summaryrefslogtreecommitdiffstats
path: root/browser/components/preferences/tests/browser_homepages_filter_aboutpreferences.js
blob: f54d0edaaa035478dbab5bc31742cdf97e65d3c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
add_task(async function testSetHomepageUseCurrent() {
  is(
    gBrowser.currentURI.spec,
    "about:blank",
    "Test starts with about:blank open"
  );
  await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:home");
  await openPreferencesViaOpenPreferencesAPI("paneHome", { leaveOpen: true });
  let doc = gBrowser.contentDocument;
  is(
    gBrowser.currentURI.spec,
    "about:preferences#home",
    "#home should be in the URI for about:preferences"
  );
  let oldHomepage = HomePage.get();

  let useCurrent = doc.getElementById("useCurrentBtn");
  useCurrent.click();

  is(gBrowser.tabs.length, 3, "Three tabs should be open");
  await TestUtils.waitForCondition(
    () => HomePage.get() == "about:blank|about:home"
  );
  is(
    HomePage.get(),
    "about:blank|about:home",
    "about:blank and about:home should be the only homepages set"
  );

  HomePage.safeSet(oldHomepage);
  BrowserTestUtils.removeTab(gBrowser.selectedTab);
  BrowserTestUtils.removeTab(gBrowser.selectedTab);
});