Bug 1478124: Part 8a - Update toolkit module to use a static component manifest. r=froydnj

Differential Revision: https://phabricator.services.mozilla.com/D15039

--HG--
extra : rebase_source : 55c387662960d82986a2a0205d3b8e451304db4b
extra : absorb_source : bd201f3bcf08f70480f19a22bfb7a8bd9cb015a1
extra : histedit_source : ec13a9b248801ab36baa275e566765734e6f3717
This commit is contained in:
Kris Maglione 2018-12-16 16:03:00 -08:00
Родитель 38ac4b836c
Коммит d20f7f8e72
33 изменённых файлов: 305 добавлений и 479 удалений

Просмотреть файл

@ -12,10 +12,10 @@
#include "nsIPrincipal.h"
#include "nsISupportsPrimitives.h"
#include "nsIAppStartup.h"
#include "nsToolkitCompsCID.h"
#include "nsCOMPtr.h"
#include "nsContentUtils.h"
#include "xpcpublic.h"
#include "mozilla/Components.h"
namespace mozilla {
@ -65,8 +65,7 @@ WindowDestroyedEvent::Run() {
case Phase::Destroying: {
bool skipNukeCrossCompartment = false;
#ifndef DEBUG
nsCOMPtr<nsIAppStartup> appStartup =
do_GetService(NS_APPSTARTUP_CONTRACTID);
nsCOMPtr<nsIAppStartup> appStartup = components::AppStartup::Service();
if (appStartup) {
appStartup->GetShuttingDown(&skipNukeCrossCompartment);

Просмотреть файл

@ -149,10 +149,6 @@
#include "nsContentUtils.h"
#include "nsCSSProps.h"
#include "nsIURIFixup.h"
#ifndef DEBUG
# include "nsIAppStartup.h"
# include "nsToolkitCompsCID.h"
#endif
#include "nsCDefaultURIFixup.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventStateManager.h"

Просмотреть файл

@ -153,10 +153,6 @@
#include "nsCSSProps.h"
#include "nsIURIFixup.h"
#include "nsIURIMutator.h"
#ifndef DEBUG
# include "nsIAppStartup.h"
# include "nsToolkitCompsCID.h"
#endif
#include "nsCDefaultURIFixup.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventStateManager.h"

Просмотреть файл

@ -33,6 +33,7 @@
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Components.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/DataStorage.h"
#include "mozilla/devtools/HeapSnapshotTempFileHelperParent.h"
@ -179,7 +180,6 @@
#include "nsServiceManagerUtils.h"
#include "nsStyleSheetService.h"
#include "nsThreadUtils.h"
#include "nsToolkitCompsCID.h"
#include "nsWidgetsCID.h"
#include "PreallocatedProcessManager.h"
#include "ProcessPriorityManager.h"
@ -3794,8 +3794,7 @@ mozilla::ipc::IPCResult ContentParent::RecvShowAlert(
return IPC_OK();
}
nsCOMPtr<nsIAlertsService> sysAlerts(
do_GetService(NS_ALERTSERVICE_CONTRACTID));
nsCOMPtr<nsIAlertsService> sysAlerts(components::Alerts::Service());
if (sysAlerts) {
sysAlerts->ShowAlert(aAlert, this);
}
@ -3808,8 +3807,7 @@ mozilla::ipc::IPCResult ContentParent::RecvCloseAlert(
return IPC_OK();
}
nsCOMPtr<nsIAlertsService> sysAlerts(
do_GetService(NS_ALERTSERVICE_CONTRACTID));
nsCOMPtr<nsIAlertsService> sysAlerts(components::Alerts::Service());
if (sysAlerts) {
sysAlerts->CloseAlert(aName, aPrincipal);
}

Просмотреть файл

@ -6,6 +6,7 @@
#include "mozilla/dom/Notification.h"
#include "mozilla/Components.h"
#include "mozilla/Encoding.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/JSONWriter.h"
@ -55,7 +56,6 @@
#include "nsServiceManagerUtils.h"
#include "nsStructuredCloneContainer.h"
#include "nsThreadUtils.h"
#include "nsToolkitCompsCID.h"
#include "nsXULAppAPI.h"
namespace mozilla {
@ -653,8 +653,7 @@ void NotificationTelemetryService::RecordDNDSupported() {
return;
}
nsCOMPtr<nsIAlertsService> alertService =
do_GetService(NS_ALERTSERVICE_CONTRACTID);
nsCOMPtr<nsIAlertsService> alertService = components::Alerts::Service();
if (!alertService) {
return;
}
@ -1411,8 +1410,7 @@ void Notification::ShowInternal() {
NS_WARNING("Could not persist Notification");
}
nsCOMPtr<nsIAlertsService> alertService =
do_GetService(NS_ALERTSERVICE_CONTRACTID);
nsCOMPtr<nsIAlertsService> alertService = components::Alerts::Service();
ErrorResult result;
NotificationPermission permission = NotificationPermission::Denied;
@ -1952,8 +1950,7 @@ void Notification::CloseInternal() {
SetAlertName();
UnpersistNotification();
if (!mIsClosed) {
nsCOMPtr<nsIAlertsService> alertService =
do_GetService(NS_ALERTSERVICE_CONTRACTID);
nsCOMPtr<nsIAlertsService> alertService = components::Alerts::Service();
if (alertService) {
nsAutoString alertName;
GetAlertName(alertName);

Просмотреть файл

@ -6,6 +6,7 @@
#include "nsReadConfig.h"
#include "nsJSConfigTriggers.h"
#include "mozilla/Components.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsIAppStartup.h"
#include "nsContentUtils.h"
@ -18,13 +19,14 @@
#include "nsIPromptService.h"
#include "nsIServiceManager.h"
#include "nsIStringBundle.h"
#include "nsToolkitCompsCID.h"
#include "nsNetUtil.h"
#include "nsString.h"
#include "nsCRT.h"
#include "nspr.h"
#include "nsXULAppAPI.h"
using namespace mozilla;
extern bool sandboxEnabled;
extern mozilla::LazyLogModule MCD;
@ -101,7 +103,7 @@ NS_IMETHODIMP nsReadConfig::Observe(nsISupports *aSubject, const char *aTopic,
rv = DisplayError();
if (NS_FAILED(rv)) {
nsCOMPtr<nsIAppStartup> appStartup =
do_GetService(NS_APPSTARTUP_CONTRACTID);
components::AppStartup::Service();
if (appStartup) appStartup->Quit(nsIAppStartup::eAttemptQuit);
}
}

Просмотреть файл

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "Classifier.h"
#include "mozilla/Components.h"
#include "mozilla/ErrorNames.h"
#include "mozilla/net/AsyncUrlChannelClassifier.h"
#include "mozilla/net/UrlClassifierCommon.h"
@ -92,7 +93,7 @@ class URIData {
data->mURI = aURI;
nsCOMPtr<nsIUrlClassifierUtils> utilsService =
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID);
components::UrlClassifierUtils::Service();
if (NS_WARN_IF(!utilsService)) {
return NS_ERROR_FAILURE;
}

Просмотреть файл

@ -24,6 +24,7 @@
#include "nsIUrlClassifierFeature.h"
#include "nsPrintfCString.h"
#include "mozilla/Components.h"
#include "mozilla/ErrorNames.h"
#include "mozilla/Logging.h"
#include "mozilla/Preferences.h"
@ -369,7 +370,7 @@ nsresult nsChannelClassifier::SendThreatHitReport(nsIChannel* aChannel,
}
nsCOMPtr<nsIURIClassifier> uriClassifier =
do_GetService(NS_URLCLASSIFIERDBSERVICE_CONTRACTID);
components::UrlClassifierDB::Service();
if (!uriClassifier) {
return NS_ERROR_UNEXPECTED;
}

Просмотреть файл

@ -0,0 +1,207 @@
# -*- 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/.
IS_ANDROID = buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'android'
IS_WINDOWS = buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'windows'
MOZ_HAS_TERMINATOR = not IS_ANDROID
Classes = [
{
'name': 'AddonContentPolicy',
'cid': '{c26a8241-ecf4-4aed-9f3c-f1f5c713b9a5}',
'contract_ids': ['@mozilla.org/addons/content-policy;1'],
'type': 'AddonContentPolicy',
'headers': ['mozilla/AddonContentPolicy.h'],
'categories': {'content-policy': '@mozilla.org/addons/content-policy;1'},
},
{
'cid': '{17a59a6b-92b8-42e5-bce0-ab434c7a7135}',
'contract_ids': ['@mozilla.org/addons/addon-manager-startup;1'],
'singleton': True,
'type': 'mozilla::AddonManagerStartup',
'headers': ['mozilla/AddonManagerStartup.h'],
'constructor': 'mozilla::AddonManagerStartup::GetInstance',
},
{
'name': 'AlertNotification',
'cid': '{9a7b7a41-0b47-47f7-b61b-15a210d6f020}',
'contract_ids': ['@mozilla.org/alert-notification;1'],
'type': 'mozilla::AlertNotification',
'headers': ['mozilla/AlertNotification.h'],
},
{
'name': 'ApplicationReputation',
'cid': '{d21b4c33-716f-4117-8041-2770b59ff8a6}',
'contract_ids': ['@mozilla.org/reputationservice/application-reputation-service;1'],
'singleton': True,
'type': 'ApplicationReputationService',
'headers': ['/toolkit/components/reputationservice/ApplicationReputation.h'],
'constructor': 'ApplicationReputationService::GetSingleton',
},
{
'name': 'DownloadPlatform',
'cid': '{649a14c9-fe5c-48ec-9c85-00cad9ccf32e}',
'contract_ids': ['@mozilla.org/toolkit/download-platform;1'],
'type': 'DownloadPlatform',
'headers': ['/toolkit/components/downloads/DownloadPlatform.h'],
},
{
'name': 'ExtensionPolicy',
'cid': '{562de129-8338-482c-bb96-a1ff09ee53cc}',
'contract_ids': ['@mozilla.org/addons/policy-service;1'],
'singleton': True,
'type': 'mozilla::ExtensionPolicyService',
'headers': ['mozilla/ExtensionPolicyService.h'],
'constructor': 'mozilla::ExtensionPolicyService::GetInstance',
},
{
'cid': '{15686f9d-483e-4361-98cd-37f1e8f1e61d}',
'contract_ids': ['@mozilla.org/toolkit/finalizationwitness;1'],
'type': 'mozilla::FinalizationWitnessService',
'headers': ['mozilla/FinalizationWitnessService.h'],
'init_method': 'Init',
},
{
'name': 'LoginReputation',
'cid': '{91fa9e67-1427-4ee9-8ee0-1a6ed578bee1}',
'contract_ids': ['@mozilla.org/reputationservice/login-reputation-service;1'],
'singleton': True,
'type': 'mozilla::LoginReputationService',
'headers': ['/toolkit/components/reputationservice/LoginReputation.h'],
'constructor': 'mozilla::LoginReputationService::GetSingleton',
},
{
'name': 'NativeFileWatcher',
'cid': '{6f488507-469d-4350-a68d-99c807be0a78}',
'contract_ids': ['@mozilla.org/toolkit/filewatcher/native-file-watcher;1'],
'type': 'mozilla::NativeFileWatcherService',
'headers': ['NativeFileWatcherWin.h' if IS_WINDOWS else 'NativeFileWatcherNotSupported.h'],
'init_method': 'Init',
},
{
'cid': '{63a69303-8a64-45a9-848c-d4e2792794e6}',
'contract_ids': ['@mozilla.org/toolkit/osfile/native-internals;1'],
'type': 'mozilla::NativeOSFileInternalsService',
'headers': ['mozilla/NativeOSFileInternals.h'],
},
{
'name': 'Alerts',
'cid': '{a0ccaaf8-09da-44d8-b250-9ac3e93c8117}',
'contract_ids': ['@mozilla.org/alerts-service;1'],
'type': 'nsAlertsService',
'headers': ['/toolkit/components/alerts/nsAlertsService.h'],
'overridable': True,
},
{
'name': 'AppStartup',
'cid': '{7dd4d320-c84b-4624-8d45-7bb9b2356977}',
'contract_ids': ['@mozilla.org/toolkit/app-startup;1'],
'type': 'nsAppStartup',
'headers': ['/toolkit/components/startup/nsAppStartup.h'],
'init_method': 'Init',
},
{
'cid': '{6356aa16-7916-4215-a825-cbc2692ca87a}',
'contract_ids': ['@mozilla.org/appshell/component/browser-status-filter;1'],
'type': 'nsBrowserStatusFilter',
'headers': ['/toolkit/components/statusfilter/nsBrowserStatusFilter.h'],
},
{
'name': 'FindService',
'cid': '{5060b803-340e-11d5-be5b-b3e063ec6a3c}',
'contract_ids': ['@mozilla.org/find/find_service;1'],
'type': 'nsFindService',
'headers': ['/toolkit/components/find/nsFindService.h'],
},
{
'name': 'TypeAheadFind',
'cid': '{e7f70966-9a37-48d7-8aeb-35998f31090e}',
'contract_ids': ['@mozilla.org/typeaheadfind;1'],
'type': 'nsTypeAheadFind',
'headers': ['/toolkit/components/typeaheadfind/nsTypeAheadFind.h'],
},
{
'name': 'UrlClassifierDB',
'cid': '{7a258022-6765-11e5-b379-b37b1f2354be}',
'contract_ids': [
'@mozilla.org/uriclassifierservice',
'@mozilla.org/url-classifier/dbservice;1',
],
'type': 'nsISupports',
'legacy_constructor': 'nsUrlClassifierDBServiceConstructor',
'headers': ['/toolkit/components/build/nsToolkitCompsModule.h'],
},
{
'name': 'UrlClassifierPrefixSet',
'cid': '{3d8579f0-75fa-4e00-ba41-38661d5b5d17}',
'contract_ids': ['@mozilla.org/url-classifier/prefixset;1'],
'type': 'nsUrlClassifierPrefixSet',
'headers': ['nsUrlClassifierPrefixSet.h'],
},
{
'name': 'UrlClassifierStreamUpdater',
'cid': '{e1797597-f4d6-4dd3-a1e1-745ad352cd80}',
'contract_ids': ['@mozilla.org/url-classifier/streamupdater;1'],
'type': 'nsUrlClassifierStreamUpdater',
'headers': ['/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.h'],
},
{
'name': 'UrlClassifierUtils',
'cid': '{b7b2ccec-7912-4ea6-a548-b038447004bd}',
'contract_ids': ['@mozilla.org/url-classifier/utils;1'],
'type': 'nsUrlClassifierUtils',
'headers': ['/toolkit/components/url-classifier/nsUrlClassifierUtils.h'],
'init_method': 'Init',
},
{
'name': 'UserInfo',
'cid': '{14c13684-1dd2-11b2-9463-bb10ba742554}',
'contract_ids': ['@mozilla.org/userinfo;1'],
'type': 'nsUserInfo',
'headers': ['/toolkit/components/startup/nsUserInfo.h'],
},
]
if defined('MOZ_UPDATER') and not IS_ANDROID:
Classes += [
{
'cid': '{f3dcf644-79e8-4f59-a1bb-878454488ef9}',
'contract_ids': ['@mozilla.org/updates/update-processor;1'],
'type': 'nsUpdateProcessor',
'headers': ['/toolkit/xre/nsUpdateDriver.h'],
},
]
if not defined('MOZ_DISABLE_PARENTAL_CONTROLS'):
Classes += [
{
'cid': '{580530e5-118c-4bc7-ab88-bc2cd2b97223}',
'contract_ids': ['@mozilla.org/parental-controls-service;1'],
'type': 'nsParentalControlsService',
'headers': ['/toolkit/components/parentalcontrols/nsParentalControlsService.h'],
},
]
if MOZ_HAS_TERMINATOR:
Classes += [
{
'cid': '{2e59cc70-f83a-412f-89d4-453885837217}',
'contract_ids': ['@mozilla.org/toolkit/shutdown-terminator;1'],
'type': 'mozilla::nsTerminator',
'headers': ['nsTerminator.h'],
},
]
if defined('ENABLE_TESTS'):
Classes += [
{
'cid': '{aaa3f7f2-8ef0-41ec-8d03-aed667cf7fa2}',
'contract_ids': ['@mozilla.org/telemetry/geckoview-testing;1'],
'type': 'TelemetryGeckoViewTestingImpl',
'headers': ['/toolkit/components/telemetry/geckoview/TelemetryGeckoViewTesting.h'],
},
]

Просмотреть файл

@ -15,27 +15,15 @@ SOURCES += [
'nsToolkitCompsModule.cpp',
]
XPCOM_MANIFESTS += [
'components.conf',
]
FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [
'../../xre',
'../alerts',
'../downloads',
'../find',
'../perfmonitoring',
'../protobuf',
'../reputationservice',
'../startup',
'../statusfilter',
'../telemetry',
'../typeaheadfind',
'../url-classifier',
]
if not CONFIG['MOZ_DISABLE_PARENTAL_CONTROLS']:
LOCAL_INCLUDES += [
'../parentalcontrols',
]
if CONFIG['CC_TYPE'] == 'clang-cl':
AllowCompilerWarnings() # workaround for bug 1090497

Просмотреть файл

@ -2,8 +2,6 @@
* 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/. */
#define NS_ALERTSERVICE_CONTRACTID "@mozilla.org/alerts-service;1"
// This separate service uses the same nsIAlertsService interface,
// but instead sends a notification to a platform alerts API
// if available. Using a separate CID allows us to overwrite the XUL
@ -19,9 +17,6 @@
#define NS_AUTOCOMPLETEMDBRESULT_CONTRACTID \
"@mozilla.org/autocomplete/mdb-result;1"
#define NS_DOWNLOADPLATFORM_CONTRACTID \
"@mozilla.org/toolkit/download-platform;1"
#define NS_FORMHISTORY_CONTRACTID "@mozilla.org/satchel/form-history;1"
#define NS_FORMFILLCONTROLLER_CONTRACTID \
@ -30,22 +25,6 @@
#define NS_FORMHISTORYAUTOCOMPLETE_CONTRACTID \
"@mozilla.org/autocomplete/search;1?name=form-history"
#define NS_TYPEAHEADFIND_CONTRACTID "@mozilla.org/typeaheadfind;1"
#define NS_PARENTALCONTROLSSERVICE_CONTRACTID \
"@mozilla.org/parental-controls-service;1"
#define NS_URLCLASSIFIERPREFIXSET_CONTRACTID \
"@mozilla.org/url-classifier/prefixset;1"
#define NS_URLCLASSIFIERDBSERVICE_CONTRACTID \
"@mozilla.org/url-classifier/dbservice;1"
#define NS_URLCLASSIFIERSTREAMUPDATER_CONTRACTID \
"@mozilla.org/url-classifier/streamupdater;1"
#define NS_URLCLASSIFIERUTILS_CONTRACTID "@mozilla.org/url-classifier/utils;1"
#define NS_URLCLASSIFIERHASHCOMPLETER_CONTRACTID \
"@mozilla.org/url-classifier/hashcompleter;1"
@ -62,37 +41,8 @@
#define NS_FAVICONSERVICE_CONTRACTID "@mozilla.org/browser/favicon-service;1"
#define NS_APPSTARTUP_CONTRACTID "@mozilla.org/toolkit/app-startup;1"
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
# define NS_UPDATEPROCESSOR_CONTRACTID \
"@mozilla.org/updates/update-processor;1"
#endif
#define NS_ADDONCONTENTPOLICY_CONTRACTID "@mozilla.org/addons/content-policy;1"
#if defined(ENABLE_TESTS)
# define NS_TELEMETRYGECKOVIEWTESTING_CONTRACTID \
"@mozilla.org/telemetry/geckoview-testing;1"
#endif
/////////////////////////////////////////////////////////////////////////////
#define ALERT_NOTIFICATION_CID \
{ \
0x9a7b7a41, 0x0b47, 0x47f7, { \
0xb6, 0x1b, 0x15, 0xa2, 0x10, 0xd6, 0xf0, 0x20 \
} \
}
// {A0CCAAF8-09DA-44D8-B250-9AC3E93C8117}
#define NS_ALERTSSERVICE_CID \
{ \
0xa0ccaaf8, 0x9da, 0x44d8, { \
0xb2, 0x50, 0x9a, 0xc3, 0xe9, 0x3c, 0x81, 0x17 \
} \
}
// {84E11F80-CA55-11DD-AD8B-0800200C9A66}
#define NS_SYSTEMALERTSSERVICE_CID \
{ \
@ -125,13 +75,6 @@
} \
}
#define NS_DOWNLOADPLATFORM_CID \
{ \
0x649a14c9, 0xfe5c, 0x48ec, { \
0x9c, 0x85, 0x00, 0xca, 0xd9, 0xcc, 0xf3, 0x2e \
} \
}
// {895DB6C7-DBDF-40ea-9F64-B175033243DC}
#define NS_FORMFILLCONTROLLER_CID \
{ \
@ -148,30 +91,6 @@
} \
}
// {59648a91-5a60-4122-8ff2-54b839c84aed}
#define NS_PARENTALCONTROLSSERVICE_CID \
{ \
0x580530e5, 0x118c, 0x4bc7, { \
0xab, 0x88, 0xbc, 0x2c, 0xd2, 0xb9, 0x72, 0x23 \
} \
}
// {e7f70966-9a37-48d7-8aeb-35998f31090e}
#define NS_TYPEAHEADFIND_CID \
{ \
0xe7f70966, 0x9a37, 0x48d7, { \
0x8a, 0xeb, 0x35, 0x99, 0x8f, 0x31, 0x09, 0x0e \
} \
}
// {3d8579f0-75fa-4e00-ba41-38661d5b5d17}
#define NS_URLCLASSIFIERPREFIXSET_CID \
{ \
0x3d8579f0, 0x75fa, 0x4e00, { \
0xba, 0x41, 0x38, 0x66, 0x1d, 0x5b, 0x5d, 0x17 \
} \
}
// {7a258022-6765-11e5-b379-b37b1f2354be}
#define NS_URLCLASSIFIERDBSERVICE_CID \
{ \
@ -180,22 +99,6 @@
} \
}
// e1797597-f4d6-4dd3-a1e1-745ad352cd80
#define NS_URLCLASSIFIERSTREAMUPDATER_CID \
{ \
0xe1797597, 0xf4d6, 0x4dd3, { \
0xa1, 0xe1, 0x74, 0x5a, 0xd3, 0x52, 0xcd, 0x80 \
} \
}
// {b7b2ccec-7912-4ea6-a548-b038447004bd}
#define NS_URLCLASSIFIERUTILS_CID \
{ \
0xb7b2ccec, 0x7912, 0x4ea6, { \
0xa5, 0x48, 0xb0, 0x38, 0x44, 0x70, 0x04, 0xbd \
} \
}
#define NS_NAVHISTORYSERVICE_CID \
{ \
0x88cecbb7, 0x6c63, 0x4b3b, { \
@ -230,57 +133,3 @@
0xb6, 0x05, 0x60, 0xb0, 0x22, 0xa0, 0x07, 0x56 \
} \
}
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
# define NS_UPDATEPROCESSOR_CID \
{ \
0xf3dcf644, 0x79e8, 0x4f59, { \
0xa1, 0xbb, 0x87, 0x84, 0x54, 0x48, 0x8e, 0xf9 \
} \
}
#endif
#define NS_APPLICATION_REPUTATION_SERVICE_CONTRACTID \
"@mozilla.org/reputationservice/application-reputation-service;1"
#define NS_APPLICATION_REPUTATION_SERVICE_CID \
{ \
0xd21b4c33, 0x716f, 0x4117, { \
0x80, 0x41, 0x27, 0x70, 0xb5, 0x9f, 0xf8, 0xa6 \
} \
}
#define NS_LOGIN_REPUTATION_SERVICE_CONTRACTID \
"@mozilla.org/reputationservice/login-reputation-service;1"
#define NS_LOGIN_REPUTATION_SERVICE_CID \
{ \
0x91fa9e67, 0x1427, 0x4ee9, { \
0x8e, 0xe0, 0x1a, 0x6e, 0xd5, 0x78, 0xbe, 0xe1 \
} \
}
#define NS_ADDONCONTENTPOLICY_CID \
{ \
0xc26a8241, 0xecf4, 0x4aed, { \
0x9f, 0x3c, 0xf1, 0xf5, 0xc7, 0x13, 0xb9, 0xa5 \
} \
}
#define NS_ADDON_POLICY_SERVICE_CID \
{ \
0x562de129, 0x8338, 0x482c, { \
0xbb, 0x96, 0xa1, 0xff, 0x09, 0xee, 0x53, 0xcc \
} \
}
#define NS_ADDON_POLICY_SERVICE_CONTRACTID \
"@mozilla.org/addons/policy-service;1"
#if defined(ENABLE_TESTS)
# define NS_TELEMETRYGECKOVIEWTESTING_CID \
{0xaaa3f7f2, \
0x8ef0, \
0x41ec, \
{0x8d, 0x3, 0xae, 0xd6, 0x67, 0xcf, 0x7f, 0xa2}};
#endif

Просмотреть файл

@ -2,256 +2,36 @@
* 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/. */
#include "mozilla/ModuleUtils.h"
#include "nsAppStartup.h"
#include "nsNetCID.h"
#include "nsUserInfo.h"
#include "nsToolkitCompsCID.h"
#include "nsFindService.h"
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
# include "nsUpdateDriver.h"
#endif
#include "nsToolkitCompsModule.h"
#if !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
# include "nsParentalControlsService.h"
#endif
#include "mozilla/AlertNotification.h"
#include "nsAlertsService.h"
#include "DownloadPlatform.h"
#include "nsTypeAheadFind.h"
#include "ApplicationReputation.h"
#include "LoginReputation.h"
#include "nsUrlClassifierDBService.h"
#include "nsUrlClassifierStreamUpdater.h"
#include "nsUrlClassifierUtils.h"
#include "nsUrlClassifierPrefixSet.h"
#include "nsBrowserStatusFilter.h"
#include "mozilla/FinalizationWitnessService.h"
#include "mozilla/NativeOSFileInternals.h"
#include "mozilla/AddonContentPolicy.h"
#include "mozilla/AddonManagerStartup.h"
#include "mozilla/ExtensionPolicyService.h"
#include "nsISupports.h"
#if defined(XP_WIN)
# include "NativeFileWatcherWin.h"
#else
# include "NativeFileWatcherNotSupported.h"
NS_IMPL_ISUPPORTS(mozilla::NativeFileWatcherService,
nsINativeFileWatcherService);
#endif // (XP_WIN)
#if !defined(MOZ_WIDGET_ANDROID)
# define MOZ_HAS_TERMINATOR
#endif
#if defined(MOZ_HAS_TERMINATOR)
# include "nsTerminator.h"
#endif
#if defined(ENABLE_TESTS)
# include "geckoview/TelemetryGeckoViewTesting.h"
#endif
using namespace mozilla;
/////////////////////////////////////////////////////////////////////////////
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAppStartup, Init)
#if defined(MOZ_HAS_TERMINATOR)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTerminator)
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUserInfo)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFindService)
#if !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParentalControlsService)
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR(AlertNotification)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAlertsService)
NS_GENERIC_FACTORY_CONSTRUCTOR(DownloadPlatform)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTypeAheadFind)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(
ApplicationReputationService, ApplicationReputationService::GetSingleton)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(LoginReputationService,
LoginReputationService::GetSingleton)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUrlClassifierPrefixSet)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUrlClassifierStreamUpdater)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUrlClassifierUtils, Init)
static nsresult nsUrlClassifierDBServiceConstructor(nsISupports *aOuter,
REFNSIID aIID,
void **aResult) {
nsresult nsUrlClassifierDBServiceConstructor(nsISupports *aOuter,
const nsIID &aIID,
void **aResult) {
nsresult rv;
NS_ENSURE_ARG_POINTER(aResult);
NS_ENSURE_NO_AGGREGATION(aOuter);
nsUrlClassifierDBService *inst = nsUrlClassifierDBService::GetInstance(&rv);
if (nullptr == inst) {
RefPtr<nsUrlClassifierDBService> inst =
nsUrlClassifierDBService::GetInstance(&rv);
if (!inst) {
return rv;
}
/* NS_ADDREF(inst); */
rv = inst->QueryInterface(aIID, aResult);
NS_RELEASE(inst);
return rv;
return inst->QueryInterface(aIID, aResult);
}
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBrowserStatusFilter)
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUpdateProcessor)
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(FinalizationWitnessService, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(NativeOSFileInternalsService)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(NativeFileWatcherService, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(AddonContentPolicy)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(AddonManagerStartup,
AddonManagerStartup::GetInstance)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ExtensionPolicyService,
ExtensionPolicyService::GetInstance)
#if defined(ENABLE_TESTS)
NS_GENERIC_FACTORY_CONSTRUCTOR(TelemetryGeckoViewTestingImpl)
#endif
NS_DEFINE_NAMED_CID(NS_TOOLKIT_APPSTARTUP_CID);
#if defined(MOZ_HAS_TERMINATOR)
NS_DEFINE_NAMED_CID(NS_TOOLKIT_TERMINATOR_CID);
#endif
NS_DEFINE_NAMED_CID(NS_USERINFO_CID);
NS_DEFINE_NAMED_CID(ALERT_NOTIFICATION_CID);
NS_DEFINE_NAMED_CID(NS_ALERTSSERVICE_CID);
#if !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
NS_DEFINE_NAMED_CID(NS_PARENTALCONTROLSSERVICE_CID);
#endif
NS_DEFINE_NAMED_CID(NS_DOWNLOADPLATFORM_CID);
NS_DEFINE_NAMED_CID(NS_FIND_SERVICE_CID);
NS_DEFINE_NAMED_CID(NS_TYPEAHEADFIND_CID);
NS_DEFINE_NAMED_CID(NS_APPLICATION_REPUTATION_SERVICE_CID);
NS_DEFINE_NAMED_CID(NS_LOGIN_REPUTATION_SERVICE_CID);
NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERPREFIXSET_CID);
NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERDBSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERSTREAMUPDATER_CID);
NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERUTILS_CID);
NS_DEFINE_NAMED_CID(NS_BROWSERSTATUSFILTER_CID);
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
NS_DEFINE_NAMED_CID(NS_UPDATEPROCESSOR_CID);
#endif
NS_DEFINE_NAMED_CID(FINALIZATIONWITNESSSERVICE_CID);
NS_DEFINE_NAMED_CID(NATIVE_OSFILE_INTERNALS_SERVICE_CID);
NS_DEFINE_NAMED_CID(NS_ADDONCONTENTPOLICY_CID);
NS_DEFINE_NAMED_CID(NS_ADDON_MANAGER_STARTUP_CID);
NS_DEFINE_NAMED_CID(NS_ADDON_POLICY_SERVICE_CID);
NS_DEFINE_NAMED_CID(NATIVE_FILEWATCHER_SERVICE_CID);
#if defined(ENABLE_TESTS)
NS_DEFINE_NAMED_CID(NS_TELEMETRYGECKOVIEWTESTING_CID);
#endif
static const Module::CIDEntry kToolkitCIDs[] = {
{&kNS_TOOLKIT_APPSTARTUP_CID, false, nullptr, nsAppStartupConstructor},
#if defined(MOZ_HAS_TERMINATOR)
{&kNS_TOOLKIT_TERMINATOR_CID, false, nullptr, nsTerminatorConstructor},
#endif
{&kNS_USERINFO_CID, false, nullptr, nsUserInfoConstructor},
{&kALERT_NOTIFICATION_CID, false, nullptr, AlertNotificationConstructor},
{&kNS_ALERTSSERVICE_CID, false, nullptr, nsAlertsServiceConstructor},
#if !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
{&kNS_PARENTALCONTROLSSERVICE_CID, false, nullptr,
nsParentalControlsServiceConstructor},
#endif
{&kNS_DOWNLOADPLATFORM_CID, false, nullptr, DownloadPlatformConstructor},
{&kNS_FIND_SERVICE_CID, false, nullptr, nsFindServiceConstructor},
{&kNS_TYPEAHEADFIND_CID, false, nullptr, nsTypeAheadFindConstructor},
{&kNS_APPLICATION_REPUTATION_SERVICE_CID, false, nullptr,
ApplicationReputationServiceConstructor},
{&kNS_LOGIN_REPUTATION_SERVICE_CID, false, nullptr,
LoginReputationServiceConstructor},
{&kNS_URLCLASSIFIERPREFIXSET_CID, false, nullptr,
nsUrlClassifierPrefixSetConstructor},
{&kNS_URLCLASSIFIERDBSERVICE_CID, false, nullptr,
nsUrlClassifierDBServiceConstructor},
{&kNS_URLCLASSIFIERSTREAMUPDATER_CID, false, nullptr,
nsUrlClassifierStreamUpdaterConstructor},
{&kNS_URLCLASSIFIERUTILS_CID, false, nullptr,
nsUrlClassifierUtilsConstructor},
{&kNS_BROWSERSTATUSFILTER_CID, false, nullptr,
nsBrowserStatusFilterConstructor},
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
{&kNS_UPDATEPROCESSOR_CID, false, nullptr, nsUpdateProcessorConstructor},
#endif
{&kFINALIZATIONWITNESSSERVICE_CID, false, nullptr,
FinalizationWitnessServiceConstructor},
{&kNATIVE_OSFILE_INTERNALS_SERVICE_CID, false, nullptr,
NativeOSFileInternalsServiceConstructor},
{&kNS_ADDONCONTENTPOLICY_CID, false, nullptr,
AddonContentPolicyConstructor},
{&kNS_ADDON_MANAGER_STARTUP_CID, false, nullptr,
AddonManagerStartupConstructor},
{&kNS_ADDON_POLICY_SERVICE_CID, false, nullptr,
ExtensionPolicyServiceConstructor},
{&kNATIVE_FILEWATCHER_SERVICE_CID, false, nullptr,
NativeFileWatcherServiceConstructor},
#if defined(ENABLE_TESTS)
{&kNS_TELEMETRYGECKOVIEWTESTING_CID, false, nullptr,
TelemetryGeckoViewTestingImplConstructor},
#endif
{nullptr}};
static const Module::ContractIDEntry kToolkitContracts[] = {
{NS_APPSTARTUP_CONTRACTID, &kNS_TOOLKIT_APPSTARTUP_CID},
#if defined(MOZ_HAS_TERMINATOR)
{NS_TOOLKIT_TERMINATOR_CONTRACTID, &kNS_TOOLKIT_TERMINATOR_CID},
#endif
{NS_USERINFO_CONTRACTID, &kNS_USERINFO_CID},
{ALERT_NOTIFICATION_CONTRACTID, &kALERT_NOTIFICATION_CID},
{NS_ALERTSERVICE_CONTRACTID, &kNS_ALERTSSERVICE_CID},
#if !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
{NS_PARENTALCONTROLSSERVICE_CONTRACTID, &kNS_PARENTALCONTROLSSERVICE_CID},
#endif
{NS_DOWNLOADPLATFORM_CONTRACTID, &kNS_DOWNLOADPLATFORM_CID},
{NS_FIND_SERVICE_CONTRACTID, &kNS_FIND_SERVICE_CID},
{NS_TYPEAHEADFIND_CONTRACTID, &kNS_TYPEAHEADFIND_CID},
{NS_APPLICATION_REPUTATION_SERVICE_CONTRACTID,
&kNS_APPLICATION_REPUTATION_SERVICE_CID},
{NS_LOGIN_REPUTATION_SERVICE_CONTRACTID, &kNS_LOGIN_REPUTATION_SERVICE_CID},
{NS_URLCLASSIFIERPREFIXSET_CONTRACTID, &kNS_URLCLASSIFIERPREFIXSET_CID},
{NS_URLCLASSIFIERDBSERVICE_CONTRACTID, &kNS_URLCLASSIFIERDBSERVICE_CID},
{NS_URICLASSIFIERSERVICE_CONTRACTID, &kNS_URLCLASSIFIERDBSERVICE_CID},
{NS_URLCLASSIFIERSTREAMUPDATER_CONTRACTID,
&kNS_URLCLASSIFIERSTREAMUPDATER_CID},
{NS_URLCLASSIFIERUTILS_CONTRACTID, &kNS_URLCLASSIFIERUTILS_CID},
{NS_BROWSERSTATUSFILTER_CONTRACTID, &kNS_BROWSERSTATUSFILTER_CID},
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
{NS_UPDATEPROCESSOR_CONTRACTID, &kNS_UPDATEPROCESSOR_CID},
#endif
{FINALIZATIONWITNESSSERVICE_CONTRACTID, &kFINALIZATIONWITNESSSERVICE_CID},
{NATIVE_OSFILE_INTERNALS_SERVICE_CONTRACTID,
&kNATIVE_OSFILE_INTERNALS_SERVICE_CID},
{NS_ADDONCONTENTPOLICY_CONTRACTID, &kNS_ADDONCONTENTPOLICY_CID},
{NS_ADDONMANAGERSTARTUP_CONTRACTID, &kNS_ADDON_MANAGER_STARTUP_CID},
{NS_ADDON_POLICY_SERVICE_CONTRACTID, &kNS_ADDON_POLICY_SERVICE_CID},
{NATIVE_FILEWATCHER_SERVICE_CONTRACTID, &kNATIVE_FILEWATCHER_SERVICE_CID},
#if defined(ENABLE_TESTS)
{NS_TELEMETRYGECKOVIEWTESTING_CONTRACTID,
&kNS_TELEMETRYGECKOVIEWTESTING_CID},
#endif
{nullptr}};
static const mozilla::Module::CategoryEntry kToolkitCategories[] = {
{"content-policy", NS_ADDONCONTENTPOLICY_CONTRACTID,
NS_ADDONCONTENTPOLICY_CONTRACTID},
{nullptr}};
static const Module kToolkitModule = {Module::kVersion, kToolkitCIDs,
kToolkitContracts, kToolkitCategories};
NSMODULE_DEFN(nsToolkitCompsModule) = &kToolkitModule;

Просмотреть файл

@ -0,0 +1,12 @@
/* 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/. */
#include "nscore.h"
#include "nsID.h"
class nsISupports;
nsresult nsUrlClassifierDBServiceConstructor(nsISupports *aOuter,
const nsIID& aIID,
void **aResult);

Просмотреть файл

@ -37,8 +37,6 @@ class NativeFileWatcherService final : public nsINativeFileWatcherService {
void operator=(const NativeFileWatcherService& other) = delete;
};
NS_IMPL_ISUPPORTS(NativeFileWatcherService, nsINativeFileWatcherService);
} // namespace mozilla
#endif // mozilla_nativefilewatcher_h__

Просмотреть файл

@ -12,7 +12,6 @@
#include "nsCOMPtr.h"
#include "nsServiceManagerUtils.h"
#include "nsWeakReference.h"
#include "nsToolkitCompsCID.h"
#include "Database.h"
#include "nsString.h"
#include "mozilla/Attributes.h"

Просмотреть файл

@ -29,6 +29,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/Components.h"
#include "mozilla/ErrorNames.h"
#include "mozilla/LoadContext.h"
#include "mozilla/Preferences.h"
@ -368,7 +369,7 @@ nsresult PendingDBLookup::LookupSpecInternal(const nsACString& aSpec) {
// blacklisted.
LOG(("Checking DB service for principal %s [this = %p]", mSpec.get(), this));
nsCOMPtr<nsIUrlClassifierDBService> dbService =
do_GetService(NS_URLCLASSIFIERDBSERVICE_CONTRACTID, &rv);
mozilla::components::UrlClassifierDB::Service(&rv);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString tables;

Просмотреть файл

@ -5,6 +5,7 @@
#include "LoginReputation.h"
#include "nsThreadUtils.h"
#include "mozilla/Components.h"
#include "mozilla/ErrorNames.h"
#include "mozilla/Logging.h"
#include "mozilla/net/UrlClassifierFeatureFactory.h"
@ -113,7 +114,7 @@ RefPtr<ReputationPromise> LoginWhitelist::QueryLoginWhitelist(
}
nsCOMPtr<nsIURIClassifier> uriClassifier =
do_GetService(NS_URLCLASSIFIERDBSERVICE_CONTRACTID, &rv);
mozilla::components::UrlClassifierDB::Service(&rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
return p;
}

Просмотреть файл

@ -6,6 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "LoginReputationIPC.h"
#include "mozilla/Components.h"
#include "mozilla/Unused.h"
using namespace mozilla;
@ -23,7 +24,7 @@ NS_IMPL_ISUPPORTS(LoginReputationParent, nsILoginReputationQueryCallback)
mozilla::ipc::IPCResult LoginReputationParent::QueryReputation(nsIURI* aURI) {
nsresult rv;
nsCOMPtr<nsILoginReputationService> service =
do_GetService(NS_LOGIN_REPUTATION_SERVICE_CONTRACTID, &rv);
components::LoginReputation::Service(&rv);
if (NS_FAILED(rv)) {
Unused << Send__delete__(this);
return IPC_OK();

Просмотреть файл

@ -15,6 +15,7 @@
#include "nsNetCID.h"
#include "nsPrintfCString.h"
#include "nsThreadUtils.h"
#include "mozilla/Components.h"
#include "mozilla/EndianUtils.h"
#include "mozilla/Telemetry.h"
#include "mozilla/IntegerPrintfMacros.h"
@ -745,7 +746,7 @@ nsresult Classifier::ApplyUpdatesBackground(TableUpdateArray& aUpdates,
}
nsCOMPtr<nsIUrlClassifierUtils> urlUtil =
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID);
components::UrlClassifierUtils::Service();
nsCString provider;
// Assume all TableUpdate objects should have the same provider.
@ -1183,7 +1184,7 @@ bool Classifier::CheckValidUpdate(TableUpdateArray& aUpdates,
nsCString Classifier::GetProvider(const nsACString& aTableName) {
nsCOMPtr<nsIUrlClassifierUtils> urlUtil =
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID);
components::UrlClassifierUtils::Service();
nsCString provider;
nsresult rv = urlUtil->GetProvider(aTableName, provider);

Просмотреть файл

@ -6,6 +6,7 @@
#include "ProtocolParser.h"
#include "LookupCache.h"
#include "nsNetCID.h"
#include "mozilla/Components.h"
#include "mozilla/Logging.h"
#include "prnetdb.h"
#include "prprf.h"
@ -773,7 +774,7 @@ nsresult ProtocolParserProtobuf::ProcessOneResponse(
// Convert threat type to list name.
nsCOMPtr<nsIUrlClassifierUtils> urlUtil =
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID);
components::UrlClassifierUtils::Service();
nsCString possibleListNames;
nsresult rv = urlUtil->ConvertThreatTypeToListNames(aResponse.threat_type(),
possibleListNames);

Просмотреть файл

@ -12,7 +12,6 @@
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsString.h"
#include "nsToolkitCompsCID.h"
#include "../../../netwerk/base/nsBufferedStreams.h"
#include "prio.h"

Просмотреть файл

@ -14,8 +14,8 @@
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIProperties.h"
#include "nsToolkitCompsCID.h"
#include "nsIXULRuntime.h"
#include "nsToolkitCompsCID.h"
#include "nsUrlClassifierDBService.h"
#include "nsUrlClassifierUtils.h"
#include "nsUrlClassifierProxies.h"
@ -28,12 +28,14 @@
#include "nsProxyRelease.h"
#include "nsString.h"
#include "mozilla/Atomics.h"
#include "mozilla/Components.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/ErrorNames.h"
#include "mozilla/Mutex.h"
#include "mozilla/Preferences.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Unused.h"
#include "mozilla/Logging.h"
#include "prnetdb.h"
#include "Entries.h"
@ -791,7 +793,7 @@ nsresult nsUrlClassifierDBServiceWorker::NotifyUpdateObserver(
mUpdateStatus = aUpdateStatus;
nsCOMPtr<nsIUrlClassifierUtils> urlUtil =
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID);
components::UrlClassifierUtils::Service();
nsCString provider;
// Assume that all the tables in update should have the same provider.
@ -1561,7 +1563,7 @@ nsUrlClassifierClassifyCallback::HandleResult(const nsACString& aTable,
matchedInfo->fullhash = aFullHash;
nsCOMPtr<nsIUrlClassifierUtils> urlUtil =
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID);
components::UrlClassifierUtils::Service();
nsCString provider;
nsresult rv = urlUtil->GetProvider(aTable, provider);
@ -1593,8 +1595,8 @@ NS_INTERFACE_MAP_BEGIN(nsUrlClassifierDBService)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIURIClassifier)
NS_INTERFACE_MAP_END
/* static */ nsUrlClassifierDBService* nsUrlClassifierDBService::GetInstance(
nsresult* result) {
/* static */ already_AddRefed<nsUrlClassifierDBService>
nsUrlClassifierDBService::GetInstance(nsresult* result) {
*result = NS_OK;
if (!sUrlClassifierDBService) {
sUrlClassifierDBService = new (fallible) nsUrlClassifierDBService();
@ -1603,18 +1605,12 @@ NS_INTERFACE_MAP_END
return nullptr;
}
NS_ADDREF(sUrlClassifierDBService); // addref the global
*result = sUrlClassifierDBService->Init();
if (NS_FAILED(*result)) {
NS_RELEASE(sUrlClassifierDBService);
return nullptr;
}
} else {
// Already exists, just add a ref
NS_ADDREF(sUrlClassifierDBService); // addref the return result
}
return sUrlClassifierDBService;
return do_AddRef(sUrlClassifierDBService);
}
nsUrlClassifierDBService::nsUrlClassifierDBService()
@ -1724,7 +1720,8 @@ nsresult nsUrlClassifierDBService::Init() {
{
// Force nsIUrlClassifierUtils loading on main thread.
nsCOMPtr<nsIUrlClassifierUtils> dummy =
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID, &rv);
components::UrlClassifierUtils::Service(&rv);
Unused << dummy;
NS_ENSURE_SUCCESS(rv, rv);
}
@ -1997,7 +1994,7 @@ nsUrlClassifierDBService::SendThreatHitReport(nsIChannel* aChannel,
}
nsCOMPtr<nsIUrlClassifierUtils> utilsService =
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID);
components::UrlClassifierUtils::Service();
if (!utilsService) {
return NS_ERROR_FAILURE;
}
@ -2099,7 +2096,7 @@ nsresult nsUrlClassifierDBService::LookupURI(nsIPrincipal* aPrincipal,
nsAutoCString key;
// Canonicalize the url
nsCOMPtr<nsIUrlClassifierUtils> utilsService =
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID);
components::UrlClassifierUtils::Service();
rv = utilsService->GetKeyForURI(uri, key);
if (NS_FAILED(rv)) return rv;
@ -2482,7 +2479,7 @@ nsUrlClassifierDBService::AsyncClassifyLocalWithFeatures(
nsAutoCString key;
// Canonicalize the url
nsCOMPtr<nsIUrlClassifierUtils> utilsService =
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID);
components::UrlClassifierUtils::Service();
nsresult rv = utilsService->GetKeyForURI(uri, key);
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -17,7 +17,6 @@
#include "nsIUrlClassifierDBService.h"
#include "nsIUrlClassifierInfo.h"
#include "nsIURIClassifier.h"
#include "nsToolkitCompsCID.h"
#include "nsICryptoHMAC.h"
#include "mozilla/Attributes.h"
#include "mozilla/Mutex.h"
@ -101,7 +100,8 @@ class nsUrlClassifierDBService final : public nsIUrlClassifierDBService,
nsresult Init();
static nsUrlClassifierDBService* GetInstance(nsresult* result);
static already_AddRefed<nsUrlClassifierDBService> GetInstance(
nsresult* result);
NS_DECLARE_STATIC_IID_ACCESSOR(NS_URLCLASSIFIERDBSERVICE_CID)

Просмотреть файл

@ -13,7 +13,6 @@
#include "nsTArray.h"
#include "nsString.h"
#include "nsIFile.h"
#include "nsToolkitCompsCID.h"
#include "nsTArray.h"
#include "nsThreadUtils.h"
#include "nsNetUtil.h"

Просмотреть файл

@ -3,6 +3,7 @@
* 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/. */
#include "mozilla/Components.h"
#include "nsCRT.h"
#include "nsIHttpChannel.h"
#include "nsIObserverService.h"
@ -14,7 +15,6 @@
#include "nsNetUtil.h"
#include "nsStreamUtils.h"
#include "nsStringStream.h"
#include "nsToolkitCompsCID.h"
#include "nsUrlClassifierStreamUpdater.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/ErrorNames.h"
@ -294,7 +294,7 @@ nsUrlClassifierStreamUpdater::DownloadUpdates(
observerService->AddObserver(this, gQuitApplicationMessage, false);
mDBService = do_GetService(NS_URLCLASSIFIERDBSERVICE_CONTRACTID, &rv);
mDBService = mozilla::components::UrlClassifierDB::Service(&rv);
NS_ENSURE_SUCCESS(rv, rv);
mInitialized = true;
@ -327,7 +327,7 @@ nsUrlClassifierStreamUpdater::DownloadUpdates(
}
nsCOMPtr<nsIUrlClassifierUtils> urlUtil =
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID);
mozilla::components::UrlClassifierUtils::Service();
nsTArray<nsCString> tables;
mozilla::safebrowsing::Classifier::SplitTables(aRequestTables, tables);

Просмотреть файл

@ -6,6 +6,8 @@
#include "nsIThread.h"
#include "nsThreadUtils.h"
#include "nsUrlClassifierUtils.h"
#include "mozilla/Components.h"
#include "mozilla/Unused.h"
using namespace mozilla;
using namespace mozilla::safebrowsing;
@ -95,7 +97,8 @@ void ApplyUpdate(TableUpdateArray& updates) {
// in gtest.
nsresult rv;
nsCOMPtr<nsIUrlClassifierUtils> dummy =
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID, &rv);
mozilla::components::UrlClassifierUtils::Service(&rv);
Unused << dummy;
ASSERT_TRUE(NS_SUCCEEDED(rv));
}

