Changeset 260621 in webkit


Ignore:
Timestamp:
Apr 23, 2020 10:43:33 PM (4 years ago)
Author:
Alexey Shvayka
Message:

Remove revoked Proxy checks from ProxyCreate
https://bugs.webkit.org/show_bug.cgi?id=210862

Reviewed by Ross Kirsling.

JSTests:

Removes expectations for 2 invalid ChakraCore tests.

  • ChakraCore.yaml: Mark 2 test cases as passing.
  • ChakraCore/test/es6/arraywithproxy.baseline: Removed.
  • ChakraCore/test/es6/proxytest9.baseline: Removed.
  • stress/proxy-revoke.js: Adjust test.
  • test262/expectations.yaml: Mark 12 test cases as passing.

Source/JavaScriptCore:

This change removes revoked Proxy checks from ProxyCreate [1], implementing
https://github.com/tc39/ecma262/pull/1814 and aligning JSC with SpiderMonkey.
Also cleans up ProxyObject creation by using isFunction() instead of
isCallable(), which are identical.

[1]: https://tc39.es/ecma262/#sec-proxycreate (steps 2, 4)

  • runtime/ProxyObject.cpp:

(JSC::ProxyObject::structureForTarget):
(JSC::ProxyObject::finishCreation):

Location:
trunk
Files:
2 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChakraCore.yaml

    r259564 r260621  
    16931693  cmd: runChakra :pass, "NoException", "", ["../UnitTestFramework/UnitTestFramework.js"]
    16941694- path: ChakraCore/test/es6/proxyTrapConsumeNewTarget.js
    1695   # Different behavior.
    1696   cmd: runChakra :skip, "NoException", "", ["../UnitTestFramework/UnitTestFramework.js"]
     1695  cmd: runChakra :pass, "NoException", "", ["../UnitTestFramework/UnitTestFramework.js"]
    16971696- path: ChakraCore/test/es6/CrossContextSpreadfunctionCall.js
    16981697  # LoadScriptFile polyfill doesn't return an object.
     
    17441743  cmd: runChakra :skipDueToOutdatedOrBadTest, "NoException", "", []
    17451744- path: ChakraCore/test/es6/proxy-issue884.js
    1746   # Different behavior.
    1747   cmd: runChakra :skip, "NoException", "proxy-issue884.baseline", []
     1745  cmd: runChakra :pass, "NoException", "proxy-issue884.baseline", []
    17481746- path: ChakraCore/test/es6/nullPropertyDescriptor.js
    17491747  cmd: runChakra :pass, "NoException", "", []
     
    18491847  cmd: runChakra :pass, "NoException", "", ["../UnitTestFramework/UnitTestFramework.js"]
    18501848- path: ChakraCore/test/es6/arraywithproxy.js
    1851   # Different behavior, cannot convert Symbol to string. Could be bad test.
    1852   cmd: runChakra :skip, "NoException", "arraywithproxy.baseline", []
     1849  cmd: runChakra :skipDueToOutdatedOrBadTest, "NoException", "", []
    18531850- path: ChakraCore/test/es6/proxytest8.js
    18541851  cmd: runChakra :baseline, "NoException", "proxytest8.baseline", []
    18551852- path: ChakraCore/test/es6/proxytest9.js
    1856   # Different behavior.
    1857   cmd: runChakra :skip, "NoException", "proxytest9.baseline", []
     1853  cmd: runChakra :skipDueToOutdatedOrBadTest, "NoException", "", []
    18581854- path: ChakraCore/test/es6/ES6Function_bugs.js
    18591855  cmd: runChakra :pass, "NoException", "", ["../UnitTestFramework/UnitTestFramework.js"]
  • trunk/JSTests/ChangeLog

    r260601 r260621  
     12020-04-23  Alexey Shvayka  <shvaikalesh@gmail.com>
     2
     3        Remove revoked Proxy checks from ProxyCreate
     4        https://bugs.webkit.org/show_bug.cgi?id=210862
     5
     6        Reviewed by Ross Kirsling.
     7
     8        Removes expectations for 2 invalid ChakraCore tests.
     9
     10        * ChakraCore.yaml: Mark 2 test cases as passing.
     11        * ChakraCore/test/es6/arraywithproxy.baseline: Removed.
     12        * ChakraCore/test/es6/proxytest9.baseline: Removed.
     13        * stress/proxy-revoke.js: Adjust test.
     14        * test262/expectations.yaml: Mark 12 test cases as passing.
     15
    1162020-04-23  Ross Kirsling  <ross.kirsling@sony.com>
    217
  • trunk/JSTests/stress/proxy-revoke.js

    r248880 r260621  
    9696            } catch(e) {
    9797                threw = true;
    98                 assert(e.toString() === "TypeError: A Proxy's 'target' shouldn't be a revoked Proxy");
    9998            }
    100             assert(threw);
     99            assert(!threw);
    101100        }
    102101        foo();
  • trunk/JSTests/test262/expectations.yaml

    r260601 r260621  
    12531253  default: 'Test262Error: Expected a TypeError but got a TypeError'
    12541254  strict mode: 'Test262Error: Expected a TypeError but got a TypeError'
    1255 test/built-ins/Proxy/create-handler-is-revoked-proxy.js:
    1256   default: "TypeError: A Proxy's 'handler' shouldn't be a revoked Proxy"
    1257   strict mode: "TypeError: A Proxy's 'handler' shouldn't be a revoked Proxy"
    1258 test/built-ins/Proxy/create-target-is-revoked-function-proxy.js:
    1259   default: "TypeError: A Proxy's 'target' shouldn't be a revoked Proxy"
    1260   strict mode: "TypeError: A Proxy's 'target' shouldn't be a revoked Proxy"
    1261 test/built-ins/Proxy/create-target-is-revoked-proxy.js:
    1262   default: "TypeError: A Proxy's 'target' shouldn't be a revoked Proxy"
    1263   strict mode: "TypeError: A Proxy's 'target' shouldn't be a revoked Proxy"
    12641255test/built-ins/Proxy/get-fn-realm-recursive.js:
    12651256  default: 'Test262Error: Expected true but got false'
     
    12741265  default: 'Test262Error: Expected SameValue(«true», «false») to be true'
    12751266  strict mode: 'Test262Error: Expected SameValue(«true», «false») to be true'
    1276 test/built-ins/Proxy/revocable/handler-is-revoked-proxy.js:
    1277   default: "TypeError: A Proxy's 'handler' shouldn't be a revoked Proxy"
    1278   strict mode: "TypeError: A Proxy's 'handler' shouldn't be a revoked Proxy"
    1279 test/built-ins/Proxy/revocable/target-is-revoked-function-proxy.js:
    1280   default: "TypeError: A Proxy's 'target' shouldn't be a revoked Proxy"
    1281   strict mode: "TypeError: A Proxy's 'target' shouldn't be a revoked Proxy"
    1282 test/built-ins/Proxy/revocable/target-is-revoked-proxy.js:
    1283   default: "TypeError: A Proxy's 'target' shouldn't be a revoked Proxy"
    1284   strict mode: "TypeError: A Proxy's 'target' shouldn't be a revoked Proxy"
    12851267test/built-ins/Reflect/ownKeys/order-after-define-property.js:
    12861268  default: 'Test262Error: Expected [Symbol(b), Symbol(a)] and [Symbol(a), Symbol(b)] to have the same contents. '
  • trunk/Source/JavaScriptCore/ChangeLog

    r260585 r260621  
     12020-04-23  Alexey Shvayka  <shvaikalesh@gmail.com>
     2
     3        Remove revoked Proxy checks from ProxyCreate
     4        https://bugs.webkit.org/show_bug.cgi?id=210862
     5
     6        Reviewed by Ross Kirsling.
     7
     8        This change removes revoked Proxy checks from ProxyCreate [1], implementing
     9        https://github.com/tc39/ecma262/pull/1814 and aligning JSC with SpiderMonkey.
     10        Also cleans up ProxyObject creation by using isFunction() instead of
     11        isCallable(), which are identical.
     12
     13        [1]: https://tc39.es/ecma262/#sec-proxycreate (steps 2, 4)
     14
     15        * runtime/ProxyObject.cpp:
     16        (JSC::ProxyObject::structureForTarget):
     17        (JSC::ProxyObject::finishCreation):
     18
    1192020-04-22  Keith Miller  <keith_miller@apple.com>
    220
  • trunk/Source/JavaScriptCore/runtime/ProxyObject.cpp

    r260447 r260621  
    7272Structure* ProxyObject::structureForTarget(JSGlobalObject* globalObject, JSValue target)
    7373{
    74     if (!target.isObject())
    75         return globalObject->proxyObjectStructure();
    76 
    77     JSObject* targetAsObject = jsCast<JSObject*>(target);
    78     CallData ignoredCallData;
    79     VM& vm = globalObject->vm();
    80     bool isCallable = targetAsObject->methodTable(vm)->getCallData(targetAsObject, ignoredCallData) != CallType::None;
    81     return isCallable ? globalObject->callableProxyObjectStructure() : globalObject->proxyObjectStructure();
     74    VM& vm = globalObject->vm();
     75    return target.isFunction(vm) ? globalObject->callableProxyObjectStructure() : globalObject->proxyObjectStructure();
    8276}
    8377
     
    9185        return;
    9286    }
    93     if (ProxyObject* targetAsProxy = jsDynamicCast<ProxyObject*>(vm, target)) {
    94         if (targetAsProxy->isRevoked()) {
    95             throwTypeError(globalObject, scope, "A Proxy's 'target' shouldn't be a revoked Proxy"_s);
    96             return;
    97         }
    98     }
    9987    if (!handler.isObject()) {
    10088        throwTypeError(globalObject, scope, "A Proxy's 'handler' should be an Object"_s);
    10189        return;
    10290    }
    103     if (ProxyObject* handlerAsProxy = jsDynamicCast<ProxyObject*>(vm, handler)) {
    104         if (handlerAsProxy->isRevoked()) {
    105             throwTypeError(globalObject, scope, "A Proxy's 'handler' shouldn't be a revoked Proxy"_s);
    106             return;
    107         }
    108     }
    10991
    11092    JSObject* targetAsObject = jsCast<JSObject*>(target);
    11193
    112     CallData ignoredCallData;
    113     m_isCallable = targetAsObject->methodTable(vm)->getCallData(targetAsObject, ignoredCallData) != CallType::None;
     94    m_isCallable = targetAsObject->isFunction(vm);
    11495    if (m_isCallable) {
    11596        TypeInfo info = structure(vm)->typeInfo();
     
    11798    }
    11899
    119     m_isConstructible = jsCast<JSObject*>(target)->isConstructor(vm);
     100    m_isConstructible = targetAsObject->isConstructor(vm);
    120101
    121102    m_target.set(vm, this, targetAsObject);
Note: See TracChangeset for help on using the changeset viewer.