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/jit-test/tests/parser/columnNumber.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/jit-test/tests/parser/columnNumber.js')
-rw-r--r-- | js/src/jit-test/tests/parser/columnNumber.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/parser/columnNumber.js b/js/src/jit-test/tests/parser/columnNumber.js new file mode 100644 index 000000000..ce29db33c --- /dev/null +++ b/js/src/jit-test/tests/parser/columnNumber.js @@ -0,0 +1,45 @@ +// Simple tests for evaluate's "columnNumber" option. + +load(libdir + 'asserts.js'); + +assertEq(evaluate("saveStack().column"), 1); +assertEq(evaluate("saveStack().column", { columnNumber: 1729 }), 1730); +assertEq(evaluate("\nsaveStack().column", { columnNumber: 1729 }), 1); +assertEq(evaluate("saveStack().column", { columnNumber: "42" }), 43); +assertThrowsInstanceOf(() => evaluate("saveStack().column", { columnNumber: -10 }), + RangeError); +assertThrowsInstanceOf(() => evaluate("saveStack().column", { columnNumber: Math.pow(2,30) }), + RangeError); + +if (helperThreadCount() > 0) { + print("offThreadCompileScript 1"); + offThreadCompileScript("saveStack().column", { columnNumber: -10 }); + assertThrowsInstanceOf(runOffThreadScript, RangeError); + + print("offThreadCompileScript 2"); + offThreadCompileScript("saveStack().column", { columnNumber: Math.pow(2,30) }); + assertThrowsInstanceOf(runOffThreadScript, RangeError); + + print("offThreadCompileScript 3"); + offThreadCompileScript("saveStack().column", { columnNumber: 10000 }); + assertEq(runOffThreadScript(), 10001); +} + +// Check handling of columns near the limit of our ability to represent them. +// (This is hardly thorough, but since web content can't set column numbers, +// it's probably not worth it to be thorough.) +const maxColumn = Math.pow(2, 30) - 1; +assertEq(evaluate("saveStack().column", { columnNumber: maxColumn }), + maxColumn + 1); + +// Check the 'silently zero' behavior when we reach the limit of the srcnotes +// column encoding. +assertEq(evaluate(" saveStack().column", { columnNumber: maxColumn }), + 1); + +// Gathering source text for inclusion in error messages should not try to reach +// outside the buffer to find the start of the source line. The below should +// report the error without crashing. +assertThrowsInstanceOf(() => evaluate("function x(y,y) { 'use strict'; } x()", + { columnNumber: 10 }), + SyntaxError); |