Browse Source

Merge pull request #267 from MStoykov/addGlobalThis

Add globalThis
Dmitry Panov 4 years ago
parent
commit
bb14c2267b
2 changed files with 2 additions and 0 deletions
  1. 1 0
      builtin_global.go
  2. 1 0
      tc39_test.go

+ 1 - 0
builtin_global.go

@@ -328,6 +328,7 @@ func (r *Runtime) builtin_unescape(call FunctionCall) Value {
 
 
 func (r *Runtime) initGlobalObject() {
 func (r *Runtime) initGlobalObject() {
 	o := r.globalObject.self
 	o := r.globalObject.self
+	o._putProp("globalThis", r.globalObject, true, false, true)
 	o._putProp("NaN", _NaN, false, false, false)
 	o._putProp("NaN", _NaN, false, false, false)
 	o._putProp("undefined", _undefined, false, false, false)
 	o._putProp("undefined", _undefined, false, false, false)
 	o._putProp("Infinity", _positiveInf, false, false, false)
 	o._putProp("Infinity", _positiveInf, false, false, false)

+ 1 - 0
tc39_test.go

@@ -364,6 +364,7 @@ var (
 		"sec-strict-mode-of-ecmascript",
 		"sec-strict-mode-of-ecmascript",
 		"sec-let-and-const-declarations*",
 		"sec-let-and-const-declarations*",
 		"sec-arguments-exotic-objects-defineownproperty-p-desc",
 		"sec-arguments-exotic-objects-defineownproperty-p-desc",
+		"sec-other-properties-of-the-global-object-globalthis",
 	}
 	}
 )
 )