yield-then-detach.html (961B)
1 <!doctype html> 2 <title>Scheduler: yield in Detached Scheduler</title> 3 <link rel="help" href="https://github.com/WICG/scheduling-apis"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 7 <script> 8 'use strict'; 9 10 promise_test(async t => { 11 await new Promise(resolve => window.onload = resolve); 12 13 const frame = document.body.appendChild(document.createElement('iframe')); 14 const iframeDOMException = frame.contentWindow.DOMException; 15 const iframeScheduler = frame.contentWindow.scheduler; 16 17 let didRun = false; 18 iframeScheduler.yield().then(() => { didRun = true; }); 19 20 document.body.removeChild(frame); 21 await promise_rejects_dom(t, 'NotSupportedError', iframeDOMException, iframeScheduler.yield()); 22 await new Promise(resolve => t.step_timeout(resolve, 10)); 23 assert_false(didRun, 'The continuation should not have run.'); 24 }, 'Test scheduler.yield() from an iframe that is removed'); 25 26 </script>