• weinig@apple.com's avatar
    JavaScriptCore: · 41dbaab8
    weinig@apple.com authored
    2008-04-04  Sam Weinig  <sam@webkit.org>
    
            Reviewed by Geoffrey Garen.
    
            First step in implementing the "split window"
    
            - Add a GlobalThisValue to ExecState which should be used 
              in places that used to implement the "use the global object
              as this if null" rule.
            - Factor out lookupGetter/lookupSetter into virtual methods 
              on JSObject so that they can be forwarded.
            - Make defineGetter/defineSetter virtual methods for the same
              reason.
            - Have PrototypeReflexiveFunction store the globalObject used
              to create it so that it can be used to get the correct thisObject
              for eval.
    
            * API/JSObjectRef.cpp:
            (JSObjectCallAsFunction):
            * JavaScriptCore.exp:
            * kjs/Activation.h:
            * kjs/ExecState.cpp:
            (KJS::ExecState::ExecState):
            (KJS::GlobalExecState::GlobalExecState):
            * kjs/ExecState.h:
            (KJS::ExecState::globalThisValue):
            * kjs/ExecStateInlines.h:
            (KJS::ExecState::ExecState):
            (KJS::FunctionExecState::FunctionExecState):
            * kjs/JSGlobalObject.cpp:
            (KJS::JSGlobalObject::reset):
            (KJS::JSGlobalObject::toGlobalObject):
            * kjs/JSGlobalObject.h:
            (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
            (KJS::JSGlobalObject::JSGlobalObject):
            * kjs/array_instance.cpp:
            (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
            (KJS::compareWithCompareFunctionForQSort):
            * kjs/array_object.cpp:
            (KJS::arrayProtoFuncSort):
            (KJS::arrayProtoFuncFilter):
            (KJS::arrayProtoFuncMap):
            (KJS::arrayProtoFuncEvery):
            (KJS::arrayProtoFuncForEach):
            (KJS::arrayProtoFuncSome):
            * kjs/function.cpp:
            (KJS::FunctionImp::callAsFunction):
            (KJS::ActivationImp::toThisObject):
            (KJS::globalFuncEval):
            (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
            (KJS::PrototypeReflexiveFunction::mark):
            * kjs/function.h:
            (KJS::PrototypeReflexiveFunction::cachedGlobalObject):
            * kjs/function_object.cpp:
            (KJS::functionProtoFuncApply):
            (KJS::functionProtoFuncCall):
            * kjs/nodes.cpp:
            (KJS::ExpressionNode::resolveAndCall):
            (KJS::FunctionCallValueNode::evaluate):
            (KJS::LocalVarFunctionCallNode::inlineEvaluate):
            (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
            (KJS::FunctionCallBracketNode::evaluate):
            (KJS::FunctionCallDotNode::inlineEvaluate):
            * kjs/object.cpp:
            (KJS::JSObject::call):
            (KJS::JSObject::put):
            (KJS::tryGetAndCallProperty):
            (KJS::JSObject::lookupGetter):
            (KJS::JSObject::lookupSetter):
            (KJS::JSObject::toThisObject):
            (KJS::JSObject::toGlobalObject):
            (KJS::JSObject::fillGetterPropertySlot):
            * kjs/object.h:
            * kjs/object_object.cpp:
            (KJS::objectProtoFuncLookupGetter):
            (KJS::objectProtoFuncLookupSetter):
            * kjs/string_object.cpp:
            (KJS::replace):
    
    WebCore:
    
    2008-04-04  Sam Weinig  <sam@webkit.org>
    
            Reviewed by Geoffrey Garen.
    
            First step in implementing the "split window"
    
            - This patch takes the first step in changing the window navigation model
              from clearing the window properties on navigation, to replacing
              an inner window.  This is necessary to safely perform security checks
              using the lexical global object.
    
              This first step adds a new class called JSDOMWindowWrapper, which wraps
              the real window object.  All JS calls that would go to the window object
              now go to it, which it forwards to the current inner window.  To accomplish
              this, the wrapper window is used as the ThisValue wherever the window was used
              before.
    
            * WebCore.base.exp:
            * WebCore.xcodeproj/project.pbxproj:
            * bindings/js/JSDOMWindowBase.cpp:
            (WebCore::JSDOMWindowBase::JSDOMWindowBase):
            (WebCore::JSDOMWindowBase::clear): Reset the wrapper windows prototype too.
            (WebCore::JSDOMWindowBase::toThisObject):
            (WebCore::JSDOMWindowBase::wrapper):
            (WebCore::windowProtoFuncAToB):
            (WebCore::windowProtoFuncBToA):
            (WebCore::windowProtoFuncOpen):
            (WebCore::windowProtoFuncSetTimeout):
            (WebCore::windowProtoFuncClearTimeout):
            (WebCore::windowProtoFuncSetInterval):
            (WebCore::windowProtoFuncAddEventListener):
            (WebCore::windowProtoFuncRemoveEventListener):
            (WebCore::windowProtoFuncShowModalDialog):
            (WebCore::windowProtoFuncNotImplemented):
            (WebCore::toJS):
            * bindings/js/JSDOMWindowBase.h:
            Fix to expect the wrapper as the thisObj.
            * bindings/js/JSDOMWindowCustom.cpp:
            (WebCore::JSDOMWindow::postMessage):
            (WebCore::toDOMWindow):
            * bindings/js/JSDOMWindowWrapper.cpp: Added.
            (WebCore::):
            (WebCore::JSDOMWindowWrapper::JSDOMWindowWrapper):
            (WebCore::JSDOMWindowWrapper::~JSDOMWindowWrapper):
            (WebCore::JSDOMWindowWrapper::mark):
            (WebCore::JSDOMWindowWrapper::className):
            (WebCore::JSDOMWindowWrapper::getOwnPropertySlot):
            (WebCore::JSDOMWindowWrapper::put):
            (WebCore::JSDOMWindowWrapper::deleteProperty):
            (WebCore::JSDOMWindowWrapper::getPropertyNames):
            (WebCore::JSDOMWindowWrapper::getPropertyAttributes):
            (WebCore::JSDOMWindowWrapper::defineGetter):
            (WebCore::JSDOMWindowWrapper::defineSetter):
            (WebCore::JSDOMWindowWrapper::lookupGetter):
            (WebCore::JSDOMWindowWrapper::lookupSetter):
            (WebCore::JSDOMWindowWrapper::toGlobalObject):
            (WebCore::JSDOMWindowWrapper::impl):
            (WebCore::JSDOMWindowWrapper::disconnectFrame):
            (WebCore::JSDOMWindowWrapper::clear):
            (WebCore::toJS):
            * bindings/js/JSDOMWindowWrapper.h: Added.
            (WebCore::JSDOMWindowWrapper::innerWindow):
            (WebCore::JSDOMWindowWrapper::setInnerWindow):
            (WebCore::JSDOMWindowWrapper::classInfo):
            Forward methods to the innerWindow.
            * bindings/js/JSHTMLDocumentCustom.cpp:
            (WebCore::JSHTMLDocument::open):
            * bindings/js/ScheduledAction.cpp:
            (WebCore::ScheduledAction::execute):
            * bindings/js/kjs_events.cpp:
            (WebCore::JSAbstractEventListener::handleEvent):
            * bindings/js/kjs_proxy.cpp:
            (WebCore::KJSProxy::~KJSProxy):
            (WebCore::KJSProxy::evaluate):
            (WebCore::KJSProxy::clear):
            (WebCore::KJSProxy::initScript):
            (WebCore::KJSProxy::clearDocumentWrapper):
            (WebCore::KJSProxy::processingUserGesture):
            (WebCore::KJSProxy::attachDebugger):
            * bindings/js/kjs_proxy.h:
            (WebCore::KJSProxy::haveWindowWrapper):
            (WebCore::KJSProxy::windowWrapper):
            (WebCore::KJSProxy::globalObject):
            (WebCore::KJSProxy::initScriptIfNeeded):
            Hold onto the wrapper window instead of global object.  As a convenience,
            keep the globalObject() as a forward to the inner window.
            * bindings/objc/DOMUtility.mm:
            (KJS::createDOMWrapper):
            * bindings/scripts/CodeGeneratorJS.pm:
            * dom/Document.cpp:
            (WebCore::Document::domWindow):
            * dom/Document.h:
            (WebCore::Document::defaultView):
            * loader/FrameLoader.cpp:
            (WebCore::FrameLoader::dispatchWindowObjectAvailable):
            * page/DOMWindow.idl:
            * page/Frame.cpp:
            (WebCore::Frame::~Frame):
            (WebCore::Frame::pageDestroyed):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@31746 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    41dbaab8
kjs_events.cpp 10.4 KB