summaryrefslogtreecommitdiffstats
path: root/devtools/shared/tests/xpcshell/test_executeSoon.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /devtools/shared/tests/xpcshell/test_executeSoon.js
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--devtools/shared/tests/xpcshell/test_executeSoon.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/devtools/shared/tests/xpcshell/test_executeSoon.js b/devtools/shared/tests/xpcshell/test_executeSoon.js
new file mode 100644
index 0000000000..acb60360a1
--- /dev/null
+++ b/devtools/shared/tests/xpcshell/test_executeSoon.js
@@ -0,0 +1,35 @@
+/* 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("resource://devtools/shared/DevToolsUtils.js");
+
+add_task(async function () {
+ await waitForTick();
+
+ let stack = Components.stack;
+ while (stack) {
+ info(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() {
+ return new Promise(resolve => {
+ executeSoon(resolve);
+ });
+}