4 <script src=
"../resources/testharness.js"></script>
5 <script src=
"../resources/testharnessreport.js"></script>
6 <iframe id=testIframe
></iframe>
8 var notifyTest
= async_test("Test that async event dispatch to detached frame is gracefully handled.");
10 function changeOrientationAndDetach() {
11 // Dispatch an orientationchange event; this is handled asynchronously,
12 // queueing a task/timer to do the actual dispatch.
13 window
.testRunner
.setMockScreenOrientation('portrait-secondary');
15 // Detach the iframe while the event dispatch is in-flight. If
16 // the screen orientation controller is finalized during the
17 // detach, the async event dispatch just after will be treated
18 // like a no-op -- there's no controller to handle the dispatch.
19 document
.body
.removeChild(testIframe
);
20 setTimeout(function () { notifyTest
.done(); }, 0);
22 notifyTest
.step(function () {
23 // Force the creation of a ScreenOrientation and register it
24 // with the controller, so that orientationchange events are sent.
25 var currentType
= window
.screen
.orientation
.type
;
26 testIframe
.src
= "resources/iframe-listen-orientation-change-detach.html";