This repository has been archived by the owner on Jul 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1148593 - Create async stack in callback objects. r=bz, r=fitzgen
--HG-- extra : rebase_source : f9b507d8f005dbca6f40f510ca41a0cbb03aebf9
- Loading branch information
Tom Tromey
committed
Jul 24, 2015
1 parent
a37b7fa
commit 9f3b16b
Showing
23 changed files
with
421 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!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> |
60 changes: 60 additions & 0 deletions
60
dom/base/test/test_async_setTimeout_stack_across_globals.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!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> | ||
<iframe id="iframe"></iframe> | ||
<script type="application/javascript"> | ||
SimpleTest.waitForExplicitFinish(); | ||
|
||
var otherGlobal = document.getElementById("iframe").contentWindow; | ||
|
||
function getFunctionName(frame) { | ||
return frame.slice(0, frame.indexOf("@")); | ||
} | ||
|
||
function a() { b() } | ||
function b() { c() } | ||
function c() { otherGlobal.setTimeout(d, 1) } | ||
function d() { e() } | ||
function e() { f() } | ||
function f() { otherGlobal.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*f"); | ||
is(frames[4], "e"); | ||
is(frames[5], "d"); | ||
is(frames[6], "setTimeout handler*c"); | ||
is(frames[7], "b"); | ||
is(frames[8], "a"); | ||
|
||
SimpleTest.finish(); | ||
} | ||
|
||
SpecialPowers.pushPrefEnv( | ||
{"set": [['javascript.options.asyncstack', true]]}, | ||
a); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.