post-task-with-signal-and-priority.any.js (588B)
1 // META: title=Scheduler: Signal and Priority Combination 2 // META: global=window,worker 3 'use strict'; 4 5 promise_test(async t => { 6 const task1Result = scheduler.postTask(() => 'task1', {priority: 'user-visible'}); 7 8 const controller = new TaskController({priority: 'background'}); 9 const signal = controller.signal 10 const task2Result = scheduler.postTask(() => 'task2', {priority: 'user-blocking', signal}); 11 12 const result = await Promise.race([task1Result, task2Result]); 13 assert_equals('task2', result); 14 }, 'Test when scheduler.postTask() is passed both a signal and a priority');