Bug 1572844 - Consistently check for MOZ_BITS_DOWNLOAD. r=bytesized
authorAdam Gashlin <agashlin@mozilla.com>
Mon, 26 Aug 2019 23:38:50 +0000
changeset 553751 7ce6426b7653e89258f3bfd74903e9b97390399c
parent 553750 7e382148d47f8f09f5395c014bb621e8f55cc0a1
child 553752 7395aa7395272714890d0510247743ca19fcbcc6
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbytesized
bugs1572844
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1572844 - Consistently check for MOZ_BITS_DOWNLOAD. r=bytesized BITS download can be disabled on Windows. This patch checks for the config/define MOZ_BITS_DOWNLOAD when including the C++ parts of the service, exposing the service in JS, setting the pref, and including BITS-specific tests. For consistency and simplicity it also removes the Windows checks; the configure system won't allow MOZ_BITS_DOWNLOAD if not on Windows. Differential Revision: https://phabricator.services.mozilla.com/D43493
browser/app/profile/firefox.js
toolkit/components/bitsdownload/Bits.jsm
toolkit/components/bitsdownload/components.conf
toolkit/components/bitsdownload/moz.build
toolkit/mozapps/update/tests/moz.build
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -158,17 +158,17 @@ pref("app.update.url", "https://aus5.moz
 // app.update.interval is in branding section
 // app.update.promptWaitTime is in branding section
 
 // Whether or not to attempt using the service for updates.
 #ifdef MOZ_MAINTENANCE_SERVICE
   pref("app.update.service.enabled", true);
 #endif
 
-#ifdef XP_WIN
+#ifdef MOZ_BITS_DOWNLOAD
   // If set to true, the Update Service will attempt to use Windows BITS to
   // download updates and will fallback to downloading internally if that fails.
   pref("app.update.BITS.enabled", true);
 #endif
 
 // Symmetric (can be overridden by individual extensions) update preferences.
 // e.g.
 //  extensions.{GUID}.update.enabled
--- a/toolkit/components/bitsdownload/Bits.jsm
+++ b/toolkit/components/bitsdownload/Bits.jsm
@@ -22,17 +22,17 @@ const { AppConstants } = ChromeUtils.imp
 const { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 
 // This conditional prevents errors if this file is imported from operating
 // systems other than Windows. This is purely for convenient importing, because
 // attempting to use anything in this file on platforms other than Windows will
 // result in an error.
-if (AppConstants.platform == "win") {
+if (AppConstants.MOZ_BITS_DOWNLOAD) {
   XPCOMUtils.defineLazyServiceGetter(
     this,
     "gBits",
     "@mozilla.org/bits;1",
     "nsIBits"
   );
 }
 
--- a/toolkit/components/bitsdownload/components.conf
+++ b/toolkit/components/bitsdownload/components.conf
@@ -1,16 +1,16 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 Classes = []
-if buildconfig.substs['OS_ARCH'] == 'WINNT' and defined('MOZ_BITS_DOWNLOAD'):
+if defined('MOZ_BITS_DOWNLOAD'):
     Classes += [
         {
             'cid': '{495d6f3d-9748-4d30-8ce5-0290c0001edf}',
             'contract_ids': ['@mozilla.org/bits;1'],
             'singleton': True,
             'constructor': 'GetBitsService',
             'headers': ['Bits.h'],
         },
--- a/toolkit/components/bitsdownload/moz.build
+++ b/toolkit/components/bitsdownload/moz.build
@@ -9,17 +9,17 @@ XPIDL_MODULE = 'Bits'
 XPIDL_SOURCES += [
     'nsIBits.idl',
 ]
 
 XPCOM_MANIFESTS += [
     'components.conf',
 ]
 
-if CONFIG['OS_ARCH'] == 'WINNT':
+if CONFIG['MOZ_BITS_DOWNLOAD']:
   EXPORTS += [
     'Bits.h'
   ]
   UNIFIED_SOURCES += [
     'Bits.cpp'
   ]
 
 EXTRA_JS_MODULES += [
--- a/toolkit/mozapps/update/tests/moz.build
+++ b/toolkit/mozapps/update/tests/moz.build
@@ -5,17 +5,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 HAS_MISC_RULE = True
 
 FINAL_TARGET = '_tests/xpcshell/toolkit/mozapps/update/tests/data'
 
 if not CONFIG['MOZ_SUITE']:
     BROWSER_CHROME_MANIFESTS += ['browser/browser.ini']
-    if CONFIG['OS_ARCH'] == 'WINNT':
+    if CONFIG['MOZ_BITS_DOWNLOAD']:
         BROWSER_CHROME_MANIFESTS += ['browser/browser.bits.ini']
 
 XPCSHELL_TESTS_MANIFESTS += [
     'unit_aus_update/xpcshell.ini',
     'unit_base_updater/xpcshell.ini'
 ]
 
 if CONFIG['MOZ_MAINTENANCE_SERVICE']: