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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Daisuke Akatsuka 2019-01-18 16:21:43 +00:00
Родитель ecf8bd7f2d
Коммит 336d4a7b39
1 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -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);