| Index: lib/windowObserver.js | 
| =================================================================== | 
| --- a/lib/windowObserver.js | 
| +++ b/lib/windowObserver.js | 
| @@ -30,17 +30,22 @@ exports.WindowObserver = WindowObserver; | 
| *                          and "end" (default) means to wait until the "load" event. | 
| * @constructor | 
| */ | 
| function WindowObserver(listener, when) | 
| { | 
| this._listener  = listener; | 
| this._when = when; | 
|  | 
| -  let e = Services.ww.getWindowEnumerator(); | 
| +  let e = Services.wm.getZOrderDOMWindowEnumerator(null, true); | 
| +  if (!e.hasMoreElements()) | 
| +  { | 
| +    // On Linux the list returned will be empty, see bug 156333. Fall back to random order. | 
| +    e = Services.wm.getEnumerator(null); | 
| +  } | 
| while (e.hasMoreElements()) | 
| { | 
| let window = e.getNext().QueryInterface(Ci.nsIDOMWindow); | 
| if (when == "start" || window.document.readyState == "complete") | 
| this._listener.applyToWindow(window); | 
| else | 
| this.observe(window, "chrome-document-global-created", null); | 
| } | 
|  |