From a17204e7d1b17c013ad8ecd5030ba6716faff6c6 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 28 Sep 2016 17:01:57 -0700 Subject: [PATCH] Normative: add `globalThis` (#702) - Adds intrinsic `%GlobalThisValue%` - Sets it in `SetRealmGlobalObject` - Adds global name `globalThis` Per https://github.com/tc39/proposal-global/issues/12 --- spec.html | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/spec.html b/spec.html index 388fdc5ea6b..849e011c74b 100644 --- a/spec.html +++ b/spec.html @@ -3079,6 +3079,17 @@

Well-Known Intrinsic Objects

The initial value of the `prototype` data property of %Generator%; i.e., %Generator.prototype% + + + %GlobalThisValue% + + + `globalThis` + + + The initial value of the `globalThis` property of the global object + + %Int8Array% @@ -7280,11 +7291,12 @@

CreateIntrinsics ( _realmRec_ )

SetRealmGlobalObject ( _realmRec_, _globalObj_, _thisValue_ )

The abstract operation SetRealmGlobalObject with arguments _realmRec_, _globalObj_, and _thisValue_ performs the following steps:

+ 1. Let _intrinsics_ be _realmRec_.[[Intrinsics]]. 1. If _globalObj_ is *undefined*, then - 1. Let _intrinsics_ be _realmRec_.[[Intrinsics]]. 1. Set _globalObj_ to ObjectCreate(_intrinsics_.[[%Object.prototype%]]). 1. Assert: Type(_globalObj_) is Object. 1. If _thisValue_ is *undefined*, set _thisValue_ to _globalObj_. + 1. Set _intrinsics_.[[%GlobalThisValue%]] to _thisValue_. 1. Set _realmRec_.[[GlobalObject]] to _globalObj_. 1. Let _newGlobalEnv_ be NewGlobalEnvironment(_globalObj_, _thisValue_). 1. Set _realmRec_.[[GlobalEnv]] to _newGlobalEnv_. @@ -25258,6 +25270,12 @@

Math

Reflect

See .

+ + +

globalThis

+

The initial value of `globalThis` is the well-known intrinsic object %GlobalThisValue%.

+

This property has the attributes { [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

+