Status: New
Owner: ----

New issue 3052 by [email protected]: Function.prototype.apply() & Function.prototype.call() with `undefined` or `null` as `thisArg`
http://code.google.com/p/v8/issues/detail?id=3052

http://ecma-international.org/ecma-262/5.1/#sec-15.3.4.3
http://ecma-international.org/ecma-262/5.1/#sec-15.3.4.4

The `thisArg` value is passed without modification as the `this` value. This is a change from Edition 3, where a `undefined` or `null` `thisArg` is replaced with the global object and `ToObject` is applied to all other values and that result is passed as the `this` value.

It seems like V8 still has the ES3 behavior:

    function foo() {
      console.log(this);
      return this;
    };
    foo.call(undefined) === undefined; // `false`, expected `true`

It seems other engines have the same behavior, though. Spidermonkey/Firefox, Carakan/PrestOpera, JSC/Safari, and v8/Chrome all show FAIL in this test case:

data:text/html,<script>function foo() { console.log(this); return this; }; document.write(foo.call(undefined) === undefined %3F 'PASS' %3A 'FAIL');</script>

Is this a wilful violation of the ES5 spec for back-compat reasons, or is it just an oversight that this never got implemented?

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to