Title: [250580] trunk/Source/WebInspectorUI
Revision
250580
Author
[email protected]
Date
2019-10-01 13:41:32 -0700 (Tue, 01 Oct 2019)

Log Message

Web Inspector: Sources: clicking on a breakpoint changes the path components to not match the script's path
https://bugs.webkit.org/show_bug.cgi?id=196450
<rdar://problem/49488100>

Reviewed by Matt Baker.

When selecting any tree element that isn't in the resources tree outline, attempt to find
the corresponding tree element in the resources tree outline and silently select that as
well so that the hierarchical path component shows the right breadcrumb trail.

If the tree element is for a `WI.Script` which has a corresponding `WI.Resource`, use the
`WI.Resource` instead.

* UserInterface/Views/SourcesNavigationSidebarPanel.js:
(WI.SourcesNavigationSidebarPanel.prototype._handleTreeSelectionDidChange):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (250579 => 250580)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-10-01 20:35:50 UTC (rev 250579)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-10-01 20:41:32 UTC (rev 250580)
@@ -1,3 +1,21 @@
+2019-10-01  Devin Rousso  <[email protected]>
+
+        Web Inspector: Sources: clicking on a breakpoint changes the path components to not match the script's path
+        https://bugs.webkit.org/show_bug.cgi?id=196450
+        <rdar://problem/49488100>
+
+        Reviewed by Matt Baker.
+
+        When selecting any tree element that isn't in the resources tree outline, attempt to find
+        the corresponding tree element in the resources tree outline and silently select that as
+        well so that the hierarchical path component shows the right breadcrumb trail.
+
+        If the tree element is for a `WI.Script` which has a corresponding `WI.Resource`, use the
+        `WI.Resource` instead.
+
+        * UserInterface/Views/SourcesNavigationSidebarPanel.js:
+        (WI.SourcesNavigationSidebarPanel.prototype._handleTreeSelectionDidChange):
+
 2019-09-30  Devin Rousso  <[email protected]>
 
         Web Inspector: JS Formatter: unexpected newlines added inside template string _expression_

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js (250579 => 250580)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js	2019-10-01 20:35:50 UTC (rev 250579)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js	2019-10-01 20:41:32 UTC (rev 250580)
@@ -1681,6 +1681,19 @@
             return;
         }
 
+        // Silently select the corresponding tree element in the resources tree outline to update
+        // the hierarchical path components to show the right ancestor(s).
+        let selectTreeElementInResourcesTreeOutline = (sourceCode) => {
+            let resourceTreeElement = this._resourcesTreeOutline.findTreeElement(sourceCode);
+            if (!resourceTreeElement)
+                return;
+
+            const omitFocus = true;
+            const selectedByUser = false;
+            const suppressNotification = true;
+            resourceTreeElement.select(omitFocus, selectedByUser, suppressNotification);
+        };
+
         if (treeElement instanceof WI.FolderTreeElement
             || treeElement instanceof WI.OriginTreeElement
             || treeElement instanceof WI.ResourceTreeElement
@@ -1687,6 +1700,13 @@
             || treeElement instanceof WI.ScriptTreeElement
             || treeElement instanceof WI.CSSStyleSheetTreeElement) {
             let representedObject = treeElement.representedObject;
+
+            if (representedObject instanceof WI.Script && representedObject.resource)
+                representedObject = representedObject.resource;
+
+            if (treeElement.treeOutline !== this._resourcesTreeOutline)
+                selectTreeElementInResourcesTreeOutline(representedObject);
+
             if (representedObject instanceof WI.Collection || representedObject instanceof WI.SourceCode || representedObject instanceof WI.Frame)
                 WI.showRepresentedObject(representedObject);
             return;
@@ -1711,18 +1731,13 @@
             if (WI.debuggerManager.isBreakpointSpecial(breakpoint))
                 return;
 
-            if (treeElement.treeOutline === this._pauseReasonTreeOutline) {
-                WI.showSourceCodeLocation(breakpoint.sourceCodeLocation);
-                return;
-            }
+            let sourceCode = breakpoint.sourceCodeLocation.displaySourceCode;
+            if (sourceCode instanceof WI.Script && sourceCode.resource)
+                sourceCode = sourceCode.resource;
+            selectTreeElementInResourcesTreeOutline(sourceCode);
 
-            if (treeElement.parent.representedObject) {
-                console.assert(treeElement.parent.representedObject instanceof WI.SourceCode);
-                if (treeElement.parent.representedObject instanceof WI.SourceCode) {
-                    WI.showSourceCodeLocation(breakpoint.sourceCodeLocation);
-                    return;
-                }
-            }
+            WI.showSourceCodeLocation(breakpoint.sourceCodeLocation);
+            return;
         }
 
         console.error("Unknown tree element", treeElement);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to