[Pkg-mozext-commits] [adblock-plus] 402/464: Fixed: WindowObserver ignoring primary browser window if instantiated before window visible

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 20:44:38 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 6ef8a3c5a5eaf42a90003550420ded3ec7ce39d1
Author: Thomas Greiner <thomas at adblockplus.org>
Date:   Mon Sep 30 13:04:32 2013 +0200

    Fixed: WindowObserver ignoring primary browser window if instantiated before window visible
---
 lib/windowObserver.js | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/lib/windowObserver.js b/lib/windowObserver.js
index a20dd87..277c6c6 100644
--- a/lib/windowObserver.js
+++ b/lib/windowObserver.js
@@ -35,15 +35,23 @@ function WindowObserver(listener, when)
   this._listener  = listener;
   this._when = when;
 
+  let windows = [];
   let e = Services.wm.getZOrderDOMWindowEnumerator(null, true);
-  if (!e.hasMoreElements())
+  while (e.hasMoreElements())
+    windows.push(e.getNext());
+
+  // Check if there are any windows that we missed
+  let eAll = Services.ww.getWindowEnumerator();
+  while (eAll.hasMoreElements())
   {
-    // On Linux the list returned will be empty, see bug 156333. Fall back to random order.
-    e = Services.wm.getEnumerator(null);
+    let element = eAll.getNext();
+    if (windows.indexOf(element) < 0)
+      windows.push(element);
   }
-  while (e.hasMoreElements())
+  
+  for (let i = 0; i < windows.length; i++)
   {
-    let window = e.getNext().QueryInterface(Ci.nsIDOMWindow);
+    let window = windows[i].QueryInterface(Ci.nsIDOMWindow);
     if (when == "start" || window.document.readyState == "complete")
       this._listener.applyToWindow(window);
     else

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