Last Comment Bug 688595 - Hide Inspect Element context menu items if not enabled
: Hide Inspect Element context menu items if not enabled
Status: RESOLVED FIXED
:
Product: Firefox
Classification: Client Software
Component: Developer Tools (show other bugs)
: unspecified
: x86 Mac OS X
: -- normal (vote)
: Firefox 9
Assigned To: Rob Campbell [:rc] (:robcee)
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-22 13:27 PDT by Rob Campbell [:rc] (:robcee)
Modified: 2011-09-23 15:47 PDT (History)
0 users
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
[in-fx-team] inspect menu hiding (4.19 KB, patch)
2011-09-22 13:28 PDT, Rob Campbell [:rc] (:robcee)
gavin.sharp: review+
Details | Diff | Splinter Review

Description Rob Campbell [:rc] (:robcee) 2011-09-22 13:27:05 PDT
I noticed the Inspect Element context menu items are not hidden by default and rely on InspectorUI.enabled which breaks in a subsequent patch. I've added a check against the preference in the context menu's showItem code.
Comment 1 Rob Campbell [:rc] (:robcee) 2011-09-22 13:28:22 PDT
Created attachment 561861 [details] [diff] [review]
[in-fx-team] inspect menu hiding
Comment 2 :Gavin Sharp [email: gavin@gavinsharp.com] 2011-09-22 17:19:39 PDT
Comment on attachment 561861 [details] [diff] [review]
[in-fx-team] inspect menu hiding

>diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js

>+    document.getElementById("inspect-separator").hidden = false;
>+    document.getElementById("context-inspect").hidden = false;

Shouldn't need this, since the context menu code runs on every show anyways.

>diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js

>+    var showInspect = Cc["@mozilla.org/preferences-service;1"]
>+           .getService(Ci.nsIPrefService)
>+           .QueryInterface(Ci.nsIPrefBranch2)
>+           .getBoolPref("devtools.inspector.enabled");

Use gPrefService.getBoolPref()

r=me with both of those changes made
Comment 3 Rob Campbell [:rc] (:robcee) 2011-09-23 15:30:42 PDT
Comment on attachment 561861 [details] [diff] [review]
[in-fx-team] inspect menu hiding

https://hg.mozilla.org/integration/fx-team/rev/7d5311c92e04
Comment 4 Rob Campbell [:rc] (:robcee) 2011-09-23 15:47:57 PDT
https://hg.mozilla.org/mozilla-central/rev/7d5311c92e04

Note You need to log in before you can comment on or make changes to this bug.