Skip to content
Snippets Groups Projects
Verified Commit 8f61c9c0 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern:
Browse files

Bug 41629: Fix errors with MOZ_SERVICES_SYNC=False

MOZ_SERVICES_SYNC should have been removed in Moz Bug 1227361.
However, it is still available, so we would like to use it.
Since it is a configuration that Mozilla does not test, and using it
results in a build error and in a few runtime errors, too.
This commit fixes them.

We have an upstream bug, too, but its (proposed) fix does not apply to
ESR 102 because of ESMification.
Should it not be accepted, we could replace this commit with the
poposed fix.
Upstream: https://bugzilla.mozilla.org/show_bug.cgi?id=1816969
parent 9ac0abfd
Branches
Tags
1 merge request!560Bug 41629: Fix errors with MOZ_SERVICES_SYNC=False
......@@ -5,7 +5,11 @@
// This file is loaded into the browser window scope.
/* eslint-env mozilla/browser-window */
const { UIState } = ChromeUtils.import("resource://services-sync/UIState.jsm");
ChromeUtils.defineModuleGetter(
this,
"UIState",
"resource://services-sync/UIState.jsm"
);
ChromeUtils.defineModuleGetter(
this,
......@@ -342,7 +346,9 @@ var gSync = {
// once syncing completes (bug 1239042).
_syncStartTime: 0,
_syncAnimationTimer: 0,
_obs: ["weave:engine:sync:finish", "quit-application", UIState.ON_UPDATE],
_obs: AppConstants.MOZ_SERVICES_SYNC
? ["weave:engine:sync:finish", "quit-application", UIState.ON_UPDATE]
: [],
get log() {
if (!this._log) {
......@@ -458,7 +464,7 @@ var gSync = {
this._definePrefGetters();
if (!this.FXA_ENABLED) {
if (!AppConstants.MOZ_SERVICES_SYNC || !this.FXA_ENABLED) {
this.onFxaDisabled();
return;
}
......@@ -1529,7 +1535,7 @@ var gSync = {
// can lead to a empty label for 'Send To Device' Menu.
this.init();
if (!this.FXA_ENABLED) {
if (!AppConstants.MOZ_SERVICES_SYNC || !this.FXA_ENABLED) {
// These items are hidden in onFxaDisabled(). No need to do anything.
return;
}
......@@ -1564,7 +1570,7 @@ var gSync = {
// "Send Page to Device" and "Send Link to Device" menu items
updateContentContextMenu(contextMenu) {
if (!this.FXA_ENABLED) {
if (!AppConstants.MOZ_SERVICES_SYNC || !this.FXA_ENABLED) {
// These items are hidden by default. No need to do anything.
return false;
}
......
......
......@@ -791,10 +791,10 @@ if (AppConstants.TOR_BROWSER_UPDATE) {
};
}
XPCOMUtils.defineLazyGetter(
this,
"WeaveService",
() => Cc["@mozilla.org/weave/service;1"].getService().wrappedJSObject
XPCOMUtils.defineLazyGetter(this, "WeaveService", () =>
AppConstants.MOZ_SERVICES_SYNC
? Cc["@mozilla.org/weave/service;1"].getService().wrappedJSObject
: null
);
if (AppConstants.MOZ_CRASHREPORTER) {
......@@ -2795,7 +2795,7 @@ BrowserGlue.prototype = {
// Schedule a sync (if enabled) after we've loaded
{
task: async () => {
if (WeaveService.enabled) {
if (WeaveService?.enabled) {
await WeaveService.whenLoaded();
WeaveService.Weave.Service.scheduler.autoConnect();
}
......
......
......@@ -181,7 +181,17 @@
@RESPATH@/browser/components/MacTouchBar.manifest
@RESPATH@/browser/components/MacTouchBar.js
#endif
; TODO: Remove this in ESR-115.
; If everything goes well, this patch will not be necessary in 115, because we
; have also an upstream bug.
; I suspect this is somehow incorrect, and that MOZ_SERVICES_SYNC is actually
; never defined for the makefile (it is not for Firefox 112, which builds
; correctly with MOZ_SERVICES_SYNC == False, even without this ifdef).
; But we are interested in disabling it, so using either this, or #if 0 would be
; fine for us.
#ifdef MOZ_SERVICES_SYNC
@RESPATH@/components/SyncComponents.manifest
#endif
@RESPATH@/components/servicesComponents.manifest
@RESPATH@/components/servicesSettings.manifest
@RESPATH@/components/cryptoComponents.manifest
......
......
......@@ -293,6 +293,7 @@ for var in (
for var in (
"MOZ_ALLOW_ADDON_SIDELOAD",
"MOZ_BACKGROUNDTASKS",
"MOZ_SERVICES_SYNC",
"MOZ_SYSTEM_NSS",
"MOZ_SYSTEM_POLICIES",
"MOZ_UNSIGNED_APP_SCOPE",
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment