9.1.2 [[SetPrototypeOf]] (V)

# raul mihaila (11 years ago)

While reading the SetPrototypeOf algorithm I noticed that some steps are repeated. At step 5, if O.[[Extensible]] is false, the method returns false. But at step 8, the same condition is checked again. It seems to me that between these steps neither the value of O, nor the value of O.[[Extensible]] changes. Aren't steps 7 and 8 redundant?

# Till Schneidereit (11 years ago)

The second set of checks is needed because step 6 might change the results: if one of the objects iterated over in step 6 is a proxy, then arbitrary code can be executed through an invocation of its getPrototypeOf handler. This code might make O inextensible or change its __proto__ to be the same value as V.