Title: [91346] trunk
Revision
91346
Author
[email protected]
Date
2011-07-20 00:54:08 -0700 (Wed, 20 Jul 2011)

Log Message

Source/WebCore: Add a resourceLink audit formatter to make it possible for devtools
extensions to link to specific lines in HTML/JS/CSS resources from the
audit results panel.

https://bugs.webkit.org/show_bug.cgi?id=64315

Patch by Boris Smus <[email protected]> on 2011-07-20
Reviewed by Yury Semikhatsky.

* inspector/front-end/AuditFormatters.js: resourceLink implementation
* inspector/front-end/ExtensionAPI.js: registering resourceLink FormattedValue

LayoutTests: Web Inspector: audit extensions need a way to link directly to resources
https://bugs.webkit.org/show_bug.cgi?id=64315

Patch by Boris Smus <[email protected]> on 2011-07-20
Reviewed by Yury Semikhatsky.

* inspector/extensions/extensions-audits-expected.txt:
* inspector/extensions/extensions-audits-api-expected.txt:
* inspector/extensions/extensions-audits.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (91345 => 91346)


--- trunk/LayoutTests/ChangeLog	2011-07-20 07:52:39 UTC (rev 91345)
+++ trunk/LayoutTests/ChangeLog	2011-07-20 07:54:08 UTC (rev 91346)
@@ -1,3 +1,14 @@
+2011-07-20  Boris Smus  <[email protected]>
+
+        Web Inspector: audit extensions need a way to link directly to resources
+        https://bugs.webkit.org/show_bug.cgi?id=64315
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/extensions/extensions-audits-expected.txt:
+        * inspector/extensions/extensions-audits-api-expected.txt:
+        * inspector/extensions/extensions-audits.html:
+
 2011-07-20  [email protected]  <[email protected]@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
 
         input type=number doesn't render correctly in rtl.

Modified: trunk/LayoutTests/inspector/extensions/extensions-audits-api-expected.txt (91345 => 91346)


--- trunk/LayoutTests/inspector/extensions/extensions-audits-api-expected.txt	2011-07-20 07:52:39 UTC (rev 91345)
+++ trunk/LayoutTests/inspector/extensions/extensions-audits-api-expected.txt	2011-07-20 07:54:08 UTC (rev 91346)
@@ -16,6 +16,7 @@
     createURL : <function>
     createSnippet : <function>
     createText : <function>
+    createResourceLink : <function>
     addResult : <function>
     createResult : <function>
     done : <function>

Modified: trunk/LayoutTests/inspector/extensions/extensions-audits-expected.txt (91345 => 91346)


--- trunk/LayoutTests/inspector/extensions/extensions-audits-expected.txt	2011-07-20 07:52:39 UTC (rev 91345)
+++ trunk/LayoutTests/inspector/extensions/extensions-audits-expected.txt	2011-07-20 07:54:08 UTC (rev 91346)
@@ -19,6 +19,7 @@
 {
     return 4;
 }
+         error.html:10
     Passed rule
      this rule always passes ok
   Extension audits that fail

Modified: trunk/LayoutTests/inspector/extensions/extensions-audits.html (91345 => 91346)


--- trunk/LayoutTests/inspector/extensions/extensions-audits.html	2011-07-20 07:52:39 UTC (rev 91345)
+++ trunk/LayoutTests/inspector/extensions/extensions-audits.html	2011-07-20 07:54:08 UTC (rev 91346)
@@ -20,6 +20,7 @@
         var nestedNode = node.addChild("... and a snippet");
         nestedNode.expanded = true;
         nestedNode.addChild(results.createSnippet("function rand()\n{\n    return 4;\n}"));
+        nestedNode.addChild(results.createResourceLink('file:///path/to/error.html', 10));
 
         results.addResult("Rule with details subtree (1)", "This rule has a lot of details", results.Severity.Warning, node);
         // Audit normally terminates when number of added rule results is equal to

Modified: trunk/Source/WebCore/ChangeLog (91345 => 91346)


--- trunk/Source/WebCore/ChangeLog	2011-07-20 07:52:39 UTC (rev 91345)
+++ trunk/Source/WebCore/ChangeLog	2011-07-20 07:54:08 UTC (rev 91346)
@@ -1,3 +1,17 @@
+2011-07-20  Boris Smus  <[email protected]>
+
+        Add a resourceLink audit formatter to make it possible for devtools
+        extensions to link to specific lines in HTML/JS/CSS resources from the
+        audit results panel.
+
+        https://bugs.webkit.org/show_bug.cgi?id=64315
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/AuditFormatters.js: resourceLink implementation
+        * inspector/front-end/ExtensionAPI.js: registering resourceLink FormattedValue
+
+
 2011-07-20  Kent Tamura  <[email protected]>
 
         input type=number doesn't render correctly in rtl.

Modified: trunk/Source/WebCore/inspector/front-end/AuditFormatters.js (91345 => 91346)


--- trunk/Source/WebCore/inspector/front-end/AuditFormatters.js	2011-07-20 07:52:39 UTC (rev 91345)
+++ trunk/Source/WebCore/inspector/front-end/AuditFormatters.js	2011-07-20 07:54:08 UTC (rev 91346)
@@ -88,5 +88,18 @@
         if (allowExternalNavigation)
             a.target = "_blank";
         return a;
+    },
+
+    resourceLink: function(url, line)
+    {
+        var title = url.replace(/.*[\/\\]/, "") + ":" + line;
+        var a = document.createElement("a");
+        a.href = ""
+        a.title = url;
+        a.className = "console-message-url webkit-html-resource-link";
+        a.setAttribute("line_number", line);
+        a.setAttribute("preferred_panel", "scripts");
+        a.textContent = title;
+        return a;
     }
 };

Modified: trunk/Source/WebCore/inspector/front-end/ExtensionAPI.js (91345 => 91346)


--- trunk/Source/WebCore/inspector/front-end/ExtensionAPI.js	2011-07-20 07:52:39 UTC (rev 91345)
+++ trunk/Source/WebCore/inspector/front-end/ExtensionAPI.js	2011-07-20 07:54:08 UTC (rev 91346)
@@ -290,6 +290,7 @@
     this.createURL = bind(this._nodeFactory, null, "url");
     this.createSnippet = bind(this._nodeFactory, null, "snippet");
     this.createText = bind(this._nodeFactory, null, "text");
+    this.createResourceLink = bind(this._nodeFactory, null, "resourceLink");
 }
 
 AuditResultImpl.prototype = {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to