2 if (!Services.prefs.getBoolPref("javascript.options.asyncstack")) {
3 info("Async stacks are disabled.");
7 function getAsyncStack() {
8 return Components.stack;
11 // asyncCause may contain non-ASCII characters.
12 let testAsyncCause = "Tes" + String.fromCharCode(355) + "String";
14 Cu.callFunctionWithAsyncStack(function asyncCallback() {
15 let stack = Components.stack;
17 Assert.equal(stack.name, "asyncCallback");
18 Assert.equal(stack.caller, null);
19 Assert.equal(stack.asyncCause, null);
21 Assert.equal(stack.asyncCaller.name, "getAsyncStack");
22 Assert.equal(stack.asyncCaller.asyncCause, testAsyncCause);
23 Assert.equal(stack.asyncCaller.asyncCaller, null);
25 Assert.equal(stack.asyncCaller.caller.name, "run_test");
26 Assert.equal(stack.asyncCaller.caller.asyncCause, null);
27 }, getAsyncStack(), testAsyncCause);