Source/WebCore/ChangeLog

 12012-11-25 Kentaro Hara <haraken@chromium.org>
 2
 3 [V8] Remove WorkerContextExecutionProxy
 4 https://bugs.webkit.org/show_bug.cgi?id=103210
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 This patch moves all methods in WorkerContextExecutionProxy
 9 to WorkerScriptController.
 10
 11 Due to the dependency between WorkerContextExecutionProxy's methods,
 12 it is a bit difficult to split this patch into pieces.
 13 This patch simply moves methods without changing their logic.
 14 Also this patch doesn't remove empty WorkerContextExecutionProxy.{h,cpp}
 15 to keep the diff sane. I will address these issues in a follow-up patch.
 16
 17 Tests: fast/worker/*
 18
 19 * bindings/v8/ScriptState.cpp:
 20 (WebCore::scriptStateFromWorkerContext):
 21 * bindings/v8/V8Binding.cpp:
 22 (WebCore::toV8Context):
 23 * bindings/v8/V8WorkerContextEventListener.cpp:
 24 (WebCore::V8WorkerContextEventListener::handleEvent):
 25 * bindings/v8/WorkerContextExecutionProxy.cpp:
 26 * bindings/v8/WorkerContextExecutionProxy.h:
 27 * bindings/v8/WorkerScriptController.cpp:
 28 (WebCore::WorkerScriptController::WorkerScriptController):
 29 (WebCore::WorkerScriptController::~WorkerScriptController):
 30 (WebCore::WorkerScriptController::dispose):
 31 (WebCore):
 32 (WebCore::WorkerScriptController::initializeIfNeeded):
 33 (WebCore::WorkerScriptController::evaluate):
 34 (WebCore::WorkerScriptController::setEvalAllowed):
 35 (WebCore::WorkerScriptController::disableEval):
 36 * bindings/v8/WorkerScriptController.h:
 37 (WebCore):
 38 (WebCore::WorkerContextExecutionState::WorkerContextExecutionState):
 39 (WorkerContextExecutionState):
 40 (WorkerScriptController):
 41 (WebCore::WorkerScriptController::context):
 42 * bindings/v8/WorkerScriptDebugServer.cpp:
 43 (WebCore::WorkerScriptDebugServer::addListener):
 44 * bindings/v8/custom/V8WorkerContextCustom.cpp:
 45 (WebCore::SetTimeoutOrInterval):
 46 (WebCore::toV8):
 47
1482012-11-22 Kentaro Hara <haraken@chromium.org>
249
350 [V8] Move WorkerExecutionContextProxy::initializeIfNeeded() to V8Initializer

Source/WebCore/bindings/v8/ScriptState.cpp

3939#include "V8HiddenPropertyName.h"
4040#include "V8WorkerContext.h"
4141#include "WorkerContext.h"
42 #include "WorkerContextExecutionProxy.h"
4342#include "WorkerScriptController.h"
4443#include <v8.h>
4544#include <wtf/Assertions.h>

@@ScriptState* scriptStateFromPage(DOMWrapperWorld*, Page* page)
142141#if ENABLE(WORKERS)
143142ScriptState* scriptStateFromWorkerContext(WorkerContext* workerContext)
144143{
145  WorkerContextExecutionProxy* proxy = workerContext->script()->proxy();
146  if (!proxy)
 144 WorkerScriptController* script = workerContext->script();
 145 if (!script)
147146 return 0;
148147
149148 v8::HandleScope handleScope;
150  v8::Local<v8::Context> context = proxy->context();
151  return ScriptState::forContext(context);
 149 return ScriptState::forContext(script->context());
152150}
153151#endif
154152

Source/WebCore/bindings/v8/V8Binding.cpp

4747#include "V8XPathNSResolver.h"
4848#include "WebCoreMemoryInstrumentation.h"
4949#include "WorkerContext.h"
50 #include "WorkerContextExecutionProxy.h"
 50#include "WorkerScriptController.h"
5151#include "WorldContextHandle.h"
5252#include "XPathNSResolver.h"
5353#include <wtf/MathExtras.h>

@@v8::Local<v8::Context> toV8Context(ScriptExecutionContext* context, const WorldC
311311 return worldContext.adjustedContext(frame->script());
312312#if ENABLE(WORKERS)
313313 } else if (context->isWorkerContext()) {
314  if (WorkerContextExecutionProxy* proxy = static_cast<WorkerContext*>(context)->script()->proxy())
315  return proxy->context();
 314 if (WorkerScriptController* script = static_cast<WorkerContext*>(context)->script())
 315 return script->context();
316316#endif
317317 }
318318 return v8::Local<v8::Context>();

Source/WebCore/bindings/v8/V8WorkerContextEventListener.cpp

4141#include "V8GCController.h"
4242#include "V8RecursionScope.h"
4343#include "WorkerContext.h"
44 #include "WorkerContextExecutionProxy.h"
 44#include "WorkerScriptController.h"
4545
4646namespace WebCore {
4747
48 static WorkerContextExecutionProxy* workerProxy(ScriptExecutionContext* context)
49 {
50  ASSERT(context->isWorkerContext());
51  WorkerContext* workerContext = static_cast<WorkerContext*>(context);
52  return workerContext->script()->proxy();
53 }
54 
5548V8WorkerContextEventListener::V8WorkerContextEventListener(v8::Local<v8::Object> listener, bool isInline, const WorldContextHandle& worldContext)
5649 : V8EventListener(listener, isInline, worldContext)
5750{

@@void V8WorkerContextEventListener::handleEvent(ScriptExecutionContext* context,
6861
6962 v8::HandleScope handleScope;
7063
71  WorkerContextExecutionProxy* proxy = workerProxy(context);
72  if (!proxy)
 64 WorkerScriptController* script = static_cast<WorkerContext*>(context)->script();
 65 if (!script)
7366 return;
7467
75  v8::Handle<v8::Context> v8Context = proxy->context();
 68 v8::Handle<v8::Context> v8Context = script->context();
7669 if (v8Context.IsEmpty())
7770 return;
7871

Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp

2828 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929 */
3030
 31// FIXME: This file is going to be removed in a follow-up patch.
3132
3233#include "config.h"
3334

5960
6061namespace WebCore {
6162
62 WorkerContextExecutionProxy::WorkerContextExecutionProxy(WorkerContext* workerContext)
63  : m_workerContext(workerContext)
64  , m_disableEvalPending(String())
65 {
66  V8Initializer::initializeWorker();
67 }
68 
69 WorkerContextExecutionProxy::~WorkerContextExecutionProxy()
70 {
71  dispose();
72 }
73 
74 void WorkerContextExecutionProxy::dispose()
75 {
76  m_perContextData.clear();
77  m_context.clear();
78 }
79 
80 bool WorkerContextExecutionProxy::initializeIfNeeded()
81 {
82  // Bail out if the context has already been initialized.
83  if (!m_context.isEmpty())
84  return true;
85 
86  // Create a new environment
87  v8::Persistent<v8::ObjectTemplate> globalTemplate;
88  m_context.adopt(v8::Context::New(0, globalTemplate));
89  if (m_context.isEmpty())
90  return false;
91 
92  // Starting from now, use local context only.
93  v8::Local<v8::Context> context = v8::Local<v8::Context>::New(m_context.get());
94 
95  v8::Context::Scope scope(context);
96 
97  m_perContextData = V8PerContextData::create(m_context.get());
98  if (!m_perContextData->init()) {
99  dispose();
100  return false;
101  }
102 
103  // Set DebugId for the new context.
104  context->SetEmbedderData(0, v8::String::New("worker"));
105 
106  // Create a new JS object and use it as the prototype for the shadow global object.
107  WrapperTypeInfo* contextType = &V8DedicatedWorkerContext::info;
108 #if ENABLE(SHARED_WORKERS)
109  if (!m_workerContext->isDedicatedWorkerContext())
110  contextType = &V8SharedWorkerContext::info;
111 #endif
112  v8::Handle<v8::Function> workerContextConstructor = m_perContextData->constructorForType(contextType);
113  v8::Local<v8::Object> jsWorkerContext = V8ObjectConstructor::newInstance(workerContextConstructor);
114  // Bail out if allocation failed.
115  if (jsWorkerContext.IsEmpty()) {
116  dispose();
117  return false;
118  }
119 
120  // Wrap the object.
121  V8DOMWrapper::createDOMWrapper(PassRefPtr<WorkerContext>(m_workerContext), contextType, jsWorkerContext);
122 
123  // Insert the object instance as the prototype of the shadow object.
124  v8::Handle<v8::Object> globalObject = v8::Handle<v8::Object>::Cast(m_context->Global()->GetPrototype());
125  globalObject->SetPrototype(jsWorkerContext);
126 
127  return true;
128 }
129 
130 ScriptValue WorkerContextExecutionProxy::evaluate(const String& script, const String& fileName, const TextPosition& scriptStartPosition, WorkerContextExecutionState* state)
131 {
132  V8GCController::checkMemoryUsage();
133 
134  v8::HandleScope hs;
135 
136  if (!initializeIfNeeded())
137  return ScriptValue();
138 
139  if (!m_disableEvalPending.isEmpty()) {
140  m_context->AllowCodeGenerationFromStrings(false);
141  m_context->SetErrorMessageForCodeGenerationFromStrings(v8String(m_disableEvalPending));
142  m_disableEvalPending = String();
143  }
144 
145  v8::Context::Scope scope(m_context.get());
146 
147  v8::TryCatch exceptionCatcher;
148 
149  v8::Local<v8::String> scriptString = v8ExternalString(script);
150  v8::Handle<v8::Script> compiledScript = ScriptSourceCode::compileScript(scriptString, fileName, scriptStartPosition);
151  v8::Local<v8::Value> result = ScriptRunner::runCompiledScript(compiledScript, m_workerContext);
152 
153  if (!exceptionCatcher.CanContinue()) {
154  m_workerContext->script()->forbidExecution();
155  return ScriptValue();
156  }
157 
158  if (exceptionCatcher.HasCaught()) {
159  v8::Local<v8::Message> message = exceptionCatcher.Message();
160  state->hadException = true;
161  state->errorMessage = toWebCoreString(message->Get());
162  state->lineNumber = message->GetLineNumber();
163  state->sourceURL = toWebCoreString(message->GetScriptResourceName());
164  if (m_workerContext->sanitizeScriptError(state->errorMessage, state->lineNumber, state->sourceURL))
165  state->exception = throwError(v8GeneralError, state->errorMessage.utf8().data());
166  else
167  state->exception = ScriptValue(exceptionCatcher.Exception());
168 
169  exceptionCatcher.Reset();
170  } else
171  state->hadException = false;
172 
173  if (result.IsEmpty() || result->IsUndefined())
174  return ScriptValue();
175 
176  return ScriptValue(result);
177 }
178 
179 void WorkerContextExecutionProxy::setEvalAllowed(bool enable, const String& errorMessage)
180 {
181  m_disableEvalPending = enable ? String() : errorMessage;
182 }
183 
18463} // namespace WebCore
18564
18665#endif // ENABLE(WORKERS)

