Bug 1181965. Remove uses of mozRequestAnimationFrame from dom and parser tests. r=bkelly
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 14 Jul 2015 15:28:57 -0400
changeset 252891 f25a915e59d92f38c18c0cace5192010dd001817
parent 252890 29d3d5041e09382fb585a43cffa575513859d8d9
child 252892 e30ea5d48d7b05fc217b3f4bcf099ab2bf1732b6
push id29048
push userryanvm@gmail.com
push dateWed, 15 Jul 2015 03:36:39 +0000
treeherdermozilla-central@892594bdad30 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly
bugs1181965
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1181965. Remove uses of mozRequestAnimationFrame from dom and parser tests. r=bkelly
dom/base/crashtests/706283-1.html
dom/base/crashtests/709384.html
dom/base/nsDocument.h
dom/base/test/test_bug647518.html
dom/base/test/test_bug675121.html
dom/base/test/test_bug704063.html
dom/browser-element/BrowserElementPanningAPZDisabled.js
dom/canvas/test/reftest/webgl-utils.js
dom/events/test/test_bug607464.html
dom/plugins/test/crashtests/626602-1.html
parser/htmlparser/tests/reftest/frame599320-1.html
--- a/dom/base/crashtests/706283-1.html
+++ b/dom/base/crashtests/706283-1.html
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <script>
 
-window.mozRequestAnimationFrame(null);
+window.requestAnimationFrame(null);
 
 </script>
--- a/dom/base/crashtests/709384.html
+++ b/dom/base/crashtests/709384.html
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
 <script>
-  mozCancelRequestAnimationFrame(mozRequestAnimationFrame(function() {}));
-  mozRequestAnimationFrame(function() {});
+  cancelRequestAnimationFrame(requestAnimationFrame(function() {}));
+  requestAnimationFrame(function() {});
 </script>
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -1756,20 +1756,20 @@ private:
   nsIContent* GetContentInThisDocument(nsIFrame* aFrame) const;
 
   // Just like EnableStyleSheetsForSet, but doesn't check whether
   // aSheetSet is null and allows the caller to control whether to set
   // aSheetSet as the preferred set in the CSSLoader.
   void EnableStyleSheetsForSetInternal(const nsAString& aSheetSet,
                                        bool aUpdateCSSLoader);
 
-  // Revoke any pending notifications due to mozRequestAnimationFrame calls
+  // Revoke any pending notifications due to requestAnimationFrame calls
   void RevokeAnimationFrameNotifications();
   // Reschedule any notifications we need to handle
-  // mozRequestAnimationFrame, if it's OK to do so.
+  // requestAnimationFrame, if it's OK to do so.
   void MaybeRescheduleAnimationFrameNotifications();
 
   // These are not implemented and not supported.
   nsDocument(const nsDocument& aOther);
   nsDocument& operator=(const nsDocument& aOther);
 
   // The layout history state that should be used by nodes in this
   // document.  We only actually store a pointer to it when:
--- a/dom/base/test/test_bug647518.html
+++ b/dom/base/test/test_bug647518.html
@@ -17,29 +17,29 @@ https://bugzilla.mozilla.org/show_bug.cg
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 647518 **/
 SimpleTest.waitForExplicitFinish();
 var counter = 3;
 
 var called = false;
