diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp')
-rw-r--r-- | src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp index fe4d59c012..86ff149bb4 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp @@ -42,12 +42,6 @@ namespace WebCore { const ClassInfo JSDOMWindowBase::s_info = { "Window", 0, 0, 0 }; -JSDOMWindowBase::JSDOMWindowBaseData::JSDOMWindowBaseData(PassRefPtr<DOMWindow> window, JSDOMWindowShell* shell) - : impl(window) - , shell(shell) -{ -} - JSDOMWindowBase::JSDOMWindowBase(NonNullPassRefPtr<Structure> structure, PassRefPtr<DOMWindow> window, JSDOMWindowShell* shell) : JSDOMGlobalObject(structure, new JSDOMWindowBaseData(window, shell), shell) { @@ -59,10 +53,11 @@ JSDOMWindowBase::JSDOMWindowBase(NonNullPassRefPtr<Structure> structure, PassRef addStaticGlobals(staticGlobals, sizeof(staticGlobals) / sizeof(GlobalPropertyInfo)); } -void JSDOMWindowBase::updateDocument() +void JSDOMWindowBase::updateDocument(DOMWrapperWorld* world) { ASSERT(d()->impl->document()); ExecState* exec = globalExec(); + EnterDOMWrapperWorld worldEntry(exec, world); symbolTablePutWithAttributes(Identifier(exec, "document"), toJS(exec, this, d()->impl->document()), DontDelete | ReadOnly); } @@ -85,21 +80,7 @@ String JSDOMWindowBase::crossDomainAccessErrorMessage(const JSGlobalObject* othe void JSDOMWindowBase::printErrorMessage(const String& message) const { - if (message.isEmpty()) - return; - - Frame* frame = impl()->frame(); - if (!frame) - return; - - Settings* settings = frame->settings(); - if (!settings) - return; - - if (settings->privateBrowsingEnabled()) - return; - - impl()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String()); // FIXME: provide a real line number and source URL. + printErrorMessageForFrame(impl()->frame(), message); } ExecState* JSDOMWindowBase::globalExec() @@ -163,18 +144,26 @@ JSDOMWindowShell* JSDOMWindowBase::shell() const JSGlobalData* JSDOMWindowBase::commonJSGlobalData() { - static JSGlobalData* globalData; + ASSERT(isMainThread()); + + static JSGlobalData* globalData = 0; if (!globalData) { globalData = JSGlobalData::createLeaked().releaseRef(); globalData->timeoutChecker.setTimeoutInterval(10000); // 10 seconds #ifndef NDEBUG globalData->mainThreadOnly = true; #endif + globalData->clientData = new WebCoreJSClientData(globalData); } return globalData; } +void JSDOMWindowBase::destroyJSDOMWindowBaseData(void* jsDOMWindowBaseData) +{ + delete static_cast<JSDOMWindowBaseData*>(jsDOMWindowBaseData); +} + // JSDOMGlobalObject* is ignored, accesing a window in any context will // use that DOMWindow's prototype chain. JSValue toJS(ExecState* exec, JSDOMGlobalObject*, DOMWindow* domWindow) @@ -182,21 +171,21 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject*, DOMWindow* domWindow) return toJS(exec, domWindow); } -JSValue toJS(ExecState*, DOMWindow* domWindow) +JSValue toJS(ExecState* exec, DOMWindow* domWindow) { if (!domWindow) return jsNull(); Frame* frame = domWindow->frame(); if (!frame) return jsNull(); - return frame->script()->windowShell(); + return frame->script()->windowShell(currentWorld(exec)); } -JSDOMWindow* toJSDOMWindow(Frame* frame) +JSDOMWindow* toJSDOMWindow(Frame* frame, DOMWrapperWorld* world) { if (!frame) return 0; - return frame->script()->windowShell()->window(); + return frame->script()->windowShell(world)->window(); } JSDOMWindow* toJSDOMWindow(JSValue value) |