diff --git a/src/js/contentscript-end.js b/src/js/contentscript-end.js index a3134fc76..9e3e1a291 100644 --- a/src/js/contentscript-end.js +++ b/src/js/contentscript-end.js @@ -33,8 +33,13 @@ // https://github.com/chrisaljoudi/uBlock/issues/464 if ( document instanceof HTMLDocument === false ) { - //console.debug('contentscript-end.js > not a HTLMDocument'); - return; + // https://github.com/chrisaljoudi/uBlock/issues/1528 + if ( + document instanceof XMLDocument === false || + document.createElement('div') instanceof HTMLDivElement === false + ) { + return; + } } // I've seen this happens on Firefox diff --git a/src/js/contentscript-start.js b/src/js/contentscript-start.js index 6a8ceff2b..21931a3e1 100644 --- a/src/js/contentscript-start.js +++ b/src/js/contentscript-start.js @@ -36,8 +36,13 @@ // https://github.com/chrisaljoudi/uBlock/issues/464 if ( document instanceof HTMLDocument === false ) { - //console.debug('contentscript-start.js > not a HTLMDocument'); - return; + // https://github.com/chrisaljoudi/uBlock/issues/1528 + if ( + document instanceof XMLDocument === false || + document.createElement('div') instanceof HTMLDivElement === false + ) { + return; + } } // This can happen