Просмотреть файл

@ -10,6 +10,8 @@
#include "string.h"
#include "gtest/gtest.h"
#include "nsThreadUtils.h"
#include "mozilla/Components.h"
#include "mozilla/Unused.h"
using namespace mozilla;
using namespace mozilla::safebrowsing;
@ -191,7 +193,8 @@ static void testUpdate(TableUpdateArray& tableUpdates,
// in gtest.
nsresult rv;
nsCOMPtr<nsIUrlClassifierUtils> dummy =
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID, &rv);
components::UrlClassifierUtils::Service(&rv);
Unused << dummy;
ASSERT_TRUE(NS_SUCCEEDED(rv));
}

Просмотреть файл

@ -16,8 +16,8 @@
#include "nsPIDOMWindow.h"
#include "nsPrintfCString.h"
#include "nsString.h"
#include "nsToolkitCompsCID.h"
#include "nsXPCOMCIDInternal.h"
#include "mozilla/Components.h"
#include "mozilla/XREAppData.h"
#include "mozilla/Services.h"
@ -148,7 +148,7 @@ nsresult ProfileResetCleanup(nsIToolkitProfile* aOldProfile) {
do_GetService(NS_WINDOWWATCHER_CONTRACTID));
if (!windowWatcher) return NS_ERROR_FAILURE;
nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID));
nsCOMPtr<nsIAppStartup> appStartup(components::AppStartup::Service());
if (!appStartup) return NS_ERROR_FAILURE;
nsCOMPtr<mozIDOMWindowProxy> progressWindow;

