| Index: third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-compileScript.js
|
| diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-compileScript.js b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-compileScript.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7bfc5ca861f6cf5f8e4d3635ebbc0c3fbe4e9d15
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-compileScript.js
|
| @@ -0,0 +1,40 @@
|
| +(async function(testRunner) {
|
| + let {page, session, dp} = await testRunner.startBlank(``);
|
| +
|
| + await dp.Debugger.enable();
|
| + dp.Debugger.onScriptParsed(messageObject => {
|
| + if (!messageObject.params.url)
|
| + return;
|
| + testRunner.log('Debugger.scriptParsed: ' + messageObject.params.url);
|
| + });
|
| +
|
| + dp.Runtime.enable();
|
| + var message = await dp.Runtime.onceExecutionContextCreated();
|
| + var executionContextId = message.params.context.id;
|
| + await testCompileScript('\n (', false, 'foo1.js');
|
| + await testCompileScript('239', true, 'foo2.js');
|
| + await testCompileScript('239', false, 'foo3.js');
|
| + await testCompileScript('testfunction f()\n{\n return 0;\n}\n', false, 'foo4.js');
|
| + testRunner.completeTest();
|
| +
|
| + async function testCompileScript(expression, persistScript, sourceURL) {
|
| + testRunner.log('Compiling script: ' + sourceURL);
|
| + testRunner.log(' persist: ' + persistScript);
|
| + var messageObject = await dp.Runtime.compileScript({
|
| + expression: expression,
|
| + sourceURL: sourceURL,
|
| + persistScript: persistScript,
|
| + executionContextId: executionContextId
|
| + });
|
| + var result = messageObject.result;
|
| + if (result.exceptionDetails) {
|
| + result.exceptionDetails.exceptionId = 0;
|
| + result.exceptionDetails.exception.objectId = 0;
|
| + result.exceptionDetails.scriptId = 0;
|
| + }
|
| + if (result.scriptId)
|
| + result.scriptId = 0;
|
| + testRunner.logObject(result, 'compilation result: ');
|
| + testRunner.log('-----');
|
| + }
|
| +})
|
|
|