Bug 591175 - Intermittent failure in test_bug346485.html | [SimpleTest/SimpleTest.js, window.onerror] An error occurred - checkFormSubmission is not defined; r=mounir a=intermittent-orange-fix
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 22 Nov 2010 03:13:37 -0500
changeset 58028 f18b9274235c68cdc49c772b92612408ec373474
parent 58027 51a9339e0c579f46d2b74d6d1c7b03e226c1f494
child 58029 ad9e2c046780a49e49e2c53bf38f1747cce416e7
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersmounir, intermittent-orange-fix
bugs591175, 346485
milestone2.0b8pre
Bug 591175 - Intermittent failure in test_bug346485.html | [SimpleTest/SimpleTest.js, window.onerror] An error occurred - checkFormSubmission is not defined; r=mounir a=intermittent-orange-fix
content/html/content/test/test_bug346485.html
--- a/content/html/content/test/test_bug346485.html
+++ b/content/html/content/test/test_bug346485.html
@@ -3,21 +3,27 @@
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=346485
 -->
 <head>
   <title>Test for Bug 346485</title>
   <script type="application/javascript" src="/MochiKit/packed.js"></script>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <script type="application/javascript">
+    frameLoaded = function() {
+      is(frames['submit_frame'].location.href, "about:blank",
+         "Blank frame loaded");
+    }
+  </script>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=346485">Mozilla Bug 346485</a>
 <p id="display"></p>
-<iframe name="submit_frame" onload="checkFormSubmission();" style="visibility: hidden;"></iframe>
+<iframe name="submit_frame" onload="frameLoaded()" style="visibility: hidden;"></iframe>
 <div id="content" style="display: none">
   <form id='f' method='get' target='submit_frame' action='foo'>
     <input name='a' id='a'>
     <input name='b' id='b'>
     <output id='o' for='a b' name='output-name'>tulip</output>
   </form>
 </div>
 <pre id="test">
@@ -121,16 +127,18 @@ function checkHtmlForIDLAttribute(elemen
 
 function submitForm()
 {
   // Setting the values for the submit.
   document.getElementById('o').value = 'foo';
   document.getElementById('a').value = 'afield';
   document.getElementById('b').value = 'bfield';
 
+  frameLoaded = checkFormSubmission;
+
   // This will call checkFormSubmission() which is going to call ST.finish().
   document.getElementById('f').submit();
 }
 
 function checkFormSubmission()
 {
   /**
    * All elements values have been set just before the submission.
@@ -140,40 +148,41 @@ function checkFormSubmission()
 
   is(frames['submit_frame'].location.href,
     'http://mochi.test:8888/tests/content/html/content/test/foo?a=afield&b=bfield',
      "The output element value should not be submitted");
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
-
-var o = document.getElementsByTagName('output');
-is(o.length, 1, "There should be one output element");
+addLoadEvent(function() {
+  var o = document.getElementsByTagName('output');
+  is(o.length, 1, "There should be one output element");
 
-o = o[0];
-ok(o instanceof HTMLOutputElement,
-  "The output should be instance of HTMLOutputElement");
+  o = o[0];
+  ok(o instanceof HTMLOutputElement,
+    "The output should be instance of HTMLOutputElement");
 
-o = document.getElementById('o');
-ok(o instanceof HTMLOutputElement,
-  "The output should be instance of HTMLOutputElement");
+  o = document.getElementById('o');
+  ok(o instanceof HTMLOutputElement,
+    "The output should be instance of HTMLOutputElement");
 
-is(o.type, "output", "Output type IDL attribute should be 'output'");
+  is(o.type, "output", "Output type IDL attribute should be 'output'");
 
-checkNameAttribute(o);
+  checkNameAttribute(o);
 
-checkValueAndDefaultValueIDLAttribute(o);
+  checkValueAndDefaultValueIDLAttribute(o);
 
-checkValueModeFlag(o);
+  checkValueModeFlag(o);
 
-checkDescendantChanged(o);
+  checkDescendantChanged(o);
 
-checkFormIDLAttribute(o);
+  checkFormIDLAttribute(o);
 
-checkHtmlForIDLAttribute(o);
+  checkHtmlForIDLAttribute(o);
 
-submitForm();
+  submitForm();
+});
 
 </script>
 </pre>
 </body>
 </html>