Index: Source/bindings/core/v8/custom/V8InjectedScriptManager.cpp |
diff --git a/Source/bindings/core/v8/custom/V8InjectedScriptManager.cpp b/Source/bindings/core/v8/custom/V8InjectedScriptManager.cpp |
index 62eb9617eb42a65560c8cb1c59fdf374b6ecc670..32cd50b5fdb35a9413d65352e5f5d4c7f4e9c15c 100644 |
--- a/Source/bindings/core/v8/custom/V8InjectedScriptManager.cpp |
+++ b/Source/bindings/core/v8/custom/V8InjectedScriptManager.cpp |
@@ -58,6 +58,13 @@ ScriptValue InjectedScriptManager::createInjectedScript(const String& scriptSour |
if (scriptHostWrapper.IsEmpty()) |
return ScriptValue(); |
+ // Store the inspectedScriptState on the scriptHostWrapper if it is |
+ // different from the ScriptState associated with the context. |
+ // This is needed to support Dart as Dart does not create a separate V8 |
+ // context for every Dart library. |
+ if (inspectedScriptState != ScriptState::from(inspectedScriptState->context())) |
+ V8HiddenValue::setHiddenValue(isolate, scriptHostWrapper, V8HiddenValue::scriptState(isolate), v8::External::New(isolate, inspectedScriptState)); |
+ |
injectedScriptNative->setOnInjectedScriptHost(scriptHostWrapper); |
// Inject javascript into the context. The compiled script is supposed to evaluate into |