mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 23:38:38 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
48
devtools/shared/tests/unit/test_executeSoon.js
Normal file
48
devtools/shared/tests/unit/test_executeSoon.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Client request stacks should span the entire process from before making the
|
||||
* request to handling the reply from the server. The server frames are not
|
||||
* included, nor can they be in most cases, since the server can be a remote
|
||||
* device.
|
||||
*/
|
||||
|
||||
var { executeSoon } = require("devtools/shared/DevToolsUtils");
|
||||
var promise = require("promise");
|
||||
var defer = require("devtools/shared/defer");
|
||||
var Services = require("Services");
|
||||
|
||||
var asyncStackEnabled =
|
||||
Services.prefs.getBoolPref("javascript.options.asyncstack");
|
||||
|
||||
do_register_cleanup(() => {
|
||||
Services.prefs.setBoolPref("javascript.options.asyncstack",
|
||||
asyncStackEnabled);
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
Services.prefs.setBoolPref("javascript.options.asyncstack", true);
|
||||
|
||||
yield waitForTick();
|
||||
|
||||
let stack = Components.stack;
|
||||
while (stack) {
|
||||
do_print(stack.name);
|
||||
if (stack.name == "waitForTick") {
|
||||
// Reached back to outer function before executeSoon
|
||||
ok(true, "Complete stack");
|
||||
return;
|
||||
}
|
||||
stack = stack.asyncCaller || stack.caller;
|
||||
}
|
||||
ok(false, "Incomplete stack");
|
||||
});
|
||||
|
||||
function waitForTick() {
|
||||
let deferred = defer();
|
||||
executeSoon(deferred.resolve);
|
||||
return deferred.promise;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue