Commit 3db89498 authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

[DevTools] process Runtime.terminateExecution using interuption

.. and Emulation.setScriptExecutionDisabled as well.

R=pfeldman@chromium.org

Bug: chromium:820640
Change-Id: I72d245cf78d80ad0444a036d29220562f787b585
Reviewed-on: https://chromium-review.googlesource.com/957820
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544084}
parent 079441f2
......@@ -24,7 +24,9 @@ bool ShouldSendOnIO(const std::string& method) {
method == "Debugger.setBreakpointByUrl" ||
method == "Debugger.removeBreakpoint" ||
method == "Debugger.setBreakpointsActive" ||
method == "Performance.getMetrics" || method == "Page.crash";
method == "Performance.getMetrics" || method == "Page.crash" ||
method == "Runtime.terminateExecution" ||
method == "Emulation.setScriptExecutionDisabled";
}
} // namespace
......
Tests terminate execution.
{
description : 1
type : number
value : 1
}
{
id : <number>
result : {
}
}
{
id : <number>
result : {
result : {
type : string
value : evaluated after
}
}
}
(async function(testRunner) {
var {page, session, dp} =
await testRunner.startBlank('Tests terminate execution.');
dp.Runtime.enable();
let consoleCall = dp.Runtime.onceConsoleAPICalled();
dp.Runtime.evaluate({
expression: `let p = fetch('data:text/plain,Hello again!');
p.then(() => {console.log(1); while(true){}});
p.then(() => console.log(42));`
});
await consoleCall.then(msg => testRunner.log(msg.params.args[0]));
await Promise.all([
dp.Runtime
.evaluate({expression: '\'evaluated after\'', returnByValue: true})
.then(msg => testRunner.log(msg)),
dp.Runtime.terminateExecution().then(msg => testRunner.log(msg))
]);
testRunner.completeTest();
})
Tests terminate execution.
{
id : <number>
result : {
}
}
{
error : {
code : -32000
message : Execution was terminated
}
id : <number>
}
(async function(testRunner) {
var {page, session, dp} =
await testRunner.startHTML(`
<div></div>
<script>
document.querySelector('div').addEventListener('click', () => { console.log(42); while(true){} });
document.querySelector('div').addEventListener('click', () => { while(true){} });
</script>
`, 'Tests terminate execution.');
dp.Runtime.enable();
let promise =
dp.Runtime.evaluate({expression: `document.querySelector('div').click()`})
.then(msg => testRunner.log(msg));
await dp.Runtime.onceConsoleAPICalled();
await Promise.all([
dp.Emulation.setScriptExecutionDisabled({value: true}),
dp.Runtime.terminateExecution().then(msg => testRunner.log(msg)), promise
]);
testRunner.completeTest();
})
......@@ -111,7 +111,9 @@ bool ShouldInterruptForMethod(const String& method) {
method == "Debugger.setBreakpointByUrl" ||
method == "Debugger.removeBreakpoint" ||
method == "Debugger.setBreakpointsActive" ||
method == "Performance.getMetrics" || method == "Page.crash";
method == "Performance.getMetrics" || method == "Page.crash" ||
method == "Runtime.terminateExecution" ||
method == "Emulation.setScriptExecutionDisabled";
}
} // namespace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment