mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
61 lines
1.7 KiB
HTML
61 lines
1.7 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=1142577
|
|
-->
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Test for Bug 1142577 - Async stacks for setTimeout</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1142577">Mozilla Bug 1142577</a>
|
|
<pre id="stack"></pre>
|
|
<script type="application/javascript">
|
|
SimpleTest.waitForExplicitFinish();
|
|
SimpleTest.requestFlakyTimeout("Testing async stacks across setTimeout");
|
|
|
|
function getFunctionName(frame) {
|
|
return frame.slice(0, frame.indexOf("@"));
|
|
}
|
|
|
|
function a() { b() }
|
|
function b() { c() }
|
|
function c() { setTimeout(d, 1) }
|
|
function d() { e() }
|
|
function e() { f() }
|
|
function f() { setTimeout(g, 1) }
|
|
function g() { h() }
|
|
function h() { i() }
|
|
function i() {
|
|
var stackString = Error().stack;
|
|
document.getElementById("stack").textContent = stackString;
|
|
|
|
var frames = stackString
|
|
.split("\n")
|
|
.map(getFunctionName)
|
|
.filter(function (name) { return !!name; });
|
|
|
|
is(frames[0], "i");
|
|
is(frames[1], "h");
|
|
is(frames[2], "g");
|
|
is(frames[3], "setTimeout handler*SimpleTest_setTimeoutShim");
|
|
is(frames[4], "f");
|
|
is(frames[5], "e");
|
|
is(frames[6], "d");
|
|
is(frames[7], "setTimeout handler*SimpleTest_setTimeoutShim");
|
|
is(frames[8], "c");
|
|
is(frames[9], "b");
|
|
is(frames[10], "a");
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
SpecialPowers.pushPrefEnv(
|
|
{"set": [['javascript.options.asyncstack', true]]},
|
|
a);
|
|
</script>
|
|
</body>
|
|
</html>
|