On 6/5/15 11:19 AM, Domenic Denicola wrote:
> Boris, I know you have been looking into this area and making changes around some of the crazier or less-specified edge cases (e.g. [1], [2], probably more I am forgetting). Would you be willing to take a look at the doc?
Sure. A few comments:
1) I'm not sure whether the "The global object and the prototype chain
of Window interface" section is trying to describe the current Blink
implementation or the spec, but per spec the prototype chain of window
looks like this:
window -> Window.prototype -> named properties object ->
EventTarget.prototype -> Object.prototype
Window's named properties go on the "named properties object" per spec.
The only property that appears by default on Window.prototype is
"constructor". This should probably be added to the "Things we need to
fix" bit.
2) In the "What are visible and what are shadowed?" section, I assume
"JavaScript global variable creation" refers to "var" at toplevel in a
script, not to ES built-ins. If so, those variables are created after
the Window interface members, as the document says, because they're only
created the first time a toplevel script is run, whereas the global
object has to be created before you start running any scripts against
it. At least that's the only sane way to do it, imo.
3) "var addEventListener" is not quite identical to
"this.addEventListener = undefined" because the former creates a
non-configurable property. But apart from that, I agree with the two
case descriptions in the "What are visible and what are shadowed?" section.
4) Mostly agreed on the "Conclusion" section, with the caveat for
comment #1 above and the general understanding that this is a
qualitative description that glosses over details. For example,
deleting an interface property from window does not suddenly "unshadow"
a declared var that was declared before the delete, because the var
declaration was ignored due to the property already existing. But a var
declaration in a script that runs after the delete will define a global
variable.
Please do let me know if you run into more spec issues (esp. for the
named properties object) as you do this. I've tried to iron them out,
but the details of some edge cases here are ... complicated.
-Boris