Bug 1525889 - make sure profileDowngrade doesn't break when sync is not enabled for an application. r=mossop

This commit is contained in:
Magnus Melin 2019-02-11 23:04:09 +02:00
parent febdd49738
commit 1584297cc4
3 changed files with 18 additions and 3 deletions

View File

@ -67,6 +67,13 @@ this.AppConstants = Object.freeze({
false,
#endif
MOZ_SERVICES_SYNC:
#ifdef MOZ_SERVICES_SYNC
true,
#else
false,
#endif
MOZ_SERVICES_HEALTHREPORT:
#ifdef MOZ_SERVICES_HEALTHREPORT
true,

View File

@ -4,6 +4,8 @@
let gParams;
const { AppConstants } = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
function init() {
/*
* The C++ code passes a dialog param block using its integers as in and out
@ -13,10 +15,12 @@ function init() {
* 1: A return argument, one of nsIToolkitProfileService.downgradeUIChoice.
*/
gParams = window.arguments[0].QueryInterface(Ci.nsIDialogParamBlock);
let hasSync = gParams.GetInt(0) & Ci.nsIToolkitProfileService.hasSync;
if (AppConstants.MOZ_SERVICES_SYNC) {
let hasSync = gParams.GetInt(0) & Ci.nsIToolkitProfileService.hasSync;
document.getElementById("sync").hidden = !hasSync;
document.getElementById("nosync").hidden = hasSync;
document.getElementById("sync").hidden = !hasSync;
document.getElementById("nosync").hidden = hasSync;
}
}
function quit() {

View File

@ -9,8 +9,10 @@
<!DOCTYPE dialog [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
%brandDTD;
#ifdef MOZ_SERVICES_SYNC
<!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd">
%syncBrandDTD;
#endif
<!ENTITY % profileDTD SYSTEM "chrome://mozapps/locale/profile/profileDowngrade.dtd">
%profileDTD;
]>
@ -32,7 +34,9 @@
<image id="info" role="presentation"/>
<vbox flex="1">
<description id="nosync">&window.nosync;</description>
#ifdef MOZ_SERVICES_SYNC
<description id="sync">&window.sync;</description>
#endif
</vbox>
</hbox>