Status: New
Owner: ----

New issue 1547 by [email protected]: Wrong global in cross-frame this-coercion
http://code.google.com/p/v8/issues/detail?id=1547

The attached file renders

    (1,f)(): inner

on Chrome 14.0.803.0 dev, whereas it renders

    (1,f)(): outer

as it should on Safari Version 5.0.5 (5533.21.1), WebKit Nightly Version 5.0.5 (5533.21.1, r90681), Firefox 5.0, and Firefox Nightly 8.0a1 (2011-07-09).

Technically, this issue falls between the gaps of various specs, since the ES5.1 spec does not admit the existence of multiple globals. Nevertheless, from the perspective of ES5.1 semantics, only the latter behavior makes sense, since the caller passes undefined as the this-binding and only the callee coerces the undefined to the global object. Since the callee does not and should not know the caller's global object, the global object it should coerce to is its own. This corresponds to a lexical understanding of "which global", which is what ES-next is expected to specify.

Note that the similar https://bugzilla.mozilla.org/show_bug.cgi?id=634590 issue did arrive at the opposite result, that f() should return "inner". This likewise makes no sense, as that bug thread admits, but is unfortunately needed for backward compatibility. The nonsensical behavior in this case is already a de-facto standard across as least all the same browsers listed about, including Chrome. (I haven't yet tested any of this on IE10preview.) But for (1,f)(), de-facto agreement among other browsers agrees with sense, so we should fix Chrome to match.

See also the thread beginning at https://mail.mozilla.org/pipermail/es5-discuss/2011-July/004018.html .

Please tag with ES5. Thanks.


Attachments:
        inner-out2.html  220 bytes

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to