Martin, I have not looked at the code yet, but do any other browsers implement this change in the spec? To me, this looks like something that can break existing websites massively and that makes me a bit nervous. I think it is a very usual thing to do to use both call and apply with null as the first argument. My guess would be that many of those calls will (intentionally or not) rely on the conversion from null to the global object.
I will have a look at the code soon, but before landing something like this we will need to build chrome with this change and check that top web pages do not break. Cheers, -- Mads On Thu, Jan 6, 2011 at 1:20 AM, <[email protected]> wrote: > It is probably worth mentioning the relevant paragraphs in the ES spec. > > 15.3.4.3 (Function.prototype.apply) > 15.3.4.4 (Function.prototype.call) > > have changed between ES3 and ES5. > > In ES3: > If thisArg is null or undefined, the called function is passed the global > object > as the this value. > Otherwise, the called function is passed ToObject(thisArg) as the this > value. > > In ES5 the algorithm changed to not apply ToObject nor to substitute global > object for null or undefined. The note from the ES5 spec (15.3.4.3 and > 15.3.4.4): > > NOTE 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. > > > http://codereview.chromium.org/6087011/ > -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
