Bug 509274 - Make sizing reftests more robust
authorRobert Longson <longsonr@gmail.com>
Mon, 14 Sep 2009 21:45:14 +0100
changeset 32465 dc368601e0abd7620e044f203f7f8049591faf62
parent 32464 baf6eb94e8f5a3efc780502db49be20669f55173
child 32466 6119349e864e7d27faf80076cb7ceb790a846fc5
push id9094
push userlongsonr@gmail.com
push dateMon, 14 Sep 2009 20:45:31 +0000
treeherdermozilla-central@dc368601e0ab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs509274
milestone1.9.3a1pre
Bug 509274 - Make sizing reftests more robust
layout/reftests/svg/sizing/dynamic--inline-css-height.xhtml
layout/reftests/svg/sizing/dynamic--inline-css-width.xhtml
layout/reftests/svg/sizing/dynamic--inline-resize-cb-height.xhtml
layout/reftests/svg/sizing/dynamic--inline-resize-cb-width.xhtml
layout/reftests/svg/sizing/dynamic--inline-resize-window-height.xhtml
layout/reftests/svg/sizing/dynamic--inline-resize-window-width.xhtml
layout/reftests/svg/sizing/dynamic--object-svg-unloaded-a.svg
layout/reftests/svg/sizing/dynamic--object-svg-unloaded-b.xhtml
--- a/layout/reftests/svg/sizing/dynamic--inline-css-height.xhtml
+++ b/layout/reftests/svg/sizing/dynamic--inline-css-height.xhtml
@@ -25,23 +25,27 @@ html, body {
   background: red;
 }
 
     </style>
     <script type="text/javascript">
 
 function handle_load(e)
 {
-  setTimeout(resize_svg, 50); // allow some time for layout and rendering
+  document.addEventListener("MozReftestInvalidate", resize_svg, false);
+  // in case we're not gecko
+  setTimeout(resize_svg, 5000);
 }
 
 function resize_svg()
 {
   document.getElementById('svg').style.height = '100%';
-  setTimeout(notify_test_finished, 50); // allow some time for layout and rendering
+  document.addEventListener("MozReftestInvalidate", notify_test_finished, false);
+  // in case we're not gecko
+  setTimeout(notify_test_finished, 5000);
 }
 
 function notify_test_finished()
 {
   document.documentElement.removeAttribute('class');
 }
 
     </script>
--- a/layout/reftests/svg/sizing/dynamic--inline-css-width.xhtml
+++ b/layout/reftests/svg/sizing/dynamic--inline-css-width.xhtml
@@ -25,23 +25,27 @@ html, body {
   background: red;
 }
 
     </style>
     <script type="text/javascript">
 
 function handle_load(e)
 {
-  setTimeout(resize_svg, 50); // allow some time for layout and rendering
+  document.addEventListener("MozReftestInvalidate", resize_svg, false);
+  // in case we're not gecko
+  setTimeout(resize_svg, 5000);
 }
 
 function resize_svg()
 {
   document.getElementById('svg').style.width = '100%';
-  setTimeout(notify_test_finished, 50); // allow some time for layout and rendering
+  document.addEventListener("MozReftestInvalidate", notify_test_finished, false);
+  // in case we're not gecko
+  setTimeout(notify_test_finished, 5000);
 }
 
 function notify_test_finished()
 {
   document.documentElement.removeAttribute('class');
 }
 
     </script>
--- a/layout/reftests/svg/sizing/dynamic--inline-resize-cb-height.xhtml
+++ b/layout/reftests/svg/sizing/dynamic--inline-resize-cb-height.xhtml
@@ -26,24 +26,28 @@ html, body, div {
   overflow: hidden;
 }
 
     </style>
     <script type="text/javascript">
 
 function handle_load(e)
 {
-  setTimeout(resize_div, 50); // allow some time for layout and rendering
+  document.addEventListener("MozReftestInvalidate", resize_div, false);
+  // in case we're not gecko
+  setTimeout(resize_div, 5000);
 }
 
 function resize_div()
 {
   var XHTML_NS = 'http://www.w3.org/1999/xhtml';
   document.getElementsByTagNameNS(XHTML_NS, 'div').item(0).style.height = '100%';
-  setTimeout(notify_test_finished, 50); // allow some time for layout and rendering
+  document.addEventListener("MozReftestInvalidate", notify_test_finished, false);
+  // in case we're not gecko
+  setTimeout(notify_test_finished, 5000);
 }
 
 function notify_test_finished()
 {
   document.documentElement.removeAttribute('class');
 }
 
     </script>
