Commit f68e4323 authored by Christopher Lam's avatar Christopher Lam Committed by Commit Bot

Add null check to ContentAction::Apply.

This CL is a speculative fix for a Feedback App crash.

Bug: 1010336
Change-Id: Ifc97455fbf942af41dc54417cc7449b888577d32
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2210602Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: calamity <calamity@chromium.org>
Auto-Submit: calamity <calamity@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774999}
parent 7463bed1
......@@ -73,11 +73,24 @@ class ShowExtensionAction : public ContentAction {
*error = kNoAction;
return nullptr;
}
return std::make_unique<ShowExtensionAction>();
auto action = std::make_unique<ShowExtensionAction>();
// Sanity check for https://crbug.com/1010336.
// |browser_context| is null in unit tests.
CHECK(!browser_context || action->GetAction(browser_context, extension));
return action;
}
// Implementation of ContentAction:
void Apply(const ApplyInfo& apply_info) const override {
// Sanity check for https://crbug.com/1010336.
// This check fails on the 2 cases that could cause
// ExtensionActionManager::GetExtensionAction to return null so we can
// understand null-related crashes.
CHECK(ActionInfo::GetExtensionActionInfo(apply_info.extension));
CHECK(ExtensionRegistry::Get(apply_info.browser_context)
->enabled_extensions()
.Contains(apply_info.extension->id()));
ExtensionAction* action =
GetAction(apply_info.browser_context, apply_info.extension);
action->DeclarativeShow(ExtensionTabUtil::GetTabId(apply_info.tab));
......
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