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 <script> | 5 <script> |
6 function keepAliveInInlineScript() { } | 6 function keepAliveInInlineScript() { } |
7 | 7 |
8 //@ sourceURL=inlineScriptURL.js | 8 //# sourceURL=inlineScriptURL.js |
9 </script> | 9 </script> |
10 <script> | 10 <script> |
11 function doEval() | 11 function doEval() |
12 { | 12 { |
13 eval("function keepAlive() {}\n//@ sourceURL=evalURL.js"); | 13 eval("function keepAlive() {}\n//# sourceURL=evalURL.js"); |
| 14 } |
| 15 |
| 16 function doDeprecatedEval() |
| 17 { |
| 18 eval("function keepAlive() {}\n//@ sourceURL=deprecatedEvalURL.js"); |
14 } | 19 } |
15 | 20 |
16 function doEvalWithNonRelativeURL() | 21 function doEvalWithNonRelativeURL() |
17 { | 22 { |
18 eval("function relativeURLScript() {}\n//@ sourceURL=/js/nonRelativeURL.js")
; | 23 eval("function relativeURLScript() {}\n//# sourceURL=/js/nonRelativeURL.js")
; |
19 } | 24 } |
20 | 25 |
21 function doDynamicScript() | 26 function doDynamicScript() |
22 { | 27 { |
23 var scriptElement = document.createElement("script"); | 28 var scriptElement = document.createElement("script"); |
24 scriptElement.textContent = "function keepAliveInDynamicScript() {}\n//@ sou
rceURL=dynamicScriptURL.js"; | 29 scriptElement.textContent = "function keepAliveInDynamicScript() {}\n//# sou
rceURL=dynamicScriptURL.js"; |
25 document.body.appendChild(scriptElement); | 30 document.body.appendChild(scriptElement); |
26 } | 31 } |
27 | 32 |
28 function test() | 33 function test() |
29 | 34 |
30 { | 35 { |
31 function forEachScriptMatchingURL(url, handler) | 36 function forEachScriptMatchingURL(url, handler) |
32 { | 37 { |
33 var scripts = WebInspector.debuggerModel.scripts; | 38 var scripts = WebInspector.debuggerModel.scripts; |
34 for (var i = 0; i < scripts.length; ++i) { | 39 for (var i = 0; i < scripts.length; ++i) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 { | 74 { |
70 InspectorTest.assertTrue(script.hasSourceURL, "hasSourceURL
flag is not set for eval with sourceURL comment"); | 75 InspectorTest.assertTrue(script.hasSourceURL, "hasSourceURL
flag is not set for eval with sourceURL comment"); |
71 } | 76 } |
72 | 77 |
73 InspectorTest.addResult(sourceFrame.textEditor.text()); | 78 InspectorTest.addResult(sourceFrame.textEditor.text()); |
74 forEachScriptMatchingURL("evalURL.js", checkScriptHasSourceURL); | 79 forEachScriptMatchingURL("evalURL.js", checkScriptHasSourceURL); |
75 next(); | 80 next(); |
76 } | 81 } |
77 }, | 82 }, |
78 | 83 |
| 84 function testDeprecatedSourceURLComment(next) |
| 85 { |
| 86 InspectorTest.showScriptSource("deprecatedEvalURL.js", didShowScript
Source); |
| 87 InspectorTest.evaluateInPage("setTimeout(doDeprecatedEval, 0)"); |
| 88 |
| 89 function didShowScriptSource(sourceFrame) |
| 90 { |
| 91 function checkScriptHasSourceURL(script) |
| 92 { |
| 93 InspectorTest.assertTrue(script.hasSourceURL, "hasSourceURL
flag is not set for eval with sourceURL comment"); |
| 94 } |
| 95 |
| 96 InspectorTest.addResult(sourceFrame.textEditor.text()); |
| 97 forEachScriptMatchingURL("deprecatedEvalURL.js", checkScriptHasS
ourceURL); |
| 98 next(); |
| 99 } |
| 100 }, |
| 101 |
79 function testSourceURLCommentInDynamicScript(next) | 102 function testSourceURLCommentInDynamicScript(next) |
80 { | 103 { |
81 InspectorTest.showScriptSource("dynamicScriptURL.js", didShowScriptS
ource); | 104 InspectorTest.showScriptSource("dynamicScriptURL.js", didShowScriptS
ource); |
82 InspectorTest.evaluateInPage("setTimeout(doDynamicScript, 0)"); | 105 InspectorTest.evaluateInPage("setTimeout(doDynamicScript, 0)"); |
83 | 106 |
84 function didShowScriptSource(sourceFrame) | 107 function didShowScriptSource(sourceFrame) |
85 { | 108 { |
86 function checkScriptHasSourceURL(script) | 109 function checkScriptHasSourceURL(script) |
87 { | 110 { |
88 InspectorTest.assertTrue(script.hasSourceURL, "hasSourceURL
flag is not set for dynamic script with sourceURL comment"); | 111 InspectorTest.assertTrue(script.hasSourceURL, "hasSourceURL
flag is not set for dynamic script with sourceURL comment"); |
(...skipping 26 matching lines...) Expand all Loading... |
115 }; | 138 }; |
116 | 139 |
117 </script> | 140 </script> |
118 | 141 |
119 </head> | 142 </head> |
120 | 143 |
121 <body onload="runTest()"> | 144 <body onload="runTest()"> |
122 <p>Tests that evals with sourceURL comment are shown in scripts panel.</p> | 145 <p>Tests that evals with sourceURL comment are shown in scripts panel.</p> |
123 </body> | 146 </body> |
124 </html> | 147 </html> |
OLD | NEW |