Bug 1380465 - Drop the expected reflows about focus on url bar. r?mconley draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Wed, 20 Dec 2017 08:33:34 +0900
changeset 713262 f2302e8657cb93a6b9300315071551648c58b3fe
parent 713261 f6792818c0ac5a389acd91afdffcf65842fbf8f9
child 713263 934ef23b363ff6b04c44063d13b832de8762cbb1
push id93598
push userhikezoe@mozilla.com
push dateTue, 19 Dec 2017 23:34:11 +0000
reviewersmconley
bugs1380465, 1377447
milestone59.0a1
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
browser/base/content/test/performance/browser_windowopen_reflows.js
browser/base/content/test/performance/head.js
--- 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() {