LEFT | RIGHT |
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-2012 Eyeo GmbH | 3 * Copyright (C) 2006-2012 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 if (!this._shutdownHandler) | 68 if (!this._shutdownHandler) |
69 return; | 69 return; |
70 | 70 |
71 onShutdown.remove(this._shutdownHandler); | 71 onShutdown.remove(this._shutdownHandler); |
72 this._shutdownHandler(); | 72 this._shutdownHandler(); |
73 this._shutdownHandler = null; | 73 this._shutdownHandler = null; |
74 }, | 74 }, |
75 | 75 |
76 observe: function(subject, topic, data) | 76 observe: function(subject, topic, data) |
77 { | 77 { |
78 // Make sure page is not about:blank (work-around for bug 795961) | |
79 if (topic == "chrome-document-global-created") | 78 if (topic == "chrome-document-global-created") |
80 { | 79 { |
81 let window = subject.QueryInterface(Ci.nsIDOMWindow); | 80 let window = subject.QueryInterface(Ci.nsIDOMWindow); |
82 if (this._when == "start") | 81 if (this._when == "start") |
83 { | 82 { |
84 this._listener.applyToWindow(window); | 83 this._listener.applyToWindow(window); |
85 return; | 84 return; |
86 } | 85 } |
87 | 86 |
88 let event = (this._when == "ready" ? "DOMContentLoaded" : "load"); | 87 let event = (this._when == "ready" ? "DOMContentLoaded" : "load"); |
89 let listener = function() | 88 let listener = function() |
90 { | 89 { |
91 window.removeEventListener(event, listener, false); | 90 window.removeEventListener(event, listener, false); |
92 if (this._shutdownHandler) | 91 if (this._shutdownHandler) |
93 this._listener.applyToWindow(window); | 92 this._listener.applyToWindow(window); |
94 }.bind(this); | 93 }.bind(this); |
95 window.addEventListener(event, listener, false); | 94 window.addEventListener(event, listener, false); |
96 } | 95 } |
97 }, | 96 }, |
98 | 97 |
99 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
rver]) | 98 QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObse
rver]) |
100 }; | 99 }; |
LEFT | RIGHT |