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 = []; |
18 for (var nodeId in innerMapping) { | 19 for (var nodeId in innerMapping) { |
19 var node = innerMapping[nodeId]; | 20 var node = innerMapping[nodeId]; |
20 if (node.nodeName() === "LINK" || node.nodeName() === "SCRIPT") { | 21 if (node.nodeName() === "LINK" || node.nodeName() === "SCRIPT") { |
21 var segments = []; | 22 var segments = []; |
22 var href = node.resolveURL(node.getAttribute("src") || node.getA
ttribute("href")); | 23 var href = node.resolveURL(node.getAttribute("src") || node.getA
ttribute("href")); |
23 if (!href) { | 24 if (!href) { |
24 segments.push("<empty>"); | 25 segments.push("<empty>"); |
25 continue; | 26 continue; |
26 } | 27 } |
27 if (href.startsWith("http:")) { | 28 if (href.startsWith("http:")) { |
28 InspectorTest.addResult(href); | 29 outputLines.push(href); |
29 continue; | 30 continue; |
30 } | 31 } |
31 var parsedURL = href.asParsedURL(); | 32 var parsedURL = href.asParsedURL(); |
32 if (!parsedURL) { | 33 if (!parsedURL) { |
33 testController.notifyDone("FAIL: no URL match for <" + href
+ ">"); | 34 testController.notifyDone("FAIL: no URL match for <" + href
+ ">"); |
34 continue; | 35 continue; |
35 } | 36 } |
36 var split = parsedURL.path.split("/"); | 37 var split = parsedURL.path.split("/"); |
37 for (var i = split.length - 1, j = 0; j < 3 && i >= 0; --i, ++j) | 38 for (var i = split.length - 1, j = 0; j < 3 && i >= 0; --i, ++j) |
38 segments.push(split[i]); | 39 segments.push(split[i]); |
39 InspectorTest.addResult(segments.reverse()); | 40 outputLines.push(segments.reverse()); |
40 } | 41 } |
41 if (node.nodeName() === "A") | 42 if (node.nodeName() === "A") |
42 InspectorTest.addResult(node.resolveURL(node.getAttribute("href"
))); | 43 outputLines.push(node.resolveURL(node.getAttribute("href"))); |
43 } | 44 } |
| 45 outputLines.sort(); |
| 46 InspectorTest.addResult(outputLines.join("\n")); |
44 InspectorTest.completeTest(); | 47 InspectorTest.completeTest(); |
45 } | 48 } |
46 } | 49 } |
47 | 50 |
48 </script> | 51 </script> |
49 </head> | 52 </head> |
50 | 53 |
51 <body> | 54 <body> |
52 <p> | 55 <p> |
53 Tests that src and href element targets are rewritten properly. | 56 Tests that src and href element targets are rewritten properly. |
54 </p> | 57 </p> |
55 | 58 |
56 <a style="display:none" href=" javascript:alert('foo') "></a> | 59 <a style="display:none" href=" javascript:alert('foo') "></a> |
57 <iframe src="resources/elements-panel-rewrite-href-iframe.html" onload="runTest(
)"></iframe> | 60 <iframe src="resources/elements-panel-rewrite-href-iframe.html" onload="runTest(
)"></iframe> |
58 </body> | 61 </body> |
59 </html> | 62 </html> |
OLD | NEW |