Bug 1380465 - Drop the expected reflows about focus on url bar. r?mconley
Since
bug 1377447 we use EnsurePresShellInitAndFrames for
FlushPendingNotification when textbox gets focused, and
EnsurePresShellInitAndFrames should not trigger any reflows. So in theory,
there is something causes a reflow that we could improve on other platforms.
MozReview-Commit-ID: FAcSZKrv0Fr
--- a/browser/base/content/test/performance/browser_windowopen_reflows.js
+++ b/browser/base/content/test/performance/browser_windowopen_reflows.js
@@ -7,24 +7,17 @@
* 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 = [
- {
- stack: [
- "select@chrome://global/content/bindings/textbox.xml",
- "focusAndSelectUrlBar@chrome://browser/content/browser.js",
- ],
- },
-];
+const EXPECTED_REFLOWS = [];
if (Services.appinfo.OS == "WINNT") {
EXPECTED_REFLOWS.push(
{
stack: [
"verticalMargins@chrome://browser/content/browser-tabsintitlebar.js",
"_update@chrome://browser/content/browser-tabsintitlebar.js",
"init@chrome://browser/content/browser-tabsintitlebar.js",
@@ -34,16 +27,22 @@ if (Services.appinfo.OS == "WINNT") {
},
);
}
if (Services.appinfo.OS == "WINNT" || Services.appinfo.OS == "Darwin") {
EXPECTED_REFLOWS.push(
{
stack: [
+ "select@chrome://global/content/bindings/textbox.xml",
+ "focusAndSelectUrlBar@chrome://browser/content/browser.js",
+ ],
+ },
+ {
+ stack: [
"rect@chrome://browser/content/browser-tabsintitlebar.js",
"_update@chrome://browser/content/browser-tabsintitlebar.js",
"init@chrome://browser/content/browser-tabsintitlebar.js",
"handleEvent@chrome://browser/content/tabbrowser.xml",
],
times: 4, // This number should only ever go down - never up.
},
);
--- a/browser/base/content/test/performance/head.js
+++ b/browser/base/content/test/performance/head.js
@@ -139,24 +139,28 @@ async function withReflowObserver(testFn
docShell.addWeakReflowObserver(observer);
Services.els.addListenerForAllEvents(win, dirtyFrameFn, true);
try {
dirtyFrameFn();
await testFn(dirtyFrameFn);
} finally {
- for (let remainder of expectedReflows) {
- if (!Number.isInteger(remainder.minTimes) || remainder.minTimes > 0) {
- Assert.ok(false,
- `Unused expected reflow: ${JSON.stringify(remainder.stack, null, "\t")}\n` +
- `This reflow was supposed to be hit ${remainder.minTimes || remainder.times} more time(s).\n` +
- "This is probably a good thing - just remove it from the " +
- "expected list.");
+ if (expectedReflows.length != 0) {
+ for (let remainder of expectedReflows) {
+ if (!Number.isInteger(remainder.minTimes) || remainder.minTimes > 0) {
+ Assert.ok(false,
+ `Unused expected reflow: ${JSON.stringify(remainder.stack, null, "\t")}\n` +
+ `This reflow was supposed to be hit ${remainder.minTimes || remainder.times} more time(s).\n` +
+ "This is probably a good thing - just remove it from the " +
+ "expected list.");
+ }
}
+ } else {
+ Assert.ok(true, "All expected reflows were observed");
}
Services.els.removeListenerForAllEvents(win, dirtyFrameFn, true);
docShell.removeWeakReflowObserver(observer);
}
}
async function ensureNoPreloadedBrowser() {