Bug 1356244 - use DevToolsShim in nsContextMenu draft
authorJulian Descottes <jdescottes@mozilla.com>
Mon, 24 Apr 2017 09:20:21 +0200
changeset 567008 ca9e5f5b8680f58fe97a496a31e5b83104b326a2
parent 567007 dcb0da4bf86ac1f3a1504973aba904888c0a0f90
child 567009 a95b13f7542f42b21809f1af795e9096091aabc7
push id55407
push userjdescottes@mozilla.com
push dateMon, 24 Apr 2017 09:44:49 +0000
bugs1356244
milestone55.0a1
Bug 1356244 - use DevToolsShim in nsContextMenu MozReview-Commit-ID: 2SrNcC8Fbes
browser/base/content/nsContextMenu.js
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -12,16 +12,19 @@ Components.utils.import("resource://gre/
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 Components.utils.import("resource://gre/modules/Services.jsm");
 
 
 XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper",
   "resource://gre/modules/LoginHelper.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "WebNavigationFrames",
   "resource://gre/modules/WebNavigationFrames.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "DevToolsShim",
+  "chrome://devtools-shim/content/DevToolsShim.jsm");
+
 
 var gContextMenuContentData = null;
 
 function openContextMenu(aMessage) {
   let data = aMessage.data;
   let browser = aMessage.target;
 
   let spellInfo = data.spellInfo;
@@ -285,17 +288,19 @@ nsContextMenu.prototype = {
                   this.isContentSelected);
     this.showItem("context-viewpartialsource-mathml",
                   this.onMathML && !this.isContentSelected);
 
     var shouldShow = !(this.isContentSelected ||
                        this.onImage || this.onCanvas ||
                        this.onVideo || this.onAudio ||
                        this.onLink || this.onTextInput);
-    var showInspect = !this.onSocial && gPrefService.getBoolPref("devtools.inspector.enabled");
+    var showInspect = !this.onSocial
+                      && DevToolsShim.isInstalled()
+                      && gPrefService.getBoolPref("devtools.inspector.enabled");
     this.showItem("context-viewsource", shouldShow);
     this.showItem("context-viewinfo", shouldShow);
     this.showItem("inspect-separator", showInspect);
     this.showItem("context-inspect", showInspect);
 
     this.showItem("context-sep-viewsource", shouldShow);
 
     // Set as Desktop background depends on whether an image was clicked on,