summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/extensions/uneval
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/non262/extensions/uneval
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/non262/extensions/uneval')
-rw-r--r--js/src/tests/non262/extensions/uneval/bug496985.js14
-rw-r--r--js/src/tests/non262/extensions/uneval/bug566661.js8
-rw-r--r--js/src/tests/non262/extensions/uneval/function-bind.js32
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-231518.js99
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-245795.js33
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-254375.js28
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-304897.js22
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-306738.js30
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-311583.js23
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-313803.js29
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-322957.js29
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-328556.js21
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-358594-01.js31
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-358594-02.js23
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-358594-03.js30
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-358594-04.js23
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-358594-05.js31
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-358594-06.js23
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-367629.js45
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-375801.js35
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-380581.js28
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-380933.js29
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-381211.js28
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-381301.js39
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-385393-03.js29
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-385729.js58
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-452498-082.js33
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-452498-101.js30
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-452498-117.js35
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-621814.js15
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-624199.js19
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-90596-002.js264
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-96284-002.js147
-rw-r--r--js/src/tests/non262/extensions/uneval/regress-bug567606.js21
-rw-r--r--js/src/tests/non262/extensions/uneval/strict-function-toSource.js19
-rw-r--r--js/src/tests/non262/extensions/uneval/symbol-uneval.js15
-rw-r--r--js/src/tests/non262/extensions/uneval/toSource-0.js16
37 files changed, 1434 insertions, 0 deletions
diff --git a/js/src/tests/non262/extensions/uneval/bug496985.js b/js/src/tests/non262/extensions/uneval/bug496985.js
new file mode 100644
index 0000000000..0f68288cc5
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/bug496985.js
@@ -0,0 +1,14 @@
+// |reftest| skip-if(!this.uneval)
+
+var a = function() {
+ return function ({x: arguments}) {
+ return arguments;
+ }
+}
+var b = eval(uneval(a));
+
+assertEq(a()({x: 1}), 1);
+assertEq(b()({x: 1}), 1);
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/non262/extensions/uneval/bug566661.js b/js/src/tests/non262/extensions/uneval/bug566661.js
new file mode 100644
index 0000000000..51e142351e
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/bug566661.js
@@ -0,0 +1,8 @@
+// |reftest| skip-if(!this.uneval)
+
+var f = function (q) { return q['\xC7']; }
+var d = eval(uneval(f));
+assertEq(d({'\xC7': 'good'}), 'good');
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/non262/extensions/uneval/function-bind.js b/js/src/tests/non262/extensions/uneval/function-bind.js
new file mode 100644
index 0000000000..263099cf07
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/function-bind.js
@@ -0,0 +1,32 @@
+// |reftest| skip-if(!this.uneval)
+
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var gTestfile = 'function-bind.js';
+var BUGNUMBER = 429507;
+var summary = "ES5: Function.prototype.bind";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+assertEq((function unbound(){"body"}).bind().toSource(), `function bound() {
+ [native code]
+}`);
+
+assertEq(uneval((function unbound(){"body"}).bind()), `function bound() {
+ [native code]
+}`);
+
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("All tests passed!");
diff --git a/js/src/tests/non262/extensions/uneval/regress-231518.js b/js/src/tests/non262/extensions/uneval/regress-231518.js
new file mode 100644
index 0000000000..fc360f0870
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-231518.js
@@ -0,0 +1,99 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 231518;
+var summary = 'decompiler must quote keywords and non-identifier property names';
+var actual = '';
+var expect = 'no error';
+var status;
+var object;
+var result;
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+ status = inSection(1) + ' eval(uneval({"if": false}))';
+
+ try
+ {
+ object = {'if': false };
+ result = uneval(object);
+ printStatus('uneval returns ' + result);
+ eval(result);
+ actual = 'no error';
+ }
+ catch(e)
+ {
+ actual = 'error';
+ }
+
+ reportCompare(expect, actual, status);
+
+ status = inSection(2) + ' eval(uneval({"if": "then"}))';
+
+ try
+ {
+ object = {'if': "then" };
+ result = uneval(object);
+ printStatus('uneval returns ' + result);
+ eval(result);
+ actual = 'no error';
+ }
+ catch(e)
+ {
+ actual = 'error';
+ }
+
+ reportCompare(expect, actual, status);
+
+ status = inSection(3) + ' eval(uneval(f))';
+
+ try
+ {
+ result = uneval(f);
+ printStatus('uneval returns ' + result);
+ eval(result);
+ actual = 'no error';
+ }
+ catch(e)
+ {
+ actual = 'error';
+ }
+
+ reportCompare(expect, actual, status);
+
+ status = inSection(2) + ' eval(uneval(g))';
+
+ try
+ {
+ result = uneval(g);
+ printStatus('uneval returns ' + result);
+ eval(result);
+ actual = 'no error';
+ }
+ catch(e)
+ {
+ actual = 'error';
+ }
+
+ reportCompare(expect, actual, status);
+
+function f()
+{
+ var obj = new Object();
+
+ obj['name'] = 'Just a name';
+ obj['if'] = false;
+ obj['some text'] = 'correct';
+}
+
+function g()
+{
+ return {'if': "then"};
+}
+
diff --git a/js/src/tests/non262/extensions/uneval/regress-245795.js b/js/src/tests/non262/extensions/uneval/regress-245795.js
new file mode 100644
index 0000000000..bb5a736039
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-245795.js
@@ -0,0 +1,33 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 245795;
+var summary = 'eval(uneval(function)) should be round-trippable';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+function a()
+{
+ b = function() {};
+}
+
+var r = "function a() { b = function() {}; }";
+eval(uneval(a));
+
+var v = a.toString().replace(/[ \n]+/g, ' ');
+print(v)
+
+printStatus("[" + v + "]");
+
+expect = r;
+actual = v;
+
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/non262/extensions/uneval/regress-254375.js b/js/src/tests/non262/extensions/uneval/regress-254375.js
new file mode 100644
index 0000000000..4640d3e1c8
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-254375.js
@@ -0,0 +1,28 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 254375;
+var summary = 'Object.toSource for negative number property names';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+ try
+ {
+ expect = 'no error';
+ eval(uneval({'-1':true}));
+ actual = 'no error';
+ }
+ catch(e)
+ {
+ actual = 'error';
+ }
+
+ reportCompare(expect, actual, summary);
diff --git a/js/src/tests/non262/extensions/uneval/regress-304897.js b/js/src/tests/non262/extensions/uneval/regress-304897.js
new file mode 100644
index 0000000000..f88bff8445
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-304897.js
@@ -0,0 +1,22 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 304897;
+var summary = 'uneval("\\t"), uneval("\\x09")';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+expect = '"\\t"';
+actual = uneval('\t');
+reportCompare(expect, actual, summary);
+
+actual = uneval('\x09');
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/non262/extensions/uneval/regress-306738.js b/js/src/tests/non262/extensions/uneval/regress-306738.js
new file mode 100644
index 0000000000..71f8b5d014
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-306738.js
@@ -0,0 +1,30 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 306738;
+var summary = 'uneval() on objects with getter or setter';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+actual = uneval(
+ {
+ get foo()
+ {
+ return "foo";
+ }
+ });
+
+expect = '({get foo()\n\
+ {\n\
+ return "foo";\n\
+ }})';
+
+compareSource(expect, actual, summary);
diff --git a/js/src/tests/non262/extensions/uneval/regress-311583.js b/js/src/tests/non262/extensions/uneval/regress-311583.js
new file mode 100644
index 0000000000..9121b9f4e9
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-311583.js
@@ -0,0 +1,23 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 311583;
+var summary = 'uneval(array) should use elision for holes';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var a = new Array(3);
+a[0] = a[2] = 0;
+
+actual = uneval(a);
+expect = '[0, , 0]';
+
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/non262/extensions/uneval/regress-313803.js b/js/src/tests/non262/extensions/uneval/regress-313803.js
new file mode 100644
index 0000000000..3f5c18456a
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-313803.js
@@ -0,0 +1,29 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 313803;
+var summary = 'uneval() on func with embedded objects with getter or setter';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var func = function ff() {
+ obj = { get foo() { return "foo"; }};
+ return 1;
+};
+
+actual = uneval(func);
+
+expect = '(function ff() {\n\
+ obj = { get foo() { return "foo"; }};\n\
+ return 1;\n\
+})';
+
+compareSource(expect, actual, summary);
diff --git a/js/src/tests/non262/extensions/uneval/regress-322957.js b/js/src/tests/non262/extensions/uneval/regress-322957.js
new file mode 100644
index 0000000000..e3b8157b52
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-322957.js
@@ -0,0 +1,29 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 322957;
+var summary = 'TryMethod should not eat getter exceptions';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var obj = { get toSource() { throw "EXCEPTION"; } };
+
+var got_proper_exception = -1;
+
+try {
+ uneval(obj);
+} catch (e) {
+ got_proper_exception = (e === "EXCEPTION");
+}
+
+expect = true;
+actual = got_proper_exception;
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/non262/extensions/uneval/regress-328556.js b/js/src/tests/non262/extensions/uneval/regress-328556.js
new file mode 100644
index 0000000000..c757fad02d
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-328556.js
@@ -0,0 +1,21 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 328556;
+var summary = 'Do not Assert: growth == (size_t)-1 || (nchars + 1) * sizeof(char16_t) == growth, in jsarray.c';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var D = [];
+D.foo = D;
+uneval(D);
+
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/non262/extensions/uneval/regress-358594-01.js b/js/src/tests/non262/extensions/uneval/regress-358594-01.js
new file mode 100644
index 0000000000..e5b22a575c
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-358594-01.js
@@ -0,0 +1,31 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 358594;
+var summary = 'Do not crash on uneval(this).';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ // don't crash|assert
+ function f() { }
+ f.__proto__ = this;
+ Object.defineProperty(this, "m", { set: f, enumerable: true, configurable: true });
+ uneval(this);
+ reportCompare(expect, actual, summary);
+}
diff --git a/js/src/tests/non262/extensions/uneval/regress-358594-02.js b/js/src/tests/non262/extensions/uneval/regress-358594-02.js
new file mode 100644
index 0000000000..897d739579
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-358594-02.js
@@ -0,0 +1,23 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 358594;
+var summary = 'Do not crash on uneval(this).';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+// don't crash|assert
+function f() { }
+f.__proto__ = this;
+Object.defineProperty(this, "m", { set: f, enumerable: true, configurable: true });
+uneval(this);
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/non262/extensions/uneval/regress-358594-03.js b/js/src/tests/non262/extensions/uneval/regress-358594-03.js
new file mode 100644
index 0000000000..55f4fb250d
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-358594-03.js
@@ -0,0 +1,30 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 358594;
+var summary = 'Do not crash on uneval(this).';
+var actual = '';
+var expect = '';
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ // don't crash|assert
+ f = function () { };
+ f.__proto__ = this;
+ Object.defineProperty(this, "m", { set: f, enumerable: true, configurable: true });
+ uneval(this);
+ reportCompare(expect, actual, summary);
+}
diff --git a/js/src/tests/non262/extensions/uneval/regress-358594-04.js b/js/src/tests/non262/extensions/uneval/regress-358594-04.js
new file mode 100644
index 0000000000..01d1fe3e03
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-358594-04.js
@@ -0,0 +1,23 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 358594;
+var summary = 'Do not crash on uneval(this).';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+// don't crash|assert
+f = function () { };
+f.__proto__ = this;
+Object.defineProperty(this, "m", { set: f, enumerable: true, configurable: true });
+uneval(this);
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/non262/extensions/uneval/regress-358594-05.js b/js/src/tests/non262/extensions/uneval/regress-358594-05.js
new file mode 100644
index 0000000000..aa2ae6e925
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-358594-05.js
@@ -0,0 +1,31 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 358594;
+var summary = 'Do not crash on uneval(this).';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ // don't crash|assert
+ f = function () { };
+ f.hhhhhhhhh = this;
+ Object.defineProperty(this, "m", { set: f, enumerable: true, configurable: true });
+ uneval(this);
+ reportCompare(expect, actual, summary);
+}
diff --git a/js/src/tests/non262/extensions/uneval/regress-358594-06.js b/js/src/tests/non262/extensions/uneval/regress-358594-06.js
new file mode 100644
index 0000000000..2a83057eda
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-358594-06.js
@@ -0,0 +1,23 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 358594;
+var summary = 'Do not crash on uneval(this).';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+// don't crash|assert
+f = function () { };
+f.hhhhhhhhh = this;
+Object.defineProperty(this, "m", { set: f, enumerable: true, configurable: true });
+uneval(this);
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/non262/extensions/uneval/regress-367629.js b/js/src/tests/non262/extensions/uneval/regress-367629.js
new file mode 100644
index 0000000000..9d7a999a22
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-367629.js
@@ -0,0 +1,45 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 367629;
+var summary = 'Decompilation of result with native function as getter';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var a =
+ Object.defineProperty({}, "h",
+ {
+ get: encodeURI,
+ enumerable: true,
+ configurable: true
+ });
+
+ expect = '({get h() {[native code]}})';
+ actual = uneval(a);
+
+ // Native function syntax:
+ // `function IdentifierName_opt ( FormalParameters ) { [ native code ] }`
+
+ // The placement of whitespace characters in the native function's body is
+ // implementation-dependent, so we need to replace those for this test.
+ var re = new RegExp(["\\{", "\\[", "native", "code", "\\]", "\\}"].join("\\s*"));
+ actual = actual.replace(re, "{[native code]}");
+
+ compareSource(expect, actual, summary);
+}
diff --git a/js/src/tests/non262/extensions/uneval/regress-375801.js b/js/src/tests/non262/extensions/uneval/regress-375801.js
new file mode 100644
index 0000000000..6f345bf8fa
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-375801.js
@@ -0,0 +1,35 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 375801;
+var summary = 'uneval should use "(void 0)" instead of "undefined"';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = '({a:(void 0)})'
+ actual = uneval({a: undefined})
+ compareSource(expect, actual, summary + ': uneval');
+
+ expect = 'function() {({a: undefined});}';
+ actual = (function() {({a: undefined});}).toString();
+ compareSource(expect, actual, summary + ': toString');
+
+ expect = '(function () {({a: undefined});})';
+ actual = (function () {({a: undefined});}).toSource();
+ compareSource(expect, actual, summary + ': toSource');
+}
diff --git a/js/src/tests/non262/extensions/uneval/regress-380581.js b/js/src/tests/non262/extensions/uneval/regress-380581.js
new file mode 100644
index 0000000000..5420b3fe17
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-380581.js
@@ -0,0 +1,28 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 380581;
+var summary = 'Incorrect uneval with setter in object literal';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = '(function() { })';
+ actual = uneval(eval("(function() { })"));
+ compareSource(expect, actual, summary);
+}
diff --git a/js/src/tests/non262/extensions/uneval/regress-380933.js b/js/src/tests/non262/extensions/uneval/regress-380933.js
new file mode 100644
index 0000000000..8033f886e7
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-380933.js
@@ -0,0 +1,29 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 380933;
+var summary = 'Do not assert with uneval object with setter with modified proto';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var f = (function(){});
+var y =
+ Object.defineProperty({}, "p",
+ {
+ get: f,
+ enumerable: true,
+ configurable: true
+ });
+f.__proto__ = [];
+uneval(y);
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete");
+
diff --git a/js/src/tests/non262/extensions/uneval/regress-381211.js b/js/src/tests/non262/extensions/uneval/regress-381211.js
new file mode 100644
index 0000000000..3ac4282e1c
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-381211.js
@@ -0,0 +1,28 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 381211;
+var summary = 'uneval with getter';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = '({get x(){}})';
+ actual = uneval({get x(){}});
+ compareSource(expect, actual, summary);
+}
diff --git a/js/src/tests/non262/extensions/uneval/regress-381301.js b/js/src/tests/non262/extensions/uneval/regress-381301.js
new file mode 100644
index 0000000000..be8495e662
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-381301.js
@@ -0,0 +1,39 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 381301;
+var summary = 'uneval of object with native-function getter';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var o =
+ Object.defineProperty({}, "x", { get: decodeURI, enumerable: true, configurable: true });
+ expect = '({get x() {[native code]}})';
+ actual = uneval(o);
+
+ // Native function syntax:
+ // `function IdentifierName_opt ( FormalParameters ) { [ native code ] }`
+
+ // The placement of whitespace characters in the native function's body is
+ // implementation-dependent, so we need to replace those for this test.
+ var re = new RegExp(["\\{", "\\[", "native", "code", "\\]", "\\}"].join("\\s*"));
+ actual = actual.replace(re, "{[native code]}");
+
+ compareSource(expect, actual, summary);
+}
diff --git a/js/src/tests/non262/extensions/uneval/regress-385393-03.js b/js/src/tests/non262/extensions/uneval/regress-385393-03.js
new file mode 100644
index 0000000000..2f11b25ecf
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-385393-03.js
@@ -0,0 +1,29 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 385393;
+var summary = 'Regression test for bug 385393';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ f = (function() { new (delete y) });
+ eval(uneval(f))
+
+ reportCompare(expect, actual, summary);
+}
diff --git a/js/src/tests/non262/extensions/uneval/regress-385729.js b/js/src/tests/non262/extensions/uneval/regress-385729.js
new file mode 100644
index 0000000000..5f650e6082
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-385729.js
@@ -0,0 +1,58 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 385729;
+var summary = 'uneval(eval(expression closure))';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+function normalizeSource(source) {
+ source = String(source);
+ source = source.replace(/([(){},.:\[\]])/mg, ' $1 ');
+ source = source.replace(/\s+/mg, ' ');
+
+ return source;
+}
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = '(function f () /x/g)';
+ try
+ {
+ // mozilla 1.9
+ actual = uneval(eval(expect));
+ }
+ catch(ex)
+ {
+ // mozilla 1.8
+ expect = 'SyntaxError: missing { before function body';
+ actual = ex + '';
+ }
+ compareSource(normalizeSource(expect), normalizeSource(actual), summary);
+
+ expect = '({get f () /x/g})';
+ try
+ {
+ // mozilla 1.9
+ actual = uneval(eval("({get f () /x/g})"));
+ }
+ catch(ex)
+ {
+ // mozilla 1.8
+ expect = 'SyntaxError: missing { before function body';
+ actual = ex + '';
+ }
+ compareSource(normalizeSource(expect), normalizeSource(actual), summary);
+}
diff --git a/js/src/tests/non262/extensions/uneval/regress-452498-082.js b/js/src/tests/non262/extensions/uneval/regress-452498-082.js
new file mode 100644
index 0000000000..8fee44d2a1
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-452498-082.js
@@ -0,0 +1,33 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- tab-width: 2; 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #82 From Gary Kwong [:nth10sd]
+
+// =====
+
+ uneval(function(){[y] = [x];});
+
+// =====
+
+ reportCompare(expect, actual, summary);
+}
diff --git a/js/src/tests/non262/extensions/uneval/regress-452498-101.js b/js/src/tests/non262/extensions/uneval/regress-452498-101.js
new file mode 100644
index 0000000000..c660ab9b80
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-452498-101.js
@@ -0,0 +1,30 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #101 From Gary Kwong [:nth10sd]
+
+ uneval(function(){with({functional: []}){x5, y = this;const y = undefined }});
+// Assertion failure: strcmp(rval, with_cookie) == 0, at ../jsopcode.cpp:2567
+
+ reportCompare(expect, actual, summary);
+}
diff --git a/js/src/tests/non262/extensions/uneval/regress-452498-117.js b/js/src/tests/non262/extensions/uneval/regress-452498-117.js
new file mode 100644
index 0000000000..c2b5135790
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-452498-117.js
@@ -0,0 +1,35 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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 = 452498;
+var summary = 'TM: upvar2 regression tests';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+// ------- Comment #117 From Gary Kwong [:nth10sd]
+
+// The following all do not require -j.
+
+// Assertion failure: pnu->pn_lexdef == dn, at ../jsemit.cpp:1817
+// =====
+ uneval(function(){arguments = ({ get y(){} }); for(var [arguments] in y ) (x);});
+
+// =====
+
+ reportCompare(expect, actual, summary);
+}
diff --git a/js/src/tests/non262/extensions/uneval/regress-621814.js b/js/src/tests/non262/extensions/uneval/regress-621814.js
new file mode 100644
index 0000000000..7e661d97a8
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-621814.js
@@ -0,0 +1,15 @@
+// |reftest| skip-if(!this.uneval)
+
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+var expect = 'pass';
+var actual = expect;
+function f({"\xF51F": x}) {}
+try {
+ eval(uneval(f));
+} catch (e) {
+ actual = '' + e;
+}
+reportCompare(expect, actual, "");
diff --git a/js/src/tests/non262/extensions/uneval/regress-624199.js b/js/src/tests/non262/extensions/uneval/regress-624199.js
new file mode 100644
index 0000000000..2634600f12
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-624199.js
@@ -0,0 +1,19 @@
+// |reftest| skip-if(!this.uneval)
+
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+function roundTrip(f) {
+ try {
+ eval(uneval(f));
+ return true;
+ } catch (e) {
+ return '' + e;
+ }
+}
+
+function f() { if (true) { 'use strict'; } var eval; }
+assertEq(roundTrip(f), true);
+
+reportCompare(true,true);
diff --git a/js/src/tests/non262/extensions/uneval/regress-90596-002.js b/js/src/tests/non262/extensions/uneval/regress-90596-002.js
new file mode 100644
index 0000000000..ae66ea7142
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-90596-002.js
@@ -0,0 +1,264 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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/. */
+
+/*
+ * Date: 28 August 2001
+ *
+ * SUMMARY: A [DontEnum] prop, if overridden, should appear in uneval().
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=90596
+ *
+ * NOTE: some inefficiencies in the test are made for the sake of readability.
+ * Sorting properties alphabetically is done for definiteness in comparisons.
+ */
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var BUGNUMBER = 90596;
+var summary = 'A [DontEnum] prop, if overridden, should appear in uneval()';
+var cnCOMMA = ',';
+var cnLBRACE = '{';
+var cnRBRACE = '}';
+var cnLPAREN = '(';
+var cnRPAREN = ')';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var obj = {};
+
+
+status = inSection(1);
+obj = {toString:9};
+actual = uneval(obj);
+expect = '({toString:9})';
+addThis();
+
+status = inSection(2);
+obj = {hasOwnProperty:"Hi"};
+actual = uneval(obj);
+expect = '({hasOwnProperty:"Hi"})';
+addThis();
+
+status = inSection(3);
+obj = {toString:9, hasOwnProperty:"Hi"};
+actual = uneval(obj);
+expect = '({toString:9, hasOwnProperty:"Hi"})';
+addThis();
+
+status = inSection(4);
+obj = {prop1:1, toString:9, hasOwnProperty:"Hi"};
+actual = uneval(obj);
+expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})';
+addThis();
+
+
+// TRY THE SAME THING IN EVAL CODE
+var s = '';
+
+status = inSection(5);
+s = 'obj = {toString:9}';
+eval(s);
+actual = uneval(obj);
+expect = '({toString:9})';
+addThis();
+
+status = inSection(6);
+s = 'obj = {hasOwnProperty:"Hi"}';
+eval(s);
+actual = uneval(obj);
+expect = '({hasOwnProperty:"Hi"})';
+addThis();
+
+status = inSection(7);
+s = 'obj = {toString:9, hasOwnProperty:"Hi"}';
+eval(s);
+actual = uneval(obj);
+expect = '({toString:9, hasOwnProperty:"Hi"})';
+addThis();
+
+status = inSection(8);
+s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}';
+eval(s);
+actual = uneval(obj);
+expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})';
+addThis();
+
+
+// TRY THE SAME THING IN FUNCTION CODE
+function A()
+{
+ status = inSection(9);
+ var s = 'obj = {toString:9}';
+ eval(s);
+ actual = uneval(obj);
+ expect = '({toString:9})';
+ addThis();
+}
+A();
+
+function B()
+{
+ status = inSection(10);
+ var s = 'obj = {hasOwnProperty:"Hi"}';
+ eval(s);
+ actual = uneval(obj);
+ expect = '({hasOwnProperty:"Hi"})';
+ addThis();
+}
+B();
+
+function C()
+{
+ status = inSection(11);
+ var s = 'obj = {toString:9, hasOwnProperty:"Hi"}';
+ eval(s);
+ actual = uneval(obj);
+ expect = '({toString:9, hasOwnProperty:"Hi"})';
+ addThis();
+}
+C();
+
+function D()
+{
+ status = inSection(12);
+ var s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}';
+ eval(s);
+ actual = uneval(obj);
+ expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})';
+ addThis();
+}
+D();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Sort properties alphabetically -
+ */
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = sortThis(actual);
+ expectedvalues[UBound] = sortThis(expect);
+ UBound++;
+}
+
+
+/*
+ * Takes string of form '({"c", "b", "a", 2})' and returns '({"a","b","c",2})'
+ */
+function sortThis(sList)
+{
+ sList = compactThis(sList);
+ sList = stripParens(sList);
+ sList = stripBraces(sList);
+ var arr = sList.split(cnCOMMA);
+ arr = arr.sort();
+ var ret = String(arr);
+ ret = addBraces(ret);
+ ret = addParens(ret);
+ return ret;
+}
+
+
+/*
+ * Strips out any whitespace from the text -
+ */
+function compactThis(text)
+{
+ var charCode = 0;
+ var ret = '';
+
+ for (var i=0; i<text.length; i++)
+ {
+ charCode = text.charCodeAt(i);
+
+ if (!isWhiteSpace(charCode))
+ ret += text.charAt(i);
+ }
+
+ return ret;
+}
+
+
+function isWhiteSpace(charCode)
+{
+ switch (charCode)
+ {
+ case (0x0009):
+ case (0x000B):
+ case (0x000C):
+ case (0x0020):
+ case (0x000A): // '\n'
+ case (0x000D): // '\r'
+ return true;
+ break;
+
+ default:
+ return false;
+ }
+}
+
+
+/*
+ * strips off parens at beginning and end of text -
+ */
+function stripParens(text)
+{
+ // remember to escape the parens...
+ var arr = text.match(/^\((.*)\)$/);
+
+ // defend against a null match...
+ if (arr != null && arr[1] != null)
+ return arr[1];
+ return text;
+}
+
+
+/*
+ * strips off braces at beginning and end of text -
+ */
+function stripBraces(text)
+{
+ // remember to escape the braces...
+ var arr = text.match(/^\{(.*)\}$/);
+
+ // defend against a null match...
+ if (arr != null && arr[1] != null)
+ return arr[1];
+ return text;
+}
+
+
+function addBraces(text)
+{
+ return cnLBRACE + text + cnRBRACE;
+}
+
+
+function addParens(text)
+{
+ return cnLPAREN + text + cnRPAREN;
+}
+
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+}
diff --git a/js/src/tests/non262/extensions/uneval/regress-96284-002.js b/js/src/tests/non262/extensions/uneval/regress-96284-002.js
new file mode 100644
index 0000000000..f49b670aff
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-96284-002.js
@@ -0,0 +1,147 @@
+// |reftest| skip-if(!this.uneval)
+
+/* -*- 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/. */
+
+/*
+ * Date: 03 September 2001
+ *
+ * SUMMARY: Double quotes should be escaped in uneval(new Error('""'))
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=96284
+ *
+ * The real point here is this: we should be able to reconstruct an object
+ * obj from uneval(obj). We'll test this on various types of objects.
+ *
+ * Method: define obj2 = eval(uneval(obj1)) and verify that
+ * obj2.toSource() == obj1.toSource().
+ */
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var BUGNUMBER = 96284;
+var summary = 'Double quotes should be escaped in Error.prototype.toSource()';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var obj1 = {};
+var obj2 = {};
+var cnTestString = '"This is a \" STUPID \" test string!!!"\\';
+
+
+// various NativeError objects -
+status = inSection(1);
+obj1 = Error(cnTestString);
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(2);
+obj1 = EvalError(cnTestString);
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(3);
+obj1 = RangeError(cnTestString);
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(4);
+obj1 = ReferenceError(cnTestString);
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(5);
+obj1 = SyntaxError(cnTestString);
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(6);
+obj1 = TypeError(cnTestString);
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(7);
+obj1 = URIError(cnTestString);
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+
+// other types of objects -
+status = inSection(8);
+obj1 = new String(cnTestString);
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(9);
+obj1 = {color:'red', texture:cnTestString, hasOwnProperty:42};
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(10);
+obj1 = function(x) {function g(y){return y+1;} return g(x);};
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(11);
+obj1 = new Number(eval('6'));
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(12);
+obj1 = /ad;(lf)kj(2309\/\/)\/\//;
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+}
diff --git a/js/src/tests/non262/extensions/uneval/regress-bug567606.js b/js/src/tests/non262/extensions/uneval/regress-bug567606.js
new file mode 100644
index 0000000000..7123f8e36b
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/regress-bug567606.js
@@ -0,0 +1,21 @@
+// |reftest| skip-if(!this.uneval)
+
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+var global = this;
+
+(function() {
+ function f() {
+ this.b = function() {};
+ Object.defineProperty(this, "b", ({
+ configurable: global.__defineSetter__("", function() {})
+ }));
+ }
+ for (y of [0]) {
+ _ = new f();
+ }
+})();
+uneval(this);
+
+reportCompare(true, true);
diff --git a/js/src/tests/non262/extensions/uneval/strict-function-toSource.js b/js/src/tests/non262/extensions/uneval/strict-function-toSource.js
new file mode 100644
index 0000000000..383da34df6
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/strict-function-toSource.js
@@ -0,0 +1,19 @@
+// |reftest| skip-if(!this.uneval)
+
+/*
+ * Bug 800407 - Functions defined with Function construcor
+ * do have strict mode when JSOPTION_STRICT_MODE is on.
+ */
+
+options("strict_mode");
+function testRunOptionStrictMode(str, arg, result) {
+ var strict_inner = new Function('return typeof this == "undefined";');
+ return strict_inner;
+}
+let inner = testRunOptionStrictMode();
+assertEq(inner(), true);
+assertEq(eval(uneval(inner))(), true);
+
+assertEq((new Function('x', 'return x*2;')).toSource().includes('"use strict"'), false);
+
+reportCompare(true, true);
diff --git a/js/src/tests/non262/extensions/uneval/symbol-uneval.js b/js/src/tests/non262/extensions/uneval/symbol-uneval.js
new file mode 100644
index 0000000000..1454bc0c3a
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/symbol-uneval.js
@@ -0,0 +1,15 @@
+// |reftest| skip-if(!this.uneval)
+
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+assertEq(uneval(Symbol.iterator), "Symbol.iterator");
+assertEq(uneval(Symbol()), "Symbol()");
+assertEq(uneval(Symbol("")), 'Symbol("")');
+assertEq(uneval(Symbol("ponies")), 'Symbol("ponies")');
+assertEq(uneval(Symbol.for("ponies")), 'Symbol.for("ponies")');
+
+assertEq({glyph: Symbol(undefined)}.toSource(), "({glyph:Symbol()})");
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/non262/extensions/uneval/toSource-0.js b/js/src/tests/non262/extensions/uneval/toSource-0.js
new file mode 100644
index 0000000000..60906463c7
--- /dev/null
+++ b/js/src/tests/non262/extensions/uneval/toSource-0.js
@@ -0,0 +1,16 @@
+// |reftest| skip-if(!this.uneval)
+
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+assertEq(eval(uneval('\x001')), '\x001');
+
+f = eval('(' + (function () { return '\x001'; }).toString() + ')');
+assertEq(f(), '\x001');
+
+assertEq(eval('\x001'.toSource()) == '\x001', true);
+
+if (typeof reportCompare === 'function')
+ reportCompare(true, true);