Bug 1043586 - Tweak how about:preferences gets filtered out of current set of tabs for homepages. r=Gijs

This commit is contained in:
Jared Wein 2016-01-04 11:12:30 -05:00
parent 7943c8757e
commit 6e577cf41f
3 changed files with 24 additions and 4 deletions

View File

@ -379,19 +379,18 @@ var gMainPane = {
// We should only include visible & non-pinned tabs
tabs = win.gBrowser.visibleTabs.slice(win.gBrowser._numPinnedTabs);
tabs = tabs.filter(this.isNotAboutPreferences);
}
return tabs;
},
/**
* Check to see if a tab is not about:preferences
*/
isNotAboutPreferences: function (aElement, aIndex, aArray)
{
return (aElement.linkedBrowser.currentURI.spec.startsWith != "about:preferences");
return !aElement.linkedBrowser.currentURI.spec.startsWith("about:preferences");
},
/**

View File

@ -19,6 +19,7 @@ skip-if = os != "win" # This test tests the windows-specific app selection dialo
[browser_cookies_exceptions.js]
[browser_healthreport.js]
skip-if = true || !healthreport || (os == 'linux' && debug) # Bug 1185403 for the "true"
[browser_homepages_filter_aboutpreferences.js]
[browser_notifications_do_not_disturb.js]
[browser_permissions_urlFieldHidden.js]
[browser_proxy_backup.js]

View File

@ -0,0 +1,20 @@
add_task(function() {
is(gBrowser.currentURI.spec, "about:blank", "Test starts with about:blank open");
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:home");
yield openPreferencesViaOpenPreferencesAPI("paneGeneral", null, {leaveOpen: true});
let doc = gBrowser.contentDocument;
is(gBrowser.currentURI.spec, "about:preferences#general",
"#general should be in the URI for about:preferences");
let oldHomepagePref = Services.prefs.getCharPref("browser.startup.homepage");
let useCurrent = doc.getElementById("useCurrent");
useCurrent.click();
is(gBrowser.tabs.length, 3, "Three tabs should be open");
is(Services.prefs.getCharPref("browser.startup.homepage"), "about:blank|about:home",
"about:blank and about:home should be the only homepages set");
Services.prefs.setCharPref("browser.startup.homepage", oldHomepagePref);
yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
});