OLD | NEW |
(Empty) | |
| 1 (async function(testRunner) { |
| 2 let {page, session, dp} = await testRunner.startBlank(``); |
| 3 |
| 4 await dp.Debugger.enable(); |
| 5 dp.Debugger.onScriptParsed(messageObject => { |
| 6 if (!messageObject.params.url) |
| 7 return; |
| 8 testRunner.log('Debugger.scriptParsed: ' + messageObject.params.url); |
| 9 }); |
| 10 |
| 11 dp.Runtime.enable(); |
| 12 var message = await dp.Runtime.onceExecutionContextCreated(); |
| 13 var executionContextId = message.params.context.id; |
| 14 await testCompileScript('\n (', false, 'foo1.js'); |
| 15 await testCompileScript('239', true, 'foo2.js'); |
| 16 await testCompileScript('239', false, 'foo3.js'); |
| 17 await testCompileScript('testfunction f()\n{\n return 0;\n}\n', false, 'foo
4.js'); |
| 18 testRunner.completeTest(); |
| 19 |
| 20 async function testCompileScript(expression, persistScript, sourceURL) { |
| 21 testRunner.log('Compiling script: ' + sourceURL); |
| 22 testRunner.log(' persist: ' + persistScript); |
| 23 var messageObject = await dp.Runtime.compileScript({ |
| 24 expression: expression, |
| 25 sourceURL: sourceURL, |
| 26 persistScript: persistScript, |
| 27 executionContextId: executionContextId |
| 28 }); |
| 29 var result = messageObject.result; |
| 30 if (result.exceptionDetails) { |
| 31 result.exceptionDetails.exceptionId = 0; |
| 32 result.exceptionDetails.exception.objectId = 0; |
| 33 result.exceptionDetails.scriptId = 0; |
| 34 } |
| 35 if (result.scriptId) |
| 36 result.scriptId = 0; |
| 37 testRunner.logObject(result, 'compilation result: '); |
| 38 testRunner.log('-----'); |
| 39 } |
| 40 }) |
OLD | NEW |