Source/WebCore/bindings/v8/WorkerContextExecutionProxy.h

2828 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929 */
3030
 31// FIXME: This file is going to be removed in a follow-up patch.
3132
3233#ifndef WorkerContextExecutionProxy_h
3334#define WorkerContextExecutionProxy_h

4243
4344namespace WebCore {
4445
45  class Event;
46  class EventTarget;
47  class V8PerContextData;
48  class WorkerContext;
49  struct WrapperTypeInfo;
50 
51  struct WorkerContextExecutionState {
52  WorkerContextExecutionState()
53  : hadException(false)
54  , lineNumber(0)
55  {
56  }
57 
58  bool hadException;
59  ScriptValue exception;
60  String errorMessage;
61  int lineNumber;
62  String sourceURL;
63  };
64 
65  class WorkerContextExecutionProxy {
66  public:
67  explicit WorkerContextExecutionProxy(WorkerContext*);
68  ~WorkerContextExecutionProxy();
69 
70  // Alow use of eval() and is equivalents in scripts.
71  void setEvalAllowed(bool enable, const String& errorMessage);
72 
73  // Evaluate a script file in the current execution environment.
74  ScriptValue evaluate(const String& script, const String& fileName, const TextPosition& scriptStartPosition, WorkerContextExecutionState*);
75 
76  // Returns a local handle of the context.
77  v8::Local<v8::Context> context() { return v8::Local<v8::Context>::New(m_context.get()); }
78 
79  private:
80  void initIsolate();
81  bool initializeIfNeeded();
82  void dispose();
83 
84  WorkerContext* m_workerContext;
85  ScopedPersistent<v8::Context> m_context;
86  OwnPtr<V8PerContextData> m_perContextData;
87  String m_disableEvalPending;
88  };
89 
9046} // namespace WebCore
9147
9248#endif // ENABLE(WORKERS)

