Commit c0746819 authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

devtools: Check if the agent is enabled during markUndoableState

The agent can be disabled when this message arrives, just like the
undo() and redo() methods above.

Check for this explicitly because it sets history_ back to null which
can cause a nullptr dereference.

Bug: 1115856
Change-Id: I503a8dffc5abd3b490d6ca21ae22f0edafb8e42d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2367680
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: default avatarSimon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801024}
parent f49e18ab
......@@ -1337,6 +1337,8 @@ Response InspectorDOMAgent::redo() {
}
Response InspectorDOMAgent::markUndoableState() {
if (!enabled_.Get())
return Response::ServerError("DOM agent is not enabled");
history_->MarkUndoableState();
return Response::Success();
}
......
Tests that DOM.markUndoableState does not crash when DOM is disabled.
Did not crash
(async function(testRunner) {
const {page, session, dp} = await testRunner.startHTML(`
<input></input>
`, 'Tests that DOM.markUndoableState does not crash when DOM is disabled.');
await dp.DOM.markUndoableState();
testRunner.log('Did not crash');
testRunner.completeTest();
})
\ No newline at end of file
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