Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

/* Any copyright is dedicated to the Public Domain.
"use strict";
add_task(async function default_homepage_test() {
await SpecialPowers.pushPrefEnv({
set: [["browser.startup.page", 1]],
});
let defaults = Services.prefs.getDefaultBranch("");
// Simulate a homepage set via policy or a distribution.
defaults.setStringPref("browser.startup.homepage", "https://example.com");
await openPreferencesViaOpenPreferencesAPI("paneHome", { leaveOpen: true });
let doc = gBrowser.contentDocument;
let homeMode = doc.getElementById("homeMode");
Assert.equal(homeMode.value, 2, "homeMode should be 2 (Custom URL)");
let homePageUrl = doc.getElementById("homePageUrl");
Assert.equal(
homePageUrl.value,
"homePageUrl should be example.com"
);
registerCleanupFunction(async () => {
defaults.setStringPref("browser.startup.homepage", "about:home");
BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
});