v8::Local<v8::Context> ScriptController::mainWorldContext(Frame* frame) { if (!frame) return v8::Local<v8::Context>(); return contextForWorld(frame->script(), mainThreadNormalWorld()); }
v8::Local<v8::Context> ScriptController::currentWorldContext() { if (!isolate()->InContext()) return contextForWorld(*this, mainThreadNormalWorld()); v8::Handle<v8::Context> context = isolate()->GetEnteredContext(); DOMWrapperWorld* isolatedWorld = DOMWrapperWorld::isolatedWorld(context); if (!isolatedWorld) return contextForWorld(*this, mainThreadNormalWorld()); Frame* frame = toFrameIfNotDetached(context); if (m_frame == frame) return v8::Local<v8::Context>::New(m_isolate, context); return contextForWorld(*this, isolatedWorld); }
v8::Local<v8::Context> ScriptController::currentWorldContext() { if (!v8::Context::InContext()) return contextForWorld(this, mainThreadNormalWorld()); v8::Handle<v8::Context> context = v8::Context::GetEntered(); DOMWrapperWorld* isolatedWorld = DOMWrapperWorld::isolated(context); if (!isolatedWorld) return contextForWorld(this, mainThreadNormalWorld()); Frame* frame = toFrameIfNotDetached(context); if (!m_frame) return v8::Local<v8::Context>(); if (m_frame == frame) return v8::Local<v8::Context>::New(context); // FIXME: Need to handle weak isolated worlds correctly. if (isolatedWorld->createdFromUnitializedWorld()) return v8::Local<v8::Context>(); return contextForWorld(this, isolatedWorld); }
v8::Local<v8::Context> ScriptController::mainWorldContext() { return contextForWorld(this, mainThreadNormalWorld()); }