Commit f46837c8 authored by apavlov@chromium.org's avatar apavlov@chromium.org
Browse files

2011-01-27 Alexander Pavlov <apavlov@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: [Elements panel] Tooltip for relative links incorrectly identifies current URL
        https://bugs.webkit.org/show_bug.cgi?id=53171

        WebCore:
        * inspector/front-end/inspector.js:
        (WebInspector.completeURL): Taught to understand partial href's that start with "?" (contain GET parameters only)

        LayoutTests:
        * inspector/styles-url-linkify-expected.txt:
        * inspector/styles-url-linkify.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76788 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1435bfcb
2011-01-27 Alexander Pavlov <apavlov@chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: [Elements panel] Tooltip for relative links incorrectly identifies current URL
https://bugs.webkit.org/show_bug.cgi?id=53171
* inspector/styles-url-linkify-expected.txt:
* inspector/styles-url-linkify.html:
2011-01-27 Sergio Villar Senin <svillar@igalia.com>
 
Unreviewed.
Tests that the Styles sidebar pane URLs are linked correctly. Bug 51663
Tests that URLs are linked to and completed correctly. Bugs 51663, 53171
Partial URLs completed:
http://example.com/
http://example.com/moo
https://secure.com/moo
https://secure.com/moo
http://example.com/moo
http://example.com/foo/zoo/moo
http://example.com/foo/boo/moo
http://example.com/moo
http://example.com/foo?a=b
http://example.com/foo?a=b
Link for a URI from CSS document:
LayoutTests/inspector/resources/fromcss.png
Link for a URI from iframe inline stylesheet:
......
......@@ -46,8 +46,29 @@ function test()
InspectorTest.selectElementAndRun("local", executeLocalTest);
}
function completeURL(baseURL, href)
{
InspectorTest.addResult(WebInspector.completeURL(baseURL, href));
}
function completeURLTest()
{
InspectorTest.addResult("Partial URLs completed:");
completeURL("http://example.com", "/");
completeURL("http://example.com", "moo");
completeURL("http://example.com/", "https://secure.com/moo");
completeURL("https://example.com/foo", "//secure.com/moo");
completeURL("http://example.com/foo/zoo", "/moo");
completeURL("http://example.com/foo/zoo/", "moo");
completeURL("http://example.com/foo/zoo", "boo/moo");
completeURL("http://example.com/foo", "moo");
completeURL("http://example.com/foo", "?a=b");
completeURL("http://example.com/foo?c=d", "?a=b");
}
function executeLocalTest()
{
completeURLTest();
InspectorTest.addResult("Link for a URI from CSS document:");
dumpHref();
InspectorTest.selectElementAndRun("iframed", executeIframedTest);
......@@ -67,7 +88,7 @@ function test()
</head>
<body onload="runAfterIframeLoaded()">
<p>
Tests that the Styles sidebar pane URLs are linked correctly. <a href="http://bugs.webkit.org/show_bug.cgi?id=51663">Bug 51663</a>
Tests that URLs are linked to and completed correctly. Bugs <a href="http://bugs.webkit.org/show_bug.cgi?id=51663">51663</a>, <a href="http://bugs.webkit.org/show_bug.cgi?id=53171">53171</a>
</p>
<div id="local"></div>
<iframe src="resources/styles-url-linkify-iframe.html"></iframe>
......
2011-01-27 Alexander Pavlov <apavlov@chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: [Elements panel] Tooltip for relative links incorrectly identifies current URL
https://bugs.webkit.org/show_bug.cgi?id=53171
* inspector/front-end/inspector.js:
(WebInspector.completeURL): Taught to understand partial href's that start with "?" (contain GET parameters only)
2011-01-27 Yury Semikhatsky <yurys@chromium.org>
 
Reviewed by Pavel Feldman.
......@@ -1515,7 +1515,19 @@ WebInspector.completeURL = function(baseURL, href)
var path = href;
if (path.charAt(0) !== "/") {
var basePath = parsedURL.path;
path = basePath.substring(0, basePath.lastIndexOf("/")) + "/" + path;
// A href of "?foo=bar" implies "basePath?foo=bar".
// With "basePath?a=b" and "?foo=bar" we should get "basePath?foo=bar".
var prefix;
if (path.charAt(0) === "?") {
var basePathCutIndex = basePath.indexOf("?");
if (basePathCutIndex !== -1)
prefix = basePath.substring(0, basePathCutIndex);
else
prefix = basePath;
} else
prefix = basePath.substring(0, basePath.lastIndexOf("/")) + "/";
path = prefix + path;
} else if (path.length > 1 && path.charAt(1) === "/") {
// href starts with "//" which is a full URL with the protocol dropped (use the baseURL protocol).
return parsedURL.scheme + ":" + path;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment