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_5/extensions/regress-350312-03.js | |
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_5/extensions/regress-350312-03.js')
-rw-r--r-- | js/src/tests/js1_5/extensions/regress-350312-03.js | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/js/src/tests/js1_5/extensions/regress-350312-03.js b/js/src/tests/js1_5/extensions/regress-350312-03.js new file mode 100644 index 000000000..edf3cb49e --- /dev/null +++ b/js/src/tests/js1_5/extensions/regress-350312-03.js @@ -0,0 +1,116 @@ +/* -*- 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 = 350312; +var summary = 'Accessing wrong stack slot with nested catch/finally'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + var pfx = "(function (x) {try {if (x > 41) throw x}", + cg1a = " catch (e if e === 42) {var v = 'catch guard 1 ' + e; actual += v + ',';print(v);}" + cg1b = " catch (e if e === 42) {var v = 'catch guard 1 + throw ' + e; actual += v + ',';print(v); throw e;}" + cg2 = " catch (e if e === 43) {var v = 'catch guard 2 ' + e; actual += v + ',';print(v)}" + cat = " catch (e) {var v = 'catch all ' + e; print(v); if (e == 44) throw e}" + fin = " finally{var v = 'fin'; actual += v + ',';print(v)}", + end = "})"; + + var exphash = { + pfx: "(function (y) { var result = ''; y = y + ',';", + cg1a: " result += (y === '42,') ? ('catch guard 1 ' + y):'';", + cg1b: " result += (y === '42,') ? ('catch guard 1 + throw ' + y):'';", + cg2: " result += (y === '43,') ? ('catch guard 2 ' + y):'';", + cat: " result += (y > 41) ? ('catch all ' + y):'';", + fin: " result += 'fin,';", + end: "return result;})" + }; + + var src = [ + pfx + fin + end, + pfx + cat + end, + pfx + cat + fin + end, + pfx + cg1a + end, + pfx + cg1a + fin + end, + pfx + cg1a + cat + end, + pfx + cg1a + cat + fin + end, + pfx + cg1a + cg2 + end, + pfx + cg1a + cg2 + fin + end, + pfx + cg1a + cg2 + cat + end, + pfx + cg1a + cg2 + cat + fin + end, + pfx + cg1b + end, + pfx + cg1b + fin + end, + pfx + cg1b + cat + end, + pfx + cg1b + cat + fin + end, + pfx + cg1b + cg2 + end, + pfx + cg1b + cg2 + fin + end, + pfx + cg1b + cg2 + cat + end, + pfx + cg1b + cg2 + cat + fin + end, + ]; + + var expsrc = [ + exphash.pfx + exphash.fin + exphash.end, + exphash.pfx + exphash.cat + exphash.end, + exphash.pfx + exphash.cat + exphash.fin + exphash.end, + exphash.pfx + exphash.cg1a + exphash.end, + exphash.pfx + exphash.cg1a + exphash.fin + exphash.end, + exphash.pfx + exphash.cg1a + exphash.cat + exphash.end, + exphash.pfx + exphash.cg1a + exphash.cat + exphash.fin + exphash.end, + exphash.pfx + exphash.cg1a + exphash.cg2 + exphash.end, + exphash.pfx + exphash.cg1a + exphash.cg2 + exphash.fin + exphash.end, + exphash.pfx + exphash.cg1a + exphash.cg2 + exphash.cat + exphash.end, + exphash.pfx + exphash.cg1a + exphash.cg2 + exphash.cat + exphash.fin + exphash.end, + exphash.pfx + exphash.cg1b + exphash.end, + exphash.pfx + exphash.cg1b + exphash.fin + exphash.end, + exphash.pfx + exphash.cg1b + exphash.cat + exphash.end, + exphash.pfx + exphash.cg1b + exphash.cat + exphash.fin + exphash.end, + exphash.pfx + exphash.cg1b + exphash.cg2 + exphash.end, + exphash.pfx + exphash.cg1b + exphash.cg2 + exphash.fin + exphash.end, + exphash.pfx + exphash.cg1b + exphash.cg2 + exphash.cat + exphash.end, + exphash.pfx + exphash.cg1b + exphash.cg2 + exphash.cat + exphash.fin + exphash.end, + ]; + + for (var i in src) { + print("\n=== " + i + ": " + src[i]); + var f = eval(src[i]); + var exp = eval(expsrc[i]); + // dis(f); + print('decompiling: ' + f); + //print('decompiling exp: ' + exp); + + actual = ''; + try { expect = exp(41); f(41) } catch (e) { print('tried f(41), caught ' + e) } + reportCompare(expect, actual, summary); + + actual = ''; + try { expect = exp(42); f(42) } catch (e) { print('tried f(42), caught ' + e) } + reportCompare(expect, actual, summary); + + actual = ''; + try { expect = exp(43); f(43) } catch (e) { print('tried f(43), caught ' + e) } + reportCompare(expect, actual, summary); + + actual = ''; + try { expect = exp(44); f(44) } catch (e) { print('tried f(44), caught ' + e) } + reportCompare(expect, actual, summary); + + actual = ''; + try { expect = exp(45); f(45) } catch (e) { print('tried f(44), caught ' + e) } + reportCompare(expect, actual, summary); + + } + + exitFunc ('test'); +} |