Bug 1558676, browser_html_options_ui.js should wait long enough to ensure layout has been flushed everywhere, r=mstriemer
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 29 Aug 2019 23:35:20 +0000
changeset 551345 b75df9358daaa98fc905a08d6120bd7e5c2094de
parent 551344 4b5fb6e4c7f945bec7f975e31b9e0da6becc87b8
child 551346 c21434a80df3fcc51fb79d84a212026d8c8c64b6
push id11865
push userbtara@mozilla.com
push dateMon, 02 Sep 2019 08:54:37 +0000
treeherdermozilla-beta@37f59c4671b3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstriemer
bugs1558676
milestone70.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 1558676, browser_html_options_ui.js should wait long enough to ensure layout has been flushed everywhere, r=mstriemer Differential Revision: https://phabricator.services.mozilla.com/D44063
toolkit/mozapps/extensions/test/browser/browser_html_options_ui.js
--- a/toolkit/mozapps/extensions/test/browser/browser_html_options_ui.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_html_options_ui.js
@@ -126,49 +126,42 @@ add_task(async function testInlineOption
     "Browser should be the same width as its direct parent"
   );
   ok(stack.clientWidth > 0, "The stack has a width");
   ok(
     card.querySelector('[action="preferences"]').hidden,
     "The preferences option is hidden now"
   );
 
-  let lastHeight;
-  let waitForHeightChange = () =>
-    TestUtils.waitForCondition(() => {
-      if (browser.clientHeight !== lastHeight) {
-        lastHeight = browser.clientHeight;
-        return true;
-      }
-      return false;
-    });
+  let waitForHeightChange = expectedHeight =>
+    TestUtils.waitForCondition(() => browser.clientHeight === expectedHeight);
 
   // The expected heights are 1px taller, to work around bug 1548687.
   const EXPECTED_HEIGHT_SHORT = HEIGHT_SHORT + 1;
   const EXPECTED_HEIGHT_TALL = HEIGHT_TALL + 1;
 
-  await waitForHeightChange();
+  await waitForHeightChange(EXPECTED_HEIGHT_SHORT);
 
   // Check resizing the browser through extension CSS.
   await extension.sendMessage("get-height");
   let height = await extension.awaitMessage("height");
   is(height, EXPECTED_HEIGHT_SHORT, "The height is smaller to start");
   is(height, browser.clientHeight, "The browser is the same size");
 
   info("Resize the browser to be taller");
   await extension.sendMessage("toggle-class");
-  await waitForHeightChange();
+  await waitForHeightChange(EXPECTED_HEIGHT_TALL);
   await extension.sendMessage("get-height");
   height = await extension.awaitMessage("height");
   is(height, EXPECTED_HEIGHT_TALL, "The height is bigger now");
   is(height, browser.clientHeight, "The browser is the same size");
 
   info("Shrink the browser again");
   await extension.sendMessage("toggle-class");
-  await waitForHeightChange();
+  await waitForHeightChange(EXPECTED_HEIGHT_SHORT);
   await extension.sendMessage("get-height");
   height = await extension.awaitMessage("height");
   is(height, EXPECTED_HEIGHT_SHORT, "The browser shrunk back");
   is(height, browser.clientHeight, "The browser is the same size");
 
   info("Switching to details view");
   detailsBtn.click();