Source/WebCore/bindings/v8/WorkerScriptController.cpp

3636
3737#include "DOMTimer.h"
3838#include "ScriptCallStack.h"
 39#include "ScriptRunner.h"
3940#include "ScriptSourceCode.h"
4041#include "ScriptValue.h"
 42#include "V8DedicatedWorkerContext.h"
 43#include "V8Initializer.h"
 44#include "V8SharedWorkerContext.h"
4145#include "V8WorkerContext.h"
4246#include "WorkerContext.h"
4347#include "WorkerContextExecutionProxy.h"

@@namespace WebCore {
5559WorkerScriptController::WorkerScriptController(WorkerContext* workerContext)
5660 : m_workerContext(workerContext)
5761 , m_isolate(v8::Isolate::New())
 62 , m_disableEvalPending(String())
5863 , m_executionForbidden(false)
5964 , m_executionScheduledToTerminate(false)
6065{

@@WorkerScriptController::WorkerScriptController(WorkerContext* workerContext)
6267 m_isolate->Enter();
6368 m_domDataStore = adoptPtr(new DOMDataStore(DOMDataStore::Worker));
6469 data->setDOMDataStore(m_domDataStore.get());
65  m_proxy = adoptPtr(new WorkerContextExecutionProxy(workerContext));
 70
 71 V8Initializer::initializeWorker();
6672}
6773
6874WorkerScriptController::~WorkerScriptController()

@@WorkerScriptController::~WorkerScriptController()
7480 // See http://webkit.org/b/83104#c14 for why this is here.
7581 WebKit::Platform::current()->didStopWorkerRunLoop(WebKit::WebWorkerRunLoop(&m_workerContext->thread()->runLoop()));
7682#endif
77  m_proxy.clear();
 83 dispose();
7884 V8PerIsolateData::dispose(m_isolate);
7985 m_isolate->Exit();
8086 m_isolate->Dispose();
8187}
8288
 89void WorkerScriptController::dispose()
 90{
 91 m_perContextData.clear();
 92 m_context.clear();
 93}
 94
 95bool WorkerScriptController::initializeIfNeeded()
 96{
 97 // Bail out if the context has already been initialized.
 98 if (!m_context.isEmpty())
 99 return true;
 100
 101 // Create a new environment
 102 v8::Persistent<v8::ObjectTemplate> globalTemplate;
 103 m_context.adopt(v8::Context::New(0, globalTemplate));
 104 if (m_context.isEmpty())
 105 return false;
 106
 107 // Starting from now, use local context only.
 108 v8::Local<v8::Context> context = v8::Local<v8::Context>::New(m_context.get());
 109
 110 v8::Context::Scope scope(context);
 111
 112 m_perContextData = V8PerContextData::create(m_context.get());
 113 if (!m_perContextData->init()) {
 114 dispose();
 115 return false;
 116 }
 117
 118 // Set DebugId for the new context.
 119 context->SetEmbedderData(0, v8::String::New("worker"));
 120
 121 // Create a new JS object and use it as the prototype for the shadow global object.
 122 WrapperTypeInfo* contextType = &V8DedicatedWorkerContext::info;
 123#if ENABLE(SHARED_WORKERS)
 124 if (!m_workerContext->isDedicatedWorkerContext())
 125 contextType = &V8SharedWorkerContext::info;
 126#endif
 127 v8::Handle<v8::Function> workerContextConstructor = m_perContextData->constructorForType(contextType);
 128 v8::Local<v8::Object> jsWorkerContext = V8ObjectConstructor::newInstance(workerContextConstructor);
 129 // Bail out if allocation failed.
 130 if (jsWorkerContext.IsEmpty()) {
 131 dispose();
 132 return false;
 133 }
 134
 135 // Wrap the object.
 136 V8DOMWrapper::createDOMWrapper(PassRefPtr<WorkerContext>(m_workerContext), contextType, jsWorkerContext);
 137
 138 // Insert the object instance as the prototype of the shadow object.
 139 v8::Handle<v8::Object> globalObject = v8::Handle<v8::Object>::Cast(m_context->Global()->GetPrototype());
 140 globalObject->SetPrototype(jsWorkerContext);
 141
 142 return true;
 143}
 144
 145ScriptValue WorkerScriptController::evaluate(const String& script, const String& fileName, const TextPosition& scriptStartPosition, WorkerContextExecutionState* state)
 146{
 147 V8GCController::checkMemoryUsage();
 148
 149 v8::HandleScope hs;
 150
 151 if (!initializeIfNeeded())
 152 return ScriptValue();
 153
 154 if (!m_disableEvalPending.isEmpty()) {
 155 m_context->AllowCodeGenerationFromStrings(false);
 156 m_context->SetErrorMessageForCodeGenerationFromStrings(v8String(m_disableEvalPending));
 157 m_disableEvalPending = String();
 158 }
 159
 160 v8::Context::Scope scope(m_context.get());
 161
 162 v8::TryCatch exceptionCatcher;
 163
 164 v8::Local<v8::String> scriptString = v8ExternalString(script);
 165 v8::Handle<v8::Script> compiledScript = ScriptSourceCode::compileScript(scriptString, fileName, scriptStartPosition);
 166 v8::Local<v8::Value> result = ScriptRunner::runCompiledScript(compiledScript, m_workerContext);
 167
 168 if (!exceptionCatcher.CanContinue()) {
 169 m_workerContext->script()->forbidExecution();
 170 return ScriptValue();
 171 }
 172
 173 if (exceptionCatcher.HasCaught()) {
 174 v8::Local<v8::Message> message = exceptionCatcher.Message();
 175 state->hadException = true;
 176 state->errorMessage = toWebCoreString(message->Get());
 177 state->lineNumber = message->GetLineNumber();
 178 state->sourceURL = toWebCoreString(message->GetScriptResourceName());
 179 if (m_workerContext->sanitizeScriptError(state->errorMessage, state->lineNumber, state->sourceURL))
 180 state->exception = throwError(v8GeneralError, state->errorMessage.utf8().data());
 181 else
 182 state->exception = ScriptValue(exceptionCatcher.Exception());
 183
 184 exceptionCatcher.Reset();
 185 } else
 186 state->hadException = false;
 187
 188 if (result.IsEmpty() || result->IsUndefined())
 189 return ScriptValue();
 190
 191 return ScriptValue(result);
 192}
 193
 194void WorkerScriptController::setEvalAllowed(bool enable, const String& errorMessage)
 195{
 196 m_disableEvalPending = enable ? String() : errorMessage;
 197}
 198
