Commit 6f3ea996 authored by Mathias Bynens's avatar Mathias Bynens Committed by Commit Bot

Prevent STATUS_ACCESS_VIOLATION in inspector overlay

Prior to a recent change [1], `InspectorOverlayAgent::SetInspectTool`
would call `InspectorOverlayAgent::LoadFrameForTool` which assigns to
`overlay_page_`. With the patch, that no longer happened, resulting in
`STATUS_ACCESS_VIOLATION` “oh snap” errors when using the “capture area
screenshot” functionality in DevTools.

This patch moves the “is the inspector agent enabled” check around so
that we don’t hit any `nullptr`s while still getting the desired
behavior of not rendering inspector overlays while taking screenshots.

[1]: https://chromium-review.googlesource.com/c/chromium/src/+/2235553

Bug: chromium:1091037, chromium:1122038
Change-Id: I36ab8b883f1e643bcc89ebaed4063cc1409ee466
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2387560Reviewed-by: default avatarPeter Marshall <petermarshall@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803417}
parent 0e87a315
......@@ -1372,13 +1372,13 @@ void InspectorOverlayAgent::EnsureEnableFrameOverlay() {
void InspectorOverlayAgent::SetInspectTool(InspectTool* inspect_tool) {
LocalFrameView* view = frame_impl_->GetFrameView();
LocalFrame* frame = GetFrame();
if (!view || !frame || !enabled_.Get())
if (!view || !frame)
return;
if (inspect_tool_)
inspect_tool_->Dispose();
if (inspect_tool) {
if (inspect_tool && enabled_.Get()) {
inspect_tool_ = inspect_tool;
LoadFrameForTool(inspect_tool->GetDataResourceId());
EnsureEnableFrameOverlay();
......
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