Commit 5f38e1a6 authored by weinig@apple.com's avatar weinig@apple.com

Reviewed by Darin Adler.

        Cleanup and plumbing in preparation for the great Window split.

        - Rename KJS::Window to WebCore::JSDOMWindowBase.
        - Remove KJS::Window::retrieve() and KJS::Window::retrieveWindow() and replace
          with the new toJSDOMWindow().
        - Remove KJS::Window::retrieveActive() and replace with explicit call to 
          exec->dynamicGlobalObject() and toJSDOMWindow().

        * bindings/js/JSCustomVoidCallback.cpp:
        (WebCore::toVoidCallback):.
        * bindings/js/JSCustomXPathNSResolver.cpp:
        (WebCore::JSCustomXPathNSResolver::create):
        * bindings/js/JSDatabaseCustom.cpp:
        (WebCore::JSDatabase::changeVersion):
        (WebCore::JSDatabase::transaction):
        * bindings/js/JSDocumentCustom.cpp:
        (WebCore::JSDocument::location):
        (WebCore::toJS):
        * bindings/js/JSEventTargetBase.cpp:
        (WebCore::jsEventTargetAddEventListener):
        (WebCore::jsEventTargetRemoveEventListener):
        * bindings/js/JSEventTargetNode.cpp:
        (WebCore::JSEventTargetNode::setListener):
        * bindings/js/JSHTMLDocumentCustom.cpp:
        (WebCore::JSHTMLDocument::nameGetter):
        (WebCore::JSHTMLDocument::open):
        * bindings/js/JSHTMLFrameSetElementCustom.cpp:
        (WebCore::JSHTMLFrameSetElement::nameGetter):
        * bindings/js/JSLocation.cpp:
        (WebCore::JSLocation::put):
        (WebCore::jsLocationProtoFuncReplace):
        (WebCore::jsLocationProtoFuncReload):
        (WebCore::jsLocationProtoFuncAssign):
        * bindings/js/JSLocation.h:
        * bindings/js/JSSQLTransactionCustom.cpp:
        (WebCore::JSSQLTransaction::executeSql):
        * bindings/js/JSSVGLazyEventListener.cpp:
        (WebCore::JSSVGLazyEventListener::JSSVGLazyEventListener):
        (WebCore::JSSVGLazyEventListener::eventParameterName):
        * bindings/js/JSSVGLazyEventListener.h:
        * bindings/js/JSXMLHttpRequest.cpp:
        (WebCore::JSXMLHttpRequest::putValueProperty):
        (WebCore::jsXMLHttpRequestPrototypeFunctionOpen):
        (WebCore::jsXMLHttpRequestPrototypeFunctionAddEventListener):
        (WebCore::jsXMLHttpRequestPrototypeFunctionRemoveEventListener):
        * bindings/js/ScheduledAction.cpp:
        (WebCore::ScheduledAction::execute):
        * bindings/js/ScheduledAction.h:
        * bindings/js/kjs_binding.cpp:
        (WebCore::allowsAccessFromFrame):
        (WebCore::printErrorMessageForFrame):
        * bindings/js/kjs_events.cpp:
        (WebCore::JSAbstractEventListener::handleEvent):
        (WebCore::JSUnprotectedEventListener::JSUnprotectedEventListener):
        (WebCore::JSUnprotectedEventListener::~JSUnprotectedEventListener):
        (WebCore::JSUnprotectedEventListener::windowObj):
        (WebCore::JSEventListener::JSEventListener):
        (WebCore::JSEventListener::~JSEventListener):
        (WebCore::JSEventListener::windowObj):
        (WebCore::JSLazyEventListener::JSLazyEventListener):
        (WebCore::JSLazyEventListener::parseCode):
        * bindings/js/kjs_events.h:
        * bindings/js/kjs_navigator.cpp:
        (WebCore::MimeType::getValueProperty):
        * bindings/js/kjs_proxy.cpp:
        (WebCore::KJSProxy::evaluate):
        (WebCore::KJSProxy::createHTMLEventHandler):
        (WebCore::KJSProxy::createSVGEventHandler):
        * bindings/js/kjs_window.cpp:
        (WebCore::JSDOMWindowBasePrivate::JSDOMWindowBasePrivate):
        (WebCore::DOMWindowTimer::DOMWindowTimer):
        (WebCore::DOMWindowTimer::action):
        (WebCore::DOMWindowTimer::takeAction):
        (WebCore::):
        (WebCore::JSDOMWindowBase::JSDOMWindowBase):
        (WebCore::JSDOMWindowBase::~JSDOMWindowBase):
        (WebCore::JSDOMWindowBase::location):
        (WebCore::JSDOMWindowBase::mark):
        (WebCore::allowPopUp):
        (WebCore::createWindow):
        (WebCore::showModalDialog):
        (WebCore::JSDOMWindowBase::getValueProperty):
        (WebCore::JSDOMWindowBase::childFrameGetter):
        (WebCore::JSDOMWindowBase::indexGetter):
        (WebCore::JSDOMWindowBase::namedItemGetter):
        (WebCore::JSDOMWindowBase::getOwnPropertySlot):
        (WebCore::JSDOMWindowBase::put):
        (WebCore::JSDOMWindowBase::allowsAccessFrom):
        (WebCore::JSDOMWindowBase::allowsAccessFromNoErrorMessage):
        (WebCore::JSDOMWindowBase::allowsAccessFromPrivate):
        (WebCore::JSDOMWindowBase::crossDomainAccessErrorMessage):
        (WebCore::JSDOMWindowBase::printErrorMessage):
        (WebCore::JSDOMWindowBase::globalExec):
        (WebCore::JSDOMWindowBase::shouldInterruptScript):
        (WebCore::JSDOMWindowBase::setListener):
        (WebCore::JSDOMWindowBase::getListener):
        (WebCore::JSDOMWindowBase::findJSEventListener):
        (WebCore::JSDOMWindowBase::findOrCreateJSEventListener):
        (WebCore::JSDOMWindowBase::findJSUnprotectedEventListener):
        (WebCore::JSDOMWindowBase::findOrCreateJSUnprotectedEventListener):
        (WebCore::JSDOMWindowBase::clearHelperObjectProperties):
        (WebCore::JSDOMWindowBase::clear):
        (WebCore::JSDOMWindowBase::setCurrentEvent):
        (WebCore::JSDOMWindowBase::currentEvent):
        (WebCore::windowProtoFuncAToB):
        (WebCore::windowProtoFuncBToA):
        (WebCore::windowProtoFuncOpen):
        (WebCore::windowProtoFuncSetTimeout):
        (WebCore::windowProtoFuncClearTimeout):
        (WebCore::windowProtoFuncSetInterval):
        (WebCore::windowProtoFuncAddEventListener):
        (WebCore::windowProtoFuncRemoveEventListener):
        (WebCore::windowProtoFuncShowModalDialog):
        (WebCore::windowProtoFuncNotImplemented):
        (WebCore::JSDOMWindowBase::setReturnValueSlot):
        (WebCore::JSDOMWindowBase::clearAllTimeouts):
        (WebCore::JSDOMWindowBase::installTimeout):
        (WebCore::JSDOMWindowBase::pauseTimeouts):
        (WebCore::JSDOMWindowBase::resumeTimeouts):
        (WebCore::JSDOMWindowBase::clearTimeout):
        (WebCore::JSDOMWindowBase::timerFired):
        (WebCore::JSDOMWindowBase::disconnectFrame):
        (WebCore::JSDOMWindowBase::jsEventListeners):
        (WebCore::JSDOMWindowBase::jsHTMLEventListeners):
        (WebCore::JSDOMWindowBase::jsUnprotectedEventListeners):
        (WebCore::JSDOMWindowBase::jsUnprotectedHTMLEventListeners):
        (WebCore::toJS):
        (WebCore::toJSDOMWindow):
        (WebCore::toJSDOMWindow):
        * bindings/js/kjs_window.h:
        (WebCore::JSDOMWindowBase::impl):
        (WebCore::JSDOMWindowBase::classInfo):
        (WebCore::JSDOMWindowBase::):
        * bindings/objc/DOMUtility.mm:
        (KJS::createDOMWrapper):
        * bindings/scripts/CodeGeneratorJS.pm:
        * history/CachedPage.cpp:
        (WebCore::CachedPage::CachedPage):
        (WebCore::CachedPage::restore):
        * page/Chrome.cpp:
        (WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer):
        (WebCore::PageGroupLoadDeferrer::~PageGroupLoadDeferrer):
        * page/DOMWindow.idl:
        * page/Frame.cpp:
        (WebCore::Frame::~Frame):
        (WebCore::Frame::windowScriptNPObject):
        (WebCore::Frame::pageDestroyed):
        * page/InspectorController.cpp:
        (WebCore::inspectedWindow):
        * page/mac/FrameMac.mm:
        (WebCore::Frame::windowScriptObject):
        * page/mac/WebCoreFrameBridge.mm:
        (updateRenderingForBindings):
        * platform/SecurityOrigin.cpp:
        (WebCore::SecurityOrigin::canAccess):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@30731 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 71d3a95e
