Bug 1091307 - Add a configure flag to prevent shipping Mozilla's RIL and Geolocation provider r=hsinyi

This commit is contained in:
Fabrice Desré 2015-02-26 13:51:20 -08:00
parent 0c1910289b
commit 26484e0481
15 changed files with 114 additions and 41 deletions

View File

@ -462,23 +462,28 @@
@BINPATH@/components/CellBroadcastService.manifest
@BINPATH@/components/MmsService.js
@BINPATH@/components/MmsService.manifest
@BINPATH@/components/MobileConnectionService.js
@BINPATH@/components/MobileConnectionService.manifest
@BINPATH@/components/MobileMessageDatabaseService.js
@BINPATH@/components/MobileMessageDatabaseService.manifest
#ifndef DISABLE_MOZ_RIL_GEOLOC
@BINPATH@/components/MobileConnectionService.js
@BINPATH@/components/MobileConnectionService.manifest
@BINPATH@/components/RadioInterfaceLayer.js
@BINPATH@/components/RadioInterfaceLayer.manifest
@BINPATH@/components/RILContentHelper.js
@BINPATH@/components/RILSystemMessengerHelper.js
@BINPATH@/components/RILSystemMessengerHelper.manifest
@BINPATH@/components/SmsService.js
@BINPATH@/components/SmsService.manifest
#endif
@BINPATH@/components/RILContentHelper.js
@BINPATH@/components/RILContentHelper.manifest
@BINPATH@/components/RILSystemMessengerHelper.js
@BINPATH@/components/RILSystemMessengerHelper.manifest
@BINPATH@/components/TelephonyAudioService.js
@BINPATH@/components/TelephonyAudioService.manifest
#ifndef DISABLE_MOZ_RIL_GEOLOC
@BINPATH@/components/TelephonyService.js
@BINPATH@/components/TelephonyService.manifest
@BINPATH@/components/VoicemailService.js
@BINPATH@/components/VoicemailService.manifest
#endif
#endif // MOZ_WIDGET_GONK && MOZ_B2G_RIL
#ifndef MOZ_WIDGET_GONK

View File

@ -7654,6 +7654,18 @@ MOZ_ARG_WITH_STRING(jitreport-granularity,
AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
dnl ========================================================
dnl = Disable Mozilla's versions of RIL and Geolocation
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(mozril-geoloc,
[ --disable-mozril-geoloc Disable Mozilla's RIL and geolocation],
DISABLE_MOZ_RIL_GEOLOC=1,
DISABLE_MOZ_RIL_GEOLOC= )
if test -n "$DISABLE_MOZ_RIL_GEOLOC"; then
AC_DEFINE(DISABLE_MOZ_RIL_GEOLOC)
fi
AC_SUBST(DISABLE_MOZ_RIL_GEOLOC)
dnl ========================================================
dnl =
dnl = Misc. Options

View File

@ -28,9 +28,13 @@ XPCOMUtils.defineLazyServiceGetter(this, "gSettingsService",
"@mozilla.org/settingsService;1",
"nsISettingsService");
XPCOMUtils.defineLazyServiceGetter(this, "gRadioInterfaceLayer",
"@mozilla.org/ril;1",
"nsIRadioInterfaceLayer");
XPCOMUtils.defineLazyGetter(this, "gRadioInterfaceLayer", function() {
let ril = { numRadioInterfaces: 0 };
try {
ril = Cc["@mozilla.org/ril;1"].getService(Ci.nsIRadioInterfaceLayer);
} catch(e) {}
return ril;
});
const GONK_CELLBROADCAST_SERVICE_CONTRACTID =
"@mozilla.org/cellbroadcast/gonkservice;1";

View File

@ -18,7 +18,7 @@ UNIFIED_SOURCES += [
'ipc/CellBroadcastParent.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_RIL']:
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_RIL'] and not CONFIG['DISABLE_MOZ_RIL_GEOLOC']:
EXTRA_COMPONENTS += [
'gonk/CellBroadcastService.js',
'gonk/CellBroadcastService.manifest',

View File

@ -56,9 +56,13 @@ XPCOMUtils.defineLazyServiceGetter(this, "gNetworkManager",
"@mozilla.org/network/manager;1",
"nsINetworkManager");
XPCOMUtils.defineLazyServiceGetter(this, "gRadioInterfaceLayer",
"@mozilla.org/ril;1",
"nsIRadioInterfaceLayer");
XPCOMUtils.defineLazyGetter(this, "gRadioInterfaceLayer", function() {
let ril = { numRadioInterfaces: 0 };
try {
ril = Cc["@mozilla.org/ril;1"].getService(Ci.nsIRadioInterfaceLayer);
} catch(e) {}
return ril;
});
let DEBUG = RIL.DEBUG_RIL;
function debug(s) {

View File

@ -62,10 +62,11 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_RIL']:
'gonk/nsIGonkMobileConnectionService.idl',
'gonk/nsIMobileConnectionMessenger.idl',
]
EXTRA_COMPONENTS += [
'gonk/MobileConnectionService.js',
'gonk/MobileConnectionService.manifest',
]
if not CONFIG['DISABLE_MOZ_RIL_GEOLOC']:
EXTRA_COMPONENTS += [
'gonk/MobileConnectionService.js',
'gonk/MobileConnectionService.manifest',
]
LOCAL_INCLUDES += [
'/dom/system/gonk',

View File

@ -40,7 +40,10 @@ const DOM_MOBILE_MESSAGE_DELIVERY_ERROR = "error";
const SMS_HANDLED_WAKELOCK_TIMEOUT = 5000;
XPCOMUtils.defineLazyGetter(this, "gRadioInterfaces", function() {
let ril = Cc["@mozilla.org/ril;1"].getService(Ci.nsIRadioInterfaceLayer);
let ril = { numRadioInterfaces: 0 };
try {
ril = Cc["@mozilla.org/ril;1"].getService(Ci.nsIRadioInterfaceLayer);
} catch(e) {}
let interfaces = [];
for (let i = 0; i < ril.numRadioInterfaces; i++) {

View File

@ -35,9 +35,12 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_RIL']:
'gonk/MmsService.manifest',
'gonk/MobileMessageDatabaseService.js',
'gonk/MobileMessageDatabaseService.manifest',
'gonk/SmsService.js',
'gonk/SmsService.manifest',
]
if not CONFIG['DISABLE_MOZ_RIL_GEOLOC']:
EXTRA_COMPONENTS += [
'gonk/SmsService.js',
'gonk/SmsService.manifest',
]
EXPORTS.mozilla.dom += [
'DOMMobileMessageError.h',

View File

@ -205,7 +205,7 @@ SettingsServiceLock.prototype = {
try {
aCallback && aCallback.handle ? aCallback.handle(aName, aValue) : null;
} catch (e) {
if (DEBUG) debug("settings 'handle' callback threw an exception, dropping: " + e + "\n");
if (DEBUG) debug("settings 'handle' for " + aName + " callback threw an exception, dropping: " + e + "\n");
}
},

View File

@ -73,8 +73,11 @@ XPCOMUtils.defineLazyGetter(this, "gNumRadioInterfaces", function() {
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
if (isParentProcess) {
let ril = Cc["@mozilla.org/ril;1"].getService(Ci.nsIRadioInterfaceLayer);
return ril.numRadioInterfaces;
let ril = { numRadioInterfaces: 0 };
try {
ril = Cc["@mozilla.org/ril;1"].getService(Ci.nsIRadioInterfaceLayer);
} catch(e) {}
return ril.numRadioInterfaces
}
return Services.prefs.getIntPref(kPrefRilNumRadioInterfaces);

View File

@ -0,0 +1,18 @@
# Copyright 2012 Mozilla Foundation and Mozilla contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# RILContentHelper.js
component {472816e1-1fd6-4405-996c-806f9ea68174} RILContentHelper.js
contract @mozilla.org/ril/content-helper;1 {472816e1-1fd6-4405-996c-806f9ea68174}
category profile-after-change RILContentHelper @mozilla.org/ril/content-helper;1

View File

@ -16,8 +16,3 @@
component {2d831c8d-6017-435b-a80c-e5d422810cea} RadioInterfaceLayer.js
contract @mozilla.org/ril;1 {2d831c8d-6017-435b-a80c-e5d422810cea}
category profile-after-change RadioInterfaceLayer @mozilla.org/ril;1
# RILContentHelper.js
component {472816e1-1fd6-4405-996c-806f9ea68174} RILContentHelper.js
contract @mozilla.org/ril/content-helper;1 {472816e1-1fd6-4405-996c-806f9ea68174}
category profile-after-change RILContentHelper @mozilla.org/ril/content-helper;1

View File

@ -88,9 +88,8 @@ if CONFIG['MOZ_B2G_RIL']:
'nsIRadioInterfaceLayer.idl',
]
EXTRA_COMPONENTS += [
'RadioInterfaceLayer.js',
'RadioInterfaceLayer.manifest',
'RILContentHelper.js',
'RILContentHelper.manifest',
'RILSystemMessengerHelper.js',
'RILSystemMessengerHelper.manifest',
]
@ -100,6 +99,11 @@ if CONFIG['MOZ_B2G_RIL']:
'ril_worker_buf_object.js',
'RILSystemMessenger.jsm',
]
if not CONFIG['DISABLE_MOZ_RIL_GEOLOC']:
EXTRA_COMPONENTS += [
'RadioInterfaceLayer.js',
'RadioInterfaceLayer.manifest',
]
FAIL_ON_WARNINGS = True

View File

@ -58,9 +58,13 @@ function debug(s) {
dump("TelephonyService: " + s + "\n");
}
XPCOMUtils.defineLazyServiceGetter(this, "gRadioInterfaceLayer",
"@mozilla.org/ril;1",
"nsIRadioInterfaceLayer");
XPCOMUtils.defineLazyGetter(this, "gRadioInterfaceLayer", function() {
let ril = { numRadioInterfaces: 0 };
try {
ril = Cc["@mozilla.org/ril;1"].getService(Ci.nsIRadioInterfaceLayer);
} catch(e) {}
return ril;
});
XPCOMUtils.defineLazyServiceGetter(this, "gPowerManagerService",
"@mozilla.org/power/powermanagerservice;1",

View File

@ -333,9 +333,11 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsHapticFeedback)
#endif
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ThirdPartyUtil, Init)
#ifndef DISABLE_MOZ_RIL_GEOLOC
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsICellBroadcastService,
NS_CreateCellBroadcastService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsISmsService, NS_CreateSmsService)
#endif
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMmsService, NS_CreateMmsService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMobileMessageService,
NS_CreateMobileMessageService)
@ -357,8 +359,10 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(GamepadServiceTest,
#endif
#ifdef MOZ_WIDGET_GONK
#ifndef DISABLE_MOZ_RIL_GEOLOC
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIGeolocationProvider,
GonkGPSGeolocationProvider::GetSingleton)
#endif
// Since the nsVolumeService constructor calls into nsIPowerManagerService,
// we need it to be constructed sometime after nsIPowerManagerService.
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsVolumeService,
@ -366,12 +370,14 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsVolumeService,
#endif
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMediaManagerService,
MediaManager::GetInstance)
#ifndef DISABLE_MOZ_RIL_GEOLOC
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMobileConnectionService,
NS_CreateMobileConnectionService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITelephonyService,
NS_CreateTelephonyService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIVoicemailService,
NS_CreateVoicemailService)
#endif
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(FakeTVService,
TVServiceFactory::CreateFakeTVService)
NS_GENERIC_FACTORY_CONSTRUCTOR(TVTunerData)
@ -782,8 +788,16 @@ NS_DEFINE_NAMED_CID(NS_DEVICE_SENSORS_CID);
NS_DEFINE_NAMED_CID(NS_HAPTICFEEDBACK_CID);
#endif
#endif
#ifndef DISABLE_MOZ_RIL_GEOLOC
NS_DEFINE_NAMED_CID(CELLBROADCAST_SERVICE_CID);
#ifdef MOZ_WIDGET_GONK
NS_DEFINE_NAMED_CID(GONK_GPS_GEOLOCATION_PROVIDER_CID);
#endif
NS_DEFINE_NAMED_CID(TELEPHONY_SERVICE_CID);
NS_DEFINE_NAMED_CID(NS_VOICEMAIL_SERVICE_CID);
NS_DEFINE_NAMED_CID(NS_MOBILE_CONNECTION_SERVICE_CID);
NS_DEFINE_NAMED_CID(SMS_SERVICE_CID);
#endif
NS_DEFINE_NAMED_CID(MMS_SERVICE_CID);
NS_DEFINE_NAMED_CID(MOBILE_MESSAGE_SERVICE_CID);
NS_DEFINE_NAMED_CID(MOBILE_MESSAGE_DATABASE_SERVICE_CID);
@ -796,9 +810,6 @@ NS_DEFINE_NAMED_CID(TCPSERVERSOCKETCHILD_CID);
NS_DEFINE_NAMED_CID(UDPSOCKETCHILD_CID);
NS_DEFINE_NAMED_CID(NS_TIMESERVICE_CID);
NS_DEFINE_NAMED_CID(NS_MEDIASTREAMCONTROLLERSERVICE_CID);
#ifdef MOZ_WIDGET_GONK
NS_DEFINE_NAMED_CID(GONK_GPS_GEOLOCATION_PROVIDER_CID);
#endif
NS_DEFINE_NAMED_CID(NS_MEDIAMANAGERSERVICE_CID);
#ifdef MOZ_GAMEPAD
NS_DEFINE_NAMED_CID(NS_GAMEPAD_TEST_CID);
@ -811,8 +822,6 @@ NS_DEFINE_NAMED_CID(NS_SYNTHVOICEREGISTRY_CID);
#ifdef ACCESSIBILITY
NS_DEFINE_NAMED_CID(NS_ACCESSIBILITY_SERVICE_CID);
#endif
NS_DEFINE_NAMED_CID(TELEPHONY_SERVICE_CID);
NS_DEFINE_NAMED_CID(NS_VOICEMAIL_SERVICE_CID);
NS_DEFINE_NAMED_CID(FAKE_TV_SERVICE_CID);
NS_DEFINE_NAMED_CID(TV_TUNER_DATA_CID);
NS_DEFINE_NAMED_CID(TV_CHANNEL_DATA_CID);
@ -820,8 +829,6 @@ NS_DEFINE_NAMED_CID(TV_PROGRAM_DATA_CID);
NS_DEFINE_NAMED_CID(GECKO_MEDIA_PLUGIN_SERVICE_CID);
NS_DEFINE_NAMED_CID(NS_MOBILE_CONNECTION_SERVICE_CID);
NS_DEFINE_NAMED_CID(PRESENTATION_DEVICE_MANAGER_CID);
NS_DEFINE_NAMED_CID(TEXT_INPUT_PROCESSOR_CID);
@ -1081,8 +1088,10 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
#endif
{ &kTHIRDPARTYUTIL_CID, false, nullptr, ThirdPartyUtilConstructor },
{ &kNS_STRUCTUREDCLONECONTAINER_CID, false, nullptr, nsStructuredCloneContainerConstructor },
#ifndef DISABLE_MOZ_RIL_GEOLOC
{ &kCELLBROADCAST_SERVICE_CID, false, nullptr, nsICellBroadcastServiceConstructor },
{ &kSMS_SERVICE_CID, false, nullptr, nsISmsServiceConstructor },
#endif
{ &kMMS_SERVICE_CID, false, nullptr, nsIMmsServiceConstructor },
{ &kMOBILE_MESSAGE_SERVICE_CID, false, nullptr, nsIMobileMessageServiceConstructor },
{ &kMOBILE_MESSAGE_DATABASE_SERVICE_CID, false, nullptr, nsIMobileMessageDatabaseServiceConstructor },
@ -1096,7 +1105,7 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
{ &kGECKO_MEDIA_PLUGIN_SERVICE_CID, true, nullptr, GeckoMediaPluginServiceConstructor },
{ &kNS_TIMESERVICE_CID, false, nullptr, nsITimeServiceConstructor },
{ &kNS_MEDIASTREAMCONTROLLERSERVICE_CID, false, nullptr, nsIStreamingProtocolControllerServiceConstructor },
#ifdef MOZ_WIDGET_GONK
#if defined(MOZ_WIDGET_GONK) && !defined(DISABLE_MOZ_RIL_GEOLOC)
{ &kGONK_GPS_GEOLOCATION_PROVIDER_CID, false, nullptr, nsIGeolocationProviderConstructor },
#endif
{ &kNS_MEDIAMANAGERSERVICE_CID, false, nullptr, nsIMediaManagerServiceConstructor },
@ -1106,9 +1115,11 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
#ifdef ACCESSIBILITY
{ &kNS_ACCESSIBILITY_SERVICE_CID, false, nullptr, CreateA11yService },
#endif
#ifndef DISABLE_MOZ_RIL_GEOLOC
{ &kTELEPHONY_SERVICE_CID, false, nullptr, nsITelephonyServiceConstructor },
{ &kNS_MOBILE_CONNECTION_SERVICE_CID, false, NULL, nsIMobileConnectionServiceConstructor },
{ &kNS_VOICEMAIL_SERVICE_CID, false, nullptr, nsIVoicemailServiceConstructor },
#endif
{ &kFAKE_TV_SERVICE_CID, false, nullptr, FakeTVServiceConstructor },
{ &kTV_TUNER_DATA_CID, false, nullptr, TVTunerDataConstructor },
{ &kTV_CHANNEL_DATA_CID, false, nullptr, TVChannelDataConstructor },
@ -1240,8 +1251,10 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
#endif
{ THIRDPARTYUTIL_CONTRACTID, &kTHIRDPARTYUTIL_CID },
{ NS_STRUCTUREDCLONECONTAINER_CONTRACTID, &kNS_STRUCTUREDCLONECONTAINER_CID },
#ifndef DISABLE_MOZ_RIL_GEOLOC
{ CELLBROADCAST_SERVICE_CONTRACTID, &kCELLBROADCAST_SERVICE_CID },
{ SMS_SERVICE_CONTRACTID, &kSMS_SERVICE_CID },
#endif
{ MMS_SERVICE_CONTRACTID, &kMMS_SERVICE_CID },
{ MOBILE_MESSAGE_SERVICE_CONTRACTID, &kMOBILE_MESSAGE_SERVICE_CID },
{ MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID, &kMOBILE_MESSAGE_DATABASE_SERVICE_CID },
@ -1254,7 +1267,7 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
{ "@mozilla.org/udp-socket-child;1", &kUDPSOCKETCHILD_CID },
{ TIMESERVICE_CONTRACTID, &kNS_TIMESERVICE_CID },
{ MEDIASTREAMCONTROLLERSERVICE_CONTRACTID, &kNS_MEDIASTREAMCONTROLLERSERVICE_CID },
#ifdef MOZ_WIDGET_GONK
#if defined(MOZ_WIDGET_GONK) && !defined(DISABLE_MOZ_RIL_GEOLOC)
{ GONK_GPS_GEOLOCATION_PROVIDER_CONTRACTID, &kGONK_GPS_GEOLOCATION_PROVIDER_CID },
#endif
#ifdef MOZ_GAMEPAD
@ -1265,14 +1278,18 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
{ "@mozilla.org/accessibilityService;1", &kNS_ACCESSIBILITY_SERVICE_CID },
{ "@mozilla.org/accessibleRetrieval;1", &kNS_ACCESSIBILITY_SERVICE_CID },
#endif
#ifndef DISABLE_MOZ_RIL_GEOLOC
{ TELEPHONY_SERVICE_CONTRACTID, &kTELEPHONY_SERVICE_CID },
#endif
{ FAKE_TV_SERVICE_CONTRACTID, &kFAKE_TV_SERVICE_CID },
{ TV_TUNER_DATA_CONTRACTID, &kTV_TUNER_DATA_CID },
{ TV_CHANNEL_DATA_CONTRACTID, &kTV_CHANNEL_DATA_CID },
{ TV_PROGRAM_DATA_CONTRACTID, &kTV_PROGRAM_DATA_CID },
{ "@mozilla.org/gecko-media-plugin-service;1", &kGECKO_MEDIA_PLUGIN_SERVICE_CID },
#ifndef DISABLE_MOZ_RIL_GEOLOC
{ NS_MOBILE_CONNECTION_SERVICE_CONTRACTID, &kNS_MOBILE_CONNECTION_SERVICE_CID },
{ NS_VOICEMAIL_SERVICE_CONTRACTID, &kNS_VOICEMAIL_SERVICE_CID },
#endif
{ PRESENTATION_DEVICE_MANAGER_CONTRACTID, &kPRESENTATION_DEVICE_MANAGER_CID },
{ "@mozilla.org/text-input-processor;1", &kTEXT_INPUT_PROCESSOR_CID },
{ nullptr }