OLD | NEW |
---|---|
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // Flags: --expose_gc | |
5 | 4 |
6 print("Checks that inspector correctly process compiled scripts"); | 5 print("Checks that inspector correctly process compiled scripts"); |
7 | 6 |
8 function addScripts() { | 7 function addScripts() { |
9 // sourceURL in the same line | 8 // sourceURL in the same line |
10 return addScript("function foo1(){}//# sourceURL=oneline.js\n") | 9 return addScript("function foo1(){}//# sourceURL=oneline.js\n") |
11 // sourceURL without end line | 10 // sourceURL without end line |
12 .then(() => addScript("function foo2(){}//# sourceURL=oneline-without-nl.js" )) | 11 .then(() => addScript("function foo2(){}//# sourceURL=oneline-without-nl.js" )) |
13 // other source urls | 12 // other source urls |
14 .then(() => addScript("function foo3(){}\n//# sourceURL=twoline.js\n")) | 13 .then(() => addScript("function foo3(){}\n//# sourceURL=twoline.js\n")) |
(...skipping 29 matching lines...) Expand all Loading... | |
44 } | 43 } |
45 | 44 |
46 Protocol.Debugger.onScriptParsed((message) => requestSourceAndDump(message, true )); | 45 Protocol.Debugger.onScriptParsed((message) => requestSourceAndDump(message, true )); |
47 Protocol.Debugger.onScriptFailedToParse((message) => requestSourceAndDump(messag e, false)); | 46 Protocol.Debugger.onScriptFailedToParse((message) => requestSourceAndDump(messag e, false)); |
48 addScripts() | 47 addScripts() |
49 .then(() => Protocol.Debugger.enable()) | 48 .then(() => Protocol.Debugger.enable()) |
50 .then(addScripts) | 49 .then(addScripts) |
51 .then(() => Protocol.Debugger.disable()) | 50 .then(() => Protocol.Debugger.disable()) |
52 | 51 |
53 .then(() => InspectorTest.log("Run gc and then Debugger.enable()..")) | 52 .then(() => InspectorTest.log("Run gc and then Debugger.enable()..")) |
54 .then(() => Protocol.Runtime.evaluate({ expression: "for (let i = 1; i < 20; + +i) eval(`foo${i} = undefined`); gc();" })) | 53 .then(() => Protocol.Runtime.evaluate({ expression: "for (let i = 1; i < 20; + +i) eval(`foo${i} = undefined`);" })) |
kozy
2016/11/03 01:23:36
I added this gc call here to check that v8-debugge
| |
55 .then(() => Protocol.Debugger.enable()) | 54 .then(() => Protocol.Debugger.enable()) |
56 .then(InspectorTest.completeTest); | 55 .then(InspectorTest.completeTest); |
57 | 56 |
58 function addScript(source) { | 57 function addScript(source) { |
59 return Protocol.Runtime.evaluate({ expression: source }); | 58 return Protocol.Runtime.evaluate({ expression: source }); |
60 } | 59 } |
61 | 60 |
62 function requestSourceAndDump(scriptParsedMessage, scriptParsed) { | 61 function requestSourceAndDump(scriptParsedMessage, scriptParsed) { |
63 Protocol.Debugger.getScriptSource({ scriptId: scriptParsedMessage.params.scrip tId }) | 62 Protocol.Debugger.getScriptSource({ scriptId: scriptParsedMessage.params.scrip tId }) |
64 .then((sourceMessage) => dumpScriptParsed(scriptParsedMessage, sourceMessage , scriptParsed)); | 63 .then((sourceMessage) => dumpScriptParsed(scriptParsedMessage, sourceMessage , scriptParsed)); |
(...skipping 19 matching lines...) Expand all Loading... | |
84 sourceResult.scriptSource = sourceResult.scriptSource.replace(/\n/g, "<nl>"); | 83 sourceResult.scriptSource = sourceResult.scriptSource.replace(/\n/g, "<nl>"); |
85 InspectorTest.log(scriptParsed ? "scriptParsed" : "scriptFailedToParse"); | 84 InspectorTest.log(scriptParsed ? "scriptParsed" : "scriptFailedToParse"); |
86 InspectorTest.logObject(sourceResult); | 85 InspectorTest.logObject(sourceResult); |
87 InspectorTest.logObject(params); | 86 InspectorTest.logObject(params); |
88 } | 87 } |
89 | 88 |
90 function matchExact(re, str) { | 89 function matchExact(re, str) { |
91 var match = str.match(re); | 90 var match = str.match(re); |
92 return match !== null && str === match[0]; | 91 return match !== null && str === match[0]; |
93 } | 92 } |
OLD | NEW |