crash test for bug 644542
authorKarl Tomlinson <karlt+@karlt.net>
Wed, 04 May 2011 10:43:13 +1200
changeset 69122 3833fae240f758f70ceb18e7b3b9c0717fdc1c1f
parent 69121 c26ec595c92373e0421f15e3eefcf4a1c3df73f2
child 69123 46a89f1c9263208b2e144dd2b1aac0da6a5ff3eb
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
bugs644542
milestone6.0a1
crash test for bug 644542
layout/forms/test/Makefile.in
layout/forms/test/test_bug644542.html
--- a/layout/forms/test/Makefile.in
+++ b/layout/forms/test/Makefile.in
@@ -71,16 +71,17 @@ include $(topsrcdir)/config/rules.mk
 		bug564115_window.html \
 		test_bug377624.html \
 		test_bug571352.html \
 		test_bug572406.html \
 		test_bug572649.html \
 		test_bug36619.html \
 		test_bug620936.html \
 		test_bug595310.html \
+		test_bug644542.html \
 		$(NULL)
 
 _CHROME_FILES = \
 		test_bug536567.html \
 		$(NULL)
 
 libs:: $(_TEST_FILES)
 	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/layout/forms/test/test_bug644542.html
@@ -0,0 +1,63 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=644542
+-->
+<head>
+  <title>Test for Bug 644542</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <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 type="text/css">
+    select:after {
+	    content: ' appended string';
+    }
+  </style>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=644542">Mozilla Bug 644542</a>
+<p id="display">
+  <form method="post" action="">
+    <select id="select">
+      <option value="1">1</option>
+      <option value="2">2</option>
+    </select>
+  </form>
+</p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 644542 **/
+
+var select = document.getElementById("select");
+
+var clicks = 0;
+
+function click() {
+    synthesizeMouseAtCenter(select, { });
+    ++clicks;
+
+    // At least two clicks were required for bug 644542, sometimes more;
+    // delay is long enough that this doesn't look like a double
+    // click, and also allows time for popup to show and for painting.
+    setTimeout(clicks < 4 ? click : done, 500);
+}
+
+function done() {
+    ok(true, "No crash on opening dropdown");
+    SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+// waitForFocus is most likely not the right thing to wait for, but
+// without this the first click is ineffective (even with a reflow forced
+// before synthesizeMouse).
+SimpleTest.waitForFocus(click);
+</script>
+</pre>
+</body>
+</html>