Ah, I'm much more comfortable with that. Martin, that means that we don't need to do anything here at this point since we don't have strict mode. Once we have strict mode we should add a check to see if the function invoked is a strict mode function and not perform the conversion in that case.
Thanks Kasper! -- Mads On Thu, Jan 6, 2011 at 1:26 PM, Kasper Lund <[email protected]> wrote: > Another relevant part of the ES5 specification is: > > 10.4.3 Entering Function Code > The following steps are performed when control enters the execution > context for function code contained in > function object F, a caller provided thisArg, and a caller provided > argumentsList: > 1. If the function code is strict code, set the ThisBinding to thisArg. > 2. Else if thisArg is null or undefined, set the ThisBinding to the > global object. > > Cheers, > Kasper > > 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 >> > -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
