Changeset 31962 in webkit for trunk/JavaScriptCore/kjs/nodes.cpp


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/kjs/nodes.cpp

    r31746 r31962  
    38433843    ASSERT(base && base->isVariableObject());
    38443844
    3845     static_cast<JSVariableObject*>(base)->initializeVariable(exec, m_ident, val, ReadOnly);
     3845    static_cast<JSVariableObject*>(base)->putWithAttributes(exec, m_ident, val, ReadOnly);
    38463846}
    38473847
     
    38633863            if (exec->codeType() != EvalCode)
    38643864                attributes |= DontDelete;
    3865             variableObject->initializeVariable(exec, m_ident, val, attributes);
     3865            variableObject->putWithAttributes(exec, m_ident, val, attributes);
    38663866        } else {
    38673867            JSValue* val = m_init->evaluate(exec);
     
    38743874                return handleSlowCase(exec, chain, val);
    38753875
    3876             variableObject->initializeVariable(exec, m_ident, val, ReadOnly);
     3876            variableObject->putWithAttributes(exec, m_ident, val, ReadOnly);
    38773877        }
    38783878    }
     
    48514851        if (m_varStack[i].second & DeclarationStacks::IsConstant)
    48524852            attributes = ReadOnly;
    4853         variableObject->initializeVariable(exec, ident, jsUndefined(), attributes);
     4853        variableObject->putWithAttributes(exec, ident, jsUndefined(), attributes);
    48544854    }
    48554855
    48564856    for (i = 0, size = m_functionStack.size(); i < size; ++i) {
    48574857        FuncDeclNode* funcDecl = m_functionStack[i];
    4858         variableObject->initializeVariable(exec, funcDecl->m_ident, funcDecl->makeFunction(exec), 0);
     4858        variableObject->putWithAttributes(exec, funcDecl->m_ident, funcDecl->makeFunction(exec), 0);
    48594859    }
    48604860}
Note: See TracChangeset for help on using the changeset viewer.