OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.or
g/TR/html4/loose.dtd"> | 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.or
g/TR/html4/loose.dtd"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <link rel="stylesheet" src="/bogusSheet1.css"> | 4 <link rel="stylesheet" src="/bogusSheet1.css"> |
5 <link rel="stylesheet" src="bogusSheet2.css"> | 5 <link rel="stylesheet" src="bogusSheet2.css"> |
6 <script src="../../http/tests/inspector/inspector-test.js"></script> | 6 <script src="../../http/tests/inspector/inspector-test.js"></script> |
7 <script src="../../http/tests/inspector/elements-test.js"></script> | 7 <script src="../../http/tests/inspector/elements-test.js"></script> |
8 <script> | 8 <script> |
9 | 9 |
10 function test() | 10 function test() |
11 { | 11 { |
12 InspectorTest.expandElementsTree(step1); | 12 InspectorTest.expandElementsTree(step1); |
13 | 13 |
14 function step1() | 14 function step1() |
15 { | 15 { |
16 var innerMapping = InspectorTest.domModel._idToDOMNode; | 16 var innerMapping = InspectorTest.domModel._idToDOMNode; |
17 | 17 |
18 var outputLines = []; | |
19 for (var nodeId in innerMapping) { | 18 for (var nodeId in innerMapping) { |
20 var node = innerMapping[nodeId]; | 19 var node = innerMapping[nodeId]; |
21 if (node.nodeName() === "LINK" || node.nodeName() === "SCRIPT") { | 20 if (node.nodeName() === "LINK" || node.nodeName() === "SCRIPT") { |
22 var segments = []; | 21 var segments = []; |
23 var href = node.resolveURL(node.getAttribute("src") || node.getA
ttribute("href")); | 22 var href = node.resolveURL(node.getAttribute("src") || node.getA
ttribute("href")); |
24 if (!href) { | 23 if (!href) { |
25 segments.push("<empty>"); | 24 segments.push("<empty>"); |
26 continue; | 25 continue; |
27 } | 26 } |
28 if (href.startsWith("http:")) { | 27 if (href.startsWith("http:")) { |
29 outputLines.push(href); | 28 InspectorTest.addResult(href); |
30 continue; | 29 continue; |
31 } | 30 } |
32 var parsedURL = href.asParsedURL(); | 31 var parsedURL = href.asParsedURL(); |
33 if (!parsedURL) { | 32 if (!parsedURL) { |
34 testController.notifyDone("FAIL: no URL match for <" + href
+ ">"); | 33 testController.notifyDone("FAIL: no URL match for <" + href
+ ">"); |
35 continue; | 34 continue; |
36 } | 35 } |
37 var split = parsedURL.path.split("/"); | 36 var split = parsedURL.path.split("/"); |
38 for (var i = split.length - 1, j = 0; j < 3 && i >= 0; --i, ++j) | 37 for (var i = split.length - 1, j = 0; j < 3 && i >= 0; --i, ++j) |
39 segments.push(split[i]); | 38 segments.push(split[i]); |
40 outputLines.push(segments.reverse()); | 39 InspectorTest.addResult(segments.reverse()); |
41 } | 40 } |
42 if (node.nodeName() === "A") | 41 if (node.nodeName() === "A") |
43 outputLines.push(node.resolveURL(node.getAttribute("href"))); | 42 InspectorTest.addResult(node.resolveURL(node.getAttribute("href"
))); |
44 } | 43 } |
45 outputLines.sort(); | |
46 InspectorTest.addResult(outputLines.join("\n")); | |
47 InspectorTest.completeTest(); | 44 InspectorTest.completeTest(); |
48 } | 45 } |
49 } | 46 } |
50 | 47 |
51 </script> | 48 </script> |
52 </head> | 49 </head> |
53 | 50 |
54 <body> | 51 <body> |
55 <p> | 52 <p> |
56 Tests that src and href element targets are rewritten properly. | 53 Tests that src and href element targets are rewritten properly. |
57 </p> | 54 </p> |
58 | 55 |
59 <a style="display:none" href=" javascript:alert('foo') "></a> | 56 <a style="display:none" href=" javascript:alert('foo') "></a> |
60 <iframe src="resources/elements-panel-rewrite-href-iframe.html" onload="runTest(
)"></iframe> | 57 <iframe src="resources/elements-panel-rewrite-href-iframe.html" onload="runTest(
)"></iframe> |
61 </body> | 58 </body> |
62 </html> | 59 </html> |
OLD | NEW |