1
0
Fork 0
firefox/browser/components/preferences/tests/browser_homepage_default.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

31 lines
1 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"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,
"https://example.com",
"homePageUrl should be example.com"
);
registerCleanupFunction(async () => {
defaults.setStringPref("browser.startup.homepage", "about:home");
BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
});