Mochitest for bug 112294
authorEre Maijala <emaijala@kolumbus.fi>
Wed, 23 Jul 2008 10:30:41 +0300
changeset 16130 fec39d6457d68d1988e8053f484f0ff20c10db7c
parent 16129 720a9ec68e862fe109ff6175309990163a07f798
child 16131 ed4c2de9fa703acf3f116423f7948655b9ce6a66
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
bugs112294
milestone1.9.1a1pre
Mochitest for bug 112294 r/sr=roc
content/events/test/Makefile.in
content/events/test/test_bug112294.html
--- a/content/events/test/Makefile.in
+++ b/content/events/test/Makefile.in
@@ -40,16 +40,17 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = content/events/test
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _TEST_FILES = \
+		test_bug112294.html \
 		test_bug238987.html \
 		test_bug288392.html \
 		test_bug328885.html \
 		test_bug336682_1.html \
 		test_bug336682_2.xul \
 		test_bug336682.js \
 		test_bug367781.html \
 		test_bug368835.html \
new file mode 100644
--- /dev/null
+++ b/content/events/test/test_bug112294.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=112294
+-->
+<head>
+  <title>Test for Bug 112294</title>
+  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=112294">Mozilla Bug 112294</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 112294 **/
+
+var countFocus = 0;
+var countBlur = 0;
+
+function handleBlur()
+{
+  ++countBlur;
+  if (countBlur < 5)
+  {
+    // Try to simulate an alert
+	alert = window.open("about:blank", "Alert", "width=200,height=200");
+	alert.focus();
+	alert.close();
+  }    
+}
+
+function handleFocus()
+{
+  ++countFocus;
+}
+
+function doTest()
+{
+  window.focus();
+  window.onblur = handleBlur;
+  window.onfocus = handleFocus;
+  
+  var popup = window.open("about:blank", "Bug 112294", "width=10,height=10");
+  popup.focus();
+  popup.close();
+  setTimeout(finishTest, 0);
+}
+
+function finishTest()
+{
+  is(countFocus, 1, "onfocus count");
+  is(countBlur, 1, "onblur count");
+  SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+setTimeout(doTest, 0);
+
+</script>
+</pre>
+</body>
+</html>