Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / elements / elements-panel-rewrite-href.html
blobde009599f69ed2bb789537dacba8b9a182982ac3
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <head>
4 <link rel="stylesheet" src="/bogusSheet1.css">
5 <link rel="stylesheet" src="bogusSheet2.css">
6 <script src="../../http/tests/inspector/inspector-test.js"></script>
7 <script src="../../http/tests/inspector/elements-test.js"></script>
8 <script>
10 function test()
12 InspectorTest.expandElementsTree(step1);
14 function step1()
16 var innerMapping = InspectorTest.domModel._idToDOMNode;
18 for (var nodeId in innerMapping) {
19 var node = innerMapping[nodeId];
20 if (node.nodeName() === "LINK" || node.nodeName() === "SCRIPT") {
21 var segments = [];
22 var href = node.resolveURL(node.getAttribute("src") || node.getAttribute("href"));
23 if (!href) {
24 segments.push("<empty>");
25 continue;
27 if (href.startsWith("http:")) {
28 InspectorTest.addResult(href);
29 continue;
31 var parsedURL = href.asParsedURL();
32 if (!parsedURL)
33 testController.notifyDone("FAIL: no URL match for <" + href + ">");
34 var split = parsedURL.path.split("/");
35 for (var i = split.length - 1, j = 0; j < 3 && i >= 0; --i, ++j)
36 segments.push(split[i]);
37 InspectorTest.addResult(segments.reverse());
39 if (node.nodeName() === "A")
40 InspectorTest.addResult(node.resolveURL(node.getAttribute("href")));
42 InspectorTest.completeTest();
46 </script>
47 </head>
49 <body>
50 <p>
51 Tests that src and href element targets are rewritten properly.
52 </p>
54 <a style="display:none" href=" javascript:alert('foo') "></a>
55 <iframe src="resources/elements-panel-rewrite-href-iframe.html" onload="runTest()"></iframe>
56 </body>
57 </html>