Bug 14324 - Cannot remove/customize the "Inspect Element" contextual menu item
Summary: Cannot remove/customize the "Inspect Element" contextual menu item
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 523.x (Safari 3)
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Adam Roben (:aroben)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-22 17:34 PDT by Ian Cely
Modified: 2007-07-17 14:19 PDT (History)
0 users

See Also:


Attachments
Patch 1/3 (5.57 KB, patch)
2007-07-06 17:05 PDT, Adam Roben (:aroben)
timothy: review+
Details | Formatted Diff | Diff
Patch 2/3 (10.26 KB, patch)
2007-07-06 17:06 PDT, Adam Roben (:aroben)
timothy: review+
Details | Formatted Diff | Diff
Patch 3/3 (8.43 KB, patch)
2007-07-06 17:06 PDT, Adam Roben (:aroben)
timothy: review+
Details | Formatted Diff | Diff
Patch 1.5/3 (3.23 KB, patch)
2007-07-17 14:00 PDT, Adam Roben (:aroben)
timothy: review+
Details | Formatted Diff | Diff
new Patch 3/3 (12.61 KB, patch)
2007-07-17 14:01 PDT, Adam Roben (:aroben)
timothy: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Cely 2007-06-22 17:34:41 PDT
The "Inspect Element" menu item gets added to the menu *after* the UIDelegate has been given a chance to customize the menu.  This behavior makes it impossible for client applications to remove or modify this menu item on a per view basis (of course this can be disabled at the application scope via a preference).  In addition the tag for the "Inspect Element" menu item would need to be exposed to the client API.
Comment 1 Timothy Hatcher 2007-06-22 20:27:18 PDT
We should have a way to let the client change this. But we also want the control to force it in there so debugging client apps can still be done, event if the UI delegate removes all menu items blindly.
Comment 2 Adam Roben (:aroben) 2007-06-23 21:54:28 PDT
(In reply to comment #1)
> We should have a way to let the client change this. But we also want the
> control to force it in there so debugging client apps can still be done, event
> if the UI delegate removes all menu items blindly.

Perhaps this is as simple as adding the item to the menu before it is passed up to the UI delegate in Release builds, and adding it afterwards in Debug builds?
Comment 3 Adam Roben (:aroben) 2007-07-06 17:05:43 PDT
Created attachment 15425 [details]
Patch 1/3

Adds Settings::developerMenuExtrasEnabled
Comment 4 Adam Roben (:aroben) 2007-07-06 17:06:15 PDT
Created attachment 15426 [details]
Patch 2/3

Remove ContextMenuClient::shouldIncludeInspectElementItem
Comment 5 Adam Roben (:aroben) 2007-07-06 17:06:45 PDT
Created attachment 15427 [details]
Patch 3/3

Pass the Inspect Element item up to the UI delegate.
Comment 6 Adam Roben (:aroben) 2007-07-06 17:07:38 PDT
I decided to fix a FIXME in ContextMenuController while I was at it (patches 1 and 2). Patch 3 actually fixes the bug.
Comment 7 Adam Roben (:aroben) 2007-07-14 20:46:04 PDT
I suspect these patches cause Safari on Windows to not show the Inspect Element context menu item, though I haven't gotten to test this theory yet. Please don't land these patches yet.
Comment 8 Adam Roben (:aroben) 2007-07-17 14:00:15 PDT
Created attachment 15553 [details]
Patch 1.5/3

Here's a pretty important patch that somehow got left out.
Comment 9 Adam Roben (:aroben) 2007-07-17 14:01:05 PDT
Created attachment 15555 [details]
new Patch 3/3

This patch fixes up Windows so that the Inspect Element item will still show up.
Comment 10 Adam Roben (:aroben) 2007-07-17 14:19:51 PDT
Landed as r24378-r24381