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

Unified Diff: extensions/renderer/object_backed_native_handler.cc

Issue 1880933002: Begin to enable extension APIs in Extension Service Worker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments - 3 Created 4 years, 8 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/object_backed_native_handler.cc
diff --git a/extensions/renderer/object_backed_native_handler.cc b/extensions/renderer/object_backed_native_handler.cc
index 3728543d2be924e1d91fb9c3acb6c11e3f8c3270..671730be2f60b6676996ce1e3f9711338960e211 100644
--- a/extensions/renderer/object_backed_native_handler.cc
+++ b/extensions/renderer/object_backed_native_handler.cc
@@ -163,8 +163,12 @@ bool ObjectBackedNativeHandler::ContextCanAccessObject(
return true;
if (context == object->CreationContext())
return true;
+ // TODO(lazyboy): ScriptContextSet isn't available on worker threads. We
+ // should probably use WorkerScriptContextSet somehow.
ScriptContext* other_script_context =
- ScriptContextSet::GetContextByObject(object);
+ content::WorkerThread::GetCurrentId() == 0
+ ? ScriptContextSet::GetContextByObject(object)
+ : nullptr;
lazyboy 2016/04/18 18:42:14 FYI, I had to add this b/c accessing ScriptContext
if (!other_script_context || !other_script_context->web_frame())
return allow_null_context;

Powered by Google App Engine
This is Rietveld 408576698