Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Issue 5949 (Firebug cannot be opened in popup windows)

  • Loading branch information...
commit 682d6777177fe722a68b678a2b264ce408657cf9 1 parent 66652ca
Sebastian Zartner authored October 12, 2012

Showing 1 changed file with 20 additions and 12 deletions. Show diff stats Hide diff stats

  1. 32  extension/bootstrap.js
32  extension/bootstrap.js
@@ -26,6 +26,7 @@ var FIREBUG_MODULES = [
26 26
     "resource://firebug/storageService.js"
27 27
 ];
28 28
 
  29
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
29 30
 Cu.import("resource://gre/modules/Services.jsm");
30 31
 
31 32
 // ********************************************************************************************* //
@@ -69,7 +70,7 @@ function startup(params, reason)
69 70
         FirebugLoader.loadIntoWindow(enumerator.getNext());
70 71
 
71 72
     // Listen for new windows, Firebug must be loaded into them too.
72  
-    Services.ww.registerNotification(windowWatcher);
  73
+    Services.obs.addObserver(windowWatcher, "chrome-document-global-created", false);
73 74
 
74 75
     // GCLI commands
75 76
     Cu.import("resource://firebug/gcli.js");
@@ -83,7 +84,7 @@ function shutdown(params, reason)
83 84
         return;
84 85
 
85 86
     // Remove "new window" listener.
86  
-    Services.ww.unregisterNotification(windowWatcher);
  87
+    Services.obs.removeObserver(windowWatcher, "chrome-document-global-created");
87 88
 
88 89
     // remove from all windows
89 90
     try
@@ -122,17 +123,24 @@ function shutdown(params, reason)
122 123
 // ********************************************************************************************* //
123 124
 // Window Listener
124 125
 
125  
-var windowWatcher = function windowWatcher(win, topic)
  126
+var windowWatcher =
126 127
 {
127  
-    if (topic != "domwindowopened")
128  
-        return;
129  
-
130  
-    win.addEventListener("load", function onLoad()
  128
+    QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
  129
+    observe: function windowWatcher(win, topic, data)
131 130
     {
132  
-        win.removeEventListener("load", onLoad, false);
133  
-        if (win.document.documentElement.getAttribute("windowtype") == "navigator:browser")
134  
-            FirebugLoader.loadIntoWindow(win);
135  
-    }, false);
136  
-}
  131
+        if (win.location.href !== "about:blank")
  132
+        {
  133
+            // https://bugzil.la/795961 ?
  134
+            win.addEventListener("load", function onLoad(evt)
  135
+            { 
  136
+                // load listener not necessary once https://bugzil.la/800677 is fixed
  137
+                var win = evt.currentTarget;
  138
+                win.removeEventListener("load", onLoad, false);
  139
+                if (win.document.documentElement.getAttribute("windowtype") == "navigator:browser")
  140
+                    FirebugLoader.loadIntoWindow(win);
  141
+            }, false);
  142
+        }
  143
+    }
  144
+};
137 145
 
138 146
 // ********************************************************************************************* //

0 notes on commit 682d677

Please sign in to comment.
Something went wrong with that request. Please try again.