test_executeSoon.js (915B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /** 7 * Client request stacks should span the entire process from before making the 8 * request to handling the reply from the server. The server frames are not 9 * included, nor can they be in most cases, since the server can be a remote 10 * device. 11 */ 12 13 var { executeSoon } = require("resource://devtools/shared/DevToolsUtils.js"); 14 15 add_task(async function () { 16 await waitForTick(); 17 18 let stack = Components.stack; 19 while (stack) { 20 info(stack.name); 21 if (stack.name == "waitForTick") { 22 // Reached back to outer function before executeSoon 23 ok(true, "Complete stack"); 24 return; 25 } 26 stack = stack.asyncCaller || stack.caller; 27 } 28 ok(false, "Incomplete stack"); 29 }); 30 31 function waitForTick() { 32 return new Promise(resolve => { 33 executeSoon(resolve); 34 }); 35 }