From 1e3b008bd7647860b9031a885e1c2b598dc27437 Mon Sep 17 00:00:00 2001 From: Dave Townsend Date: Wed, 30 Jan 2019 14:56:30 -0800 Subject: [PATCH] Bug 1455707: Detect when running an older version than previously ran with the selected profile. r=froydnj, r=mconley, r=Gijs Use the information in compatibility.ini to detect that the current running application is an older version than previously ran with the profile and in that case open a UI allowing the user to launch the profile manager, launch the previous instance of the application or quit. Also includes the patch from bug 1523725. --HG-- rename : browser/themes/shared/information.svg => toolkit/themes/shared/profile/information.svg extra : rebase_source : 3bf8b329eb5ea9e71fe2f0ed34a7e44dfdc434fd extra : intermediate-source : 21a801ca5f6d435509f93e1dee187cb6ca868c8f extra : source : c9d89812bc226ca593119bf440cb4f5e50ac2ace --- browser/themes/shared/jar.inc.mn | 1 - browser/themes/shared/newInstall.css | 2 +- .../mozapps/profile/profileDowngrade.dtd | 20 ++ toolkit/locales/jar.mn | 3 + toolkit/profile/content/profileDowngrade.js | 29 ++ toolkit/profile/content/profileDowngrade.xul | 39 +++ toolkit/profile/jar.mn | 4 + toolkit/profile/nsIToolkitProfileService.idl | 39 ++- toolkit/profile/nsToolkitProfileService.cpp | 24 +- toolkit/themes/shared/mozapps.inc.mn | 2 + .../themes/shared/profile}/information.svg | 0 .../shared/profile/profileDowngrade.css | 13 + toolkit/xre/nsAppRunner.cpp | 254 +++++++++++++++--- 13 files changed, 396 insertions(+), 34 deletions(-) create mode 100644 toolkit/locales/en-US/chrome/mozapps/profile/profileDowngrade.dtd create mode 100644 toolkit/profile/content/profileDowngrade.js create mode 100644 toolkit/profile/content/profileDowngrade.xul rename {browser/themes/shared => toolkit/themes/shared/profile}/information.svg (100%) create mode 100644 toolkit/themes/shared/profile/profileDowngrade.css diff --git a/browser/themes/shared/jar.inc.mn b/browser/themes/shared/jar.inc.mn index 670d8f39a192..181d284bf5b9 100644 --- a/browser/themes/shared/jar.inc.mn +++ b/browser/themes/shared/jar.inc.mn @@ -56,7 +56,6 @@ skin/classic/browser/identity-icon.svg (../shared/identity-block/identity-icon.svg) skin/classic/browser/identity-icon-notice.svg (../shared/identity-block/identity-icon-notice.svg) skin/classic/browser/info.svg (../shared/info.svg) - skin/classic/browser/information.svg (../shared/information.svg) skin/classic/browser/newInstall.css (../shared/newInstall.css) skin/classic/browser/newInstallPage.css (../shared/newInstallPage.css) diff --git a/browser/themes/shared/newInstall.css b/browser/themes/shared/newInstall.css index a9d9dbc0d05f..33daa754d96f 100644 --- a/browser/themes/shared/newInstall.css +++ b/browser/themes/shared/newInstall.css @@ -10,7 +10,7 @@ window { width: 32px; height: 32px; margin-inline-end: 8px; - list-style-image: url("chrome://browser/skin/information.svg"); + list-style-image: url("chrome://mozapps/skin/profile/information.svg"); } description { diff --git a/toolkit/locales/en-US/chrome/mozapps/profile/profileDowngrade.dtd b/toolkit/locales/en-US/chrome/mozapps/profile/profileDowngrade.dtd new file mode 100644 index 000000000000..ce3b8388bd87 --- /dev/null +++ b/toolkit/locales/en-US/chrome/mozapps/profile/profileDowngrade.dtd @@ -0,0 +1,20 @@ + + + + + + + + + + + + diff --git a/toolkit/locales/jar.mn b/toolkit/locales/jar.mn index a5c65f929eaf..daa821d3f02c 100644 --- a/toolkit/locales/jar.mn +++ b/toolkit/locales/jar.mn @@ -83,6 +83,9 @@ locale/@AB_CD@/mozapps/profile/createProfileWizard.dtd (%chrome/mozapps/profile/createProfileWizard.dtd) locale/@AB_CD@/mozapps/profile/profileSelection.properties (%chrome/mozapps/profile/profileSelection.properties) locale/@AB_CD@/mozapps/profile/profileSelection.dtd (%chrome/mozapps/profile/profileSelection.dtd) +#ifdef MOZ_BLOCK_PROFILE_DOWNGRADE + locale/@AB_CD@/mozapps/profile/profileDowngrade.dtd (%chrome/mozapps/profile/profileDowngrade.dtd) +#endif #ifndef MOZ_FENNEC locale/@AB_CD@/mozapps/update/updates.dtd (%chrome/mozapps/update/updates.dtd) locale/@AB_CD@/mozapps/update/updates.properties (%chrome/mozapps/update/updates.properties) diff --git a/toolkit/profile/content/profileDowngrade.js b/toolkit/profile/content/profileDowngrade.js new file mode 100644 index 000000000000..39f8195b0ab3 --- /dev/null +++ b/toolkit/profile/content/profileDowngrade.js @@ -0,0 +1,29 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +let gParams; + +function init() { + /* + * The C++ code passes a dialog param block using its integers as in and out + * arguments for this UI. The following are the uses of the integers: + * + * 0: A set of flags from nsIToolkitProfileService.downgradeUIFlags. + * 1: A return argument, one of nsIToolkitProfileService.downgradeUIChoice. + */ + gParams = window.arguments[0].QueryInterface(Ci.nsIDialogParamBlock); + let hasSync = gParams.GetInt(0) & Ci.nsIToolkitProfileService.hasSync; + + document.getElementById("sync").hidden = !hasSync; + document.getElementById("nosync").hidden = hasSync; +} + +function quit() { + gParams.SetInt(1, Ci.nsIToolkitProfileService.quit); +} + +function createProfile() { + gParams.SetInt(1, Ci.nsIToolkitProfileService.createNewProfile); + window.close(); +} diff --git a/toolkit/profile/content/profileDowngrade.xul b/toolkit/profile/content/profileDowngrade.xul new file mode 100644 index 000000000000..4189fd6894c9 --- /dev/null +++ b/toolkit/profile/content/profileDowngrade.xul @@ -0,0 +1,39 @@ + + + + + + + +%brandDTD; + +%syncBrandDTD; + +%profileDTD; +]> + + + +