Bug 1465983 part 1 - Fix race in test_font_loading_api.html. rs=heycam
authorJonathan Watt <jwatt@jwatt.org>
Tue, 22 May 2018 12:46:18 +0100
changeset 421384 94409f81ab0e75db962f24b29cb8a7f1bc3a71f2
parent 421383 46d845389b970ade7754694a03cb3438e6985faa
child 421385 023d0b84b7a9d8cdde7b9eb6e8fbc30faeae220d
push id34093
push useraiakab@mozilla.com
push dateTue, 05 Jun 2018 21:58:58 +0000
treeherdermozilla-central@da28b92efe6f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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 1465983 part 1 - Fix race in test_font_loading_api.html. rs=heycam This patch changes 'TEST 3' so that instead of testing that all the documents' document.fonts.ready Promises are resolved at a certain time, that instead it just waits for them to resolve and then checks that they resolved to the correct object. The test previously assumed that calling SpecialPowers.pushPrefEnv on the page's 'load' and waiting for pushPrefEnv's callback would be enough time for document.fonts.ready to have been resolved for the top-level document and all of its frames. That is not necessarily the case. Even the Promise in the top-level document itself is not guaranteed to have resolved by that point. The Promises will not have been resolved at least until style and layout has been flushed, and in fact in Mozilla's implementation it frequently won't happen until the first refresh driver tick after layout has finished. The result of this is that the CI machine 'Linux x64 QuantumRender opt' was failing 'TEST 3' intermittently.
--- a/layout/style/test/test_font_loading_api.html
+++ b/layout/style/test/test_font_loading_api.html
@@ -219,22 +219,22 @@ function runTest() {
     is(Object.getPrototypeOf(FontFace.prototype), Object.prototype, "FontFace should inherit from Object (TEST 1)");
     // (TEST 2) Some miscellaneous tests for FontFaceSetLoadEvent.
     ok(window.FontFaceSetLoadEvent, "FontFaceSetLoadEvent interface object should be present (TEST 2)");
     is(Object.getPrototypeOf(FontFaceSetLoadEvent.prototype), Event.prototype, "FontFaceSetLoadEvent should inherit from Event (TEST 2)");
   }).then(function() {
-    // (TEST 3) Test that document.fonts.ready starts out resolved with the
-    // FontFaceSet.
+    // (TEST 3) Test that document.fonts.ready is resolved with the
+    // document.fonts FontFaceSet.
     var p = Promise.resolve();
     sourceDocuments.forEach(function({ doc, what }) {
-      p = p.then(function() {
-        return is_resolved_with(doc.fonts.ready, doc.fonts, "initial value of document.fonts", "(TEST 3) (" + what + ")");
+      p = p.then(doc.fonts.ready).then(function() {
+        return is_resolved_with(doc.fonts.ready, doc.fonts, "document.fonts.ready resolves with document.fonts", "(TEST 3) (" + what + ")");
     return p;
   }).then(function() {
     // (TEST 4) Test that document.fonts in this test document starts out with no
     // FontFace objects in it.