summaryrefslogtreecommitdiffstats
path: root/js/src/tests/js1_7/expressions
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/tests/js1_7/expressions
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/js1_7/expressions')
-rw-r--r--js/src/tests/js1_7/expressions/browser.js0
-rw-r--r--js/src/tests/js1_7/expressions/destructuring-scope.js67
-rw-r--r--js/src/tests/js1_7/expressions/regress-346203.js28
-rw-r--r--js/src/tests/js1_7/expressions/regress-346645-01.js34
-rw-r--r--js/src/tests/js1_7/expressions/regress-346645-02.js34
-rw-r--r--js/src/tests/js1_7/expressions/regress-346645-03.js34
-rw-r--r--js/src/tests/js1_7/expressions/regress-418051.js34
-rw-r--r--js/src/tests/js1_7/expressions/regress-451340.js27
-rw-r--r--js/src/tests/js1_7/expressions/shell.js0
9 files changed, 258 insertions, 0 deletions
diff --git a/js/src/tests/js1_7/expressions/browser.js b/js/src/tests/js1_7/expressions/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/js1_7/expressions/browser.js
diff --git a/js/src/tests/js1_7/expressions/destructuring-scope.js b/js/src/tests/js1_7/expressions/destructuring-scope.js
new file mode 100644
index 000000000..374c1bec9
--- /dev/null
+++ b/js/src/tests/js1_7/expressions/destructuring-scope.js
@@ -0,0 +1,67 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* 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/. */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 'none';
+var summary = 'Test destructuring assignments for differing scopes';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+function f() {
+ var x = 3;
+ if (x > 0) {
+ let {a:x} = {a:7};
+ if (x != 7)
+ throw "fail";
+ }
+ if (x != 3)
+ throw "fail";
+}
+
+function g() {
+ // Before JS1.7's destructuring for…in was fixed to match JS1.8's,
+ // the expected values were a == "x" and b == 7.
+ for (var [a,b] in {x:7}) {
+ if (a !== "x" || typeof b !== "undefined")
+ throw "fail";
+ }
+
+ {
+ // Before JS1.7's destructuring for…in was fixed to match JS1.8's,
+ // the expected values were a == "y" and b == 8.
+ for (let [a,b] in {y:8}) {
+ if (a !== "y" || typeof b !== "undefined")
+ throw "fail";
+ }
+ }
+
+ if (a !== "x" || typeof b !== "undefined")
+ throw "fail";
+}
+
+f();
+g();
+
+if (typeof a != "undefined" || typeof b != "undefined" || typeof x != "undefined")
+ throw "fail";
+
+function h() {
+ // Before JS1.7's destructuring for…in was fixed to match JS1.8's,
+ // the expected values were a == "x" and b == 9.
+ for ([a,b] in {z:9}) {
+ if (a !== "z" || typeof b !== "undefined")
+ throw "fail";
+ }
+}
+
+h();
+
+if (a !== "z" || typeof b !== "undefined")
+ throw "fail";
+
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/js1_7/expressions/regress-346203.js b/js/src/tests/js1_7/expressions/regress-346203.js
new file mode 100644
index 000000000..1c18a09ac
--- /dev/null
+++ b/js/src/tests/js1_7/expressions/regress-346203.js
@@ -0,0 +1,28 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* 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/. */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 346203;
+var summary = 'Do not crash during destructuring assignment ';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var {b:{c:x}}={b:{c:1}}
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_7/expressions/regress-346645-01.js b/js/src/tests/js1_7/expressions/regress-346645-01.js
new file mode 100644
index 000000000..9782fc82e
--- /dev/null
+++ b/js/src/tests/js1_7/expressions/regress-346645-01.js
@@ -0,0 +1,34 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* 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/. */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 346645;
+var summary = 'Do not crash with empty object in destructuring assign LHS';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ try
+ {
+ eval('({ a:{} }) = 3;');
+ }
+ catch(ex)
+ {
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_7/expressions/regress-346645-02.js b/js/src/tests/js1_7/expressions/regress-346645-02.js
new file mode 100644
index 000000000..f01781c67
--- /dev/null
+++ b/js/src/tests/js1_7/expressions/regress-346645-02.js
@@ -0,0 +1,34 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* 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/. */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 346645;
+var summary = 'Do not crash with empty array in destructuring assign LHS';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ try
+ {
+ eval('({ a:[] }) = 3;');
+ }
+ catch(ex)
+ {
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_7/expressions/regress-346645-03.js b/js/src/tests/js1_7/expressions/regress-346645-03.js
new file mode 100644
index 000000000..20f4d8edb
--- /dev/null
+++ b/js/src/tests/js1_7/expressions/regress-346645-03.js
@@ -0,0 +1,34 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* 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/. */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 346645;
+var summary = 'Do not crash with non-empty array in destructuring assign LHS';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ try
+ {
+ eval('({ a:[z] }) = 3;');
+ }
+ catch(ex)
+ {
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_7/expressions/regress-418051.js b/js/src/tests/js1_7/expressions/regress-418051.js
new file mode 100644
index 000000000..32c6b4eac
--- /dev/null
+++ b/js/src/tests/js1_7/expressions/regress-418051.js
@@ -0,0 +1,34 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* 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/. */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 418051;
+var summary = 'Do not assert: (pnkey)->pn_arity == PN_NULLARY && ' +
+ '((pnkey)->pn_type == TOK_NUMBER || (pnkey)->pn_type == TOK_STRING || ' +
+ '(pnkey)->pn_type == TOK_NAME)';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ try
+ {
+ eval("({x:[]}={x}");
+ }
+ catch(ex)
+ {
+ }
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_7/expressions/regress-451340.js b/js/src/tests/js1_7/expressions/regress-451340.js
new file mode 100644
index 000000000..77733091f
--- /dev/null
+++ b/js/src/tests/js1_7/expressions/regress-451340.js
@@ -0,0 +1,27 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* 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/. */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 451340;
+var summary = 'Do no crash [@ CheckDestructuring]';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ function x([y]) { }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_7/expressions/shell.js b/js/src/tests/js1_7/expressions/shell.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/js1_7/expressions/shell.js