Index: lib/windowObserver.js |
=================================================================== |
--- a/lib/windowObserver.js |
+++ b/lib/windowObserver.js |
@@ -35,15 +35,23 @@ |
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 |