tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

yield-scheduling-state-cleared.any.js (693B)


      1 'use strict';
      2 
      3 promise_test(async t => {
      4  const ids = [];
      5  // The timer task will run after the background task, and the scheduling state
      6  // set in the background task should not leak to the timer task.
      7  const {promise, resolve} = Promise.withResolvers();
      8  scheduler.postTask(async () => {
      9    setTimeout(async () => {
     10      let task = scheduler.postTask(() => {
     11        ids.push('task');
     12      }, {priority: 'user-visible'});
     13      await scheduler.yield();
     14      ids.push('continuation');
     15      await task;
     16      resolve();
     17    });
     18  }, {priority: 'background'});
     19  await promise;
     20  assert_equals(ids.toString(), 'continuation,task');
     21 }, 'yield() does not leak priority across tasks');