Bug 497633, add tests
authorNeil Deakin <neil@mozilla.com>
Mon, 22 Jun 2009 16:09:58 -0400
changeset 29454 ade8a70e0aee7d006440588ff93446a32389ed3c
parent 29453 914a46ad38b6fd3e773c4ee38d422b06932488dd
child 29455 33ac0a1f2b6c8fd6778127ac2bd4d613a5fb406c
push idunknown
push userunknown
push dateunknown
bugs497633
milestone1.9.2a1pre
Bug 497633, add tests
dom/tests/mochitest/general/497633.html
dom/tests/mochitest/general/test_497898.html
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/general/497633.html
@@ -0,0 +1,24 @@
+<html>
+<head>
+</head>
+<body>
+<script>
+var t = 0;
+function doe() {
+setTimeout(function() {
+  if (t == 1) {
+    window.close();
+    window.opener.done();
+  }
+  else {
+    window.frames[0].location.reload();
+    t++;
+  }
+}, 300);
+}
+</script>
+
+<iframe src="data:application/xhtml+xml;charset=utf-8,%3Chtml%20xmlns%3D%22http%3A//www.w3.org/1999/xhtml%22%3E%0A%0A%3Ciframe/%3E%0A%3Cframeset%20onblur%3D%22window.frameElement.parentNode.removeChild%28window.frameElement%29%22/%3E%0A%0A%3Cscript%3E%0Afunction%20doe%28i%29%7B%0Adocument.getElementsByTagName%28%27*%27%29%5B1%5D.focus%28%29%3B%0A%7D%0AsetTimeout%28doe%2C100%29%3B%0A%3C/script%3E%0A%3C/html%3E" onload="doe()" id="content"></iframe>
+</body>
+</html>
+
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/general/test_497898.html
@@ -0,0 +1,30 @@
+<html>
+<head>
+<title>Crash [@ nsFocusManager::SendFocusOrBlurEvent] after switching focus to a different window in this case</title>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+<script type="text/javascript" src="/MochiKit/packed.js"></script>
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script>
+SimpleTest.waitForExplicitFinish();
+
+function done()
+{
+  is("passed", "passed", "test passed without crashing");
+  SimpleTest.finish();
+}
+
+function switchFocus()
+{
+  setTimeout(function () window.open('497633.html', '_new', 'width=300,height=300'), 0);
+}
+</script>
+</head>
+<body>
+<iframe src="data:text/html;charset=utf-8,%3Chtml%3E%0A%3Chead%3E%3C/head%3E%0A%3Cbody%3E%0A%3Cbutton%20id%3D%22a%22%20onfocus%3D%22parent.switchFocus%28%29%22%20onblur%3D%22window.frameElement.parentNode.removeChild%28window.frameElement%29%22%3ESwitching%20focus%20to%20a%20different%20program%20should%20not%20crash%20Mozilla%3C/button%3E%0A%3Cscript%3E%0Adocument.getElementById%28%27a%27%29.focus%28%29%3B%0A%3C/script%3E%0A%3C/body%3E%0A%3C/html%3E"></iframe>
+
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+</body>
+</html>
+