fune/browser/base/content/test/general/browser_bug724239.js
Gijs Kruitbosch 1840a17b2a Bug 776167 - allow going back to about:newtab, r=smaug,ursula
MozReview-Commit-ID: 8FTPI30RqYL

--HG--
extra : rebase_source : 693cecd231ebef219edbf2985910589c266101ae
2017-08-10 10:46:19 +01:00

36 lines
1.8 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
add_task(async function test_blank() {
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" },
async function(browser) {
BrowserTestUtils.loadURI(browser, "http://example.com");
await BrowserTestUtils.browserLoaded(browser);
ok(!gBrowser.canGoBack, "about:blank wasn't added to session history");
});
});
add_task(async function test_newtab() {
await SpecialPowers.pushPrefEnv({set: [["browser.newtabpage.activity-stream.enabled", true]]});
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" },
async function(browser) {
// Can't load it directly because that'll use a preloaded tab if present.
BrowserTestUtils.loadURI(browser, "about:newtab");
await BrowserTestUtils.browserLoaded(browser);
BrowserTestUtils.loadURI(browser, "http://example.com");
await BrowserTestUtils.browserLoaded(browser);
is(gBrowser.canGoBack, true, "about:newtab was added to the session history when AS was enabled.");
});
await SpecialPowers.pushPrefEnv({set: [["browser.newtabpage.activity-stream.enabled", false]]});
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" },
async function(browser) {
// Can't load it directly because that'll use a preloaded tab if present.
BrowserTestUtils.loadURI(browser, "about:newtab");
await BrowserTestUtils.browserLoaded(browser);
BrowserTestUtils.loadURI(browser, "http://example.com");
await BrowserTestUtils.browserLoaded(browser);
is(gBrowser.canGoBack, false, "about:newtab was not added to the session history when AS was disabled.");
});
});