Index: Source/bindings/v8/ScriptState.cpp |
diff --git a/Source/bindings/v8/ScriptState.cpp b/Source/bindings/v8/ScriptState.cpp |
index 6e3e7b0794aeddd2754b08c932c104e7b23a6cfd..e601de3ba374ff28b396291807bc0e7756140dd6 100644 |
--- a/Source/bindings/v8/ScriptState.cpp |
+++ b/Source/bindings/v8/ScriptState.cpp |
@@ -6,6 +6,7 @@ |
#include "bindings/v8/ScriptState.h" |
#include "bindings/v8/V8Binding.h" |
+#include "core/dom/ExecutionContext.h" |
#include "core/frame/LocalFrame.h" |
namespace WebCore { |
@@ -68,6 +69,11 @@ ExecutionContext* ScriptState::executionContext() const |
return toExecutionContext(context()); |
} |
+void ScriptState::setExecutionContext(PassRefPtr<ExecutionContext>) |
+{ |
+ ASSERT_NOT_REACHED(); |
+} |
+ |
DOMWindow* ScriptState::domWindow() const |
{ |
v8::HandleScope scope(m_isolate); |
@@ -81,4 +87,28 @@ ScriptState* ScriptState::forMainWorld(LocalFrame* frame) |
return ScriptState::from(toV8Context(isolate, frame, DOMWrapperWorld::mainWorld())); |
} |
+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. |
+ scriptState->ref(); |
+ return scriptState; |
+} |
+ |
+ScriptStateForTesting::ScriptStateForTesting(v8::Handle<v8::Context> context, PassRefPtr<DOMWrapperWorld> world) |
+ : ScriptState(context, world) |
+{ |
+} |
+ |
+ExecutionContext* ScriptStateForTesting::executionContext() const |
+{ |
+ return m_executionContext.get(); |
+} |
+ |
+void ScriptStateForTesting::setExecutionContext(PassRefPtr<ExecutionContext> executionContext) |
+{ |
+ m_executionContext = executionContext; |
+} |
+ |
} |