Web Inspector: Sources: "Reveal in Resources Tab" still shown when Sources tab is...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Mar 2019 22:19:38 +0000 (22:19 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Mar 2019 22:19:38 +0000 (22:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196134

Reviewed by Joseph Pecoraro.

* UserInterface/Views/RecordingActionTreeElement.js:
(WI.RecordingActionTreeElement.prototype.populateContextMenu):
Drive-by: find the first call frame that has a source code location, rather than naively
always using the top call frame.

* UserInterface/Views/SearchResultTreeElement.js:
(WI.SearchResultTreeElement.prototype.populateContextMenu):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243403 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/RecordingActionTreeElement.js
Source/WebInspectorUI/UserInterface/Views/SearchResultTreeElement.js

index ba61479..67b1eb2 100644 (file)
@@ -1,3 +1,18 @@
+2019-03-22  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Sources: "Reveal in Resources Tab" still shown when Sources tab is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=196134
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/RecordingActionTreeElement.js:
+        (WI.RecordingActionTreeElement.prototype.populateContextMenu):
+        Drive-by: find the first call frame that has a source code location, rather than naively
+        always using the top call frame.
+
+        * UserInterface/Views/SearchResultTreeElement.js:
+        (WI.SearchResultTreeElement.prototype.populateContextMenu):
+
 2019-03-22  Keith Rollin  <krollin@apple.com>
 
         Enable ThinLTO support in Production builds
index 1860132..05fbc55 100644 (file)
@@ -428,10 +428,22 @@ WI.RecordingActionTreeElement = class RecordingActionTreeElement extends WI.Gene
 
         contextMenu.appendSeparator();
 
-        let callFrame = this.representedObject.trace[0];
-        if (callFrame) {
-            contextMenu.appendItem(WI.UIString("Reveal in Resources Tab"), () => {
-                WI.showSourceCodeLocation(callFrame.sourceCodeLocation, {
+        let sourceCodeLocation = null;
+        for (let callFrame of this.representedObject.trace) {
+            if (callFrame.sourceCodeLocation) {
+                sourceCodeLocation = callFrame.sourceCodeLocation;
+                break;
+            }
+        }
+
+        if (sourceCodeLocation) {
+            let label = null;
+            if (WI.settings.experimentalEnableSourcesTab.value)
+                label = WI.UIString("Reveal in Sources Tab");
+            else
+                label = WI.UIString("Reveal in Resources Tab");
+            contextMenu.appendItem(label, () => {
+                WI.showSourceCodeLocation(sourceCodeLocation, {
                     ignoreNetworkTab: true,
                     ignoreSearchTab: true,
                 });
index 8f5018f..7a39cdd 100644 (file)
@@ -99,7 +99,12 @@ WI.SearchResultTreeElement = class SearchResultTreeElement extends WI.GeneralTre
                 });
             });
         } else if (this.representedObject instanceof WI.SourceCodeSearchMatchObject) {
-            contextMenu.appendItem(WI.UIString("Reveal in Resources Tab"), () => {
+            let label = null;
+            if (WI.settings.experimentalEnableSourcesTab.value)
+                label = WI.UIString("Reveal in Sources Tab");
+            else
+                label = WI.UIString("Reveal in Resources Tab");
+            contextMenu.appendItem(label, () => {
                 WI.showOriginalOrFormattedSourceCodeTextRange(this.representedObject.sourceCodeTextRange, {
                     ignoreNetworkTab: true,
                     ignoreSearchTab: true,