3 <link rel=
"stylesheet" href=
"../styles/resources/styles-url-linkify.css">
5 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
6 <script src=
"../../../http/tests/inspector/elements-test.js"></script>
11 function completeURL(baseURL
, href
)
13 InspectorTest
.addResult(WebInspector
.ParsedURL
.completeURL(baseURL
, href
));
16 InspectorTest
.addResult("URLs completed:");
17 completeURL("http://example.com", "/");
18 completeURL("http://example.com", "moo");
19 completeURL("http://example.com/", "https://secure.com/moo");
20 completeURL("https://example.com/foo", "//secure.com/moo");
21 completeURL("http://example.com/foo/zoo", "/moo");
22 completeURL("http://example.com/foo/zoo/", "moo");
23 completeURL("http://example.com/foo/zoo", "boo/moo");
24 completeURL("http://example.com/foo", "moo");
25 completeURL("http://example.com/foo", "?a=b");
26 completeURL("http://example.com/foo", "?a=/b");
27 completeURL("http://example.com/?c=/d#anchor", "?a=/b");
28 completeURL("http://example.com/foo?c=d", "?a=b");
29 completeURL("http://example.com/foo?c=d#anchor", "?a=/b");
30 completeURL("http://example.com/foo?c=/d/e", "?a=b");
31 completeURL("http://example.com/foo?c=/d/e", "cat.jpeg");
32 completeURL("http://example.com/foo#anchor", "cat.jpeg");
33 completeURL("http://example.com/", "/foo?bar=http://otherexample.com");
35 const dataURL
= "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAABCAgMAAACeOuh7AAAABGdBTUEAAK/INwWK6QAAAAlQTFRF////AAAA////fu+PTwAAAAF0Uk5TAEDm2GYAAACHSURBVDjLxdLbDYAgDAVQGELn0R3oEHYf2KGdUqtE46OFRCP3oyTng1xCnWsaD5JRRtCkQ2YmkBkHRXqWJBn0j0TICbrsWVoWhRShCdcGyZCtHxMaUnVPRZ9KSbmBJdsX2vJVnwqRD0Rb4rpzgIbE/AI5NTnWAMvy5l0dXrfuLh5OCe5BmmYGXhTUxlQ5xJ8AAAAASUVORK5CYII=";
36 const blobURL
= "blob:http%3A//example.com/f91b7b00-00-0000-0000-3b7c87055d7a";
37 completeURL("https://example.com/foo", dataURL
);
38 completeURL("http://example.com/foo", "javascript:alert('foo');");
39 completeURL("http://example.com/foo", blobURL
);
40 InspectorTest
.addResult(WebInspector
.ParsedURL
.completeURL(blobURL
));
42 function dumpHref(dumpLinkClass
)
45 var valueChildNodes
= InspectorTest
.firstMatchedStyleSection().propertiesTreeOutline
.firstChild().valueElement
.childNodes
;
46 for (var i
= 0; i
< valueChildNodes
.length
; ++i
) {
47 if (valueChildNodes
[i
].href
) {
48 hrefNode
= valueChildNodes
[i
];
53 InspectorTest
.addResult("href property not found");
59 if (hrefNode
.classList
.contains("webkit-html-resource-link"))
60 styleClass
+= "webkit-html-resource-link ";
61 if (hrefNode
.classList
.contains("webkit-html-external-link"))
62 styleClass
+= "webkit-html-external-link ";
65 var href
= hrefNode
.href
;
66 var segments
= href
.split("/");
68 for (var i
= segments
.length
- 1, minSegment
= i
- 3; i
>= 0 && i
>= minSegment
; --i
)
69 output
.unshift(segments
[i
]);
71 InspectorTest
.addResult(styleClass
+ output
.join("/"));
74 InspectorTest
.selectNodeAndWaitForStyles("local", step1
);
78 InspectorTest
.addResult("Link for a URI from CSS document:");
80 InspectorTest
.selectNodeAndWaitForStyles("iframed", step2
);
85 InspectorTest
.addResult("Link for a URI from iframe inline stylesheet:");
87 InspectorTest
.completeTest();
93 <body onload=
"runAfterIframeIsLoaded()">
95 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>,
<a href=
"http://bugs.webkit.org/show_bug.cgi?id=62643">62643</a>,
<a href=
"http://bugs.webkit.org/show_bug.cgi?id=72373">72373</a>,
<a href=
"http://bugs.webkit.org/show_bug.cgi?id=79905">79905</a>
97 <div id=
"local"></div>
98 <iframe src=
"../styles/resources/styles-url-linkify-iframe.html"></iframe>