blob: f6d128c166cee4393e692a59c90d18a14fefa005 [file] [log] [blame]
<!doctype html>
<title>Scheduling API: postTask and AbortSignal</title>
<link rel="author" title="Scott Haseley" href="mailto:shaseley@chromium.org">
<link rel="help" href="https://github.com/WICG/main-thread-scheduling">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
async_test(t => {
let result = "fail";
let ac = new AbortController;
scheduler.postTask(() => {}, { signal: ac.signal }).then(
() => { assert_unreached('This task should have been aborted'); },
() => { result = "pass"; });
ac.abort();
// The task should be aborted.
scheduler.postTask(t.step_func_done(() => {
assert_equals(result, "pass");
}));
}, 'Test that scheduler.postTask() accepts an AbortSignal that is not also a TaskSignal');
</script>