{"action":"created","issue":{"url":"https://api.github.com/repos/tc39/test262/issues/568","repository_url":"https://api.github.com/repos/tc39/test262","labels_url":"https://api.github.com/repos/tc39/test262/issues/568/labels{/name}","comments_url":"https://api.github.com/repos/tc39/test262/issues/568/comments","events_url":"https://api.github.com/repos/tc39/test262/issues/568/events","html_url":"https://github.com/tc39/test262/issues/568","id":145738641,"number":568,"title":"Reducing reliance on fnGlobalObject.js","user":{"login":"jugglinmike","id":677252,"avatar_url":"https://avatars.githubusercontent.com/u/677252?v=3","gravatar_id":"","url":"https://api.github.com/users/jugglinmike","html_url":"https://github.com/jugglinmike","followers_url":"https://api.github.com/users/jugglinmike/followers","following_url":"https://api.github.com/users/jugglinmike/following{/other_user}","gists_url":"https://api.github.com/users/jugglinmike/gists{/gist_id}","starred_url":"https://api.github.com/users/jugglinmike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jugglinmike/subscriptions","organizations_url":"https://api.github.com/users/jugglinmike/orgs","repos_url":"https://api.github.com/users/jugglinmike/repos","events_url":"https://api.github.com/users/jugglinmike/events{/privacy}","received_events_url":"https://api.github.com/users/jugglinmike/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-04T16:41:09Z","updated_at":"2016-04-27T18:38:41Z","closed_at":"2016-04-27T18:38:41Z","body":"While reviewing [gh-567: \"Add `System.global` tests\"](https://github.com/tc39/test262/pull/567), I was about to suggest the use of [the `fnGlobalObject` helper function](https://github.com/tc39/test262/blob/755b0d61171a7b16fd81979bc8d6f24bb832ecc6/harness/fnGlobalObject.js) instead of a simple `this` reference to test the property value.\r\n\r\nI'm not sure this is necessary, though, and really, I'm not sure `fnGlobalObject` is necessary in *any* case that Test262 currently uses it.\r\n\r\nTest runners are required to execute test contents in the global scope--anything else would invalidate certain tests. The `this` keyword has long (always?) been specified as returning the global object when evaluated in global code.\r\n\r\nIf this is true, I would be in favor of simplifying the ~200 tests that include `fnGlobalObject.js` to reference `this` directly, and (more importantly) reducing the domain-specific knowledge required to author new tests.\r\n\r\nI'd like to keep the helper around, though, because it will still be necessary for accessing the global from module code (see [gh-562: \"Module semantics: declaration instantiation\"](https://github.com/tc39/test262/pull/562)), and it seems possible that security restrictions (e.g. CSP in web browsers) may lead some consumers to look for a mechanism to override that function.\r\n\r\nIf there is some detail that I'm overlooking, then I'm happy to leave the usage as-is (although I may want to document the use case(s) as an in-line comment in `fnGlobalObject.js` itself).\r\n\r\n\r\nFrom ES5's [11.1.1 The this Keyword](https://es5.github.io/#x11.1.1):\r\n\r\n> The this keyword evaluates to the value of the ThisBinding of the current\r\n> execution context.\r\n\r\nAnd from [10.4.1.1 Initial Global Execution Context](https://es5.github.io/#x10.4.1.1):\r\n\r\n> The following steps are performed to initialize a global execution context\r\n> for ECMAScript code C:\r\n>\r\n> 1. Set the VariableEnvironment to the Global Environment.\r\n> 2. Set the LexicalEnvironment to the Global Environment.\r\n> 3. Set the ThisBinding to the global object."},"comment":{"url":"https://api.github.com/repos/tc39/test262/issues/comments/215185987","html_url":"https://github.com/tc39/test262/issues/568#issuecomment-215185987","issue_url":"https://api.github.com/repos/tc39/test262/issues/568","id":215185987,"user":{"login":"jugglinmike","id":677252,"avatar_url":"https://avatars.githubusercontent.com/u/677252?v=3","gravatar_id":"","url":"https://api.github.com/users/jugglinmike","html_url":"https://github.com/jugglinmike","followers_url":"https://api.github.com/users/jugglinmike/followers","following_url":"https://api.github.com/users/jugglinmike/following{/other_user}","gists_url":"https://api.github.com/users/jugglinmike/gists{/gist_id}","starred_url":"https://api.github.com/users/jugglinmike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jugglinmike/subscriptions","organizations_url":"https://api.github.com/users/jugglinmike/orgs","repos_url":"https://api.github.com/users/jugglinmike/repos","events_url":"https://api.github.com/users/jugglinmike/events{/privacy}","received_events_url":"https://api.github.com/users/jugglinmike/received_events","type":"User","site_admin":false},"created_at":"2016-04-27T18:38:41Z","updated_at":"2016-04-27T18:38:41Z","body":"Resolved via gh-595"}}