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

Unified Diff: lib/windowObserver.js

Issue 8684120: Fixed: Topic 11234 - toolbar icon not shown in popup windows (Closed)
Patch Set: Created Oct. 30, 2012, 5:12 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld