summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/assignment/target-member-computed-reference-undefined.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/language/expressions/assignment/target-member-computed-reference-undefined.js
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/expressions/assignment/target-member-computed-reference-undefined.js')
-rw-r--r--js/src/tests/test262/language/expressions/assignment/target-member-computed-reference-undefined.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/assignment/target-member-computed-reference-undefined.js b/js/src/tests/test262/language/expressions/assignment/target-member-computed-reference-undefined.js
new file mode 100644
index 0000000000..d9b488a1af
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/assignment/target-member-computed-reference-undefined.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-assignment-operators
+description: Assignment Operator evaluates the value prior validating a MemberExpression's reference (undefined)
+info: |
+ # 13.15.2 Runtime Semantics: Evaluation
+ AssignmentExpression : LeftHandSideExpression = AssignmentExpression
+
+ 1. If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral,
+ then
+ a. Let lref be the result of evaluating LeftHandSideExpression.
+ [...]
+ e. Perform ? PutValue(lref, rval).
+
+ # 6.2.4.5 PutValue ( V, W )
+
+ [...]
+ 5. If IsPropertyReference(V) is true, then
+ a. Let baseObj be ? ToObject(V.[[Base]]).
+---*/
+
+function DummyError() { }
+
+assert.throws(DummyError, function() {
+ var base = undefined;
+ var prop = function() {
+ throw new DummyError();
+ };
+ var expr = function() {
+ throw new Test262Error("right-hand side expression evaluated");
+ };
+
+ base[prop()] = expr();
+});
+
+assert.throws(DummyError, function() {
+ var base = undefined;
+ var prop = {
+ toString: function() {
+ throw new Test262Error("property key evaluated");
+ }
+ };
+ var expr = function() {
+ throw new DummyError();
+ };
+
+ base[prop] = expr();
+});
+
+reportCompare(0, 0);