Backed out changeset 742643bf1bcb (bug 1356271)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Sat, 29 Jul 2017 11:46:54 +0200
changeset 422922 843bb2fdec5d0181a03b60e42d8cfdd56a561fee
parent 422921 d389494af12c7f107efd218b0a96bec1ef6ae518
child 422923 58b2f8b17e37c9760145d4cf8f9837e6ae79876f
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1356271
milestone56.0a1
backs out742643bf1bcbf9a7bae3101ced857604bda48951
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
Backed out changeset 742643bf1bcb (bug 1356271)
browser/base/content/test/performance/browser_appmenu_reflows.js
browser/base/content/test/performance/browser_tabopen_reflows.js
browser/base/content/test/performance/browser_tabopen_squeeze_reflows.js
browser/base/content/test/performance/browser_windowopen_reflows.js
browser/base/content/test/performance/head.js
--- a/browser/base/content/test/performance/browser_appmenu_reflows.js
+++ b/browser/base/content/test/performance/browser_appmenu_reflows.js
@@ -5,79 +5,99 @@
  * EXPECTED_APPMENU_OPEN_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_APPMENU_OPEN_REFLOWS = [
-  {
-    stack: [
-      "openPopup@chrome://global/content/bindings/popup.xml",
-      "show/</<@chrome://browser/content/customizableui/panelUI.js",
-    ],
-  },
+  [
+    "openPopup@chrome://global/content/bindings/popup.xml",
+    "show/</<@chrome://browser/content/customizableui/panelUI.js",
+  ],
+
+  [
+    "get_alignmentPosition@chrome://global/content/bindings/popup.xml",
+    "adjustArrowPosition@chrome://global/content/bindings/popup.xml",
+    "onxblpopupshowing@chrome://global/content/bindings/popup.xml",
+    "openPopup@chrome://global/content/bindings/popup.xml",
+    "show/</<@chrome://browser/content/customizableui/panelUI.js",
+  ],
 
-  {
-    stack: [
-      "get_alignmentPosition@chrome://global/content/bindings/popup.xml",
-      "adjustArrowPosition@chrome://global/content/bindings/popup.xml",
-      "onxblpopupshowing@chrome://global/content/bindings/popup.xml",
-      "openPopup@chrome://global/content/bindings/popup.xml",
-      "show/</<@chrome://browser/content/customizableui/panelUI.js",
-    ],
+  [
+    "get_alignmentPosition@chrome://global/content/bindings/popup.xml",
+    "adjustArrowPosition@chrome://global/content/bindings/popup.xml",
+    "onxblpopupshowing@chrome://global/content/bindings/popup.xml",
+    "openPopup@chrome://global/content/bindings/popup.xml",
+    "show/</<@chrome://browser/content/customizableui/panelUI.js",
+  ],
 
-    times: 2, // This number should only ever go down - never up.
-  },
+  [
+    "get_alignmentPosition@chrome://global/content/bindings/popup.xml",
+    "adjustArrowPosition@chrome://global/content/bindings/popup.xml",
+    "onxblpopuppositioned@chrome://global/content/bindings/popup.xml",
+  ],
 
-  {
-    stack: [
-      "get_alignmentPosition@chrome://global/content/bindings/popup.xml",
-      "adjustArrowPosition@chrome://global/content/bindings/popup.xml",
-      "onxblpopuppositioned@chrome://global/content/bindings/popup.xml",
-    ],
-  },
+  [
+    "get_alignmentPosition@chrome://global/content/bindings/popup.xml",
+    "handleEvent@resource:///modules/PanelMultiView.jsm",
+    "openPopup@chrome://global/content/bindings/popup.xml",
+  ],
+
+  [
+    "handleEvent@resource:///modules/PanelMultiView.jsm",
+    "openPopup@chrome://global/content/bindings/popup.xml",
+  ],
+
+  [
+    "handleEvent@resource:///modules/PanelMultiView.jsm",
+    "openPopup@chrome://global/content/bindings/popup.xml",
+  ],
 
-  {
-    stack: [
-      "get_alignmentPosition@chrome://global/content/bindings/popup.xml",
-      "handleEvent@resource:///modules/PanelMultiView.jsm",
-      "openPopup@chrome://global/content/bindings/popup.xml",
-    ],
-  },
+  [
+    "handleEvent@resource:///modules/PanelMultiView.jsm",
+    "openPopup@chrome://global/content/bindings/popup.xml",
+  ],
+
+  [
+    "handleEvent@resource:///modules/PanelMultiView.jsm",
+    "openPopup@chrome://global/content/bindings/popup.xml",
+  ],
 
-  {
-    stack: [
-      "handleEvent@resource:///modules/PanelMultiView.jsm",
-      "openPopup@chrome://global/content/bindings/popup.xml",
-    ],
+  [
+    "handleEvent@resource:///modules/PanelMultiView.jsm",
+    "openPopup@chrome://global/content/bindings/popup.xml",
+  ],
 
-    times: 6, // This number should only ever go down - never up.
-  },
+  [
+    "handleEvent@resource:///modules/PanelMultiView.jsm",
+    "openPopup@chrome://global/content/bindings/popup.xml",
+  ],
 ];
 
 const EXPECTED_APPMENU_SUBVIEW_REFLOWS = [
   /**
    * The synced tabs view has labels that are multiline. Because of bugs in
    * XUL layout relating to multiline text in scrollable containers, we need
    * to manually read their height in order to ensure container heights are
    * correct. Unfortunately this requires 2 sync reflows.
    *
    * If we add more views where this is necessary, we may need to duplicate
    * these expected reflows further.
    */
-  {
-    stack: [
-      "descriptionHeightWorkaround@resource:///modules/PanelMultiView.jsm",
-      "onTransitionEnd@resource:///modules/PanelMultiView.jsm",
-    ],
+  [
+    "descriptionHeightWorkaround@resource:///modules/PanelMultiView.jsm",
+    "onTransitionEnd@resource:///modules/PanelMultiView.jsm",
+  ],
 
-    times: 2, // This number should only ever go down - never up.
-  },
+  [
+    "descriptionHeightWorkaround@resource:///modules/PanelMultiView.jsm",
+    "onTransitionEnd@resource:///modules/PanelMultiView.jsm",
+  ],
 
   /**
    * Please don't add anything new!
    */
 ];
 
 add_task(async function() {
   await ensureNoPreloadedBrowser();
--- a/browser/base/content/test/performance/browser_tabopen_reflows.js
+++ b/browser/base/content/test/performance/browser_tabopen_reflows.js
@@ -10,21 +10,19 @@
  * 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",
-    ],
-  }
+  [
+    "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();
--- a/browser/base/content/test/performance/browser_tabopen_squeeze_reflows.js
+++ b/browser/base/content/test/performance/browser_tabopen_squeeze_reflows.js
@@ -5,23 +5,21 @@
  * 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",
-      "_adjustFocusAfterTabSwitch@chrome://browser/content/tabbrowser.xml",
-    ],
-  }
+  [
+    "select@chrome://global/content/bindings/textbox.xml",
+    "focusAndSelectUrlBar@chrome://browser/content/browser.js",
+    "_adjustFocusAfterTabSwitch@chrome://browser/content/tabbrowser.xml",
+  ],
 ];
 
 /*
  * This test ensures that there are no unexpected
  * uninterruptible reflows when opening a new tab that will
  * cause the existing tabs to squeeze smaller.
  */
 add_task(async function() {
--- a/browser/base/content/test/performance/browser_windowopen_reflows.js
+++ b/browser/base/content/test/performance/browser_windowopen_reflows.js
@@ -8,104 +8,124 @@
  * 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",
-      "_delayedStartup@chrome://browser/content/browser.js",
-    ],
-  },
+  [
+    "select@chrome://global/content/bindings/textbox.xml",
+    "focusAndSelectUrlBar@chrome://browser/content/browser.js",
+    "_delayedStartup@chrome://browser/content/browser.js",
+  ],
 ];
 
 if (Services.appinfo.OS == "Linux") {
   if (gMultiProcessBrowser) {
-    EXPECTED_REFLOWS.push({
-      stack: [
+    EXPECTED_REFLOWS.push(
+      [
         "handleEvent@chrome://browser/content/tabbrowser.xml",
         "EventListener.handleEvent*tabbrowser-tabs_XBL_Constructor@chrome://browser/content/tabbrowser.xml",
       ],
-    });
+    );
   } else {
-    EXPECTED_REFLOWS.push({
-      stack: [
+    EXPECTED_REFLOWS.push(
+      [
         "handleEvent@chrome://browser/content/tabbrowser.xml",
         "inferFromText@chrome://browser/content/browser.js",
         "handleEvent@chrome://browser/content/browser.js",
       ],
-    });
+    );
   }
 }
 
 if (Services.appinfo.OS == "Darwin") {
-  EXPECTED_REFLOWS.push({
-    stack: [
+  EXPECTED_REFLOWS.push(
+    [
       "handleEvent@chrome://browser/content/tabbrowser.xml",
       "inferFromText@chrome://browser/content/browser.js",
       "handleEvent@chrome://browser/content/browser.js",
     ],
-  });
+  );
 }
 
 if (Services.appinfo.OS == "WINNT") {
   EXPECTED_REFLOWS.push(
-    {
-      stack: [
-        "verticalMargins@chrome://browser/content/browser-tabsintitlebar.js",
-        "_update@chrome://browser/content/browser-tabsintitlebar.js",
-        "updateAppearance@chrome://browser/content/browser-tabsintitlebar.js",
-        "handleEvent@chrome://browser/content/tabbrowser.xml",
-      ],
-      times: 2, // This number should only ever go down - never up.
-    },
+    [
+      "verticalMargins@chrome://browser/content/browser-tabsintitlebar.js",
+      "_update@chrome://browser/content/browser-tabsintitlebar.js",
+      "updateAppearance@chrome://browser/content/browser-tabsintitlebar.js",
+      "handleEvent@chrome://browser/content/tabbrowser.xml",
+    ],
 
-    {
-      stack: [
-        "handleEvent@chrome://browser/content/tabbrowser.xml",
-        "inferFromText@chrome://browser/content/browser.js",
-        "handleEvent@chrome://browser/content/browser.js",
-      ],
-    },
+    [
+      "verticalMargins@chrome://browser/content/browser-tabsintitlebar.js",
+      "_update@chrome://browser/content/browser-tabsintitlebar.js",
+      "updateAppearance@chrome://browser/content/browser-tabsintitlebar.js",
+      "handleEvent@chrome://browser/content/tabbrowser.xml",
+    ],
 
-    {
-      stack: [
-        "handleEvent@chrome://browser/content/tabbrowser.xml",
-        "EventListener.handleEvent*tabbrowser-tabs_XBL_Constructor@chrome://browser/content/tabbrowser.xml",
-      ],
-    }
+    [
+      "handleEvent@chrome://browser/content/tabbrowser.xml",
+      "inferFromText@chrome://browser/content/browser.js",
+      "handleEvent@chrome://browser/content/browser.js",
+    ],
+
+    [
+      "handleEvent@chrome://browser/content/tabbrowser.xml",
+      "EventListener.handleEvent*tabbrowser-tabs_XBL_Constructor@chrome://browser/content/tabbrowser.xml",
+    ],
   );
 }
 
 if (Services.appinfo.OS == "WINNT" || Services.appinfo.OS == "Darwin") {
   EXPECTED_REFLOWS.push(
-    {
-      stack: [
-        "rect@chrome://browser/content/browser-tabsintitlebar.js",
-        "_update@chrome://browser/content/browser-tabsintitlebar.js",
-        "updateAppearance@chrome://browser/content/browser-tabsintitlebar.js",
-        "handleEvent@chrome://browser/content/tabbrowser.xml",
-      ],
-      times: 4, // This number should only ever go down - never up.
-    },
+    [
+      "rect@chrome://browser/content/browser-tabsintitlebar.js",
+      "_update@chrome://browser/content/browser-tabsintitlebar.js",
+      "updateAppearance@chrome://browser/content/browser-tabsintitlebar.js",
+      "handleEvent@chrome://browser/content/tabbrowser.xml",
+    ],
+
+    [
+      "rect@chrome://browser/content/browser-tabsintitlebar.js",
+      "_update@chrome://browser/content/browser-tabsintitlebar.js",
+      "updateAppearance@chrome://browser/content/browser-tabsintitlebar.js",
+      "handleEvent@chrome://browser/content/tabbrowser.xml",
+    ],
+
+    [
+      "rect@chrome://browser/content/browser-tabsintitlebar.js",
+      "_update@chrome://browser/content/browser-tabsintitlebar.js",
+      "updateAppearance@chrome://browser/content/browser-tabsintitlebar.js",
+      "handleEvent@chrome://browser/content/tabbrowser.xml",
+    ],
 
-    {
-      stack: [
-        "verticalMargins@chrome://browser/content/browser-tabsintitlebar.js",
-        "_update@chrome://browser/content/browser-tabsintitlebar.js",
-        "updateAppearance@chrome://browser/content/browser-tabsintitlebar.js",
-        "handleEvent@chrome://browser/content/tabbrowser.xml",
-      ],
-      times: 2, // This number should only ever go down - never up.
-    }
+    [
+      "rect@chrome://browser/content/browser-tabsintitlebar.js",
+      "_update@chrome://browser/content/browser-tabsintitlebar.js",
+      "updateAppearance@chrome://browser/content/browser-tabsintitlebar.js",
+      "handleEvent@chrome://browser/content/tabbrowser.xml",
+    ],
+
+    [
+      "verticalMargins@chrome://browser/content/browser-tabsintitlebar.js",
+      "_update@chrome://browser/content/browser-tabsintitlebar.js",
+      "updateAppearance@chrome://browser/content/browser-tabsintitlebar.js",
+      "handleEvent@chrome://browser/content/tabbrowser.xml",
+    ],
+
+    [
+      "verticalMargins@chrome://browser/content/browser-tabsintitlebar.js",
+      "_update@chrome://browser/content/browser-tabsintitlebar.js",
+      "updateAppearance@chrome://browser/content/browser-tabsintitlebar.js",
+      "handleEvent@chrome://browser/content/tabbrowser.xml",
+    ],
   );
 }
 
 /*
  * This test ensures that there are no unexpected
  * uninterruptible reflows when opening new windows.
  */
 add_task(async function() {
--- a/browser/base/content/test/performance/head.js
+++ b/browser/base/content/test/performance/head.js
@@ -1,78 +1,66 @@
 /**
  * Async utility function for ensuring that no unexpected uninterruptible
  * reflows occur during some period of time in a window.
  *
  * @param testFn (async function)
  *        The async function that will exercise the browser activity that is
  *        being tested for reflows.
- * @param expectedReflows (Array, optional)
- *        An Array of Objects representing reflows.
+ * @param expectedStacks (Array, optional)
+ *        An Array of Arrays representing stacks.
  *
  *        Example:
  *
  *        [
- *          {
- *            // This reflow is caused by lorem ipsum
- *            stack: [
- *              "select@chrome://global/content/bindings/textbox.xml",
- *              "focusAndSelectUrlBar@chrome://browser/content/browser.js",
- *              "openLinkIn@chrome://browser/content/utilityOverlay.js",
- *              "openUILinkIn@chrome://browser/content/utilityOverlay.js",
- *              "BrowserOpenTab@chrome://browser/content/browser.js",
- *            ],
- *            // We expect this particular reflow to happen 2 times
- *            times: 2,
- *          },
+ *          // This reflow is caused by lorem ipsum
+ *          [
+ *            "select@chrome://global/content/bindings/textbox.xml",
+ *            "focusAndSelectUrlBar@chrome://browser/content/browser.js",
+ *            "openLinkIn@chrome://browser/content/utilityOverlay.js",
+ *            "openUILinkIn@chrome://browser/content/utilityOverlay.js",
+ *            "BrowserOpenTab@chrome://browser/content/browser.js",
+ *          ],
  *
- *          {
- *            // This reflow is caused by lorem ipsum. We expect this reflow
- *            // to only happen once, so we can omit the "times" property.
- *            stack: [
- *              "get_scrollPosition@chrome://global/content/bindings/scrollbox.xml",
- *              "_fillTrailingGap@chrome://browser/content/tabbrowser.xml",
- *              "_handleNewTab@chrome://browser/content/tabbrowser.xml",
- *              "onxbltransitionend@chrome://browser/content/tabbrowser.xml",
- *            ],
- *          }
+ *          // This reflow is caused by lorem ipsum
+ *          [
+ *            "get_scrollPosition@chrome://global/content/bindings/scrollbox.xml",
+ *            "_fillTrailingGap@chrome://browser/content/tabbrowser.xml",
+ *            "_handleNewTab@chrome://browser/content/tabbrowser.xml",
+ *            "onxbltransitionend@chrome://browser/content/tabbrowser.xml",
+ *          ],
  *
  *        ]
  *
  *        Note that line numbers are not included in the stacks.
  *
  *        Order of the reflows doesn't matter. Expected reflows that aren't seen
  *        will cause an assertion failure. When this argument is not passed,
  *        it defaults to the empty Array, meaning no reflows are expected.
  * @param window (browser window, optional)
  *        The browser window to monitor. Defaults to the current window.
  */
-async function withReflowObserver(testFn, expectedReflows = [], win = window) {
+async function withReflowObserver(testFn, expectedStacks = [], win = window) {
   let dwu = win.QueryInterface(Ci.nsIInterfaceRequestor)
                .getInterface(Ci.nsIDOMWindowUtils);
   let dirtyFrameFn = () => {
     try {
       dwu.ensureDirtyRootFrame();
     } catch (e) {
       // If this fails, we should probably make note of it, but it's not fatal.
       info("Note: ensureDirtyRootFrame threw an exception.");
     }
   };
 
   let els = Cc["@mozilla.org/eventlistenerservice;1"]
               .getService(Ci.nsIEventListenerService);
 
-  // We're going to remove the reflows one by one as we see them so that
+  // We're going to remove the stacks one by one as we see them so that
   // we can check for expected, unseen reflows, so let's clone the array.
-  // While we're at it, for reflows that omit the "times" property, default
-  // it to 1.
-  expectedReflows = expectedReflows.slice(0);
-  expectedReflows.forEach(r => {
-    r.times = r.times || 1;
-  });
+  expectedStacks = expectedStacks.slice(0);
 
   let observer = {
     reflow(start, end) {
       // Gather information about the current code path, slicing out the current
       // frame.
       let path = (new Error().stack).split("\n").slice(1).map(line => {
         return line.replace(/:\d+:\d+$/, "");
       }).join("|");
@@ -83,24 +71,22 @@ async function withReflowObserver(testFn
       dirtyFrameFn();
 
       // Stack trace is empty. Reflow was triggered by native code, which
       // we ignore.
       if (path === "") {
         return;
       }
 
-      let index = expectedReflows.findIndex(reflow => path.startsWith(reflow.stack.join("|")));
+      let index = expectedStacks.findIndex(stack => path.startsWith(stack.join("|")));
 
       if (index != -1) {
         Assert.ok(true, "expected uninterruptible reflow: '" +
                   JSON.stringify(pathWithLineNumbers, null, "\t") + "'");
-        if (--expectedReflows[index].times == 0) {
-          expectedReflows.splice(index, 1);
-        }
+        expectedStacks.splice(index, 1);
       } else {
         Assert.ok(false, "unexpected uninterruptible reflow \n" +
                          JSON.stringify(pathWithLineNumbers, null, "\t") + "\n");
       }
     },
 
     reflowInterruptible(start, end) {
       // We're not interested in interruptible reflows, but might as well take the
@@ -118,24 +104,24 @@ async function withReflowObserver(testFn
   docShell.addWeakReflowObserver(observer);
 
   els.addListenerForAllEvents(win, dirtyFrameFn, true);
 
   try {
     dirtyFrameFn();
     await testFn();
   } finally {
-    for (let remainder of expectedReflows) {
+    for (let remainder of expectedStacks) {
       Assert.ok(false,
-                `Unused expected reflow: ${JSON.stringify(remainder.stack, null, "\t")}\n` +
-                `This reflow was supposed to be hit ${remainder.times} more time(s).\n` +
+                `Unused expected reflow: ${JSON.stringify(remainder, null, "\t")}.\n` +
                 "This is probably a good thing - just remove it from the " +
                 "expected list.");
     }
 
+
     els.removeListenerForAllEvents(win, dirtyFrameFn, true);
     docShell.removeWeakReflowObserver(observer);
   }
 }
 
 async function ensureNoPreloadedBrowser() {
   // If we've got a preloaded browser, get rid of it so that it
   // doesn't interfere with the test if it's loading. We have to