blob: cae0f58a23f75154de75ffd1ca0fadbe071386e4 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description('Test unhandled promise rejection event.');
window.jsTestIsAsync = true;
window.error = null;
window.promise = [];
window.onunhandledrejection = function (e) {
error = e;
shouldBe(`error.type`, `"unhandledrejection"`);
shouldBe(`error.cancelable`, `true`);
shouldBe(`error.promise`, `promise[0]`);
shouldBe(`error.reason`, `0`);
evalAndLog(`window.promise[1].catch(function () { });`);
evalAndLog(`window.promise[2].catch(function () { });`);
setTimeout(function () { finishJSTest(); }, 100);
return false;
};
for (let i = 0; i < 3; ++i)
evalAndLog(`window.promise[${i}] = Promise.reject(${i});`);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>