emulated-undefined.js (924B)
1 // Copyright (C) 2020 Alexey Shvayka. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-if-statement-runtime-semantics-evaluation 5 description: > 6 ToBoolean returns `false` for [[IsHTMLDDA]] object; first Statement is not evaluated. 7 info: | 8 IfStatement : if ( Expression ) Statement else Statement 9 10 1. Let exprRef be the result of evaluating Expression. 11 2. Let exprValue be ! ToBoolean(? GetValue(exprRef)). 12 3. If exprValue is true, then 13 [...] 14 4. Else, 15 a. Let stmtCompletion be the result of evaluating the second Statement. 16 17 The [[IsHTMLDDA]] Internal Slot / Changes to ToBoolean 18 19 1. If argument has an [[IsHTMLDDA]] internal slot, return false. 20 2. Return true. 21 features: [IsHTMLDDA] 22 ---*/ 23 24 var result = false; 25 if ($262.IsHTMLDDA) { 26 throw new Test262Error("unreachable"); 27 } else { 28 result = true; 29 } 30 31 assert(result); 32 33 reportCompare(0, 0);