Bug 1341985 - Use registerCleanupFunction to restore to normal refresh mode. r?heycam draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Fri, 10 Mar 2017 12:12:54 +0900
changeset 496384 9b07e1a7d3877ff6d59e9cd85add4b6d63b9fef5
parent 496383 7c2fc14271026f4beb00644e1d59f0f19e70c283
child 496385 a49a73e753596e007b0c07c2dc3c8facf5bd5d8a
push id48582
push userhikezoe@mozilla.com
push dateFri, 10 Mar 2017 03:13:33 +0000
reviewersheycam
bugs1341985
milestone55.0a1
Bug 1341985 - Use registerCleanupFunction to restore to normal refresh mode. r?heycam Otherwise, the refresh driver left under test mode when a javascript error occurs in the middle of tests. MozReview-Commit-ID: J7oUuuYhTZ1
layout/style/test/test_animations.html
--- a/layout/style/test/test_animations.html
+++ b/layout/style/test/test_animations.html
@@ -226,16 +226,20 @@ var div, cs;
 var originalNewDiv = window.new_div;
 window.new_div = function(style) {
   [ div, cs ] = originalNewDiv(style);
 };
 
 // take over the refresh driver right from the start.
 advance_clock(0);
 
+SimpleTest.registerCleanupFunction(() => {
+  SpecialPowers.DOMWindowUtils.restoreNormalRefresh();
+});
+
 /*
  * css3-animations:  2. Animations
  * http://dev.w3.org/csswg/css3-animations/#animations
  */
 
 // Test that animations don't affect the computed value before the
 // start of the animation or after its end.  Test without
 // animation-fill-mode, but then repeat the test with all the values of
@@ -2090,14 +2094,12 @@ is(cs.getPropertyValue("left"), "5px", "
 div.style.animation = "unset";
 div.style.animation = "none 1s linear";
 is(cs.getPropertyValue("left"), "0px", "animation name 'none' as identifier is ignored");
 div.style.animation = "unset";
 div.style.animation = "\"none\" 1s linear";
 is(cs.getPropertyValue("left"), "7px", "animation name 'none' as string is accepted");
 done_div();
 
-SpecialPowers.DOMWindowUtils.restoreNormalRefresh();
-
 </script>
 </pre>
 </body>
 </html>