Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: inject.preload.js

Issue 29559650: Issue 5650 - Prevent attachShadowRoot to create closed shadow root. (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Capture the original attachShadow instead. Created Sept. 29, 2017, 4:54 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: inject.preload.js
===================================================================
--- a/inject.preload.js
+++ b/inject.preload.js
@@ -133,16 +133,32 @@
let thisShadow = shadowRoot(this);
return thisShadow == ourShadowRoot ? null : thisShadow;
}
});
}
}
/*
+ * Closed shadowRoot prevention.
+ * https://issues.adblockplus.org/ticket/5650
+ */
+ if ("attachShadow" in Element.prototype)
+ {
+ let _attachShadow = Element.prototype.attachShadow;
+ Element.prototype.attachShadow = options =>
+ {
+ if (options && options.mode == "closed")
+ options.mode = "open";
+
+ return _attachShadow.call(this, options);
lainverse 2017/10/02 06:41:21 Arrow functions doesn't have their own 'this' and
+ };
+ }
+
+ /*
* Shared request checking code, used by both the WebSocket and
* RTCPeerConnection wrappers.
*/
let RealCustomEvent = window.CustomEvent;
// If we've been injected into a frame via contentWindow then we can simply
// grab the copy of checkRequest left for us by the parent document. Otherwise
// we need to set it up now, along with the event handling functions.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld