Ignore:
Timestamp:
Apr 8, 2008, 7:17:49 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2008-04-04 Sam Weinig <[email protected]>

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 <[email protected]>

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):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/ExecState.cpp

    r31267 r31746  
    4343
    4444// The constructor for the globalExec pseudo-ExecState
    45 inline ExecState::ExecState(JSGlobalObject* globalObject)
     45inline ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisObject)
    4646    : m_globalObject(globalObject)
    4747    , m_exception(0)
     
    5656    , m_inlineScopeChainNode(0, 0)
    5757    , m_variableObject(globalObject)
    58     , m_thisValue(globalObject)
     58    , m_thisValue(thisObject)
     59    , m_globalThisValue(thisObject)
    5960    , m_iterationDepth(0)
    6061    , m_switchDepth(0)
     
    7879    , m_variableObject(globalObject)
    7980    , m_thisValue(thisObject)
     81    , m_globalThisValue(thisObject)
    8082    , m_iterationDepth(0)
    8183    , m_switchDepth(0)
     
    101103    , m_variableObject(variableObject)
    102104    , m_thisValue(thisObject)
     105    , m_globalThisValue(thisObject)
    103106    , m_iterationDepth(0)
    104107    , m_switchDepth(0)
     
    116119}
    117120
    118 GlobalExecState::GlobalExecState(JSGlobalObject* globalObject)
    119     : ExecState(globalObject)
     121GlobalExecState::GlobalExecState(JSGlobalObject* globalObject, JSObject* thisObject)
     122    : ExecState(globalObject, thisObject)
    120123{
    121124}
Note: See TracChangeset for help on using the changeset viewer.