Index: Source/bindings/core/v8/V8BindingForTesting.cpp |
diff --git a/Source/bindings/core/v8/V8TestingScope.cpp b/Source/bindings/core/v8/V8BindingForTesting.cpp |
similarity index 50% |
rename from Source/bindings/core/v8/V8TestingScope.cpp |
rename to Source/bindings/core/v8/V8BindingForTesting.cpp |
index 3cb08ed8e7a57d89fcf043f4dd9c3effbba18db3..15831d785cf1536cd66abd0065e9dffed1a12b7c 100644 |
--- a/Source/bindings/core/v8/V8TestingScope.cpp |
+++ b/Source/bindings/core/v8/V8BindingForTesting.cpp |
@@ -3,12 +3,36 @@ |
// found in the LICENSE file. |
#include "config.h" |
-#include "bindings/core/v8/V8TestingScope.h" |
+#include "bindings/core/v8/V8BindingForTesting.h" |
#include "bindings/core/v8/DOMWrapperWorld.h" |
namespace blink { |
+PassRefPtr<ScriptStateForTesting> ScriptStateForTesting::create(v8::Handle<v8::Context> context, PassRefPtr<DOMWrapperWorld> world) |
+{ |
+ RefPtr<ScriptStateForTesting> scriptState = adoptRef(new ScriptStateForTesting(context, world)); |
+ // This ref() is for keeping this ScriptState alive as long as the v8::Context is alive. |
+ // This is deref()ed in the weak callback of the v8::Context. |
Nico
2015/08/29 21:42:48
This seems to not work, see http://build.chromium.
haraken
2015/08/30 01:26:07
I think this is an issue of ScriptPromisePropertyT
|
+ scriptState->ref(); |
+ return scriptState; |
+} |
+ |
+ScriptStateForTesting::ScriptStateForTesting(v8::Handle<v8::Context> context, PassRefPtr<DOMWrapperWorld> world) |
+ : ScriptState(context, world) |
+{ |
+} |
+ |
+ExecutionContext* ScriptStateForTesting::executionContext() const |
+{ |
+ return m_executionContext; |
+} |
+ |
+void ScriptStateForTesting::setExecutionContext(ExecutionContext* executionContext) |
+{ |
+ m_executionContext = executionContext; |
+} |
+ |
V8TestingScope::V8TestingScope(v8::Isolate* isolate) |
: m_handleScope(isolate) |
, m_contextScope(v8::Context::New(isolate)) |