bug 1249664 - Test that the popup doesn't hide on frame reconstruction r?RyanVM draft
authorChris H-C <chutten@mozilla.com>
Tue, 15 Mar 2016 13:17:17 -0400
changeset 341259 2b5b3ed1ea64746ae66d4ffc273e6e2e3fa5f075
parent 340999 341344bdec8f10bf50646cd6ef2355361435cbf6
child 516372 b53b17e8d5a39c51c0b5dd864bd662f2f3e2c225
push id13177
push userbmo:chutten@mozilla.com
push dateWed, 16 Mar 2016 20:20:04 +0000
reviewersRyanVM
bugs1249664
milestone48.0a1
bug 1249664 - Test that the popup doesn't hide on frame reconstruction r?RyanVM MozReview-Commit-ID: LEikQXmeNeM
layout/forms/test/mochitest.ini
layout/forms/test/test_bug1249664.html
--- a/layout/forms/test/mochitest.ini
+++ b/layout/forms/test/mochitest.ini
@@ -60,8 +60,11 @@ skip-if = (buildapp == 'b2g' && (toolkit
 [test_textarea_resize.html]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' # b2g(resizing textarea not available in b2g) b2g-debug(resizing textarea not available in b2g) b2g-desktop(resizing textarea not available in b2g)
 [test_bug961363.html]
 skip-if = toolkit == 'android' # Bug 1021644 - Fails when pushed into a different chunk on Android
 [test_bug1111995.html]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g'
 [test_select_vertical.html]
 skip-if = e10s || buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' # Bug 1170129 - vertical <select> popup not implemented for e10s # <select> elements don't use an in-page popup on B2G/Android
+[test_bug1249664.html]
+# Not a bug on e10s or non-Windows
+skip-if = e10s || os != "win"
new file mode 100644
--- /dev/null
+++ b/layout/forms/test/test_bug1249664.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Test for Bug 1249664 - select dismisses on frame reconstruction</title>
+<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+<style>
+.ov-hidden {
+  overflow: hidden
+}
+#container {
+  width: 500px;
+  height: 500px;
+}
+</style>
+</head>
+<body>
+<div id="container">
+  <select id="select">
+    <option id="op1">An Option</option>
+    <option id="op2">Another Option</option>
+    <option id="op3">Yet Another Option</option>
+  </select>
+</div>
+<script type="application/javascript">
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("the mouse event needs to come later than " +
+"just asynchronously after the popupshowing event for reasons that are not clear.");
+
+let select = document.getElementById("select");
+select.focus();
+
+document.addEventListener("click", function () {
+  ok(false, "If the document sees a click, it is because the popup has been hidden.");
+  SimpleTest.finish();
+}, false);
+
+select.addEventListener("popupshowing", function () {
+  setTimeout(function () {
+    // Changing the container's overflow forces a frame reconstruction
+    let container = document.getElementById("container");
+    container.classList.toggle("ov-hidden");
+    container.clientTop; // force layout flush
+
+    select.addEventListener("click", function (aEvent) {
+      // Success!
+      SimpleTest.finish();
+      // make sure to silence the event before it reaches the doc
+      aEvent.stopImmediatePropagation();
+    }, false);
+    setTimeout(function () {
+      synthesizeMouse(document.getElementById("op2"), 5, 5, { });
+    }, 1000);
+  }, 0);
+}, false);
+
+// Open the dropdown.
+synthesizeKey("VK_DOWN", { altKey: true });
+</script>
+</body>
+</html>