diff --git a/lib/frame.js b/lib/frame.js index 49a2d17..9beb070 100644 --- a/lib/frame.js +++ b/lib/frame.js @@ -83,6 +83,16 @@ return false; } + try { + var href = window.location.href; + } + catch (e){ + // we are unable to read the location due to SOP + // therefore we also can not intercept anything. + log("NOT intercepting window du to SOP", window); + return false; + } + log("intercepting window", window); intercept( {subject: window}, diff --git a/lib/intercept.js b/lib/intercept.js index a942c8c..30433c6 100644 --- a/lib/intercept.js +++ b/lib/intercept.js @@ -32,7 +32,16 @@ scope.setRandomSupplyByType = setRandomSupplyByType; function getURL(window){ - if (!window.location.href || window.location.href === "about:blank"){ + var href; + try { + href = window.location.href; + } + catch (e){ + // unable to read location due to SOP + // since we are not able to do anything in that case we can allow everything + return "about:SOP"; + } + if (!href || href === "about:blank"){ if (window !== window.parent){ return getURL(window.parent); }