2008-03-03 Sam Weinig <sam@webkit.org>
Reviewed by Darin Adler.
Cleanup and plumbing in preparation for the great Window split.
- Rename KJS::Window to WebCore::JSDOMWindowBase.
- Remove KJS::Window::retrieve() and KJS::Window::retrieveWindow() and replace
with the new toJSDOMWindow().
- Remove KJS::Window::retrieveActive() and replace with explicit call to
exec->dynamicGlobalObject() and toJSDOMWindow().
* bindings/js/JSCustomVoidCallback.cpp:
(WebCore::toVoidCallback):.
* bindings/js/JSCustomXPathNSResolver.cpp:
(WebCore::JSCustomXPathNSResolver::create):
* bindings/js/JSDatabaseCustom.cpp:
(WebCore::JSDatabase::changeVersion):
(WebCore::JSDatabase::transaction):
* bindings/js/JSDocumentCustom.cpp:
(WebCore::JSDocument::location):
(WebCore::toJS):
* bindings/js/JSEventTargetBase.cpp:
(WebCore::jsEventTargetAddEventListener):
(WebCore::jsEventTargetRemoveEventListener):
* bindings/js/JSEventTargetNode.cpp:
(WebCore::JSEventTargetNode::setListener):
* bindings/js/JSHTMLDocumentCustom.cpp:
(WebCore::JSHTMLDocument::nameGetter):
(WebCore::JSHTMLDocument::open):
* bindings/js/JSHTMLFrameSetElementCustom.cpp:
(WebCore::JSHTMLFrameSetElement::nameGetter):
* bindings/js/JSLocation.cpp:
(WebCore::JSLocation::put):
(WebCore::jsLocationProtoFuncReplace):
(WebCore::jsLocationProtoFuncReload):
(WebCore::jsLocationProtoFuncAssign):
* bindings/js/JSLocation.h:
* bindings/js/JSSQLTransactionCustom.cpp:
(WebCore::JSSQLTransaction::executeSql):
* bindings/js/JSSVGLazyEventListener.cpp:
(WebCore::JSSVGLazyEventListener::JSSVGLazyEventListener):
(WebCore::JSSVGLazyEventListener::eventParameterName):
* bindings/js/JSSVGLazyEventListener.h:
* bindings/js/JSXMLHttpRequest.cpp:
(WebCore::JSXMLHttpRequest::putValueProperty):
(WebCore::jsXMLHttpRequestPrototypeFunctionOpen):
(WebCore::jsXMLHttpRequestPrototypeFunctionAddEventListener):
(WebCore::jsXMLHttpRequestPrototypeFunctionRemoveEventListener):
* bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::execute):
* bindings/js/ScheduledAction.h:
* bindings/js/kjs_binding.cpp:
(WebCore::allowsAccessFromFrame):
(WebCore::printErrorMessageForFrame):
* bindings/js/kjs_events.cpp:
(WebCore::JSAbstractEventListener::handleEvent):
(WebCore::JSUnprotectedEventListener::JSUnprotectedEventListener):
(WebCore::JSUnprotectedEventListener::~JSUnprotectedEventListener):
(WebCore::JSUnprotectedEventListener::windowObj):
(WebCore::JSEventListener::JSEventListener):
(WebCore::JSEventListener::~JSEventListener):
(WebCore::JSEventListener::windowObj):
(WebCore::JSLazyEventListener::JSLazyEventListener):
(WebCore::JSLazyEventListener::parseCode):
* bindings/js/kjs_events.h:
* bindings/js/kjs_navigator.cpp:
(WebCore::MimeType::getValueProperty):
* bindings/js/kjs_proxy.cpp:
(WebCore::KJSProxy::evaluate):
(WebCore::KJSProxy::createHTMLEventHandler):
(WebCore::KJSProxy::createSVGEventHandler):
* bindings/js/kjs_window.cpp:
(WebCore::JSDOMWindowBasePrivate::JSDOMWindowBasePrivate):
(WebCore::DOMWindowTimer::DOMWindowTimer):
(WebCore::DOMWindowTimer::action):
(WebCore::DOMWindowTimer::takeAction):
(WebCore::):
(WebCore::JSDOMWindowBase::JSDOMWindowBase):
(WebCore::JSDOMWindowBase::~JSDOMWindowBase):
(WebCore::JSDOMWindowBase::location):
(WebCore::JSDOMWindowBase::mark):
(WebCore::allowPopUp):
(WebCore::createWindow):
(WebCore::showModalDialog):
(WebCore::JSDOMWindowBase::getValueProperty):
(WebCore::JSDOMWindowBase::childFrameGetter):
(WebCore::JSDOMWindowBase::indexGetter):
(WebCore::JSDOMWindowBase::namedItemGetter):
(WebCore::JSDOMWindowBase::getOwnPropertySlot):
(WebCore::JSDOMWindowBase::put):
(WebCore::JSDOMWindowBase::allowsAccessFrom):
(WebCore::JSDOMWindowBase::allowsAccessFromNoErrorMessage):
(WebCore::JSDOMWindowBase::allowsAccessFromPrivate):
(WebCore::JSDOMWindowBase::crossDomainAccessErrorMessage):
(WebCore::JSDOMWindowBase::printErrorMessage):
(WebCore::JSDOMWindowBase::globalExec):
(WebCore::JSDOMWindowBase::shouldInterruptScript):
(WebCore::JSDOMWindowBase::setListener):
(WebCore::JSDOMWindowBase::getListener):
(WebCore::JSDOMWindowBase::findJSEventListener):
(WebCore::JSDOMWindowBase::findOrCreateJSEventListener):
(WebCore::JSDOMWindowBase::findJSUnprotectedEventListener):
(WebCore::JSDOMWindowBase::findOrCreateJSUnprotectedEventListener):
(WebCore::JSDOMWindowBase::clearHelperObjectProperties):
(WebCore::JSDOMWindowBase::clear):
(WebCore::JSDOMWindowBase::setCurrentEvent):
(WebCore::JSDOMWindowBase::currentEvent):
(WebCore::windowProtoFuncAToB):
(WebCore::windowProtoFuncBToA):
(WebCore::windowProtoFuncOpen):
(WebCore::windowProtoFuncSetTimeout):
(WebCore::windowProtoFuncClearTimeout):
(WebCore::windowProtoFuncSetInterval):
(WebCore::windowProtoFuncAddEventListener):
(WebCore::windowProtoFuncRemoveEventListener):
(WebCore::windowProtoFuncShowModalDialog):
(WebCore::windowProtoFuncNotImplemented):
(WebCore::JSDOMWindowBase::setReturnValueSlot):
(WebCore::JSDOMWindowBase::clearAllTimeouts):
(WebCore::JSDOMWindowBase::installTimeout):
(WebCore::JSDOMWindowBase::pauseTimeouts):
(WebCore::JSDOMWindowBase::resumeTimeouts):
(WebCore::JSDOMWindowBase::clearTimeout):
(WebCore::JSDOMWindowBase::timerFired):
(WebCore::JSDOMWindowBase::disconnectFrame):
(WebCore::JSDOMWindowBase::jsEventListeners):
(WebCore::JSDOMWindowBase::jsHTMLEventListeners):
(WebCore::JSDOMWindowBase::jsUnprotectedEventListeners):
(WebCore::JSDOMWindowBase::jsUnprotectedHTMLEventListeners):
(WebCore::toJS):
(WebCore::toJSDOMWindow):
(WebCore::toJSDOMWindow):
* bindings/js/kjs_window.h:
(WebCore::JSDOMWindowBase::impl):
(WebCore::JSDOMWindowBase::classInfo):
(WebCore::JSDOMWindowBase::):
* bindings/objc/DOMUtility.mm:
(KJS::createDOMWrapper):
* bindings/scripts/CodeGeneratorJS.pm:
* history/CachedPage.cpp:
(WebCore::CachedPage::CachedPage):
(WebCore::CachedPage::restore):
* page/Chrome.cpp:
(WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer):
(WebCore::PageGroupLoadDeferrer::~PageGroupLoadDeferrer):
* page/DOMWindow.idl:
* page/Frame.cpp:
(WebCore::Frame::~Frame):
(WebCore::Frame::windowScriptNPObject):
(WebCore::Frame::pageDestroyed):
* page/InspectorController.cpp:
(WebCore::inspectedWindow):
* page/mac/FrameMac.mm:
(WebCore::Frame::windowScriptObject):
* page/mac/WebCoreFrameBridge.mm:
(updateRenderingForBindings):
* platform/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::canAccess):
2008-03-03 Kevin Ollivier <kevino@theolliviers.com>
wx build fixes after recent Frame-related changes.
......@@ -32,10 +32,11 @@
#include "CString.h"
#include "DOMWindow.h"
#include "Frame.h"
#include "JSDOMWindow.h"
#include "Page.h"
#include "kjs_binding.h"
#include "kjs_proxy.h"
#include "kjs_window.h"
#include "Page.h"
namespace WebCore {
......@@ -107,7 +108,7 @@ VoidCallback* toVoidCallback(ExecState* exec, JSValue* value, bool& ok)
if (!object)
return 0;
Frame* frame = Window::retrieveActive(exec)->impl()->frame();
Frame* frame = toJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
if (!frame)
return 0;
......
......@@ -33,8 +33,8 @@
#include "Document.h"
#include "ExceptionCode.h"
#include "Frame.h"
#include "JSDOMWindow.h"
#include "Page.h"
#include "kjs_binding.h"
#include "kjs_proxy.h"
#include "kjs_window.h"
......@@ -54,7 +54,7 @@ PassRefPtr<JSCustomXPathNSResolver> JSCustomXPathNSResolver::create(KJS::ExecSta
return 0;
}
return new JSCustomXPathNSResolver(resolverObject, KJS::Window::retrieveActive(exec)->impl()->frame());
return new JSCustomXPathNSResolver(resolverObject, toJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame());
}
JSCustomXPathNSResolver::JSCustomXPathNSResolver(JSObject* customResolver, Frame* frame)
......
......@@ -144,7 +144,7 @@ JSValue* JSDOMWindow::postMessage(ExecState* exec, const List& args)
{
DOMWindow* window = impl();
DOMWindow* source = static_cast<JSDOMWindow*>(exec->dynamicGlobalObject())->impl();
DOMWindow* source = toJSDOMWindow(exec->dynamicGlobalObject())->impl();
String domain = source->frame()->loader()->url().host();
String uri = source->frame()->loader()->url().string();
String message = args[0]->toString(exec);
......
......@@ -29,16 +29,17 @@
#include "config.h"
#include "JSDatabase.h"
#include "DOMWindow.h"
#include "Database.h"
#include "Document.h"
#include "DOMWindow.h"
#include "ExceptionCode.h"
#include "kjs_window.h"
#include "JSCustomSQLTransactionCallback.h"
#include "JSCustomSQLTransactionErrorCallback.h"
#include "JSCustomVoidCallback.h"
#include "JSDOMWindow.h"
#include "PlatformString.h"
#include "SQLValue.h"
#include "kjs_window.h"
#include <kjs/array_instance.h>
namespace WebCore {
......@@ -50,7 +51,7 @@ JSValue* JSDatabase::changeVersion(ExecState* exec, const List& args)
String oldVersion = args[0]->toString(exec);
String newVersion = args[1]->toString(exec);
Frame* frame = Window::retrieveActive(exec)->impl()->frame();
Frame* frame = toJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
if (!frame)
return jsUndefined();
......@@ -96,7 +97,7 @@ JSValue* JSDatabase::transaction(ExecState* exec, const List& args)
return jsUndefined();
}
Frame* frame = Window::retrieveActive(exec)->impl()->frame();
Frame* frame = toJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
if (!frame)
return jsUndefined();
......
......@@ -50,9 +50,9 @@ JSValue* JSDocument::location(ExecState* exec) const
if (!frame)
return jsNull();
Window* win = Window::retrieveWindow(frame);
ASSERT(win);
return win->location();
JSDOMWindow* window = toJSDOMWindow(frame);
ASSERT(window);
return window->location();
}
void JSDocument::setLocation(ExecState* exec, JSValue* value)
......@@ -65,7 +65,7 @@ void JSDocument::setLocation(ExecState* exec, JSValue* value)
// IE and Mozilla both resolve the URL relative to the source frame,
// not the target frame.
Frame* activeFrame = static_cast<JSDOMWindow*>(exec->dynamicGlobalObject())->impl()->frame();
Frame* activeFrame = toJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
if (activeFrame)
str = activeFrame->document()->completeURL(str).string();
......@@ -94,7 +94,7 @@ JSValue* toJS(ExecState* exec, Document* doc)
// Make sure the document is kept around by the window object, and works right with the
// back/forward cache.
if (doc->frame())
Window::retrieveWindow(doc->frame())->putDirect("document", ret, DontDelete|ReadOnly);
toJSDOMWindow(doc->frame())->putDirect("document", ret, DontDelete|ReadOnly);
else {
size_t nodeCount = 0;
for (Node* n = doc; n; n = n->traverseNextNode())
......
......@@ -27,7 +27,9 @@
#include "config.h"
#include "JSEventTargetBase.h"
#include "JSDOMWindow.h"
#include "JSEventTargetNode.h"
#include "kjs_window.h"
#include "JSEventTargetBase.lut.h"
......@@ -101,7 +103,7 @@ JSValue* jsEventTargetAddEventListener(ExecState* exec, JSObject* thisObj, const
if (!frame)
return jsUndefined();
if (JSEventListener* listener = Window::retrieveWindow(frame)->findOrCreateJSEventListener(args[1]))
if (JSEventListener* listener = toJSDOMWindow(frame)->findOrCreateJSEventListener(args[1]))
eventTarget->addEventListener(args[0]->toString(exec), listener, args[2]->toBoolean(exec));
return jsUndefined();
......@@ -120,7 +122,7 @@ JSValue* jsEventTargetRemoveEventListener(ExecState* exec, JSObject* thisObj, co
if (!frame)
return jsUndefined();
if (JSEventListener* listener = Window::retrieveWindow(frame)->findJSEventListener(args[1]))
if (JSEventListener* listener = toJSDOMWindow(frame)->findJSEventListener(args[1]))
eventTarget->removeEventListener(args[0]->toString(exec), listener, args[2]->toBoolean(exec));
return jsUndefined();
......
......@@ -27,6 +27,9 @@
#include "config.h"
#include "JSEventTargetNode.h"
#include "JSDOMWindow.h"
#include "kjs_window.h"
namespace WebCore {
using namespace KJS;
......@@ -60,7 +63,7 @@ void JSEventTargetNode::setListener(ExecState* exec, const AtomicString& eventTy
{
Frame* frame = impl()->document()->frame();
if (frame)
EventTargetNodeCast(impl())->setHTMLEventListener(eventType, KJS::Window::retrieveWindow(frame)->findOrCreateJSEventListener(func, true));
EventTargetNodeCast(impl())->setHTMLEventListener(eventType, toJSDOMWindow(frame)->findOrCreateJSEventListener(func, true));
}
JSValue* JSEventTargetNode::getListener(const AtomicString& eventType) const
......
......@@ -33,6 +33,7 @@
#include "HTMLElement.h"
#include "HTMLIFrameElement.h"
#include "HTMLNames.h"
#include "JSDOMWindow.h"
#include "JSHTMLCollection.h"
#include "kjs_html.h"
#include "kjs_window.h"
......@@ -64,7 +65,7 @@ JSValue* JSHTMLDocument::nameGetter(ExecState* exec, JSObject* originalObject, c
Frame* frame;
if (node->hasTagName(iframeTag) && (frame = static_cast<HTMLIFrameElement*>(node)->contentFrame()))
return KJS::Window::retrieve(frame);
return toJSDOMWindow(frame);
return toJS(exec, node);
}
......@@ -97,7 +98,7 @@ JSValue* JSHTMLDocument::open(ExecState* exec, const List& args)
if (args.size() > 2) {
Frame* frame = static_cast<HTMLDocument*>(impl())->frame();
if (frame) {
KJS::Window* window = KJS::Window::retrieveWindow(frame);
JSDOMWindow* window = toJSDOMWindow(frame);
if (window) {
JSObject* functionObject = window->get(exec, "open")->getObject();
if (!functionObject || !functionObject->implementsCall())
......
......@@ -30,6 +30,7 @@
#include "HTMLFrameElement.h"
#include "HTMLFrameSetElement.h"
#include "HTMLNames.h"
#include "JSDOMWindow.h"
#include "kjs_binding.h"
#include "kjs_window.h"
......@@ -51,7 +52,7 @@ JSValue* JSHTMLFrameSetElement::nameGetter(ExecState* exec, JSObject* originalOb
Node* frame = element->children()->namedItem(propertyName);
if (Document* doc = static_cast<HTMLFrameElement*>(frame)->contentDocument()) {
if (KJS::Window* window = KJS::Window::retrieveWindow(doc->frame()))
if (JSDOMWindow* window = toJSDOMWindow(doc->frame()))
return window;
}
......
......@@ -26,6 +26,7 @@
#include "DOMWindow.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "JSDOMWindow.h"
#include "kjs_proxy.h"
#include "kjs_window.h"
......@@ -152,7 +153,7 @@ void JSLocation::put(ExecState* exec, const Identifier& propertyName, JSValue* v
switch (entry->value.intValue) {
case Href: {
// FIXME: Why isn't this security check needed for the other properties, like Host, below?
Frame* frame = Window::retrieveActive(exec)->impl()->frame();
Frame* frame = toJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
if (!frame)
return;
if (!frame->loader()->shouldAllowNavigation(m_frame))
......@@ -201,7 +202,7 @@ void JSLocation::put(ExecState* exec, const Identifier& propertyName, JSValue* v
return;
}
Frame* activeFrame = Window::retrieveActive(exec)->impl()->frame();
Frame* activeFrame = toJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
if (!url.protocolIs("javascript") || sameDomainAccess) {
bool userGesture = activeFrame->scriptProxy()->processingUserGesture();
m_frame->loader()->scheduleLocationChange(url.string(), activeFrame->loader()->outgoingReferrer(), false, userGesture);
......@@ -233,12 +234,12 @@ JSValue* jsLocationProtoFuncReplace(ExecState* exec, JSObject* thisObj, const Li
if (!frame)
return jsUndefined();
Frame* activeFrame = Window::retrieveActive(exec)->impl()->frame();
Frame* activeFrame = toJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
if (activeFrame) {
if (!activeFrame->loader()->shouldAllowNavigation(frame))
return jsUndefined();
String str = args[0]->toString(exec);
const Window* window = Window::retrieveWindow(frame);
const JSDOMWindow* window = toJSDOMWindow(frame);
if (!protocolIs(str, "javascript") || (window && window->allowsAccessFrom(exec))) {
bool userGesture = activeFrame->scriptProxy()->processingUserGesture();
frame->loader()->scheduleLocationChange(activeFrame->loader()->completeURL(str).string(), activeFrame->loader()->outgoingReferrer(), true, userGesture);
......@@ -257,12 +258,12 @@ JSValue* jsLocationProtoFuncReload(ExecState* exec, JSObject* thisObj, const Lis
if (!frame)
return jsUndefined();
Window* window = Window::retrieveWindow(frame);
JSDOMWindow* window = toJSDOMWindow(frame);
if (!window->allowsAccessFrom(exec))
return jsUndefined();
if (!frame->loader()->url().protocolIs("javascript") || (window && window->allowsAccessFrom(exec))) {
bool userGesture = Window::retrieveActive(exec)->impl()->frame()->scriptProxy()->processingUserGesture();
bool userGesture = toJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame()->scriptProxy()->processingUserGesture();
frame->loader()->scheduleRefresh(userGesture);
}
return jsUndefined();
......@@ -277,11 +278,11 @@ JSValue* jsLocationProtoFuncAssign(ExecState* exec, JSObject* thisObj, const Lis
if (!frame)
return jsUndefined();
Frame* activeFrame = Window::retrieveActive(exec)->impl()->frame();
Frame* activeFrame = toJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
if (activeFrame) {
if (!activeFrame->loader()->shouldAllowNavigation(frame))
return jsUndefined();
const Window* window = Window::retrieveWindow(frame);
const JSDOMWindow* window = toJSDOMWindow(frame);
String dstUrl = activeFrame->loader()->completeURL(args[0]->toString(exec)).string();
if (!protocolIs(dstUrl, "javascript") || (window && window->allowsAccessFrom(exec))) {
bool userGesture = activeFrame->scriptProxy()->processingUserGesture();
......
......@@ -22,18 +22,15 @@
#include "kjs_binding.h"
namespace KJS {
class Window;
}
namespace WebCore {
class Frame;
class JSDOMWindowBase;
class JSLocation : public DOMObject {
typedef DOMObject Base;
friend class KJS::Window;
friend class JSDOMWindowBase;
public:
JSLocation(KJS::JSObject* protoype, Frame*);
......
......@@ -33,6 +33,7 @@
#include "ExceptionCode.h"
#include "JSCustomSQLStatementCallback.h"
#include "JSCustomSQLStatementErrorCallback.h"
#include "JSDOMWindow.h"
#include "SQLTransaction.h"
#include "kjs_window.h"
......@@ -88,7 +89,7 @@ JSValue* JSSQLTransaction::executeSql(ExecState* exec, const List& args)
return jsUndefined();
}
if (Frame* frame = Window::retrieveActive(exec)->impl()->frame())
if (Frame* frame = toJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame())
callback = new JSCustomSQLStatementCallback(object, frame);
}
......@@ -100,7 +101,7 @@ JSValue* JSSQLTransaction::executeSql(ExecState* exec, const List& args)
return jsUndefined();
}
if (Frame* frame = Window::retrieveActive(exec)->impl()->frame())
if (Frame* frame = toJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame())
errorCallback = new JSCustomSQLStatementErrorCallback(object, frame);
}
......
......@@ -28,19 +28,17 @@ using namespace KJS;
namespace WebCore {
JSSVGLazyEventListener::JSSVGLazyEventListener(const String& functionName, const String& code, KJS::Window* win, Node* node, int lineno)
: JSLazyEventListener(functionName, code, win, node, lineno)
JSSVGLazyEventListener::JSSVGLazyEventListener(const String& functionName, const String& code, JSDOMWindow* win, Node* node, int lineNumber)
: JSLazyEventListener(functionName, code, win, node, lineNumber)
{
}
JSValue *JSSVGLazyEventListener::eventParameterName() const
JSValue* JSSVGLazyEventListener::eventParameterName() const
{
static ProtectedPtr<JSValue> eventString = jsString("evt");
return eventString.get();
}
}
} // namespace WebCore
#endif // ENABLE(SVG)
// vim:ts=4:noet
......@@ -29,14 +29,13 @@ namespace WebCore {
class JSSVGLazyEventListener : public JSLazyEventListener {
public:
JSSVGLazyEventListener(const String& functionName, const String& code, KJS::Window*, Node*, int lineno = 0);
JSSVGLazyEventListener(const String& functionName, const String& code, JSDOMWindow*, Node*, int lineNumber = 0);
private:
virtual KJS::JSValue* eventParameterName() const;
};
}
} // namespace WebCore
#endif // ENABLE(SVG)
#endif
// vim:ts=4:noet
#endif // JSSVGLazyEventListener_h
......@@ -25,6 +25,7 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "HTMLDocument.h"
#include "JSDOMWindow.h"
#include "JSDocument.h"
#include "JSEvent.h"
#include "XMLHttpRequest.h"
......@@ -153,7 +154,7 @@ void JSXMLHttpRequest::putValueProperty(ExecState* exec, int token, JSValue* val
Frame* frame = doc->frame();
if (!frame)
return;
m_impl->setOnReadyStateChangeListener(KJS::Window::retrieveWindow(frame)->findOrCreateJSUnprotectedEventListener(value, true));
m_impl->setOnReadyStateChangeListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(value, true));
break;
}
case Onload: {
......@@ -163,7 +164,7 @@ void JSXMLHttpRequest::putValueProperty(ExecState* exec, int token, JSValue* val
Frame* frame = doc->frame();
if (!frame)
return;
m_impl->setOnLoadListener(KJS::Window::retrieveWindow(frame)->findOrCreateJSUnprotectedEventListener(value, true));
m_impl->setOnLoadListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(value, true));
break;
}
}
......@@ -261,7 +262,7 @@ JSValue* jsXMLHttpRequestPrototypeFunctionOpen(ExecState* exec, JSObject* thisOb
return throwError(exec, SyntaxError, "Not enough arguments");
String method = args[0]->toString(exec);
Frame* frame = Window::retrieveActive(exec)->impl()->frame();
Frame* frame = toJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
if (!frame)
return jsUndefined();
KURL url = frame->loader()->completeURL(args[1]->toString(exec));
......@@ -357,7 +358,7 @@ JSValue* jsXMLHttpRequestPrototypeFunctionAddEventListener(ExecState* exec, JSOb
Frame* frame = doc->frame();
if (!frame)
return jsUndefined();
JSUnprotectedEventListener* listener = KJS::Window::retrieveWindow(frame)->findOrCreateJSUnprotectedEventListener(args[1], true);
JSUnprotectedEventListener* listener = toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(args[1], true);
if (!listener)
return jsUndefined();
request->impl()->addEventListener(args[0]->toString(exec), listener, args[2]->toBoolean(exec));
......@@ -377,7 +378,7 @@ JSValue* jsXMLHttpRequestPrototypeFunctionRemoveEventListener(ExecState* exec, J
Frame* frame = doc->frame();
if (!frame)
return jsUndefined();
JSUnprotectedEventListener* listener = KJS::Window::retrieveWindow(frame)->findOrCreateJSUnprotectedEventListener(args[1], true);
JSUnprotectedEventListener* listener = toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(args[1], true);
if (!listener)
return jsUndefined();
request->impl()->removeEventListener(args[0]->toString(exec), listener, args[2]->toBoolean(exec));
......
/*
* Copyright (C) 2000 Harri Porten (porten@kde.org)
* Copyright (C) 2006 Jon Shier (jshier@iastate.edu)
* Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reseved.
* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reseved.
* Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
*
* This library is free software; you can redistribute it and/or
......@@ -29,6 +29,7 @@
#include "Document.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "JSDOMWindow.h"
#include "Page.h"
#include "kjs_proxy.h"
#include "kjs_window.h"
......@@ -46,7 +47,7 @@ ScheduledAction::ScheduledAction(JSValue* func, const List& args)
}
void ScheduledAction::execute(Window* window)
void ScheduledAction::execute(JSDOMWindowBase* window)
{
RefPtr<Frame> frame = window->impl()->frame();
if (!frame)
......@@ -56,7 +57,7 @@ void ScheduledAction::execute(Window* window)
return;
KJSProxy* scriptProxy = frame->scriptProxy();
Window* globalObject = scriptProxy->globalObject();
JSDOMWindow* globalObject = scriptProxy->globalObject();
scriptProxy->setProcessingTimerCallback(true);
......
......@@ -25,13 +25,14 @@
#include <wtf/Vector.h>