diff options
Diffstat (limited to 'js/src/jit-test/tests/parser/oom-tracking-line-starts-in-tokenizer.js')
-rw-r--r-- | js/src/jit-test/tests/parser/oom-tracking-line-starts-in-tokenizer.js | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/parser/oom-tracking-line-starts-in-tokenizer.js b/js/src/jit-test/tests/parser/oom-tracking-line-starts-in-tokenizer.js new file mode 100644 index 0000000000..46aa1dbd04 --- /dev/null +++ b/js/src/jit-test/tests/parser/oom-tracking-line-starts-in-tokenizer.js @@ -0,0 +1,143 @@ +// Constraints on this test's appearance: +// +// * |TokenStream::SourceCoords::add| must try to allocate memory. (This test +// ensures this happens by making the function below >=128 lines long so +// that |SourceCoords::lineStartOffsets_| must convert to heap storage. The +// precise approach doesn't matter.) +// * That allocation attempt must fail (by forced simulated OOM, here). +// +// It'd be nice to build up the function programmatically, but it appears that +// the above only happens if the provided function has a lazy script. Cursory +// attempts to relazify |Function("...")| didn't work, so this fuzzer-like +// version had to be used instead. +if ("oomTest" in this) { + oomTest(function() { + try { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + } catch(e) { + ; + } + }) +} |