| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource
s/inspector-protocol-test.js"></script> | |
| 4 <script> | |
| 5 function test() | |
| 6 { | |
| 7 var executionContextId; | |
| 8 | |
| 9 InspectorTest.sendCommand("Debugger.enable", {}, onDebuggerEnabled); | |
| 10 | |
| 11 function onDebuggerEnabled() | |
| 12 { | |
| 13 InspectorTest.sendCommand("Runtime.enable", {}); | |
| 14 InspectorTest.eventHandler["Debugger.scriptParsed"] = onScriptParsed; | |
| 15 InspectorTest.eventHandler["Runtime.executionContextCreated"] = onExecut
ionContextCreated; | |
| 16 } | |
| 17 | |
| 18 function onScriptParsed(messageObject) | |
| 19 { | |
| 20 if (!messageObject.params.url) | |
| 21 return; | |
| 22 InspectorTest.log("Debugger.scriptParsed: " + messageObject.params.url); | |
| 23 } | |
| 24 | |
| 25 function onExecutionContextCreated(messageObject) | |
| 26 { | |
| 27 executionContextId = messageObject.params.context.id; | |
| 28 testCompileScript("\n (", false, "foo1.js") | |
| 29 .then(() => testCompileScript("239", true, "foo2.js")) | |
| 30 .then(() => testCompileScript("239", false, "foo3.js")) | |
| 31 .then(() => testCompileScript("testfunction f()\n{\n return 0;\n}
\n", false, "foo4.js")) | |
| 32 .then(() => InspectorTest.completeTest()); | |
| 33 } | |
| 34 | |
| 35 function testCompileScript(expression, persistScript, sourceURL) | |
| 36 { | |
| 37 InspectorTest.log("Compiling script: " + sourceURL); | |
| 38 InspectorTest.log(" persist: " + persistScript); | |
| 39 var callback; | |
| 40 var promise = new Promise(resolver => callback = resolver); | |
| 41 InspectorTest.sendCommand("Runtime.compileScript", { | |
| 42 expression: expression, | |
| 43 sourceURL: sourceURL, | |
| 44 persistScript: persistScript, | |
| 45 executionContextId: executionContextId | |
| 46 }, onCompiled); | |
| 47 return promise; | |
| 48 | |
| 49 function onCompiled(messageObject) | |
| 50 { | |
| 51 var result = messageObject.result; | |
| 52 if (result.exceptionDetails) { | |
| 53 result.exceptionDetails.exceptionId = 0; | |
| 54 result.exceptionDetails.exception.objectId = 0; | |
| 55 result.exceptionDetails.scriptId = 0; | |
| 56 } | |
| 57 if (result.scriptId) | |
| 58 result.scriptId = 0; | |
| 59 InspectorTest.logObject(result, "compilation result: "); | |
| 60 InspectorTest.log("-----"); | |
| 61 callback(); | |
| 62 } | |
| 63 } | |
| 64 } | |
| 65 </script> | |
| 66 </head> | |
| 67 <body onLoad="runTest();"></body> | |
| 68 </html> | |
| OLD | NEW |