Bug 1495944: Show/Hide 'Inspect Element' item in content context menu. r=jdescottes

This patch removes "Inspect Element" menu item from content context menu in
case that about:devtools-toolbox are opening.
However, we may be able to remove after fixing 1515265.

Depends on D16684

Differential Revision: https://phabricator.services.mozilla.com/D16685
This commit is contained in:
Daisuke Akatsuka
2019-01-18 16:21:43 +00:00
parent e2a5c2e2b4
commit f89726c3bd

View File

@@ -425,12 +425,21 @@ nsContextMenu.prototype = {
this.showItem("context-viewpartialsource-selection",
this.isContentSelected);
const {gBrowser} = this.browser.ownerGlobal;
// Hide menu that opens devtools when the window is showing `about:devtools-toolbox`.
// This is to avoid displaying multiple devtools at the same time. See bug 1495944.
const isAboutDevtoolsToolbox = gBrowser &&
gBrowser.currentURI &&
gBrowser.currentURI.scheme === "about" &&
gBrowser.currentURI.filePath === "devtools-toolbox";
var shouldShow = !(this.isContentSelected ||
this.onImage || this.onCanvas ||
this.onVideo || this.onAudio ||
this.onLink || this.onTextInput);
var showInspect = this.inTabBrowser &&
!isAboutDevtoolsToolbox &&
Services.prefs.getBoolPref("devtools.inspector.enabled", true) &&
!Services.prefs.getBoolPref("devtools.policy.disabled", false);