OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> |
| 4 <script> |
| 5 function test() |
| 6 { |
| 7 var executionContextId; |
| 8 |
| 9 InspectorTest.sendCommand("Runtime.enable", {}); |
| 10 InspectorTest.eventHandler["Runtime.executionContextCreated"] = function(mes
sageObject) |
| 11 { |
| 12 executionContextId = messageObject.params.context.id; |
| 13 |
| 14 compileScriptPromise("\n (", false, "foo1.js") |
| 15 .then(dumpResult) |
| 16 .then(() => compileScriptPromise("239", true, "foo2.js")) |
| 17 .then(dumpResult) |
| 18 .then(() => compileScriptPromise("239", false, "foo3.js")) |
| 19 .then(dumpResult) |
| 20 .then(() => compileScriptPromise("testfunction f()\n{\n return 0;
\n}\n", false, "foo4.js")) |
| 21 .then(dumpResult) |
| 22 .then(() => InspectorTest.completeTest()); |
| 23 } |
| 24 |
| 25 function dumpResult(messageObject) |
| 26 { |
| 27 if (messageObject.result.exceptionDetails) |
| 28 messageObject.result.exceptionDetails.scriptId = 0; |
| 29 if (messageObject.result.scriptId) |
| 30 messageObject.result.scriptId = 0; |
| 31 InspectorTest.logObject(messageObject.result); |
| 32 } |
| 33 |
| 34 function compileScriptPromise(expression, persistScript, sourceURL) |
| 35 { |
| 36 var cb; |
| 37 var p = new Promise((resolver) => cb = resolver); |
| 38 InspectorTest.sendCommand("Runtime.compileScript", { expression: express
ion, sourceURL: sourceURL, persistScript: persistScript, executionContextId: exe
cutionContextId }, cb); |
| 39 return p; |
| 40 } |
| 41 } |
| 42 </script> |
| 43 </head> |
| 44 <body onLoad="runTest();"></body> |
| 45 </html> |
OLD | NEW |