post-task-then-detach.html (1007B)
1 <!doctype html> 2 <title>Scheduler: postTask in Detached Scheduler</title> 3 <link rel="author" title="Nate Chapin" href="mailto:japhet@chromium.org"> 4 <link rel="help" href="https://github.com/WICG/scheduling-apis"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 8 <script> 9 'use strict'; 10 11 async_test(t => { 12 onload = () => { 13 let didRun = false; 14 const frame = document.body.appendChild(document.createElement('iframe')); 15 frame.contentWindow.scheduler.postTask(() => { didRun = true; }); 16 document.body.removeChild(frame); 17 18 // We cannot assume anything about ordering between postTask tasks and 19 // non-postTask or postTask tasks from different schedulers, so the best we 20 // can do is give the task time to run. 21 t.step_timeout(() => { 22 assert_false(didRun, 'The task should not have run.'); 23 t.done(); 24 }, 10); 25 } 26 }, 'Test scheduler.postTask() from an iframe that is removed before the task runs'); 27 28 </script>