| Andreas Farre | 971f63f | 2017-04-04 15:27:08 | [diff] [blame] | 1 | <!doctype html> |
| 2 | <meta charset=utf-8> |
| 3 | <title>requestIdleCallback on removed frame shouldn't call back</title> |
| 4 | <script src=/resources/testharness.js></script> |
| 5 | <script src=/resources/testharnessreport.js></script> |
| 6 | <script> |
| 7 | async_test(function (t) { |
| 8 | assert_false(document.hidden, "document.hidden must exist and be false to run this test properly"); |
| 9 | |
| 10 | function start() { |
| 11 | var frame = document.createElement('iframe'); |
| 12 | frame.addEventListener('load', _ => connect(frame), {once:true}); |
| 13 | frame.src = "about:blank"; |
| 14 | document.body.appendChild(frame); |
| 15 | } |
| 16 | |
| 17 | function connect(frame) { |
| 18 | var contentWindow = frame.contentWindow; |
| 19 | contentWindow.requestIdleCallback(_ => callback0(frame, contentWindow)); |
| 20 | t.step_timeout(function() { t.done(); }, 1000); |
| 21 | } |
| 22 | |
| 23 | function callback0(f, w) { |
| 24 | document.body.removeChild(f); |
| 25 | w.requestIdleCallback(t.unreached_func("requestIdleCallback callback should not trigger the callback")); |
| 26 | } |
| 27 | |
| 28 | addEventListener('load', start, {once:true}); |
| 29 | }, "calling requestIdleCallback on a contentWindow from a removed iframe should not trigger the callback"); |
| 30 | </script> |