fune/browser/base/content/test/performance/browser_tabopen_reflows.js
Mike Conley 5f9f0cd7f2 Bug 1356271 - Make it so that it's easier to define repeating reflows for reflow tests. r=florian
MozReview-Commit-ID: 5ZL5RtItbiL

--HG--
extra : rebase_source : 93fbacfde3a9825e46c0d81bb3ad29af448551fa
extra : source : 7629e34f7fb6f756c09f0d6735b746a9d1050c5f
2017-07-10 18:07:25 -04:00

44 lines
1.5 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* WHOA THERE: We should never be adding new things to EXPECTED_REFLOWS. This
* is a whitelist that should slowly go away as we improve the performance of
* the front-end. Instead of adding more reflows to the whitelist, you should
* be modifying your code to avoid the reflow.
*
* See https://developer.mozilla.org/en-US/Firefox/Performance_best_practices_for_Firefox_fe_engineers
* for tips on how to do that.
*/
const EXPECTED_REFLOWS = [
// selection change notification may cause querying the focused editor content
// by IME and that will cause reflow.
{
stack: [
"select@chrome://global/content/bindings/textbox.xml",
],
}
];
/*
* This test ensures that there are no unexpected
* uninterruptible reflows when opening new tabs.
*/
add_task(async function() {
await ensureNoPreloadedBrowser();
// Add a reflow observer and open a new tab.
await withReflowObserver(async function() {
let switchDone = BrowserTestUtils.waitForEvent(window, "TabSwitchDone");
BrowserOpenTab();
await BrowserTestUtils.waitForEvent(gBrowser.selectedTab, "transitionend",
false, e => e.propertyName === "max-width");
await switchDone;
}, EXPECTED_REFLOWS);
let switchDone = BrowserTestUtils.waitForEvent(window, "TabSwitchDone");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
await switchDone;
});