| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 var executionContextId; | |
| 6 | |
| 7 InspectorTest.sendCommand("Debugger.enable", {}, onDebuggerEnabled); | |
| 8 | |
| 9 function onDebuggerEnabled() | |
| 10 { | |
| 11 InspectorTest.sendCommand("Runtime.enable", {}); | |
| 12 InspectorTest.eventHandler["Debugger.scriptParsed"] = onScriptParsed; | |
| 13 InspectorTest.eventHandler["Runtime.executionContextCreated"] = onExecutionCon
textCreated; | |
| 14 } | |
| 15 | |
| 16 function onScriptParsed(messageObject) | |
| 17 { | |
| 18 if (!messageObject.params.url) | |
| 19 return; | |
| 20 InspectorTest.log("Debugger.scriptParsed: " + messageObject.params.url); | |
| 21 } | |
| 22 | |
| 23 function onExecutionContextCreated(messageObject) | |
| 24 { | |
| 25 executionContextId = messageObject.params.context.id; | |
| 26 testCompileScript("\n (", false, "foo1.js") | |
| 27 .then(() => testCompileScript("239", true, "foo2.js")) | |
| 28 .then(() => testCompileScript("239", false, "foo3.js")) | |
| 29 .then(() => testCompileScript("testfunction f()\n{\n return 0;\n}\n", fal
se, "foo4.js")) | |
| 30 .then(() => InspectorTest.completeTest()); | |
| 31 } | |
| 32 | |
| 33 function testCompileScript(expression, persistScript, sourceURL) | |
| 34 { | |
| 35 InspectorTest.log("Compiling script: " + sourceURL); | |
| 36 InspectorTest.log(" persist: " + persistScript); | |
| 37 var callback; | |
| 38 var promise = new Promise(resolver => callback = resolver); | |
| 39 InspectorTest.sendCommand("Runtime.compileScript", { | |
| 40 expression: expression, | |
| 41 sourceURL: sourceURL, | |
| 42 persistScript: persistScript, | |
| 43 executionContextId: executionContextId | |
| 44 }, onCompiled); | |
| 45 return promise; | |
| 46 | |
| 47 function onCompiled(messageObject) | |
| 48 { | |
| 49 var result = messageObject.result; | |
| 50 if (result.exceptionDetails) { | |
| 51 result.exceptionDetails.exceptionId = 0; | |
| 52 result.exceptionDetails.exception.objectId = 0; | |
| 53 result.exceptionDetails.scriptId = 0; | |
| 54 } | |
| 55 if (result.scriptId) | |
| 56 result.scriptId = 0; | |
| 57 InspectorTest.logObject(result, "compilation result: "); | |
| 58 InspectorTest.log("-----"); | |
| 59 callback(); | |
| 60 } | |
| 61 } | |
| OLD | NEW |