diff options
author | kalman <kalman@chromium.org> | 2015-09-09 01:58:46 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-09 08:59:36 +0000 |
commit | 881d73aac25304b2fc310ba2a63ac2abd4a0cdfc (patch) | |
tree | 97459cced4d66ca504cbb800ba24a1d502850cbc /extensions/renderer | |
parent | d58fe78655d2299474d8e51074e74cf527583f15 (diff) | |
download | chromium_src-881d73aac25304b2fc310ba2a63ac2abd4a0cdfc.zip chromium_src-881d73aac25304b2fc310ba2a63ac2abd4a0cdfc.tar.gz chromium_src-881d73aac25304b2fc310ba2a63ac2abd4a0cdfc.tar.bz2 |
Disable the extension service worker checks that are crashing the renderer.
They're triggering for hosted apps, which is a bug. It's still not correct and
that will be fixed soon, but in the meantime don't crash.
BUG=525965, 529516
R=rdevlin.cronin@chromium.org
Review URL: https://codereview.chromium.org/1328313002
Cr-Commit-Position: refs/heads/master@{#347859}
Diffstat (limited to 'extensions/renderer')
-rw-r--r-- | extensions/renderer/dispatcher.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc index 4fbc49b..ad631e7 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc @@ -199,7 +199,11 @@ class ServiceWorkerScriptContextSet { void Insert(const GURL& url, scoped_ptr<ScriptContext> context) { base::AutoLock lock(lock_); - CHECK(script_contexts_.find(url) == script_contexts_.end()); + scoped_ptr<ScriptContext> existing = script_contexts_.take_and_erase(url); + // This should be CHECK(!existing), but can't until these ScriptContexts + // are keyed on v8::Contexts rather than URLs. See crbug.com/525965. + if (existing) + existing->Invalidate(); script_contexts_.set(url, context.Pass()); } @@ -358,6 +362,15 @@ void Dispatcher::DidInitializeServiceWorkerContextOnWorkerThread( const GURL& url) { const base::TimeTicks start_time = base::TimeTicks::Now(); + if (!url.SchemeIs(kExtensionScheme) && + !url.SchemeIs(kExtensionResourceScheme)) { + // Early-out if this isn't a chrome-extension:// or resource scheme, + // because looking up the extension registry is unnecessary if it's not. + // Checking this will also skip over hosted apps, which is the desired + // behavior - hosted app service workers are not our concern. + return; + } + const Extension* extension = RendererExtensionRegistry::Get()->GetExtensionOrAppByURL(url); @@ -417,8 +430,11 @@ void Dispatcher::WillReleaseScriptContext( // static void Dispatcher::WillDestroyServiceWorkerContextOnWorkerThread( const GURL& url) { - if (RendererExtensionRegistry::Get()->GetExtensionOrAppByURL(url)) + if (url.SchemeIs(kExtensionScheme) || + url.SchemeIs(kExtensionResourceScheme)) { + // See comment in DidInitializeServiceWorkerContextOnWorkerThread. g_service_worker_script_context_set.Get().Remove(url); + } } void Dispatcher::DidCreateDocumentElement(blink::WebLocalFrame* frame) { |