Просмотреть файл

@ -10,6 +10,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/Components.h"
#include "mozilla/FilePreferences.h"
#include "mozilla/ChaosMode.h"
#include "mozilla/CmdLineAndEnvUtils.h"
@ -150,7 +151,6 @@
#include "nsAppDirectoryServiceDefs.h"
#include "nsXULAppAPI.h"
#include "nsXREDirProvider.h"
#include "nsToolkitCompsCID.h"
#include "nsINIParser.h"
#include "mozilla/Omnijar.h"
@ -1298,7 +1298,7 @@ ScopedXPCOMStartup::~ScopedXPCOMStartup() {
mozilla::MacAutoreleasePool pool;
#endif
nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID));
nsCOMPtr<nsIAppStartup> appStartup(components::AppStartup::Service());
if (appStartup) appStartup->DestroyHiddenWindow();
gDirServiceProvider->DoShutdown();
@ -1422,7 +1422,7 @@ nsresult ScopedXPCOMStartup::SetWindowCreator(nsINativeAppSupport* native) {
if (cr) cr->CheckForOSAccessibility();
nsCOMPtr<nsIWindowCreator> creator(do_GetService(NS_APPSTARTUP_CONTRACTID));
nsCOMPtr<nsIWindowCreator> creator(components::AppStartup::Service());
if (!creator) return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIWindowWatcher> wwatch(
@ -1998,8 +1998,7 @@ static ReturnAbortOnError ShowProfileManager(
ioParamBlock->SetObjects(dlgArray);
nsCOMPtr<nsIAppStartup> appStartup(
do_GetService(NS_APPSTARTUP_CONTRACTID));
nsCOMPtr<nsIAppStartup> appStartup(components::AppStartup::Service());
NS_ENSURE_TRUE(appStartup, NS_ERROR_FAILURE);
nsCOMPtr<mozIDOMWindowProxy> newWindow;
@ -4217,7 +4216,7 @@ nsresult XREMain::XRE_mainRun() {
nsAppStartupNotifier::NotifyObservers(APPSTARTUP_TOPIC);
nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID));
nsCOMPtr<nsIAppStartup> appStartup(components::AppStartup::Service());
NS_ENSURE_TRUE(appStartup, NS_ERROR_FAILURE);
mDirProvider.DoStartup();

Просмотреть файл

@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsAppRunner.h"
#include "nsToolkitCompsCID.h"
#include "nsXREDirProvider.h"
#include "jsapi.h"
@ -38,6 +37,7 @@
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/Components.h"
#include "mozilla/Services.h"
#include "mozilla/Omnijar.h"
#include "mozilla/Preferences.h"
@ -962,7 +962,8 @@ nsXREDirProvider::DoStartup() {
MOZ_ASSERT(mPrefsInitialized);
bool safeModeNecessary = false;
nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID));
nsCOMPtr<nsIAppStartup> appStartup(
mozilla::components::AppStartup::Service());
if (appStartup) {
rv = appStartup->TrackStartupCrashBegin(&safeModeNecessary);
if (NS_FAILED(rv) && rv != NS_ERROR_NOT_AVAILABLE)

Просмотреть файл

@ -25,10 +25,10 @@
#include "nsIURIFixup.h"
#include "nsCategoryManagerUtils.h"
#include "nsCDefaultURIFixup.h"
#include "nsToolkitCompsCID.h"
#include "nsGeoPosition.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Components.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Services.h"
#include "mozilla/Preferences.h"
@ -236,8 +236,7 @@ class GeckoThreadSupport final
static int64_t RunUiThreadCallback() { return RunAndroidUiTasks(); }
static void ForceQuit() {
nsCOMPtr<nsIAppStartup> appStartup =
do_GetService(NS_APPSTARTUP_CONTRACTID);
nsCOMPtr<nsIAppStartup> appStartup = components::AppStartup::Service();
if (appStartup) {
appStartup->Quit(nsIAppStartup::eForceQuit);
@ -568,8 +567,7 @@ nsAppShell::Observe(nsISupports* aSubject, const char* aTopic,
// quit. Therefore, we should *not* exit Gecko when there is no
// window or the last window is closed. nsIAppStartup::Quit will
// still force Gecko to exit.
nsCOMPtr<nsIAppStartup> appStartup =
do_GetService(NS_APPSTARTUP_CONTRACTID);
nsCOMPtr<nsIAppStartup> appStartup = components::AppStartup::Service();
if (appStartup) {
appStartup->EnterLastWindowClosingSurvivalArea();
}
@ -606,8 +604,7 @@ nsAppShell::Observe(nsISupports* aSubject, const char* aTopic,
// We are told explicitly to quit, perhaps due to
// nsIAppStartup::Quit being called. We should release our hold on
// nsIAppStartup and let it continue to quit.
nsCOMPtr<nsIAppStartup> appStartup =
do_GetService(NS_APPSTARTUP_CONTRACTID);
nsCOMPtr<nsIAppStartup> appStartup = components::AppStartup::Service();
if (appStartup) {
appStartup->ExitLastWindowClosingSurvivalArea();
}

Просмотреть файл

@ -26,6 +26,7 @@
#include "nsIStringBundle.h"
#include "nsToolkitCompsCID.h"
#include "mozilla/Components.h"
#include "mozilla/dom/Element.h"
NativeMenuItemTarget* nsMenuBarX::sNativeEventTarget = nil;
@ -883,7 +884,7 @@ static BOOL gMenuItemsExecuteCommands = YES;
if (mostSpecificContent) {
nsMenuUtilsX::DispatchCommandTo(mostSpecificContent);
} else {
nsCOMPtr<nsIAppStartup> appStartup = do_GetService(NS_APPSTARTUP_CONTRACTID);
nsCOMPtr<nsIAppStartup> appStartup = mozilla::components::AppStartup::Service();
if (appStartup) {
appStartup->Quit(nsIAppStartup::eAttemptQuit);
}

Просмотреть файл

@ -132,7 +132,6 @@
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/Touch.h"
#include "mozilla/gfx/2D.h"
#include "nsToolkitCompsCID.h"
#include "nsIAppStartup.h"
#include "mozilla/WindowsVersion.h"
#include "mozilla/TextEvents.h" // For WidgetKeyboardEvent