Reflection of global bindings
bruant.d at gmail.com
Sat Dec 15 09:21:47 PST 2012
On public-script-coord, Boris Zbarsky showed an example  where a
global variable is var-defined and then observed to be absent from the
global object it was attached to (because the WindowProxy has changed of
underlying window object).
The careful ECMAScript 5.1 reader knows that global var-defined
variables are supposed to be reflected as own non-configurable
properties of the global object. Reflecting the property as such commits
the object to keep the property forever which, as we've seen in Boris
example, is not compatible with how the web works.
I don't think it'll be possible to change how global objects in
same-origin iframes work nor relax ES5 invariants; so my proposal is to
have var/let/const/function global declarations *reflected* as
configurable, but acting as if they were not.
This would also require a couple of changes in the spec and consequently
JS engines and certainly test262.
Other proposals welcome, of course.
More information about the es-discuss