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 injectScript(value) | 6 function injectScript(value) |
7 { | 7 { |
8 eval("function foo() { return " + value + "; } //# sourceURL=MyScript.js"); | 8 eval("function foo() { return " + value + "; } //# sourceURL=MyScript.js"); |
9 } | 9 } |
10 | 10 |
11 function test() | 11 function test() |
12 { | 12 { |
13 InspectorTest.evaluateInPage("injectScript(1);"); | 13 InspectorTest.evaluateInPage("injectScript(1);"); |
14 InspectorTest.evaluateInPage("injectScript(2);"); | 14 InspectorTest.evaluateInPage("injectScript(2);"); |
15 | 15 |
16 WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISour
ceCodeAdded, reportAdded); | 16 WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISour
ceCodeAdded, reportAdded); |
17 WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISour
ceCodeRemoved, reportRemoved); | 17 WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISour
ceCodeRemoved, reportRemoved); |
18 | 18 |
19 var iteration = 0; | 19 var iteration = 0; |
20 | 20 |
21 function reportAdded(event) | 21 function reportAdded(event) |
22 { | 22 { |
23 if (event.data.url().indexOf("MyScript.js") === -1) | 23 if (event.data.url().indexOf("MyScript.js") === -1) |
24 return; | 24 return; |
25 InspectorTest.addResult("Added: " + event.data.url().replace(/VM[\d]+/,
"VMXX") + " to " + event.data.project().type()); | 25 InspectorTest.addResult("Added: " + event.data.url().replace(/VM[\d]+/,
"VMXX") + " to " + event.data.project().type()); |
26 if (event.data.project().type() !== "network") | 26 if (event.data.project().type() !== "network") |
27 return; | 27 return; |
28 event.data.requestContent(function(it, content) { | 28 event.data.requestContent().then(function(it, content) { |
29 InspectorTest.addResult("Content: " + content); | 29 InspectorTest.addResult("Content: " + content); |
30 if (it) | 30 if (it) |
31 InspectorTest.completeTest(); | 31 InspectorTest.completeTest(); |
32 }.bind(null, iteration++)); | 32 }.bind(null, iteration++)); |
33 } | 33 } |
34 | 34 |
35 function reportRemoved(event) | 35 function reportRemoved(event) |
36 { | 36 { |
37 if (event.data.url() !== "MyScript.js") | 37 if (event.data.url() !== "MyScript.js") |
38 return; | 38 return; |
39 InspectorTest.addResult("Removed: " + event.data.url() + " from " + even
t.data.project().type()); | 39 InspectorTest.addResult("Removed: " + event.data.url() + " from " + even
t.data.project().type()); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 </script> | 43 </script> |
44 </head> | 44 </head> |
45 | 45 |
46 <body onload="runTest()"> | 46 <body onload="runTest()"> |
47 <p> | 47 <p> |
48 Tests that script is replaced with the newer version when the names match. | 48 Tests that script is replaced with the newer version when the names match. |
49 </p> | 49 </p> |
50 | 50 |
51 </body> | 51 </body> |
52 </html> | 52 </html> |
OLD | NEW |