Commit f3432f4b authored by Ramin Halavati's avatar Ramin Halavati Committed by Commit Bot

Add fail safe mechanism to Extension Event Router.

To investigate a crash on ChromeOS, fail safe code and reporting are
added to EventRouter dispatcher and ChromeExtensionsBrowserClient.

Bug: 870838
Change-Id: I8da1a56f80e247d68f26c8d8027f1eb36cea272f
Reviewed-on: https://chromium-review.googlesource.com/c/1335594
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608434}
parent c893a340
...@@ -114,6 +114,17 @@ bool ChromeExtensionsBrowserClient::AreExtensionsDisabled( ...@@ -114,6 +114,17 @@ bool ChromeExtensionsBrowserClient::AreExtensionsDisabled(
bool ChromeExtensionsBrowserClient::IsValidContext( bool ChromeExtensionsBrowserClient::IsValidContext(
content::BrowserContext* context) { content::BrowserContext* context) {
// TODO(https://crbug.com/870838): Remove after investigating the bug.
if (!context) {
LOG(ERROR) << "Unexpected null context";
NOTREACHED();
return false;
}
if (!g_browser_process) {
LOG(ERROR) << "Unexpected null g_browser_process";
NOTREACHED();
return false;
}
Profile* profile = static_cast<Profile*>(context); Profile* profile = static_cast<Profile*>(context);
return g_browser_process->profile_manager() && return g_browser_process->profile_manager() &&
g_browser_process->profile_manager()->IsValidProfile(profile); g_browser_process->profile_manager()->IsValidProfile(profile);
......
...@@ -722,6 +722,12 @@ void EventRouter::DoDispatchEventToSenderBookkeepingOnUI( ...@@ -722,6 +722,12 @@ void EventRouter::DoDispatchEventToSenderBookkeepingOnUI(
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
BrowserContext* browser_context = BrowserContext* browser_context =
reinterpret_cast<BrowserContext*>(browser_context_id); reinterpret_cast<BrowserContext*>(browser_context_id);
// TODO(https://crbug.com/870838): Remove after investigating the bug.
if (!ExtensionsBrowserClient::Get()) {
LOG(ERROR) << "ExtensionsBrowserClient does not exist.";
NOTREACHED();
return;
}
if (!ExtensionsBrowserClient::Get()->IsValidContext(browser_context)) if (!ExtensionsBrowserClient::Get()->IsValidContext(browser_context))
return; return;
const Extension* extension = const Extension* extension =
......
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