Index: third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js |
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js |
index 1e932c0968fb0c0ca4e826bdeaaf04cce7870cce..dfbfc820ffd6c5f815b6e0929240bbce7487f293 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js |
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js |
@@ -44,16 +44,14 @@ InspectorTest.flushResults = function() |
results = []; |
} |
-InspectorTest.evaluateInPage = function(code, callback) |
+InspectorTest.evaluateInPage = async function(code, callback) |
{ |
- callback = InspectorTest.safeWrap(callback); |
- |
- function mycallback(error, result, exceptionDetails) |
- { |
- if (!error) |
- callback(InspectorTest.runtimeModel.createRemoteObject(result), exceptionDetails); |
- } |
- InspectorTest.RuntimeAgent.evaluate(code, "console", false, mycallback); |
+ var response = await InspectorTest.RuntimeAgent.invoke_evaluate({ |
+ expression: code, |
+ objectGroup: "console" |
+ }); |
+ if (!response[Protocol.Error]) |
+ InspectorTest.safeWrap(callback)(InspectorTest.runtimeModel.createRemoteObject(response.result), response.exceptionDetails); |
} |
InspectorTest.addScriptUISourceCode = function(url, content, isContentScript, worldId) { |
@@ -67,7 +65,7 @@ InspectorTest.addScriptUISourceCode = function(url, content, isContentScript, wo |
InspectorTest.addScriptForFrame = function(url, content, frame) { |
content += '\n//# sourceURL=' + url; |
var executionContext = InspectorTest.runtimeModel.executionContexts().find(context => context.frameId === frame.id); |
- InspectorTest.RuntimeAgent.evaluate(content, "console", false, false, executionContext.id, function() { }); |
+ InspectorTest.RuntimeAgent.evaluate(content, "console", false, false, executionContext.id); |
} |
InspectorTest.evaluateInPagePromise = function(code) |
@@ -75,34 +73,25 @@ InspectorTest.evaluateInPagePromise = function(code) |
return new Promise(succ => InspectorTest.evaluateInPage(code, succ)); |
} |
-InspectorTest.evaluateInPageAsync = function(code) |
+InspectorTest.evaluateInPageAsync = async function(code) |
{ |
- var callback; |
- var promise = new Promise((fulfill) => { callback = fulfill }); |
- InspectorTest.RuntimeAgent.evaluate(code, |
- "console", |
- /* includeCommandLineAPI */ false, |
- /* doNotPauseOnExceptionsAndMuteConsole */ undefined, |
- /* contextId */ undefined, |
- /* returnByValue */ undefined, |
- /* generatePreview */ undefined, |
- /* userGesture */ undefined, |
- /* awaitPromise */ true, |
- mycallback); |
+ var response = await InspectorTest.RuntimeAgent.invoke_evaluate({ |
+ expression: code, |
+ objectGroup: "console", |
+ includeCommandLineAPI: false, |
+ silent: undefined, |
+ contextId: undefined, |
+ returnByValue: undefined, |
+ generatePreview: undefined, |
+ userGesture: undefined, |
+ awaitPromise: true |
+ }); |
- function mycallback(error, result, exceptionDetails) |
- { |
- if (!error && !exceptionDetails) { |
- callback(InspectorTest.runtimeModel.createRemoteObject(result)); |
- } else { |
- if (error) |
- InspectorTest.addResult("Error: " + error); |
- else |
- InspectorTest.addResult("Error: " + (exceptionDetails ? exceptionDetails.text : " exception while evaluation in page.")); |
- InspectorTest.completeTest(); |
- } |
- } |
- return promise; |
+ var error = response[Protocol.Error]; |
+ if (!error && !response.exceptionDetails) |
+ return InspectorTest.runtimeModel.createRemoteObject(response.result); |
+ InspectorTest.addResult("Error: " + (error || response.exceptionDetails && response.exceptionDetails.text || "exception while evaluation in page.")); |
+ InspectorTest.completeTest(); |
} |
InspectorTest.callFunctionInPageAsync = function(name, args) |