зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1518799: Show a custom page on startup on Nightly on a specific date. r=Gijs
We want to show an informative message about dedicated profiles per channel to users of Nightly on a specific date. We currently only have the ability to do this when the version changes. This adds the ability to show a page once on startup on a specific date. This will probably be backed out past that date. Differential Revision: https://phabricator.services.mozilla.com/D16249 --HG-- extra : rebase_source : 2da25281b9a9e52f11af43161f48e9db5a7da984 extra : source : eace4709948cdf060a36a60c00eeb286cb7acb17
This commit is contained in:
Родитель
f68118a2d1
Коммит
a64d8fa204
|
@ -2,6 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
pref("startup.homepage_override_nightly.20190116", "https://www.mozilla.org/firefox/dedicated-profiles/");
|
||||
pref("startup.homepage_override_url", "https://www.mozilla.org/projects/firefox/%VERSION%/whatsnew/?oldversion=%OLD_VERSION%");
|
||||
pref("startup.homepage_welcome_url", "https://www.mozilla.org/projects/firefox/%VERSION%/firstrun/");
|
||||
pref("startup.homepage_welcome_url.additional", "");
|
||||
|
|
|
@ -61,10 +61,18 @@ function resolveURIInternal(aCmdLine, aArgument) {
|
|||
|
||||
var gFirstWindow = false;
|
||||
|
||||
function getNormalizedDate() {
|
||||
let pad = num => ("" + num).padStart(2, "0");
|
||||
|
||||
let date = new Date();
|
||||
return `${date.getFullYear()}${pad(date.getMonth() + 1)}${pad(date.getDate())}`;
|
||||
}
|
||||
|
||||
const OVERRIDE_NONE = 0;
|
||||
const OVERRIDE_NEW_PROFILE = 1;
|
||||
const OVERRIDE_NEW_MSTONE = 2;
|
||||
const OVERRIDE_NEW_BUILD_ID = 3;
|
||||
const OVERRIDE_NIGHTLY = 4;
|
||||
/**
|
||||
* Determines whether a home page override is needed.
|
||||
* Returns:
|
||||
|
@ -76,6 +84,15 @@ const OVERRIDE_NEW_BUILD_ID = 3;
|
|||
* OVERRIDE_NONE otherwise.
|
||||
*/
|
||||
function needHomepageOverride(prefb) {
|
||||
let isInTests = Cu.isInAutomation || Services.prefs.getBoolPref("marionette.enabled", false);
|
||||
if (AppConstants.NIGHTLY_BUILD && !isInTests) {
|
||||
let pref = `startup.homepage_override_nightly.${getNormalizedDate()}`;
|
||||
let url = Services.prefs.getCharPref(pref, "");
|
||||
if (url) {
|
||||
return OVERRIDE_NIGHTLY;
|
||||
}
|
||||
}
|
||||
|
||||
var savedmstone = prefb.getCharPref("browser.startup.homepage_override.mstone", "");
|
||||
|
||||
if (savedmstone == "ignore")
|
||||
|
@ -544,6 +561,12 @@ nsBrowserContentHandler.prototype = {
|
|||
UpdatePing.handleUpdateSuccess(old_mstone, old_buildId);
|
||||
}
|
||||
break;
|
||||
case OVERRIDE_NIGHTLY:
|
||||
// Opens a page on the first startup on a particular day.
|
||||
let pref = `startup.homepage_override_nightly.${getNormalizedDate()}`;
|
||||
overridePage = Services.prefs.getCharPref(pref);
|
||||
Services.prefs.setCharPref(pref, "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ex) {}
|
||||
|
|
Загрузка…
Ссылка в новой задаче