From de9fad5ec35395ed8494c1f97c3b40eb2d393125 Mon Sep 17 00:00:00 2001 From: gorhill Date: Tue, 13 Jan 2015 15:52:15 -0500 Subject: [PATCH] this fixes #464 --- src/js/contentscript-end.js | 11 ++++++++++- src/js/contentscript-start.js | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/js/contentscript-end.js b/src/js/contentscript-end.js index 6d229130d..b6bbbf0a6 100644 --- a/src/js/contentscript-end.js +++ b/src/js/contentscript-end.js @@ -31,8 +31,17 @@ /******************************************************************************/ +// https://github.com/gorhill/uBlock/issues/464 +if ( document instanceof HTMLDocument === false ) { + return false; +} + +if ( !vAPI ) { + return; +} + if ( vAPI.canExecuteContentScript() !== true ) { - throw "uBlock> contentscript-end.js > Skipping " + location.protocol; + return; } // https://github.com/gorhill/uBlock/issues/456 diff --git a/src/js/contentscript-start.js b/src/js/contentscript-start.js index 2432562c2..ab95b3427 100644 --- a/src/js/contentscript-start.js +++ b/src/js/contentscript-start.js @@ -34,6 +34,11 @@ /******************************************************************************/ +// https://github.com/gorhill/uBlock/issues/464 +if ( document instanceof HTMLDocument === false ) { + return false; +} + // Because in case if ( !vAPI ) { return;