fixes #306
@@ -1229,3 +1229,16 @@ func TestProxyExport(t *testing.T) {
t.Fatalf("Export returned unexpected type: %T", v1)
}
+
+func TestProxy_proxy_createTargetNotCallable(t *testing.T) {
+ // from https://github.com/tc39/test262/blob/main/test/built-ins/Proxy/create-target-is-not-callable.js
+ const SCRIPT = `
+ var p = new Proxy({}, {});
+ assert.throws(TypeError, function() {
+ p();
+ });
+ `
+ testScript1(TESTLIB+SCRIPT, _undefined, t)
+}
@@ -848,7 +848,7 @@ func (p *proxyObject) assertConstructor() func(args []Value, newTarget *Object)
func (p *proxyObject) apply(call FunctionCall) Value {
if p.call == nil {
- p.val.runtime.NewTypeError("proxy target is not a function")
+ panic(p.val.runtime.NewTypeError("proxy target is not a function"))
if v, ok := p.checkHandler().apply(p.target, nilSafe(call.This), call.Arguments); ok {
return v