Index: LayoutTests/screen_orientation/screenorientation-detached-notify-no-crash.html |
diff --git a/LayoutTests/screen_orientation/screenorientation-detached-notify-no-crash.html b/LayoutTests/screen_orientation/screenorientation-detached-notify-no-crash.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..087f4898a6adc6b6bc5e22119fdc8035f922261d |
--- /dev/null |
+++ b/LayoutTests/screen_orientation/screenorientation-detached-notify-no-crash.html |
@@ -0,0 +1,30 @@ |
+<!DOCTYPE html> |
+<html> |
+<body> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<iframe id=testIframe></iframe> |
+<script> |
+var notifyTest = async_test("Test that async event dispatch to detached frame is gracefully handled."); |
+ |
+function changeOrientationAndDetach() { |
+ // Dispatch an orientationchange event; this is handled asynchronously, |
+ // queueing a task/timer to do the actual dispatch. |
+ window.testRunner.setMockScreenOrientation('portrait-secondary'); |
+ |
+ // Detach the iframe while the event dispatch is in-flight. If |
+ // the screen orientation controller is finalized during the |
+ // detach, the async event dispatch just after will be treated |
+ // like a no-op -- there's no controller to handle the dispatch. |
+ document.body.removeChild(testIframe); |
+ setTimeout(function () { notifyTest.done(); }, 0); |
+} |
+notifyTest.step(function () { |
+ // Force the creation of a ScreenOrientation and register it |
+ // with the controller, so that orientationchange events are sent. |
+ var currentType = window.screen.orientation.type; |
+ testIframe.src = "resources/iframe-listen-orientation-change-detach.html"; |
+}); |
+</script> |
+</body> |
+</html> |