Ignore:
Timestamp:
Sep 18, 2009, 4:12:03 PM (16 years ago)
Author:
[email protected]
Message:

Implement ES5 Object.defineProperty function
https://bugs.webkit.org/show_bug.cgi?id=29503

Reviewed by Geoff Garen

Implement Object.defineProperty. This requires adding the API to
ObjectConstructor, along with a helper function that implements the
ES5 internal ToPropertyDescriptor function. It then adds
JSObject::defineOwnProperty that implements the appropriate ES5 semantics.
Currently defineOwnProperty uses a delete followed by a put to redefine
attributes of a property, clearly this is less efficient than it could be
but we can improve this if it needs to be possible in future.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSGlobalObject.cpp

    r47404 r48542  
    176176}
    177177
    178 void JSGlobalObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunc)
     178void JSGlobalObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes)
    179179{
    180180    PropertySlot slot;
    181181    if (!symbolTableGet(propertyName, slot))
    182         JSVariableObject::defineGetter(exec, propertyName, getterFunc);
    183 }
    184 
    185 void JSGlobalObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunc)
     182        JSVariableObject::defineGetter(exec, propertyName, getterFunc, attributes);
     183}
     184
     185void JSGlobalObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes)
    186186{
    187187    PropertySlot slot;
    188188    if (!symbolTableGet(propertyName, slot))
    189         JSVariableObject::defineSetter(exec, propertyName, setterFunc);
     189        JSVariableObject::defineSetter(exec, propertyName, setterFunc, attributes);
    190190}
    191191
Note: See TracChangeset for help on using the changeset viewer.