Title: [124792] trunk
Revision
124792
Author
[email protected]
Date
2012-08-06 12:04:31 -0700 (Mon, 06 Aug 2012)

Log Message

Web Inspector: WebInspector.linkifyStringAsFragment gives wrong typeof lineNumber
https://bugs.webkit.org/show_bug.cgi?id=93019

Patch by John J. Barton <[email protected]> on 2012-08-06
Reviewed by Pavel Feldman.

Source/WebCore:

Add test for WebInspector.linkifyStringAsFragment()

* inspector/front-end/ResourceUtils.js:
(WebInspector.linkifyStringAsFragmentWithCustomLinkifier):

LayoutTests:

parseInt the RegExp match for lineNumber
New test case added to linkify.html

* inspector/debugger/linkifier-expected.txt:
* inspector/debugger/linkifier.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (124791 => 124792)


--- trunk/LayoutTests/ChangeLog	2012-08-06 18:46:31 UTC (rev 124791)
+++ trunk/LayoutTests/ChangeLog	2012-08-06 19:04:31 UTC (rev 124792)
@@ -1,3 +1,16 @@
+2012-08-06  John J. Barton  <[email protected]>
+
+        Web Inspector: WebInspector.linkifyStringAsFragment gives wrong typeof lineNumber
+        https://bugs.webkit.org/show_bug.cgi?id=93019
+
+        Reviewed by Pavel Feldman.
+
+        parseInt the RegExp match for lineNumber 
+        New test case added to linkify.html
+
+        * inspector/debugger/linkifier-expected.txt:
+        * inspector/debugger/linkifier.html:
+
 2012-08-06  Dmitry Titov  <[email protected]>
 
         [Chromium] Not reviewed, linting TestExpectations.

Modified: trunk/LayoutTests/inspector/debugger/linkifier-expected.txt (124791 => 124792)


--- trunk/LayoutTests/inspector/debugger/linkifier-expected.txt	2012-08-06 18:46:31 UTC (rev 124791)
+++ trunk/LayoutTests/inspector/debugger/linkifier-expected.txt	2012-08-06 19:04:31 UTC (rev 124792)
@@ -1,6 +1,8 @@
 Tests that Linkifier works correctly.
 
 Debugger was enabled.
+The string "at triggerError (http://localhost/show/:22:11) " linkifies to url: http://localhost/show/
+The lineNumber is 22 with type number
 listeners added on raw source code: 1
 original location: linkifier.html:9
 pretty printed location: linkifier.html:12

Modified: trunk/LayoutTests/inspector/debugger/linkifier.html (124791 => 124792)


--- trunk/LayoutTests/inspector/debugger/linkifier.html	2012-08-06 18:46:31 UTC (rev 124791)
+++ trunk/LayoutTests/inspector/debugger/linkifier.html	2012-08-06 19:04:31 UTC (rev 124792)
@@ -41,6 +41,12 @@
             }
         }
 
+        var linkifyMe = "at triggerError (http://localhost/show/:22:11)";
+        var fragment = WebInspector.linkifyStringAsFragment(linkifyMe);
+        var anchor = fragment.querySelector('a');
+        InspectorTest.addResult("The string \"" + linkifyMe + " \" linkifies to url: " + anchor.href);
+        InspectorTest.addResult("The lineNumber is " + anchor.lineNumber + " with type " + (typeof anchor.lineNumber));
+
         linkifier = new WebInspector.Linkifier();
         var count1 = liveLocationsCount();
         link = linkifier.linkifyLocation(WebInspector.inspectedPageURL, 8, 0, "dummy-class");

Modified: trunk/Source/WebCore/ChangeLog (124791 => 124792)


--- trunk/Source/WebCore/ChangeLog	2012-08-06 18:46:31 UTC (rev 124791)
+++ trunk/Source/WebCore/ChangeLog	2012-08-06 19:04:31 UTC (rev 124792)
@@ -1,3 +1,15 @@
+2012-08-06  John J. Barton  <[email protected]>
+
+        Web Inspector: WebInspector.linkifyStringAsFragment gives wrong typeof lineNumber
+        https://bugs.webkit.org/show_bug.cgi?id=93019
+
+        Reviewed by Pavel Feldman.
+
+        Add test for WebInspector.linkifyStringAsFragment()
+
+        * inspector/front-end/ResourceUtils.js:
+        (WebInspector.linkifyStringAsFragmentWithCustomLinkifier):
+
 2012-08-06  David Reveman  <[email protected]>
 
         [Chromium] Refactor CCTextureUpdater into CCTextureUpdater and CCTextureUpdateController.

Modified: trunk/Source/WebCore/inspector/front-end/ResourceUtils.js (124791 => 124792)


--- trunk/Source/WebCore/inspector/front-end/ResourceUtils.js	2012-08-06 18:46:31 UTC (rev 124791)
+++ trunk/Source/WebCore/inspector/front-end/ResourceUtils.js	2012-08-06 19:04:31 UTC (rev 124792)
@@ -182,7 +182,7 @@
 
 /**
  * @param {string} string
- * @param {function(string,string,string=):Node} linkifier
+ * @param {function(string,string,number=):Node} linkifier
  * @return {DocumentFragment}
  */
 WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linkifier)
@@ -204,10 +204,14 @@
         var title = linkString;
         var realURL = (linkString.startsWith("www.") ? "http://" + linkString : linkString);
         var lineColumnMatch = lineColumnRegEx.exec(realURL);
-        if (lineColumnMatch)
+        var lineNumber;
+        if (lineColumnMatch) {
             realURL = realURL.substring(0, realURL.length - lineColumnMatch[0].length);
+            lineNumber = parseInt(lineColumnMatch[1], 10);
+            lineNumber = isNaN(lineNumber) ? undefined : lineNumber;
+        }
 
-        var linkNode = linkifier(title, realURL, lineColumnMatch ? lineColumnMatch[1] : undefined);
+        var linkNode = linkifier(title, realURL, lineNumber);
         container.appendChild(linkNode);
         string = string.substring(linkIndex + linkString.length, string.length);
     }
@@ -237,7 +241,7 @@
     /**
      * @param {string} title
      * @param {string} url
-     * @param {string=} lineNumber
+     * @param {number=} lineNumber
      * @return {Node}
      */
     function linkifier(title, url, lineNumber)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to