diff options
Diffstat (limited to 'js/src/tests/js1_7/iterable')
-rw-r--r-- | js/src/tests/js1_7/iterable/browser.js | 0 | ||||
-rw-r--r-- | js/src/tests/js1_7/iterable/regress-340526-01.js | 27 | ||||
-rw-r--r-- | js/src/tests/js1_7/iterable/regress-340526-02.js | 43 | ||||
-rw-r--r-- | js/src/tests/js1_7/iterable/regress-341496.js | 19 | ||||
-rw-r--r-- | js/src/tests/js1_7/iterable/regress-341499.js | 33 | ||||
-rw-r--r-- | js/src/tests/js1_7/iterable/regress-341510.js | 29 | ||||
-rw-r--r-- | js/src/tests/js1_7/iterable/regress-341815.js | 94 | ||||
-rw-r--r-- | js/src/tests/js1_7/iterable/regress-341821.js | 83 | ||||
-rw-r--r-- | js/src/tests/js1_7/iterable/regress-354750-01.js | 42 | ||||
-rw-r--r-- | js/src/tests/js1_7/iterable/regress-355025.js | 28 | ||||
-rw-r--r-- | js/src/tests/js1_7/iterable/regress-355075-01.js | 38 | ||||
-rw-r--r-- | js/src/tests/js1_7/iterable/regress-355090.js | 37 | ||||
-rw-r--r-- | js/src/tests/js1_7/iterable/regress-415922.js | 49 | ||||
-rw-r--r-- | js/src/tests/js1_7/iterable/regress-568056.js | 24 | ||||
-rw-r--r-- | js/src/tests/js1_7/iterable/shell.js | 0 |
15 files changed, 546 insertions, 0 deletions
diff --git a/js/src/tests/js1_7/iterable/browser.js b/js/src/tests/js1_7/iterable/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/js1_7/iterable/browser.js diff --git a/js/src/tests/js1_7/iterable/regress-340526-01.js b/js/src/tests/js1_7/iterable/regress-340526-01.js new file mode 100644 index 000000000..e3e189278 --- /dev/null +++ b/js/src/tests/js1_7/iterable/regress-340526-01.js @@ -0,0 +1,27 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 340526; +var summary = 'Iterators: cross-referenced objects with close handler can ' + + 'delay close handler execution'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +try +{ + var iter = Iterator({}); + iter.foo = "bar"; + for (var i in iter) + ; +} +catch(ex) +{ +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_7/iterable/regress-340526-02.js b/js/src/tests/js1_7/iterable/regress-340526-02.js new file mode 100644 index 000000000..a94566a3d --- /dev/null +++ b/js/src/tests/js1_7/iterable/regress-340526-02.js @@ -0,0 +1,43 @@ +// |reftest| skip -- obsolete test +/* -*- 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 = 340526; +var summary = 'Iterators: cross-referenced objects with close handler can ' + + 'delay close handler execution'; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +var close_count = 0; + +function gen() +{ + try { + yield 0; + } finally { + ++close_count; + } +} + +var iter1 = gen(); +var iter2 = gen(); + +iter1.another = iter2; +iter2.another = iter1; + +iter1.next(); +iter2.next(); + +iter1 = null; +iter2 = null; + +gc(); + +var expect = 2; +var actual = close_count; + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_7/iterable/regress-341496.js b/js/src/tests/js1_7/iterable/regress-341496.js new file mode 100644 index 000000000..9e3a5aa3a --- /dev/null +++ b/js/src/tests/js1_7/iterable/regress-341496.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 = 341496; +var summary = 'Iterators: check that adding properties does not crash'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +var iter = Iterator({}); +for (var i = 0; i != 10*1000; ++i) + iter[i] = i; + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_7/iterable/regress-341499.js b/js/src/tests/js1_7/iterable/regress-341499.js new file mode 100644 index 000000000..7e3d619f1 --- /dev/null +++ b/js/src/tests/js1_7/iterable/regress-341499.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 = 341499; +var summary = 'Iterators: do not assert from close handler when ' + + 'allocating GC things'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +var someGlobal; + +function generator() +{ + try { + yield 0; + } finally { + someGlobal = []; + } +} + +var iter = generator(); +iter.next(); +iter = null; + +gc(); + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_7/iterable/regress-341510.js b/js/src/tests/js1_7/iterable/regress-341510.js new file mode 100644 index 000000000..27fb73b03 --- /dev/null +++ b/js/src/tests/js1_7/iterable/regress-341510.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 = 341510; +var summary = 'Iterators: crash in close handler with assignment to ' + + 'nonexistent name'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +function gen(i) { + try { + yield i; + } finally { + name_that_does_not_exist_in_the_scope_chain = 1; + } +} + +var iter = gen(1); +iter.next(); +iter = null; +gc(); + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_7/iterable/regress-341815.js b/js/src/tests/js1_7/iterable/regress-341815.js new file mode 100644 index 000000000..51cf2ea28 --- /dev/null +++ b/js/src/tests/js1_7/iterable/regress-341815.js @@ -0,0 +1,94 @@ +// |reftest| skip-if(!xulRuntime.shell) -- bug xxx - fails to dismiss alert +/* -*- 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 = 341815; +var summary = 'Close hook crash'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +var ialert = 0; +//----------------------------------------------------------------------------- +//test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + var globalToPokeGC = {}; + + function make_iterator() + { + function generator() { + try { + yield 0; + } finally { + make_iterator(); + } + } + generator().next(); + globalToPokeGC = {}; + if (typeof alert != 'undefined') + { + alert(++ialert); + } + } + + make_iterator(); + + for (var i = 0; i != 50000; ++i) { + var x = {}; + } + + print('done'); + + setTimeout('checkTest()', 10000); + + exitFunc ('test'); +} + +function init() +{ + // give the dialog closer time to register + setTimeout('test()', 5000); +} + +var lastialert = 0; + +function checkTest() +{ + // this function is used to check if there + // additional alerts are still being fired + // in order to prevent the test from completing + // until all alerts have finished. + + if (ialert != lastialert) + { + lastialert = ialert; + setTimeout('checkTest()', 10000); + return; + } + + reportCompare(expect, actual, summary); + gDelayTestDriverEnd = false; + jsTestDriverEnd(); +} + +if (typeof window != 'undefined') +{ + // delay test driver end + gDelayTestDriverEnd = true; + + window.addEventListener("load", init, false); +} +else +{ + reportCompare(expect, actual, summary); +} + diff --git a/js/src/tests/js1_7/iterable/regress-341821.js b/js/src/tests/js1_7/iterable/regress-341821.js new file mode 100644 index 000000000..03cf79898 --- /dev/null +++ b/js/src/tests/js1_7/iterable/regress-341821.js @@ -0,0 +1,83 @@ +// |reftest| skip-if(!xulRuntime.shell) -- bug xxx - fails to dismiss alert +/* -*- 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 = 341821; +var summary = 'Close hook crash'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +var ialert = 0; + +//----------------------------------------------------------------------------- +//test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + function generator() + { + try { + yield []; + } finally { + make_iterator(); + } + } + + function make_iterator() + { + var iter = generator(); + iter.next(); + iter = null; + if (typeof alert != 'undefined') + { + alert(++ialert); + } + } + + make_iterator(); + + // Trigger GC through the branch callback. + for (var i = 0; i != 50000; ++i) { + var x = {}; + } + + print('done'); + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} + +function init() +{ + // give the dialog closer time to register + setTimeout('runtest()', 5000); +} + +function runtest() +{ + test(); + reportCompare(expect, actual, summary); + gDelayTestDriverEnd = false; + jsTestDriverEnd(); +} + +if (typeof window != 'undefined') +{ + // delay test driver end + gDelayTestDriverEnd = true; + + window.addEventListener("load", init, false); +} +else +{ + reportCompare(expect, actual, summary); +} + diff --git a/js/src/tests/js1_7/iterable/regress-354750-01.js b/js/src/tests/js1_7/iterable/regress-354750-01.js new file mode 100644 index 000000000..1ad600a78 --- /dev/null +++ b/js/src/tests/js1_7/iterable/regress-354750-01.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 = 354750; +var summary = 'Changing Iterator.prototype.next should not affect default iterator'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + Iterator.prototype.next = function() { + throw "This should not be thrown"; + } + + expect = 'No exception'; + actual = 'No exception'; + try + { + for (var i in []) + { + } + } + catch(ex) + { + actual = ex; + } + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_7/iterable/regress-355025.js b/js/src/tests/js1_7/iterable/regress-355025.js new file mode 100644 index 000000000..6407451c0 --- /dev/null +++ b/js/src/tests/js1_7/iterable/regress-355025.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 = 355025; +var summary = 'Test regression from bug 354750 - Iterable()'; +var actual = 'No Error'; +var expect = 'No Error'; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + Iterator([]); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_7/iterable/regress-355075-01.js b/js/src/tests/js1_7/iterable/regress-355075-01.js new file mode 100644 index 000000000..a3b2e8ad6 --- /dev/null +++ b/js/src/tests/js1_7/iterable/regress-355075-01.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 = 355075; +var summary = 'Regression tests from bug 354750'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + options('strict'); + options('werror'); + + function f() { + this.a = {1: "a", 2: "b"}; + var dummy; + for (var b in this.a) + dummy = b; + } + + f(); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_7/iterable/regress-355090.js b/js/src/tests/js1_7/iterable/regress-355090.js new file mode 100644 index 000000000..32f70456a --- /dev/null +++ b/js/src/tests/js1_7/iterable/regress-355090.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 = 355090; +var summary = 'Iterator(8) is a function'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 'No Error'; + actual = 'No Error'; + try + { + Iterator(8); + } + catch(ex) + { + actual = ex + ''; + } + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_7/iterable/regress-415922.js b/js/src/tests/js1_7/iterable/regress-415922.js new file mode 100644 index 000000000..c7fe29e7b --- /dev/null +++ b/js/src/tests/js1_7/iterable/regress-415922.js @@ -0,0 +1,49 @@ +/* -*- 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 = 415922; +var summary = 'Support exception from withing JSNewEnumerateOp on JSENUMERATE_NEXT'; +var actual = 'No Error'; +var expect = 'Error: its enumeration failed'; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + function f() { for (k in it) return k } + + if (typeof it == 'undefined') + { + print(expect = actual = 'it not defined, test skipped'); + } + else + { + try + { + it.enum_fail = true; + var r = f(); + actual = 'No exception r: ' + r.toString(); + } + catch (e) + { + actual = e + ''; + } + finally + { + it.enum_fail = false; + } + } + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_7/iterable/regress-568056.js b/js/src/tests/js1_7/iterable/regress-568056.js new file mode 100644 index 000000000..1f6570d38 --- /dev/null +++ b/js/src/tests/js1_7/iterable/regress-568056.js @@ -0,0 +1,24 @@ +// Any copyright is dedicated to the Public Domain. +// http://creativecommons.org/licenses/publicdomain/ + +var BUGNUMBER = 568056; +var summary = "Iterator(obj) must not go up obj's prototype chain"; + +var foo = { + z: 9, +}; + +var bar = { + __proto__: foo, + a: 1, + b: 2, +}; + +var results = []; +for each (let [key, value] in Iterator(bar)) + results.push(key + ":" + value); + +var actual = results.join(';') +var expect = "a:1;b:2"; + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_7/iterable/shell.js b/js/src/tests/js1_7/iterable/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/js1_7/iterable/shell.js |