--- a/layout/reftests/svg/sizing/dynamic--inline-resize-cb-width.xhtml
+++ b/layout/reftests/svg/sizing/dynamic--inline-resize-cb-width.xhtml
@@ -26,24 +26,28 @@ html, body, div {
   overflow: hidden;
 }
 
     </style>
     <script type="text/javascript">
 
 function handle_load(e)
 {
-  setTimeout(resize_div, 50); // allow some time for layout and rendering
+  document.addEventListener("MozReftestInvalidate", resize_div, false);
+  // in case we're not gecko
+  setTimeout(resize_div, 5000);
 }
 
 function resize_div()
 {
   var XHTML_NS = 'http://www.w3.org/1999/xhtml';
   document.getElementsByTagNameNS(XHTML_NS, 'div').item(0).style.width = '100%';
-  setTimeout(notify_test_finished, 50); // allow some time for layout and rendering
+  document.addEventListener("MozReftestInvalidate", notify_test_finished, false);
+  // in case we're not gecko
+  setTimeout(notify_test_finished, 5000);
 }
 
 function notify_test_finished()
 {
   document.documentElement.removeAttribute('class');
 }
 
     </script>
--- a/layout/reftests/svg/sizing/dynamic--inline-resize-window-height.xhtml
+++ b/layout/reftests/svg/sizing/dynamic--inline-resize-window-height.xhtml
@@ -29,23 +29,27 @@ html, body, div {
     </style>
     <script type="text/javascript">
 
 var initial_height = top.innerHeight;
 top.innerHeight /= 2;
 
 function handle_load(e)
 {
-  setTimeout(restore_height, 50); // allow some time for layout and rendering
+  document.addEventListener("MozReftestInvalidate", restore_height, false);
+  // in case we're not gecko
+  setTimeout(restore_height, 5000);
 }
 
 function restore_height()
 {
   top.innerHeight = initial_height;
-  setTimeout(notify_test_finished, 50); // allow some time for layout and rendering
+  document.addEventListener("MozReftestInvalidate", notify_test_finished, false);
+  // in case we're not gecko
+  setTimeout(notify_test_finished, 5000);
 }
 
 function notify_test_finished()
 {
   document.documentElement.removeAttribute('class');
 }
 
     </script>
--- a/layout/reftests/svg/sizing/dynamic--inline-resize-window-width.xhtml
+++ b/layout/reftests/svg/sizing/dynamic--inline-resize-window-width.xhtml
@@ -35,17 +35,19 @@ top.innerWidth /= 2;
 function handle_load(e)
 {
   setTimeout(restore_width, 50); // allow some time for layout and rendering
 }
 
 function restore_width()
 {
   top.innerWidth = initial_width;
-  setTimeout(notify_test_finished, 50); // allow some time for layout and rendering
+  document.addEventListener("MozReftestInvalidate", notify_test_finished, false);
+  // in case we're not gecko
+  setTimeout(notify_test_finished, 5000);
 }
 
 function notify_test_finished()
 {
   document.documentElement.removeAttribute('class');
 }
 
     </script>
--- a/layout/reftests/svg/sizing/dynamic--object-svg-unloaded-a.svg
+++ b/layout/reftests/svg/sizing/dynamic--object-svg-unloaded-a.svg
@@ -12,17 +12,19 @@
   <script type="text/javascript">
 
 var embedding_element;
 
 function handle_load(e)
 {
   embedding_element = e.originalTarget.ownerDocument.defaultView.frameElement;
 
-  setTimeout(load_new_page, 50); // allow some time for layout and rendering
+  document.addEventListener("MozReftestInvalidate", load_new_page, false);
+  // in case we're not gecko
+  setTimeout(load_new_page, 5000);
 }
 
 function load_new_page()
 {
   // We could set embedding_element.data to load the new page, but that:
   //
   //  a) Crashes if we don't use setTimeout
   //
--- a/layout/reftests/svg/sizing/dynamic--object-svg-unloaded-b.xhtml
+++ b/layout/reftests/svg/sizing/dynamic--object-svg-unloaded-b.xhtml
@@ -22,17 +22,19 @@ html {
 
     <script type="text/javascript">
 
 var embedding_element;
 
 function handle_load(e)
 {
   embedding_element = e.originalTarget.defaultView.frameElement;
-  setTimeout(notify_test_finished, 50); // allow some time for layout and rendering
+  document.addEventListener("MozReftestInvalidate", notify_test_finished, false);
+  // in case we're not gecko
+  setTimeout(notify_test_finished, 5000);
 }
 
 function notify_test_finished()
 {
   embedding_element.ownerDocument.documentElement.removeAttribute('class');
 }
 
     </script>