2.1.23 [ECMA-262/7] Section 19.1.2.18 Object.setPrototypeOf ( O, proto )
V0196: Object.setPrototypeOf throws an error immediately if parameter O is not an object
The specification states:
-
... Object.setPrototypeOf ( O, proto ) When the setPrototypeOf function is called with arguments O and proto, the following steps are taken: 1. Let O be ? RequireObjectCoercible(O). 2. If Type(proto) is neither Object nor Null, throw a TypeError exception. 3. If Type(O) is not Object, return O. 4. Let status be ? O.[[SetPrototypeOf]](proto). 5. If status is false, throw a TypeError exception. 6. Return O.
EdgeHTML Mode
ToObject(O) is done instead of
RequireObjectCoercible(O) in step 1. As a result, Object.setPrototypeOf
throws an error immediately if
parameter O is not an object.