Bug 1495944: Show/Hide 'Inspect Element' item in content context menu. r=jdescottes
☠☠ backed out by fd6b8be34aed ☠ ☠
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Thu, 17 Jan 2019 06:59:17 +0000
changeset 511474 f78876cf49e649cd99dbe806a01225e2f856924d
parent 511473 85f355a22192c5ccba2a05c8684e2f04cc7b988e
child 511475 7862a0a1c3ec0ce425f027acf718aa946c324312
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1495944, 1515265
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
browser/base/content/nsContextMenu.js
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -420,22 +420,31 @@ nsContextMenu.prototype = {
     this.setItemAttr("context-sendaudio", "disabled", !this.mediaURL || mediaIsBlob);
   },
 
   initViewItems: function CM_initViewItems() {
     // View source is always OK, unless in directory listing.
     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);
 
     var showInspectA11Y = showInspect &&
                           // Only when accessibility service started.
                           Services.appinfo.accessibilityEnabled &&
                           this.inTabBrowser &&
                           Services.prefs.getBoolPref("devtools.enabled", true) &&