Bug 1563632: Fix font restyle races better. r=bustage a=test-only
authorKris Maglione <maglione.k@gmail.com>
Mon, 08 Jul 2019 22:02:31 -0700
changeset 544525 e0892e6d1986bfe1736fa97488c8428a7778ad9f
parent 544524 a65cd5be719c867538cfdfba170f8975af6b8669
child 544526 d679782f8509a6aa5e529b310de33857747665d9
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage, test-only
bugs1563632
milestone69.0
Bug 1563632: Fix font restyle races better. r=bustage a=test-only
gfx/tests/mochitest/test_font_whitelist.html
--- a/gfx/tests/mochitest/test_font_whitelist.html
+++ b/gfx/tests/mochitest/test_font_whitelist.html
@@ -31,16 +31,18 @@ let fontUsed = id => {
 };
 
 // A map of the default mono, sans and serif fonts, obtained when
 // whitelisting is disabled.
 const fonts = { mono: fontUsed("mono"),
                 sans: fontUsed("sans"),
                 serif: fontUsed("serif") };
 
+let hack = 0;
+
 // Set the font whitelist to contain none, some, or all of the
 // default mono, sans, and serif fonts. Check that the rendering
 // of our three test elements uses only fonts present in the
 // whitelist.
 let testFontWhitelist = async function(useMono, useSans, useSerif) {
   let whitelist = [];
   if (useMono) {
     whitelist.push(fonts.mono);
@@ -48,17 +50,21 @@ let testFontWhitelist = async function(u
   if (useSans) {
     whitelist.push(fonts.sans);
   }
   if (useSerif) {
     whitelist.push(fonts.serif);
   }
   await SpecialPowers.pushPrefEnv({"set": [["font.system.whitelist",
                                             whitelist.join(", ")]]});
-  await SpecialPowers.setIntPref("font.fixme.hack", Date.now());
+
+  await new Promise(SimpleTest.executeSoon);
+  await SpecialPowers.setIntPref("font.fixme.hack", hack++);
+  await new Promise(SimpleTest.executeSoon);
+
   // If whitelist is empty, then whitelisting is considered disabled
   // and all fonts are allowed.
   info("font whitelist: " + JSON.stringify(whitelist));
   let whitelistEmpty = whitelist.length === 0;
   is(useMono || whitelistEmpty, fontUsed("mono") === fonts.mono,
      "Correct mono whitelisting state; got " + fontUsed("mono") + ", requested " + fonts.mono);
   is(useSans || whitelistEmpty, fontUsed("sans") === fonts.sans,
      "Correct sans whitelisting state; got " + fontUsed("sans") + ", requested " + fonts.sans);