From 36882a28e27e7d473d71de2415fe629d0b36b931 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Tue, 10 Mar 2020 21:08:07 -0400 Subject: [PATCH] Fix: AggregateError/newtarget-proto-fallback. Closes gh-2515 (#2518) --- .../newtarget-proto-fallback.js | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/test/built-ins/AggregateError/newtarget-proto-fallback.js b/test/built-ins/AggregateError/newtarget-proto-fallback.js index 9f921ab97e..096fa0adfa 100644 --- a/test/built-ins/AggregateError/newtarget-proto-fallback.js +++ b/test/built-ins/AggregateError/newtarget-proto-fallback.js @@ -30,33 +30,29 @@ info: | features: [AggregateError, Symbol] ---*/ -var custom = { x: 42 }; -var ctor = function() {}; -Object.setPrototypeOf(ctor, custom); - -var values = [ +const values = [ undefined, null, 42, false, true, Symbol(), - 'string' + 'string', + AggregateError.prototype, ]; +const NewTarget = new Function(); + for (const value of values) { - const newt = new Proxy(ctor, { + const NewTargetProxy = new Proxy(NewTarget, { get(t, p) { if (p === 'prototype') { return value; } - return t[p]; } }); - const obj = Reflect.construct(AggregateError, [[]], newt); - - assert.sameValue(Object.getPrototypeOf(obj), custom); - assert.sameValue(obj.x, 42); + const error = Reflect.construct(AggregateError, [[]], NewTargetProxy); + assert.sameValue(Object.getPrototypeOf(error), AggregateError.prototype); }