83199void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode)
84200{
85201 evaluate(sourceCode, 0);

@@void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, Script
91207 return;
92208
93209 WorkerContextExecutionState state;
94  m_proxy->evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startPosition(), &state);
 210 evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startPosition(), &state);
95211 if (state.hadException) {
96212 if (exception)
97213 *exception = state.exception;

@@bool WorkerScriptController::isExecutionForbidden() const
133249
134250void WorkerScriptController::disableEval(const String& errorMessage)
135251{
136  m_proxy->setEvalAllowed(false, errorMessage);
 252 setEvalAllowed(false, errorMessage);
137253}
138254
139255void WorkerScriptController::setException(const ScriptValue& exception)

Source/WebCore/bindings/v8/WorkerScriptController.h

3333
3434#if ENABLE(WORKERS)
3535
 36#include "ScriptValue.h"
3637#include "V8Binding.h"
37 
3838#include <v8.h>
3939#include <wtf/OwnPtr.h>
4040#include <wtf/Threading.h>
 41#include <wtf/text/TextPosition.h>
4142
4243namespace WebCore {
4344
4445 class ScriptSourceCode;
4546 class ScriptValue;
4647 class WorkerContext;
47  class WorkerContextExecutionProxy;
 48
 49 struct WorkerContextExecutionState {
 50 WorkerContextExecutionState()
 51 : hadException(false)
 52 , lineNumber(0)
 53 {
 54 }
 55
 56 bool hadException;
 57 ScriptValue exception;
 58 String errorMessage;
 59 int lineNumber;
 60 String sourceURL;
 61 };
4862
4963 class WorkerScriptController {
5064 public:
5165 WorkerScriptController(WorkerContext*);
5266 ~WorkerScriptController();
5367
54  WorkerContextExecutionProxy* proxy() { return m_proxy.get(); }
5568 WorkerContext* workerContext() { return m_workerContext; }
5669
5770 void evaluate(const ScriptSourceCode&);

@@namespace WebCore {
7487
7588 void disableEval(const String&);
7689
 90 // Alow use of eval() and is equivalents in scripts.
 91 void setEvalAllowed(bool enable, const String&);
 92
7793 // Returns WorkerScriptController for the currently executing context. 0 will be returned if the current executing context is not the worker context.
7894 static WorkerScriptController* controllerForContext();
7995
 96 // Evaluate a script file in the current execution environment.
 97 ScriptValue evaluate(const String& script, const String& fileName, const TextPosition& scriptStartPosition, WorkerContextExecutionState*);
 98
 99 // Returns a local handle of the context.
 100 v8::Local<v8::Context> context() { return v8::Local<v8::Context>::New(m_context.get()); }
80101 private:
 102 bool initializeIfNeeded();
 103 void dispose();
 104
81105 WorkerContext* m_workerContext;
82  OwnPtr<WorkerContextExecutionProxy> m_proxy;
83106 v8::Isolate* m_isolate;
 107 ScopedPersistent<v8::Context> m_context;
 108 OwnPtr<V8PerContextData> m_perContextData;
 109 String m_disableEvalPending;
84110 OwnPtr<DOMDataStore> m_domDataStore;
85111 bool m_executionForbidden;
86112 bool m_executionScheduledToTerminate;

Source/WebCore/bindings/v8/WorkerScriptDebugServer.cpp

3535
3636#include "ScriptDebugListener.h"
3737#include "WorkerContext.h"
38 #include "WorkerContextExecutionProxy.h"
3938#include "WorkerDebuggerAgent.h"
4039#include "WorkerThread.h"
4140#include <v8.h>

@@void WorkerScriptDebugServer::addListener(ScriptDebugListener* listener)
6665 ASSERT(!m_debuggerScript.get()->IsUndefined());
6766 v8::Debug::SetDebugEventListener2(&WorkerScriptDebugServer::v8DebugEventCallback, v8::External::New(this));
6867
69  // TODO: Should we remove |proxy|? It looks like unused now.
70  WorkerContextExecutionProxy* proxy = m_workerContext->script()->proxy();
71  if (!proxy)
72  return;
73 
7468 v8::Handle<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("getWorkerScripts")));
7569 v8::Handle<v8::Value> argv[] = { v8Undefined() };
7670 v8::Handle<v8::Value> value = getScriptsFunction->Call(m_debuggerScript.get(), 0, argv);

Source/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp

4343#include "V8WorkerContextEventListener.h"
4444#include "WebSocket.h"
4545#include "WorkerContext.h"
46 #include "WorkerContextExecutionProxy.h"
 46#include "WorkerScriptController.h"
4747
4848namespace WebCore {
4949

@@v8::Handle<v8::Value> SetTimeoutOrInterval(const v8::Arguments& args, bool singl
5959 int32_t timeout = argumentCount >= 2 ? args[1]->Int32Value() : 0;
6060 int timerId;
6161
62  WorkerContextExecutionProxy* proxy = workerContext->script()->proxy();
63  if (!proxy)
 62 WorkerScriptController* script = workerContext->script();
 63 if (!script)
6464 return v8::Undefined();
6565
66  v8::Handle<v8::Context> v8Context = proxy->context();
 66 v8::Handle<v8::Context> v8Context = script->context();
6767 if (function->IsString()) {
6868 if (ContentSecurityPolicy* policy = workerContext->contentSecurityPolicy()) {
6969 if (!policy->allowEval())

@@v8::Handle<v8::Value> toV8(WorkerContext* impl, v8::Handle<v8::Object> creationC
134134 if (!impl)
135135 return v8NullWithCheck(isolate);
136136
137  WorkerContextExecutionProxy* proxy = impl->script()->proxy();
138  if (!proxy)
 137 WorkerScriptController* script = impl->script();
 138 if (!script)
139139 return v8NullWithCheck(isolate);
140140
141  v8::Handle<v8::Object> global = proxy->context()->Global();
 141 v8::Handle<v8::Object> global = script->context()->Global();
142142 ASSERT(!global.IsEmpty());
143143 return global;
144144}