Modified: trunk/JSTests/test262/expectations.yaml (260653 => 260654)
--- trunk/JSTests/test262/expectations.yaml 2020-04-24 17:50:41 UTC (rev 260653)
+++ trunk/JSTests/test262/expectations.yaml 2020-04-24 17:53:26 UTC (rev 260654)
@@ -1261,9 +1261,6 @@
test/built-ins/Proxy/ownKeys/trap-is-undefined-target-is-proxy.js:
default: 'Test262Error: Expected [length, foo, 0, Symbol()] and [Symbol(), length, foo, 0] to have the same contents. '
strict mode: 'Test262Error: Expected [length, foo, 0, Symbol()] and [Symbol(), length, foo, 0] to have the same contents. '
-test/built-ins/Proxy/revocable/builtin.js:
- default: 'Test262Error: Expected SameValue(«true», «false») to be true'
- strict mode: 'Test262Error: Expected SameValue(«true», «false») to be true'
test/built-ins/Reflect/ownKeys/order-after-define-property.js:
default: 'Test262Error: Expected [Symbol(b), Symbol(a)] and [Symbol(a), Symbol(b)] to have the same contents. '
strict mode: 'Test262Error: Expected [Symbol(b), Symbol(a)] and [Symbol(a), Symbol(b)] to have the same contents. '
Modified: trunk/Source/_javascript_Core/ChangeLog (260653 => 260654)
--- trunk/Source/_javascript_Core/ChangeLog 2020-04-24 17:50:41 UTC (rev 260653)
+++ trunk/Source/_javascript_Core/ChangeLog 2020-04-24 17:53:26 UTC (rev 260654)
@@ -1,3 +1,26 @@
+2020-04-24 Alexey Shvayka <[email protected]>
+
+ Proxy.revocable should not have [[Construct]] slot
+ https://bugs.webkit.org/show_bug.cgi?id=210959
+
+ Reviewed by Darin Adler.
+
+ This change removes proxyRevocableConstructorThrowError() since its presence is
+ observable when, for example, Proxy.revocable is a [[ProxyTarget]] itself [1].
+ Also removes unnecessary newTarget() check in constructProxyObject() and
+ 2 extra ArgList instances.
+
+ This patch aligns JSC with the spec [2], V8 and SpiderMonkey.
+
+ [1]: https://tc39.es/ecma262/#sec-proxycreate (step 7.b)
+ [2]: https://tc39.es/ecma262/#sec-ecmascript-standard-built-in-objects
+
+ * runtime/ProxyConstructor.cpp:
+ (JSC::makeRevocableProxy):
+ (JSC::ProxyConstructor::finishCreation):
+ (JSC::constructProxyObject):
+ (JSC::proxyRevocableConstructorThrowError): Deleted.
+
2020-04-24 Yusuke Suzuki <[email protected]>
[JSC] DFG AI for some bitops + BigInt32 should be precise
Modified: trunk/Source/_javascript_Core/runtime/ProxyConstructor.cpp (260653 => 260654)
--- trunk/Source/_javascript_Core/runtime/ProxyConstructor.cpp 2020-04-24 17:50:41 UTC (rev 260653)
+++ trunk/Source/_javascript_Core/runtime/ProxyConstructor.cpp 2020-04-24 17:53:26 UTC (rev 260654)
@@ -63,16 +63,14 @@
if (callFrame->argumentCount() < 2)
return throwVMTypeError(globalObject, scope, "Proxy.revocable needs to be called with two arguments: the target and the handler"_s);
- ArgList args(callFrame);
- JSValue target = args.at(0);
- JSValue handler = args.at(1);
+ JSValue target = callFrame->argument(0);
+ JSValue handler = callFrame->argument(1);
ProxyObject* proxy = ProxyObject::create(globalObject, target, handler);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
ProxyRevoke* revoke = ProxyRevoke::create(vm, globalObject->proxyRevokeStructure(), proxy);
- RETURN_IF_EXCEPTION(scope, encodedJSValue());
+ scope.assertNoException();
JSObject* result = constructEmptyObject(globalObject);
- RETURN_IF_EXCEPTION(scope, encodedJSValue());
result->putDirect(vm, makeIdentifier(vm, "proxy"), proxy, static_cast<unsigned>(PropertyAttribute::None));
result->putDirect(vm, makeIdentifier(vm, "revoke"), revoke, static_cast<unsigned>(PropertyAttribute::None));
@@ -79,29 +77,18 @@
return JSValue::encode(result);
}
-static EncodedJSValue JSC_HOST_CALL proxyRevocableConstructorThrowError(JSGlobalObject* globalObject, CallFrame*)
-{
- auto scope = DECLARE_THROW_SCOPE(globalObject->vm());
- return throwVMTypeError(globalObject, scope, "Proxy.revocable cannot be constructed. It can only be called"_s);
-}
-
void ProxyConstructor::finishCreation(VM& vm, const char* name, JSGlobalObject* globalObject)
{
Base::finishCreation(vm, name, NameAdditionMode::WithStructureTransition);
putDirect(vm, vm.propertyNames->length, jsNumber(2), PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly);
- putDirect(vm, makeIdentifier(vm, "revocable"), JSFunction::create(vm, globalObject, 2, "revocable"_s, makeRevocableProxy, NoIntrinsic, proxyRevocableConstructorThrowError));
+ putDirect(vm, makeIdentifier(vm, "revocable"), JSFunction::create(vm, globalObject, 2, "revocable"_s, makeRevocableProxy));
}
static EncodedJSValue JSC_HOST_CALL constructProxyObject(JSGlobalObject* globalObject, CallFrame* callFrame)
{
- auto scope = DECLARE_THROW_SCOPE(globalObject->vm());
- if (callFrame->newTarget().isUndefined())
- return throwVMTypeError(globalObject, scope, "new.target of Proxy construct should not be undefined"_s);
-
- ArgList args(callFrame);
- JSValue target = args.at(0);
- JSValue handler = args.at(1);
- RELEASE_AND_RETURN(scope, JSValue::encode(ProxyObject::create(globalObject, target, handler)));
+ JSValue target = callFrame->argument(0);
+ JSValue handler = callFrame->argument(1);
+ return JSValue::encode(ProxyObject::create(globalObject, target, handler));
}
static EncodedJSValue JSC_HOST_CALL callProxy(JSGlobalObject* globalObject, CallFrame*)