fune/browser/base/content/test/newtab/browser_newtab_reflow_load.js
Andrew Halberstadt d2109610fb Bug 1385352 - Enable 'mozilla/no-arbitrary-setTimeout' eslint rule on browser-chrome tests, r=standard8
MozReview-Commit-ID: 5lO0uAjHMsw

--HG--
extra : rebase_source : 8607b3964da207a6076c79b6f1d75b40503cdd7d
2017-08-10 14:48:21 -04:00

38 lines
1.2 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
const FRAME_SCRIPT = getRootDirectory(gTestPath) + "content-reflows.js";
const ADDITIONAL_WAIT_MS = 2000;
/*
* Ensure that loading about:newtab doesn't cause uninterruptible reflows.
*/
add_task(async function() {
await BrowserTestUtils.openNewForegroundTab(gBrowser, () => {
return gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:blank", {animate: false});
}, false);
let browser = gBrowser.selectedBrowser;
let mm = browser.messageManager;
mm.loadFrameScript(FRAME_SCRIPT, true);
mm.addMessageListener("newtab-reflow", ({data: stack}) => {
ok(false, `unexpected uninterruptible reflow ${stack}`);
});
let browserLoadedPromise = BrowserTestUtils.waitForEvent(browser, "load", true);
browser.loadURI("about:newtab");
await browserLoadedPromise;
// Wait some more to catch sync reflows after the page has loaded.
await new Promise(resolve => {
setTimeout(resolve, ADDITIONAL_WAIT_MS);
});
// Clean up.
gBrowser.removeCurrentTab({animate: false});
ok(true, "Each test requires at least one pass, fail or todo so here is a pass.");
});