Reimplement [[SetPrototypeOf]](V) and Object.setPrototypeOf(O, proto) according to 6.0 (#377)

* Don't throw type error with Reflect.setPrototypeOf
* Pass more test262 tests

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
This commit is contained in:
Boram Bae 2019-08-19 16:52:09 +09:00 committed by Patrick Kim
commit 8e4f170f3f
5 changed files with 66 additions and 38 deletions

View file

@ -672,10 +672,6 @@ bool ProxyObject::setPrototype(ExecutionState& state, const Value& value)
bool booleanTrapResult;
Value arguments[] = { target, value };
booleanTrapResult = Object::call(state, trap, handler, 2, arguments).toBoolean(state);
if (!booleanTrapResult) {
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, strings->Proxy.string(), false, String::emptyString, "%s: Proxy setPrototypeOf could not set the prototype.");
return false;
}
// 11. Let extensibleTarget be IsExtensible(target).
bool extensibleTarget = target.asObject()->isExtensible(state);