diff --git a/include/hermes/VM/JSProxy.h b/include/hermes/VM/JSProxy.h index c2cb9fd97fe..993c42531b2 100644 --- a/include/hermes/VM/JSProxy.h +++ b/include/hermes/VM/JSProxy.h @@ -61,7 +61,9 @@ class JSProxy : public JSObject { static PseudoHandle create( Runtime *runtime, - Handle prototype); + Handle /* prototype */) { + return create(runtime); + } static void setTargetAndHandler( Handle selfHandle, diff --git a/lib/VM/JSProxy.cpp b/lib/VM/JSProxy.cpp index 2b32a3ea84f..ccc99cc5010 100644 --- a/lib/VM/JSProxy.cpp +++ b/lib/VM/JSProxy.cpp @@ -129,15 +129,6 @@ PseudoHandle JSProxy::create(Runtime *runtime) { return mem.initToPseudoHandle(proxy); } -PseudoHandle JSProxy::create( - Runtime *runtime, - Handle prototype) { - assert( - prototype.get() == runtime->objectPrototypeRawPtr && - "JSProxy::create() can only be used with object prototype"); - return create(runtime); -} - void JSProxy::setTargetAndHandler( Handle selfHandle, Runtime *runtime, diff --git a/test/hermes/proxy.js b/test/hermes/proxy.js index e7f59aeb6cc..a7db5e38e5f 100644 --- a/test/hermes/proxy.js +++ b/test/hermes/proxy.js @@ -2141,7 +2141,10 @@ assert.equal( var f = function() { return 1; } f.a = 1; f.b = 2; -checkDeep({...f})(_ => ({a:1, b:2})) +checkDeep({...f})(_ => ({a:1, b:2})); + +// newTarget.prototype for Proxy ctor is !== Object.prototype does not throw +Reflect.construct(Proxy, [{}, {}], WeakSet); // Check that defining a property in a Proxy target which is an array // uses fast array access (this will trip an assert otherwise)