Ignore:
Timestamp:
Apr 16, 2008, 1:58:46 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

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

Reviewed by Geoffrey Garen.

  • To keep the behavior of the WebKit and JavaScriptCore API's the same, we need to hide the fact that the global object and the window object are no longer the same thing, and the the global object now changes on navigations. To do this, only the wrapper should ever be exposed. This fixes the two remaining spots where the internal global object is exposed, the windowScriptObject returned from [WebFrame windowObject] and the object return by calling JSContextGetGlobalObject on [WebFrame globalContext].
  • API/JSContextRef.cpp: (JSContextGetGlobalObject): This is a bit of a hack, this returns the "this" representation of the globalObject which will be the WrapperWindow for WebCore and the globalObject for non-WebCore.
  • API/JSObjectRef.cpp: (JSObjectSetProperty): Call the new putWithAttributes method instead of relying on lower-level calls. This is needed so that the window wrapper can forward the calls.
  • JavaScriptCore.exp:
  • kjs/Activation.h:
  • kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::putWithAttributes):
  • kjs/JSGlobalObject.h:
  • kjs/JSVariableObject.h: (KJS::JSVariableObject::symbolTablePutWithAttributes):
  • kjs/function.cpp: (KJS::ActivationImp::putWithAttributes):
  • kjs/nodes.cpp: (KJS::ConstDeclNode::handleSlowCase): (KJS::ConstDeclNode::evaluateSingle): (KJS::EvalNode::processDeclarations):
  • kjs/object.cpp: (KJS::JSObject::putWithAttributes):
  • kjs/object.h: Rename initializeVariable to putWithAttributes and move it down to JSObject so it can be used for JSObjectSetProperty.

WebCore:

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

Reviewed by Geoffrey Garen.

  • To keep the behavior of the WebKit and JavaScriptCore API's the same, we need to hide the fact that the global object and the window object are no longer the same thing, and the the global object now changes on navigations. To do this, only the wrapper should ever be exposed. This fixes the two remaining spots where the internal global object is exposed, the windowScriptObject returned from [WebFrame windowObject] and the object return by calling JSContextGetGlobalObject on [WebFrame globalContext]
  • bindings/js/JSDOMWindowWrapper.cpp: (WebCore::JSDOMWindowWrapper::putWithAttributes):
  • bindings/js/JSDOMWindowWrapper.h: Forward this new method so that JSObjectSetProperty doesn't set properties on the wrapper.
  • page/mac/FrameMac.mm: (WebCore::Frame::windowScriptObject): Return the wrapper instead of the global object.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSObjectRef.cpp

    r31746 r31962  
    180180    JSValue* jsValue = toJS(value);
    181181
    182     // If non-0 attributes were passed, we may need to use a lower-level call than
    183     // the normal JSObject::put. If there is no existing property, then use either
    184     // initializeVariable or putDirect instead, since those have the power to set attributes.
    185     if (attributes && !jsObject->hasProperty(exec, name)) {
    186         if (jsObject->isGlobalObject())
    187             static_cast<JSGlobalObject*>(jsObject)->initializeVariable(exec, name, jsValue, attributes);
    188         else
    189             jsObject->putDirect(name, jsValue, attributes);
    190         return;
    191     }
    192 
    193     jsObject->put(exec, name, jsValue);
     182    if (attributes && !jsObject->hasProperty(exec, name))
     183        jsObject->putWithAttributes(exec, name, jsValue, attributes);
     184    else
     185        jsObject->put(exec, name, jsValue);
     186
    194187    if (exec->hadException()) {
    195188        if (exception)
Note: See TracChangeset for help on using the changeset viewer.