Index: include.preload.js |
=================================================================== |
--- a/include.preload.js |
+++ b/include.preload.js |
@@ -196,9 +196,8 @@ |
} |
} |
-function ElementHidingTracer(document, selectors) |
+function ElementHidingTracer(selectors) |
{ |
- this.document = document; |
this.selectors = selectors; |
this.changedNodes = []; |
@@ -264,7 +263,7 @@ |
// Forget previously changed nodes that are no longer in the DOM. |
for (var i = 0; i < this.changedNodes.length; i++) |
{ |
- if (!this.document.contains(this.changedNodes[i])) |
+ if (!document.contains(this.changedNodes[i])) |
this.changedNodes.splice(i--, 1); |
} |
@@ -274,7 +273,7 @@ |
var node = mutation.target; |
// Ignore mutations of nodes that aren't in the DOM anymore. |
- if (!this.document.contains(node)) |
+ if (!document.contains(node)) |
continue; |
// Since querySelectorAll() doesn't consider the root itself |
@@ -317,10 +316,10 @@ |
trace: function() |
{ |
- this.checkNodes([this.document]); |
+ this.checkNodes([document]); |
this.observer.observe( |
- this.document, |
+ document, |
{ |
childList: true, |
attributes: true, |
@@ -331,13 +330,13 @@ |
disconnect: function() |
{ |
- this.document.removeEventListener("DOMContentLoaded", this.trace); |
+ document.removeEventListener("DOMContentLoaded", this.trace); |
this.observer.disconnect(); |
clearTimeout(this.timeout); |
} |
}; |
-function runInDocument(document, fn, arg) |
+function runInDocument(fn, arg) |
{ |
var script = document.createElement("script"); |
script.type = "application/javascript"; |
@@ -352,7 +351,7 @@ |
// us. As a workaround we wrap WebSocket, preventing blocked WebSocket |
// connections from being opened. |
// [1] - https://bugs.chromium.org/p/chromium/issues/detail?id=129353 |
-function wrapWebSocket(document) |
+function wrapWebSocket() |
{ |
if (typeof WebSocket == "undefined") |
return; |
@@ -372,7 +371,7 @@ |
}); |
}); |
- runInDocument(document, function(eventName) |
+ runInDocument(function(eventName) |
{ |
// As far as possible we must track everything we use that could be |
// sabotaged by the website later in order to circumvent us. |
@@ -432,14 +431,14 @@ |
}, eventName); |
} |
-function init(document) |
+function init() |
{ |
var shadow = null; |
var style = null; |
var observer = null; |
var tracer = null; |
- wrapWebSocket(document); |
+ wrapWebSocket(); |
function getPropertyFilters(callback) |
{ |
@@ -468,7 +467,7 @@ |
// Stop the website from messing with our shadowRoot |
if ("shadowRoot" in Element.prototype) |
{ |
- runInDocument(document, function() |
+ runInDocument(function() |
{ |
var ourShadowRoot = document.documentElement.shadowRoot; |
var desc = Object.getOwnPropertyDescriptor(Element.prototype, "shadowRoot"); |
@@ -560,7 +559,7 @@ |
propertyFilters.apply(); |
if (selectors.trace) |
- tracer = new ElementHidingTracer(document, selectors.selectors); |
+ tracer = new ElementHidingTracer(selectors.selectors); |
}; |
ext.backgroundPage.sendMessage({type: "get-selectors"}, function(response) |
@@ -586,28 +585,8 @@ |
document.addEventListener("load", function(event) |
{ |
var element = event.target; |
- |
if (/^i?frame$/.test(element.localName)) |
checkCollapse(element); |
- |
- if (/\bChrome\//.test(navigator.userAgent)) |
- { |
- var contentDocument = getContentDocument(element); |
- if (contentDocument) |
- { |
- var contentWindow = contentDocument.defaultView; |
- if (contentDocument instanceof contentWindow.HTMLDocument) |
- { |
- // Prior to Chrome 37, content scripts cannot run in |
- // dynamically created frames. Also on Chrome 37-40 |
- // document_start content scripts (like this one) don't |
- // run either in those frames due to https://crbug.com/416907. |
- // So we have to apply element hiding from the parent frame. |
- if (!("init" in contentWindow)) |
- init(contentDocument); |
- } |
- } |
- } |
}, true); |
return updateStylesheet; |
@@ -616,5 +595,5 @@ |
if (document instanceof HTMLDocument) |
{ |
checkSitekey(); |
- window.updateStylesheet = init(document); |
+ window.updateStylesheet = init(); |
} |