-var handle1 = window.mozRequestAnimationFrame(function() {
+var handle1 = window.requestAnimationFrame(function() {
   called = true;
 });
 ok(handle1 > 0, "Should get back a nonzero handle");
 
 function checker() {
   --counter;
   if (counter == 0) {
     is(called, false, "Canceled callback should not have been called");
     SimpleTest.finish();
   } else {
-    window.mozRequestAnimationFrame(checker);
+    window.requestAnimationFrame(checker);
   }
 }
-window.mozRequestAnimationFrame(checker);
-window.mozCancelAnimationFrame(handle1);
+window.requestAnimationFrame(checker);
+window.cancelAnimationFrame(handle1);
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/base/test/test_bug675121.html
+++ b/dom/base/test/test_bug675121.html
@@ -22,17 +22,17 @@ var callbackFired = false;
 var xhrInProgress = false;
 function f() {
   callbackFired = true;
   if (!xhrInProgress) {
     SimpleTest.finish();
   }
 }
 
-window.mozRequestAnimationFrame(f);
+window.requestAnimationFrame(f);
 var xhr = new XMLHttpRequest();
 xhr.open("GET", "file_bug675121.sjs", false);
 xhrInProgress = true;
 xhr.send();
 xhrInProgress = false;
 is(xhr.responseText, "Responded", "Should have a response by now");
 is(callbackFired, false, "Callback should not fire during sync XHR");
 
--- a/dom/base/test/test_bug704063.html
+++ b/dom/base/test/test_bug704063.html
@@ -7,44 +7,44 @@ https://bugzilla.mozilla.org/show_bug.cg
   <meta charset="utf-8">
   <title>Test for Bug </title>
   <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">
 
   /** Test for Bug  **/
   SimpleTest.waitForExplicitFinish();
-  var unprefixedRan = false;
-  var prefixedRan = false;
-  function unprefixed(time) {
-    is(prefixedRan, true, "We were called second");
-    unprefixedRan = true;
+  var firstRan = false;
+  var secondRan = false;
+  function second(time) {
+    is(firstRan, true, "We were called second");
+    secondRan = true;
     ok(Math.abs(time - performance.now()) < 3600000,
        "An hour really shouldn't have passed here");
     ok(Math.abs(time - Date.now()) > 3600000,
        "More than an hour should have passed since 1970");
   }
-  function prefixed(time) {
-    is(unprefixedRan, false, "Prefixed was called first");
-    prefixedRan = true;
-    ok(Math.abs(time - Date.now()) < 3600000,
-       "Our time should be comparable to Date.now()");
-    ok(Math.abs(time - performance.now()) > 3600000,
-       "Our time should not be comparable to performance.now()");
+  function first(time) {
+    is(secondRan, false, "second() was called first");
+    firstRan = true;
+    ok(Math.abs(time - performance.now()) < 3600000,
+       "An hour really shouldn't have passed here either");
+    ok(Math.abs(time - Date.now()) > 3600000,
+       "More than an hour should have passed since 1970 here either");
   }
-  function prefixed2() {
-    ok(prefixedRan, "We should be after the other prefixed call");
-    ok(unprefixedRan, "We should be after the unprefixed call");
+  function third() {
+    ok(firstRan, "We should be after the first call");
+    ok(secondRan, "We should be after the second call");
     SimpleTest.finish();
   }
 
   window.onload = function() {
-    window.mozRequestAnimationFrame(prefixed);
-    window.requestAnimationFrame(unprefixed);
-    window.mozRequestAnimationFrame(prefixed2);
+    window.requestAnimationFrame(first);
+    window.requestAnimationFrame(second);
+    window.requestAnimationFrame(third);
   }
 
   </script>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
 <p id="display"></p>
 <div id="content" style="display: none">
--- a/dom/browser-element/BrowserElementPanningAPZDisabled.js
+++ b/dom/browser-element/BrowserElementPanningAPZDisabled.js
@@ -617,17 +617,17 @@ const KineticPanning = {
       //
       // We use exponential to get a smoother stop, but by itself exponential
       // is too smooth at the end. Adding a polynomial with the appropriate
       // weight helps to balance
       position.set(v.x * Math.exp(-t / c) * -c + a.x * t * t + v.x * c,
                    v.y * Math.exp(-t / c) * -c + a.y * t * t + v.y * c);
     }
 
-    let startTime = content.mozAnimationStartTime;
+    let startTime = content.performance.now();
     let elapsedTime = 0, targetedTime = 0, averageTime = 0;
 
     let velocity = this._velocity;
     let acceleration = this._acceleration;
 
     let position = this._position;
     let nextPosition = new Point(0, 0);
     let delta = new Point(0, 0);
@@ -662,14 +662,14 @@ const KineticPanning = {
       }
 
       position.add(delta);
       if (this.target.onKineticPan(delta.scale(-1))) {
         this.stop();
         return;
       }
 
-      content.mozRequestAnimationFrame(callback);
+      content.requestAnimationFrame(callback);
     }).bind(this);
 
-    content.mozRequestAnimationFrame(callback);
+    content.requestAnimationFrame(callback);
   }
 };
--- a/dom/canvas/test/reftest/webgl-utils.js
+++ b/dom/canvas/test/reftest/webgl-utils.js
@@ -57,17 +57,17 @@ function initGL(canvas) {
     };
     gl = canvas.getContext("experimental-webgl", argDict);
   } catch(e) {}
 
   return gl;
 }
 
 function rAF(func) {
-  var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame;
+  var raf = window.requestAnimationFrame;
   raf(func);
 }
 
 var MAX_WAIT_FOR_COMPOSITE_DELAY_MS = 500;
 
 function waitForComposite(func) {
   var isDone = false;
   var doneFunc = function () {
--- a/dom/events/test/test_bug607464.html
+++ b/dom/events/test/test_bug607464.html
@@ -50,20 +50,20 @@ function runTest() {
     '</div>', '_blank', 'width=300,height=300');
   SimpleTest.waitForFocus(function () {
     var scrollbox = win.document.getElementById("scrollbox");
     let scrollTopBefore = scrollbox.scrollTop;
 
     scrollDown15PxWithPixelScrolling(scrollbox);
 
     // wait for the next refresh driver run
-    win.mozRequestAnimationFrame(function() {
+    win.requestAnimationFrame(function() {
       // actually, wait for the next one before checking results, since
       // scrolling might not be flushed until after this code has run
-      win.mozRequestAnimationFrame(function() {
+      win.requestAnimationFrame(function() {
         is(scrollbox.scrollTop, scrollTopBefore + 15,
            "Pixel scrolling should have finished after one refresh driver iteration. " +
            "We shouldn't be scrolling smoothly, even though the pref is set.");
         win.close();
         SimpleTest.finish();
       });
     });
   }, win);
--- a/dom/plugins/test/crashtests/626602-1.html
+++ b/dom/plugins/test/crashtests/626602-1.html
@@ -30,34 +30,34 @@
   <script type="text/javascript">
 var plugin, div, canvas;
 function start() {
   plugin = document.getElementById("four");
   div = document.getElementById("three");
   canvas = document.getElementById("two");
   paintCanvas();
 
-  mozRequestAnimationFrame(moveSomething);
+  requestAnimationFrame(moveSomething);
 }
 
 function paintCanvas() {
   var ctx = canvas.getContext("2d");
   ctx.fillStyle = "rgba(255,0,0, 0.6)";
   ctx.fillRect(0,0, 200,200);
 }
 
 var i = 0, numLoops = 20;
 var pluginIn = true, divIn = true, canvasIn = true;
 function moveSomething() {
   var didSomething = (0 === (i % 2)) ? moveSomethingOut() : moveSomethingIn();
   if (!didSomething && ++i >= numLoops) {
     return finish();
   }
 
-  mozRequestAnimationFrame(moveSomething);
+  requestAnimationFrame(moveSomething);
 }
 
 function finish() {
   document.documentElement.removeAttribute("class");
 }
 
 function moveSomethingOut() {
   if (pluginIn) {
--- a/parser/htmlparser/tests/reftest/frame599320-1.html
+++ b/parser/htmlparser/tests/reftest/frame599320-1.html
@@ -1077,16 +1077,16 @@
 <title>Non-UTF-16 doc</title>
 </head>
 <body>
 <h1>Non-UTF-16 doc</h1>
 
 <p>Euro sign: €</p>
 <script>
 window.onload = function() {
-  window.mozRequestAnimationFrame(function() {
+  window.requestAnimationFrame(function() {
     parent.document.documentElement.removeAttribute("class");
   });
 }
 </script>
 </body>
 </html>