summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/annexB/language/statements/if/emulated-undefined.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/annexB/language/statements/if/emulated-undefined.js')
-rw-r--r--js/src/tests/test262/annexB/language/statements/if/emulated-undefined.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/js/src/tests/test262/annexB/language/statements/if/emulated-undefined.js b/js/src/tests/test262/annexB/language/statements/if/emulated-undefined.js
new file mode 100644
index 0000000000..46f73419f8
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/statements/if/emulated-undefined.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-if-statement-runtime-semantics-evaluation
+description: >
+ ToBoolean returns `false` for [[IsHTMLDDA]] object; first Statement is not evaluated.
+info: |
+ IfStatement : if ( Expression ) Statement else Statement
+
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let exprValue be ! ToBoolean(? GetValue(exprRef)).
+ 3. If exprValue is true, then
+ [...]
+ 4. Else,
+ a. Let stmtCompletion be the result of evaluating the second Statement.
+
+ The [[IsHTMLDDA]] Internal Slot / Changes to ToBoolean
+
+ 1. If argument has an [[IsHTMLDDA]] internal slot, return false.
+ 2. Return true.
+features: [IsHTMLDDA]
+---*/
+
+var result = false;
+if ($262.IsHTMLDDA) {
+ throw new Test262Error("unreachable");
+} else {
+ result = true;
+}
+
+assert(result);
+
+reportCompare(0, 0);