summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_2017
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-06-08 14:51:46 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:14 -0400
commit7ecc50d90d13690d610f26d0056a326e52bc834c (patch)
tree18e5e9248a8011e44de84cb8b73f77f9027d0dd6 /js/src/tests/ecma_2017
parent987d6726f3c64d1cc510acba1de08deb5e0a7702 (diff)
downloadUXP-7ecc50d90d13690d610f26d0056a326e52bc834c.tar
UXP-7ecc50d90d13690d610f26d0056a326e52bc834c.tar.gz
UXP-7ecc50d90d13690d610f26d0056a326e52bc834c.tar.lz
UXP-7ecc50d90d13690d610f26d0056a326e52bc834c.tar.xz
UXP-7ecc50d90d13690d610f26d0056a326e52bc834c.zip
1317379 - Disallow generator functions and async functions as direct children of if/else.
Diffstat (limited to 'js/src/tests/ecma_2017')
-rw-r--r--js/src/tests/ecma_2017/AsyncFunctions/forbidden-as-consequent.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/js/src/tests/ecma_2017/AsyncFunctions/forbidden-as-consequent.js b/js/src/tests/ecma_2017/AsyncFunctions/forbidden-as-consequent.js
new file mode 100644
index 000000000..656ed46de
--- /dev/null
+++ b/js/src/tests/ecma_2017/AsyncFunctions/forbidden-as-consequent.js
@@ -0,0 +1,14 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+assertThrowsInstanceOf(() => eval("if (1) async function foo() {}"),
+ SyntaxError);
+assertThrowsInstanceOf(() => eval("'use strict'; if (1) async function foo() {}"),
+ SyntaxError);
+
+var async = 42;
+assertEq(eval("if (1) async \n function foo() {}"), 42);
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);