summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/identifier-resolution
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/identifier-resolution
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/identifier-resolution')
-rw-r--r--js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T1.js27
-rw-r--r--js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T2.js26
-rw-r--r--js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T3.js28
-rw-r--r--js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T4.js28
-rw-r--r--js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T5.js32
-rw-r--r--js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T6.js31
-rw-r--r--js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T7.js33
-rw-r--r--js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T8.js33
-rw-r--r--js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T9.js28
-rw-r--r--js/src/tests/test262/language/identifier-resolution/S11.1.2_A1_T1.js27
-rw-r--r--js/src/tests/test262/language/identifier-resolution/S11.1.2_A1_T2.js21
-rw-r--r--js/src/tests/test262/language/identifier-resolution/assign-to-global-undefined-strict.js22
-rw-r--r--js/src/tests/test262/language/identifier-resolution/browser.js0
-rw-r--r--js/src/tests/test262/language/identifier-resolution/shell.js0
-rw-r--r--js/src/tests/test262/language/identifier-resolution/static-init-invalid-await.js26
-rw-r--r--js/src/tests/test262/language/identifier-resolution/unscopables.js24
16 files changed, 386 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T1.js b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T1.js
new file mode 100644
index 0000000000..5268062bf8
--- /dev/null
+++ b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T1.js
@@ -0,0 +1,27 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Every execution context has associated with it a scope chain.
+ A scope chain is a list of objects that are searched when evaluating an
+ Identifier
+es5id: 10.2.2_A1_T1
+description: Checking scope chain containing function declarations
+---*/
+
+var x = 0;
+
+function f1(){
+ var x = 1;
+ function f2(){
+ return x;
+ };
+ return f2();
+}
+
+if(!(f1() === 1)){
+ throw new Test262Error("#1: Scope chain disturbed");
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T2.js b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T2.js
new file mode 100644
index 0000000000..418aafc137
--- /dev/null
+++ b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T2.js
@@ -0,0 +1,26 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Every execution context has associated with it a scope chain.
+ A scope chain is a list of objects that are searched when evaluating an
+ Identifier
+es5id: 10.2.2_A1_T2
+description: Checking scope chain containing function declarations
+---*/
+
+var x = 0;
+
+function f1(){
+ function f2(){
+ return x;
+ };
+ return f2();
+}
+
+if(!(f1() === 0)){
+ throw new Test262Error("#1: Scope chain disturbed");
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T3.js b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T3.js
new file mode 100644
index 0000000000..e2f47c4c98
--- /dev/null
+++ b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T3.js
@@ -0,0 +1,28 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Every execution context has associated with it a scope chain.
+ A scope chain is a list of objects that are searched when evaluating an
+ Identifier
+es5id: 10.2.2_A1_T3
+description: Checking scope chain containing function declarations
+---*/
+
+var x = 0;
+
+function f1(){
+ function f2(){
+ return x;
+ };
+ return f2();
+
+ var x = 1;
+}
+
+if(!(f1() === undefined)){
+ throw new Test262Error("#1: Scope chain disturbed");
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T4.js b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T4.js
new file mode 100644
index 0000000000..4524d28812
--- /dev/null
+++ b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T4.js
@@ -0,0 +1,28 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Every execution context has associated with it a scope chain.
+ A scope chain is a list of objects that are searched when evaluating an
+ Identifier
+es5id: 10.2.2_A1_T4
+description: Checking scope chain containing function declarations
+---*/
+
+var x = 0;
+
+function f1(){
+ function f2(){
+ return x;
+ };
+
+ var x = 1;
+ return f2();
+}
+
+if(!(f1() === 1)){
+ throw new Test262Error("#1: Scope chain disturbed");
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T5.js b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T5.js
new file mode 100644
index 0000000000..7d554011c0
--- /dev/null
+++ b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T5.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Every execution context has associated with it a scope chain.
+ A scope chain is a list of objects that are searched when evaluating an
+ Identifier
+es5id: 10.2.2_A1_T5
+description: Checking scope chain containing function declarations and "with"
+flags: [noStrict]
+---*/
+
+var x = 0;
+
+var myObj = {x : "obj"};
+
+function f1(){
+ var x = 1;
+ function f2(){
+ with(myObj){
+ return x;
+ }
+ };
+ return f2();
+}
+
+if(!(f1() === "obj")){
+ throw new Test262Error("#1: Scope chain disturbed");
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T6.js b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T6.js
new file mode 100644
index 0000000000..711972c6f5
--- /dev/null
+++ b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T6.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Every execution context has associated with it a scope chain.
+ A scope chain is a list of objects that are searched when evaluating an
+ Identifier
+es5id: 10.2.2_A1_T6
+description: Checking scope chain containing function declarations and "with"
+flags: [noStrict]
+---*/
+
+var x = 0;
+
+var myObj = {x : "obj"};
+
+function f1(){
+ function f2(){
+ with(myObj){
+ return x;
+ }
+ };
+ return f2();
+}
+
+if(!(f1() === "obj")){
+ throw new Test262Error("#1: Scope chain disturbed");
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T7.js b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T7.js
new file mode 100644
index 0000000000..43048150c5
--- /dev/null
+++ b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T7.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Every execution context has associated with it a scope chain.
+ A scope chain is a list of objects that are searched when evaluating an
+ Identifier
+es5id: 10.2.2_A1_T7
+description: Checking scope chain containing function declarations and "with"
+flags: [noStrict]
+---*/
+
+var x = 0;
+
+var myObj = {x : "obj"};
+
+function f1(){
+ function f2(){
+ with(myObj){
+ return x;
+ }
+ };
+ return f2();
+
+ var x = 1;
+}
+
+if(!(f1() === "obj")){
+ throw new Test262Error("#1: Scope chain disturbed");
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T8.js b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T8.js
new file mode 100644
index 0000000000..63df65dc15
--- /dev/null
+++ b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T8.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Every execution context has associated with it a scope chain.
+ A scope chain is a list of objects that are searched when evaluating an
+ Identifier
+es5id: 10.2.2_A1_T8
+description: Checking scope chain containing function declarations and "with"
+flags: [noStrict]
+---*/
+
+var x = 0;
+
+var myObj = {x : "obj"};
+
+function f1(){
+ function f2(){
+ with(myObj){
+ return x;
+ }
+ };
+
+ var x = 1;
+ return f2();
+}
+
+if(!(f1() === "obj")){
+ throw new Test262Error("#1: Scope chain disturbed");
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T9.js b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T9.js
new file mode 100644
index 0000000000..85b5f86d48
--- /dev/null
+++ b/js/src/tests/test262/language/identifier-resolution/S10.2.2_A1_T9.js
@@ -0,0 +1,28 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Every execution context has associated with it a scope chain.
+ A scope chain is a list of objects that are searched when evaluating an
+ Identifier
+es5id: 10.2.2_A1_T9
+description: Checking scope chain containing function declarations and "with"
+flags: [noStrict]
+---*/
+
+var x = 0;
+
+var myObj = {x : "obj"};
+
+function f1(){
+ with(myObj){
+ return x;
+ }
+}
+
+if(!(f1() === "obj")){
+ throw new Test262Error("#1: Scope chain disturbed");
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/identifier-resolution/S11.1.2_A1_T1.js b/js/src/tests/test262/language/identifier-resolution/S11.1.2_A1_T1.js
new file mode 100644
index 0000000000..c75101c0d6
--- /dev/null
+++ b/js/src/tests/test262/language/identifier-resolution/S11.1.2_A1_T1.js
@@ -0,0 +1,27 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The result of evaluating an Identifier is always a value of type Reference
+es5id: 11.1.2_A1_T1
+description: Creating variables without defining it
+---*/
+
+//CHECK#1
+if (this.x !== undefined) {
+ throw new Test262Error('#1: this.x === undefined. Actual: ' + (this.x));
+}
+
+//CHECK#2
+var object = new Object();
+if (object.prop !== undefined) {
+ throw new Test262Error('#2: var object = new Object(); object.prop === undefined. Actual: ' + (object.prop));
+}
+
+//CHECK#3
+this.y++;
+if (isNaN(y) !== true) {
+ throw new Test262Error('#3: this.y++; y === Not-a-Number. Actual: ' + (y));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/identifier-resolution/S11.1.2_A1_T2.js b/js/src/tests/test262/language/identifier-resolution/S11.1.2_A1_T2.js
new file mode 100644
index 0000000000..2091e24f5d
--- /dev/null
+++ b/js/src/tests/test262/language/identifier-resolution/S11.1.2_A1_T2.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The result of evaluating an Identifier is always a value of type Reference
+es5id: 11.1.2_A1_T2
+description: Trying to generate ReferenceError
+---*/
+
+//CHECK#1
+try {
+ this.z;
+ z;
+ throw new Test262Error('#1.1: this.z; z === undefined throw ReferenceError. Actual: ' + (z));
+} catch(e) {
+ if ((e instanceof ReferenceError) !== true) {
+ throw new Test262Error('#1.2: this.z; z === undefined throw ReferenceError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/identifier-resolution/assign-to-global-undefined-strict.js b/js/src/tests/test262/language/identifier-resolution/assign-to-global-undefined-strict.js
new file mode 100644
index 0000000000..2681bec68c
--- /dev/null
+++ b/js/src/tests/test262/language/identifier-resolution/assign-to-global-undefined-strict.js
@@ -0,0 +1,22 @@
+// |reftest| error:ReferenceError
+'use strict';
+// 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, attempts to assign to an unresolvable reference must throw a ReferenceError exception
+info: |
+ via sec-putvalue
+
+ If IsUnresolvableReference(V) is true, then
+ If IsStrictReference(V) is true, then
+ Throw a ReferenceError exception.
+
+flags: [onlyStrict]
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+
+undeclared = (this.undeclared = 5);
diff --git a/js/src/tests/test262/language/identifier-resolution/browser.js b/js/src/tests/test262/language/identifier-resolution/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/identifier-resolution/browser.js
diff --git a/js/src/tests/test262/language/identifier-resolution/shell.js b/js/src/tests/test262/language/identifier-resolution/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/identifier-resolution/shell.js
diff --git a/js/src/tests/test262/language/identifier-resolution/static-init-invalid-await.js b/js/src/tests/test262/language/identifier-resolution/static-init-invalid-await.js
new file mode 100644
index 0000000000..47ff0ae838
--- /dev/null
+++ b/js/src/tests/test262/language/identifier-resolution/static-init-invalid-await.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: Restriction on `await`
+info: |
+ IdentifierReference : Identifier
+
+ - It is a Syntax Error if the code matched by this production is nested,
+ directly or indirectly (but not crossing function or static initialization
+ block boundaries), within a ClassStaticBlock and the StringValue of
+ Identifier is "arguments" or "await".
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ await;
+ }
+}
diff --git a/js/src/tests/test262/language/identifier-resolution/unscopables.js b/js/src/tests/test262/language/identifier-resolution/unscopables.js
new file mode 100644
index 0000000000..04f8df480c
--- /dev/null
+++ b/js/src/tests/test262/language/identifier-resolution/unscopables.js
@@ -0,0 +1,24 @@
+// Copyright 2015 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 8.1.1.4.1
+description: >
+ `Symbol.unscopables` is not referenced when finding bindings in global scope
+info: |
+ 1. Let envRec be the global Environment Record for which the method was
+ invoked.
+ 2. Let DclRec be envRec.[[DeclarativeRecord]].
+ 3. If DclRec.HasBinding(N) is true, return true.
+ 4. Let ObjRec be envRec.[[ObjectRecord]].
+ 5. Return ObjRec.HasBinding(N).
+features: [Symbol.unscopables]
+---*/
+
+var x = 86;
+this[Symbol.unscopables] = {
+ x: true
+};
+assert.sameValue(x, 86);
+
+reportCompare(0, 0);