Bug 827976 - Test that the hidden window is not loaded before first paint. r=florian
☠☠ backed out by bf3cbcc82527 ☠ ☠
authorFelipe Gomes <felipc@gmail.com>
Fri, 01 Mar 2019 21:07:28 +0000
changeset 519906 92b45080d080e1cfb967afcd6164e859c0dd58be
parent 519905 443087a359f9baec6e41e9693adc32ad420c561c
child 519907 54c0b12443edcbc5df3328ee7772345325bac70e
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian
bugs827976
milestone67.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 827976 - Test that the hidden window is not loaded before first paint. r=florian Differential Revision: https://phabricator.services.mozilla.com/D21087
browser/base/content/test/performance/browser.ini
browser/base/content/test/performance/browser_startup_hiddenwindow.js
browser/components/tests/startupRecorder.js
--- a/browser/base/content/test/performance/browser.ini
+++ b/browser/base/content/test/performance/browser.ini
@@ -18,16 +18,18 @@ support-files =
   head.js
 [browser_appmenu.js]
 skip-if = asan || debug || (os == 'win' && bits == 32) # Bug 1382809, bug 1369959, Win32 because of intermittent OOM failures
 [browser_preferences_usage.js]
 skip-if = !debug
 [browser_startup.js]
 [browser_startup_content.js]
 skip-if = !e10s
+[browser_startup_hiddenwindow.js]
+skip-if = os == 'mac'
 [browser_startup_flicker.js]
 run-if = debug || devedition || nightly_build # Requires startupRecorder.js, which isn't shipped everywhere by default
 [browser_tabclose_grow.js]
 [browser_tabclose.js]
 skip-if = (os == 'win' && bits == 32) # Bug 1488537
 [browser_tabdetach.js]
 [browser_tabopen.js]
 skip-if = (verify && (os == 'mac'))
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/performance/browser_startup_hiddenwindow.js
@@ -0,0 +1,38 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+add_task(async function() {
+  if (!AppConstants.NIGHTLY_BUILD && !AppConstants.MOZ_DEV_EDITION && !AppConstants.DEBUG) {
+    ok(!("@mozilla.org/test/startuprecorder;1" in Cc),
+       "the startup recorder component shouldn't exist in this non-nightly/non-devedition/" +
+       "non-debug build.");
+    return;
+  }
+
+  let startupRecorder = Cc["@mozilla.org/test/startuprecorder;1"].getService().wrappedJSObject;
+  await startupRecorder.done;
+
+  let extras = Cu.cloneInto(startupRecorder.data.extras, {});
+
+  let phasesExpectations = {
+    "before profile selection": false,
+    "before opening first browser window": false,
+    "before first paint": !Services.prefs.getBoolPref("toolkit.lazyHiddenWindow"),
+
+    // Bug 1531854
+    "before handling user events": true,
+    "before becoming idle": true,
+  };
+
+  for (let phase in extras) {
+    if (!(phase in phasesExpectations)) {
+      ok(false, `Startup phase '${phase}' should be specified.`);
+      continue;
+    }
+
+    is(extras[phase].hiddenWindowLoaded, phasesExpectations[phase],
+       `Hidden window loaded at '${phase}': ${phasesExpectations[phase]}`);
+  }
+});
--- a/browser/components/tests/startupRecorder.js
+++ b/browser/components/tests/startupRecorder.js
@@ -44,16 +44,17 @@ let afterPaintListener = () => {
 function startupRecorder() {
   this.wrappedJSObject = this;
   this.data = {
     images: {
       "image-drawing": new Set(),
       "image-loading": new Set(),
     },
     code: {},
+    extras: {},
     prefStats: {},
   };
   this.done = new Promise(resolve => { this._resolve = resolve; });
 }
 startupRecorder.prototype = {
   classID: Components.ID("{11c095b2-e42e-4bdf-9dd0-aed87595f6a4}"),
 
   QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]),
@@ -68,16 +69,19 @@ startupRecorder.prototype = {
       services: Object.keys(Cc).filter(c => {
         try {
           return Cm.isServiceInstantiatedByContractID(c, Ci.nsISupports);
         } catch (e) {
           return false;
         }
       }),
     };
+    this.data.extras[name] = {
+      hiddenWindowLoaded: Services.appShell.hasHiddenWindow,
+    };
   },
 
   observe(subject, topic, data) {
     if (topic == "app-startup") {
       // We can't ensure our observer will be called first or last, so the list of
       // topics we observe here should avoid the topics used to trigger things
       // during startup (eg. the topics observed by BrowserGlue.jsm).
       let topics = [