Web Inspector: debugger popover should have source location link when showing functio...
authormattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Dec 2015 22:38:13 +0000 (22:38 +0000)
committermattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Dec 2015 22:38:13 +0000 (22:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151866

Reviewed by Brian Burg.

Added source code location link to function popover header.

* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype._showPopoverForFunction.didGetDetails):
Create source code location link from response payload.
(WebInspector.SourceCodeTextEditor.prototype._showPopoverForFunction):

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js

index 9bfbfbd..7fe00eb 100644 (file)
@@ -1,3 +1,17 @@
+2015-12-10  Matt Baker  <mattbaker@apple.com>
+
+        Web Inspector: debugger popover should have source location link when showing function source
+        https://bugs.webkit.org/show_bug.cgi?id=151866
+
+        Reviewed by Brian Burg.
+
+        Added source code location link to function popover header.
+
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        (WebInspector.SourceCodeTextEditor.prototype._showPopoverForFunction.didGetDetails):
+        Create source code location link from response payload.
+        (WebInspector.SourceCodeTextEditor.prototype._showPopoverForFunction):
+
 2015-12-10  Nikita Vasilyev  <nvasilyev@apple.com>
 
         Web Inspector: [Meta] Unify z-index values in Inspector's CSS
index e6bea71..cc84959 100644 (file)
@@ -1444,7 +1444,7 @@ WebInspector.SourceCodeTextEditor = class SourceCodeTextEditor extends WebInspec
 
     _showPopoverForFunction(data)
     {
-        var candidate = this.tokenTrackingController.candidate;
+        let candidate = this.tokenTrackingController.candidate;
 
         function didGetDetails(error, response)
         {
@@ -1459,16 +1459,22 @@ WebInspector.SourceCodeTextEditor = class SourceCodeTextEditor extends WebInspec
             if (candidate !== this.tokenTrackingController.candidate)
                 return;
 
-            var wrapper = document.createElement("div");
-            wrapper.className = "body formatted-function";
+            let wrapper = document.createElement("div");
+            wrapper.classList.add("body", "formatted-function");
             wrapper.textContent = data.description;
 
-            var content = document.createElement("div");
-            content.className = "function";
+            let content = document.createElement("div");
+            content.classList.add("function");
+
+            let location = response.location;
+            let sourceCode = WebInspector.debuggerManager.scriptForIdentifier(location.scriptId);
+            let sourceCodeLocation = sourceCode.createSourceCodeLocation(location.lineNumber, location.columnNumber);
+            let functionSourceCodeLink = WebInspector.createSourceCodeLocationLink(sourceCodeLocation);
 
-            var title = content.appendChild(document.createElement("div"));
-            title.className = "title";
+            let title = content.appendChild(document.createElement("div"));
+            title.classList.add("title");
             title.textContent = response.name || response.inferredName || response.displayName || WebInspector.UIString("(anonymous function)");
+            title.appendChild(functionSourceCodeLink);
 
             content.appendChild(wrapper);