Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Issue 5946: Firebug breaks Firefox UI when disabled

  • Loading branch information...
commit 4b065d180414648f047a35f42968ceabc13c0ccd 1 parent e2501af
@janodvarko janodvarko authored
View
77 extension/content/firebug/firefox/browserOverlay.js
@@ -557,6 +557,51 @@ Firebug.GlobalUI =
});
return true;
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Page Context Menu Overlay
+
+ loadContextMenuOverlay: function(win)
+ {
+ if (typeof(win.nsContextMenu) == "undefined")
+ return;
+
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=433168
+ var setTargetOriginal = this.setTargetOriginal = win.nsContextMenu.prototype.setTarget;
+ win.nsContextMenu.prototype.setTarget = function(aNode, aRangeParent, aRangeOffset)
+ {
+ setTargetOriginal.apply(this, arguments);
+
+ if (this.isTargetAFormControl(aNode))
+ this.shouldDisplay = true;
+ };
+
+ // Hide built-in inspector if the pref says so.
+ var initItemsOriginal = this.initItemsOriginal = win.nsContextMenu.prototype.initItems;
+ win.nsContextMenu.prototype.initItems = function()
+ {
+ initItemsOriginal.apply(this, arguments);
+
+ // Hide built-in inspector menu item if the pref "extensions.firebug.hideDefaultInspector"
+ // says so. Note that there is also built-in preference "devtools.inspector.enable" that
+ // can be used for the same purpose.
+ var hideInspect = PrefLoader.getPref("hideDefaultInspector");
+ if (hideInspect)
+ {
+ this.showItem("inspect-separator", false);
+ this.showItem("context-inspect", false);
+ }
+ }
+ },
+
+ unloadContextMenuOverlay: function(win)
+ {
+ if (typeof(win.nsContextMenu) == "undefined")
+ return;
+
+ win.nsContextMenu.prototype.setTarget = this.setTargetOriginal;
+ win.nsContextMenu.prototype.initItems = this.initItemsOriginal;
}
}
@@ -1269,38 +1314,6 @@ if (checkFirebugVersion(PrefLoader.getPref("currentVersion")) > 0)
}
// ********************************************************************************************* //
-// Firefox Page Context Menu
-
-if (typeof(nsContextMenu) != "undefined")
-{
- // https://bugzilla.mozilla.org/show_bug.cgi?id=433168
- var setTargetOriginal = nsContextMenu.prototype.setTarget;
- nsContextMenu.prototype.setTarget = function(aNode, aRangeParent, aRangeOffset)
- {
- setTargetOriginal.apply(this, arguments);
- if (this.isTargetAFormControl(aNode))
- this.shouldDisplay = true;
- };
-
- // Hide built-in inspector if the pref says so.
- var initItemsOriginal = nsContextMenu.prototype.initItems;
- nsContextMenu.prototype.initItems = function()
- {
- initItemsOriginal.apply(this, arguments);
-
- // Hide built-in inspector menu item if the pref "extensions.firebug.hideDefaultInspector"
- // says so. Note that there is also built-in preference "devtools.inspector.enable" that
- // can be used for the same purpose.
- var hideInspect = PrefLoader.getPref("hideDefaultInspector");
- if (hideInspect)
- {
- this.showItem("inspect-separator", false);
- this.showItem("context-inspect", false);
- }
- }
-}
-
-// ********************************************************************************************* //
// All Pages Activation" is on
// Load Firebug by default if activation is on for all pages (see issue 5522)
View
4 extension/modules/loader.js
@@ -125,6 +125,8 @@ var FirebugLoader =
el.parentNode.removeChild(el);
});
+ win.Firebug.GlobalUI.unloadContextMenuOverlay(win);
+
delete win.Firebug;
delete win.FBTrace;
delete win.FBL;
@@ -141,6 +143,8 @@ var FirebugLoader =
// Apply all Firefox/SeaMonkey overlays to the browser window.
loadSubscript("chrome://firebug/content/firefox/browserOverlay.js", win);
+ win.Firebug.GlobalUI.loadContextMenuOverlay(win);
+
// Firebug extensions should initialize here.
this.dispatchToScopes("topWindowLoad", [win]);
},
Please sign in to comment.
Something went wrong with that request. Please try again.