Bug 14324

Summary: Cannot remove/customize the "Inspect Element" contextual menu item
Product: WebKit Reporter: Ian Cely <ian>
Component: Web Inspector (Deprecated)Assignee: Adam Roben (:aroben) <aroben>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 523.x (Safari 3)   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Patch 1/3
timothy: review+
Patch 2/3
timothy: review+
Patch 3/3
timothy: review+
Patch 1.5/3
timothy: review+
new Patch 3/3 timothy: review+

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