Commit 7edf6aa1 authored by Christopher Lam's avatar Christopher Lam Committed by Commit Bot

Speculative fix for content_action.cc crash.

This CL changes RulesRegistry::DeserializeAndAddRules() to bail out if
the extension has been unloaded. This may have been the cause of some
crashes where a ContentAction was being created for an unloaded
extension.

Bug: 1010336, 1115969
Change-Id: Ibbd01c1b5b0a8f4cc3c2668fbb4b804189ba0b20
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2345939
Commit-Queue: calamity <calamity@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800433}
parent d0f0696d
......@@ -21,6 +21,7 @@
#include "extensions/browser/api/declarative/rules_cache_delegate.h"
#include "extensions/browser/extension_error.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/state_store.h"
......@@ -311,6 +312,14 @@ void RulesRegistry::DeserializeAndAddRules(const std::string& extension_id,
std::unique_ptr<base::Value> rules) {
DCHECK_CURRENTLY_ON(owner_thread());
// Since this is called in response to asynchronously loading rules from
// storage, the extension may have been unloaded by the time this is called.
if (!ExtensionRegistry::Get(browser_context())
->enabled_extensions()
.Contains(extension_id)) {
return;
}
std::string error = AddRulesNoFill(extension_id, RulesFromValue(rules.get()),
&rules_, nullptr);
if (!error.empty())
......
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