Index: lib/windowObserver.js |
=================================================================== |
--- a/lib/windowObserver.js |
+++ b/lib/windowObserver.js |
@@ -34,7 +34,7 @@ |
this.observe(window, "domwindowopened", null); |
} |
- Services.ww.registerNotification(this); |
+ Services.obs.addObserver(this, "chrome-document-global-created", false); |
Wladimir Palant
2012/10/30 17:20:21
Please use weak references just in case. Meaning t
|
this._shutdownHandler = function() |
{ |
@@ -42,7 +42,7 @@ |
while (e.hasMoreElements()) |
this._listener.removeFromWindow(e.getNext().QueryInterface(Ci.nsIDOMWindow)); |
- Services.ww.unregisterNotification(this); |
+ Services.obs.removeObserver(this, "chrome-document-global-created"); |
}.bind(this); |
onShutdown.add(this._shutdownHandler); |
} |
@@ -51,6 +51,7 @@ |
_listener: null, |
_when: null, |
_shutdownHandler: null, |
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), |
shutdown: function() |
{ |
@@ -64,7 +65,7 @@ |
observe: function(subject, topic, data) |
{ |
- if (topic == "domwindowopened") |
+ if (subject.location.href !== "about:blank") |
Wladimir Palant
2012/10/30 17:20:21
Please check |subject instanceof Ci.nsIDOMWindow|
Wladimir Palant
2012/10/30 18:52:22
Forgot to mention: there should be a link to Bugzi
|
{ |
if (this._when == "start") |
{ |
@@ -77,7 +78,7 @@ |
let listener = function() |
{ |
window.removeEventListener(event, listener, false); |
- if (this._shutdownHandler) |
+ if (this._shutdownHandler && window.document.documentElement.getAttribute("windowtype") == "navigator:browser") |
Wladimir Palant
2012/10/30 17:20:21
Is this debug code? Please remove.
|
this._listener.applyToWindow(window); |
}.bind(this); |
window.addEventListener(event, listener, false); |