Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /scheduler/task-controller-abort1.any.html - WPT Dashboard Interop Dashboard
- /scheduler/task-controller-abort1.any.serviceworker.html - WPT Dashboard Interop Dashboard
- /scheduler/task-controller-abort1.any.sharedworker.html - WPT Dashboard Interop Dashboard
- /scheduler/task-controller-abort1.any.worker.html - WPT Dashboard Interop Dashboard
// META: title=Scheduler: TaskController.abort() Basic Functionality
// META: global=window,worker
'use strict';
promise_test(async t => {
const controller = new TaskController();
const signal = controller.signal;
let didRun = false;
const taskResult = scheduler.postTask(() => { didRun = true; }, {signal});
controller.abort();
await promise_rejects_dom(t, 'AbortError', taskResult);
assert_false(didRun);
}, 'Test that TaskController.abort() prevents a task from running and rejects the promise');