Title: [203135] trunk/Source/WebInspectorUI
Revision
203135
Author
[email protected]
Date
2016-07-12 16:16:12 -0700 (Tue, 12 Jul 2016)

Log Message

REGRESSION(r192789): Web Inspector: Log Value context menu appears twice
https://bugs.webkit.org/show_bug.cgi?id=159681
<rdar://problem/27304804>

Patch by Joseph Pecoraro <[email protected]> on 2016-07-12
Reviewed by Brian Burg.

In r192789 contextmenu events may bubble up so that multiple handlers
may append ContextMenuItems. In nested ObjectTrees / ObjectPreviews
this could result in duplicate items. Add a flag on the bubbling event
so that we only include Object Tree context menu items for the deepest
part of the Object Tree, but still allow bubbling up to the root.

* UserInterface/Views/ObjectPreviewView.js:
(WebInspector.ObjectPreviewView.prototype._contextMenuHandler):
(WebInspector.ObjectPreviewView):
* UserInterface/Views/ObjectTreeBaseTreeElement.js:
(WebInspector.ObjectTreeBaseTreeElement.prototype._contextMenuHandler):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (203134 => 203135)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-07-12 23:14:11 UTC (rev 203134)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-07-12 23:16:12 UTC (rev 203135)
@@ -1,3 +1,23 @@
+2016-07-12  Joseph Pecoraro  <[email protected]>
+
+        REGRESSION(r192789): Web Inspector: Log Value context menu appears twice
+        https://bugs.webkit.org/show_bug.cgi?id=159681
+        <rdar://problem/27304804>
+
+        Reviewed by Brian Burg.
+
+        In r192789 contextmenu events may bubble up so that multiple handlers
+        may append ContextMenuItems. In nested ObjectTrees / ObjectPreviews
+        this could result in duplicate items. Add a flag on the bubbling event
+        so that we only include Object Tree context menu items for the deepest
+        part of the Object Tree, but still allow bubbling up to the root.
+
+        * UserInterface/Views/ObjectPreviewView.js:
+        (WebInspector.ObjectPreviewView.prototype._contextMenuHandler):
+        (WebInspector.ObjectPreviewView):
+        * UserInterface/Views/ObjectTreeBaseTreeElement.js:
+        (WebInspector.ObjectTreeBaseTreeElement.prototype._contextMenuHandler):
+
 2016-07-12  Johan K. Jensen  <[email protected]>
 
         Web Inspector: ER: Copy as cURL

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js (203134 => 203135)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js	2016-07-12 23:14:11 UTC (rev 203134)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js	2016-07-12 23:16:12 UTC (rev 203135)
@@ -270,6 +270,8 @@
     {
         let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
 
+        event.__addedObjectPreviewContextMenuItems = true;
+
         contextMenu.appendItem(WebInspector.UIString("Log Value"), () => {
             let remoteObject = this._remoteObject;
             let isImpossible = !this._propertyPath || this._propertyPath.isFullPathImpossible();

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js (203134 => 203135)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js	2016-07-12 23:14:11 UTC (rev 203134)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js	2016-07-12 23:16:12 UTC (rev 203135)
@@ -181,8 +181,15 @@
 
     _contextMenuHandler(event)
     {
+        if (event.__addedObjectPreviewContextMenuItems)
+            return;
+        if (event.__addedObjectTreeContextMenuItems)
+            return;
+
         let contextMenu = WebInspector.ContextMenu.createFromEvent(event);
 
+        event.__addedObjectTreeContextMenuItems = true;
+
         if (typeof this.treeOutline.objectTreeElementAddContextMenuItems === "function") {
             this.treeOutline.objectTreeElementAddContextMenuItems(this, contextMenu);
             if (!contextMenu.isEmpty())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to