Changeset 244020 in webkit


Ignore:
Timestamp:
Apr 8, 2019 8:51:19 AM (5 years ago)
Author:
Ryan Haddad
Message:

Unreviewed, rolling out r243943.

Caused test262 failures.

Reverted changeset:

"[JSC] Filter DontEnum properties in
ProxyObject::getOwnPropertyNames()"
https://bugs.webkit.org/show_bug.cgi?id=176810
https://trac.webkit.org/changeset/243943

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r243967 r244020  
     12019-04-08  Ryan Haddad  <ryanhaddad@apple.com>
     2
     3        Unreviewed, rolling out r243943.
     4
     5        Caused test262 failures.
     6
     7        Reverted changeset:
     8
     9        "[JSC] Filter DontEnum properties in
     10        ProxyObject::getOwnPropertyNames()"
     11        https://bugs.webkit.org/show_bug.cgi?id=176810
     12        https://trac.webkit.org/changeset/243943
     13
    1142019-04-07  Michael Saboff  <msaboff@apple.com>
    215
  • trunk/JSTests/stress/proxy-own-keys.js

    r243943 r244020  
    136136        called = false;
    137137    }
    138 
    139     for (let i = 0; i < 500; i++) {
    140         let threw = false;
    141         let foundKey = false;
    142         try {
    143             for (let k in proxy)
    144                 foundKey = true;
    145         } catch(e) {
    146             threw = true;
    147             assert(e.toString() === "TypeError: Proxy object's non-extensible 'target' has configurable property 'x' that was not in the result from the 'ownKeys' trap");
    148             assert(!foundKey);
    149         }
    150         assert(threw);
    151         assert(called);
    152         called = false;
    153     }
    154138}
    155139
     
    181165        assert(threw);
    182166        assert(called);
    183         called = false;
    184     }
    185 
    186     for (let i = 0; i < 500; i++) {
    187         let threw = false;
    188         let reached = false;
    189         try {
    190             for (let k in proxy)
    191                 reached = true;
    192         } catch (e) {
    193             threw = true;
    194             assert(e.toString() === "TypeError: Proxy handler's 'ownKeys' method returned a key that was not present in its non-extensible target");
    195         }
    196         assert(threw);
    197         assert(called);
    198         assert(!reached);
    199167        called = false;
    200168    }
     
    700668    }
    701669}
    702 
    703 {
    704     let error = null;
    705     let s1 = Symbol();
    706     let s2 = Symbol();
    707     let target = Object.defineProperties({}, {
    708         x: {
    709             value: "X",
    710             enumerable: true,
    711             configurable: true,
    712         },
    713         dontEnum1: {
    714             value: "dont-enum",
    715             enumerable: false,
    716             configurable: true,
    717         },
    718         y: {
    719             get() { return "Y"; },
    720             enumerable: true,
    721             configurable: true,
    722         },
    723         dontEnum2: {
    724             get() { return "dont-enum-accessor" },
    725             enumerable: false,
    726             configurable: true
    727         },
    728         [s1]: {
    729             value: "s1",
    730             enumerable: true,
    731             configurable: true,
    732         },
    733         [s2]: {
    734             value: "dont-enum-symbol",
    735             enumerable: false,
    736             configurable: true, 
    737         },
    738     });
    739     let checkedOwnKeys = false;
    740     let checkedPropertyDescriptor = false;
    741     let handler = {
    742         ownKeys() {
    743             checkedOwnKeys = true;
    744             return ["x", "dontEnum1", "y", "dontEnum2", s1, s2];
    745         },
    746         getOwnPropertyDescriptor(t, k) {
    747             checkedPropertyDescriptors = true;
    748             return Reflect.getOwnPropertyDescriptor(t, k);
    749         }
    750     };
    751     let proxy = new Proxy(target, handler);
    752     for (let i = 0; i < 500; i++) {
    753         checkedPropertyDescriptors = false;
    754         assert(shallowEq(["x", "dontEnum1", "y", "dontEnum2", s1, s2], Reflect.ownKeys(proxy)));
    755         assert(checkedOwnKeys);
    756         assert(!checkedPropertyDescriptors);
    757         checkedOwnKeys = false;
    758 
    759         let enumerableStringKeys = [];
    760         for (let k in proxy)
    761             enumerableStringKeys.push(k);
    762         assert(shallowEq(["x", "y"], enumerableStringKeys));
    763         assert(checkedOwnKeys);
    764         assert(checkedPropertyDescriptors);
    765     }
    766 }
  • trunk/Source/JavaScriptCore/ChangeLog

    r244019 r244020  
     12019-04-08  Ryan Haddad  <ryanhaddad@apple.com>
     2
     3        Unreviewed, rolling out r243943.
     4
     5        Caused test262 failures.
     6
     7        Reverted changeset:
     8
     9        "[JSC] Filter DontEnum properties in
     10        ProxyObject::getOwnPropertyNames()"
     11        https://bugs.webkit.org/show_bug.cgi?id=176810
     12        https://trac.webkit.org/changeset/243943
     13
    1142019-04-08  Claudio Saavedra  <csaavedra@igalia.com>
    215
  • trunk/Source/JavaScriptCore/runtime/PropertyNameArray.h

    r243943 r244020  
    5454        , m_privateSymbolMode(privateSymbolMode)
    5555    {
    56     }
    57 
    58     void reset()
    59     {
    60         m_set.clear();
    61         m_data = PropertyNameArrayData::create();
    6256    }
    6357
  • trunk/Source/JavaScriptCore/runtime/ProxyObject.cpp

    r243943 r244020  
    10071007    }
    10081008
    1009     if (!targetIsExensible) {
    1010         for (UniquedStringImpl* impl : targetConfigurableKeys) {
    1011             if (removeIfContainedInUncheckedResultKeys(impl) == IsNotContainedIn) {
    1012                 throwVMTypeError(exec, scope, makeString("Proxy object's non-extensible 'target' has configurable property '", String(impl), "' that was not in the result from the 'ownKeys' trap"));
    1013                 return;
    1014             }
    1015         }
    1016 
    1017         if (uncheckedResultKeys.size()) {
    1018             throwVMTypeError(exec, scope, "Proxy handler's 'ownKeys' method returned a key that was not present in its non-extensible target"_s);
     1009    if (targetIsExensible)
     1010        return;
     1011
     1012    for (UniquedStringImpl* impl : targetConfigurableKeys) {
     1013        if (removeIfContainedInUncheckedResultKeys(impl) == IsNotContainedIn) {
     1014            throwVMTypeError(exec, scope, makeString("Proxy object's non-extensible 'target' has configurable property '", String(impl), "' that was not in the result from the 'ownKeys' trap"));
    10191015            return;
    10201016        }
    10211017    }
    10221018
    1023     if (!enumerationMode.includeDontEnumProperties()) {
    1024         // Filtering DontEnum properties is observable in proxies and must occur following the invariant checks above.
    1025         auto data = trapResult.releaseData();
    1026         trapResult.reset();
    1027 
    1028         for (auto propertyName : data->propertyNameVector()) {
    1029             PropertySlot slot(this, PropertySlot::InternalMethodType::GetOwnProperty);
    1030             if (!getOwnPropertySlotCommon(exec, propertyName, slot))
    1031                 continue;
    1032             if (slot.attributes() & PropertyAttribute::DontEnum)
    1033                 continue;
    1034             trapResult.addUnchecked(propertyName.impl());
    1035         }
     1019    if (uncheckedResultKeys.size()) {
     1020        throwVMTypeError(exec, scope, "Proxy handler's 'ownKeys' method returned a key that was not present in its non-extensible target"_s);
     1021        return;
    10361022    }
    10371023}
  • trunk/Source/WebCore/ChangeLog

    r243971 r244020  
     12019-04-08  Ryan Haddad  <ryanhaddad@apple.com>
     2
     3        Unreviewed, rolling out r243943.
     4
     5        Caused test262 failures.
     6
     7        Reverted changeset:
     8
     9        "[JSC] Filter DontEnum properties in
     10        ProxyObject::getOwnPropertyNames()"
     11        https://bugs.webkit.org/show_bug.cgi?id=176810
     12        https://trac.webkit.org/changeset/243943
     13
    1142019-04-05  Sergio Villar Senin  <svillar@igalia.com>
    215
  • trunk/Source/WebCore/bindings/js/JSDOMConvertRecord.h

    r243943 r244020  
    8787        // 4. Let keys be ? O.[[OwnPropertyKeys]]().
    8888        JSC::PropertyNameArray keys(&vm, JSC::PropertyNameMode::Strings, JSC::PrivateSymbolMode::Exclude);
    89         object->methodTable(vm)->getOwnPropertyNames(object, &state, keys, JSC::EnumerationMode(JSC::DontEnumPropertiesMode::Include));
     89        object->methodTable(vm)->getOwnPropertyNames(object, &state, keys, JSC::EnumerationMode());
    9090
    9191        RETURN_IF_EXCEPTION(scope, { });
     
    100100            // 2. If desc is not undefined and desc.[[Enumerable]] is true:
    101101
    102             // It's necessary to filter enumerable here rather than using the default EnumerationMode,
    103             // to prevent an observable extra [[GetOwnProperty]] operation in the case of ProxyObject records.
     102            // FIXME: Do we need to check for enumerable / undefined, or is this handled by the default
     103            // enumeration mode?
     104
    104105            if (didGetDescriptor && descriptor.enumerable()) {
    105106                // 1. Let typedKey be key converted to an IDL value of type K.
Note: See TracChangeset for help on using the changeset viewer.