[Pkg-mozext-commits] [adblock-plus] 215/464: WindowObserver: On initialization, don't assume that existing windows are ready

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 20:44:18 UTC 2014


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

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

commit a85e455f0edd76a88a762bc28ba01305643f48a2
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Tue Jan 24 16:23:48 2012 +0100

    WindowObserver: On initialization, don't assume that existing windows are ready
---
 windowObserver.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/windowObserver.js b/windowObserver.js
index fbe4970..5f62352 100644
--- a/windowObserver.js
+++ b/windowObserver.js
@@ -26,7 +26,13 @@ function WindowObserver(listener, when)
 
   let e = Services.ww.getWindowEnumerator();
   while (e.hasMoreElements())
-    this._listener.applyToWindow(e.getNext().QueryInterface(Ci.nsIDOMWindow));
+  {
+    let window = e.getNext().QueryInterface(Ci.nsIDOMWindow);
+    if (when == "start" || window.document.readyState == "complete")
+      this._listener.applyToWindow(window);
+    else
+      this.observe(window, "domwindowopened", null);
+  }
 
   Services.ww.registerNotification(this);
 

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