Changeset 56580 in webkit
- Timestamp:
- Mar 25, 2010 5:06:31 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r56576 r56580 1 2010-03-25 Drew Wilson <atwilson@chromium.org> 2 3 Reviewed by Nate Chapin. 4 5 [v8] Error in getScriptExecutionContext() when worker context is terminating. 6 https://bugs.webkit.org/show_bug.cgi?id=36565 7 8 Removed WorkerScriptExecutionProxy::retrieve() and added WorkerScriptController::controllerForContext(). This allows 9 callers to differentiate between "the current context is shutting down" vs "the current context is not a worker context". 10 11 Test: Existing worker tests suffice. 12 13 * bindings/v8/V8DOMWrapper.cpp: 14 (WebCore::V8DOMWrapper::getConstructor): 15 Changed to use WorkerScriptController::controllerForContext() instead of WorkerScriptExecutionProxy::retrieve(). 16 * bindings/v8/V8Utilities.cpp: 17 (WebCore::getScriptExecutionContext): 18 Changed to use WorkerScriptController::controllerForContext() instead of WorkerScriptExecutionProxy::retrieve(). 19 * bindings/v8/WorkerContextExecutionProxy.cpp: 20 Removed WorkerScriptExecutionProxy::retrieve(). 21 * bindings/v8/WorkerContextExecutionProxy.h: 22 Removed WorkerScriptExecutionProxy::retrieve(). 23 * bindings/v8/WorkerScriptController.cpp: 24 (WebCore::WorkerScriptController::controllerForContext): 25 Added helper function to get the WorkerScriptController for the current context. 26 * bindings/v8/WorkerScriptController.h: 27 Added declaration for controllerForContext(). 28 1 29 2010-03-25 Simon Hausmann <simon.hausmann@nokia.com> 2 30 -
trunk/WebCore/bindings/v8/V8DOMWrapper.cpp
r56527 r56580 163 163 v8::Local<v8::Function> V8DOMWrapper::getConstructor(WrapperTypeInfo* type, WorkerContext*) 164 164 { 165 WorkerContextExecutionProxy* proxy = WorkerContextExecutionProxy::retrieve(); 165 WorkerScriptController* controller = WorkerScriptController::controllerForContext(); 166 WorkerContextExecutionProxy* proxy = controller ? controller->proxy() : 0; 166 167 if (!proxy) 167 168 return v8::Local<v8::Function>(); -
trunk/WebCore/bindings/v8/V8Utilities.cpp
r56329 r56580 129 129 { 130 130 #if ENABLE(WORKERS) 131 WorkerContextExecutionProxy* proxy = WorkerContextExecutionProxy::retrieve(); 132 if (proxy) 133 return proxy->workerContext()->scriptExecutionContext(); 131 WorkerScriptController* controller = WorkerScriptController::controllerForContext(); 132 if (controller) { 133 WorkerContextExecutionProxy* proxy = controller->proxy(); 134 return proxy ? proxy->workerContext()->scriptExecutionContext() : 0; 135 } 134 136 #endif 135 137 -
trunk/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
r56452 r56580 46 46 #include "V8Proxy.h" 47 47 #include "V8SharedWorkerContext.h" 48 #include "V8WorkerContext.h"49 48 #include "Worker.h" 50 49 #include "WorkerContext.h" … … 107 106 m_context.Clear(); 108 107 } 109 }110 111 WorkerContextExecutionProxy* WorkerContextExecutionProxy::retrieve()112 {113 // Happens on frame destruction, check otherwise GetCurrent() will crash.114 if (!v8::Context::InContext())115 return 0;116 v8::Handle<v8::Context> context = v8::Context::GetCurrent();117 v8::Handle<v8::Object> global = context->Global();118 global = V8DOMWrapper::lookupDOMWrapper(V8WorkerContext::GetTemplate(), global);119 // Return 0 if the current executing context is not the worker context.120 if (global.IsEmpty())121 return 0;122 WorkerContext* workerContext = V8WorkerContext::toNative(global);123 return workerContext->script()->proxy();124 108 } 125 109 -
trunk/WebCore/bindings/v8/WorkerContextExecutionProxy.h
r56375 r56580 75 75 WorkerContext* workerContext() { return m_workerContext; } 76 76 77 // Returns WorkerContextExecutionProxy object of the currently executing context. 0 will be returned if the current executing context is not the worker context.78 static WorkerContextExecutionProxy* retrieve();79 80 77 private: 81 78 void initV8IfNeeded(); -
trunk/WebCore/bindings/v8/WorkerScriptController.cpp
r55180 r56580 42 42 #include "V8DOMMap.h" 43 43 #include "V8Proxy.h" 44 #include "V8WorkerContext.h" 44 45 #include "WorkerContext.h" 45 46 #include "WorkerContextExecutionProxy.h" … … 99 100 } 100 101 102 WorkerScriptController* WorkerScriptController::controllerForContext() 103 { 104 // Happens on frame destruction, check otherwise GetCurrent() will crash. 105 if (!v8::Context::InContext()) 106 return 0; 107 v8::Handle<v8::Context> context = v8::Context::GetCurrent(); 108 v8::Handle<v8::Object> global = context->Global(); 109 global = V8DOMWrapper::lookupDOMWrapper(V8WorkerContext::GetTemplate(), global); 110 // Return 0 if the current executing context is not the worker context. 111 if (global.IsEmpty()) 112 return 0; 113 WorkerContext* workerContext = V8WorkerContext::toNative(global); 114 return workerContext->script(); 115 } 116 101 117 } // namespace WebCore 102 118 -
trunk/WebCore/bindings/v8/WorkerScriptController.h
r56131 r56580 57 57 58 58 void forbidExecution(); 59 // Returns WorkerScriptController for the currently executing context. 0 will be returned if the current executing context is not the worker context. 60 static WorkerScriptController* controllerForContext(); 59 61 60 62 private: -
trunk/WebKit/chromium/ChangeLog
r56579 r56580 1 2010-03-25 Drew Wilson <atwilson@chromium.org> 2 3 Reviewed by Nate Chapin. 4 5 [v8] Error in getScriptExecutionContext() when worker context is terminating 6 https://bugs.webkit.org/show_bug.cgi?id=36565 7 8 Test: Existing worker tests suffice. 9 10 * src/WebWorkerClientImpl.cpp: 11 (WebKit::WebWorkerClientImpl::createWorkerContextProxy): 12 Changed to use WorkerScriptController::controllerForContext() instead of WorkerScriptExecutionProxy::retrieve(). 13 1 14 2010-03-25 Jeremy Orlow <jorlow@chromium.org> 2 15 -
trunk/WebKit/chromium/src/WebWorkerClientImpl.cpp
r53586 r56580 46 46 #include "WorkerContext.h" 47 47 #include "WorkerContextExecutionProxy.h" 48 #include "WorkerScriptController.h" 48 49 #include "WorkerMessagingProxy.h" 49 50 #include <wtf/Threading.h> … … 95 96 webWorker = webFrame->client()->createWorker(webFrame, proxy); 96 97 } else { 97 Worker ContextExecutionProxy* currentContext =98 WorkerContextExecutionProxy ::retrieve();98 WorkerScriptController* controller = WorkerScriptController::controllerForContext(); 99 WorkerContextExecutionProxy* currentContext = controller ? controller->proxy() : 0; 99 100 if (!currentContext) { 100 101 ASSERT_NOT_REACHED();
Note: See TracChangeset
for help on using the changeset viewer.