browser_homepage_default.js (1028B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 add_task(async function default_homepage_test() { 7 await SpecialPowers.pushPrefEnv({ 8 set: [["browser.startup.page", 1]], 9 }); 10 let defaults = Services.prefs.getDefaultBranch(""); 11 // Simulate a homepage set via policy or a distribution. 12 defaults.setStringPref("browser.startup.homepage", "https://example.com"); 13 14 await openPreferencesViaOpenPreferencesAPI("paneHome", { leaveOpen: true }); 15 16 let doc = gBrowser.contentDocument; 17 let homeMode = doc.getElementById("homeMode"); 18 Assert.equal(homeMode.value, 2, "homeMode should be 2 (Custom URL)"); 19 20 let homePageUrl = doc.getElementById("homePageUrl"); 21 Assert.equal( 22 homePageUrl.value, 23 "https://example.com", 24 "homePageUrl should be example.com" 25 ); 26 27 registerCleanupFunction(async () => { 28 defaults.setStringPref("browser.startup.homepage", "about:home"); 29 BrowserTestUtils.removeTab(gBrowser.selectedTab); 30 }); 31 });