summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/module-code/eval-this.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/language/module-code/eval-this.js
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/module-code/eval-this.js')
-rw-r--r--js/src/tests/test262/language/module-code/eval-this.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/module-code/eval-this.js b/js/src/tests/test262/language/module-code/eval-this.js
new file mode 100644
index 0000000000..c269282ffc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-this.js
@@ -0,0 +1,48 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Module Environment Records provide a this binding, and the value is
+ `undefined`.
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ [...]
+
+ 12.2.2 The this Keyword
+ 12.2.2.1 Runtime Semantics: Evaluation
+
+ PrimaryExpression : this
+
+ 1. Return ? ResolveThisBinding( ).
+
+ 8.3.4 ResolveThisBinding ( )
+
+ 1. Let envRec be GetThisEnvironment( ).
+ 2. Return ? envRec.GetThisBinding().
+
+ 8.3.3 GetThisEnvironment ( )
+
+ 1. Let lex be the running execution context's LexicalEnvironment.
+ 2. Repeat
+ a. Let envRec be lex's EnvironmentRecord.
+ b. Let exists be envRec.HasThisBinding().
+ c. If exists is true, return envRec.
+ d. Let outer be the value of lex's outer environment reference.
+ e. Let lex be outer.
+
+ 8.1.1.5.3 HasThisBinding ()
+
+ 1. Return true.
+
+ 8.1.1.5.4 GetThisBinding ()
+
+ 1. Return undefined.
+flags: [module]
+---*/
+
+assert.sameValue(this, undefined);
+
+reportCompare(0, 0);