Changeset 154300 in webkit


Ignore:
Timestamp:
Aug 19, 2013 2:44:17 PM (11 years ago)
Author:
barraclough@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=119995
Start removing custom implementations of getOwnPropertyDescriptor

Reviewed by Sam Weinig.

This can now typically implemented in terms of getOwnPropertySlot.
Add a macro to PropertyDescriptor to define an implementation of GOPD in terms of GOPS.
Switch over most classes in JSC & the WebCore bindings generator to use this.

Source/JavaScriptCore:

  • API/JSCallbackObjectFunctions.h:
  • debugger/DebuggerActivation.cpp:
  • runtime/Arguments.cpp:
  • runtime/ArrayConstructor.cpp:
  • runtime/ArrayPrototype.cpp:
  • runtime/BooleanPrototype.cpp:
  • runtime/DateConstructor.cpp:
  • runtime/DatePrototype.cpp:
  • runtime/ErrorPrototype.cpp:
  • runtime/JSActivation.cpp:
  • runtime/JSArray.cpp:
  • runtime/JSArrayBuffer.cpp:
  • runtime/JSArrayBufferView.cpp:
  • runtime/JSCell.cpp:
  • runtime/JSDataView.cpp:
  • runtime/JSDataViewPrototype.cpp:
  • runtime/JSFunction.cpp:
  • runtime/JSGenericTypedArrayViewInlines.h:
  • runtime/JSNotAnObject.cpp:
  • runtime/JSONObject.cpp:
  • runtime/JSObject.cpp:
  • runtime/NamePrototype.cpp:
  • runtime/NumberConstructor.cpp:
  • runtime/NumberPrototype.cpp:
  • runtime/ObjectConstructor.cpp:
    • Implement getOwnPropertySlot in terms of GET_OWN_PROPERTY_DESCRIPTOR_IMPL.
  • runtime/PropertyDescriptor.h:
    • Added GET_OWN_PROPERTY_DESCRIPTOR_IMPL macro.
  • runtime/PropertySlot.h:

(JSC::PropertySlot::isValue):
(JSC::PropertySlot::isGetter):
(JSC::PropertySlot::isCustom):
(JSC::PropertySlot::isCacheableValue):
(JSC::PropertySlot::isCacheableGetter):
(JSC::PropertySlot::isCacheableCustom):
(JSC::PropertySlot::attributes):
(JSC::PropertySlot::getterSetter):

  • Add accessors necessary to convert PropertySlot to descriptor.
  • runtime/RegExpConstructor.cpp:
  • runtime/RegExpMatchesArray.cpp:
  • runtime/RegExpMatchesArray.h:
  • runtime/RegExpObject.cpp:
  • runtime/RegExpPrototype.cpp:
  • runtime/StringConstructor.cpp:
  • runtime/StringObject.cpp:
    • Implement getOwnPropertySlot in terms of GET_OWN_PROPERTY_DESCRIPTOR_IMPL.

Source/WebCore:

  • bindings/js/JSCSSStyleDeclarationCustom.cpp:
  • bindings/js/JSHTMLAppletElementCustom.cpp:
  • bindings/js/JSHTMLEmbedElementCustom.cpp:
  • bindings/js/JSHTMLObjectElementCustom.cpp:
  • bindings/js/JSHistoryCustom.cpp:

(WebCore::JSHistory::getOwnPropertySlotDelegate):

  • bindings/js/JSLocationCustom.cpp:

(WebCore::JSLocation::getOwnPropertySlotDelegate):

  • bindings/js/JSWorkerGlobalScopeCustom.cpp:
    • Remove getOwnPropertyDescriptorDelegate methods, Change attributes of cross-frame access properties in JSHistory/JSLocation to prevent properties from being redefined.
  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateHeader):
(GenerateImplementation):
(GenerateConstructorHelperMethods):

  • Implement getOwnPropertySlot in terms of GET_OWN_PROPERTY_DESCRIPTOR_IMPL.
  • bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
  • bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
  • bindings/scripts/test/JS/JSTestEventConstructor.cpp:
  • bindings/scripts/test/JS/JSTestEventTarget.cpp:
  • bindings/scripts/test/JS/JSTestException.cpp:
  • bindings/scripts/test/JS/JSTestInterface.cpp:
  • bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
  • bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
  • bindings/scripts/test/JS/JSTestNode.cpp:
  • bindings/scripts/test/JS/JSTestObj.cpp:
  • bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
  • bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
  • bindings/scripts/test/JS/JSTestTypedefs.cpp:
    • Update test expectations.

LayoutTests:

  • http/tests/security/xss-DENIED-defineProperty-expected.txt:
    • Remove erroneous error messages - cross frame access to reload is allowed - it's just read-only, non-configurable.
Location:
trunk
Files:
63 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r154295 r154300  
     12013-08-19  Gavin Barraclough  <barraclough@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=119995
     4        Start removing custom implementations of getOwnPropertyDescriptor
     5
     6        Reviewed by Sam Weinig.
     7
     8        This can now typically implemented in terms of getOwnPropertySlot.
     9        Add a macro to PropertyDescriptor to define an implementation of GOPD in terms of GOPS.
     10        Switch over most classes in JSC & the WebCore bindings generator to use this.
     11
     12        * http/tests/security/xss-DENIED-defineProperty-expected.txt:
     13            - Remove erroneous error messages - cross frame access to reload is allowed - it's just read-only, non-configurable.
     14
    1152013-08-19  Jer Noble  <jer.noble@apple.com>
    216
  • trunk/LayoutTests/http/tests/security/xss-DENIED-defineProperty-expected.txt

    r145692 r154300  
    1 CONSOLE MESSAGE: Blocked a frame with origin "http://localhost:8000" from accessing a frame with origin "http://127.0.0.1:8000". Protocols, domains, and ports must match.
    2 CONSOLE MESSAGE: Blocked a frame with origin "http://localhost:8000" from accessing a frame with origin "http://127.0.0.1:8000". Protocols, domains, and ports must match.
    3 CONSOLE MESSAGE: Blocked a frame with origin "http://localhost:8000" from accessing a frame with origin "http://127.0.0.1:8000". Protocols, domains, and ports must match.
    4 CONSOLE MESSAGE: Blocked a frame with origin "http://localhost:8000" from accessing a frame with origin "http://127.0.0.1:8000". Protocols, domains, and ports must match.
    5 CONSOLE MESSAGE: Blocked a frame with origin "http://localhost:8000" from accessing a frame with origin "http://127.0.0.1:8000". Protocols, domains, and ports must match.
    6 CONSOLE MESSAGE: Blocked a frame with origin "http://localhost:8000" from accessing a frame with origin "http://127.0.0.1:8000". Protocols, domains, and ports must match.
    71CONSOLE MESSAGE: Blocked a frame with origin "http://localhost:8000" from accessing a frame with origin "http://127.0.0.1:8000". Protocols, domains, and ports must match.
    82CONSOLE MESSAGE: Blocked a frame with origin "http://localhost:8000" from accessing a frame with origin "http://127.0.0.1:8000". Protocols, domains, and ports must match.
  • trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r154253 r154300  
    214214
    215215template <class Parent>
    216 bool JSCallbackObject<Parent>::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    217 {
    218     JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(object);
    219     PropertySlot slot(thisObject);
    220     if (thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, propertyName, slot)) {
    221         // Ideally we should return an access descriptor, but returning a value descriptor is better than nothing.
    222         JSValue value = slot.getValue(exec, propertyName);
    223         if (!exec->hadException())
    224             descriptor.setValue(value);
    225         // We don't know whether the property is configurable, but assume it is.
    226         descriptor.setConfigurable(true);
    227         // We don't know whether the property is enumerable (we could call getOwnPropertyNames() to find out), but assume it isn't.
    228         descriptor.setEnumerable(false);
    229         return true;
    230     }
    231 
    232     return Parent::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    233 }
     216GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSCallbackObject<Parent>)
    234217
    235218template <class Parent>
  • trunk/Source/JavaScriptCore/ChangeLog

    r154298 r154300  
     12013-08-18  Gavin Barraclough  <barraclough@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=119995
     4        Start removing custom implementations of getOwnPropertyDescriptor
     5
     6        Reviewed by Sam Weinig.
     7
     8        This can now typically implemented in terms of getOwnPropertySlot.
     9        Add a macro to PropertyDescriptor to define an implementation of GOPD in terms of GOPS.
     10        Switch over most classes in JSC & the WebCore bindings generator to use this.
     11
     12        * API/JSCallbackObjectFunctions.h:
     13        * debugger/DebuggerActivation.cpp:
     14        * runtime/Arguments.cpp:
     15        * runtime/ArrayConstructor.cpp:
     16        * runtime/ArrayPrototype.cpp:
     17        * runtime/BooleanPrototype.cpp:
     18        * runtime/DateConstructor.cpp:
     19        * runtime/DatePrototype.cpp:
     20        * runtime/ErrorPrototype.cpp:
     21        * runtime/JSActivation.cpp:
     22        * runtime/JSArray.cpp:
     23        * runtime/JSArrayBuffer.cpp:
     24        * runtime/JSArrayBufferView.cpp:
     25        * runtime/JSCell.cpp:
     26        * runtime/JSDataView.cpp:
     27        * runtime/JSDataViewPrototype.cpp:
     28        * runtime/JSFunction.cpp:
     29        * runtime/JSGenericTypedArrayViewInlines.h:
     30        * runtime/JSNotAnObject.cpp:
     31        * runtime/JSONObject.cpp:
     32        * runtime/JSObject.cpp:
     33        * runtime/NamePrototype.cpp:
     34        * runtime/NumberConstructor.cpp:
     35        * runtime/NumberPrototype.cpp:
     36        * runtime/ObjectConstructor.cpp:
     37            - Implement getOwnPropertySlot in terms of GET_OWN_PROPERTY_DESCRIPTOR_IMPL.
     38        * runtime/PropertyDescriptor.h:
     39            - Added GET_OWN_PROPERTY_DESCRIPTOR_IMPL macro.
     40        * runtime/PropertySlot.h:
     41        (JSC::PropertySlot::isValue):
     42        (JSC::PropertySlot::isGetter):
     43        (JSC::PropertySlot::isCustom):
     44        (JSC::PropertySlot::isCacheableValue):
     45        (JSC::PropertySlot::isCacheableGetter):
     46        (JSC::PropertySlot::isCacheableCustom):
     47        (JSC::PropertySlot::attributes):
     48        (JSC::PropertySlot::getterSetter):
     49            - Add accessors necessary to convert PropertySlot to descriptor.
     50        * runtime/RegExpConstructor.cpp:
     51        * runtime/RegExpMatchesArray.cpp:
     52        * runtime/RegExpMatchesArray.h:
     53        * runtime/RegExpObject.cpp:
     54        * runtime/RegExpPrototype.cpp:
     55        * runtime/StringConstructor.cpp:
     56        * runtime/StringObject.cpp:
     57            - Implement getOwnPropertySlot in terms of GET_OWN_PROPERTY_DESCRIPTOR_IMPL.
     58
    1592013-08-19  Michael Saboff  <msaboff@apple.com>
    260
  • trunk/Source/JavaScriptCore/debugger/DebuggerActivation.cpp

    r154038 r154300  
    9696}
    9797
    98 bool DebuggerActivation::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    99 {
    100     DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object);
    101     return thisObject->m_activation->methodTable()->getOwnPropertyDescriptor(thisObject->m_activation.get(), exec, propertyName, descriptor);
    102 }
     98GET_OWN_PROPERTY_DESCRIPTOR_IMPL(DebuggerActivation)
    10399
    104100bool DebuggerActivation::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool shouldThrow)
  • trunk/Source/JavaScriptCore/runtime/Arguments.cpp

    r154253 r154300  
    153153}
    154154
    155 bool Arguments::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    156 {
    157     Arguments* thisObject = jsCast<Arguments*>(object);
    158     unsigned i = propertyName.asIndex();
    159     if (JSValue value = thisObject->tryGetArgument(i)) {
    160         RELEASE_ASSERT(i < PropertyName::NotAnIndex);
    161         descriptor.setDescriptor(value, None);
    162         return true;
    163     }
    164    
    165     if (propertyName == exec->propertyNames().length && LIKELY(!thisObject->m_overrodeLength)) {
    166         descriptor.setDescriptor(jsNumber(thisObject->m_numArguments), DontEnum);
    167         return true;
    168     }
    169    
    170     if (propertyName == exec->propertyNames().callee && LIKELY(!thisObject->m_overrodeCallee)) {
    171         if (!thisObject->m_isStrictMode) {
    172             descriptor.setDescriptor(thisObject->m_callee.get(), DontEnum);
    173             return true;
    174         }
    175         thisObject->createStrictModeCalleeIfNecessary(exec);
    176     }
    177 
    178     if (propertyName == exec->propertyNames().caller && thisObject->m_isStrictMode)
    179         thisObject->createStrictModeCallerIfNecessary(exec);
    180    
    181     return JSObject::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    182 }
     155GET_OWN_PROPERTY_DESCRIPTOR_IMPL(Arguments)
    183156
    184157void Arguments::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
  • trunk/Source/JavaScriptCore/runtime/ArrayConstructor.cpp

    r154038 r154300  
    7272}
    7373
    74 bool ArrayConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    75 {
    76     return getStaticFunctionDescriptor<InternalFunction>(exec, ExecState::arrayConstructorTable(exec), jsCast<ArrayConstructor*>(object), propertyName, descriptor);
    77 }
     74GET_OWN_PROPERTY_DESCRIPTOR_IMPL(ArrayConstructor)
    7875
    7976// ------------------------------ Functions ---------------------------
  • trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp

    r154038 r154300  
    142142}
    143143
    144 bool ArrayPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    145 {
    146     return getStaticFunctionDescriptor<JSArray>(exec, ExecState::arrayPrototypeTable(exec), jsCast<ArrayPrototype*>(object), propertyName, descriptor);
    147 }
     144GET_OWN_PROPERTY_DESCRIPTOR_IMPL(ArrayPrototype)
    148145
    149146// ------------------------------ Array Functions ----------------------------
  • trunk/Source/JavaScriptCore/runtime/BooleanPrototype.cpp

    r154038 r154300  
    6969}
    7070
    71 bool BooleanPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    72 {
    73     return getStaticFunctionDescriptor<BooleanObject>(exec, ExecState::booleanPrototypeTable(exec), jsCast<BooleanPrototype*>(object), propertyName, descriptor);
    74 }
     71GET_OWN_PROPERTY_DESCRIPTOR_IMPL(BooleanPrototype)
    7572
    7673// ------------------------------ Functions ---------------------------
  • trunk/Source/JavaScriptCore/runtime/DateConstructor.cpp

    r154038 r154300  
    9292}
    9393
    94 bool DateConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    95 {
    96     return getStaticFunctionDescriptor<InternalFunction>(exec, ExecState::dateConstructorTable(exec), jsCast<DateConstructor*>(object), propertyName, descriptor);
    97 }
     94GET_OWN_PROPERTY_DESCRIPTOR_IMPL(DateConstructor)
    9895
    9996// ECMA 15.9.3
  • trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp

    r154038 r154300  
    520520}
    521521
    522 bool DatePrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    523 {
    524     return getStaticFunctionDescriptor<JSObject>(exec, ExecState::dateTable(exec), jsCast<DatePrototype*>(object), propertyName, descriptor);
    525 }
     522GET_OWN_PROPERTY_DESCRIPTOR_IMPL(DatePrototype)
    526523
    527524// Functions
  • trunk/Source/JavaScriptCore/runtime/ErrorPrototype.cpp

    r154038 r154300  
    6767}
    6868
    69 bool ErrorPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    70 {
    71     return getStaticFunctionDescriptor<ErrorInstance>(exec, ExecState::errorPrototypeTable(exec), jsCast<ErrorPrototype*>(object), propertyName, descriptor);
    72 }
     69GET_OWN_PROPERTY_DESCRIPTOR_IMPL(ErrorPrototype)
    7370
    7471// ------------------------------ Functions ---------------------------
  • trunk/Source/JavaScriptCore/runtime/JSActivation.cpp

    r154253 r154300  
    179179}
    180180
    181 bool JSActivation::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    182 {
    183     JSActivation* thisObject = jsCast<JSActivation*>(object);
    184 
    185     if (propertyName == exec->propertyNames().arguments) {
    186         // Defend against the inspector asking for the arguments object after it has been optimized out.
    187         if (!thisObject->isTornOff()) {
    188             PropertySlot slot(thisObject);
    189             JSActivation::getOwnPropertySlot(thisObject, exec, propertyName, slot);
    190             descriptor.setDescriptor(slot.getValue(exec, propertyName), DontEnum);
    191             return true;
    192         }
    193     }
    194 
    195     if (thisObject->symbolTableGet(propertyName, descriptor))
    196         return true;
    197 
    198     return Base::getOwnPropertyDescriptor(object, exec, propertyName, descriptor);
    199 }
     181GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSActivation)
    200182
    201183void JSActivation::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
  • trunk/Source/JavaScriptCore/runtime/JSArray.cpp

    r154253 r154300  
    190190}
    191191
    192 bool JSArray::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    193 {
    194     JSArray* thisObject = jsCast<JSArray*>(object);
    195     if (propertyName == exec->propertyNames().length) {
    196         descriptor.setDescriptor(jsNumber(thisObject->length()), thisObject->isLengthWritable() ? DontDelete | DontEnum : DontDelete | DontEnum | ReadOnly);
    197         return true;
    198     }
    199 
    200     return JSObject::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    201 }
     192GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSArray)
    202193
    203194// ECMA 15.4.5.1
  • trunk/Source/JavaScriptCore/runtime/JSArrayBuffer.cpp

    r154253 r154300  
    7979}
    8080
    81 bool JSArrayBuffer::getOwnPropertyDescriptor(
    82     JSObject* object, ExecState* exec, PropertyName propertyName,
    83     PropertyDescriptor& descriptor)
    84 {
    85     JSArrayBuffer* thisObject = jsCast<JSArrayBuffer*>(object);
    86    
    87     if (propertyName == exec->propertyNames().byteLength) {
    88         descriptor.setDescriptor(
    89             jsNumber(thisObject->impl()->byteLength()), DontDelete | ReadOnly);
    90         return true;
    91     }
    92    
    93     return Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    94 }
     81GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSArrayBuffer)
    9582
    9683void JSArrayBuffer::put(
  • trunk/Source/JavaScriptCore/runtime/JSArrayBufferView.cpp

    r154253 r154300  
    140140}
    141141
    142 bool JSArrayBufferView::getOwnPropertyDescriptor(
    143     JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    144 {
    145     JSArrayBufferView* thisObject = jsCast<JSArrayBufferView*>(object);
    146     if (propertyName == exec->propertyNames().byteOffset) {
    147         descriptor.setDescriptor(jsNumber(thisObject->byteOffset()), DontDelete | ReadOnly);
    148         return true;
    149     }
    150    
    151     if (propertyName == exec->propertyNames().buffer) {
    152         descriptor.setDescriptor(
    153             exec->vm().m_typedArrayController->toJS(
    154                 exec, thisObject->globalObject(), thisObject->buffer()),
    155             DontDelete | ReadOnly);
    156         return true;
    157     }
    158    
    159     return Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    160 }
     142GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSArrayBufferView)
    161143
    162144void JSArrayBufferView::put(
  • trunk/Source/JavaScriptCore/runtime/JSCell.cpp

    r154127 r154300  
    219219}
    220220
    221 bool JSCell::getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&)
    222 {
    223     RELEASE_ASSERT_NOT_REACHED();
    224     return false;
    225 }
     221GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSCell)
    226222
    227223void JSCell::slowDownAndWasteMemory(JSArrayBufferView*)
  • trunk/Source/JavaScriptCore/runtime/JSDataView.cpp

    r154253 r154300  
    9696}
    9797
    98 bool JSDataView::getOwnPropertyDescriptor(
    99     JSObject* object, ExecState* exec, PropertyName propertyName,
    100     PropertyDescriptor& descriptor)
    101 {
    102     JSDataView* thisObject = jsCast<JSDataView*>(object);
    103     if (propertyName == exec->propertyNames().byteLength) {
    104         descriptor.setDescriptor(jsNumber(thisObject->m_length), DontEnum | ReadOnly);
    105         return true;
    106     }
    107    
    108     return Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    109 }
     98GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSDataView)
    11099
    111100void JSDataView::slowDownAndWasteMemory(JSArrayBufferView*)
  • trunk/Source/JavaScriptCore/runtime/JSDataViewPrototype.cpp

    r154143 r154300  
    9191}
    9292
    93 bool JSDataViewPrototype::getOwnPropertyDescriptor(
    94     JSObject* object, ExecState* exec, PropertyName propertyName,
    95     PropertyDescriptor& descriptor)
    96 {
    97     return getStaticFunctionDescriptor<JSObject>(
    98         exec, ExecState::dataViewTable(exec), jsCast<JSDataViewPrototype*>(object),
    99         propertyName, descriptor);
    100 }
     93GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSDataViewPrototype)
    10194
    10295template<typename Adaptor>
  • trunk/Source/JavaScriptCore/runtime/JSFunction.cpp

    r154253 r154300  
    303303}
    304304
    305 bool JSFunction::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    306 {
    307     JSFunction* thisObject = jsCast<JSFunction*>(object);
    308     if (thisObject->isHostFunction())
    309         return Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    310    
    311     if (propertyName == exec->propertyNames().prototype) {
    312         PropertySlot slot(thisObject);
    313         thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, propertyName, slot);
    314         return Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    315     }
    316    
    317     if (propertyName == exec->propertyNames().arguments) {
    318         if (thisObject->jsExecutable()->isStrictMode()) {
    319             bool result = Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    320             if (!result) {
    321                 thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
    322                 result = Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    323                 ASSERT(result);
    324             }
    325             return result;
    326         }
    327         descriptor.setDescriptor(retrieveArguments(exec, thisObject), ReadOnly | DontEnum | DontDelete);
    328         return true;
    329     }
    330    
    331     if (propertyName == exec->propertyNames().length) {
    332         descriptor.setDescriptor(jsNumber(thisObject->jsExecutable()->parameterCount()), ReadOnly | DontEnum | DontDelete);
    333         return true;
    334     }
    335    
    336     if (propertyName == exec->propertyNames().name) {
    337         descriptor.setDescriptor(thisObject->jsExecutable()->nameValue(), ReadOnly | DontEnum | DontDelete);
    338         return true;
    339     }
    340 
    341     if (propertyName == exec->propertyNames().caller) {
    342         if (thisObject->jsExecutable()->isStrictMode()) {
    343             bool result = Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    344             if (!result) {
    345                 thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
    346                 result = Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    347                 ASSERT(result);
    348             }
    349             return result;
    350         }
    351         descriptor.setDescriptor(retrieveCallerFunction(exec, thisObject), ReadOnly | DontEnum | DontDelete);
    352         return true;
    353     }
    354    
    355     return Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    356 }
     305GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSFunction)
    357306
    358307void JSFunction::getOwnNonIndexPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
  • trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h

    r154253 r154300  
    235235
    236236template<typename Adaptor>
    237 bool JSGenericTypedArrayView<Adaptor>::getOwnPropertyDescriptor(
    238     JSObject* object, ExecState* exec, PropertyName propertyName,
    239     PropertyDescriptor& descriptor)
    240 {
    241     JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(object);
    242     if (propertyName == exec->propertyNames().length) {
    243         descriptor.setDescriptor(jsNumber(thisObject->length()), DontDelete | ReadOnly);
    244         return true;
    245     }
    246    
    247     if (propertyName == exec->propertyNames().byteLength) {
    248         descriptor.setDescriptor(jsNumber(thisObject->byteLength()), DontDelete | ReadOnly);
    249         return true;
    250     }
    251    
    252     unsigned index = propertyName.asIndex();
    253     if (index != PropertyName::NotAnIndex && thisObject->canGetIndexQuickly(index)) {
    254         descriptor.setDescriptor(thisObject->getIndexQuickly(index), DontDelete | ReadOnly);
    255         return true;
    256     }
    257    
    258     return Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    259 }
     237GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSGenericTypedArrayView<Adaptor>)
    260238
    261239template<typename Adaptor>
  • trunk/Source/JavaScriptCore/runtime/JSNotAnObject.cpp

    r153532 r154300  
    5959}
    6060
    61 bool JSNotAnObject::getOwnPropertyDescriptor(JSObject*, ExecState* exec, PropertyName, PropertyDescriptor&)
    62 {
    63     ASSERT_UNUSED(exec, exec->hadException());
    64     return false;
    65 }
     61GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSNotAnObject)
    6662
    6763void JSNotAnObject::put(JSCell*, ExecState* exec, PropertyName , JSValue, PutPropertySlot&)
  • trunk/Source/JavaScriptCore/runtime/JSONObject.cpp

    r154038 r154300  
    597597}
    598598
    599 bool JSONObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    600 {
    601     return getStaticFunctionDescriptor<JSObject>(exec, ExecState::jsonTable(exec), jsCast<JSONObject*>(object), propertyName, descriptor);
    602 }
     599GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSONObject)
    603600
    604601class Walker {
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r154253 r154300  
    23822382}
    23832383
    2384 bool JSObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    2385 {
    2386     unsigned attributes = 0;
    2387     JSCell* cell = 0;
    2388     PropertyOffset offset = object->structure()->get(exec->vm(), propertyName, attributes, cell);
    2389     if (isValidOffset(offset)) {
    2390         descriptor.setDescriptor(object->getDirect(offset), attributes);
    2391         return true;
    2392     }
    2393    
    2394     unsigned i = propertyName.asIndex();
    2395     if (i == PropertyName::NotAnIndex)
    2396         return false;
    2397    
    2398     switch (object->structure()->indexingType()) {
    2399     case ALL_BLANK_INDEXING_TYPES:
    2400     case ALL_UNDECIDED_INDEXING_TYPES:
    2401         return false;
    2402        
    2403     case ALL_INT32_INDEXING_TYPES:
    2404     case ALL_CONTIGUOUS_INDEXING_TYPES: {
    2405         Butterfly* butterfly = object->m_butterfly;
    2406         if (i >= butterfly->vectorLength())
    2407             return false;
    2408         JSValue value = butterfly->contiguous()[i].get();
    2409         if (!value)
    2410             return false;
    2411         descriptor.setDescriptor(value, 0);
    2412         return true;
    2413     }
    2414        
    2415     case ALL_DOUBLE_INDEXING_TYPES: {
    2416         Butterfly* butterfly = object->m_butterfly;
    2417         if (i >= butterfly->vectorLength())
    2418             return false;
    2419         double value = butterfly->contiguousDouble()[i];
    2420         if (value != value)
    2421             return false;
    2422         descriptor.setDescriptor(JSValue(JSValue::EncodeAsDouble, value), 0);
    2423         return true;
    2424     }
    2425        
    2426     case ALL_ARRAY_STORAGE_INDEXING_TYPES: {
    2427         ArrayStorage* storage = object->m_butterfly->arrayStorage();
    2428         if (i >= storage->length())
    2429             return false;
    2430         if (i < storage->vectorLength()) {
    2431             WriteBarrier<Unknown>& value = storage->m_vector[i];
    2432             if (!value)
    2433                 return false;
    2434             descriptor.setDescriptor(value.get(), 0);
    2435             return true;
    2436         }
    2437         if (SparseArrayValueMap* map = storage->m_sparseMap.get()) {
    2438             SparseArrayValueMap::iterator it = map->find(i);
    2439             if (it == map->notFound())
    2440                 return false;
    2441             it->value.get(descriptor);
    2442             return true;
    2443         }
    2444         return false;
    2445     }
    2446        
    2447     default:
    2448         RELEASE_ASSERT_NOT_REACHED();
    2449         return false;
    2450     }
    2451 }
     2384GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSObject)
    24522385
    24532386bool JSObject::getPropertyDescriptor(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
  • trunk/Source/JavaScriptCore/runtime/NamePrototype.cpp

    r154038 r154300  
    6464}
    6565
    66 bool NamePrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    67 {
    68     return getStaticFunctionDescriptor<Base>(exec, ExecState::privateNamePrototypeTable(exec), jsCast<NamePrototype*>(object), propertyName, descriptor);
    69 }
     66GET_OWN_PROPERTY_DESCRIPTOR_IMPL(NamePrototype)
    7067
    7168// ------------------------------ Functions ---------------------------
  • trunk/Source/JavaScriptCore/runtime/NumberConstructor.cpp

    r154038 r154300  
    7878}
    7979
    80 bool NumberConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    81 {
    82     return getStaticValueDescriptor<NumberConstructor, InternalFunction>(exec, ExecState::numberConstructorTable(exec), jsCast<NumberConstructor*>(object), propertyName, descriptor);
    83 }
     80GET_OWN_PROPERTY_DESCRIPTOR_IMPL(NumberConstructor)
    8481
    8582void NumberConstructor::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
  • trunk/Source/JavaScriptCore/runtime/NumberPrototype.cpp

    r154038 r154300  
    8989}
    9090
    91 bool NumberPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    92 {
    93     return getStaticFunctionDescriptor<NumberObject>(exec, ExecState::numberPrototypeTable(exec), jsCast<NumberPrototype*>(object), propertyName, descriptor);
    94 }
     91GET_OWN_PROPERTY_DESCRIPTOR_IMPL(NumberPrototype)
    9592
    9693// ------------------------------ Functions ---------------------------
  • trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp

    r153673 r154300  
    100100}
    101101
    102 bool ObjectConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    103 {
    104     return getStaticFunctionDescriptor<JSObject>(exec, ExecState::objectConstructorTable(exec), jsCast<ObjectConstructor*>(object), propertyName, descriptor);
    105 }
     102GET_OWN_PROPERTY_DESCRIPTOR_IMPL(ObjectConstructor)
    106103
    107104static ALWAYS_INLINE JSObject* constructObject(ExecState* exec)
  • trunk/Source/JavaScriptCore/runtime/PropertyDescriptor.h

    r140718 r154300  
    5656        JS_EXPORT_PRIVATE void setUndefined();
    5757        JS_EXPORT_PRIVATE void setDescriptor(JSValue value, unsigned attributes);
    58         void setAccessorDescriptor(GetterSetter* accessor, unsigned attributes);
     58        JS_EXPORT_PRIVATE void setAccessorDescriptor(GetterSetter* accessor, unsigned attributes);
    5959        JS_EXPORT_PRIVATE void setWritable(bool);
    6060        JS_EXPORT_PRIVATE void setEnumerable(bool);
     
    8686}
    8787
     88#define GET_OWN_PROPERTY_DESCRIPTOR_IMPL(ClassName) \
     89bool ClassName::getOwnPropertyDescriptor(JSC::JSObject* object, JSC::ExecState* exec, JSC::PropertyName propertyName, JSC::PropertyDescriptor& descriptor) \
     90{ \
     91    JSC::PropertySlot slot(object); \
     92    if (!getOwnPropertySlot(object, exec, propertyName, slot)) \
     93        return false; \
     94    if (slot.isGetter()) \
     95        descriptor.setAccessorDescriptor(slot.getterSetter(), slot.attributes()); \
     96    else \
     97        descriptor.setDescriptor(slot.getValue(exec, propertyName), slot.attributes()); \
     98    return true; \
     99}
     100
    88101#endif
  • trunk/Source/JavaScriptCore/runtime/PropertySlot.h

    r154253 r154300  
    6969
    7070    bool isCacheable() const { return m_offset != invalidOffset; }
    71     bool isCacheableValue() const { return isCacheable() && m_propertyType == TypeValue; }
    72     bool isCacheableGetter() const { return isCacheable() && m_propertyType == TypeGetter; }
    73     bool isCacheableCustom() const { return isCacheable() && m_propertyType == TypeCustom; }
     71    bool isValue() const { return m_propertyType == TypeValue; }
     72    bool isGetter() const { return m_propertyType == TypeGetter; }
     73    bool isCustom() const { return m_propertyType == TypeCustom; }
     74    bool isCacheableValue() const { return isCacheable() && isValue(); }
     75    bool isCacheableGetter() const { return isCacheable() && isGetter(); }
     76    bool isCacheableCustom() const { return isCacheable() && isCustom(); }
     77
     78    unsigned attributes() const { return m_attributes; }
    7479
    7580    PropertyOffset cachedOffset() const
     
    7782        ASSERT(isCacheable());
    7883        return m_offset;
     84    }
     85
     86    GetterSetter* getterSetter() const
     87    {
     88        ASSERT(isGetter());
     89        return m_data.getter.getterSetter;
    7990    }
    8091
  • trunk/Source/JavaScriptCore/runtime/RegExpConstructor.cpp

    r154038 r154300  
    159159}
    160160
    161 bool RegExpConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    162 {
    163     return getStaticValueDescriptor<RegExpConstructor, InternalFunction>(exec, ExecState::regExpConstructorTable(exec), jsCast<RegExpConstructor*>(object), propertyName, descriptor);
    164 }
     161GET_OWN_PROPERTY_DESCRIPTOR_IMPL(RegExpConstructor)
    165162
    166163JSValue regExpConstructorDollar1(ExecState* exec, JSValue slotBase, PropertyName)
  • trunk/Source/JavaScriptCore/runtime/RegExpMatchesArray.cpp

    r154038 r154300  
    5757    Base::finishCreation(vm);
    5858}
     59
     60GET_OWN_PROPERTY_DESCRIPTOR_IMPL(RegExpMatchesArray)
    5961
    6062void RegExpMatchesArray::visitChildren(JSCell* cell, SlotVisitor& visitor)
  • trunk/Source/JavaScriptCore/runtime/RegExpMatchesArray.h

    r154038 r154300  
    8585        }
    8686
    87         static bool getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    88         {
    89             RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object);
    90             thisObject->reifyAllPropertiesIfNecessary(exec);
    91             return JSArray::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    92         }
     87        static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&);
    9388
    9489        static void put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue v, PutPropertySlot& slot)
  • trunk/Source/JavaScriptCore/runtime/RegExpObject.cpp

    r154253 r154300  
    101101}
    102102
    103 bool RegExpObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    104 {
    105     if (propertyName == exec->propertyNames().lastIndex) {
    106         RegExpObject* regExp = asRegExpObject(object);
    107         descriptor.setDescriptor(regExp->getLastIndex(), regExp->m_lastIndexIsWritable ? DontDelete | DontEnum : DontDelete | DontEnum | ReadOnly);
    108         return true;
    109     }
    110     return getStaticValueDescriptor<RegExpObject, JSObject>(exec, ExecState::regExpTable(exec), jsCast<RegExpObject*>(object), propertyName, descriptor);
    111 }
     103GET_OWN_PROPERTY_DESCRIPTOR_IMPL(RegExpObject)
    112104
    113105bool RegExpObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
  • trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp

    r154038 r154300  
    7171}
    7272
    73 bool RegExpPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    74 {
    75     return getStaticFunctionDescriptor<RegExpObject>(exec, ExecState::regExpPrototypeTable(exec), jsCast<RegExpPrototype*>(object), propertyName, descriptor);
    76 }
     73GET_OWN_PROPERTY_DESCRIPTOR_IMPL(RegExpPrototype)
    7774
    7875// ------------------------------ Functions ---------------------------
  • trunk/Source/JavaScriptCore/runtime/StringConstructor.cpp

    r153532 r154300  
    6666}
    6767
    68 bool StringConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    69 {
    70     return getStaticFunctionDescriptor<InternalFunction>(exec, ExecState::stringConstructorTable(exec), jsCast<StringConstructor*>(object), propertyName, descriptor);
    71 }
     68GET_OWN_PROPERTY_DESCRIPTOR_IMPL(StringConstructor)
    7269
    7370// ------------------------------ Functions --------------------------------
  • trunk/Source/JavaScriptCore/runtime/StringObject.cpp

    r154038 r154300  
    6161}
    6262
    63 bool StringObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    64 {
    65     StringObject* thisObject = jsCast<StringObject*>(object);
    66     if (thisObject->internalValue()->getStringPropertyDescriptor(exec, propertyName, descriptor))
    67         return true;   
    68     return JSObject::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    69 }
     63GET_OWN_PROPERTY_DESCRIPTOR_IMPL(StringObject)
    7064
    7165void StringObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
  • trunk/Source/WebCore/ChangeLog

    r154299 r154300  
     12013-08-19  Gavin Barraclough  <barraclough@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=119995
     4        Start removing custom implementations of getOwnPropertyDescriptor
     5
     6        Reviewed by Sam Weinig.
     7
     8        This can now typically implemented in terms of getOwnPropertySlot.
     9        Add a macro to PropertyDescriptor to define an implementation of GOPD in terms of GOPS.
     10        Switch over most classes in JSC & the WebCore bindings generator to use this.
     11
     12        * bindings/js/JSCSSStyleDeclarationCustom.cpp:
     13        * bindings/js/JSHTMLAppletElementCustom.cpp:
     14        * bindings/js/JSHTMLEmbedElementCustom.cpp:
     15        * bindings/js/JSHTMLObjectElementCustom.cpp:
     16        * bindings/js/JSHistoryCustom.cpp:
     17        (WebCore::JSHistory::getOwnPropertySlotDelegate):
     18        * bindings/js/JSLocationCustom.cpp:
     19        (WebCore::JSLocation::getOwnPropertySlotDelegate):
     20        * bindings/js/JSWorkerGlobalScopeCustom.cpp:
     21            - Remove getOwnPropertyDescriptorDelegate methods,
     22              Change attributes of cross-frame access properties in JSHistory/JSLocation to prevent properties from being redefined.
     23        * bindings/scripts/CodeGeneratorJS.pm:
     24        (GenerateHeader):
     25        (GenerateImplementation):
     26        (GenerateConstructorHelperMethods):
     27            - Implement getOwnPropertySlot in terms of GET_OWN_PROPERTY_DESCRIPTOR_IMPL.
     28        * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
     29        * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
     30        * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
     31        * bindings/scripts/test/JS/JSTestEventTarget.cpp:
     32        * bindings/scripts/test/JS/JSTestException.cpp:
     33        * bindings/scripts/test/JS/JSTestInterface.cpp:
     34        * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
     35        * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
     36        * bindings/scripts/test/JS/JSTestNode.cpp:
     37        * bindings/scripts/test/JS/JSTestObj.cpp:
     38        * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
     39        * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
     40        * bindings/scripts/test/JS/JSTestTypedefs.cpp:
     41            - Update test expectations.
     42
    1432013-08-19  Benjamin Poulain  <benjamin@webkit.org>
    244
  • trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp

    r154253 r154300  
    337337}
    338338
    339 bool JSCSSStyleDeclaration::getOwnPropertyDescriptorDelegate(JSC::ExecState* exec, JSC::PropertyName propertyIdentifier, JSC::PropertyDescriptor& descriptor)
    340 {
    341     CSSPropertyInfo propertyInfo = cssPropertyIDForJSCSSPropertyName(propertyIdentifier);
    342     if (!propertyInfo.propertyID)
    343         return false;
    344 
    345     JSValue value;
    346     if (propertyInfo.hadPixelOrPosPrefix)
    347         value = cssPropertyGetterPixelOrPosPrefix(exec, this, propertyInfo.propertyID);
    348     else
    349         value = cssPropertyGetter(exec, this, propertyInfo.propertyID);
    350     descriptor.setDescriptor(value, ReadOnly | DontDelete | DontEnum);
    351     return true;
    352 }
    353 
    354339bool JSCSSStyleDeclaration::putDelegate(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot&)
    355340{
  • trunk/Source/WebCore/bindings/js/JSHTMLAppletElementCustom.cpp

    r151736 r154300  
    3939}
    4040
    41 bool JSHTMLAppletElement::getOwnPropertyDescriptorDelegate(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    42 {
    43     return pluginElementCustomGetOwnPropertyDescriptor<JSHTMLAppletElement, Base>(exec, propertyName, descriptor, this);
    44 }
    45 
    4641bool JSHTMLAppletElement::putDelegate(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
    4742{
  • trunk/Source/WebCore/bindings/js/JSHTMLEmbedElementCustom.cpp

    r151736 r154300  
    3939}
    4040
    41 bool JSHTMLEmbedElement::getOwnPropertyDescriptorDelegate(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    42 {
    43     return pluginElementCustomGetOwnPropertyDescriptor<JSHTMLEmbedElement, Base>(exec, propertyName, descriptor, this);
    44 }
    45 
    4641bool JSHTMLEmbedElement::putDelegate(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
    4742{
  • trunk/Source/WebCore/bindings/js/JSHTMLObjectElementCustom.cpp

    r151736 r154300  
    3939}
    4040
    41 bool JSHTMLObjectElement::getOwnPropertyDescriptorDelegate(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    42 {
    43     return pluginElementCustomGetOwnPropertyDescriptor<JSHTMLObjectElement, Base>(exec, propertyName, descriptor, this);
    44 }
    45 
    4641bool JSHTMLObjectElement::putDelegate(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
    4742{
  • trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp

    r154253 r154300  
    6666
    6767    // Check for the few functions that we allow, even when called cross-domain.
     68    // Make these read-only / non-configurable to prevent writes via defineProperty.
    6869    const HashEntry* entry = JSHistoryPrototype::info()->propHashTable(exec)->entry(exec, propertyName);
    6970    if (entry) {
     
    7172        if (entry->attributes() & JSC::Function) {
    7273            if (entry->function() == jsHistoryPrototypeFunctionBack) {
    73                 slot.setCustom(this, entry->attributes(), nonCachingStaticBackFunctionGetter);
     74                slot.setCustom(this, ReadOnly | DontDelete | DontEnum, nonCachingStaticBackFunctionGetter);
    7475                return true;
    7576            } else if (entry->function() == jsHistoryPrototypeFunctionForward) {
    76                 slot.setCustom(this, entry->attributes(), nonCachingStaticForwardFunctionGetter);
     77                slot.setCustom(this, ReadOnly | DontDelete | DontEnum, nonCachingStaticForwardFunctionGetter);
    7778                return true;
    7879            } else if (entry->function() == jsHistoryPrototypeFunctionGo) {
    79                 slot.setCustom(this, entry->attributes(), nonCachingStaticGoFunctionGetter);
     80                slot.setCustom(this, ReadOnly | DontDelete | DontEnum, nonCachingStaticGoFunctionGetter);
    8081                return true;
    8182            }
     
    9192    printErrorMessageForFrame(impl()->frame(), message);
    9293    slot.setUndefined();
    93     return true;
    94 }
    95 
    96 bool JSHistory::getOwnPropertyDescriptorDelegate(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    97 {
    98     if (!impl()->frame()) {
    99         descriptor.setUndefined();
    100         return true;
    101     }
    102 
    103     // Throw out all cross domain access
    104     if (!shouldAllowAccessToFrame(exec, impl()->frame()))
    105         return true;
    106 
    107     // Check for the few functions that we allow, even when called cross-domain.
    108     const HashEntry* entry = JSHistoryPrototype::info()->propHashTable(exec)->entry(exec, propertyName);
    109     if (entry) {
    110         PropertySlot slot(this);
    111         // Allow access to back(), forward() and go() from any frame.
    112         if (entry->attributes() & JSC::Function) {
    113             if (entry->function() == jsHistoryPrototypeFunctionBack) {
    114                 slot.setCustom(this, entry->attributes(), nonCachingStaticBackFunctionGetter);
    115                 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
    116                 return true;
    117             } else if (entry->function() == jsHistoryPrototypeFunctionForward) {
    118                 slot.setCustom(this, entry->attributes(), nonCachingStaticForwardFunctionGetter);
    119                 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
    120                 return true;
    121             } else if (entry->function() == jsHistoryPrototypeFunctionGo) {
    122                 slot.setCustom(this, entry->attributes(), nonCachingStaticGoFunctionGetter);
    123                 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
    124                 return true;
    125             }
    126         }
    127     } else {
    128         // Allow access to toString() cross-domain, but always Object.toString.
    129         if (propertyName == exec->propertyNames().toString) {
    130             PropertySlot slot(this);
    131             slot.setCustom(this, ReadOnly | DontDelete | DontEnum, objectToStringFunctionGetter);
    132             descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
    133             return true;
    134         }
    135     }
    136 
    137     descriptor.setUndefined();
    13894    return true;
    13995}
  • trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp

    r154253 r154300  
    6464
    6565    // Check for the few functions that we allow, even when called cross-domain.
     66    // Make these read-only / non-configurable to prevent writes via defineProperty.
    6667    const HashEntry* entry = JSLocationPrototype::info()->propHashTable(exec)->entry(exec, propertyName);
    6768    if (entry && (entry->attributes() & JSC::Function)) {
    6869        if (entry->function() == jsLocationPrototypeFunctionReplace) {
    69             slot.setCustom(this, entry->attributes(), nonCachingStaticReplaceFunctionGetter);
     70            slot.setCustom(this, ReadOnly | DontDelete | DontEnum, nonCachingStaticReplaceFunctionGetter);
    7071            return true;
    7172        } else if (entry->function() == jsLocationPrototypeFunctionReload) {
    72             slot.setCustom(this, entry->attributes(), nonCachingStaticReloadFunctionGetter);
     73            slot.setCustom(this, ReadOnly | DontDelete | DontEnum, nonCachingStaticReloadFunctionGetter);
    7374            return true;
    7475        } else if (entry->function() == jsLocationPrototypeFunctionAssign) {
    75             slot.setCustom(this, entry->attributes(), nonCachingStaticAssignFunctionGetter);
     76            slot.setCustom(this, ReadOnly | DontDelete | DontEnum, nonCachingStaticAssignFunctionGetter);
    7677            return true;
    7778        }
     
    8485    printErrorMessageForFrame(frame, message);
    8586    slot.setUndefined();
    86     return true;
    87 }
    88 
    89 bool JSLocation::getOwnPropertyDescriptorDelegate(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    90 {
    91     Frame* frame = impl()->frame();
    92     if (!frame) {
    93         descriptor.setUndefined();
    94         return true;
    95     }
    96    
    97     // throw out all cross domain access
    98     if (!shouldAllowAccessToFrame(exec, frame))
    99         return true;
    100    
    101     // Check for the few functions that we allow, even when called cross-domain.
    102     const HashEntry* entry = JSLocationPrototype::info()->propHashTable(exec)->entry(exec, propertyName);
    103     PropertySlot slot(this);
    104     if (entry && (entry->attributes() & JSC::Function)) {
    105         if (entry->function() == jsLocationPrototypeFunctionReplace) {
    106             slot.setCustom(this, entry->attributes(), nonCachingStaticReplaceFunctionGetter);
    107             descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
    108             return true;
    109         } else if (entry->function() == jsLocationPrototypeFunctionReload) {
    110             slot.setCustom(this, entry->attributes(), nonCachingStaticReloadFunctionGetter);
    111             descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
    112             return true;
    113         } else if (entry->function() == jsLocationPrototypeFunctionAssign) {
    114             slot.setCustom(this, entry->attributes(), nonCachingStaticAssignFunctionGetter);
    115             descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
    116             return true;
    117         }
    118     }
    119    
    120     // FIXME: Other implementers of the Window cross-domain scheme (Window, History) allow toString,
    121     // but for now we have decided not to, partly because it seems silly to return "[Object Location]" in
    122     // such cases when normally the string form of Location would be the URL.
    123 
    124     descriptor.setUndefined();
    12587    return true;
    12688}
  • trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp

    r154038 r154300  
    7878}
    7979
    80 bool JSWorkerGlobalScope::getOwnPropertyDescriptorDelegate(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    81 {
    82     // Look for overrides before looking at any of our own properties.
    83     if (JSGlobalObject::getOwnPropertyDescriptor(this, exec, propertyName, descriptor))
    84         return true;
    85     return false;
    86 }
    87 
    8880JSValue JSWorkerGlobalScope::importScripts(ExecState* exec)
    8981{
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r154253 r154300  
    430430
    431431    return @getOwnPropertySlotImpl;
    432 }
    433 
    434 sub GenerateGetOwnPropertyDescriptorBody
    435 {
    436     my ($interface, $interfaceName, $className, $hasAttributes, $inlined) = @_;
    437    
    438     my $namespaceMaybe = ($inlined ? "JSC::" : "");
    439     my $namedGetterFunction = GetNamedGetterFunction($interface);
    440     my $indexedGetterFunction = GetIndexedGetterFunction($interface);
    441     my $hasNumericIndexedGetter = $indexedGetterFunction ? $codeGenerator->IsNumericType($indexedGetterFunction->signature->type) : 0;
    442 
    443    
    444     my @getOwnPropertyDescriptorImpl = ();
    445     if ($interface->extendedAttributes->{"CheckSecurity"}) {
    446         if ($interfaceName eq "DOMWindow") {
    447             $implIncludes{"BindingSecurity.h"} = 1;
    448             push(@implContent, "    if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, jsCast<$className*>(thisObject)->impl()))\n");
    449         } else {
    450             push(@implContent, "    if (!shouldAllowAccessToFrame(exec, thisObject->impl()->frame()))\n");
    451         }
    452         push(@implContent, "        return false;\n");
    453     }
    454    
    455     if ($interfaceName eq "NamedNodeMap" or $interfaceName =~ /^HTML\w*Collection$/) {
    456         push(@getOwnPropertyDescriptorImpl, "    ${namespaceMaybe}JSValue proto = thisObject->prototype();\n");
    457         push(@getOwnPropertyDescriptorImpl, "    if (proto.isObject() && jsCast<${namespaceMaybe}JSObject*>(asObject(proto))->hasProperty(exec, propertyName))\n");
    458         push(@getOwnPropertyDescriptorImpl, "        return false;\n\n");
    459     }
    460    
    461     my $manualLookupGetterGeneration = sub {
    462         my $requiresManualLookup = ($indexedGetterFunction && !$hasNumericIndexedGetter) || $namedGetterFunction;
    463         if ($requiresManualLookup) {
    464             push(@getOwnPropertyDescriptorImpl, "    const ${namespaceMaybe}HashEntry* entry = ${className}Table.entry(exec, propertyName);\n");
    465             push(@getOwnPropertyDescriptorImpl, "    if (entry) {\n");
    466             push(@getOwnPropertyDescriptorImpl, "        PropertySlot slot(thisObject);\n");
    467             push(@getOwnPropertyDescriptorImpl, "        slot.setCustom(thisObject, entry->attributes(), entry->propertyGetter());\n");
    468             push(@getOwnPropertyDescriptorImpl, "        descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());\n");
    469             push(@getOwnPropertyDescriptorImpl, "        return true;\n");
    470             push(@getOwnPropertyDescriptorImpl, "    }\n");
    471         }
    472     };
    473 
    474     if (!$interface->extendedAttributes->{"CustomNamedGetter"}) {
    475         &$manualLookupGetterGeneration();
    476     }
    477 
    478     if ($indexedGetterFunction) {
    479         push(@getOwnPropertyDescriptorImpl, "    unsigned index = propertyName.asIndex();\n");
    480         push(@getOwnPropertyDescriptorImpl, "    if (index != PropertyName::NotAnIndex && index < static_cast<$interfaceName*>(thisObject->impl())->length()) {\n");
    481         # Assume that if there's a setter, the index will be writable
    482         if ($interface->extendedAttributes->{"CustomIndexedSetter"}) {
    483             push(@getOwnPropertyDescriptorImpl, "        unsigned attributes = ${namespaceMaybe}DontDelete;\n");
    484         } else {
    485             push(@getOwnPropertyDescriptorImpl, "        unsigned attributes = ${namespaceMaybe}DontDelete | ${namespaceMaybe}ReadOnly;\n");
    486         }
    487         if ($hasNumericIndexedGetter) {
    488             push(@getOwnPropertyDescriptorImpl, "        descriptor.setDescriptor(thisObject->getByIndex(exec, index), attributes);\n");
    489         } else {
    490             push(@getOwnPropertyDescriptorImpl, "        ${namespaceMaybe}PropertySlot slot(thisObject);\n");
    491             push(@getOwnPropertyDescriptorImpl, "        slot.setCustomIndex(thisObject, attributes, index, indexGetter);\n");
    492             push(@getOwnPropertyDescriptorImpl, "        descriptor.setDescriptor(slot.getValue(exec, propertyName), attributes);\n");
    493         }
    494         push(@getOwnPropertyDescriptorImpl, "        return true;\n");
    495         push(@getOwnPropertyDescriptorImpl, "    }\n");
    496     }
    497 
    498     if ($namedGetterFunction || $interface->extendedAttributes->{"CustomNamedGetter"}) {
    499         push(@getOwnPropertyDescriptorImpl, "    if (canGetItemsForName(exec, static_cast<$interfaceName*>(thisObject->impl()), propertyName)) {\n");
    500         push(@getOwnPropertyDescriptorImpl, "        ${namespaceMaybe}PropertySlot slot(thisObject);\n");
    501         push(@getOwnPropertyDescriptorImpl, "        slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nameGetter);\n");
    502         push(@getOwnPropertyDescriptorImpl, "        descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum);\n");
    503         push(@getOwnPropertyDescriptorImpl, "        return true;\n");
    504         push(@getOwnPropertyDescriptorImpl, "    }\n");
    505         if ($inlined) {
    506             $headerIncludes{"wtf/text/AtomicString.h"} = 1;
    507         } else {
    508             $implIncludes{"wtf/text/AtomicString.h"} = 1;
    509         }
    510     }
    511 
    512     if ($interface->extendedAttributes->{"CustomNamedGetter"}) {
    513         &$manualLookupGetterGeneration();
    514     }
    515 
    516     if ($interface->extendedAttributes->{"JSCustomGetOwnPropertySlotAndDescriptor"}) {
    517         push(@getOwnPropertyDescriptorImpl, "    if (thisObject->getOwnPropertyDescriptorDelegate(exec, propertyName, descriptor))\n");
    518         push(@getOwnPropertyDescriptorImpl, "        return true;\n");
    519     }
    520 
    521     if ($hasAttributes) {
    522         if ($inlined) {
    523             die "Cannot inline if NoStaticTables is set." if ($interface->extendedAttributes->{"JSNoStaticTables"});
    524             push(@getOwnPropertyDescriptorImpl, "    return ${namespaceMaybe}getStaticValueDescriptor<$className, Base>(exec, info()->staticPropHashTable, thisObject, propertyName, descriptor);\n");
    525         } else {
    526             push(@getOwnPropertyDescriptorImpl, "    return ${namespaceMaybe}getStaticValueDescriptor<$className, Base>(exec, " . hashTableAccessor($interface->extendedAttributes->{"JSNoStaticTables"}, $className) . ", thisObject, propertyName, descriptor);\n");
    527         }
    528     } else {
    529         push(@getOwnPropertyDescriptorImpl, "    return Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);\n");
    530     }
    531    
    532     return @getOwnPropertyDescriptorImpl;
    533432}
    534433
     
    791690        push(@headerContent, "    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);\n") if ($hasComplexGetter);
    792691        push(@headerContent, "    bool getOwnPropertySlotDelegate(JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);\n") if $interface->extendedAttributes->{"JSCustomGetOwnPropertySlotAndDescriptor"};
    793         push(@headerContent, "    bool getOwnPropertyDescriptorDelegate(JSC::ExecState*, JSC::PropertyName, JSC::PropertyDescriptor&);\n") if $interface->extendedAttributes->{"JSCustomGetOwnPropertySlotAndDescriptor"};
    794692        $structureFlags{"JSC::OverridesGetOwnPropertySlot"} = 1;
    795693        $structureFlags{"JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero"} = 1;
     
    1008906        push(@headerContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
    1009907        push(@headerContent, GenerateGetOwnPropertySlotBody($interface, $interfaceName, $className, $numAttributes > 0, 1));
    1010         push(@headerContent, "}\n\n");
    1011         push(@headerContent, "ALWAYS_INLINE bool ${className}::getOwnPropertyDescriptor(JSC::JSObject* object, JSC::ExecState* exec, JSC::PropertyName propertyName, JSC::PropertyDescriptor& descriptor)\n");
    1012         push(@headerContent, "{\n");
    1013         push(@headerContent, "    ${className}* thisObject = JSC::jsCast<${className}*>(object);\n");
    1014         push(@headerContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
    1015         push(@headerContent, GenerateGetOwnPropertyDescriptorBody($interface, $interfaceName, $className, $numAttributes > 0, 1));
    1016908        push(@headerContent, "}\n\n");
    1017909    }
     
    17671659        push(@implContent, "}\n\n");
    17681660
    1769         push(@implContent, "bool ${className}Prototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)\n");
    1770         push(@implContent, "{\n");
    1771         push(@implContent, "    ${className}Prototype* thisObject = jsCast<${className}Prototype*>(object);\n");
    1772 
    1773         if ($numConstants eq 0 && $numFunctions eq 0) {
    1774             push(@implContent, "    return Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);\n");       
    1775         } elsif ($numConstants eq 0) {
    1776             push(@implContent, "    return getStaticFunctionDescriptor<JSObject>(exec, " . prototypeHashTableAccessor($interface->extendedAttributes->{"JSNoStaticTables"}, $className) . ", thisObject, propertyName, descriptor);\n");
    1777         } elsif ($numFunctions eq 0) {
    1778             push(@implContent, "    return getStaticValueDescriptor<${className}Prototype, JSObject>(exec, " . prototypeHashTableAccessor($interface->extendedAttributes->{"JSNoStaticTables"}, $className) . ", thisObject, propertyName, descriptor);\n");
    1779         } else {
    1780             push(@implContent, "    return getStaticPropertyDescriptor<${className}Prototype, JSObject>(exec, " . prototypeHashTableAccessor($interface->extendedAttributes->{"JSNoStaticTables"}, $className) . ", thisObject, propertyName, descriptor);\n");
    1781         }
    1782         push(@implContent, "}\n\n");
     1661        push(@implContent, "GET_OWN_PROPERTY_DESCRIPTOR_IMPL(${className}Prototype)\n\n");
    17831662    }
    17841663
     
    18971776    # Attributes
    18981777    if ($hasGetter) {
    1899         if (!$interface->extendedAttributes->{"JSInlineGetOwnPropertySlot"} && !$interface->extendedAttributes->{"CustomGetOwnPropertySlot"}) {
    1900             push(@implContent, "bool ${className}::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)\n");
    1901             push(@implContent, "{\n");
    1902             push(@implContent, "    ${className}* thisObject = jsCast<${className}*>(object);\n");
    1903             push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
    1904             push(@implContent, GenerateGetOwnPropertySlotBody($interface, $interfaceName, $className, $numAttributes > 0, 0));
    1905             push(@implContent, "}\n\n");
    1906             push(@implContent, "bool ${className}::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)\n");
    1907             push(@implContent, "{\n");
    1908             push(@implContent, "    ${className}* thisObject = jsCast<${className}*>(object);\n");
    1909             push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
    1910             push(@implContent, GenerateGetOwnPropertyDescriptorBody($interface, $interfaceName, $className, $numAttributes > 0, 0));
    1911             push(@implContent, "}\n\n");
     1778        if (!$interface->extendedAttributes->{"CustomGetOwnPropertySlot"}) {
     1779            if (!$interface->extendedAttributes->{"JSInlineGetOwnPropertySlot"}) {
     1780                push(@implContent, "bool ${className}::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)\n");
     1781                push(@implContent, "{\n");
     1782                push(@implContent, "    ${className}* thisObject = jsCast<${className}*>(object);\n");
     1783                push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
     1784                push(@implContent, GenerateGetOwnPropertySlotBody($interface, $interfaceName, $className, $numAttributes > 0, 0));
     1785                push(@implContent, "}\n\n");
     1786            }
     1787            push(@implContent, "GET_OWN_PROPERTY_DESCRIPTOR_IMPL(${className})\n\n");
    19121788        }
    19131789
     
    42394115        push(@$outputArray, "}\n\n");
    42404116
    4241         push(@$outputArray, "bool ${constructorClassName}::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)\n");
    4242         push(@$outputArray, "{\n");
    4243         push(@$outputArray, "    return getStatic${kind}Descriptor<${constructorClassName}, JSDOMWrapper>(exec, " . constructorHashTableAccessor($interface->extendedAttributes->{"JSNoStaticTables"}, $constructorClassName) . ", jsCast<${constructorClassName}*>(object), propertyName, descriptor);\n");
    4244         push(@$outputArray, "}\n\n");
     4117        push(@$outputArray, "GET_OWN_PROPERTY_DESCRIPTOR_IMPL(${constructorClassName})\n\n");
    42454118    }
    42464119
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp

    r154038 r154300  
    7272}
    7373
    74 bool JSTestActiveDOMObjectConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    75 {
    76     return getStaticValueDescriptor<JSTestActiveDOMObjectConstructor, JSDOMWrapper>(exec, &JSTestActiveDOMObjectConstructorTable, jsCast<JSTestActiveDOMObjectConstructor*>(object), propertyName, descriptor);
    77 }
     74GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestActiveDOMObjectConstructor)
    7875
    7976/* Hash table for prototype */
     
    10097}
    10198
    102 bool JSTestActiveDOMObjectPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    103 {
    104     JSTestActiveDOMObjectPrototype* thisObject = jsCast<JSTestActiveDOMObjectPrototype*>(object);
    105     return getStaticFunctionDescriptor<JSObject>(exec, &JSTestActiveDOMObjectPrototypeTable, thisObject, propertyName, descriptor);
    106 }
     99GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestActiveDOMObjectPrototype)
    107100
    108101const ClassInfo JSTestActiveDOMObject::s_info = { "TestActiveDOMObject", &Base::s_info, &JSTestActiveDOMObjectTable, 0 , CREATE_METHOD_TABLE(JSTestActiveDOMObject) };
     
    143136}
    144137
    145 bool JSTestActiveDOMObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    146 {
    147     JSTestActiveDOMObject* thisObject = jsCast<JSTestActiveDOMObject*>(object);
    148     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    149     if (!shouldAllowAccessToFrame(exec, thisObject->impl()->frame()))
    150         return false;
    151     return getStaticValueDescriptor<JSTestActiveDOMObject, Base>(exec, &JSTestActiveDOMObjectTable, thisObject, propertyName, descriptor);
    152 }
     138GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestActiveDOMObject)
    153139
    154140JSValue jsTestActiveDOMObjectExcitingAttr(ExecState* exec, JSValue slotBase, PropertyName)
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp

    r154253 r154300  
    7070}
    7171
    72 bool JSTestCustomNamedGetterConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    73 {
    74     return getStaticValueDescriptor<JSTestCustomNamedGetterConstructor, JSDOMWrapper>(exec, &JSTestCustomNamedGetterConstructorTable, jsCast<JSTestCustomNamedGetterConstructor*>(object), propertyName, descriptor);
    75 }
     72GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestCustomNamedGetterConstructor)
    7673
    7774/* Hash table for prototype */
     
    9794}
    9895
    99 bool JSTestCustomNamedGetterPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    100 {
    101     JSTestCustomNamedGetterPrototype* thisObject = jsCast<JSTestCustomNamedGetterPrototype*>(object);
    102     return getStaticFunctionDescriptor<JSObject>(exec, &JSTestCustomNamedGetterPrototypeTable, thisObject, propertyName, descriptor);
    103 }
     96GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestCustomNamedGetterPrototype)
    10497
    10598const ClassInfo JSTestCustomNamedGetter::s_info = { "TestCustomNamedGetter", &Base::s_info, &JSTestCustomNamedGetterTable, 0 , CREATE_METHOD_TABLE(JSTestCustomNamedGetter) };
     
    144137}
    145138
    146 bool JSTestCustomNamedGetter::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    147 {
    148     JSTestCustomNamedGetter* thisObject = jsCast<JSTestCustomNamedGetter*>(object);
    149     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    150     if (canGetItemsForName(exec, static_cast<TestCustomNamedGetter*>(thisObject->impl()), propertyName)) {
    151         PropertySlot slot(thisObject);
    152         slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nameGetter);
    153         descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum);
    154         return true;
    155     }
    156     return getStaticValueDescriptor<JSTestCustomNamedGetter, Base>(exec, &JSTestCustomNamedGetterTable, thisObject, propertyName, descriptor);
    157 }
     139GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestCustomNamedGetter)
    158140
    159141bool JSTestCustomNamedGetter::getOwnPropertySlotByIndex(JSObject* object, ExecState* exec, unsigned index, PropertySlot& slot)
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp

    r154038 r154300  
    110110}
    111111
    112 bool JSTestEventConstructorConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    113 {
    114     return getStaticValueDescriptor<JSTestEventConstructorConstructor, JSDOMWrapper>(exec, &JSTestEventConstructorConstructorTable, jsCast<JSTestEventConstructorConstructor*>(object), propertyName, descriptor);
    115 }
     112GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestEventConstructorConstructor)
    116113
    117114ConstructType JSTestEventConstructorConstructor::getConstructData(JSCell*, ConstructData& constructData)
     
    173170}
    174171
    175 bool JSTestEventConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    176 {
    177     JSTestEventConstructor* thisObject = jsCast<JSTestEventConstructor*>(object);
    178     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    179     return getStaticValueDescriptor<JSTestEventConstructor, Base>(exec, &JSTestEventConstructorTable, thisObject, propertyName, descriptor);
    180 }
     172GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestEventConstructor)
    181173
    182174JSValue jsTestEventConstructorAttr1(ExecState* exec, JSValue slotBase, PropertyName)
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp

    r154253 r154300  
    7676}
    7777
    78 bool JSTestEventTargetConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    79 {
    80     return getStaticValueDescriptor<JSTestEventTargetConstructor, JSDOMWrapper>(exec, &JSTestEventTargetConstructorTable, jsCast<JSTestEventTargetConstructor*>(object), propertyName, descriptor);
    81 }
     78GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestEventTargetConstructor)
    8279
    8380/* Hash table for prototype */
     
    106103}
    107104
    108 bool JSTestEventTargetPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    109 {
    110     JSTestEventTargetPrototype* thisObject = jsCast<JSTestEventTargetPrototype*>(object);
    111     return getStaticFunctionDescriptor<JSObject>(exec, &JSTestEventTargetPrototypeTable, thisObject, propertyName, descriptor);
    112 }
     105GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestEventTargetPrototype)
    113106
    114107const ClassInfo JSTestEventTarget::s_info = { "TestEventTarget", &Base::s_info, &JSTestEventTargetTable, 0 , CREATE_METHOD_TABLE(JSTestEventTarget) };
     
    164157}
    165158
    166 bool JSTestEventTarget::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    167 {
    168     JSTestEventTarget* thisObject = jsCast<JSTestEventTarget*>(object);
    169     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    170     const HashEntry* entry = JSTestEventTargetTable.entry(exec, propertyName);
    171     if (entry) {
    172         PropertySlot slot(thisObject);
    173         slot.setCustom(thisObject, entry->attributes(), entry->propertyGetter());
    174         descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
    175         return true;
    176     }
    177     unsigned index = propertyName.asIndex();
    178     if (index != PropertyName::NotAnIndex && index < static_cast<TestEventTarget*>(thisObject->impl())->length()) {
    179         unsigned attributes = DontDelete | ReadOnly;
    180         PropertySlot slot(thisObject);
    181         slot.setCustomIndex(thisObject, attributes, index, indexGetter);
    182         descriptor.setDescriptor(slot.getValue(exec, propertyName), attributes);
    183         return true;
    184     }
    185     if (canGetItemsForName(exec, static_cast<TestEventTarget*>(thisObject->impl()), propertyName)) {
    186         PropertySlot slot(thisObject);
    187         slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nameGetter);
    188         descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum);
    189         return true;
    190     }
    191     return getStaticValueDescriptor<JSTestEventTarget, Base>(exec, &JSTestEventTargetTable, thisObject, propertyName, descriptor);
    192 }
     159GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestEventTarget)
    193160
    194161bool JSTestEventTarget::getOwnPropertySlotByIndex(JSObject* object, ExecState* exec, unsigned index, PropertySlot& slot)
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp

    r154038 r154300  
    6969}
    7070
    71 bool JSTestExceptionConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    72 {
    73     return getStaticValueDescriptor<JSTestExceptionConstructor, JSDOMWrapper>(exec, &JSTestExceptionConstructorTable, jsCast<JSTestExceptionConstructor*>(object), propertyName, descriptor);
    74 }
     71GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestExceptionConstructor)
    7572
    7673/* Hash table for prototype */
     
    126123}
    127124
    128 bool JSTestException::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    129 {
    130     JSTestException* thisObject = jsCast<JSTestException*>(object);
    131     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    132     return getStaticValueDescriptor<JSTestException, Base>(exec, &JSTestExceptionTable, thisObject, propertyName, descriptor);
    133 }
     125GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestException)
    134126
    135127JSValue jsTestExceptionName(ExecState* exec, JSValue slotBase, PropertyName)
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp

    r154038 r154300  
    176176}
    177177
    178 bool JSTestInterfaceConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    179 {
    180     return getStaticPropertyDescriptor<JSTestInterfaceConstructor, JSDOMWrapper>(exec, &JSTestInterfaceConstructorTable, jsCast<JSTestInterfaceConstructor*>(object), propertyName, descriptor);
    181 }
     178GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestInterfaceConstructor)
    182179
    183180#if ENABLE(TEST_INTERFACE)
     
    240237}
    241238
    242 bool JSTestInterfacePrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    243 {
    244     JSTestInterfacePrototype* thisObject = jsCast<JSTestInterfacePrototype*>(object);
    245     return getStaticPropertyDescriptor<JSTestInterfacePrototype, JSObject>(exec, &JSTestInterfacePrototypeTable, thisObject, propertyName, descriptor);
    246 }
     239GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestInterfacePrototype)
    247240
    248241const ClassInfo JSTestInterface::s_info = { "TestInterface", &Base::s_info, &JSTestInterfaceTable, 0 , CREATE_METHOD_TABLE(JSTestInterface) };
     
    283276}
    284277
    285 bool JSTestInterface::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    286 {
    287     JSTestInterface* thisObject = jsCast<JSTestInterface*>(object);
    288     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    289     return getStaticValueDescriptor<JSTestInterface, Base>(exec, &JSTestInterfaceTable, thisObject, propertyName, descriptor);
    290 }
     278GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestInterface)
    291279
    292280#if ENABLE(Condition22) || ENABLE(Condition23)
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp

    r154087 r154300  
    7070}
    7171
    72 bool JSTestMediaQueryListListenerConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    73 {
    74     return getStaticValueDescriptor<JSTestMediaQueryListListenerConstructor, JSDOMWrapper>(exec, &JSTestMediaQueryListListenerConstructorTable, jsCast<JSTestMediaQueryListListenerConstructor*>(object), propertyName, descriptor);
    75 }
     72GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestMediaQueryListListenerConstructor)
    7673
    7774/* Hash table for prototype */
     
    9794}
    9895
    99 bool JSTestMediaQueryListListenerPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    100 {
    101     JSTestMediaQueryListListenerPrototype* thisObject = jsCast<JSTestMediaQueryListListenerPrototype*>(object);
    102     return getStaticFunctionDescriptor<JSObject>(exec, &JSTestMediaQueryListListenerPrototypeTable, thisObject, propertyName, descriptor);
    103 }
     96GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestMediaQueryListListenerPrototype)
    10497
    10598const ClassInfo JSTestMediaQueryListListener::s_info = { "TestMediaQueryListListener", &Base::s_info, &JSTestMediaQueryListListenerTable, 0 , CREATE_METHOD_TABLE(JSTestMediaQueryListListener) };
     
    140133}
    141134
    142 bool JSTestMediaQueryListListener::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    143 {
    144     JSTestMediaQueryListListener* thisObject = jsCast<JSTestMediaQueryListListener*>(object);
    145     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    146     return getStaticValueDescriptor<JSTestMediaQueryListListener, Base>(exec, &JSTestMediaQueryListListenerTable, thisObject, propertyName, descriptor);
    147 }
     135GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestMediaQueryListListener)
    148136
    149137JSValue jsTestMediaQueryListListenerConstructor(ExecState* exec, JSValue slotBase, PropertyName)
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp

    r154038 r154300  
    6969}
    7070
    71 bool JSTestNamedConstructorConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    72 {
    73     return getStaticValueDescriptor<JSTestNamedConstructorConstructor, JSDOMWrapper>(exec, &JSTestNamedConstructorConstructorTable, jsCast<JSTestNamedConstructorConstructor*>(object), propertyName, descriptor);
    74 }
     71GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestNamedConstructorConstructor)
    7572
    7673EncodedJSValue JSC_HOST_CALL JSTestNamedConstructorNamedConstructor::constructJSTestNamedConstructor(ExecState* exec)
     
    170167}
    171168
    172 bool JSTestNamedConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    173 {
    174     JSTestNamedConstructor* thisObject = jsCast<JSTestNamedConstructor*>(object);
    175     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    176     return getStaticValueDescriptor<JSTestNamedConstructor, Base>(exec, &JSTestNamedConstructorTable, thisObject, propertyName, descriptor);
    177 }
     169GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestNamedConstructor)
    178170
    179171JSValue jsTestNamedConstructorConstructor(ExecState* exec, JSValue slotBase, PropertyName)
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp

    r154038 r154300  
    7676}
    7777
    78 bool JSTestNodeConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    79 {
    80     return getStaticValueDescriptor<JSTestNodeConstructor, JSDOMWrapper>(exec, &JSTestNodeConstructorTable, jsCast<JSTestNodeConstructor*>(object), propertyName, descriptor);
    81 }
     78GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestNodeConstructor)
    8279
    8380ConstructType JSTestNodeConstructor::getConstructData(JSCell*, ConstructData& constructData)
     
    127124}
    128125
    129 bool JSTestNode::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    130 {
    131     JSTestNode* thisObject = jsCast<JSTestNode*>(object);
    132     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    133     return getStaticValueDescriptor<JSTestNode, Base>(exec, &JSTestNodeTable, thisObject, propertyName, descriptor);
    134 }
     126GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestNode)
    135127
    136128JSValue jsTestNodeConstructor(ExecState* exec, JSValue slotBase, PropertyName)
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r154219 r154300  
    241241}
    242242
    243 bool JSTestObjConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    244 {
    245     return getStaticPropertyDescriptor<JSTestObjConstructor, JSDOMWrapper>(exec, &JSTestObjConstructorTable, jsCast<JSTestObjConstructor*>(object), propertyName, descriptor);
    246 }
     243GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestObjConstructor)
    247244
    248245ConstructType JSTestObjConstructor::getConstructData(JSCell*, ConstructData& constructData)
     
    353350}
    354351
    355 bool JSTestObjPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    356 {
    357     JSTestObjPrototype* thisObject = jsCast<JSTestObjPrototype*>(object);
    358     return getStaticPropertyDescriptor<JSTestObjPrototype, JSObject>(exec, &JSTestObjPrototypeTable, thisObject, propertyName, descriptor);
    359 }
     352GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestObjPrototype)
    360353
    361354const ClassInfo JSTestObj::s_info = { "TestObject", &Base::s_info, &JSTestObjTable, 0 , CREATE_METHOD_TABLE(JSTestObj) };
     
    396389}
    397390
    398 bool JSTestObj::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    399 {
    400     JSTestObj* thisObject = jsCast<JSTestObj*>(object);
    401     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    402     return getStaticValueDescriptor<JSTestObj, Base>(exec, &JSTestObjTable, thisObject, propertyName, descriptor);
    403 }
     391GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestObj)
    404392
    405393JSValue jsTestObjReadOnlyLongAttr(ExecState* exec, JSValue slotBase, PropertyName)
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp

    r154131 r154300  
    135135}
    136136
    137 bool JSTestOverloadedConstructorsConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    138 {
    139     return getStaticValueDescriptor<JSTestOverloadedConstructorsConstructor, JSDOMWrapper>(exec, &JSTestOverloadedConstructorsConstructorTable, jsCast<JSTestOverloadedConstructorsConstructor*>(object), propertyName, descriptor);
    140 }
     137GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestOverloadedConstructorsConstructor)
    141138
    142139ConstructType JSTestOverloadedConstructorsConstructor::getConstructData(JSCell*, ConstructData& constructData)
     
    198195}
    199196
    200 bool JSTestOverloadedConstructors::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    201 {
    202     JSTestOverloadedConstructors* thisObject = jsCast<JSTestOverloadedConstructors*>(object);
    203     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    204     return getStaticValueDescriptor<JSTestOverloadedConstructors, Base>(exec, &JSTestOverloadedConstructorsTable, thisObject, propertyName, descriptor);
    205 }
     197GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestOverloadedConstructors)
    206198
    207199JSValue jsTestOverloadedConstructorsConstructor(ExecState* exec, JSValue slotBase, PropertyName)
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp

    r154038 r154300  
    7878}
    7979
    80 bool JSTestSerializedScriptValueInterfaceConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    81 {
    82     return getStaticValueDescriptor<JSTestSerializedScriptValueInterfaceConstructor, JSDOMWrapper>(exec, &JSTestSerializedScriptValueInterfaceConstructorTable, jsCast<JSTestSerializedScriptValueInterfaceConstructor*>(object), propertyName, descriptor);
    83 }
     80GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestSerializedScriptValueInterfaceConstructor)
    8481
    8582/* Hash table for prototype */
     
    135132}
    136133
    137 bool JSTestSerializedScriptValueInterface::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    138 {
    139     JSTestSerializedScriptValueInterface* thisObject = jsCast<JSTestSerializedScriptValueInterface*>(object);
    140     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    141     return getStaticValueDescriptor<JSTestSerializedScriptValueInterface, Base>(exec, &JSTestSerializedScriptValueInterfaceTable, thisObject, propertyName, descriptor);
    142 }
     134GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestSerializedScriptValueInterface)
    143135
    144136JSValue jsTestSerializedScriptValueInterfaceValue(ExecState* exec, JSValue slotBase, PropertyName)
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp

    r154131 r154300  
    102102}
    103103
    104 bool JSTestTypedefsConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    105 {
    106     return getStaticValueDescriptor<JSTestTypedefsConstructor, JSDOMWrapper>(exec, &JSTestTypedefsConstructorTable, jsCast<JSTestTypedefsConstructor*>(object), propertyName, descriptor);
    107 }
     104GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestTypedefsConstructor)
    108105
    109106ConstructType JSTestTypedefsConstructor::getConstructData(JSCell*, ConstructData& constructData)
     
    143140}
    144141
    145 bool JSTestTypedefsPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    146 {
    147     JSTestTypedefsPrototype* thisObject = jsCast<JSTestTypedefsPrototype*>(object);
    148     return getStaticFunctionDescriptor<JSObject>(exec, &JSTestTypedefsPrototypeTable, thisObject, propertyName, descriptor);
    149 }
     142GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestTypedefsPrototype)
    150143
    151144const ClassInfo JSTestTypedefs::s_info = { "TestTypedefs", &Base::s_info, &JSTestTypedefsTable, 0 , CREATE_METHOD_TABLE(JSTestTypedefs) };
     
    186179}
    187180
    188 bool JSTestTypedefs::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    189 {
    190     JSTestTypedefs* thisObject = jsCast<JSTestTypedefs*>(object);
    191     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    192     return getStaticValueDescriptor<JSTestTypedefs, Base>(exec, &JSTestTypedefsTable, thisObject, propertyName, descriptor);
    193 }
     181GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSTestTypedefs)
    194182
    195183JSValue jsTestTypedefsUnsignedLongLongAttr(ExecState* exec, JSValue slotBase, PropertyName)
  • trunk/Source/WebCore/bridge/objc/objc_runtime.mm

    r154038 r154300  
    216216}
    217217
    218 bool ObjcFallbackObjectImp::getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor& descriptor)
    219 {
    220     // keep the prototype from getting called instead of just returning false
    221     descriptor.setUndefined();
    222     return true;
    223 }
     218GET_OWN_PROPERTY_DESCRIPTOR_IMPL(ObjcFallbackObjectImp)
    224219
    225220void ObjcFallbackObjectImp::put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&)
  • trunk/Source/WebCore/bridge/runtime_array.cpp

    r154253 r154300  
    104104}
    105105
    106 bool RuntimeArray::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    107 {
    108     RuntimeArray* thisObject = jsCast<RuntimeArray*>(object);
    109     if (propertyName == exec->propertyNames().length) {
    110         PropertySlot slot(thisObject);
    111         slot.setCustom(thisObject, DontDelete | ReadOnly | DontEnum, lengthGetter);
    112         descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum);
    113         return true;
    114     }
    115    
    116     unsigned index = propertyName.asIndex();
    117     if (index < thisObject->getLength()) {
    118         ASSERT(index != PropertyName::NotAnIndex);
    119         PropertySlot slot(thisObject);
    120         slot.setCustomIndex(thisObject, DontDelete | DontEnum, index, indexGetter);
    121         descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | DontEnum);
    122         return true;
    123     }
    124    
    125     return JSObject::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    126 }
     106GET_OWN_PROPERTY_DESCRIPTOR_IMPL(RuntimeArray)
    127107
    128108bool RuntimeArray::getOwnPropertySlotByIndex(JSObject* object, ExecState *exec, unsigned index, PropertySlot& slot)
  • trunk/Source/WebCore/bridge/runtime_method.cpp

    r154253 r154300  
    7373}
    7474
    75 bool RuntimeMethod::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor &descriptor)
    76 {
    77     RuntimeMethod* thisObject = jsCast<RuntimeMethod*>(object);
    78     if (propertyName == exec->propertyNames().length) {
    79         PropertySlot slot(thisObject);
    80         slot.setCustom(thisObject, DontDelete | ReadOnly | DontEnum, lengthGetter);
    81         descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum);
    82         return true;
    83     }
    84    
    85     return InternalFunction::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    86 }
     75GET_OWN_PROPERTY_DESCRIPTOR_IMPL(RuntimeMethod)
    8776
    8877static EncodedJSValue JSC_HOST_CALL callRuntimeMethod(ExecState* exec)
  • trunk/Source/WebCore/bridge/runtime_object.cpp

    r154253 r154300  
    162162}
    163163
    164 bool RuntimeObject::getOwnPropertyDescriptor(JSObject* object, ExecState *exec, PropertyName propertyName, PropertyDescriptor& descriptor)
    165 {
    166     RuntimeObject* thisObject = jsCast<RuntimeObject*>(object);
    167     if (!thisObject->m_instance) {
    168         throwInvalidAccessError(exec);
    169         return false;
    170     }
    171    
    172     RefPtr<Instance> instance = thisObject->m_instance;
    173     instance->begin();
    174    
    175     Class *aClass = instance->getClass();
    176    
    177     if (aClass) {
    178         // See if the instance has a field with the specified name.
    179         Field *aField = aClass->fieldNamed(propertyName, instance.get());
    180         if (aField) {
    181             PropertySlot slot(thisObject);
    182             slot.setCustom(thisObject, DontDelete, fieldGetter);
    183             instance->end();
    184             descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete);
    185             return true;
    186         } else {
    187             // Now check if a method with specified name exists, if so return a function object for
    188             // that method.
    189             if (aClass->methodNamed(propertyName, instance.get())) {
    190                 PropertySlot slot(thisObject);
    191                 slot.setCustom(thisObject, DontDelete | ReadOnly, methodGetter);
    192                 instance->end();
    193                 descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly);
    194                 return true;
    195             }
    196         }
    197        
    198         // Try a fallback object.
    199         if (!aClass->fallbackObject(exec, instance.get(), propertyName).isUndefined()) {
    200             PropertySlot slot(thisObject);
    201             slot.setCustom(thisObject, DontDelete | ReadOnly | DontEnum, fallbackObjectGetter);
    202             instance->end();
    203             descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly | DontEnum);
    204             return true;
    205         }
    206     }
    207    
    208     instance->end();
    209    
    210     return instance->getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
    211 }
     164GET_OWN_PROPERTY_DESCRIPTOR_IMPL(RuntimeObject)
    212165
    213166void RuntimeObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
Note: See TracChangeset for help on using the changeset viewer.