OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
4 <script src="../../http/tests/inspector/debugger-test.js"></script> | 4 <script src="../../http/tests/inspector/debugger-test.js"></script> |
5 <style> | 5 <style> |
6 body { | 6 body { |
7 color: green; | 7 color: green; |
8 } | 8 } |
9 | 9 |
10 /*@ sourceURL=inlineStyleSheet.css */ | 10 /*# sourceURL=inlineStyleSheet.css */ |
11 </style> | 11 </style> |
12 <script> | 12 <script> |
13 function addInlineStyleSheet() | 13 function addInlineStyleSheet() |
14 { | 14 { |
15 var styleElement = document.createElement("style"); | 15 var styleElement = document.createElement("style"); |
16 styleElement.textContent = "body { color: black; }\n/*@ sourceURL=css/addedI
nlineStylesheet.css */"; | 16 styleElement.textContent = "body { color: black; }\n/*# sourceURL=css/addedI
nlineStylesheet.css */"; |
| 17 document.head.appendChild(styleElement); |
| 18 } |
| 19 |
| 20 function addInlineStyleSheetDeprecated() |
| 21 { |
| 22 var styleElement = document.createElement("style"); |
| 23 styleElement.textContent = "body { color: black; }\n/*@ sourceURL=css/addedI
nlineStylesheetDeprecated.css */"; |
17 document.head.appendChild(styleElement); | 24 document.head.appendChild(styleElement); |
18 } | 25 } |
19 | 26 |
20 function addInlineStyleSheetNonRelative() | 27 function addInlineStyleSheetNonRelative() |
21 { | 28 { |
22 var styleElement = document.createElement("style"); | 29 var styleElement = document.createElement("style"); |
23 styleElement.textContent = "body { color: red; }\n/*@ sourceURL=/css/nonRela
tiveInlineStylesheet.css */"; | 30 styleElement.textContent = "body { color: red; }\n/*# sourceURL=/css/nonRela
tiveInlineStylesheet.css */"; |
24 document.head.appendChild(styleElement); | 31 document.head.appendChild(styleElement); |
25 } | 32 } |
26 | 33 |
27 function test() | 34 function test() |
28 { | 35 { |
29 function forEachHeaderMatchingURL(url, handler) | 36 function forEachHeaderMatchingURL(url, handler) |
30 { | 37 { |
31 var headers = WebInspector.cssModel.styleSheetHeaders(); | 38 var headers = WebInspector.cssModel.styleSheetHeaders(); |
32 for (var i = 0; i < headers.length; ++i) { | 39 for (var i = 0; i < headers.length; ++i) { |
33 if (headers[i].sourceURL.indexOf(url) !== -1) | 40 if (headers[i].sourceURL.indexOf(url) !== -1) |
(...skipping 29 matching lines...) Expand all Loading... |
63 InspectorTest.evaluateInPage("setTimeout(addInlineStyleSheet, 0)"); | 70 InspectorTest.evaluateInPage("setTimeout(addInlineStyleSheet, 0)"); |
64 | 71 |
65 function didShowSource(sourceFrame) | 72 function didShowSource(sourceFrame) |
66 { | 73 { |
67 InspectorTest.addResult(sourceFrame.textEditor.text()); | 74 InspectorTest.addResult(sourceFrame.textEditor.text()); |
68 forEachHeaderMatchingURL("addedInlineStylesheet", checkHeaderHas
SourceURL); | 75 forEachHeaderMatchingURL("addedInlineStylesheet", checkHeaderHas
SourceURL); |
69 next(); | 76 next(); |
70 } | 77 } |
71 }, | 78 }, |
72 | 79 |
| 80 function testDeprecatedSourceURLComment(next) |
| 81 { |
| 82 InspectorTest.showScriptSource("css/addedInlineStylesheetDeprecated.
css", didShowSource); |
| 83 InspectorTest.evaluateInPage("setTimeout(addInlineStyleSheetDeprecat
ed, 0)"); |
| 84 |
| 85 function didShowSource(sourceFrame) |
| 86 { |
| 87 InspectorTest.addResult(sourceFrame.textEditor.text()); |
| 88 forEachHeaderMatchingURL("addedInlineStylesheetDeprecated", chec
kHeaderHasSourceURL); |
| 89 next(); |
| 90 } |
| 91 }, |
| 92 |
73 function testNonRelativeURL(next) | 93 function testNonRelativeURL(next) |
74 { | 94 { |
75 InspectorTest.showScriptSource("/css/nonRelativeInlineStylesheet.css
", didShowSource); | 95 InspectorTest.showScriptSource("/css/nonRelativeInlineStylesheet.css
", didShowSource); |
76 InspectorTest.evaluateInPage("setTimeout(addInlineStyleSheetNonRelat
ive, 0)"); | 96 InspectorTest.evaluateInPage("setTimeout(addInlineStyleSheetNonRelat
ive, 0)"); |
77 | 97 |
78 function didShowSource(sourceFrame) | 98 function didShowSource(sourceFrame) |
79 { | 99 { |
80 InspectorTest.addResult(sourceFrame.textEditor.text()); | 100 InspectorTest.addResult(sourceFrame.textEditor.text()); |
81 forEachHeaderMatchingURL("nonRelativeInlineStyleSheet.css", chec
kHeaderHasSourceURL); | 101 forEachHeaderMatchingURL("nonRelativeInlineStyleSheet.css", chec
kHeaderHasSourceURL); |
82 next(); | 102 next(); |
83 } | 103 } |
84 } | 104 } |
85 ]); | 105 ]); |
86 }; | 106 }; |
87 | 107 |
88 </script> | 108 </script> |
89 | 109 |
90 </head> | 110 </head> |
91 | 111 |
92 <body onload="runTest()"> | 112 <body onload="runTest()"> |
93 <p>Tests that stylesheets with sourceURL comment are shown in the Sources panel.
</p> | 113 <p>Tests that stylesheets with sourceURL comment are shown in the Sources panel.
</p> |
94 </body> | 114 </body> |
95 </html> | 115 </html> |
OLD | NEW |