Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Issue 5946: Firebug breaks Firefox UI when disabled

  • Loading branch information...
commit 122d1212c3461e4b407b0ee46a47a38f971e91cd 1 parent f95f305
Jan Odvarko authored October 03, 2012
77  extension/content/firebug/firefox/browserOverlay.js
@@ -557,6 +557,51 @@ Firebug.GlobalUI =
557 557
         });
558 558
 
559 559
         return true;
  560
+    },
  561
+
  562
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  563
+    // Page Context Menu Overlay
  564
+
  565
+    loadContextMenuOverlay: function(win)
  566
+    {
  567
+        if (typeof(win.nsContextMenu) == "undefined")
  568
+            return;
  569
+
  570
+        // https://bugzilla.mozilla.org/show_bug.cgi?id=433168
  571
+        var setTargetOriginal = this.setTargetOriginal = win.nsContextMenu.prototype.setTarget;
  572
+        win.nsContextMenu.prototype.setTarget = function(aNode, aRangeParent, aRangeOffset)
  573
+        {
  574
+            setTargetOriginal.apply(this, arguments);
  575
+
  576
+            if (this.isTargetAFormControl(aNode))
  577
+                this.shouldDisplay = true;
  578
+        };
  579
+
  580
+        // Hide built-in inspector if the pref says so.
  581
+        var initItemsOriginal = this.initItemsOriginal = win.nsContextMenu.prototype.initItems;
  582
+        win.nsContextMenu.prototype.initItems = function()
  583
+        {
  584
+            initItemsOriginal.apply(this, arguments);
  585
+
  586
+            // Hide built-in inspector menu item if the pref "extensions.firebug.hideDefaultInspector"
  587
+            // says so. Note that there is also built-in preference "devtools.inspector.enable" that
  588
+            // can be used for the same purpose.
  589
+            var hideInspect = PrefLoader.getPref("hideDefaultInspector");
  590
+            if (hideInspect)
  591
+            {
  592
+                this.showItem("inspect-separator", false);
  593
+                this.showItem("context-inspect", false);
  594
+            }
  595
+        }
  596
+    },
  597
+
  598
+    unloadContextMenuOverlay: function(win)
  599
+    {
  600
+        if (typeof(win.nsContextMenu) == "undefined")
  601
+            return;
  602
+
  603
+        win.nsContextMenu.prototype.setTarget = this.setTargetOriginal;
  604
+        win.nsContextMenu.prototype.initItems = this.initItemsOriginal;
560 605
     }
561 606
 }
562 607
 
@@ -1269,38 +1314,6 @@ if (checkFirebugVersion(PrefLoader.getPref("currentVersion")) > 0)
1269 1314
 }
1270 1315
 
1271 1316
 // ********************************************************************************************* //
1272  
-// Firefox Page Context Menu
1273  
-
1274  
-if (typeof(nsContextMenu) != "undefined")
1275  
-{
1276  
-    // https://bugzilla.mozilla.org/show_bug.cgi?id=433168
1277  
-    var setTargetOriginal = nsContextMenu.prototype.setTarget;
1278  
-    nsContextMenu.prototype.setTarget = function(aNode, aRangeParent, aRangeOffset)
1279  
-    {
1280  
-        setTargetOriginal.apply(this, arguments);
1281  
-        if (this.isTargetAFormControl(aNode))
1282  
-            this.shouldDisplay = true;
1283  
-    };
1284  
-
1285  
-    // Hide built-in inspector if the pref says so.
1286  
-    var initItemsOriginal = nsContextMenu.prototype.initItems;
1287  
-    nsContextMenu.prototype.initItems = function()
1288  
-    {
1289  
-        initItemsOriginal.apply(this, arguments);
1290  
-
1291  
-        // Hide built-in inspector menu item if the pref "extensions.firebug.hideDefaultInspector"
1292  
-        // says so. Note that there is also built-in preference "devtools.inspector.enable" that
1293  
-        // can be used for the same purpose.
1294  
-        var hideInspect = PrefLoader.getPref("hideDefaultInspector");
1295  
-        if (hideInspect)
1296  
-        {
1297  
-            this.showItem("inspect-separator", false);
1298  
-            this.showItem("context-inspect", false);
1299  
-        }
1300  
-    }
1301  
-}
1302  
-
1303  
-// ********************************************************************************************* //
1304 1317
 // All Pages Activation" is on
1305 1318
 
1306 1319
 // Load Firebug by default if activation is on for all pages (see issue 5522)
4  extension/modules/loader.js
@@ -125,6 +125,8 @@ var FirebugLoader =
125 125
                     el.parentNode.removeChild(el);
126 126
         });
127 127
 
  128
+        win.Firebug.GlobalUI.unloadContextMenuOverlay(win);
  129
+
128 130
         delete win.Firebug;
129 131
         delete win.FBTrace;
130 132
         delete win.FBL;
@@ -141,6 +143,8 @@ var FirebugLoader =
141 143
         // Apply all Firefox/SeaMonkey overlays to the browser window.
142 144
         loadSubscript("chrome://firebug/content/firefox/browserOverlay.js", win);
143 145
 
  146
+        win.Firebug.GlobalUI.loadContextMenuOverlay(win);
  147
+
144 148
         // Firebug extensions should initialize here.
145 149
         this.dispatchToScopes("topWindowLoad", [win]);
146 150
     },

0 notes on commit 122d121

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