[Pkg-mozext-commits] [adblock-plus] 26/98: Issue 4251 - Fixed hang trying to apply element hiding rules to blocked frames

David Prévot taffit at moszumanska.debian.org
Tue Oct 24 01:30:14 UTC 2017


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus.

commit a0c46e46752fee456b054595eb651a14553359c9
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Tue Jul 19 18:20:31 2016 +0200

    Issue 4251 - Fixed hang trying to apply element hiding rules to blocked frames
---
 lib/child/elemHide.js | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/lib/child/elemHide.js b/lib/child/elemHide.js
index 0c6f411..24269c8 100644
--- a/lib/child/elemHide.js
+++ b/lib/child/elemHide.js
@@ -328,12 +328,17 @@ let observer = {
     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);
       return;
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list