Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: test/inspector/debugger/script-on-after-compile.js

Issue 2473273005: Revert of [debugger] simplify fetching scripts for inspector. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/api.cc ('k') | test/inspector/debugger/script-on-after-compile-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
4 5
5 print("Checks that inspector correctly process compiled scripts"); 6 print("Checks that inspector correctly process compiled scripts");
6 7
7 function addScripts() { 8 function addScripts() {
8 // sourceURL in the same line 9 // sourceURL in the same line
9 return addScript("function foo1(){}//# sourceURL=oneline.js\n") 10 return addScript("function foo1(){}//# sourceURL=oneline.js\n")
10 // sourceURL without end line 11 // sourceURL without end line
11 .then(() => addScript("function foo2(){}//# sourceURL=oneline-without-nl.js" )) 12 .then(() => addScript("function foo2(){}//# sourceURL=oneline-without-nl.js" ))
12 // other source urls 13 // other source urls
13 .then(() => addScript("function foo3(){}\n//# sourceURL=twoline.js\n")) 14 .then(() => addScript("function foo3(){}\n//# sourceURL=twoline.js\n"))
(...skipping 27 matching lines...) Expand all
41 .then(() => addScript("function foo18(){}\n\n\n")) 42 .then(() => addScript("function foo18(){}\n\n\n"))
42 .then(() => addScript("function foo19(){}\n\n\n\n")); 43 .then(() => addScript("function foo19(){}\n\n\n\n"));
43 } 44 }
44 45
45 Protocol.Debugger.onScriptParsed((message) => requestSourceAndDump(message, true )); 46 Protocol.Debugger.onScriptParsed((message) => requestSourceAndDump(message, true ));
46 Protocol.Debugger.onScriptFailedToParse((message) => requestSourceAndDump(messag e, false)); 47 Protocol.Debugger.onScriptFailedToParse((message) => requestSourceAndDump(messag e, false));
47 addScripts() 48 addScripts()
48 .then(() => Protocol.Debugger.enable()) 49 .then(() => Protocol.Debugger.enable())
49 .then(addScripts) 50 .then(addScripts)
50 .then(() => Protocol.Debugger.disable()) 51 .then(() => Protocol.Debugger.disable())
51 .then(() => InspectorTest.log("Remove script references and re-enable debugger .")) 52
52 .then(() => Protocol.Runtime.evaluate( 53 .then(() => InspectorTest.log("Run gc and then Debugger.enable().."))
53 { expression: "for (let i = 1; i < 20; ++i) eval(`foo${i} = undefined`);" })) 54 .then(() => Protocol.Runtime.evaluate({ expression: "for (let i = 1; i < 20; + +i) eval(`foo${i} = undefined`); gc();" }))
54 .then(() => Protocol.HeapProfiler.collectGarbage())
55 .then(() => Protocol.Debugger.enable()) 55 .then(() => Protocol.Debugger.enable())
56 .then(InspectorTest.completeTest); 56 .then(InspectorTest.completeTest);
57 57
58 function addScript(source) { 58 function addScript(source) {
59 return Protocol.Runtime.evaluate({ expression: source }); 59 return Protocol.Runtime.evaluate({ expression: source });
60 } 60 }
61 61
62 function requestSourceAndDump(scriptParsedMessage, scriptParsed) { 62 function requestSourceAndDump(scriptParsedMessage, scriptParsed) {
63 Protocol.Debugger.getScriptSource({ scriptId: scriptParsedMessage.params.scrip tId }) 63 Protocol.Debugger.getScriptSource({ scriptId: scriptParsedMessage.params.scrip tId })
64 .then((sourceMessage) => dumpScriptParsed(scriptParsedMessage, sourceMessage , scriptParsed)); 64 .then((sourceMessage) => dumpScriptParsed(scriptParsedMessage, sourceMessage , scriptParsed));
(...skipping 19 matching lines...) Expand all
84 sourceResult.scriptSource = sourceResult.scriptSource.replace(/\n/g, "<nl>"); 84 sourceResult.scriptSource = sourceResult.scriptSource.replace(/\n/g, "<nl>");
85 InspectorTest.log(scriptParsed ? "scriptParsed" : "scriptFailedToParse"); 85 InspectorTest.log(scriptParsed ? "scriptParsed" : "scriptFailedToParse");
86 InspectorTest.logObject(sourceResult); 86 InspectorTest.logObject(sourceResult);
87 InspectorTest.logObject(params); 87 InspectorTest.logObject(params);
88 } 88 }
89 89
90 function matchExact(re, str) { 90 function matchExact(re, str) {
91 var match = str.match(re); 91 var match = str.match(re);
92 return match !== null && str === match[0]; 92 return match !== null && str === match[0];
93 } 93 }
OLDNEW
« no previous file with comments | « src/api.cc ('k') | test/inspector/debugger/script-on-after-compile-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698