Diff
Modified: trunk/LayoutTests/ChangeLog (136103 => 136104)
--- trunk/LayoutTests/ChangeLog 2012-11-29 07:10:14 UTC (rev 136103)
+++ trunk/LayoutTests/ChangeLog 2012-11-29 07:28:02 UTC (rev 136104)
@@ -1,3 +1,16 @@
+2012-11-28 Mike West <[email protected]>
+
+ Web Inspector: Console message's anchor element should be trimmed for readability.
+ https://bugs.webkit.org/show_bug.cgi?id=100095
+
+ Reviewed by Pavel Feldman.
+
+ * http/tests/inspector/network/resources/script-as-text-with-a-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-url.php: Added.
+ * http/tests/inspector/network/script-as-text-loading-long-url-expected.txt: Added.
+ * http/tests/inspector/network/script-as-text-loading-long-url.html: Added.
+ * platform/chromium/http/tests/inspector/network/script-as-text-loading-long-url-expected.txt: Added.
+ JSC vs V8.
+
012-11-28 Alexander Pavlov <[email protected]>
[Chromium] Unreviewed, rebaseline CSS regions test expectations for Mac 10.8 after r136045.
Added: trunk/LayoutTests/http/tests/inspector/network/resources/script-as-text-with-a-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-url.php (0 => 136104)
--- trunk/LayoutTests/http/tests/inspector/network/resources/script-as-text-with-a-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-url.php (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/resources/script-as-text-with-a-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-url.php 2012-11-29 07:28:02 UTC (rev 136104)
@@ -0,0 +1,8 @@
+<?php
+ header("Content-Type: text/plain");
+?>
+
+function foo()
+{
+ var bar = 42;
+}
Added: trunk/LayoutTests/http/tests/inspector/network/script-as-text-loading-long-url-expected.txt (0 => 136104)
--- trunk/LayoutTests/http/tests/inspector/network/script-as-text-loading-long-url-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/script-as-text-loading-long-url-expected.txt 2012-11-29 07:28:02 UTC (rev 136104)
@@ -0,0 +1,5 @@
+Tests that long URLs are correctly trimmed in anchor links.
+
+Bug 100095
+Resource interpreted as Script but transferred with MIME type text/plain: "http://127.0.0.1:8000/inspector/network/resources/script-as-text-with-a-ver…y-very-very-very-very-very-very-very-very-very-very-very-very-long-url.php". [native code]:1
+
Added: trunk/LayoutTests/http/tests/inspector/network/script-as-text-loading-long-url.html (0 => 136104)
--- trunk/LayoutTests/http/tests/inspector/network/script-as-text-loading-long-url.html (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/script-as-text-loading-long-url.html 2012-11-29 07:28:02 UTC (rev 136104)
@@ -0,0 +1,30 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+function loadScript()
+{
+ var i = document.createElement('script');
+ i.src = ""
+ document.body.appendChild(i);
+}
+
+function test()
+{
+ InspectorTest.addConsoleSniffer(step1);
+ InspectorTest.evaluateInPage("loadScript()");
+
+ function step1()
+ {
+ InspectorTest.dumpConsoleMessages();
+ InspectorTest.completeTest();
+ }
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests that long URLs are correctly trimmed in anchor links.</p>
+<a href="" 100095</a>
+</body>
+</html>
Added: trunk/LayoutTests/platform/chromium/http/tests/inspector/network/script-as-text-loading-long-url-expected.txt (0 => 136104)
--- trunk/LayoutTests/platform/chromium/http/tests/inspector/network/script-as-text-loading-long-url-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/chromium/http/tests/inspector/network/script-as-text-loading-long-url-expected.txt 2012-11-29 07:28:02 UTC (rev 136104)
@@ -0,0 +1,5 @@
+Tests that long URLs are correctly trimmed in anchor links.
+
+Bug 100095
+Resource interpreted as Script but transferred with MIME type text/plain: "http://127.0.0.1:8000/inspector/network/resources/script-as-text-with-a-ver…y-very-very-very-very-very-very-very-very-very-very-very-very-long-url.php". script-as-text-loading-long-url.html:10
+
Modified: trunk/Source/WebCore/ChangeLog (136103 => 136104)
--- trunk/Source/WebCore/ChangeLog 2012-11-29 07:10:14 UTC (rev 136103)
+++ trunk/Source/WebCore/ChangeLog 2012-11-29 07:28:02 UTC (rev 136104)
@@ -1,3 +1,30 @@
+2012-11-28 Mike West <[email protected]>
+
+ Web Inspector: Console message's anchor element should be trimmed for readability.
+ https://bugs.webkit.org/show_bug.cgi?id=100095
+
+ Reviewed by Pavel Feldman.
+
+ We're currently trimming URLs that go through
+ 'WebInspector.linkifyURLAsNode' down to 150 characters total. Not all
+ URLs go that path, however. We were missing a few cases that dropped
+ back to the default Linkifier (which especially showed up for "Live"
+ anchor elements).
+
+ This patch ensures that anything using WebInspector.Linkifier is also
+ trimmed by default. It adds a new constant to do so in order to avoid
+ magic numbers in the code.
+
+ Test: http/tests/inspector/network/script-as-text-loading-long-url.html
+
+ * inspector/front-end/Linkifier.js:
+ (WebInspector.Linkifier):
+ Pass the max length into the default formatter that's created and
+ stored when creating a 'WebInspector.Linkifier' object.
+ * inspector/front-end/ResourceUtils.js:
+ (WebInspector.linkifyURLAsNode):
+ Use the new maxlength constant rather than hard-coding 150.
+
2012-11-28 Kentaro Hara <[email protected]>
Unreviewed. Rebaselined run-bindings-tests.
Modified: trunk/Source/WebCore/inspector/front-end/Linkifier.js (136103 => 136104)
--- trunk/Source/WebCore/inspector/front-end/Linkifier.js 2012-11-29 07:10:14 UTC (rev 136103)
+++ trunk/Source/WebCore/inspector/front-end/Linkifier.js 2012-11-29 07:28:02 UTC (rev 136104)
@@ -49,7 +49,7 @@
*/
WebInspector.Linkifier = function(formatter)
{
- this._formatter = formatter || new WebInspector.Linkifier.DefaultFormatter();
+ this._formatter = formatter || new WebInspector.Linkifier.DefaultFormatter(WebInspector.Linkifier.MaxLengthForDisplayedURLs);
this._liveLocations = [];
}
@@ -173,4 +173,11 @@
anchor.textContent = "";
},
__proto__: WebInspector.Linkifier.DefaultFormatter.prototype
-}
\ No newline at end of file
+}
+
+/**
+ * The maximum number of characters to display in a URL.
+ * @const
+ * @type {number}
+ */
+WebInspector.Linkifier.MaxLengthForDisplayedURLs = 150;
Modified: trunk/Source/WebCore/inspector/front-end/ResourceUtils.js (136103 => 136104)
--- trunk/Source/WebCore/inspector/front-end/ResourceUtils.js 2012-11-29 07:10:14 UTC (rev 136103)
+++ trunk/Source/WebCore/inspector/front-end/ResourceUtils.js 2012-11-29 07:28:02 UTC (rev 136104)
@@ -181,7 +181,7 @@
a.title = url;
else if (typeof tooltipText !== "string" || tooltipText.length)
a.title = tooltipText;
- a.textContent = linkText.trimMiddle(150);
+ a.textContent = linkText.trimMiddle(WebInspector.Linkifier.MaxLengthForDisplayedURLs);
if (isExternal)
a.setAttribute("target", "_blank");
Modified: trunk/Source/WebCore/inspector/front-end/inspector.css (136103 => 136104)
--- trunk/Source/WebCore/inspector/front-end/inspector.css 2012-11-29 07:10:14 UTC (rev 136103)
+++ trunk/Source/WebCore/inspector/front-end/inspector.css 2012-11-29 07:28:02 UTC (rev 136104)
@@ -1067,6 +1067,7 @@
.console-message-url {
float: right;
+ text-align: right;
max-width: 100%;
margin-left: 4px;
}