Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/windowObserver.js

Issue 11624001: Fixed: WindowObserver ignoring primary browser window if instantiated before window visible (Closed)
Patch Set: Created Sept. 5, 2013, 3:44 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of the Adblock Plus build tools, 2 * This file is part of the Adblock Plus build tools,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 17 matching lines...) Expand all
28 * @param {String} [when] when to execute applyToWindow(). "start" means immed iately 28 * @param {String} [when] when to execute applyToWindow(). "start" means immed iately
29 * when the window opens, "ready" when its contents are available 29 * when the window opens, "ready" when its contents are available
30 * and "end" (default) means to wait until the "load" e vent. 30 * and "end" (default) means to wait until the "load" e vent.
31 * @constructor 31 * @constructor
32 */ 32 */
33 function WindowObserver(listener, when) 33 function WindowObserver(listener, when)
34 { 34 {
35 this._listener = listener; 35 this._listener = listener;
36 this._when = when; 36 this._when = when;
37 37
38 let e = Services.wm.getZOrderDOMWindowEnumerator(null, true); 38 let e = Services.ww.getWindowEnumerator();
Wladimir Palant 2013/09/09 08:04:22 You are reverting the change I made for https://bu
39 if (!e.hasMoreElements())
40 {
41 // On Linux the list returned will be empty, see bug 156333. Fall back to ra ndom order.
42 e = Services.wm.getEnumerator(null);
43 }
44 while (e.hasMoreElements()) 39 while (e.hasMoreElements())
45 { 40 {
46 let window = e.getNext().QueryInterface(Ci.nsIDOMWindow); 41 let window = e.getNext().QueryInterface(Ci.nsIDOMWindow);
47 if (when == "start" || window.document.readyState == "complete") 42 if (when == "start" || window.document.readyState == "complete")
48 this._listener.applyToWindow(window); 43 this._listener.applyToWindow(window);
49 else 44 else
50 this.observe(window, "chrome-document-global-created", null); 45 this.observe(window, "chrome-document-global-created", null);
51 } 46 }
52 47
53 Services.obs.addObserver(this, "chrome-document-global-created", true); 48 Services.obs.addObserver(this, "chrome-document-global-created", true);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 window.removeEventListener(event, listener, false); 90 window.removeEventListener(event, listener, false);
96 if (this._shutdownHandler) 91 if (this._shutdownHandler)
97 this._listener.applyToWindow(window); 92 this._listener.applyToWindow(window);
98 }.bind(this); 93 }.bind(this);
99 window.addEventListener(event, listener, false); 94 window.addEventListener(event, listener, false);
100 } 95 }
101 }, 96 },
102 97
103 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse rver]) 98 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse rver])
104 }; 99 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld