Changeset 196648 in webkit


Ignore:
Timestamp:
Feb 16, 2016 12:23:02 PM (8 years ago)
Author:
Chris Dumez
Message:

[Web IDL] Operations should be on the instance for global objects or if [Unforgeable]
https://bugs.webkit.org/show_bug.cgi?id=154120
<rdar://problem/24613231>

Reviewed by Gavin Barraclough.

LayoutTests/imported/w3c:

Rebaseline now that more checks are passing.

  • web-platform-tests/html/dom/interfaces-expected.txt:

Source/JavaScriptCore:

Have putEntry() take a thisValue parameter in addition to the base,
instead of relying on PropertySlot::thisValue() because this did not
always do the right thing. In particular, when JSDOMWindow::put() was
called to set a function, it would end up setting the new value on the
JSDOMWindowShell instead of the actual JSDOMWindow.
JSDOMWindow::getOwnPropertySlot() would then not be able to find it.
Therefore the following would fail:
$ window.open = "test"
$ console.log(window.open) prints the native function instead of "test"

  • runtime/JSObject.cpp:

(JSC::JSObject::putInlineSlow):

  • runtime/Lookup.h:

(JSC::putEntry):
(JSC::lookupPut):

Source/WebCore:

Operations should be on the instance for global objects or if
[Unforgeable] as per the Web IDL specification:

This patch implements this behavior in order to align
with the specification and other browsers.

No new tests, already covered by existing tests.

  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
Update function names now that they have "Instance" in their
name instead of "Prototype".

(WebCore::JSDOMWindow::getOwnPropertySlot):

  • Update function names now that they have "Instance" in their name instead of "Prototype".
  • Move the functions hard-coding *before* the static table check now that these functions are in the static table to maintain the previous behavior.
  • bindings/js/JSLocationCustom.cpp:

(WebCore::JSLocation::getOwnPropertySlotDelegate):
Update function names now that they have "Instance" in their
name instead of "Prototype".

  • bindings/scripts/CodeGeneratorJS.pm:
  • Move functions to the instance if their interface is a global object or if they are marked as [Unforgeable]. Operations are now treated more like attributes, as they can now be either on the instance or the prototype. In a lot of places, I now use the naming "properties" instead of "attributes" as "properties" refer both "attributes" and "operations" / "functions".
  • bindings/scripts/test/JS/JSTestInterface.cpp:
  • bindings/scripts/test/JS/JSTestObj.cpp:

Rebaseline bindings tests.

LayoutTests:

  • inspector/model/remote-object-get-properties-expected.txt:

Rebaseline test because the order of static properties has changed:
functions are now before constants instead of after.

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r196646 r196648  
     12016-02-16  Chris Dumez  <cdumez@apple.com>
     2
     3        [Web IDL] Operations should be on the instance for global objects or if [Unforgeable]
     4        https://bugs.webkit.org/show_bug.cgi?id=154120
     5        <rdar://problem/24613231>
     6
     7        Reviewed by Gavin Barraclough.
     8
     9        * inspector/model/remote-object-get-properties-expected.txt:
     10        Rebaseline test because the order of static properties has changed:
     11        functions are now before constants instead of after.
     12
    1132016-02-16  Ryan Haddad  <ryanhaddad@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r196621 r196648  
     12016-02-16  Chris Dumez  <cdumez@apple.com>
     2
     3        [Web IDL] Operations should be on the instance for global objects or if [Unforgeable]
     4        https://bugs.webkit.org/show_bug.cgi?id=154120
     5        <rdar://problem/24613231>
     6
     7        Reviewed by Gavin Barraclough.
     8
     9        Rebaseline now that more checks are passing.
     10
     11        * web-platform-tests/html/dom/interfaces-expected.txt:
     12
    1132016-02-15  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt

    r196621 r196648  
    38253825PASS Window interface: attribute toolbar
    38263826PASS Window interface: attribute status
    3827 FAIL Window interface: operation close() assert_equals: property should be writable if and only if not unforgeable expected true but got false
     3827PASS Window interface: operation close()
    38283828PASS Window interface: attribute closed
    3829 FAIL Window interface: operation stop() desc is not an Object. (evaluating '"get" in desc')
    3830 FAIL Window interface: operation focus() assert_equals: property should be writable if and only if not unforgeable expected true but got false
    3831 FAIL Window interface: operation blur() assert_equals: property should be writable if and only if not unforgeable expected true but got false
     3829PASS Window interface: operation stop()
     3830PASS Window interface: operation focus()
     3831PASS Window interface: operation blur()
    38323832PASS Window interface: attribute frames
    38333833PASS Window interface: attribute length
     
    38353835PASS Window interface: attribute parent
    38363836PASS Window interface: attribute frameElement
    3837 FAIL Window interface: operation open(DOMString,DOMString,DOMString,boolean) desc is not an Object. (evaluating '"get" in desc')
     3837FAIL Window interface: operation open(DOMString,DOMString,DOMString,boolean) assert_equals: property has wrong .length expected 0 but got 2
    38383838FAIL Window interface: attribute navigator assert_equals: setter must be undefined for readonly attributes expected (undefined) undefined but got (function) function "function navigator() {
    38393839    [native code]
     
    38413841FAIL Window interface: attribute external assert_own_property: The global object must have a property "external" expected property "external" missing
    38423842PASS Window interface: attribute applicationCache
    3843 FAIL Window interface: operation alert() desc is not an Object. (evaluating '"get" in desc')
    3844 FAIL Window interface: operation confirm(DOMString) desc is not an Object. (evaluating '"get" in desc')
    3845 FAIL Window interface: operation prompt(DOMString,DOMString) desc is not an Object. (evaluating '"get" in desc')
    3846 FAIL Window interface: operation print() desc is not an Object. (evaluating '"get" in desc')
    3847 FAIL Window interface: operation showModalDialog(DOMString,any) desc is not an Object. (evaluating '"get" in desc')
    3848 FAIL Window interface: operation postMessage(any,DOMString,[object Object]) assert_equals: property should be writable if and only if not unforgeable expected true but got false
    3849 FAIL Window interface: operation captureEvents() desc is not an Object. (evaluating '"get" in desc')
    3850 FAIL Window interface: operation releaseEvents() desc is not an Object. (evaluating '"get" in desc')
     3843PASS Window interface: operation alert()
     3844PASS Window interface: operation confirm(DOMString)
     3845PASS Window interface: operation prompt(DOMString,DOMString)
     3846PASS Window interface: operation print()
     3847PASS Window interface: operation showModalDialog(DOMString,any)
     3848PASS Window interface: operation postMessage(any,DOMString,[object Object])
     3849PASS Window interface: operation captureEvents()
     3850PASS Window interface: operation releaseEvents()
    38513851PASS Window interface: attribute onabort
    38523852FAIL Window interface: attribute onautocomplete assert_own_property: The global object must have a property "onautocomplete" expected property "onautocomplete" missing
     
    39253925PASS Window interface: attribute onstorage
    39263926PASS Window interface: attribute onunload
    3927 FAIL Window interface: operation btoa(DOMString) desc is not an Object. (evaluating '"get" in desc')
    3928 FAIL Window interface: operation atob(DOMString) desc is not an Object. (evaluating '"get" in desc')
    3929 FAIL Window interface: operation setTimeout(Function,long,any) desc is not an Object. (evaluating '"get" in desc')
    3930 FAIL Window interface: operation setTimeout(DOMString,long,any) desc is not an Object. (evaluating '"get" in desc')
    3931 FAIL Window interface: operation clearTimeout(long) desc is not an Object. (evaluating '"get" in desc')
    3932 FAIL Window interface: operation setInterval(Function,long,any) desc is not an Object. (evaluating '"get" in desc')
    3933 FAIL Window interface: operation setInterval(DOMString,long,any) desc is not an Object. (evaluating '"get" in desc')
    3934 FAIL Window interface: operation clearInterval(long) desc is not an Object. (evaluating '"get" in desc')
     3927PASS Window interface: operation btoa(DOMString)
     3928PASS Window interface: operation atob(DOMString)
     3929PASS Window interface: operation setTimeout(Function,long,any)
     3930PASS Window interface: operation setTimeout(DOMString,long,any)
     3931PASS Window interface: operation clearTimeout(long)
     3932PASS Window interface: operation setInterval(Function,long,any)
     3933PASS Window interface: operation setInterval(DOMString,long,any)
     3934PASS Window interface: operation clearInterval(long)
    39353935FAIL Window interface: operation createImageBitmap(ImageBitmapSource,long,long,long,long) assert_own_property: global object missing non-static operation expected property "createImageBitmap" missing
    39363936PASS Window interface: attribute sessionStorage
     
    41434143PASS Location interface: window.location must have own property "search"
    41444144PASS Location interface: window.location must have own property "hash"
    4145 FAIL Location interface: window.location must have own property "assign" assert_own_property: Doesn't have the unforgeable operation property expected property "assign" missing
    4146 FAIL Location interface: calling assign(USVString) on window.location with too few arguments must throw TypeError assert_own_property: expected property "assign" missing
    4147 FAIL Location interface: window.location must have own property "replace" assert_own_property: Doesn't have the unforgeable operation property expected property "replace" missing
    4148 FAIL Location interface: calling replace(USVString) on window.location with too few arguments must throw TypeError assert_own_property: expected property "replace" missing
    4149 FAIL Location interface: window.location must have own property "reload" assert_own_property: Doesn't have the unforgeable operation property expected property "reload" missing
     4145FAIL Location interface: window.location must have own property "assign" assert_equals: property should be writable if and only if not unforgeable expected false but got true
     4146FAIL Location interface: calling assign(USVString) on window.location with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
     4147    [native code]
     4148}" did not throw
     4149FAIL Location interface: window.location must have own property "replace" assert_equals: property should be writable if and only if not unforgeable expected false but got true
     4150FAIL Location interface: calling replace(USVString) on window.location with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
     4151    [native code]
     4152}" did not throw
     4153FAIL Location interface: window.location must have own property "reload" assert_equals: property should be writable if and only if not unforgeable expected false but got true
    41504154PASS Location interface: window.location must have own property "ancestorOrigins"
    41514155PASS PopStateEvent interface: existence and properties of interface object
  • trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt

    r196538 r196648  
    7272    cancelBubble
    7373    clipboardData
     74    stopPropagation
     75    preventDefault
     76    initEvent
     77    stopImmediatePropagation
    7478    NONE
    7579    CAPTURING_PHASE
     
    9296    SELECT
    9397    CHANGE
    94     stopPropagation
    95     preventDefault
    96     initEvent
    97     stopImmediatePropagation
    9898    toString
    9999    toLocaleString
  • trunk/Source/JavaScriptCore/ChangeLog

    r196644 r196648  
     12016-02-16  Chris Dumez  <cdumez@apple.com>
     2
     3        [Web IDL] Operations should be on the instance for global objects or if [Unforgeable]
     4        https://bugs.webkit.org/show_bug.cgi?id=154120
     5        <rdar://problem/24613231>
     6
     7        Reviewed by Gavin Barraclough.
     8
     9        Have putEntry() take a thisValue parameter in addition to the base,
     10        instead of relying on PropertySlot::thisValue() because this did not
     11        always do the right thing. In particular, when JSDOMWindow::put() was
     12        called to set a function, it would end up setting the new value on the
     13        JSDOMWindowShell instead of the actual JSDOMWindow.
     14        JSDOMWindow::getOwnPropertySlot() would then not be able to find it.
     15        Therefore the following would fail:
     16        $ window.open = "test"
     17        $ console.log(window.open) // prints the native function instead of "test"
     18
     19        * runtime/JSObject.cpp:
     20        (JSC::JSObject::putInlineSlow):
     21        * runtime/Lookup.h:
     22        (JSC::putEntry):
     23        (JSC::lookupPut):
     24
    1252016-02-16  Keith Miller  <keith_miller@apple.com>
    226
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r196524 r196648  
    417417            if (obj->classInfo()->hasStaticSetterOrReadonlyProperties()) {
    418418                if (auto* entry = obj->findPropertyHashEntry(propertyName)) {
    419                     putEntry(exec, entry, obj, propertyName, value, slot);
     419                    putEntry(exec, entry, obj, this, propertyName, value, slot);
    420420                    return;
    421421                }
  • trunk/Source/JavaScriptCore/runtime/Lookup.h

    r196374 r196648  
    269269}
    270270
    271 inline void putEntry(ExecState* exec, const HashTableValue* entry, JSObject* base, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
     271// 'base' means the object holding the property (possibly in the prototype chain of the object put was called on).
     272// 'thisValue' is the object that put is being applied to (in the case of a proxy, the proxy target).
     273// 'slot.thisValue()' is the object the put was originally performed on (in the case of a proxy, the proxy itself).
     274inline void putEntry(ExecState* exec, const HashTableValue* entry, JSObject* base, JSObject* thisValue, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
    272275{
    273276    // If this is a function put it as an override property.
    274277    if (entry->attributes() & BuiltinOrFunction) {
    275         if (JSObject* thisObject = jsDynamicCast<JSObject*>(slot.thisValue()))
     278        if (JSObject* thisObject = jsDynamicCast<JSObject*>(thisValue))
    276279            thisObject->putDirect(exec->vm(), propertyName, value);
    277280    } else if (entry->attributes() & Accessor) {
     
    279282            throwTypeError(exec, StrictModeReadonlyPropertyWriteError);
    280283    } else if (!(entry->attributes() & ReadOnly)) {
    281         JSValue thisValue = entry->attributes() & CustomAccessor ? slot.thisValue() : JSValue(base);
    282         entry->propertyPutter()(exec, JSValue::encode(thisValue), JSValue::encode(value));
     284        JSValue updateThisValue = entry->attributes() & CustomAccessor ? slot.thisValue() : JSValue(base);
     285        entry->propertyPutter()(exec, JSValue::encode(updateThisValue), JSValue::encode(value));
    283286        if (entry->attributes() & CustomAccessor)
    284287            slot.setCustomAccessor(base, entry->propertyPutter());
     
    301304        return false;
    302305
    303     putEntry(exec, entry, base, propertyName, value, slot);
     306    putEntry(exec, entry, base, base, propertyName, value, slot);
    304307    return true;
    305308}
  • trunk/Source/WebCore/ChangeLog

    r196641 r196648  
     12016-02-16  Chris Dumez  <cdumez@apple.com>
     2
     3        [Web IDL] Operations should be on the instance for global objects or if [Unforgeable]
     4        https://bugs.webkit.org/show_bug.cgi?id=154120
     5        <rdar://problem/24613231>
     6
     7        Reviewed by Gavin Barraclough.
     8
     9        Operations should be on the instance for global objects or if
     10        [Unforgeable] as per the Web IDL specification:
     11        - http://heycam.github.io/webidl/#es-operations
     12        - http://heycam.github.io/webidl/#dfn-unforgeable-on-an-interface
     13
     14        This patch implements this behavior in order to align
     15        with the specification and other browsers.
     16
     17        No new tests, already covered by existing tests.
     18
     19        * bindings/js/JSDOMWindowCustom.cpp:
     20        (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
     21        Update function names now that they have "Instance" in their
     22        name instead of "Prototype".
     23
     24        (WebCore::JSDOMWindow::getOwnPropertySlot):
     25        - Update function names now that they have "Instance" in their
     26          name instead of "Prototype".
     27        - Move the functions hard-coding *before* the static table check
     28          now that these functions are in the static table to maintain
     29          the previous behavior.
     30
     31        * bindings/js/JSLocationCustom.cpp:
     32        (WebCore::JSLocation::getOwnPropertySlotDelegate):
     33        Update function names now that they have "Instance" in their
     34        name instead of "Prototype".
     35
     36        * bindings/scripts/CodeGeneratorJS.pm:
     37        - Move functions to the instance if their interface is a global
     38          object or if they are marked as [Unforgeable]. Operations are
     39          now treated more like attributes, as they can now be either on
     40          the instance or the prototype. In a lot of places, I now use
     41          the naming "properties" instead of "attributes" as "properties"
     42          refer both "attributes" and "operations" / "functions".
     43
     44        * bindings/scripts/test/JS/JSTestInterface.cpp:
     45        * bindings/scripts/test/JS/JSTestObj.cpp:
     46        Rebaseline bindings tests.
     47
    1482016-02-16  Simon Fraser  <simon.fraser@apple.com>
    249
  • trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp

    r196628 r196648  
    110110        }
    111111        if (propertyName == exec->propertyNames().close) {
    112             slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowPrototypeFunctionClose, 0>);
     112            slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionClose, 0>);
    113113            return true;
    114114        }
     
    123123    // Always provide the original function, on a fresh uncached function object.
    124124    if (propertyName == exec->propertyNames().blur) {
    125         slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowPrototypeFunctionBlur, 0>);
     125        slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionBlur, 0>);
    126126        return true;
    127127    }
    128128    if (propertyName == exec->propertyNames().close) {
    129         slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowPrototypeFunctionClose, 0>);
     129        slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionClose, 0>);
    130130        return true;
    131131    }
    132132    if (propertyName == exec->propertyNames().focus) {
    133         slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowPrototypeFunctionFocus, 0>);
     133        slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionFocus, 0>);
    134134        return true;
    135135    }
    136136    if (propertyName == exec->propertyNames().postMessage) {
    137         slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowPrototypeFunctionPostMessage, 2>);
     137        slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionPostMessage, 2>);
    138138        return true;
    139139    }
     
    259259    if (Base::getOwnPropertySlot(thisObject, exec, propertyName, slot))
    260260        return true;
    261     if (!thisObject->staticFunctionsReified()) {
    262         if (auto* entry = JSDOMWindow::info()->staticPropHashTable->entry(propertyName)) {
    263             slot.setCacheableCustom(thisObject, entry->attributes(), entry->propertyGetter());
    264             return true;
    265         }
    266     }
     261
    267262    // FIXME: These are all bogus. Keeping these here make some tests pass that check these properties
    268263    // are own properties of the window, but introduces other problems instead (e.g. if you overwrite
    269264    // & delete then the original value is restored!) Should be removed.
    270265    if (propertyName == exec->propertyNames().blur) {
    271         slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowPrototypeFunctionBlur, 0>);
     266        slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionBlur, 0>);
    272267        return true;
    273268    }
    274269    if (propertyName == exec->propertyNames().close) {
    275         slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowPrototypeFunctionClose, 0>);
     270        slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionClose, 0>);
    276271        return true;
    277272    }
    278273    if (propertyName == exec->propertyNames().focus) {
    279         slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowPrototypeFunctionFocus, 0>);
     274        slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionFocus, 0>);
    280275        return true;
    281276    }
    282277    if (propertyName == exec->propertyNames().postMessage) {
    283         slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowPrototypeFunctionPostMessage, 2>);
    284         return true;
    285     }
     278        slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionPostMessage, 2>);
     279        return true;
     280    }
     281
     282    if (!thisObject->staticFunctionsReified()) {
     283        if (auto* entry = JSDOMWindow::info()->staticPropHashTable->entry(propertyName)) {
     284            if (entry->attributes() & BuiltinOrFunctionOrAccessor)
     285                return setUpStaticFunctionSlot(exec, entry, thisObject, propertyName, slot);
     286            slot.setCacheableCustom(thisObject, entry->attributes(), entry->propertyGetter());
     287            return true;
     288        }
     289    }
     290
    286291    // FIXME: this looks pretty bogus. It seems highly likely that if !canShowModalDialog the
    287292    // funtion should still be present, or should be omitted entirely - present but reads as
  • trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp

    r196423 r196648  
    5151    // Make these read-only / non-configurable to prevent writes via defineProperty.
    5252    if (propertyName == exec->propertyNames().replace) {
    53         slot.setCustom(this, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsLocationPrototypeFunctionReplace, 1>);
     53        slot.setCustom(this, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsLocationInstanceFunctionReplace, 1>);
    5454        return true;
    5555    }
    5656    if (propertyName == exec->propertyNames().reload) {
    57         slot.setCustom(this, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsLocationPrototypeFunctionReload, 0>);
     57        slot.setCustom(this, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsLocationInstanceFunctionReload, 0>);
    5858        return true;
    5959    }
    6060    if (propertyName == exec->propertyNames().assign) {
    61         slot.setCustom(this, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsLocationPrototypeFunctionAssign, 1>);
     61        slot.setCustom(this, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsLocationInstanceFunctionAssign, 1>);
    6262        return true;
    6363    }
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r196588 r196648  
    44# Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org>
    55# Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
    6 # Copyright (C) 2006, 2007-2010, 2013-2105 Apple Inc. All rights reserved.
     6# Copyright (C) 2006, 2007-2010, 2013-2016 Apple Inc. All rights reserved.
    77# Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
    88# Copyright (C) Research In Motion Limited 2010. All rights reserved.
     
    384384sub GenerateGetOwnPropertySlotBody
    385385{
    386     my ($interface, $interfaceName, $className, $hasAttributes, $inlined) = @_;
     386    my ($interface, $interfaceName, $className, $hasInstanceProperties, $inlined) = @_;
    387387
    388388    my $namespaceMaybe = ($inlined ? "JSC::" : "");
     
    393393
    394394    my $ownPropertyCheck = sub {
    395         if ($hasAttributes) {
    396             if ($inlined) {
    397                 push(@getOwnPropertySlotImpl, "    if (${namespaceMaybe}getStaticValueSlot<$className, Base>(state, *info()->staticPropHashTable, thisObject, propertyName, slot))\n");
    398             } else {
    399                 push(@getOwnPropertySlotImpl, "    if (${namespaceMaybe}getStaticValueSlot<$className, Base>(state, ${className}Table, thisObject, propertyName, slot))\n");
    400             }
     395        if ($hasInstanceProperties) {
     396            my $instanceFunctionCount = InstanceFunctionCount($interface);
     397            # If there are functions on the instance, then call getStaticPropertySlot() instead of getStaticValueSlot().
     398            my $staticPropertyGetFunction = $namespaceMaybe . ($instanceFunctionCount eq 0 ? "getStaticValueSlot" : "getStaticPropertySlot");
     399            my $staticPropertyTable = $inlined ? "*info()->staticPropHashTable" : "${className}Table";
     400            push(@getOwnPropertySlotImpl, "    if ($staticPropertyGetFunction<$className, Base>(state, ${staticPropertyTable}, thisObject, propertyName, slot))\n");
    401401        } else {
    402402            push(@getOwnPropertySlotImpl, "    if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot))\n");
     
    606606    }
    607607
    608     my $kind = $function->isStatic ? "Constructor" : "Prototype";
     608    my $kind = $function->isStatic ? "Constructor" : (OperationShouldBeOnInstance($interface, $function) ? "Instance" : "Prototype");
    609609    return $codeGenerator->WK_lcfirst($className) . $kind . "Function" . $codeGenerator->WK_ucfirst($function->signature->name);
    610610}
     
    730730}
    731731
     732# https://heycam.github.io/webidl/#es-operations
     733sub OperationShouldBeOnInstance
     734{
     735    my $interface = shift;
     736    my $function = shift;
     737
     738    # FIXME: The bindings generator does not support putting runtime-enabled on the instance yet.
     739    return 0 if $function->signature->extendedAttributes->{"EnabledAtRuntime"};
     740
     741    return 1 if IsDOMGlobalObject($interface);
     742
     743    # [Unforgeable] operations should be on the instance.
     744    # https://heycam.github.io/webidl/#Unforgeable
     745    return 1 if $function->signature->extendedAttributes->{"Unforgeable"} || $interface->extendedAttributes->{"Unforgeable"};
     746
     747    return 0;
     748}
     749
    732750sub GetIndexedGetterFunction
    733751{
     
    742760}
    743761
    744 sub InstanceAttributeCount
     762sub InstanceFunctionCount
     763{
     764    my $interface = shift;
     765    my $count = 0;
     766
     767    foreach my $function (@{$interface->functions}) {
     768        $count++ if OperationShouldBeOnInstance($interface, $function);
     769    }
     770
     771    return $count;
     772}
     773
     774sub PrototypeFunctionCount
     775{
     776    my $interface = shift;
     777    my $count = 0;
     778
     779    foreach my $function (@{$interface->functions}) {
     780        $count++ if !$function->isStatic && !OperationShouldBeOnInstance($interface, $function);
     781    }
     782
     783    return $count;
     784}
     785
     786sub InstancePropertyCount
    745787{
    746788    my $interface = shift;
    747789    my $count = 0;
    748790    foreach my $attribute (@{$interface->attributes}) {
    749         $count = $count + AttributeShouldBeOnInstance($interface, $attribute);
    750     }
    751     $count = $count + 1 if ConstructorShouldBeOnInstance($interface);
     791        $count++ if AttributeShouldBeOnInstance($interface, $attribute);
     792    }
     793    $count += InstanceFunctionCount($interface);
     794    $count++ if ConstructorShouldBeOnInstance($interface);
    752795    return $count;
    753796}
    754797
    755 sub PrototypeAttributeCount
     798sub PrototypePropertyCount
    756799{
    757800    my $interface = shift;
    758801    my $count = 0;
    759802    foreach my $attribute (@{$interface->attributes}) {
    760         $count = $count + 1 if !AttributeShouldBeOnInstance($interface, $attribute);
    761     }
    762     $count = $count + 1 if !ConstructorShouldBeOnInstance($interface);
     803        $count++ if !AttributeShouldBeOnInstance($interface, $attribute);
     804    }
     805    $count += PrototypeFunctionCount($interface);
     806    $count++ if !ConstructorShouldBeOnInstance($interface);
    763807    return $count;
    764808}
     
    767811{
    768812    my $interface = shift;
    769     my $numInstanceAttributes = InstanceAttributeCount($interface);
     813    my $numInstanceProperties = InstancePropertyCount($interface);
    770814
    771815    my $namedGetterFunction = GetNamedGetterFunction($interface);
     
    780824        || $hasNamedGetter;
    781825
    782     return $numInstanceAttributes > 0 || $hasComplexGetter;
     826    return $numInstanceProperties > 0 || $hasComplexGetter;
    783827
    784828}
     
    787831{
    788832    my $interface = shift;
    789     my $numPrototypeAttributes = PrototypeAttributeCount($interface);
     833    my $numPrototypeProperties = PrototypePropertyCount($interface);
    790834    my $numConstants = @{$interface->constants};
    791     my $numFunctions = @{$interface->functions};
    792     return $numFunctions > 0 || $numConstants > 0 || $numPrototypeAttributes > 0;
     835    return $numConstants > 0 || $numPrototypeProperties > 0;
    793836}
    794837
     
    945988    }
    946989
    947     my $hasStaticPropertyTable = InstanceAttributeCount($interface) > 0 ? "true" : "false";
     990    my $hasStaticPropertyTable = InstancePropertyCount($interface) > 0 ? "true" : "false";
    948991    push(@headerContent, "    static const bool hasStaticPropertyTable = $hasStaticPropertyTable;\n\n");
    949992
     
    13361379}
    13371380
    1338 sub GenerateAttributesHashTable
    1339 {
    1340     my ($object, $interface, $isInstance, $hashKeys, $hashSpecials, $hashValue1, $hashValue2, $conditionals, $entries) = @_;
     1381sub GeneratePropertiesHashTable
     1382{
     1383    my ($object, $interface, $isInstance, $hashKeys, $hashSpecials, $hashValue1, $hashValue2, $conditionals, $runtimeEnabledFunctions) = @_;
    13411384
    13421385    # FIXME: These should be functions on $interface.
     
    13441387    my $className = "JS$interfaceName";
    13451388   
    1346     # - Add all attributes in a hashtable definition
    1347     my $numAttributes = 0;
    1348     if ($isInstance) {
    1349         $numAttributes = InstanceAttributeCount($interface);
    1350     } else {
    1351         $numAttributes = PrototypeAttributeCount($interface);
    1352     }
    1353 
     1389    # - Add all properties in a hashtable definition
     1390    my $propertyCount = $isInstance ? InstancePropertyCount($interface) : PrototypePropertyCount($interface);
    13541391
    13551392    if (ConstructorShouldBeOnInstance($interface) == $isInstance) {
    13561393
    13571394        if (NeedsConstructorProperty($interface)) {
    1358             die if !$numAttributes;
     1395            die if !$propertyCount;
    13591396            push(@$hashKeys, "constructor");
    13601397            my $getter = "js" . $interfaceName . "Constructor";
     
    13671404    }
    13681405
    1369     return 0 if !$numAttributes;
     1406    return 0 if !$propertyCount;
    13701407
    13711408    foreach my $attribute (@{$interface->attributes}) {
     
    14041441    }
    14051442
    1406     return $numAttributes;
     1443    foreach my $function (@{$interface->functions}) {
     1444        next if ($function->signature->extendedAttributes->{"Private"});
     1445        next if ($function->isStatic);
     1446        next if $function->{overloadIndex} && $function->{overloadIndex} > 1;
     1447        next if OperationShouldBeOnInstance($interface, $function) != $isInstance;
     1448        my $name = $function->signature->name;
     1449        push(@$hashKeys, $name);
     1450
     1451        my $functionName = GetFunctionName($interface, $className, $function);
     1452        push(@$hashValue1, $functionName);
     1453
     1454        my $functionLength = GetFunctionLength($function);
     1455        push(@$hashValue2, $functionLength);
     1456
     1457        push(@$hashSpecials, ComputeFunctionSpecial($interface, $function));
     1458
     1459        my $conditional = $function->signature->extendedAttributes->{"Conditional"};
     1460        if ($conditional) {
     1461            $conditionals->{$name} = $conditional;
     1462        }
     1463
     1464        if ($function->signature->extendedAttributes->{"EnabledAtRuntime"}) {
     1465            if ($isInstance) {
     1466                die "We currently do not support [EnabledAtRuntime] operations on the instance.";
     1467            } else {
     1468                push(@$runtimeEnabledFunctions, $function);
     1469            }
     1470        }
     1471    }
     1472
     1473    return $propertyCount;
    14071474}
    14081475
     
    15341601    # declaration in the IDL.
    15351602
    1536     my $kind = $function->isStatic ? "Constructor" : "Prototype";
     1603    my $kind = $function->isStatic ? "Constructor" : (OperationShouldBeOnInstance($interface, $function) ? "Instance" : "Prototype");
    15371604    my $functionName = "js${interfaceName}${kind}Function" . $codeGenerator->WK_ucfirst($function->signature->name);
    15381605
     
    18651932    my %conditionals = ();
    18661933    my $hashName = $className . "Table";
    1867 
    1868     my $numInstanceAttributes = GenerateAttributesHashTable($object, $interface, 1,
     1934    my @runtimeEnabledFunctions = ();
     1935
     1936    # Generate hash table for properties on the instance.
     1937    my $numInstanceProperties = GeneratePropertiesHashTable($object, $interface, 1,
    18691938        \@hashKeys, \@hashSpecials,
    18701939        \@hashValue1, \@hashValue2,
    1871         \%conditionals);
    1872 
    1873     $object->GenerateHashTable($hashName, $numInstanceAttributes,
     1940        \%conditionals, \@runtimeEnabledFunctions);
     1941
     1942    $object->GenerateHashTable($hashName, $numInstanceProperties,
    18741943        \@hashKeys, \@hashSpecials,
    18751944        \@hashValue1, \@hashValue2,
    1876         \%conditionals, 0) if $numInstanceAttributes > 0;
    1877 
    1878     # - Add all constants
     1945        \%conditionals, 0) if $numInstanceProperties > 0;
     1946
     1947    # - Add all interface object (aka constructor) properties (constants, static attributes, static operations).
    18791948    if (NeedsConstructorProperty($interface)) {
    18801949        my $hashSize = 0;
     
    19822051    @hashSpecials = ();
    19832052    %conditionals = ();
    1984 
    1985 
    1986     my $numPrototypeAttributes = GenerateAttributesHashTable($object, $interface, 0,
     2053    @runtimeEnabledFunctions = ();
     2054
     2055    # Generate hash table for properties on the prototype.
     2056    my $numPrototypeProperties = GeneratePropertiesHashTable($object, $interface, 0,
    19872057        \@hashKeys, \@hashSpecials,
    19882058        \@hashValue1, \@hashValue2,
    1989         \%conditionals);
    1990     my $hashSize = $numPrototypeAttributes;
     2059        \%conditionals, \@runtimeEnabledFunctions);
     2060    my $hashSize = $numPrototypeProperties;
    19912061
    19922062    foreach my $constant (@{$interface->constants}) {
     
    20062076    }
    20072077
    2008     my @runtimeEnabledFunctions = ();
    2009 
    2010     foreach my $function (@{$interface->functions}) {
    2011         next if ($function->signature->extendedAttributes->{"Private"});
    2012         next if ($function->isStatic);
    2013         next if $function->{overloadIndex} && $function->{overloadIndex} > 1;
    2014         my $name = $function->signature->name;
    2015         push(@hashKeys, $name);
    2016 
    2017         my $functionName = GetFunctionName($interface, $className, $function);
    2018         push(@hashValue1, $functionName);
    2019 
    2020         my $functionLength = GetFunctionLength($function);
    2021         push(@hashValue2, $functionLength);
    2022 
    2023         push(@hashSpecials, ComputeFunctionSpecial($interface, $function));
    2024 
    2025         my $conditional = $function->signature->extendedAttributes->{"Conditional"};
    2026         if ($conditional) {
    2027             $conditionals{$name} = $conditional;
    2028         }
    2029 
    2030         push(@runtimeEnabledFunctions, $function) if $function->signature->extendedAttributes->{"EnabledAtRuntime"};
    2031 
    2032         $hashSize++;
    2033     }
    2034 
    20352078    my $justGenerateValueArray = !IsDOMGlobalObject($interface);
    20362079
     
    20472090
    20482091    if (PrototypeOverridesGetOwnPropertySlot($interface)) {
    2049         my $numPrototypeAttributes = PrototypeAttributeCount($interface);
     2092        my $prototypePropertyCount = PrototypePropertyCount($interface);
     2093        my $prototypeFunctionCount = PrototypeFunctionCount($interface);
     2094        my $prototypeAttributeCount = $prototypePropertyCount - $prototypeFunctionCount;
    20502095        if (IsDOMGlobalObject($interface)) {
    20512096            push(@implContent, "bool ${className}Prototype::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)\n");
     
    20552100            push(@implContent, "    auto* thisObject = jsCast<${className}Prototype*>(object);\n");
    20562101
    2057             if ($numConstants eq 0 && $numFunctions eq 0 && $numPrototypeAttributes eq 0) {
     2102            if ($numConstants eq 0 && $prototypePropertyCount eq 0) {
    20582103                push(@implContent, "    return Base::getOwnPropertySlot(thisObject, state, propertyName, slot);\n");       
    2059             } elsif ($numConstants eq 0 && $numPrototypeAttributes eq 0) {
     2104            } elsif ($numConstants eq 0 && $prototypeAttributeCount eq 0) {
    20602105                push(@implContent, "    return getStaticFunctionSlot<JSObject>(state, ${className}PrototypeTable, thisObject, propertyName, slot);\n");
    2061             } elsif ($numFunctions eq 0 && $numPrototypeAttributes eq 0) {
     2106            } elsif ($prototypePropertyCount eq 0) {
    20622107                push(@implContent, "    return getStaticValueSlot<${className}Prototype, JSObject>(state, ${className}PrototypeTable, thisObject, propertyName, slot);\n");
    20632108            } else {
     
    20652110            }
    20662111            push(@implContent, "}\n\n");
    2067         } elsif ($numConstants > 0 || $numFunctions > 0 || $numPrototypeAttributes > 0) {
     2112        } elsif ($numConstants > 0 || $numPrototypeProperties > 0) {
    20682113            push(@implContent, "void ${className}Prototype::finishCreation(VM& vm)\n");
    20692114            push(@implContent, "{\n");
     
    21162161    push(@implContent, "const ClassInfo $className" . "::s_info = { \"${visibleInterfaceName}\", &Base::s_info, ");
    21172162
    2118     if ($numInstanceAttributes > 0) {
     2163    if ($numInstanceProperties > 0) {
    21192164        push(@implContent, "&${className}Table");
    21202165    } else {
     
    21852230            push(@implContent, "    auto* thisObject = jsCast<${className}*>(object);\n");
    21862231            push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
    2187             push(@implContent, GenerateGetOwnPropertySlotBody($interface, $interfaceName, $className, $numInstanceAttributes > 0, 0));
     2232            push(@implContent, GenerateGetOwnPropertySlotBody($interface, $interfaceName, $className, $numInstanceProperties > 0, 0));
    21882233            push(@implContent, "}\n\n");
    21892234        }
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp

    r196563 r196648  
    324324#endif
    325325#if ENABLE(Condition22) || ENABLE(Condition23)
     326    { "implementsMethod1", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionImplementsMethod1), (intptr_t) (0) } },
     327#else
     328    { 0, 0, NoIntrinsic, { 0, 0 } },
     329#endif
     330#if ENABLE(Condition22) || ENABLE(Condition23)
     331    { "implementsMethod2", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionImplementsMethod2), (intptr_t) (2) } },
     332#else
     333    { 0, 0, NoIntrinsic, { 0, 0 } },
     334#endif
     335#if ENABLE(Condition22) || ENABLE(Condition23)
     336    { "implementsMethod3", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionImplementsMethod3), (intptr_t) (0) } },
     337#else
     338    { 0, 0, NoIntrinsic, { 0, 0 } },
     339#endif
     340#if ENABLE(Condition11) || ENABLE(Condition12)
     341    { "supplementalMethod1", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod1), (intptr_t) (0) } },
     342#else
     343    { 0, 0, NoIntrinsic, { 0, 0 } },
     344#endif
     345#if ENABLE(Condition11) || ENABLE(Condition12)
     346    { "supplementalMethod2", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod2), (intptr_t) (2) } },
     347#else
     348    { 0, 0, NoIntrinsic, { 0, 0 } },
     349#endif
     350#if ENABLE(Condition11) || ENABLE(Condition12)
     351    { "supplementalMethod3", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod3), (intptr_t) (0) } },
     352#else
     353    { 0, 0, NoIntrinsic, { 0, 0 } },
     354#endif
     355#if ENABLE(Condition11) || ENABLE(Condition12)
     356    { "builtinFunction", JSC::Builtin, NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(testSupplementalBuiltinFunctionCodeGenerator), (intptr_t) (0) } },
     357#else
     358    { 0, 0, NoIntrinsic, { 0, 0 } },
     359#endif
     360#if ENABLE(Condition22) || ENABLE(Condition23)
    326361    { "IMPLEMENTSCONSTANT1", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(1) } },
    327362#else
     
    340375#if ENABLE(Condition11) || ENABLE(Condition12)
    341376    { "SUPPLEMENTALCONSTANT2", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(2) } },
    342 #else
    343     { 0, 0, NoIntrinsic, { 0, 0 } },
    344 #endif
    345 #if ENABLE(Condition22) || ENABLE(Condition23)
    346     { "implementsMethod1", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionImplementsMethod1), (intptr_t) (0) } },
    347 #else
    348     { 0, 0, NoIntrinsic, { 0, 0 } },
    349 #endif
    350 #if ENABLE(Condition22) || ENABLE(Condition23)
    351     { "implementsMethod2", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionImplementsMethod2), (intptr_t) (2) } },
    352 #else
    353     { 0, 0, NoIntrinsic, { 0, 0 } },
    354 #endif
    355 #if ENABLE(Condition22) || ENABLE(Condition23)
    356     { "implementsMethod3", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionImplementsMethod3), (intptr_t) (0) } },
    357 #else
    358     { 0, 0, NoIntrinsic, { 0, 0 } },
    359 #endif
    360 #if ENABLE(Condition11) || ENABLE(Condition12)
    361     { "supplementalMethod1", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod1), (intptr_t) (0) } },
    362 #else
    363     { 0, 0, NoIntrinsic, { 0, 0 } },
    364 #endif
    365 #if ENABLE(Condition11) || ENABLE(Condition12)
    366     { "supplementalMethod2", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod2), (intptr_t) (2) } },
    367 #else
    368     { 0, 0, NoIntrinsic, { 0, 0 } },
    369 #endif
    370 #if ENABLE(Condition11) || ENABLE(Condition12)
    371     { "supplementalMethod3", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod3), (intptr_t) (0) } },
    372 #else
    373     { 0, 0, NoIntrinsic, { 0, 0 } },
    374 #endif
    375 #if ENABLE(Condition11) || ENABLE(Condition12)
    376     { "builtinFunction", JSC::Builtin, NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(testSupplementalBuiltinFunctionCodeGenerator), (intptr_t) (0) } },
    377377#else
    378378    { 0, 0, NoIntrinsic, { 0, 0 } },
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r196563 r196648  
    589589    { "putForwardsAttribute", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjPutForwardsAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjPutForwardsAttribute) } },
    590590    { "putForwardsNullableAttribute", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjPutForwardsNullableAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjPutForwardsNullableAttribute) } },
    591 #if ENABLE(Condition1)
    592     { "CONDITIONAL_CONST", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } },
    593 #else
    594     { 0, 0, NoIntrinsic, { 0, 0 } },
    595 #endif
    596     { "CONST_VALUE_0", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } },
    597     { "CONST_VALUE_1", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(1) } },
    598     { "CONST_VALUE_2", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(2) } },
    599     { "CONST_VALUE_4", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(4) } },
    600     { "CONST_VALUE_8", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(8) } },
    601     { "CONST_VALUE_9", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(-1) } },
    602     { "CONST_VALUE_11", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0xffffffff) } },
    603     { "CONST_VALUE_12", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0x01) } },
    604     { "CONST_VALUE_13", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0X20) } },
    605     { "CONST_VALUE_14", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0x1abc) } },
    606     { "CONST_JAVASCRIPT", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(15) } },
    607     { "readonly", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } },
    608591    { "voidMethod", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethod), (intptr_t) (0) } },
    609592    { "voidMethodWithArgs", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethodWithArgs), (intptr_t) (3) } },
     
    706689    { "testPromiseFunctionWithException", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseFunctionWithException), (intptr_t) (0) } },
    707690    { "testPromiseFunctionWithOptionalIntArgument", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument), (intptr_t) (0) } },
     691#if ENABLE(Condition1)
     692    { "CONDITIONAL_CONST", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } },
     693#else
     694    { 0, 0, NoIntrinsic, { 0, 0 } },
     695#endif
     696    { "CONST_VALUE_0", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } },
     697    { "CONST_VALUE_1", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(1) } },
     698    { "CONST_VALUE_2", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(2) } },
     699    { "CONST_VALUE_4", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(4) } },
     700    { "CONST_VALUE_8", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(8) } },
     701    { "CONST_VALUE_9", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(-1) } },
     702    { "CONST_VALUE_11", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0xffffffff) } },
     703    { "CONST_VALUE_12", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0x01) } },
     704    { "CONST_VALUE_13", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0X20) } },
     705    { "CONST_VALUE_14", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0x1abc) } },
     706    { "CONST_JAVASCRIPT", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(15) } },
     707    { "readonly", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } },
    708708};
    709709
Note: See TracChangeset for help on using the changeset viewer.