Files
roytam1 7529dc68e8 import changes from `dev' branch of rmottola/Arctic-Fox:
- import VMX Blur from TenFourFox and adapt moz.build with HAVE_ALTIVEC (f23006226)
- Bug 1176083. Remove the now-dead code for the XPCOM version of setTimeout/setInterval. r=smaug (af84a61a6)
- Bug 1148593 - Pass JSContext to CallbackObject constructor. r=bz (548cda0cc)
- Bug 1164564 - Clean up the worker loader;r=jlong (c22a9241c)
- Bug 1164564 - Refactor Promise-backend.js so it can be required as a CommonJS module;r=jlong (6ced4a7f2)
- Bug 1084525 - Part 4: Add listPromises method to PromisesActor r=fitzgen (132c6b062)
- Bug 1084525 - Part 5: Add onNewPromise event handler to PromisesActor r=fitzgen (07098d58c)
- Bug 1084525 - Part 6: Add onPromiseSettled event handler to PromisesActor r=fitzgen (11d0c7430)
- Bug 1164483 - move worker helpers from frontend of devtools to backend r=jsantell (d5a0d16af)
- Bug 1164632 - use new worker helpers in debugger for pretty-printing r=jsantell (de356582a)
- do not run a test program to see if -maltivec is supported, since GCC always accepts it, even if an incompatible processor is selected. Offer explicit enable-altivec option and also set CXXFLAGS (c78bc8e43)
- extend removing of optimizations to all newer GCC versions, since it is a code issue, not compiler one (29639f4d5)
2021-04-19 11:02:56 +08:00

46 lines
1.7 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests errors are handled properly by the DevToolsWorker.
const { DevToolsWorker } = devtools.require("devtools/shared/worker");
const WORKER_URL = "resource:///modules/devtools/GraphsWorker.js";
add_task(function*() {
try {
let workerNotFound = new DevToolsWorker("resource://i/dont/exist.js");
ok(false, "Creating a DevToolsWorker with an invalid URL throws");
} catch (e) {
ok(true, "Creating a DevToolsWorker with an invalid URL throws");
}
let worker = new DevToolsWorker(WORKER_URL);
try {
// plotTimestampsGraph requires timestamp, interval an duration props on the object
// passed in so there should be an error thrown in the worker
let results = yield worker.performTask("plotTimestampsGraph", {});
ok(false, "DevToolsWorker returns a rejected promise when an error occurs in the worker");
} catch (e) {
ok(true, "DevToolsWorker returns a rejected promise when an error occurs in the worker");
}
try {
let results = yield worker.performTask("not a real task");
ok(false, "DevToolsWorker returns a rejected promise when task does not exist");
} catch (e) {
ok(true, "DevToolsWorker returns a rejected promise when task does not exist");
}
worker.destroy();
try {
let results = yield worker.performTask("plotTimestampsGraph", {
timestamps: [0,1,2,3,4,5,6,7,8,9],
interval: 1,
duration: 1
});
ok(false, "DevToolsWorker rejects when performing a task on a destroyed worker");
} catch (e) {
ok(true, "DevToolsWorker rejects when performing a task on a destroyed worker");
};
});