blob: dde41e8a63d068606ed932747ab0b177c004feb1 [file] [log] [blame] [edit]
description("Regression test for https://webkit.org/b/150513.");
// This test verifies that we can properly handle calling a virtual JavaScript
// function that fails during CodeBlock generation.
var functions = [];
function init()
{
functions.push(new Function("a", "return a"));
functions.push(new Function("a", "return a"));
functions.push(new Function("a", "return a"));
}
function test()
{
for (var i = 0; i < 100000; i++) {
var f;
if (i % 1000 == 999) {
testRunner.failNextNewCodeBlock();
f = functions[2];
} else
f = functions[i % 2];
try {
var result = f(1);
if (result != 1)
testFailed("Wrong result, expected 1, got " + result);
} catch {
}
}
}
init();
test();
try {
(function () { }()); // Ensure that failNextNewCodeBlock is cleared regardless of how `new Function` caches the functions.
} catch { }
testPassed("Didn't crash when calling a virtual JavaScript function that doesn't have a CodeBlock.");