| 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); | 17 document.head.appendChild(styleElement); |
| 18 } | 18 } |
| 19 | 19 |
| 20 function addInlineStyleSheetDeprecated() | |
| 21 { | |
| 22 var styleElement = document.createElement("style"); | |
| 23 styleElement.textContent = "body { color: black; }\n/*@ sourceURL=css/addedI
nlineStylesheetDeprecated.css */"; | |
| 24 document.head.appendChild(styleElement); | |
| 25 } | |
| 26 | |
| 27 function addInlineStyleSheetNonRelative() | 20 function addInlineStyleSheetNonRelative() |
| 28 { | 21 { |
| 29 var styleElement = document.createElement("style"); | 22 var styleElement = document.createElement("style"); |
| 30 styleElement.textContent = "body { color: red; }\n/*# sourceURL=/css/nonRela
tiveInlineStylesheet.css */"; | 23 styleElement.textContent = "body { color: red; }\n/*# sourceURL=/css/nonRela
tiveInlineStylesheet.css */"; |
| 31 document.head.appendChild(styleElement); | 24 document.head.appendChild(styleElement); |
| 32 } | 25 } |
| 33 | 26 |
| 34 function test() | 27 function test() |
| 35 { | 28 { |
| 36 function forEachHeaderMatchingURL(url, handler) | 29 function forEachHeaderMatchingURL(url, handler) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 InspectorTest.evaluateInPage("setTimeout(addInlineStyleSheet, 0)"); | 63 InspectorTest.evaluateInPage("setTimeout(addInlineStyleSheet, 0)"); |
| 71 | 64 |
| 72 function didShowSource(sourceFrame) | 65 function didShowSource(sourceFrame) |
| 73 { | 66 { |
| 74 InspectorTest.addResult(sourceFrame.textEditor.text()); | 67 InspectorTest.addResult(sourceFrame.textEditor.text()); |
| 75 forEachHeaderMatchingURL("addedInlineStylesheet", checkHeaderHas
SourceURL); | 68 forEachHeaderMatchingURL("addedInlineStylesheet", checkHeaderHas
SourceURL); |
| 76 next(); | 69 next(); |
| 77 } | 70 } |
| 78 }, | 71 }, |
| 79 | 72 |
| 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 | |
| 93 function testNonRelativeURL(next) | 73 function testNonRelativeURL(next) |
| 94 { | 74 { |
| 95 InspectorTest.showScriptSource("/css/nonRelativeInlineStylesheet.css
", didShowSource); | 75 InspectorTest.showScriptSource("/css/nonRelativeInlineStylesheet.css
", didShowSource); |
| 96 InspectorTest.evaluateInPage("setTimeout(addInlineStyleSheetNonRelat
ive, 0)"); | 76 InspectorTest.evaluateInPage("setTimeout(addInlineStyleSheetNonRelat
ive, 0)"); |
| 97 | 77 |
| 98 function didShowSource(sourceFrame) | 78 function didShowSource(sourceFrame) |
| 99 { | 79 { |
| 100 InspectorTest.addResult(sourceFrame.textEditor.text()); | 80 InspectorTest.addResult(sourceFrame.textEditor.text()); |
| 101 forEachHeaderMatchingURL("nonRelativeInlineStyleSheet.css", chec
kHeaderHasSourceURL); | 81 forEachHeaderMatchingURL("nonRelativeInlineStyleSheet.css", chec
kHeaderHasSourceURL); |
| 102 next(); | 82 next(); |
| 103 } | 83 } |
| 104 } | 84 } |
| 105 ]); | 85 ]); |
| 106 }; | 86 }; |
| 107 | 87 |
| 108 </script> | 88 </script> |
| 109 | 89 |
| 110 </head> | 90 </head> |
| 111 | 91 |
| 112 <body onload="runTest()"> | 92 <body onload="runTest()"> |
| 113 <p>Tests that stylesheets with sourceURL comment are shown in the Sources panel.
</p> | 93 <p>Tests that stylesheets with sourceURL comment are shown in the Sources panel.
</p> |
| 114 </body> | 94 </body> |
| 115 </html> | 95 </html> |
| OLD | NEW |