Status: Accepted
Owner: ----
Labels: Type-Bug Priority-Medium ES5

New issue 1365 by [email protected]: Calling functions through variables doesn't use undefined as receiver.
http://code.google.com/p/v8/issues/detail?id=1365

When you call a function through an environment variable, e.g.
  var v = Object.prototype.valueOf
  v();  // <-- this call
the ES5 specification says that the this-value of the call should be the undefined value. We optimistically convert that to the global object, even for strict mode functions and builtin functions.

The above call should throw an exception (attempt to use ToObject on undefined) but instead returns the global object.
Ditto for
 "use strict";
 function foo() { return this; }
 foo();  // returns global object

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

Reply via email to