Re: [heycam/webidl] Use [[isExtensible]] over prose. (#197)

domenic approved this pull request.



> +<h4 id="preventextensions">Platform object \[[PreventExtensions]] method</h4>
+
+When the \[[PreventExtensions]] internal method of a [=platform object=] |O| is called,
+the following steps are taken:
+
+<ol class="algorithm">
+    1.  If |O| [=support indexed properties|supports indexed properties=] or
+        |O| [=support named properties|supports named properties=], 
+        return <emu-val>false</emu-val>.
+    1.  Return [=OrdinaryPreventExtensions=](|O|).
+</ol>
+
+Note: this turns the internal \[[PreventExtensions]] method
+of [=platform objects=] which [=support indexed properties|support indexed=] or
+[=support named properties|named properties=] into a noop,
+keeping them extensible, as failing to do so would make them non-functional.

The reason is more that it would cause [[GetOwnProperty]] to violate [the invariants of internal methods](https://tc39.github.io/ecma262/#sec-invariants-of-the-essential-internal-methods) (last invariant in the GOP section), since in an object with named/indexed properties, GetOwnProperty returns new properties all the time (whenever the underlying data changes).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/pull/197#pullrequestreview-5356676

Received on Saturday, 22 October 2016 21:24:12 UTC