fix a bug that caused a crash when using an offscreen window with detached devtools, related to autofill popups

This commit is contained in:
Heilig Benedek 2017-09-10 22:24:54 +02:00 committed by Cheng Zhao
parent 5daaff91ea
commit e39aacb30e
6 changed files with 31 additions and 8 deletions

View file

@ -933,9 +933,10 @@ bool WebContents::OnMessageReceived(const IPC::Message& message,
auto relay = NativeWindowRelay::FromWebContents(web_contents());
if (!relay)
return false;
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(WebContents, message, frame_host)
IPC_MESSAGE_HANDLER(AtomAutofillFrameHostMsg_ShowPopup, ShowAutofillPopup)
IPC_END_MESSAGE_MAP()
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(NativeWindow, message, frame_host)
IPC_MESSAGE_FORWARD(AtomAutofillFrameHostMsg_ShowPopup,
relay->window.get(), NativeWindow::ShowAutofillPopup)
IPC_MESSAGE_FORWARD(AtomAutofillFrameHostMsg_HidePopup,
relay->window.get(), NativeWindow::HideAutofillPopup)
IPC_MESSAGE_UNHANDLED(handled = false)
@ -944,6 +945,16 @@ bool WebContents::OnMessageReceived(const IPC::Message& message,
return handled;
}
void WebContents::ShowAutofillPopup(
content::RenderFrameHost* frame_host,
const gfx::RectF& bounds,
const std::vector<base::string16>& values,
const std::vector<base::string16>& labels) {
auto relay = NativeWindowRelay::FromWebContents(web_contents());
if (relay)
relay->window->ShowAutofillPopup(frame_host, this, bounds, values, labels);
}
// There are three ways of destroying a webContents:
// 1. call webContents.destroy();
// 2. garbage collection;
@ -1624,7 +1635,7 @@ bool WebContents::IsOffScreen() const {
}
bool WebContents::IsOffScreenOrEmbedderOffscreen() const {
return IsOffScreen() || (embedder_ && embedder_->IsOffScreen());
return IsOffScreen() || (IsGuest() && embedder_ && embedder_->IsOffScreen());
}
void WebContents::OnPaint(const gfx::Rect& dirty_rect, const SkBitmap& bitmap) {