Files
firefox/devtools/shared/tests/unit/test_executeSoon.js
T
J. Ryan Stinnett 530b903fcf Bug 1271084 - Apply ESLint autofixes to ignored /devtools files. r=tromey
For simple rules like function spacing, we can auto-fix these across the code
base so they are followed in a consistent way.

To generate this patch, I ran:

./mach eslint devtools --no-ignore --fix

After this, I reverted any changes to third party files that we really do want
to ignore.

MozReview-Commit-ID: 6Q8BApkAW20
2016-05-18 12:49:23 -05:00

48 lines
1.3 KiB
JavaScript

/* 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 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 = promise.defer();
executeSoon(deferred.resolve);
return deferred.promise;
}