Index: Source/bindings/v8/DOMWrapperWorld.h |
diff --git a/Source/bindings/v8/DOMWrapperWorld.h b/Source/bindings/v8/DOMWrapperWorld.h |
index 69385c1184dc2c3edb715e71a2c20d0b2fab9f92..b9e0533c995e14ce35a617bd5743a9e6090dff5e 100644 |
--- a/Source/bindings/v8/DOMWrapperWorld.h |
+++ b/Source/bindings/v8/DOMWrapperWorld.h |
@@ -71,26 +71,21 @@ public: |
static DOMWrapperWorld* world(v8::Handle<v8::Context> context) |
{ |
+ ASSERT(!context.IsEmpty()); |
return V8PerContextData::world(context); |
} |
// Will return null if there is no DOMWrapperWorld for the current context. |
static DOMWrapperWorld* current(v8::Isolate* isolate) |
{ |
- v8::Handle<v8::Context> context = isolate->GetCurrentContext(); |
- if (context.IsEmpty()) { |
- // If a worker thread calls current() with an empty context, it means that there is no DOMWrapperWorld. |
- if (!isMainThread()) |
- return 0; |
- |
- // If the main thread calls current() with an empty context, it's possible that |
- // current() is being called while window is being initialized. |
+ if (isMainThread() && worldOfInitializingWindow) { |
+ // It's possible that current() is being called while window is being initialized. |
// In order to make current() workable during the initialization phase, |
// we cache the world of the initializing window on worldOfInitializingWindow. |
// If there is no initiazing window, worldOfInitializingWindow is 0. |
return worldOfInitializingWindow; |
} |
- return world(context); |
+ return world(isolate->GetCurrentContext()); |
} |
static DOMWrapperWorld* mainWorld(); |