Changeset 135383 in webkit
- Timestamp:
- Nov 21, 2012 4:24:24 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r135379 r135383 1 2012-11-21 Dan Carney <dcarney@google.com> 2 3 [V8] Add context checks to WorldContextHandle and V8DOMWindowShell 4 https://bugs.webkit.org/show_bug.cgi?id=101573 5 6 Reviewed by Adam Barth. 7 8 Added a bunch of assertions to ensure the problems with IndexedDB 9 contexts cannot reemerge. 10 11 No new tests. No change in functionality. 12 13 * bindings/v8/V8DOMWindowShell.cpp: 14 (WebCore): 15 (WebCore::V8DOMWindowShell::assertContextHasCorrectPrototype): 16 * bindings/v8/V8DOMWindowShell.h: 17 (V8DOMWindowShell): 18 (WebCore::V8DOMWindowShell::isolated): 19 * bindings/v8/WorldContextHandle.cpp: 20 (WebCore::WorldContextHandle::WorldContextHandle): 21 1 22 2012-11-21 Harald Alvestrand <hta@google.com> 2 23 -
trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
r135377 r135383 65 65 66 66 namespace WebCore { 67 68 #ifndef NDEBUG 69 void V8DOMWindowShell::assertContextHasCorrectPrototype() 70 { 71 ASSERT(isMainThread()); 72 ASSERT(V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(v8::Context::GetEntered()), &V8DOMWindow::info)); 73 } 74 #endif 67 75 68 76 static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* document) … … 329 337 330 338 V8DOMWrapper::setDOMWrapper(v8::Handle<v8::Object>::Cast(windowWrapper->GetPrototype()), &V8DOMWindow::info, window); 331 V8DOMWrapper::createDOMWrapper(PassRefPtr<DOMWindow>(window), &V8DOMWindow::info, windowWrapper);332 339 333 340 // Install the windowWrapper as the prototype of the innerGlobalObject. … … 347 354 V8DOMWrapper::setDOMWrapper(innerGlobalObject, &V8DOMWindow::info, window); 348 355 innerGlobalObject->SetPrototype(windowWrapper); 356 V8DOMWrapper::createDOMWrapper(PassRefPtr<DOMWindow>(window), &V8DOMWindow::info, windowWrapper); 349 357 return true; 350 358 } -
trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.h
r135309 r135383 81 81 void destroyGlobal(); 82 82 83 #ifndef NDEBUG 84 static void assertContextHasCorrectPrototype(); 85 #endif 86 83 87 static V8DOMWindowShell* isolated(v8::Handle<v8::Context> context) 84 88 { 89 #ifndef NDEBUG 90 assertContextHasCorrectPrototype(); 91 #endif 85 92 return static_cast<V8DOMWindowShell*>(context->GetAlignedPointerFromEmbedderData(v8ContextIsolatedWindowShell)); 86 93 } -
trunk/Source/WebCore/bindings/v8/WorldContextHandle.cpp
r135309 r135383 36 36 #include "V8DOMWindow.h" 37 37 #include "V8DOMWindowShell.h" 38 #include "V8DedicatedWorkerContext.h" 39 #include "V8SharedWorkerContext.h" 38 40 39 41 namespace WebCore { … … 42 44 : m_worldToUse(worldToUse) 43 45 { 46 ASSERT(worldToUse != UseWorkerWorld); 47 44 48 if (worldToUse == UseMainWorld || worldToUse == UseWorkerWorld) 45 49 return; 46 50 47 if (v8::Context::InContext()) { 48 v8::Handle<v8::Context> context = v8::Context::GetCurrent(); 51 if (!v8::Context::InContext()) 52 CRASH(); 53 54 v8::Handle<v8::Context> context = v8::Context::GetCurrent(); 49 55 #if ENABLE(WORKERS) 50 if (UNLIKELY(!V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context), &V8DOMWindow::info))) { 51 m_worldToUse = UseWorkerWorld; 52 return; 53 } 56 if (UNLIKELY(!V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context), &V8DOMWindow::info))) { 57 #if ENABLE(SHARED_WORKERS) 58 ASSERT(V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context)->GetPrototype(), &V8DedicatedWorkerContext::info) || V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context)->GetPrototype(), &V8SharedWorkerContext::info)); 59 #else 60 ASSERT(V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context)->GetPrototype(), &V8DedicatedWorkerContext::info)); 54 61 #endif 55 if (V8DOMWindowShell::isolated(context)) { 56 m_context = SharedPersistent<v8::Context>::create(context); 57 return; 58 } 62 m_worldToUse = UseWorkerWorld; 63 return; 64 } 65 #endif 66 67 if (V8DOMWindowShell::isolated(context)) { 68 m_context = SharedPersistent<v8::Context>::create(context); 69 return; 59 70 } 60 71
Note: See TracChangeset
for help on using the changeset viewer.