Index: third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp |
diff --git a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp |
index 82d593b4d3a5398dc1fb8bea2a06b13bf0f384e7..bf5ebd0bd387216f3486b2ef438f67705d78606e 100644 |
--- a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp |
+++ b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp |
@@ -26,6 +26,7 @@ |
#include "config.h" |
#include "bindings/modules/v8/V8BindingForModules.h" |
+#include "bindings/core/v8/GlobalScopeScriptController.h" |
#include "bindings/core/v8/SerializedScriptValue.h" |
#include "bindings/core/v8/SerializedScriptValueFactory.h" |
#include "bindings/core/v8/V8ArrayBuffer.h" |
@@ -42,6 +43,7 @@ |
#include "bindings/modules/v8/V8IDBIndex.h" |
#include "bindings/modules/v8/V8IDBKeyRange.h" |
#include "bindings/modules/v8/V8IDBObjectStore.h" |
+#include "bindings/modules/v8/V8WorkletGlobalScope.h" |
#include "core/dom/DOMArrayBuffer.h" |
#include "core/dom/DOMArrayBufferView.h" |
#include "modules/indexeddb/IDBKey.h" |
@@ -49,6 +51,7 @@ |
#include "modules/indexeddb/IDBKeyRange.h" |
#include "modules/indexeddb/IDBTracing.h" |
#include "modules/indexeddb/IDBValue.h" |
+#include "modules/worklet/WorkletGlobalScope.h" |
#include "platform/RuntimeEnabledFeatures.h" |
#include "platform/SharedBuffer.h" |
#include "wtf/MathExtras.h" |
@@ -160,6 +163,23 @@ v8::Local<v8::Value> toV8(const IDBAny* impl, v8::Local<v8::Object> creationCont |
return v8::Undefined(isolate); |
} |
+v8::Local<v8::Value> toV8(WorkletGlobalScope* impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) |
+{ |
+ // Notice that we explicitly ignore creationContext because the |
+ // WorkletGlobalScope has its own creationContext. |
+ |
+ if (UNLIKELY(!impl)) |
+ return v8::Null(isolate); |
+ |
+ GlobalScopeScriptController* script = impl->script(); |
+ if (!script) |
+ return v8::Null(isolate); |
+ |
+ v8::Local<v8::Object> global = script->context()->Global(); |
+ ASSERT(!global.IsEmpty()); |
+ return global; |
+} |
+ |
static const size_t maximumDepth = 2000; |
static IDBKey* createIDBKeyFromValue(v8::Isolate* isolate, v8::Local<v8::Value> value, Vector<v8::Local<v8::Array>>& stack, ExceptionState& exceptionState, bool allowExperimentalTypes = false) |
@@ -517,4 +537,16 @@ void assertPrimaryKeyValidOrInjectable(ScriptState* scriptState, const IDBValue* |
} |
#endif |
+ExecutionContext* toExecutionContextForModules(v8::Local<v8::Context> context) |
+{ |
+ if (context.IsEmpty()) |
+ return 0; |
+ v8::Local<v8::Object> global = context->Global(); |
+ v8::Local<v8::Object> workletWrapper = V8WorkletGlobalScope::findInstanceInPrototypeChain(global, context->GetIsolate()); |
+ if (!workletWrapper.IsEmpty()) |
+ return V8WorkletGlobalScope::toImpl(workletWrapper)->executionContext(); |
+ // FIXME: Is this line of code reachable? |
+ return 0; |
+} |
+ |
} // namespace blink |