Index: LayoutTests/gamepad/page-visibility-detach-while-dispatching.html |
diff --git a/LayoutTests/gamepad/page-visibility-detach-while-dispatching.html b/LayoutTests/gamepad/page-visibility-detach-while-dispatching.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4fc0cf85d9a3203826c93f322bb6b437c19fb7c9 |
--- /dev/null |
+++ b/LayoutTests/gamepad/page-visibility-detach-while-dispatching.html |
@@ -0,0 +1,27 @@ |
+<!DOCTYPE HTML> |
+<html> |
+<script src="../resources/js-test.js"></script> |
+<script> |
+description("Test that we don't crash while dispatching pending gamepad events if the event handler detaches us."); |
+ |
+if (!window.testRunner || !window.gamepadController) |
+ document.write('This test cannot run without testRunner or gamepadController'); |
+ |
+window.addEventListener('gamepadconnected', function (event) { |
+ shouldBeEqualToNumber('event.gamepad.index', 0); |
+ shouldBeEqualToNumber('eventCount', 1); |
+ document.write('PASS'); |
+}); |
+ |
+function start() { |
+ testRunner.setPageVisibility('hidden'); |
+ gamepadController.connect(0); |
+ gamepadController.connect(1); |
+ testRunner.setPageVisibility('visible'); |
+} |
+ |
+</script> |
+<body onload="start()"> |
+FAIL |
+</body> |
+</html> |