| Index: third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-compileScript.html
|
| diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-compileScript.html b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-compileScript.html
|
| index 699e55bf0731193b46f82932f043c3da01bf9108..da8e833a6952aebd726edacc680ffea95c446565 100644
|
| --- a/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-compileScript.html
|
| +++ b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-compileScript.html
|
| @@ -6,37 +6,57 @@ function test()
|
| {
|
| var executionContextId;
|
|
|
| - InspectorTest.sendCommand("Runtime.enable", {});
|
| - InspectorTest.eventHandler["Runtime.executionContextCreated"] = function(messageObject)
|
| + InspectorTest.sendCommand("Debugger.enable", {}, onDebuggerEnabled);
|
| +
|
| + function onDebuggerEnabled()
|
| {
|
| - executionContextId = messageObject.params.context.id;
|
| + InspectorTest.sendCommand("Runtime.enable", {});
|
| + InspectorTest.eventHandler["Debugger.scriptParsed"] = onScriptParsed;
|
| + InspectorTest.eventHandler["Runtime.executionContextCreated"] = onExecutionContextCreated;
|
| + }
|
|
|
| - compileScriptPromise("\n (", false, "foo1.js")
|
| - .then(dumpResult)
|
| - .then(() => compileScriptPromise("239", true, "foo2.js"))
|
| - .then(dumpResult)
|
| - .then(() => compileScriptPromise("239", false, "foo3.js"))
|
| - .then(dumpResult)
|
| - .then(() => compileScriptPromise("testfunction f()\n{\n return 0;\n}\n", false, "foo4.js"))
|
| - .then(dumpResult)
|
| - .then(() => InspectorTest.completeTest());
|
| + function onScriptParsed(messageObject)
|
| + {
|
| + if (!messageObject.params.url)
|
| + return;
|
| + InspectorTest.log("Debugger.scriptParsed: " + messageObject.params.url);
|
| }
|
|
|
| - function dumpResult(messageObject)
|
| + function onExecutionContextCreated(messageObject)
|
| {
|
| - if (messageObject.result.exceptionDetails)
|
| - messageObject.result.exceptionDetails.scriptId = 0;
|
| - if (messageObject.result.scriptId)
|
| - messageObject.result.scriptId = 0;
|
| - InspectorTest.logObject(messageObject.result);
|
| + executionContextId = messageObject.params.context.id;
|
| + testCompileScript("\n (", false, "foo1.js")
|
| + .then(() => testCompileScript("239", true, "foo2.js"))
|
| + .then(() => testCompileScript("239", false, "foo3.js"))
|
| + .then(() => testCompileScript("testfunction f()\n{\n return 0;\n}\n", false, "foo4.js"))
|
| + .then(() => InspectorTest.completeTest());
|
| }
|
|
|
| - function compileScriptPromise(expression, persistScript, sourceURL)
|
| + function testCompileScript(expression, persistScript, sourceURL)
|
| {
|
| - var cb;
|
| - var p = new Promise((resolver) => cb = resolver);
|
| - InspectorTest.sendCommand("Runtime.compileScript", { expression: expression, sourceURL: sourceURL, persistScript: persistScript, executionContextId: executionContextId }, cb);
|
| - return p;
|
| + InspectorTest.log("Compiling script: " + sourceURL);
|
| + InspectorTest.log(" persist: " + persistScript);
|
| + var callback;
|
| + var promise = new Promise(resolver => callback = resolver);
|
| + InspectorTest.sendCommand("Runtime.compileScript", {
|
| + expression: expression,
|
| + sourceURL: sourceURL,
|
| + persistScript: persistScript,
|
| + executionContextId: executionContextId
|
| + }, onCompiled);
|
| + return promise;
|
| +
|
| + function onCompiled(messageObject)
|
| + {
|
| + var result = messageObject.result;
|
| + if (result.exceptionDetails)
|
| + result.exceptionDetails.scriptId = 0;
|
| + if (result.scriptId)
|
| + result.scriptId = 0;
|
| + InspectorTest.logObject(result, "compilation result: ");
|
| + InspectorTest.log("-----");
|
| + callback();
|
| + }
|
| }
|
| }
|
| </script>
|
|
|