Commit 6ca90e6b authored by benwells's avatar benwells Committed by Commit bot

Handle WebContents going away in content settings bubbles.

This fixes null dereference crashes when tabs close with open bubbles.

BUG=622973

Review-Url: https://codereview.chromium.org/2103733002
Cr-Commit-Position: refs/heads/master@{#402610}
parent d0210f38
......@@ -978,7 +978,9 @@ ContentSettingMixedScriptBubbleModel::ContentSettingMixedScriptBubbleModel(
}
void ContentSettingMixedScriptBubbleModel::OnCustomLinkClicked() {
DCHECK(web_contents());
if (!web_contents())
return;
web_contents()->SendToAllFrames(
new ChromeViewMsg_SetAllowRunningInsecureContent(MSG_ROUTING_NONE, true));
web_contents()->GetMainFrame()->Send(new ChromeViewMsg_ReloadFrame(
......@@ -1083,6 +1085,9 @@ void ContentSettingRPHBubbleModel::OnRadioClicked(int radio_index) {
}
void ContentSettingRPHBubbleModel::OnDoneClicked() {
if (!web_contents())
return;
// The user has one chance to deal with the RPH content setting UI,
// then we remove it.
TabSpecificContentSettings::FromWebContents(web_contents())->
......@@ -1094,6 +1099,9 @@ void ContentSettingRPHBubbleModel::OnDoneClicked() {
}
void ContentSettingRPHBubbleModel::RegisterProtocolHandler() {
if (!web_contents())
return;
// A no-op if the handler hasn't been ignored, but needed in case the user
// selects sequences like register/ignore/register.
registry_->RemoveIgnoredHandler(pending_handler_);
......@@ -1104,6 +1112,9 @@ void ContentSettingRPHBubbleModel::RegisterProtocolHandler() {
}
void ContentSettingRPHBubbleModel::UnregisterProtocolHandler() {
if (!web_contents())
return;
registry_->OnDenyRegisterProtocolHandler(pending_handler_);
TabSpecificContentSettings::FromWebContents(web_contents())->
set_pending_protocol_handler_setting(CONTENT_SETTING_BLOCK);
......@@ -1111,6 +1122,9 @@ void ContentSettingRPHBubbleModel::UnregisterProtocolHandler() {
}
void ContentSettingRPHBubbleModel::IgnoreProtocolHandler() {
if (!web_contents())
return;
registry_->OnIgnoreRegisterProtocolHandler(pending_handler_);
TabSpecificContentSettings::FromWebContents(web_contents())->
set_pending_protocol_handler_setting(CONTENT_SETTING_DEFAULT);
......
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