diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/jit-test/tests/basic/testDynamicLookup.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/basic/testDynamicLookup.js')
-rw-r--r-- | js/src/jit-test/tests/basic/testDynamicLookup.js | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/testDynamicLookup.js b/js/src/jit-test/tests/basic/testDynamicLookup.js new file mode 100644 index 0000000000..781c9f8a7a --- /dev/null +++ b/js/src/jit-test/tests/basic/testDynamicLookup.js @@ -0,0 +1,67 @@ +(function() { var x = 2; eval("assertEq(x, 2)"); })(); +(function() { var x = 2; (function() { assertEq(x, 2) })() })(); +(function() { var x = 2; (function() { eval("assertEq(x, 2)") })() })(); +(function() { var x = 2; (function() { (function() { assertEq(x, 2) })()})() })(); +(function() { var x = 2; (function() { (function() { eval("assertEq(x, 2)") })()})() })(); + +(function() { var x = 2; with({}) { assertEq(x, 2) } })(); +(function() { var x = 2; with({}) { (function() { assertEq(x, 2) })() } })(); +(function() { var x = 3; with({x:2}) { assertEq(x, 2) } })(); +(function() { var x = 3; with({x:2}) { (function() { assertEq(x, 2) })() } })(); +(function() { var x = 2; (function() { with({}) { assertEq(x, 2) } })() })(); +(function() { var x = 2; (function() { with({}) { (function() { assertEq(x, 2) })() } })() })(); +(function() { var x = 3; (function() { with({x:2}) { assertEq(x, 2) } })() })(); +(function() { var x = 3; (function() { with({x:2}) { (function() { assertEq(x, 2) })() } })() })(); + +(function() { if (Math) function x() {}; assertEq(typeof x, "function") })(); +(function() { if (Math) function x() {}; eval('assertEq(typeof x, "function")') })(); +(function() { if (Math) function x() {}; (function() { assertEq(typeof x, "function") })() })(); +(function() { if (Math) function x() {}; (function() { eval('assertEq(typeof x, "function")') })() })(); + +(function() { eval("var x = 2"); assertEq(x, 2) })(); +(function() { eval("var x = 2"); (function() { assertEq(x, 2) })() })(); +(function() { eval("var x = 2"); (function() { (function() { assertEq(x, 2) })() })() })(); + +(function() { var x = 2; (function() { eval('var y = 3'); assertEq(x, 2) })() })(); +(function() { var x = 2; (function() { eval('var y = 3'); (function() { assertEq(x, 2) })() })() })(); + +(function() { var x = 3; (function() { eval('var x = 2'); assertEq(x, 2) })() })(); +(function() { var x = 3; (function() { eval('var x = 2'); (function() { assertEq(x, 2) })() })() })(); + +(function() { var x = 2; eval("eval('assertEq(x, 2)')") })(); +(function() { var x = 2; (function() { eval("eval('assertEq(x, 2)')") })() })(); +(function() { var x = 2; eval("(function() { eval('assertEq(x, 2)') })()") })(); +(function() { var x = 2; (function() { eval("(function() { eval('assertEq(x, 2)') })()") })() })(); +(function() { var x = 2; (function() { eval("(function() { eval('(function() { assertEq(x, 2) })()') })()") })() })(); + +(function() { var [x] = [2]; eval('assertEq(x, 2)') })(); +(function() { var [x] = [2]; (function() { assertEq(x, 2) })() })(); +(function() { var [x] = [2]; (function() { eval('assertEq(x, 2)') })() })(); +(function() { for (var [x] = [2];;) { return (function() { return assertEq(x, 2); })() } })(); +(function() { for (var [x] = [2];;) { return (function() { return eval('assertEq(x, 2)'); })() } })(); + +(function() { var {y:x} = {y:2}; eval('assertEq(x, 2)') })(); +(function() { var {y:x} = {y:2}; (function() { assertEq(x, 2) })() })(); +(function() { var {y:x} = {y:2}; (function() { eval('assertEq(x, 2)') })() })(); +(function() { for (var {y:x} = {y:2};;) { return (function() { return assertEq(x, 2); })() } })(); +(function() { for (var {y:x} = {y:2};;) { return (function() { return eval('assertEq(x, 2)'); })() } })(); + +(function([x]) { eval('assertEq(x, 2)') })([2]); +(function([x]) { (function() { assertEq(x, 2) })() })([2]); +(function([x]) { (function() { eval('assertEq(x, 2)') })() })([2]); + +(function f() { assertEq(f.length, 0) })(); +(function f() { eval('assertEq(f.length, 0)') })(); +(function f() { (function f(x) { eval('assertEq(f.length, 1)') })() })(); +(function f() { eval("(function f(x) { eval('assertEq(f.length, 1)') })()") })(); + +(function f() { arguments = 3; function arguments() {}; assertEq(arguments, 3) })(); +(function f() { function arguments() {}; arguments = 3; assertEq(arguments, 3) })(); +(function f() { var arguments = 3; function arguments() {}; assertEq(arguments, 3) })(); +(function f() { function arguments() {}; var arguments = 3; assertEq(arguments, 3) })(); + +function f1() { assertEq(typeof f1, "function") }; f1(); +with({}) { (function() { assertEq(typeof f1, "function") })() } +if (Math) + function f2(x) {} +assertEq(f2.length, 1); |