fune/browser/base/content/test/about/browser_aboutHome_imitate.js
Ed Lee e3156bf606 Bug 1399648 - Get browser_aboutHome.js passing on both about:homes with activity stream or not. r=ursula
MozReview-Commit-ID: GtzmDbmSUjH

--HG--
extra : rebase_source : b62d939e325a1aa4d5d34e2501be39b2f0959357
2017-09-13 13:10:23 -07:00

41 lines
1.2 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
ignoreAllUncaughtExceptions();
add_task(async function() {
info("Make sure that a page can't imitate about:home");
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:home" }, async function(browser) {
let promise = BrowserTestUtils.browserLoaded(browser);
browser.loadURI("https://example.com/browser/browser/base/content/test/about/test_bug959531.html");
await promise;
await ContentTask.spawn(browser, null, async function() {
let button = content.document.getElementById("settings");
ok(button, "Found settings button in test page");
button.click();
});
await new Promise(resolve => {
// It may take a few turns of the event loop before the window
// is displayed, so we wait.
function check(n) {
let win = Services.wm.getMostRecentWindow("Browser:Preferences");
ok(!win, "Preferences window not showing");
if (win) {
win.close();
}
if (n > 0) {
executeSoon(() => check(n - 1));
} else {
resolve();
}
}
check(5);
});
});
});