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

Unified Diff: lib/child/elemHide.js

Issue 29348026: Issue 4251 - Fixed hang trying to apply element hiding rules to blocked frames (Closed)
Patch Set: Created July 19, 2016, 4:19 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: lib/child/elemHide.js
===================================================================
--- a/lib/child/elemHide.js
+++ b/lib/child/elemHide.js
@@ -323,22 +323,27 @@ let observer = {
observe: function(subject, topic, data)
{
if (topic != this.topic)
return;
if (subject.document.readyState == "uninitialized")
{
// It would be nice to listen to the readystatechange event here. However,
- // it doesn't fire when changing from "uninitialized" state.
- Utils.runAsync(() =>
+ // adding event listeners on uninitialized documents isn't possible. So
+ // we listen for DOMContentLoaded and beforescriptexecute - whichever
+ // fires first.
+ let listener = () =>
{
- if (!Cu.isDeadWrapper(subject))
- this.observe(subject, topic, data);
- });
+ subject.removeEventListener("DOMContentLoaded", listener);
+ subject.removeEventListener("beforescriptexecute", listener);
+ this.observe(subject, topic, data);
+ };
+ subject.addEventListener("DOMContentLoaded", listener);
+ subject.addEventListener("beforescriptexecute", listener);
Wladimir Palant 2016/07/19 16:23:25 For reference, DOMContentLoaded fires too late - w
return;
}
port.emitWithResponse("elemhideEnabled", {
frames: getFrames(subject),
isPrivate: isPrivate(subject)
}).then(({
enabled, contentType, docDomain, thirdParty, location, filter,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld