diff --git a/test/language/identifier-resolution/assign-to-global-undefined.js b/test/language/identifier-resolution/assign-to-global-undefined.js index 4d6da1438ed..2a7f2600fa8 100644 --- a/test/language/identifier-resolution/assign-to-global-undefined.js +++ b/test/language/identifier-resolution/assign-to-global-undefined.js @@ -3,18 +3,18 @@ /*--- esid: sec-initializeboundname description: > - In strict mode code, attempts to assign to an unresolvable reference must throw a ReferenceError exception + In strict mode code, re-resolve unresolvable references on the global in PutValue. info: | via sec-putvalue If IsUnresolvableReference(V) is true, then If IsStrictReference(V) is true, then - Throw a ReferenceError exception. + Let realm be the current Realm Record. + Set V to ? ResolveBinding(realm.[[GlobalEnv]], name). + Assert: IsStrictReference(V) is true. + If IsUnresolvableReference(V) is true, throw a ReferenceError exception. flags: [onlyStrict] -negative: - phase: runtime - type: ReferenceError ---*/ undeclared = (this.undeclared = 5); diff --git a/test/language/identifier-resolution/assign-to-globalThis-undefined.js b/test/language/identifier-resolution/assign-to-globalThis-undefined.js new file mode 100644 index 00000000000..9795352836e --- /dev/null +++ b/test/language/identifier-resolution/assign-to-globalThis-undefined.js @@ -0,0 +1,20 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-initializeboundname +description: > + In strict mode code, re-resolve unresolvable references on the global in PutValue. +info: | + via sec-putvalue + + If IsUnresolvableReference(V) is true, then + If IsStrictReference(V) is true, then + Let realm be the current Realm Record. + Set V to ? ResolveBinding(realm.[[GlobalEnv]], name). + Assert: IsStrictReference(V) is true. + If IsUnresolvableReference(V) is true, throw a ReferenceError exception. + +flags: [onlyStrict] +---*/ + +undeclared = (globalThis.undeclared = 5);