mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1077740 - Handle multiple homepages when resetting to about:home. r=gavin
This commit is contained in:
parent
81a0ad1bec
commit
7bb2a660d4
@ -1623,11 +1623,25 @@ BrowserGlue.prototype = {
|
|||||||
// Reset homepage pref for users who have it set to start.mozilla.org
|
// Reset homepage pref for users who have it set to start.mozilla.org
|
||||||
// or google.com/firefox.
|
// or google.com/firefox.
|
||||||
const HOMEPAGE_PREF = "browser.startup.homepage";
|
const HOMEPAGE_PREF = "browser.startup.homepage";
|
||||||
let uri = Services.prefs.getComplexValue(HOMEPAGE_PREF,
|
if (Services.prefs.prefHasUserValue(HOMEPAGE_PREF)) {
|
||||||
Ci.nsIPrefLocalizedString).data;
|
const DEFAULT =
|
||||||
if (uri && (uri.startsWith("http://start.mozilla.org") ||
|
Services.prefs.getDefaultBranch(HOMEPAGE_PREF)
|
||||||
/^https?:\/\/(www\.)?google\.[a-z.]+\/firefox/i.test(uri))) {
|
.getComplexValue("", Ci.nsIPrefLocalizedString).data;
|
||||||
|
let value =
|
||||||
|
Services.prefs.getComplexValue(HOMEPAGE_PREF, Ci.nsISupportsString);
|
||||||
|
let updated =
|
||||||
|
value.data.replace(/https?:\/\/start\.mozilla\.org[^|]*/i, DEFAULT)
|
||||||
|
.replace(/https?:\/\/(www\.)?google\.[a-z.]+\/firefox[^|]*/i,
|
||||||
|
DEFAULT);
|
||||||
|
if (updated != value.data) {
|
||||||
|
if (updated == DEFAULT) {
|
||||||
Services.prefs.clearUserPref(HOMEPAGE_PREF);
|
Services.prefs.clearUserPref(HOMEPAGE_PREF);
|
||||||
|
} else {
|
||||||
|
value.data = updated;
|
||||||
|
Services.prefs.setComplexValue(HOMEPAGE_PREF,
|
||||||
|
Ci.nsISupportsString, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user