1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-15 07:22:28 +02:00
An XML document can be a valid HTML document. Try to instanciate
a HTMLDivElement to find out whether we are dealing with an actual
HTML document or not.
This commit is contained in:
gorhill 2015-08-28 10:33:58 -04:00
parent 3dd19b7708
commit 1a380f0959
2 changed files with 14 additions and 4 deletions

View File

@ -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

View File

@ -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