User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0) Gecko/20100101 Firefox/4.0
Build Identifier: FF4RC1
var globalObject = Function("return this;").call();
window === globalObject;
true in latest Chrome and Opera.
false in FF4RC1.
I have noticed it because Object.getOwnPropertyNames gave different results.
I have noticed it after noticing that Test262 Test 184.108.40.206-4-1 failed. The problem is that Error doesn't show up on as own keys. However, it's weird because while testing on the WebConsole several times, I have reproduced the non-appearance of all native built-in Errors, but at some point, they were listed.
For the record, "Function("return this;").call();" is a way to retrieve the global object in both non/strict mode.
You're testing this in the web console, aren't you? In the web console |this| is not the same thing as |window|.
This should not cause any Test262 tests to fail unless you're running them in the web console...
And in particular, in a web page the script you quote returns true, as you can check.
I have indeed tested on the WebConsole. Regardless, the test was run and failed in the normal environment (from http://test262.ecmascript.org/).
As said, at some point, on the web console. in neither of both object were present native Error built-in. However, this isn't consistent. At some point, they re-appeared.
> I have indeed tested on the WebConsole.
In WebConsole, |window| is the prototype of |this|.
> Regardless, the test was run and failed in the normal environment
Test 220.127.116.11-4-1 in test262 fails because we lazily resolve standard classes, not because of anything to do with |new Function("return this")|.
Should I report another bug then? You seem to know the cause, is there already a bug for this?
I change status as 'invalid' since this bug was due to the fact I didn't know about the this keyword in web console.
I add a dev-doc-needed keyword too.
And I changed the title to make it more easily searchable.
Jeff promised to file a bug about the standard class stuff, since he can describe it better than I can.
As a web console bug this is invalid, yes. The idea is to allow the user to define variables in the web console without polluting the page namespace.
I filed bug 641655 on the standard class stuff.
Added a note to: