Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Unified Diff: extensions/renderer/dispatcher.cc

Issue 1328313002: Disable the extension service worker checks that are crashing the renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable some tests as well Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/renderer/dispatcher.cc
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index 4fbc49b64f5334272b5f4d863064f61a5ece33a1..ad631e7dd18e1ce1bcc25e25ffcf685fe96e01a5 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) {

Powered by Google App Engine
This is Rietveld 408576698