-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normative: add globalThis
#702
Conversation
Note: do not merge until stage 4 - an approved PR is now a pre-stage-4 requirement. |
For context, the name |
- Adds intrinsic `%GlobalThisValue%` - Sets it in `SetRealmGlobalObject` - Adds global name `globalThis` Per tc39/proposal-global#12
- Adds intrinsic `%GlobalThisValue%` - Sets it in `SetRealmGlobalObject` - Adds global name `globalThis` Per tc39/proposal-global#12
FYI to TC39: there is an interesting question of what globalThis should be for discarded windows. (I.e. those whose parent iframe was @annevk filed a bug on Safari to align their window/self/frames with Chrome/Firefox, and also with their own globalThis implementation. So, there is no action here for TC39, but I thought it'd be interesting to know. |
- Adds intrinsic `%GlobalThisValue%` - Sets it in `SetRealmGlobalObject` - Adds global name `globalThis` Per tc39/proposal-global#12
- Adds intrinsic `%GlobalThisValue%` - Sets it in `SetRealmGlobalObject` - Adds global name `globalThis` Per tc39/proposal-global#12
spec.html
Outdated
@@ -23338,6 +23337,12 @@ <h1>The Global Object</h1> | |||
<emu-clause id="sec-value-properties-of-the-global-object"> | |||
<h1>Value Properties of the Global Object</h1> | |||
|
|||
<emu-clause id="sec-global-this"> | |||
<h1>globalThis</h1> | |||
<p>The initial value of `globalThis` is the value of the field of (the value of the field of the Realm Record named [[GlobalEnv]]) named [[GlobalThisValue]]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this phrasing is super awkward. Any recommendations of how to do this cleaner without algorithm steps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<p>The initial value of `globalThis` is the value of the field of (the value of the field of the Realm Record named [[GlobalEnv]]) named [[GlobalThisValue]]. | |
<p>The initial value of the `globalThis` property of the global object of a realm _realm_ is the value of `_realm_.[[GlobalEnv]].[[GlobalThisValue]]`.</p> |
That fudges the distinction between a realm and a Realm Record, so you could say ... of a realm represented by the Realm Record _realm_ ...
, but I'm doubtful that'd be better.
- Adds intrinsic `%GlobalThisValue%` - Sets it in `SetRealmGlobalObject` - Adds global name `globalThis` Per tc39/proposal-global#12
- Adds intrinsic `%GlobalThisValue%` - Sets it in `SetRealmGlobalObject` - Adds global name `globalThis` Per tc39/proposal-global#12
- Adds intrinsic `%GlobalThisValue%` - Sets it in `SetRealmGlobalObject` - Adds global name `globalThis` Per tc39/proposal-global#12
- Adds intrinsic `%GlobalThisValue%` - Sets it in `SetRealmGlobalObject` - Adds global name `globalThis` Per tc39/proposal-global#12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks okay to me.
- Adds intrinsic `%GlobalThisValue%` - Sets it in `SetRealmGlobalObject` - Adds global name `globalThis` Per tc39/proposal-global#12
Language from tc39/ecma262#702. Tests: web-platform-tests/wpt#15720. Helps with #4363.
Before this change these getters did not account for Window object's browsing context potentially being null, resulting in a conceptual crash. Language from tc39/ecma262#702. Tests: web-platform-tests/wpt#15720. Helps with #4363.
Before this change these getters did not account for Window object's browsing context potentially being null, resulting in a conceptual crash. Language from tc39/ecma262#702. Tests: web-platform-tests/wpt#15720. Helps with #4363.
%GlobalThisValue%
SetRealmGlobalObject
globalThis
Per tc39/proposal-global#12