diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/tests/js1_8 | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-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_8')
125 files changed, 4809 insertions, 0 deletions
diff --git a/js/src/tests/js1_8/README b/js/src/tests/js1_8/README new file mode 100644 index 000000000..3dc2f56a9 --- /dev/null +++ b/js/src/tests/js1_8/README @@ -0,0 +1 @@ +JavaScript 1.8 diff --git a/js/src/tests/js1_8/browser.js b/js/src/tests/js1_8/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/js1_8/browser.js diff --git a/js/src/tests/js1_8/extensions/browser.js b/js/src/tests/js1_8/extensions/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/js1_8/extensions/browser.js diff --git a/js/src/tests/js1_8/extensions/dekker.js b/js/src/tests/js1_8/extensions/dekker.js new file mode 100644 index 000000000..26d93d4fe --- /dev/null +++ b/js/src/tests/js1_8/extensions/dekker.js @@ -0,0 +1,68 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Jason Orendorff + */ + +//----------------------------------------------------------------------------- + +var summary = "Dekker's algorithm for mutual exclusion"; +// Adapted from pseudocode in Wikipedia: +// http://en.wikipedia.org/wiki/Dekker%27s_algorithm + +printStatus (summary); + +var N = 500; // number of iterations + +// the mutex mechanism +var f = [false, false]; +var turn = 0; + +// resource being protected +var counter = 0; + +function worker(me) { + let him = 1 - me; + + for (let i = 0; i < N; i++) { + // enter the mutex + f[me] = true; + while (f[him]) { + if (turn != me) { + f[me] = false; + while (turn != me) + ; // busy wait + f[me] = true; + } + } + + // critical section + let x = counter; + sleep(0.003); + counter = x + 1; + + // leave the mutex + turn = him; + f[me] = false; + } + + return 'ok'; +} + +var expect; +var actual; + +if (typeof scatter == 'undefined' || typeof sleep == 'undefined') { + print('Test skipped. scatter or sleep not defined.'); + expect = actual = 'Test skipped.'; +} else { + var results = scatter([function () { return worker(0); }, + function () { return worker(1); }]); + + expect = "Thread status: [ok,ok], counter: " + (2 * N); + actual = "Thread status: [" + results + "], counter: " + counter; +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/expclo.js b/js/src/tests/js1_8/extensions/expclo.js new file mode 100644 index 000000000..96b067ed6 --- /dev/null +++ b/js/src/tests/js1_8/extensions/expclo.js @@ -0,0 +1,23 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Brendan Eich + */ + +var summary = "Flat expression closure source coordinate fencepost test"; + +function f(a) { + if (a) { + let b = 42; + let c = function () a+b; + ++b; + return c; + } + return null; +} + +var expect = 44; +var actual = f(1)(); + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/expclo2.js b/js/src/tests/js1_8/extensions/expclo2.js new file mode 100644 index 000000000..2c192d861 --- /dev/null +++ b/js/src/tests/js1_8/extensions/expclo2.js @@ -0,0 +1,23 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Brendan Eich + */ + +var summary = "Partial flat expression closure upvar order test"; + +function f(a) { + if (a) { + let b = 42; + let c = function () b+a; + ++b; + return c; + } + return null; +} + +var expect = 44; +var actual = f(1)(); + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/lamport.js b/js/src/tests/js1_8/extensions/lamport.js new file mode 100644 index 000000000..d9e9d6636 --- /dev/null +++ b/js/src/tests/js1_8/extensions/lamport.js @@ -0,0 +1,93 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 summary = "Lamport Bakery's algorithm for mutual exclusion"; +// Adapted from pseudocode in Wikipedia: +// http://en.wikipedia.org/wiki/Lamport%27s_bakery_algorithm + +printStatus(summary); + +var N = 15; // Number of threads. +var LOOP_COUNT = 10; // Number of times each thread should loop + +function range(n) { + for (let i = 0; i < n; i++) + yield i; +} + +function max(a) { + let x = Number.NEGATIVE_INFINITY; + for each (let i in a) + if (i > x) + x = i; + return x; +} + +// the mutex mechanism +var entering = [false for (i in range(N))]; +var ticket = [0 for (i in range(N))]; + +// the object being protected +var counter = 0; + +function lock(i) +{ + entering[i] = true; + ticket[i] = 1 + max(ticket); + entering[i] = false; + + for (let j = 0; j < N; j++) { + // If thread j is in the middle of getting a ticket, wait for that to + // finish. + while (entering[j]) + ; + + // Wait until all threads with smaller ticket numbers or with the same + // ticket number, but with higher priority, finish their work. + while ((ticket[j] != 0) && ((ticket[j] < ticket[i]) || + ((ticket[j] == ticket[i]) && (i < j)))) + ; + } +} + +function unlock(i) { + ticket[i] = 0; +} + +function worker(i) { + for (let k = 0; k < LOOP_COUNT; k++) { + lock(i); + + // The critical section + let x = counter; + sleep(0.003); + counter = x + 1; + + unlock(i); + } + return 'ok'; +} + +function makeWorker(id) { + return function () { return worker(id); }; +} + +var expect; +var actual; + +if (typeof scatter == 'undefined' || typeof sleep == 'undefined') { + print('Test skipped. scatter or sleep not defined.'); + expect = actual = 'Test skipped.'; +} else { + scatter([makeWorker(i) for (i in range(N))]); + + expect = "counter: " + (N * LOOP_COUNT); + actual = "counter: " + counter; +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/peterson.js b/js/src/tests/js1_8/extensions/peterson.js new file mode 100644 index 000000000..de8514967 --- /dev/null +++ b/js/src/tests/js1_8/extensions/peterson.js @@ -0,0 +1,57 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 summary = "Peterson's algorithm for mutual exclusion"; + +printStatus(summary); + +var N = 500; // number of iterations + +// the mutex mechanism +var f = [false, false]; +var turn = 0; + +// the resource being protected +var counter = 0; + +function worker(me) { + let him = 1 - me; + + for (let i = 0; i < N; i++) { + // enter the mutex + f[me] = true; + turn = him; + while (f[him] && turn == him) + ; // busy wait + + // critical section + let x = counter; + sleep(0.003); + counter = x+1; + + // leave the mutex + f[me] = false; + } + + return 'ok'; +} + +var expect; +var actual; + +if (typeof scatter == 'undefined' || typeof sleep == 'undefined') { + print('Test skipped. scatter or sleep not defined.'); + expect = actual = 'Test skipped.'; +} else { + var results = scatter ([function() { return worker(0); }, + function() { return worker(1); }]); + expect = "Thread status: [ok,ok], counter: " + (2 * N); + actual = "Thread status: [" + results + "], counter: " + counter; +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/regress-353116.js b/js/src/tests/js1_8/extensions/regress-353116.js new file mode 100644 index 000000000..d3a1349f8 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-353116.js @@ -0,0 +1,78 @@ +/* -*- 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 = 353116; +var summary = 'Improve errors messages for null, undefined properties'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 'TypeError: undefined has no properties'; + actual = 'No Error'; + + try + { + undefined.y; + } + catch(ex) + { + actual = ex + ''; + } + reportCompare(expect, actual, summary); + + expect = 'TypeError: null has no properties'; + actual = 'No Error'; + + try + { + null.y; + } + catch(ex) + { + actual = ex + ''; + } + reportCompare(expect, actual, summary); + + expect = 'TypeError: x is undefined'; + actual = 'No Error'; + + try + { + x = undefined; + x.y; + } + catch(ex) + { + actual = ex + ''; + } + reportCompare(expect, actual, summary); + + expect = 'TypeError: x is null'; + actual = 'No Error'; + + try + { + x = null; + x.y; + } + catch(ex) + { + actual = ex + ''; + } + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-385729.js b/js/src/tests/js1_8/extensions/regress-385729.js new file mode 100644 index 000000000..82d06b6f6 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-385729.js @@ -0,0 +1,55 @@ +/* -*- 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'; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof eval != 'undefined' && typeof uneval != 'undefined') + { + 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(expect, 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(expect, actual, summary); + } + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-394709.js b/js/src/tests/js1_8/extensions/regress-394709.js new file mode 100644 index 000000000..d04d8832f --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-394709.js @@ -0,0 +1,51 @@ +// |reftest| skip-if(!xulRuntime.shell) +/* -*- 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 = 394709; +var summary = 'Do not leak with object.watch and closure'; +var actual = 'No Leak'; +var expect = 'No Leak'; + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + assertEq(finalizeCount(), 0, "invalid initial state"); + + runtest(); + gc(); + assertEq(finalizeCount(), 1, "leaked"); + + runtest(); + gc(); + assertEq(finalizeCount(), 2, "leaked"); + + runtest(); + gc(); + assertEq(finalizeCount(), 3, "leaked"); + + + function runtest () { + var obj = { b: makeFinalizeObserver() }; + obj.watch('b', watcher); + + function watcher(id, old, value) { + ++obj.n; + return value; + } + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-415721.js b/js/src/tests/js1_8/extensions/regress-415721.js new file mode 100644 index 000000000..b5f66f779 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-415721.js @@ -0,0 +1,44 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Jason Orendorff + */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 415721; +var summary = 'jsatom.c double hashing re-validation logic is unsound'; + +printStatus (summary); + +var VARS = 10000; +var TRIES = 100; + +function atomizeStressTest() { + var fn = "function f() {var "; + for (var i = 0; i < VARS; i++) + fn += '_f' + i + ', '; + fn += 'q;}'; + + function e() { eval(fn); } + + for (var i = 0; i < TRIES; i++) { + scatter([e,e]); + gc(); + } +} + +var expect; +var actual; + +expect = actual = 'No crash'; +if (typeof scatter == 'undefined' || typeof gc == 'undefined') { + print('Test skipped. scatter or gc not defined.'); + expect = actual = 'Test skipped.'; +} else { + atomizeStressTest(); +} + +reportCompare(expect, actual, summary); + diff --git a/js/src/tests/js1_8/extensions/regress-417131.js b/js/src/tests/js1_8/extensions/regress-417131.js new file mode 100644 index 000000000..1f80246a2 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-417131.js @@ -0,0 +1,76 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 417131; +var summary = 'stress test for cache'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + function f(N) + { + for (var i = 0; i != N; ++i) { + var obj0 = {}, obj1 = {}, obj2 = {}; + obj1['a'+i] = 0; + obj2['b'+i] = 0; + obj2['b'+(i+1)] = 1; + for (var repeat = 0;repeat != 2; ++repeat) { + var count = 0; + for (var j in obj1) { + if (j !== 'a'+i) + throw "Bad:"+j; + for (var k in obj2) { + if (i == Math.floor(N/3) || i == Math.floor(2*N/3)) + gc(); + var expected; + switch (count) { + case 0: expected='b'+i; break; + case 1: expected='b'+(i+1); break; + default: + throw "Bad count: "+count; + } + if (expected != k) + throw "Bad k, expected="+expected+", actual="+k; + for (var l in obj0) + ++count; + ++count; + } + } + if (count !== 2) + throw "Bad count: "+count; + } + } + } + + var array = [function() { f(10); }, + function() { f(50); }, + function() { f(200); }, + function() { f(400); } + ]; + + if (typeof scatter == "function") { + scatter(array); + } else { + for (var i = 0; i != array.length; ++i) + array[i](); + } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-417817.js b/js/src/tests/js1_8/extensions/regress-417817.js new file mode 100644 index 000000000..0d303c325 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-417817.js @@ -0,0 +1,55 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 417817; +var summary = 'Do not assert: ASSERT_VALID_PROPERTY_CACHE_HIT'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +const numThreads = 2; +const numPasses = 1000; + +var tests = { + 0: function first(myAn) + { + /* This print statement is needed to reliably trigger the bug */ + print("Hello, World!"); + }, + length: 1 +}; + +function runAllTests() +{ + var passes; + var i; + + for (passes = 0; passes < numPasses; passes++) + { + for (i = 0; i < tests.length; i++) + { + tests[0](); + } + } +} + +if (typeof scatter == 'undefined') +{ + print(expect = actual = 'Test skipped. Requires scatter.'); +} +else +{ + var i; + var a = []; + for (i = 0; i < numThreads; i++) + a.push(runAllTests); + scatter(a); +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/regress-419091.js b/js/src/tests/js1_8/extensions/regress-419091.js new file mode 100644 index 000000000..4748292ba --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-419091.js @@ -0,0 +1,52 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 419091; +var summary = 'Do not assert: JS_PROPERTY_CACHE(cx).disabled >= 0'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof scatter == 'undefined') + { + print(expect = actual = 'Test skipped. Requires scatter.'); + } + else + { + if (typeof gczeal == 'undefined') + { + gczeal = (function () {}); + } + + gczeal(2); + + function f() { + for (let i = 0; i < 10; i++) { + let y = { x: i } + } + } + + for (let i = 0; i < 10; i++) + scatter([f, f]); + + gczeal(0); + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-445818.js b/js/src/tests/js1_8/extensions/regress-445818.js new file mode 100644 index 000000000..c481e7c9b --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-445818.js @@ -0,0 +1,41 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 445818; +var summary = 'Do not crash with threads'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +printBugNumber(BUGNUMBER); +printStatus (summary); + +if (typeof scatter == 'undefined') +{ + print(expect = actual = 'Test skipped. scatter not defined'); +} +else +{ + var array = [{}, {}, {}, {}]; + + function test() { + for (var i = 0; i != 42*42*42; ++i) { + var obj = array[i % array.length]; + obj["a"+i] = 1; + var tmp = {}; + tmp["a"+i] = 2; + } + } + + scatter([test, test, test, test]); +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/regress-446169-01.js b/js/src/tests/js1_8/extensions/regress-446169-01.js new file mode 100644 index 000000000..31250b3fd --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-446169-01.js @@ -0,0 +1,50 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 446169; +var summary = 'Do not assert: Thin_GetWait(tl->owner) in thread-safe build'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +var array = [{}, {}, {}, {}]; + +function foo() +{ + for (var i = 0; i != 42*42*42; ++i) + { + var obj = array[i % array.length]; + obj["a"+i] = 1; + var tmp = {}; + tmp["a"+i] = 2; + } +} + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof scatter == 'function') + { + scatter([foo, foo, foo, foo]); + } + else + { + print('Test skipped. Requires thread-safe build with scatter function.'); + } + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} + + diff --git a/js/src/tests/js1_8/extensions/regress-446169-02.js b/js/src/tests/js1_8/extensions/regress-446169-02.js new file mode 100644 index 000000000..a7053825d --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-446169-02.js @@ -0,0 +1,48 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 446169; +var summary = 'Do not assert: Thin_GetWait(tl->owner) in thread-safe build'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +var array = []; +for (var i = 0; i != 100*1000; i += 2) { + array[i] = i; + array[i+1] = i; +} + +var src = array.join(';x'); + +function f() { + new Function(src); +} + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof scatter == 'function') + { + scatter([f, f, f, f]); + } + else + { + print('Test skipped. Requires thread-safe build with scatter function.'); + } + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} + + diff --git a/js/src/tests/js1_8/extensions/regress-452913.js b/js/src/tests/js1_8/extensions/regress-452913.js new file mode 100644 index 000000000..6b0551422 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-452913.js @@ -0,0 +1,18 @@ +/* -*- 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 = 452913; +var summary = 'Do not crash with defined getter and for (let)'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +(this.__defineGetter__("x", function (x)'foo'.replace(/o/g, [1].push))); +for(let y in [,,,]) for(let y in [,,,]) x = x; + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/regress-454744.js b/js/src/tests/js1_8/extensions/regress-454744.js new file mode 100644 index 000000000..3b22acb9f --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-454744.js @@ -0,0 +1,35 @@ +/* -*- 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 = 454744; +var summary = 'Do not assert with JIT: PCVAL_IS_SPROP(entry->vword)'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + try + { + this.__defineGetter__('x', function() 2); for (var j=0;j<4;++j) { x=1; } + } + catch(ex) + { + } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-465337.js b/js/src/tests/js1_8/extensions/regress-465337.js new file mode 100644 index 000000000..fcbc308ed --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-465337.js @@ -0,0 +1,30 @@ +/* -*- 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 = 465337; +var summary = 'Do not assert: (m != JSVAL_INT) || isInt32(*vp)'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + var out = []; + for (let j = 0; j < 5; ++j) { out.push(6 - ((void 0) ^ 0x80000005)); } + print(uneval(out)); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-465453.js b/js/src/tests/js1_8/extensions/regress-465453.js new file mode 100644 index 000000000..ed97e89a1 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-465453.js @@ -0,0 +1,42 @@ +/* -*- 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 = 465453; +var summary = 'Do not convert (undefined) to "undefined"'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = '[(new Boolean(true)), (void 0), (new Boolean(true)), ' + + '(new Boolean(true)), (void 0), (void 0), "", "", (void 0)]'; + + var out = []; + for each (var e in [(new Boolean(true)), + (void 0), + (new Boolean(true)), + (new Boolean(true)), + (void 0), + (void 0), + "", + "", + (void 0)]) + out.push(e); + print(actual = uneval(out)); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-469625.js b/js/src/tests/js1_8/extensions/regress-469625.js new file mode 100644 index 000000000..549dc9068 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-469625.js @@ -0,0 +1,42 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Jason Orendorff + */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 469625; +var summary = 'TM: Array prototype and expression closures'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 'TypeError: [].__proto__ is not a function'; + + + Array.prototype.__proto__ = function () 3; + + try + { + [].__proto__(); + } + catch(ex) + { + print(actual = ex + ''); + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-471197.js b/js/src/tests/js1_8/extensions/regress-471197.js new file mode 100644 index 000000000..bdf8ab43b --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-471197.js @@ -0,0 +1,45 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 471197; +var summary = 'Do not crash when cx->thread is null'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + var results; + + + function f() { + for (var i = 0; i != 1000; ++i) { + } + } + + if (typeof scatter == 'function') + { + results = scatter([f, f]); + } + else + { + print('Test skipped due to lack of scatter threadsafe function'); + } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-472450-03.js b/js/src/tests/js1_8/extensions/regress-472450-03.js new file mode 100644 index 000000000..4c2d6adb5 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-472450-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 = 472450; +var summary = 'TM: Do not assert: StackBase(fp) + blockDepth == regs.sp'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + var cyclic = []; + cyclic[0] = cyclic; + ({__proto__: cyclic}) + for (var y = 0; y < 3; ++y) { for each (let z in ['', function(){}]) { let x = + 1, c = []; } } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-472450-04.js b/js/src/tests/js1_8/extensions/regress-472450-04.js new file mode 100644 index 000000000..c1d8f4d04 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-472450-04.js @@ -0,0 +1,36 @@ +/* -*- 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 = 472450; +var summary = 'TM: Do not assert: StackBase(fp) + blockDepth == regs.sp'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + var cyclic = []; + cyclic[0] = cyclic; + ({__proto__: cyclic}); + function f(){ + eval("for (var y = 0; y < 1; ++y) { for each (let z in [null, function(){}, null, '', null, '', null]) { let x = 1, c = []; } }"); + } + f(); + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-473040.js b/js/src/tests/js1_8/extensions/regress-473040.js new file mode 100644 index 000000000..b0c944b11 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-473040.js @@ -0,0 +1,25 @@ +/* -*- 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 = 473040; +var summary = 'Do not assert: tm->reservedDoublePoolPtr > tm->reservedDoublePool'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + + +Object.defineProperty(__proto__, "functional", +{ + enumerable: true, configurable: true, + get: new Function("gc()") +}); +for each (let x in [new Boolean(true), new Boolean(true), -0, new + Boolean(true), -0]) { undefined; } + + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/regress-475971.js b/js/src/tests/js1_8/extensions/regress-475971.js new file mode 100755 index 000000000..685ecec41 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-475971.js @@ -0,0 +1,58 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 475971; +var summary = 'js_CheckRedeclaration should unlock object on failures'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof scatter != 'function') + { + print(expect = actual = + 'Test skipped - requires threaded build with scatter'); + } + else + { + function x() { return 1; }; + + // g must run sufficiently long to ensure that the global scope is accessed + // from the parallel threads. + function g() + { + var sum = 0; + try { + for (var i = 0; i != 10000; ++i) { + sum += x(); + } + } catch (e) { } + } + + scatter([g, g]); + + try { + eval("const x = 1"); + } catch (e) { } + + scatter([g, g]); + + print("Done"); + } + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-476414-01.js b/js/src/tests/js1_8/extensions/regress-476414-01.js new file mode 100644 index 000000000..901783d15 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-476414-01.js @@ -0,0 +1,67 @@ +// |reftest| skip-if(!xulRuntime.shell) slow +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 476414; +var summary = 'Do not crash @ GetGCThingFlags'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +function whatToTestSpidermonkeyTrunk(code) +{ + return { + allowExec: true + }; +} +whatToTest = whatToTestSpidermonkeyTrunk; +function tryItOut(code) +{ + var wtt = whatToTest(code.replace(/\n/g, " ").replace(/\r/g, " ")); + var f = new Function(code); + if (wtt.allowExec && f) { + rv = tryRunning(f, code); + } +} +function tryRunning(f, code) +{ + try { + var rv = f(); + } catch(runError) {} +} +var realFunction = Function; +var realUneval = uneval; +var realToString = toString; +var realToSource = toSource; +function tryEnsureSanity() +{ + delete Function; + delete uneval; + delete toSource; + delete toString; + Function = realFunction; + uneval = realUneval; + toSource = realToSource; + toString = realToString; +} +for (let iters = 0; iters < 2000; ++iters) { + count=27745; tryItOut("with({x: (c) = (x2 = [])})false;"); + tryEnsureSanity(); + count=35594; tryItOut("switch(null) { case this.__defineSetter__(\"window\", function () { yield \"\" } ): break; }"); + tryEnsureSanity(); + count=45020; tryItOut("with({}) { (this.__defineGetter__(\"x\", function (y)this)); } "); + tryEnsureSanity(); + count=45197; tryItOut("M:with((p={}, (p.z = <x/> === '' )()))/*TUUL*/for each (let y in [true, {}, {}, (void 0), true, true, true, (void 0), true, (void 0)]) { return; }"); + tryEnsureSanity(); + gc(); + tryEnsureSanity(); + count=45254; tryItOut("for each (NaN in this);"); + tryEnsureSanity(); +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/regress-476414-02.js b/js/src/tests/js1_8/extensions/regress-476414-02.js new file mode 100644 index 000000000..9e64bfacb --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-476414-02.js @@ -0,0 +1,67 @@ +// |reftest| skip-if(!xulRuntime.shell) slow +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 476414; +var summary = 'Do not crash @ js_NativeSet'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +function whatToTestSpidermonkeyTrunk(code) +{ + return { + allowExec: true + }; +} +whatToTest = whatToTestSpidermonkeyTrunk; +function tryItOut(code) +{ + var wtt = whatToTest(code.replace(/\n/g, " ").replace(/\r/g, " ")); + var f = new Function(code); + if (wtt.allowExec && f) { + rv = tryRunning(f, code); + } +} +function tryRunning(f, code) +{ + try { + var rv = f(); + } catch(runError) {} +} +var realFunction = Function; +var realUneval = uneval; +var realToString = toString; +var realToSource = toSource; +function tryEnsureSanity() +{ + delete Function; + delete uneval; + delete toSource; + delete toString; + Function = realFunction; + uneval = realUneval; + toSource = realToSource; + toString = realToString; +} +for (let iters = 0; iters < 2000; ++iters) { + count=27745; tryItOut("with({x: (c) = (x2 = [])})false;"); + tryEnsureSanity(); + count=35594; tryItOut("switch(null) { case this.__defineSetter__(\"window\", function () { yield \"\" } ): break; }"); + tryEnsureSanity(); + count=45020; tryItOut("with({}) { (this.__defineGetter__(\"x\", function (y)this)); } "); + tryEnsureSanity(); + count=45197; tryItOut("M:with((p={}, (p.z = <x/> === '' )()))/*TUUL*/for each (let y in [true, {}, {}, (void 0), true, true, true, (void 0), true, (void 0)]) { return; }"); + tryEnsureSanity(); + gc(); + tryEnsureSanity(); + count=45254; tryItOut("for each (NaN in this);"); + tryEnsureSanity(); +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/regress-476653.js b/js/src/tests/js1_8/extensions/regress-476653.js new file mode 100644 index 000000000..1b33cdb9c --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-476653.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 = 476653; +var summary = 'Do not crash @ QuoteString'; +var actual = ''; +var expect = ''; + + +printBugNumber(BUGNUMBER); +printStatus (summary); + + +for each (let x1 in ['']) +for (i = 0; i < 1; ++i) {} +delete uneval; +for (i = 0; i < 1; ++i) {} +for each (let x in [new String('q'), '', /x/, '', /x/]) { + for (var y = 0; y < 7; ++y) { if (y == 2 || y == 6) { setter = x; } } +} +try +{ + this.f(z); +} +catch(ex) +{ +} + + +reportCompare(expect, actual, summary); + diff --git a/js/src/tests/js1_8/extensions/regress-476869.js b/js/src/tests/js1_8/extensions/regress-476869.js new file mode 100644 index 000000000..9b61596c0 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-476869.js @@ -0,0 +1,45 @@ +// |reftest| skip-if(Android) +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 476869; +var summary = 'Do not assert: v != JSVAL_ERROR_COOKIE'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof gczeal == 'undefined') + { + gczeal = (function (){}); + } + + + function f() + { + (new Function("gczeal(1); for each (let y in [/x/,'',new Boolean(false),new Boolean(false),new Boolean(false),'',/x/,new Boolean(false),new Boolean(false)]){}"))(); + } + __proto__.__iterator__ = this.__defineGetter__("", function(){}) + f(); + + + delete __proto__.__iterator__; + + gczeal(0); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-479252.js b/js/src/tests/js1_8/extensions/regress-479252.js new file mode 100644 index 000000000..1f65c41c9 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-479252.js @@ -0,0 +1,41 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 479252; +var summary = 'Avoid watchdog ticks when idle in shell'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof sleep != 'function' || typeof scatter != 'function' || + typeof timeout != 'function') + { + print(expect = actual = 'Test skipped: requires mulithreads and timeout.'); + } + else + { + expectExitCode(6); + + function f() { sleep(100); } + timeout(1.0); + scatter([f,f,f,f,f]); + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-479381.js b/js/src/tests/js1_8/extensions/regress-479381.js new file mode 100644 index 000000000..e8c4a4d1a --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-479381.js @@ -0,0 +1,51 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Jason Orendorff + */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 479381; +var summary = 'Do not crash @ js_FinalizeStringRT with multi-threads.'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof gczeal != 'function' || typeof scatter != 'function') + { + print(expect = actual = 'Test skipped: requires mulithreads'); + } + else + { + expect = actual = 'No Crash'; + + gczeal(2); + + function f() { + var s; + for (var i = 0; i < 9999; i++) + s = 'a' + String(i)[3] + 'b'; + return s; + } + + print(scatter([f, f, f, f])); + + gczeal(0); + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/extensions/regress-481989.js b/js/src/tests/js1_8/extensions/regress-481989.js new file mode 100644 index 000000000..36efb7567 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-481989.js @@ -0,0 +1,19 @@ +/* -*- 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 = 481989; +var summary = 'TM: Do not assert: SPROP_HAS_STUB_SETTER(sprop)'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + + +y = this.watch("x", function(){}); for each (let y in ['', '']) x = y; + + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/extensions/regress-482263.js b/js/src/tests/js1_8/extensions/regress-482263.js new file mode 100644 index 000000000..0c395a494 --- /dev/null +++ b/js/src/tests/js1_8/extensions/regress-482263.js @@ -0,0 +1,26 @@ +/* -*- 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 = 482263; +var summary = 'TM: Do not assert: x->oprnd2() == lirbuf->sp || x->oprnd2() == gp_ins'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + + +Object.defineProperty(__proto__, "x", +{ + enumerable: true, configurable: true, + get: function () { return ([]) } +}); +for each (let x in []) { for each (let x in ['', '']) { } } + + +reportCompare(expect, actual, summary); + +delete __proto__.x; diff --git a/js/src/tests/js1_8/extensions/shell.js b/js/src/tests/js1_8/extensions/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/js1_8/extensions/shell.js diff --git a/js/src/tests/js1_8/extensions/simple-tree.js b/js/src/tests/js1_8/extensions/simple-tree.js new file mode 100644 index 000000000..3795ee61b --- /dev/null +++ b/js/src/tests/js1_8/extensions/simple-tree.js @@ -0,0 +1,52 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Jason Orendorff + */ + +//----------------------------------------------------------------------------- + +var summary = "Create a tree of threads"; + +var N = 50; // number of threads to create + +printStatus (summary); + +function range(start, stop) { + var a = []; + for (var i = start; i < stop; i++) + a.push(i); + return a; +} + +function tree(start, stop) { + sleep(0.001); + + if (start >= stop) + return []; + else if (start + 1 >= stop) + return [start]; + + sleep(0.001); + + let mid = start + Math.floor((stop - start) / 2); + let halves = scatter([function () { return tree(start, mid); }, + function () { return tree(mid, stop); }]); + sleep(0.001); + return Array.prototype.concat.apply([], halves); +} + +var expect; +var actual; + +if (typeof scatter == 'undefined' || typeof sleep == 'undefined') { + print('Test skipped. scatter or sleep not defined.'); + expect = actual = 'Test skipped.'; +} else { + expect = range(0, N).toSource(); + actual = tree(0, N).toSource(); +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/genexps/regress-347739.js b/js/src/tests/js1_8/genexps/regress-347739.js new file mode 100644 index 000000000..cdc4c9c6a --- /dev/null +++ b/js/src/tests/js1_8/genexps/regress-347739.js @@ -0,0 +1,51 @@ +/* -*- 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 = 347739; +var summary = 'generator_instance.close readonly and immune'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + function gen_test(test_index) + { + try { + yield 1; + } finally { + actual += "Inside finally: "+test_index + ' '; + } + } + + actual = ''; + expect = 'Inside finally: 1 Inside finally: 2 '; + + var iter1 = gen_test(1); + var close = iter1.close; + iter1.close = null; + delete iter1.close; + iter1.next(); + iter1.close(); + + var iter2 = gen_test(2); + for (i in iter2) { + iter2.close = null; + delete iter2.close; + } + + reportCompare(expect, actual, summary + ': 2'); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/genexps/regress-349012-01.js b/js/src/tests/js1_8/genexps/regress-349012-01.js new file mode 100644 index 000000000..1e3e03f28 --- /dev/null +++ b/js/src/tests/js1_8/genexps/regress-349012-01.js @@ -0,0 +1,54 @@ +/* -*- 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 = 349012; +var summary = 'closing a generator fails to report error if yield during close is ignored'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +if (typeof quit != 'undefined') +{ + quit(0); +} + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = "Inner finally,Outer finally"; + + function gen() + { + try { + try { + yield 1; + } finally { + actual += "Inner finally"; + yield 2; + } + } finally { + actual += ",Outer finally"; + } + } + + try { + for (var i in gen()) + break; + } catch (e) { + if (!(e instanceof TypeError)) + throw e; + } + + reportCompare(expect, actual, summary); + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/genexps/regress-349326.js b/js/src/tests/js1_8/genexps/regress-349326.js new file mode 100644 index 000000000..eea4e98a7 --- /dev/null +++ b/js/src/tests/js1_8/genexps/regress-349326.js @@ -0,0 +1,148 @@ +/* -*- 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 = 349326; +var summary = 'closing generators'; +var actual = 'PASS'; +var expect = 'PASS'; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + let closed; + + function gen() + { + try { + yield 1; + yield 2; + } finally { + closed = true; + } + } + +// Test that return closes the generator + function test_return() + { + for (let i in gen()) { + if (i != 1) + throw "unexpected generator value"; + return 10; + } + } + + closed = false; + test_return(); + if (closed !== true) + throw "return does not close generator"; + +// test that break closes generator + + closed = false; + for (let i in gen()) { + if (i != 1) + throw "unexpected generator value"; + break; + } + if (closed !== true) + throw "break does not close generator"; + +label: { + for (;;) { + closed = false; + for (let i in gen()) { + if (i != 1) + throw "unexpected generator value"; + break label; + } + } + } + + if (closed !== true) + throw "break does not close generator"; + +// test that an exception closes generator + + function function_that_throws() + { + throw function_that_throws; + } + + try { + closed = false; + for (let i in gen()) { + if (i != 1) + throw "unexpected generator value"; + function_that_throws(); + } + } catch (e) { + if (e !== function_that_throws) + throw e; + } + + if (closed !== true) + throw "exception does not close generator"; + +// Check consistency of finally execution in presence of generators + + let gen2_was_closed = false; + let gen3_was_closed = false; + let finally_was_executed = false; + + function gen2() { + try { + yield 2; + } finally { + if (gen2_was_closed || !finally_was_executed || !gen3_was_closed) + throw "bad oder of gen2 finally execution" + gen2_was_closed = true; + throw gen2; + } + } + + function gen3() { + try { + yield 3; + } finally { + if (gen2_was_closed || finally_was_executed || gen3_was_closed) + throw "bad oder of gen3 finally execution" + gen3_was_closed = true; + } + } + +label2: { + try { + for (let i in gen2()) { + try { + for (let j in gen3()) { + break label2; + } + } finally { + if (gen2_was_closed || finally_was_executed || !gen3_was_closed) + throw "bad oder of try-finally execution"; + finally_was_executed = true; + } + } + throw "gen2 finally should throw"; + } catch (e) { + if (e != gen2) throw e; + } + } + + print("OK"); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/genexps/regress-384991.js b/js/src/tests/js1_8/genexps/regress-384991.js new file mode 100644 index 000000000..a34adfb3f --- /dev/null +++ b/js/src/tests/js1_8/genexps/regress-384991.js @@ -0,0 +1,59 @@ +/* -*- 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 = 384991; +var summary = ' w(yield) should not cause "yield expression must be parenthesized" syntax error'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 'No Error'; + + try + { + actual = 'No Error'; + (function() { w((yield)); }); + } + catch(ex) + { + actual = ex + ''; + } + reportCompare(expect, actual, summary + ': 1'); + + try + { + actual = 'No Error'; + (function() { w(1 ? yield : 0); }); + } + catch(ex) + { + actual = ex + ''; + } + reportCompare(expect, actual, summary + ': 2'); + + try + { + actual = 'No Error'; + (function () { f(x = yield); const x = undefined; }); + } + catch(ex) + { + actual = ex + ''; + } + reportCompare(expect, actual, summary + ': 3'); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/genexps/regress-665286.js b/js/src/tests/js1_8/genexps/regress-665286.js new file mode 100644 index 000000000..fc8f92266 --- /dev/null +++ b/js/src/tests/js1_8/genexps/regress-665286.js @@ -0,0 +1,33 @@ +/* -*- 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 = 665286; +var summary = 'yield in arguments list'; +var actual = ''; +var expect = ''; + +function reported() { + function f() { + x + } + f(yield []) +} + +function simplified1() { + print(yield) +} + +function simplified2() { + print(1, yield) +} + +reportCompare(reported.isGenerator(), true, "reported case: is generator"); +reportCompare(typeof reported(), "object", "reported case: calling doesn't crash"); +reportCompare(simplified1.isGenerator(), true, "simplified case 1: is generator"); +reportCompare(typeof simplified1(), "object", "simplified case 1: calling doesn't crash"); +reportCompare(simplified2.isGenerator(), true, "simplified case 2: is generator"); +reportCompare(typeof simplified2(), "object", "simplified case 2: calling doesn't crash"); diff --git a/js/src/tests/js1_8/genexps/regress-683738.js b/js/src/tests/js1_8/genexps/regress-683738.js new file mode 100644 index 000000000..de563645d --- /dev/null +++ b/js/src/tests/js1_8/genexps/regress-683738.js @@ -0,0 +1,71 @@ +/* -*- 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 = 683738; +var summary = 'return with argument and lazy generator detection'; +var actual = ''; +var expect = ''; + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = "generator function foo returns a value"; + try + { + actual = 'No Error'; + eval("function foo(x) { if (x) { return this; } else { yield 3; } }"); + } + catch(ex) + { + actual = ex.message; + } + reportCompare(expect, actual, summary + ": 1"); + + expect = "generator function foo returns a value"; + try + { + actual = 'No Error'; + eval("function foo(x) { if (x) { yield 3; } else { return this; } }"); + } + catch(ex) + { + actual = ex.message; + } + reportCompare(expect, actual, summary + ": 2"); + + expect = "generator function foo returns a value"; + try + { + actual = 'No Error'; + eval("function foo(x) { if (x) { return this; } else { (yield 3); } }"); + } + catch(ex) + { + actual = ex.message; + } + reportCompare(expect, actual, summary + ": 3"); + + expect = "generator function foo returns a value"; + try + { + actual = 'No Error'; + eval("function foo(x) { if (x) { (yield 3); } else { return this; } }"); + } + catch(ex) + { + actual = ex.message; + } + reportCompare(expect, actual, summary + ": 4"); + +} diff --git a/js/src/tests/js1_8/genexps/shell.js b/js/src/tests/js1_8/genexps/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/js1_8/genexps/shell.js diff --git a/js/src/tests/js1_8/regress/browser.js b/js/src/tests/js1_8/regress/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/js1_8/regress/browser.js diff --git a/js/src/tests/js1_8/regress/regress-366941.js b/js/src/tests/js1_8/regress/regress-366941.js new file mode 100644 index 000000000..bca3933d4 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-366941.js @@ -0,0 +1,74 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Robert Sayre + */ + + +//----------------------------------------------------------------------------- +var BUGNUMBER = 366941; +var summary = 'Destructuring enumerations, iterations'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + var list1 = [[1,2],[3,4],[5,6]]; + var list2 = [[1,2,3],[4,5,6],[7,8,9]]; + + expect = '1,2;3,4;5,6;'; + actual = ''; + + for each (var [foo, bar] in list1) { + actual += foo + "," + bar + ";"; + } + + reportCompare(expect, actual, summary + ': 1'); + + expect = '1,2,3;4,5,6;7,8,9;'; + actual = ''; + for each (var [foo, bar, baz] in list2) { + actual += foo + "," + bar + "," + baz + ";"; + } + + reportCompare(expect, actual, summary + ': 2'); + + function gen(list) { + for each (var test in list) { + yield test; + } + } + + var iter1 = gen(list1); + + expect = '1,2;3,4;5,6;'; + actual = ''; + + for (var [foo, bar] in iter1) { + actual += foo + "," + bar + ";"; + } + + reportCompare(expect, actual, summary + ': 3'); + + var iter2 = gen(list2); + expect = '1,2,3;4,5,6;7,8,9;'; + actual = ''; + + for (var [foo, bar, baz] in iter2) { + actual += foo + "," + bar + "," + baz + ";"; + } + + reportCompare(expect, actual, summary + ': 4'); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-384412.js b/js/src/tests/js1_8/regress/regress-384412.js new file mode 100644 index 000000000..55cbdf9c0 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-384412.js @@ -0,0 +1,98 @@ +// |reftest| skip-if(!xulRuntime.shell) +/* -*- 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 = 384412; +var summary = 'Exercise frame handling code'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + +/* + * Generators + */ + +/* Generator yields properly */ + f = (function(n) { for (var i = 0; i != n; i++) yield i }); + g = f(3); + expect(0, g.next()); + expect(1, g.next()); + expect(2, g.next()); + s = "no exception"; + try { g.next(); } catch (e) { s = e + ""; } + expect("[object StopIteration]", s); + +/* Generator yields properly in finally */ + f = (function(n) { + try { + for (var i = 0; i != n; i++) + yield i; + } finally { + yield "finally"; + } + }); + + g = f(3); + expect(0, g.next()); + expect(1, g.next()); + expect(2, g.next()); + expect("finally", g.next()); + +/* Generator throws when closed with yield in finally */ + g = f(3); + expect(0, g.next()); + s = "no exception"; + try { g.close(); } catch (e) { s = e + ""; }; + expect("TypeError: yield from closing generator " + f.toSource(), s); + + +/* + * Calls that have been replaced with js_PushFrame() &c... + */ + f = (function() { return arguments[(arguments.length - 1) / 2]; }); + expect(2, f(1, 2, 3)); + expect(2, f.call(null, 1, 2, 3)); + expect(2, f.apply(null, [1, 2, 3])); + expect("a1c", "abc".replace("b", f)); + s = "no exception"; + try { + "abc".replace("b", (function() { throw "hello" })); + } catch (e) { + s = e + ""; + } + expect("hello", s); + expect(6, [1, 2, 3].reduce(function(a, b) { return a + b; })); + s = "no exception"; + try { + [1, 2, 3].reduce(function(a, b) { if (b == 2) throw "hello"; }); + } catch (e) { + s = e + ""; + } + expect("hello", s); + + print("End of Tests"); + +/* + * Utility functions + */ + function expect(a, b) { + print('expect: ' + a + ', actual: ' + b); + reportCompare(a, b, summary); + } + + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-384758.js b/js/src/tests/js1_8/regress/regress-384758.js new file mode 100644 index 000000000..fa8771b42 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-384758.js @@ -0,0 +1,36 @@ +/* -*- 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 = 384758; +var summary = 'Statement can not follow expression closure with out intervening ;'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 'SyntaxError: missing ; before statement'; + try + { + eval('(function() { if(t) function x() foo() bar(); })'); + } + catch(ex) + { + actual = ex + ''; + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-404734.js b/js/src/tests/js1_8/regress/regress-404734.js new file mode 100644 index 000000000..399c097c3 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-404734.js @@ -0,0 +1,31 @@ +/* -*- 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 = 404734; +var summary = 'Object destructuring shorthand'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + var o = {p: 42, q: true}; + var {p, q} = o; + + expect = '42,true'; + actual = p + ',' + q; + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-427798.js b/js/src/tests/js1_8/regress/regress-427798.js new file mode 100644 index 000000000..b6ae35045 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-427798.js @@ -0,0 +1,58 @@ +/* -*- 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 = 427798; +var summary = 'js_PutBlockObject is slow'; +var actual = 'Good result'; +var expect = 'Good result'; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + function f(N) + { + for (var i = 0; i != N; ++i) { + var f, g; + { + let j = i + 1; + f = function() { j += 2; return j; } + if (f() != i + 3) + throw "Bad result"; + } + if (f() != i + 5) + throw "Bad result"; + { + let j = i + 1, k = i + 2; + f = function() { j += 2; k++; return j + k; } + if (f() != i + i + 6) + throw "Bad result"; + } + if (f() != i + i + 9) + throw "Bad result"; + } + } + + try + { + f(20*1000); + } + catch(ex) + { + actual = ex + ''; + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-433279-01.js b/js/src/tests/js1_8/regress/regress-433279-01.js new file mode 100644 index 000000000..d3bbbb595 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-433279-01.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 = 433279; +var summary = 'Do not assert: pn != tc->parseContext->nodeList'; +var actual = 'No Crash'; +var expect = 'No Crash'; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + var { sin, PI } = Math; sin(PI / 2); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-433279-02.js b/js/src/tests/js1_8/regress/regress-433279-02.js new file mode 100644 index 000000000..4fdf9f9a9 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-433279-02.js @@ -0,0 +1,33 @@ +/* -*- 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 = 433279; +var summary = 'Do not assert: pn != tc->parseContext->nodeList'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + try + { + eval('var {a} = b; c(d + 1);'); + } + catch(ex) + { + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-433279-03.js b/js/src/tests/js1_8/regress/regress-433279-03.js new file mode 100644 index 000000000..2b4b9ef35 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-433279-03.js @@ -0,0 +1,33 @@ +/* -*- 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 = 433279; +var summary = 'Do not assert: pn != tc->parseContext->nodeList'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + try + { + eval('({a}) = b; with({}) { for(let y in z) { } }'); + } + catch(ex) + { + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-442333-01.js b/js/src/tests/js1_8/regress/regress-442333-01.js new file mode 100644 index 000000000..4434da76e --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-442333-01.js @@ -0,0 +1,38 @@ +// |reftest| skip +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 442333; +var summary = 'Remove eval\'s optional second argument'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 'ReferenceError: a is not defined'; + var o = {a : 1}; + + try + { + eval('a', o); + } + catch(ex) + { + actual = ex + ''; + } + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-452491.js b/js/src/tests/js1_8/regress/regress-452491.js new file mode 100644 index 000000000..13d569865 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-452491.js @@ -0,0 +1,29 @@ +/* -*- 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 = 452491; +var summary = 'Do not crash with JIT: with new'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for (var j=0;j<5;++j) (new (function(q) q)).a; + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-455981-01.js b/js/src/tests/js1_8/regress/regress-455981-01.js new file mode 100644 index 000000000..06c3ea368 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-455981-01.js @@ -0,0 +1,36 @@ +/* -*- 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 = 455981; +var summary = 'Do not assert: entry->localKind == JSLOCAL_ARG'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 'SyntaxError: duplicate argument names not allowed in this context'; + + try + { + eval('(function ({a, b, c, d, e, f, g, h, q}, q) { })'); + } + catch(ex) + { + actual = ex + ''; + } + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-455981-02.js b/js/src/tests/js1_8/regress/regress-455981-02.js new file mode 100644 index 000000000..e91086475 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-455981-02.js @@ -0,0 +1,36 @@ +/* -*- 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 = 455981; +var summary = 'Do not assert: entry->localKind == JSLOCAL_ARG'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 'SyntaxError: duplicate argument names not allowed in this context'; + + try + { + eval('(function ({a: {b: bb, c: cc, d: dd}, m: [x, n, o, p]}, x) {});'); + } + catch(ex) + { + actual = ex + ''; + } + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-457065-01.js b/js/src/tests/js1_8/regress/regress-457065-01.js new file mode 100644 index 000000000..62f379179 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-457065-01.js @@ -0,0 +1,32 @@ +/* -*- 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 = 457065; +var summary = 'Do not assert: !fp->callee || fp->thisp == fp->argv[-1].toObjectOrNull()'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + var e = eval; + for (var a in this) { } + (function() { eval("this; for (let b in [0,1,2]) { }"); })(); + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-457065-02.js b/js/src/tests/js1_8/regress/regress-457065-02.js new file mode 100644 index 000000000..2b97ff225 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-457065-02.js @@ -0,0 +1,30 @@ +/* -*- 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 = 457065; +var summary = 'Do not assert: !fp->callee || fp->thisp == fp->argv[-1].toObjectOrNull()'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + (function(){ eval('this'); (function(){ for(let y in [0,1,2]) 6;})(); })(); + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-458076.js b/js/src/tests/js1_8/regress/regress-458076.js new file mode 100644 index 000000000..c2b7ab7a6 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-458076.js @@ -0,0 +1,30 @@ +/* -*- 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 = 458076; +var summary = 'Do not assert with JIT: !lhs->isQuad() && !rhs->isQuad()'; +var actual = 'No Crash'; +var expect = 'No Crash'; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for (let j = 0; j < 3; ++j) { true == 0; } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-459185.js b/js/src/tests/js1_8/regress/regress-459185.js new file mode 100644 index 000000000..fd31d462d --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-459185.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 = 459185; +var summary = 'Do not assert: pn->pn_arity == PN_BINARY'; +var actual = 'No Crash'; +var expect = 'No Crash'; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + try + { + for (var {a: []} in []) { } + } + catch(ex) + { + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-459186.js b/js/src/tests/js1_8/regress/regress-459186.js new file mode 100644 index 000000000..0aeda8ede --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-459186.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 = 459186; +var summary = 'Do not crash in CheckDestructuring'; +var actual = 'No Crash'; +var expect = 'No Crash'; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + try + { + for (var [,{y}] in []) {} + } + catch(ex) + { + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-459389.js b/js/src/tests/js1_8/regress/regress-459389.js new file mode 100644 index 000000000..9f84d9250 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-459389.js @@ -0,0 +1,118 @@ +/* -*- 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 = 459389; +var summary = 'Do not crash with JIT'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +print('mmmm, food!'); + + +var SNI = {}; +SNI.MetaData={}; +SNI.MetaData.Parameter=function() +{ +var parameters={}; +this.addParameter=function(key,value) +{ +parameters[key]=[]; +parameters[key].push(value); +}; +this.getParameter=function(key,separator){ +if(!parameters[key]) +{ +return; +} +return parameters[key].join(separator); +}; +this.getKeys=function() +{ +return parameters; +}; +}; +SNI.MetaData.Manager=function(){ +var m=new SNI.MetaData.Parameter(); +this.getParameter=m.getParameter; +}; +var MetaDataManager=SNI.MetaData.Manager; +SNI.Ads={ }; +SNI.Ads.Url=function(){ +var p=new SNI.MetaData.Parameter(); +this.addParameter=p.addParameter; +this.getParameter=p.getParameter; +}; +function Ad() { +var url=new SNI.Ads.Url(); +this.addParameter=url.addParameter; +this.getParameter=url.getParameter; +} +function DartAd() +AdUrl.prototype=new Ad(); +function AdUrl() { } +function AdRestriction() { +var p=new SNI.MetaData.Parameter(); +this.addParameter=p.addParameter; +this.getParameter=p.getParameter; +this.getKeys=p.getKeys; +} +function AdRestrictionManager(){ +this.restriction=[]; +this.isActive=isActive; +this.isMatch=isMatch; +this.startMatch=startMatch; +function isActive(ad,mdm){ +var value=false; +for(var i=0;i<this.restriction.length;i++) +{ +adRestriction=this.restriction[i]; +value=this.startMatch(ad,mdm,adRestriction); +} +} +function startMatch(ad,mdm,adRestriction){ +for(var key in adRestriction.getKeys()){ +var restrictions=adRestriction.getParameter(key,','); +var value=mdm.getParameter(key,''); +match=this.isMatch(value,restrictions); +if(!match){ +value=ad.getParameter(key,'') +match=this.isMatch(value,restrictions); +} +} +} +function isMatch(value,restrictions){ +var match=false; +if(value) +{ +splitValue=value.split(''); +for(var x=0;x<splitValue.length;x++){ +for(var a;a<restrictions.length;a++){ } +} +} +return match; +} +} +var adRestrictionManager = new AdRestrictionManager(); +var restrictionLeader6 = new AdRestriction(); +restrictionLeader6.addParameter("", ""); +adRestrictionManager.restriction.push(restrictionLeader6); +var restrictionLeader7 = new AdRestriction(); +restrictionLeader7.addParameter("", ""); +adRestrictionManager.restriction.push(restrictionLeader7); +function FoodAd(adtype) +{ + ad=new DartAd() + ad.addParameter("",adtype) + adRestrictionManager.isActive(ad, mdManager) +} +var mdManager = new MetaDataManager() ; + FoodAd('P') + + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/regress/regress-461930.js b/js/src/tests/js1_8/regress/regress-461930.js new file mode 100644 index 000000000..80626f2f9 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-461930.js @@ -0,0 +1,31 @@ +/* -*- 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 = 461930; +var summary = 'TM: Do not assert: count == _stats.pages'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + function gen() { for (let j = 0; j < 4; ++j) { yield 1; yield 2; gc(); } } + for (let i in gen()) { } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-461932.js b/js/src/tests/js1_8/regress/regress-461932.js new file mode 100644 index 000000000..5456fbd83 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-461932.js @@ -0,0 +1,31 @@ +/* -*- 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 = 461932; +var summary = 'TM: Do not crash in nanojit::LIns::isop'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + function gen() { for (var j = 0; j < 4; ++j) { NaN; yield 3; } } + for (let i in gen()) { } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-463334-01.js b/js/src/tests/js1_8/regress/regress-463334-01.js new file mode 100644 index 000000000..e30ee9560 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-463334-01.js @@ -0,0 +1,31 @@ +/* -*- 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 = 463334; +var summary = 'TM: Do not crash in isPromoteInt'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + u = 3; + for (let i in (function() { for (var j=0;j<4;++j) { void u; yield; } })()); + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-463334-02.js b/js/src/tests/js1_8/regress/regress-463334-02.js new file mode 100644 index 000000000..b0ccafd39 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-463334-02.js @@ -0,0 +1,33 @@ +/* -*- 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 = 463334; +var summary = 'TM: Do not crash in isPromoteInt'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for (let i in + (function() { for (let j = 0; j < 4; ++j) with({t: NaN}) yield; })()) + { + } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-464096.js b/js/src/tests/js1_8/regress/regress-464096.js new file mode 100644 index 000000000..8e699ebb6 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-464096.js @@ -0,0 +1,32 @@ +/* -*- 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 = 464096; +var summary = 'TM: Do not assert: tm->recoveryDoublePoolPtr > tm->recoveryDoublePool'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for (let f in [1,1]); + Object.prototype.__defineGetter__('x', function() gc()); + (function() { for each (let j in [1,1,1,1,1]) { var y = .2; } })(); + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-464418.js b/js/src/tests/js1_8/regress/regress-464418.js new file mode 100644 index 000000000..f05564006 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-464418.js @@ -0,0 +1,46 @@ +// |reftest| skip-if(Android) +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 464418; +var summary = 'Do not assert: fp->slots + fp->script->nfixed + ' + + 'js_ReconstructStackDepth(cx, fp->script, fp->regs->pc) == fp->regs->sp'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + if (typeof gczeal == 'function') + { + gczeal(2); + } + + for (let q = 0; q < 50; ++q) { + new Function("for (var i = 0; i < 5; ++i) { } ")(); + var w = "r".match(/r/); + new Function("for (var j = 0; j < 1; ++j) { } ")(); + } + + + if (typeof gczeal == 'function') + { + gczeal(0); + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-464978.js b/js/src/tests/js1_8/regress/regress-464978.js new file mode 100644 index 000000000..6f7001a98 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-464978.js @@ -0,0 +1,30 @@ +/* -*- 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 = 464978; +var summary = 'Do not hang with [] + null'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for (let j = 0; j < 2; ++j) { [] + null; } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465220.js b/js/src/tests/js1_8/regress/regress-465220.js new file mode 100644 index 000000000..ca4154fe6 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465220.js @@ -0,0 +1,43 @@ +/* -*- 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 = 465220; +var summary = 'Do not assert: anti-nesting'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 'TypeError: can\'t convert o to primitive type'; + + + try + { + var o = {toString: function()(i > 2) ? this : "foo"}; + var s = ""; + for (var i = 0; i < 5; i++) + s += o + o; + print(s); + actual = 'No Exception'; + } + catch(ex) + { + actual = 'TypeError: can\'t convert o to primitive type'; + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465234.js b/js/src/tests/js1_8/regress/regress-465234.js new file mode 100644 index 000000000..2cf8f3781 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465234.js @@ -0,0 +1,33 @@ +/* -*- 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 = 465234; +var summary = '"" <= null'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = true; + actual = true; + + + for (let j = 0; j < 5; ++j) actual = actual && ("" <= null); + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465239.js b/js/src/tests/js1_8/regress/regress-465239.js new file mode 100644 index 000000000..8a012d691 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465239.js @@ -0,0 +1,33 @@ +/* -*- 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 = 465239; +var summary = '"1e+81" ^ 3'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = '3,3,3,3,3,'; + actual = ''; + + + for (let j = 0; j < 5; ++j) actual += ("1e+81" ^ 3) + ','; + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465241.js b/js/src/tests/js1_8/regress/regress-465241.js new file mode 100644 index 000000000..e756c8739 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465241.js @@ -0,0 +1,33 @@ +/* -*- 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 = 465241; +var summary = '"0" in [3]'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = true; + actual = true; + + + for (let j = 0; j < 5; ++j) actual = actual && ("0" in [3]); + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465249.js b/js/src/tests/js1_8/regress/regress-465249.js new file mode 100644 index 000000000..f3c61fd07 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465249.js @@ -0,0 +1,30 @@ +/* -*- 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 = 465249; +var summary = 'Do not assert: (m != JSVAL_INT) || isInt32(*vp)'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + eval("for (let j = 0; j < 5; ++j) { (0x50505050) + (0x50505050); }"); + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465261.js b/js/src/tests/js1_8/regress/regress-465261.js new file mode 100644 index 000000000..b9aac8bde --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465261.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 = 465261; +var summary = 'TM: Do not assert: '; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for (let z = 0; z < 2; ++z) { + for each (let x in [0, true, (void 0), 0, (void 0)]) { + if(x){} + } + }; + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465308.js b/js/src/tests/js1_8/regress/regress-465308.js new file mode 100644 index 000000000..7346532cb --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465308.js @@ -0,0 +1,31 @@ +/* -*- 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 = 465308; +var summary = '((0x60000009) * 0x60000009))'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = '-1073741824,-1073741824,-1073741824,-1073741824,-1073741824,'; + + for (let j=0;j<5;++j) + print(actual += "" + (0 | ((0x60000009) * 0x60000009)) + ','); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465454.js b/js/src/tests/js1_8/regress/regress-465454.js new file mode 100644 index 000000000..648639753 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465454.js @@ -0,0 +1,31 @@ +/* -*- 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 = 465454; +var summary = 'TM: do not crash with type-unstable loop'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for each (let b in [(-1/0), new String(''), new String(''), null, (-1/0), + (-1/0), new String(''), new String(''), null]) '' + b; + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465460-01.js b/js/src/tests/js1_8/regress/regress-465460-01.js new file mode 100644 index 000000000..2a21de495 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465460-01.js @@ -0,0 +1,32 @@ +/* -*- 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 = 465460; +var summary = 'TM: valueOf in a loop'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = '11111'; + + + (function(d) { for (let j = 0; j < 5; ++j) { actual += ('' + d); } })({valueOf: function()1}); + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465460-02.js b/js/src/tests/js1_8/regress/regress-465460-02.js new file mode 100644 index 000000000..9ba0431a7 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465460-02.js @@ -0,0 +1,30 @@ +/* -*- 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 = 465460; +var summary = 'TM: valueOf in a loop: do not assert'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for each (let c in [null, null, null, {}]) { } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465460-03.js b/js/src/tests/js1_8/regress/regress-465460-03.js new file mode 100644 index 000000000..a2e69b9ec --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465460-03.js @@ -0,0 +1,29 @@ +/* -*- 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 = 465460; +var summary = 'TM: valueOf in a loop: do not assert'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + for each (let j in [null, 2, 3]) { } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465460-04.js b/js/src/tests/js1_8/regress/regress-465460-04.js new file mode 100644 index 000000000..d470e8ac4 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465460-04.js @@ -0,0 +1,30 @@ +/* -*- 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 = 465460; +var summary = 'TM: valueOf in a loop: do not assert'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for (var j = 0; j < 3; ++j) { 1 & new Date; } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465460-05.js b/js/src/tests/js1_8/regress/regress-465460-05.js new file mode 100644 index 000000000..a8f06e3f8 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465460-05.js @@ -0,0 +1,30 @@ +/* -*- 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 = 465460; +var summary = 'TM: valueOf in a loop: do not assert'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for (var j = 0; j < 3; ++j) { 1 & Date; } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465460-06.js b/js/src/tests/js1_8/regress/regress-465460-06.js new file mode 100644 index 000000000..ed0b80e18 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465460-06.js @@ -0,0 +1,30 @@ +/* -*- 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 = 465460; +var summary = 'TM: valueOf in a loop: do not assert'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for each (let x in [1, {}, 1, null, 1, {}, 1, null, 1]) { } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465460-07.js b/js/src/tests/js1_8/regress/regress-465460-07.js new file mode 100644 index 000000000..46a4005a6 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465460-07.js @@ -0,0 +1,38 @@ +/* -*- 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 = 465460; +var summary = 'TM: valueOf in a loop: do not assert'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = actual = 'pass'; + + try + { + e = {}; for (j=0;j<3;++j) { 3 | e; } "PASS"; + } + catch(ex) + { + actual = ex + ''; + } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465460-08.js b/js/src/tests/js1_8/regress/regress-465460-08.js new file mode 100644 index 000000000..0fded4b00 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465460-08.js @@ -0,0 +1,30 @@ +/* -*- 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 = 465460; +var summary = 'TM: valueOf in a loop: do not assert'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for each (let _ in [{}, {}, null, null, null, null]) { } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465460-09.js b/js/src/tests/js1_8/regress/regress-465460-09.js new file mode 100644 index 000000000..6ccc5e8c7 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465460-09.js @@ -0,0 +1,30 @@ +/* -*- 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 = 465460; +var summary = 'TM: valueOf in a loop: do not assert'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for (let i in (function() { for (var j = 0; j < 3; ++j) yield; })()) { } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465460-10.js b/js/src/tests/js1_8/regress/regress-465460-10.js new file mode 100644 index 000000000..0b3a49bcd --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465460-10.js @@ -0,0 +1,30 @@ +/* -*- 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 = 465460; +var summary = 'TM: valueOf in a loop: do not assert'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for (let i = 0; i < 2; ++i) { ({}) + 3; } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465460-11.js b/js/src/tests/js1_8/regress/regress-465460-11.js new file mode 100644 index 000000000..656188beb --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465460-11.js @@ -0,0 +1,30 @@ +/* -*- 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 = 465460; +var summary = 'TM: valueOf in a loop: do not assert'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for (let d=0;d<2;++d) for (let a=0;a<1;++a) "" + (d && function(){}); + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465460-12.js b/js/src/tests/js1_8/regress/regress-465460-12.js new file mode 100644 index 000000000..2e0be80e8 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465460-12.js @@ -0,0 +1,30 @@ +/* -*- 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 = 465460; +var summary = 'TM: valueOf in a loop: do not assert'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for (var j = 0; j < 2; ++j) { if (null > "") { } } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465483.js b/js/src/tests/js1_8/regress/regress-465483.js new file mode 100644 index 000000000..39378a510 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465483.js @@ -0,0 +1,30 @@ +/* -*- 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 = 465483; +var summary = 'Type instability leads to undefined being added as a string instead of as a number'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 'NaN'; + + for each (i in [4, 'a', 'b', (void 0)]) print(actual = '' + (i + i)); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-465567-01.js b/js/src/tests/js1_8/regress/regress-465567-01.js new file mode 100644 index 000000000..862c2abe4 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465567-01.js @@ -0,0 +1,29 @@ +/* -*- 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 = 465567; +var summary = 'TM: Weirdness with var, let, multiple assignments'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +expect = '99999'; + + +for (let j = 0; j < 5; ++j) { + var e; + e = 9; + print(actual += '' + e); + e = 47; + if (e & 0) { + let e; + } +} + + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/regress/regress-465567-02.js b/js/src/tests/js1_8/regress/regress-465567-02.js new file mode 100644 index 000000000..a1ba74db5 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465567-02.js @@ -0,0 +1,25 @@ +/* -*- 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 = 465567; +var summary = 'TM: Do not assert: JSVAL_TAG(v) == JSVAL_OBJECT'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + + +try +{ + eval("for each (e in ['', true, 1, true, 1]) { e = null; if (0) { let e; var e; } }"); +} +catch(ex) +{ +} + + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/regress/regress-465688.js b/js/src/tests/js1_8/regress/regress-465688.js new file mode 100644 index 000000000..9df47f983 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-465688.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 = 465688; +var summary = 'Do not assert: (m != JSVAL_INT) || isInt32(*vp),'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + for each (let d in [-0x80000000, -0x80000000]) - -d; + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-466128.js b/js/src/tests/js1_8/regress/regress-466128.js new file mode 100644 index 000000000..a17097141 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-466128.js @@ -0,0 +1,31 @@ +/* -*- 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 = 466128; +var summary = 'Do not assert: !ti->stackTypeMap.matches(ti_other->stackTypeMap)'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + for (let a = 0; a < 3; ++a) { + for each (let b in [1, 2, "three", 4, 5, 6, 7, 8]) { + } + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-466787.js b/js/src/tests/js1_8/regress/regress-466787.js new file mode 100644 index 000000000..f5bbb67ec --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-466787.js @@ -0,0 +1,33 @@ +/* -*- 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 = 466787; +var summary = 'TM: new Number() should stay a number during recording'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = '4444'; + + + for (let j = 0; j < 4; ++j) { for each (let one in [new Number(1)]) { + print(actual += '' + (3 + one)); } } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-467495-01.js b/js/src/tests/js1_8/regress/regress-467495-01.js new file mode 100644 index 000000000..2f6014c28 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-467495-01.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 = 467495; +var summary = 'Do not crash @ js_Interpret'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + (function() { x = 0; function x() 4; var x; const y = 1; })(); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-467495-02.js b/js/src/tests/js1_8/regress/regress-467495-02.js new file mode 100644 index 000000000..0496d5441 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-467495-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 = 467495; +var summary = 'Do not crash @ js_Interpret'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + try + { + eval("(function(){const y = 1; function x() '' let functional, x})();"); + } + catch(ex) + { + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-467495-03.js b/js/src/tests/js1_8/regress/regress-467495-03.js new file mode 100644 index 000000000..2d4560c0f --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-467495-03.js @@ -0,0 +1,47 @@ +/* -*- 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 = 467495; +var summary = 'TCF_FUN_CLOSURE_VS_VAR is necessary'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + function f(x) + { + actual = ''; + var g; + print(actual += typeof g + ','); + + if (x) + function g(){}; + + print(actual += g); + } + + expect = 'undefined,undefined'; + f(0); + + reportCompare(expect, actual, summary + ': f(0): '); + + expect = 'undefined,function g(){}'; + + f(1); + + reportCompare(expect, actual, summary + ': f(1): '); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-467495-04.js b/js/src/tests/js1_8/regress/regress-467495-04.js new file mode 100644 index 000000000..bb77c5a3b --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-467495-04.js @@ -0,0 +1,42 @@ +/* -*- 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 = 467495; +var summary = 'TCF_FUN_CLOSURE_VS_VAR is necessary'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + function g() { + if (1) + function x() {}; + var x; + const y = 1; + } + + try + { + g(); + } + catch(ex) + { + actual = ex + ''; + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-467495-05.js b/js/src/tests/js1_8/regress/regress-467495-05.js new file mode 100644 index 000000000..505fb6bd6 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-467495-05.js @@ -0,0 +1,31 @@ +/* -*- 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 = 467495; +var summary = 'TCF_FUN_CLOSURE_VS_VAR is necessary'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 'function x() {}'; + + function g(x) { if (1) function x() {} return x; } + print(actual = g(1) + ''); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-467495-06.js b/js/src/tests/js1_8/regress/regress-467495-06.js new file mode 100644 index 000000000..d8bc81c83 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-467495-06.js @@ -0,0 +1,44 @@ +/* -*- 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 = 467495; +var summary = 'TCF_FUN_CLOSURE_VS_VAR is necessary'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + function f(x) + { + var y = 1; + if (Math) + function x() { } + if (Math) + function y() { } + return [x, y]; + } + + var r = f(0); + + if (typeof(r[0]) != "function") + actual += "Bad r[0]"; + + if (typeof(r[1]) != "function") + throw "Bad r[1]"; + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-468711.js b/js/src/tests/js1_8/regress/regress-468711.js new file mode 100644 index 000000000..f5ff88a18 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-468711.js @@ -0,0 +1,30 @@ +/* -*- 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 = 468711; +var summary = 'TM: Do not assert: !JS_ON_TRACE(cx)'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + (5).toString(); for each (let b in [3, this]) { b.toString(); } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-469547.js b/js/src/tests/js1_8/regress/regress-469547.js new file mode 100644 index 000000000..32d96114d --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-469547.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 = 469547; +var summary = 'Do not crash with: for each (let [,] in [[], [], null]) {}'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + try + { + for each (let [,] in [[], [], null]) {} + } + catch(ex) + { + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-469625-02.js b/js/src/tests/js1_8/regress/regress-469625-02.js new file mode 100644 index 000000000..47ded9027 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-469625-02.js @@ -0,0 +1,35 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Jason Orendorff + */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 469625; +var summary = 'group assignment with rhs containing holes'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 'y'; + + Array.prototype[1] = 'y'; + var [x, y, z] = ['x', , 'z']; + + actual = y; + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-469625-03.js b/js/src/tests/js1_8/regress/regress-469625-03.js new file mode 100644 index 000000000..1e2d46cba --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-469625-03.js @@ -0,0 +1,42 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Jason Orendorff + */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 469625; +var summary = 'Do not assert: script->objectsOffset != 0'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + function f(x) { + var [a, b, [c0, c1]] = [x, x, x]; + } + + expect = `TypeError: (intermediate value)[Symbol.iterator](...).next(...).value is null`; + actual = 'No Error'; + try + { + f(null); + } + catch(ex) + { + actual = ex + ''; + } + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-471373.js b/js/src/tests/js1_8/regress/regress-471373.js new file mode 100644 index 000000000..15753b698 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-471373.js @@ -0,0 +1,43 @@ +/* -*- 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 = 471373; +var summary = 'TM: do not assert: (size_t)(regs.pc - script->code) < script->length'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + if (typeof window == 'undefined') + { + expectExitCode(5); + } + + + function g() { + var x = {}; + for (var b = 0; b < 2; ++b) { + yield x; + for (var c = 0; c < 10;++c) { + x.r = x; + } + } + } + for (let y in g()) { } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-471660.js b/js/src/tests/js1_8/regress/regress-471660.js new file mode 100644 index 000000000..1d219ee9d --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-471660.js @@ -0,0 +1,37 @@ +/* -*- 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 = 471660; +var summary = 'TM: Do not assert: !(fp->flags & JSFRAME_POP_BLOCKS)'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + y = {"a":1}; + + for (var w = 0; w < 5; ++w) { + + { let y; do break ; while (true); } + for each (let x in [{}, function(){}]) {y} + + } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-474769.js b/js/src/tests/js1_8/regress/regress-474769.js new file mode 100644 index 000000000..c423b9b3b --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-474769.js @@ -0,0 +1,35 @@ +/* -*- 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 = 474769; +var summary = 'TM: nested for each type-unstable loops'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 1; + + + for each (b in [1, 1, 1, 1.5, 1, 1]) { + (function() { for each (let h in [0, 0, 1.4, ""]) {} })(); + } + actual = b; + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-474771.js b/js/src/tests/js1_8/regress/regress-474771.js new file mode 100644 index 000000000..a5085426b --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-474771.js @@ -0,0 +1,41 @@ +// |reftest| skip-if(Android) +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 474771; +var summary = 'gczeal, prototype mangling, for..in'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 'PASS'; + if (typeof gczeal == 'function') + { + gczeal(2); + } + + Object.prototype.q = 3; + for each (let x in [6, 7]) { } print(actual = "PASS"); + + if (typeof gczeal == 'function') + { + gczeal(0); + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-474935.js b/js/src/tests/js1_8/regress/regress-474935.js new file mode 100644 index 000000000..118e14ff2 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-474935.js @@ -0,0 +1,40 @@ +/* -*- 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 = 474935; +var summary = 'Do not assert: !ti->typeMap.matches(ti_other->typeMap)'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + var a = ["", 0, 0, 0, 0, 0, "", "", 0, "", 0, ""]; + var i = 0; + var g = 0; + for each (let e in a) { + "" + [e]; + if (i == 3 || i == 7) { + for each (g in [1]) { + } + } + ++i; + } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-476655.js b/js/src/tests/js1_8/regress/regress-476655.js new file mode 100644 index 000000000..b1c2fb561 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-476655.js @@ -0,0 +1,39 @@ +/* -*- 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 = 476655; +var summary = 'Do not assert: depth <= (size_t) (fp->regs->sp - StackBase(fp))'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + try + { + eval( + "for(let y in ['', '']) try {for(let y in ['', '']) ( /x/g ); } finally {" + + "with({}){} } this.zzz.zzz" + + ); + } + catch(ex) + { + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-477234.js b/js/src/tests/js1_8/regress/regress-477234.js new file mode 100644 index 000000000..d10fb198f --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-477234.js @@ -0,0 +1,48 @@ +/* -*- 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 = 477234; +var summary = 'Do not assert: v != JSVAL_ERROR_COOKIE'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for (iters = 0; iters < 11500; ++iters) { + for each (let x in ['', '', '']){} + eval("Object.defineProperty(__proto__, 'x', " + + "{" + + " enumerable: true, configurable: true," + + " get: function(){}" + + "});"); + var a = uneval; + delete uneval; + uneval = a; + var b = toSource; + delete toSource; + toSource = b; + var c = toString; + delete toString; + toString = c; + } + + + delete __proto__.x; + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-477581.js b/js/src/tests/js1_8/regress/regress-477581.js new file mode 100644 index 000000000..2720f82fc --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-477581.js @@ -0,0 +1,35 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Jason Orendorff + */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 477581; +var summary = 'Do not assert: !regs.sp[-2].isPrimitive()'; +var actual = ''; +var expect = ''; + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + function g() { yield 2; } + var iterables = [[1], [], [], [], g()]; + for (let i = 0; i < iterables.length; i++) + for each (let j in iterables[i]) + ; + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-478205.js b/js/src/tests/js1_8/regress/regress-478205.js new file mode 100644 index 000000000..71d980579 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-478205.js @@ -0,0 +1,30 @@ +/* -*- 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 = 478205; +var summary = 'Do not assert: p->isQuad()'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for each (let x in ['', '']) { switch([]) {} } + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-479353.js b/js/src/tests/js1_8/regress/regress-479353.js new file mode 100644 index 000000000..0345f175c --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-479353.js @@ -0,0 +1,23 @@ +/* -*- 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 = 479353; +var summary = 'Do not assert: (uint32_t)(index_) < atoms_->length'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +function f(code) +{ + (eval("(function(){" + code + "});"))(); +} +x = {}; +f("y = this;"); +f("x, y; for each (let x in [arguments]) {}"); + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/regress/regress-479740.js b/js/src/tests/js1_8/regress/regress-479740.js new file mode 100644 index 000000000..bcbeaff03 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-479740.js @@ -0,0 +1,36 @@ +/* -*- 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 = 479740; +var summary = 'TM: Do not crash @ TraceRecorder::test_property_cache'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + + +try +{ + eval( + ' function f() {' + + ' for ( foobar in (function() {' + + ' for (var x = 0; x < 2; ++x) {' + + ' if (x % 2 == 1) { yield (this.z.z) = function(){} }' + + ' eval("this", false);' + + ' }' + + ' })());' + + ' function(){}' + + ' }' + + ' f();' + ); +} +catch(ex) +{ +} + + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/regress/regress-481800.js b/js/src/tests/js1_8/regress/regress-481800.js new file mode 100644 index 000000000..7a27e8b7f --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-481800.js @@ -0,0 +1,30 @@ +/* -*- 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 = 481800; +var summary = 'TM: Do not assert: (!lhs->isQuad() && !rhs->isQuad()) || (lhs->isQuad() && rhs->isQuad())'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + + for each (let x in ['', 0, 0, eval]) { y = x } ( function(){} ); + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/regress-483749.js b/js/src/tests/js1_8/regress/regress-483749.js new file mode 100644 index 000000000..74563ce89 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-483749.js @@ -0,0 +1,25 @@ +/* -*- 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 = 483749; +var summary = 'Do not assert: !js_IsActiveWithOrBlock(cx, fp->scopeChain, 0)'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + + +for each (let x in ['']) { + for (var b = 0; b < 5; ++b) { + if (b % 5 == 3) { + with([]) this; + } + } +} + + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_8/regress/regress-499524.js b/js/src/tests/js1_8/regress/regress-499524.js new file mode 100644 index 000000000..2b996eda2 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-499524.js @@ -0,0 +1,50 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ + +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ + +function isSyntaxError(code) { + try { + eval(code); + return false; + } catch (exception) { + if (SyntaxError.prototype.isPrototypeOf(exception)) + return true; + throw exception; + }; +}; + +/* + * Duplicate parameter names must be tolerated (as per ES3), unless + * the parameter list uses destructuring, in which case we claim the + * user has opted in to a modicum of sanity, and we forbid duplicate + * parameter names. + */ +assertEq(isSyntaxError("function f(x,x){}"), false); + +assertEq(isSyntaxError("function f(x,[x]){})"), true); +assertEq(isSyntaxError("function f(x,{y:x}){})"), true); +assertEq(isSyntaxError("function f(x,{x}){})"), true); + +assertEq(isSyntaxError("function f([x],x){})"), true); +assertEq(isSyntaxError("function f({y:x},x){})"), true); +assertEq(isSyntaxError("function f({x},x){})"), true); + +assertEq(isSyntaxError("function f([x,x]){}"), true); +assertEq(isSyntaxError("function f({x,x}){}"), true); +assertEq(isSyntaxError("function f({y:x,z:x}){}"), true); + +assertEq(isSyntaxError("function f(x,x,[y]){}"), true); +assertEq(isSyntaxError("function f(x,x,{y}){}"), true); +assertEq(isSyntaxError("function f([y],x,x){}"), true); +assertEq(isSyntaxError("function f({y},x,x){}"), true); + +assertEq(isSyntaxError("function f(a,b,c,d,e,f,g,h,b,[y]){}"), true); +assertEq(isSyntaxError("function f([y],a,b,c,d,e,f,g,h,a){}"), true); +assertEq(isSyntaxError("function f([a],b,c,d,e,f,g,h,i,a){}"), true); +assertEq(isSyntaxError("function f(a,b,c,d,e,f,g,h,i,[a]){}"), true); +assertEq(isSyntaxError("function f(a,b,c,d,e,f,g,h,i,[a]){}"), true); + +reportCompare(true, true); diff --git a/js/src/tests/js1_8/regress/regress-532491.js b/js/src/tests/js1_8/regress/regress-532491.js new file mode 100644 index 000000000..b05876327 --- /dev/null +++ b/js/src/tests/js1_8/regress/regress-532491.js @@ -0,0 +1,37 @@ +/* -*- 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 = 466128; +var summary = 'Do not assert: staticLevel == script->staticLevel, at ../jsobj.cpp'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + function f(foo) { + if (a % 2 == 1) { + try { + eval(foo); + } catch(e) {} + } + } + a = 1; + f("eval(\"x\")"); + f("x"); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_8/regress/shell.js b/js/src/tests/js1_8/regress/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/js1_8/regress/shell.js diff --git a/js/src/tests/js1_8/shell.js b/js/src/tests/js1_8/shell.js new file mode 100644 index 000000000..630b9de73 --- /dev/null +++ b/js/src/tests/js1_8/shell.js @@ -0,0 +1,12 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- + * 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/. */ + +// NOTE: This only turns on 1.8.0 in shell builds. The browser requires the +// futzing in js/src/tests/browser.js. +if (typeof version != 'undefined') +{ + version(180); +} + diff --git a/js/src/tests/js1_8/template.js b/js/src/tests/js1_8/template.js new file mode 100644 index 000000000..089aae2d6 --- /dev/null +++ b/js/src/tests/js1_8/template.js @@ -0,0 +1,28 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: + */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 99999; +var summary = ''; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} |