Bug 1425771 - Add a function to check detect whether have conformant Promise handling and set the flag to represent it. r=birtles
☠☠ backed out by a3e33b6c77ea ☠ ☠
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Mon, 18 Dec 2017 14:17:44 +0900
changeset 448439 14c5ca99af0cc6efe803d2f9d31c9e35ef500b4d
parent 448438 c97612e2aa6e8d225ad35a5051c3c3d9ff76df21
child 448440 a28293b06afed5025bb683807bff1d246bf0f1dc
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1425771
milestone59.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 1425771 - Add a function to check detect whether have conformant Promise handling and set the flag to represent it. r=birtles MozReview-Commit-ID: FbzaUBKQ47F
dom/animation/test/mozilla/file_restyles.html
--- a/dom/animation/test/mozilla/file_restyles.html
+++ b/dom/animation/test/mozilla/file_restyles.html
@@ -100,28 +100,49 @@ function startsRightNow(aAnimation) {
 }
 
 var omtaEnabled = isOMTAEnabled();
 
 var isAndroid = !!navigator.userAgent.includes("Android");
 var isServo = isStyledByServo();
 var offscreenThrottlingEnabled =
   SpecialPowers.getBoolPref('dom.animations.offscreen-throttling');
+var hasConformantPromiseHandling;
 
 function add_task_if_omta_enabled(test) {
   if (!omtaEnabled) {
     info(test.name + " is skipped because OMTA is disabled");
     return;
   }
   add_task(test);
 }
 
+function isConformant() {
+  return new Promise(resolve => {
+    let resolvedPromise = false;
+    requestAnimationFrame(() => {
+      Promise.resolve().then(() => {
+        resolvedPromise = true;
+      });
+    });
+
+    requestAnimationFrame(() => {
+      resolve(resolvedPromise);
+    });
+  });
+}
+
 // We need to wait for all paints before running tests to avoid contaminations
 // from styling of this document itself.
 waitForAllPaints(() => {
+  // Drop this once we have the conformant Promise handling(bug 1193394).
+  add_task(async function check_conformant_promise_handling() {
+    hasConformantPromiseHandling = await isConformant();
+  });
+
   add_task(async function restyling_for_main_thread_animations() {
     var div = addDiv(null, { style: 'animation: background-color 100s' });
     var animation = div.getAnimations()[0];
 
     await animation.ready;
     ok(!SpecialPowers.wrap(animation).isRunningOnCompositor);
 
     // Normally we expect one restyling for each requestAnimationFrame (as