According to the spec. it should alert the global object:
The reference to foo resolves to a Reference to an object environment record.  
When getValue is called on  that reference it goes through step 5.a and calls 
GetBindingValue on the env record.  GetBindingValue does a [[Get]] on the 
global object.  [[Get]] internally retrieves an accessor property and does a 
call to the [[Get]] function passing the global objet as the this value.

Allen


On May 2, 2011, at 4:43 PM, Mark S. Miller wrote:

> According to the ES5 spec, should the following program alert the global 
> object or undefined? Why?
> 
>     Object.defineProperty(this, 'foo', {get:function(){"use strict"; return 
> this;}});
>     alert((function(){"use strict"; return foo;})());
> 
> 
> -- 
>     Cheers,
>     --MarkM
> _______________________________________________
> es5-discuss mailing list
> es5-disc...@mozilla.org
> https://mail.mozilla.org/listinfo/es5-discuss

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to