Commit dd850c31 authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

[DevTools] allow nested command processing

It allows to break infinite loops started using Runtime.evaluate, e.g.
from console.

R=dgozman@chromium.org

Bug: chromium:820258
Change-Id: I9110ba6db50b60b803b2ec50291d31b854e216bf
Reviewed-on: https://chromium-review.googlesource.com/956525Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542014}
parent 86d326be
Tests that we can break infinite loop started from console.
Run infinite loop
Request pause
Script execution paused.
Change condition on pause to finish infinite loop
Message count: 3
Script execution resumed.
Message count: 4
while(a) {}; 42
a = false
false
42
Infinite loop finished
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(async function() {
TestRunner.addResult(
`Tests that we can break infinite loop started from console.`);
await TestRunner.loadModule('console_test_runner');
await TestRunner.loadModule('sources_test_runner');
await TestRunner.showPanel('sources');
await TestRunner.evaluateInPagePromise('a = true');
await SourcesTestRunner.startDebuggerTestPromise();
TestRunner.addResult('Run infinite loop');
ConsoleTestRunner.evaluateInConsole(`while(a) {}; 42`);
TestRunner.addResult('Request pause');
SourcesTestRunner.togglePause();
await SourcesTestRunner.waitUntilPausedPromise();
TestRunner.addResult('Change condition on pause to finish infinite loop');
ConsoleTestRunner.evaluateInConsole('a = false');
await ConsoleTestRunner.waitForConsoleMessagesPromise(3);
await new Promise(resolve => SourcesTestRunner.resumeExecution(resolve));
await ConsoleTestRunner.waitForConsoleMessagesPromise(4);
ConsoleTestRunner.dumpConsoleMessages();
TestRunner.addResult('Infinite loop finished');
SourcesTestRunner.completeDebuggerTest();
})();
......@@ -385,8 +385,6 @@ void WebDevToolsAgentImpl::Session::DispatchProtocolCommand(
// detach, so we have to check a flag here.
if (detached_)
return;
InspectorTaskRunner::IgnoreInterruptsScope scope(
frame_->GetFrame()->GetInspectorTaskRunner());
inspector_session_->DispatchProtocolMessage(method, message);
}
......
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