--- a/accessible/base/DocManager.cpp +++ b/accessible/base/DocManager.cpp @@ -15,20 +15,20 @@ #include "Platform.h" #include "RootAccessibleWrap.h" #include "xpcAccessibleDocument.h" #ifdef A11Y_LOG # include "Logging.h" #endif -#include "mozilla/Components.h" #include "mozilla/EventListenerManager.h" #include "mozilla/dom/Event.h" // for Event #include "nsContentUtils.h" +#include "nsCURILoader.h" #include "nsDocShellLoadTypes.h" #include "nsIChannel.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIWebNavigation.h" #include "nsServiceManagerUtils.h" #include "nsIWebProgress.h" #include "nsCoreUtils.h" #include "nsXULAppAPI.h" @@ -166,28 +166,30 @@ bool DocManager::IsProcessingRefreshDriv return false; } #endif //////////////////////////////////////////////////////////////////////////////// // DocManager protected bool DocManager::Init() { - nsCOMPtr<nsIWebProgress> progress = components::DocLoader::Service(); + nsCOMPtr<nsIWebProgress> progress = + do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID); if (!progress) return false; progress->AddProgressListener(static_cast<nsIWebProgressListener*>(this), nsIWebProgress::NOTIFY_STATE_DOCUMENT); return true; } void DocManager::Shutdown() { - nsCOMPtr<nsIWebProgress> progress = components::DocLoader::Service(); + nsCOMPtr<nsIWebProgress> progress = + do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID); if (progress) progress->RemoveProgressListener( static_cast<nsIWebProgressListener*>(this)); ClearDocCache(); }
deleted file mode 100644 --- a/build/docs/defining-xpcom-components.rst +++ /dev/null @@ -1,266 +0,0 @@ -.. _defining_xpcom_components: - -========================================= -Defining XPCOM C++-implemented Components -========================================= - -Native XPCOM components are registered at build time, and compiled into static -data structures which allow them to be accessed with little runtime overhead. -Each module which wishes to register components must provide a manifest -describing each component it implements, its type, and how it should be -constructed. - -Manifest files are Python data files registered in ``moz.build`` files in a -``XPCOM_MANIFESTS`` file list: - -.. code-block:: python - - XPCOM_MANIFESTS += [ - 'components.conf', - ] - -The files may define any of the following special variables: - -.. code-block:: python - - # Optional: A function to be called once, the first time any component - # listed in this manifest is instantiated. - InitFunc = 'nsInitFooModule' - # Optional: A function to be called at shutdown if any component listed in - # this manifest has been instantiated. - UnloadFunc = 'nsUnloadFooModule' - - # Optional: A processing priority, to determine how early or late the - # manifest is processed. Defaults to 50. In practice, this mainly affects - # the order in which unload functions are called at shutdown, with higher - # priority numbers being called later. - Priority = 10 - - # Optional: A list of header files to include before calling init or - # unload functions, or any legacy constructor functions. - # - # Any header path beginning with a `/` is loaded relative to the root of - # the source tree, and must not rely on any local includes. - # - # Any relative header path must be exported. - Headers = [ - '/foo/nsFooModule.h', - 'nsFoo.h', - ] - - # A list of component classes provided by this module. - Classes = [ - { - # ... - }, - # ... - ] - -Class definitions may have the following properties: - -``name`` (optional) - If present, this component will generate an entry with the given name in the - ``mozilla::components`` namespace in ``mozilla/Components.h``, which gives - easy access to its CID, service, and instance constructors as (e.g.,) - ``components::Foo::CID()``, ``components::Foo::Service()``, and - ``components::Foo::Create()``, respectively. - -``cid`` - A UUID string containing this component's CID, in the form - ``'{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}'``. - -``contract_ids`` (optional) - A list of contract IDs to register for this class. - -``categories`` (optional) - A dict of category entries to register for this component's contract ID. - Each key in the dict is the name of the category. Each value is either a - string containing a single entry name, or a list of entry name strings. - -``type`` (optional, default=``nsISupports``) - The fully-qualified type of the class implementing this component. Defaults - to ``nsISupports``, but **must** be provided if the ``init_method`` property - is specified, or if neither the ``constructor`` nor ``legacy_constructor`` - properties are provided. - -``headers`` (optional) - A list of headers to include in order to call this component's constructor, - in the same format as the global ``Headers`` property. - -``init_method`` (optional) - The name of a method to call on newly-created instances of this class before - returning them. The method must take no arguments, and must return a - ``nsresult``. If it returns failure, that failure is propagated to the - ``getService`` or ``createInstance`` caller. - -``constructor`` (optional) - The fully-qualified name of a constructor function to call in order to - create instances of this class. This function must be declared in one of the - headers listed in the ``headers`` property, must take no arguments, and must - return ``already_AddRefed<iface>`` where ``iface`` is the interface provided - in the ``type`` property. - - This property is incompatible with ``legacy_constructor``. - -``legacy_constructor`` (optional) - This property is deprecated, and should not be used in new code. - - The fully-qualified name of a constructor function to call in order to - create instances of this class. This function must be declared in one of the - headers listed in the ``headers`` property, and must have the signature - ``nsresult(nsISupports* aOuter, const nsID& aIID, void** aResult)``, and - behave equivalently to ``nsIFactory::CreateInstance``. - - This property is incompatible with ``constructor``. - -``singleton`` (optional, default=``False``) - If true, this component's constructor is expected to return the same - singleton for every call, and no ``mozilla::components::<name>::Create()`` - method will be generated for it. - -``overridable`` (optional, default=``False``) - If true, this component's contract ID is expected to be overridden by some - tests, and its ``mozilla::components::<name>::Service()`` getter will - therefore look it up by contract ID for every call. This component must, - therefore, provide at least one contract ID in its ``contract_ids`` array. - - If false, the ``Service()`` getter will always retrieve the service based on - its static data, and it cannot be overridden. - - Note: Enabling this option is expensive, and should not be done when it can - be avoided, or when the getter is used by any hot code. - -``external`` (optional, default=``False`` if any ``headers`` are provided, ``True`` otherwise) - If true, a constructor for this component's ``type`` must be defined in - another translation unit, using ``NS_IMPL_COMPONENT_FACTORY(type)``. The - constructor must return an ``already_AddRefed<nsISupports>``, and will be - used to construct instances of this type. - - This option should only be used in cases where the headers which define the - component's concrete type cannot be easily included without local includes. - - Note: External constructors may not specify an ``init_method``, since the - generated code will not have the necessary type information required to call - it. This option is also incompatible with ``constructor`` and - ``legacy_constructor``. - -``processes`` (optional, default=``ProcessSelector.ANY_PROCESS``) - An optional specifier restricting which types of process this component may - be loaded in. This must be a property of ``ProcessSelector`` with the same - name as one of the values in the ``Module::ProcessSelector`` enum. - - -Conditional Compilation -======================= - -This manifest may run any appropriate Python code to customize the values of -the ``Classes`` array based on build configuration. To simplify this process, -the following globals are available: - -``defined`` - A function which returns true if the given build config setting is defined - and true. - -``buildconfig`` - The ``buildconfig`` python module, with a ``substs`` property containing a - dict of all available build substitutions. - - -Component Constructors -====================== - -There are several ways to define component constructors, which vary mostly -depending on how old the code that uses them is: - -Class Constructors ------------------- - -This simplest way to define a component is to include a header defining a -concrete type, and let the component manager call that class's constructor: - -.. code-block:: python - - 'type': 'mozilla::foo::Foo', - 'headers': ['mozilla/Foo.h'], - -This is generally the preferred method of defining non-singleton constructors, -but may not be practicable for classes which rely on local includes for their -definitions. - -Singleton Constructors ----------------------- - -Singleton classes are generally expected to provide their own constructor -function which caches a singleton instance the first time it is called, and -returns the same instance on subsequent calls. This requires declaring the -constructor in an included header, and implementing it in a separate source -file: - -.. code-block:: python - - 'type': 'mozilla::foo::Foo', - 'headers': ['mozilla/Foo.h'], - 'constructor': 'mozilla::Foo::GetSingleton', - -``Foo.h`` - -.. code-block:: c++ - - class Foo final : public nsISupports { - public: - static already_AddRefed<Foo> GetSingleton(); - }; - -``Foo.cpp`` - -.. code-block:: c++ - - already_AddRefed<Foo> Foo::GetSingleton() { - // ... - } - -External Constructors ---------------------- - -For types whose headers can't easily be included, constructors can be defined -using a template specialization on an incomplete type: - -.. code-block:: python - - 'type': 'mozilla::foo::Foo', - 'external: True,' - -``Foo.cpp`` - -.. code-block:: c++ - - NS_IMPL_COMPONENT_FACTORY(Foo) { - return do_AddRef(new Foo()).downcast<nsISupports>(); - } - -Legacy Constructors -------------------- - -These should not be used in new code, and are left as an exercise for the -reader. - - -Registering Categories -====================== - -Classes which need define category entries with the same value as their -contract ID may do so using the following: - -.. code-block:: python - - 'contract_ids': ['@mozilla.org/foo;1'], - 'categories': { - 'content-policy': 'm-foo', - 'Gecko-Content-Viewers': ['image/jpeg', 'image/png'], - }, - -This will define each of the following category entries: - -* ``"content-policy"`` ``"m-foo",`` ``"@mozilla.org/foo;1"`` -* ``"Gecko-Content-Viewers"`` ``"image/jpeg"`` ``"@mozilla.org/foo;1"`` -* ``"Gecko-Content-Viewers"`` ``"image/png"`` ``"@mozilla.org/foo;1"``
--- a/build/docs/index.rst +++ b/build/docs/index.rst @@ -20,17 +20,16 @@ Important Concepts environment-variables build-targets python test_manifests mozinfo preprocessor jar-manifests defining-binaries - defining-xpcom-components toolchains locales rust sparse Support for projects building with GN <gn> telemetry integrated development environment (IDE)
--- a/caps/nsScriptSecurityManager.cpp +++ b/caps/nsScriptSecurityManager.cpp @@ -48,21 +48,21 @@ #include "nsIWindowWatcher.h" #include "nsIConsoleService.h" #include "nsIOService.h" #include "nsIContent.h" #include "nsDOMJSUtils.h" #include "nsAboutProtocolUtils.h" #include "nsIClassInfo.h" #include "nsIURIFixup.h" +#include "nsCDefaultURIFixup.h" #include "nsIChromeRegistry.h" #include "nsIResProtocolHandler.h" #include "nsIContentSecurityPolicy.h" #include "nsIAsyncVerifyRedirectCallback.h" -#include "mozilla/Components.h" #include "mozilla/Preferences.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/NullPrincipal.h" #include <stdint.h> #include "mozilla/dom/ScriptSettings.h" #include "mozilla/ClearOnShutdown.h" #include "mozilla/StaticPtr.h" #include "mozilla/dom/WorkerCommon.h" @@ -1132,17 +1132,17 @@ nsScriptSecurityManager::CheckLoadURIStr // return values. return rv; } NS_ENSURE_SUCCESS(rv, rv); // Now start testing fixup -- since aTargetURIStr is a string, not // an nsIURI, we may well end up fixing it up before loading. // Note: This needs to stay in sync with the nsIURIFixup api. - nsCOMPtr<nsIURIFixup> fixup = components::URIFixup::Service(); + nsCOMPtr<nsIURIFixup> fixup = do_GetService(NS_URIFIXUP_CONTRACTID); if (!fixup) { return rv; } uint32_t flags[] = {nsIURIFixup::FIXUP_FLAG_NONE, nsIURIFixup::FIXUP_FLAG_FIX_SCHEME_TYPOS, nsIURIFixup::FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP, nsIURIFixup::FIXUP_FLAGS_MAKE_ALTERNATE_URI,
--- a/docshell/base/ChildProcessChannelListener.h +++ b/docshell/base/ChildProcessChannelListener.h @@ -33,12 +33,21 @@ class ChildProcessChannelListener final private: virtual ~ChildProcessChannelListener(); nsDataHashtable<nsUint64HashKey, Callback> mCallbacks; nsDataHashtable<nsUint64HashKey, nsCOMPtr<nsIChildChannel>> mChannels; }; +#define NS_CHILDPROCESSCHANNELLISTENER_CID \ + { \ + 0x397b43f3, 0x1470, 0x4542, { \ + 0x8a, 0x40, 0xc7, 0x18, 0xf7, 0x75, 0x35, 0x63 \ + } \ + } +#define NS_CHILDPROCESSCHANNELLISTENER_CONTRACTID \ + "@mozilla.org/network/childProcessChannelListener;1" + } // namespace dom } // namespace mozilla #endif // !defined(mozilla_dom_ChildProcessChannelListener_h)
--- a/docshell/base/moz.build +++ b/docshell/base/moz.build @@ -31,16 +31,17 @@ with Files('nsILinkHandler.*'): with Files('nsIScrollObserver.*'): BUG_COMPONENT = ('Core', 'Panning and Zooming') DIRS += [ 'timeline', ] XPIDL_SOURCES += [ + 'nsCDefaultURIFixup.idl', 'nsIContentViewer.idl', 'nsIContentViewerEdit.idl', 'nsIDocShell.idl', 'nsIDocShellTreeItem.idl', 'nsIDocShellTreeOwner.idl', 'nsIDocumentLoaderFactory.idl', 'nsILoadContext.idl', 'nsILoadURIDelegate.idl',
--- a/docshell/base/nsAboutRedirector.h +++ b/docshell/base/nsAboutRedirector.h @@ -18,9 +18,17 @@ class nsAboutRedirector : public nsIAbou nsAboutRedirector() {} static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult); protected: virtual ~nsAboutRedirector() {} }; +/* 56ebedd4-6ccf-48e8-bdae-adc77f044567 */ +#define NS_ABOUT_REDIRECTOR_MODULE_CID \ + { \ + 0x56ebedd4, 0x6ccf, 0x48e8, { \ + 0xbd, 0xae, 0xad, 0xc7, 0x7f, 0x04, 0x45, 0x67 \ + } \ + } + #endif // nsAboutRedirector_h__
new file mode 100644 --- /dev/null +++ b/docshell/base/nsCDefaultURIFixup.idl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * 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/. */ + +%{ C++ +// {214C48A0-B57F-11d4-959C-0020183BF181} +#define NS_DEFAULTURIFIXUP_CID \ +{ 0x214c48a0, 0xb57f, 0x11d4, { 0x95, 0x9c, 0x0, 0x20, 0x18, 0x3b, 0xf1, 0x81 } } +#define NS_URIFIXUP_CONTRACTID \ +"@mozilla.org/docshell/urifixup;1" +%}
--- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -15,17 +15,16 @@ # include <unistd.h> // for getpid() #endif #include "mozilla/ArrayUtils.h" #include "mozilla/Attributes.h" #include "mozilla/AutoRestore.h" #include "mozilla/BasePrincipal.h" #include "mozilla/Casting.h" -#include "mozilla/Components.h" #include "mozilla/Encoding.h" #include "mozilla/EventStateManager.h" #include "mozilla/HTMLEditor.h" #include "mozilla/LoadInfo.h" #include "mozilla/Logging.h" #include "mozilla/MediaFeatureChange.h" #include "mozilla/Preferences.h" #include "mozilla/ResultExtensions.h" @@ -156,16 +155,17 @@ #include "IHistory.h" #include "IUrlClassifierUITelemetry.h" #include "mozIThirdPartyUtil.h" #include "nsArray.h" #include "nsArrayUtils.h" #include "nsAutoPtr.h" +#include "nsCDefaultURIFixup.h" #include "nsCExternalHandlerService.h" #include "nsContentDLF.h" #include "nsContentPolicyUtils.h" // NS_CheckContentLoadPolicy(...) #include "nsContentSecurityManager.h" #include "nsContentUtils.h" #include "nsCURILoader.h" #include "nsDocShellCID.h" #include "nsDocShellEditorData.h" @@ -394,18 +394,17 @@ nsDocShell::nsDocShell(BrowsingContext* AssertOriginAttributesMatchPrivateBrowsing(); nsContentUtils::GenerateUUIDInPlace(mHistoryID); if (gDocShellCount++ == 0) { NS_ASSERTION(sURIFixup == nullptr, "Huh, sURIFixup not null in first nsDocShell ctor!"); - nsCOMPtr<nsIURIFixup> uriFixup = components::URIFixup::Service(); - uriFixup.forget(&sURIFixup); + CallGetService(NS_URIFIXUP_CONTRACTID, &sURIFixup); } MOZ_LOG(gDocShellLeakLog, LogLevel::Debug, ("DOCSHELL %p created\n", this)); #ifdef DEBUG // We're counting the number of |nsDocShells| to help find leaks ++gNumberOfDocShells; if (!PR_GetEnv("MOZ_QUIET")) { @@ -9624,22 +9623,23 @@ nsresult nsDocShell::DoURILoad(nsDocShel // Double-check that we're still around to load this URI. if (mIsBeingDestroyed) { // Return NS_OK despite not doing anything to avoid throwing exceptions // from nsLocation::SetHref if the unload handler of the existing page // tears us down. return NS_OK; } - nsCOMPtr<nsIURILoader> uriLoader = components::URILoader::Service(); - if (NS_WARN_IF(!uriLoader)) { - return NS_ERROR_UNEXPECTED; - } - nsresult rv; + nsCOMPtr<nsIURILoader> uriLoader = + do_GetService(NS_URI_LOADER_CONTRACTID, &rv); + if (NS_FAILED(rv)) { + return rv; + } + if (IsFrame()) { MOZ_ASSERT(aContentPolicyType == nsIContentPolicy::TYPE_INTERNAL_IFRAME || aContentPolicyType == nsIContentPolicy::TYPE_INTERNAL_FRAME, "DoURILoad thinks this is a frame and InternalLoad does not"); if (StaticPrefs::dom_block_external_protocol_in_iframes()) { // Only allow URLs able to return data in iframes. bool doesNotReturnData = false; @@ -11262,17 +11262,17 @@ nsresult nsDocShell::AddToSessionHistory entry->RemoveChild(child); } entry->AbandonBFCacheEntry(); } } // Create a new entry if necessary. if (!entry) { - entry = components::SHEntry::Create(); + entry = do_CreateInstance(NS_SHENTRY_CONTRACTID); if (!entry) { return NS_ERROR_OUT_OF_MEMORY; } } // Get the post data & referrer nsCOMPtr<nsIInputStream> inputStream;
--- a/docshell/base/nsWebNavigationInfo.h +++ b/docshell/base/nsWebNavigationInfo.h @@ -8,16 +8,23 @@ #define nsWebNavigationInfo_h__ #include "nsIWebNavigationInfo.h" #include "nsCOMPtr.h" #include "nsICategoryManager.h" #include "nsStringFwd.h" #include "mozilla/Attributes.h" +#define NS_WEBNAVIGATION_INFO_CID \ + { \ + 0xf30bc0a2, 0x958b, 0x4287, { \ + 0xbf, 0x62, 0xce, 0x38, 0xba, 0x0c, 0x81, 0x1e \ + } \ + } + class nsWebNavigationInfo final : public nsIWebNavigationInfo { public: nsWebNavigationInfo() {} NS_DECL_ISUPPORTS NS_DECL_NSIWEBNAVIGATIONINFO
deleted file mode 100644 --- a/docshell/build/components.conf +++ /dev/null @@ -1,176 +0,0 @@ -# -*- 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/. - -about_pages = [ - 'about', - 'addons', - 'buildconfig', - 'checkerboard', - 'config', - 'crashcontent', - 'crashparent', - 'credits', - 'license', - 'logo', - 'memory', - 'mozilla', - 'neterror', - 'networking', - 'performance', - 'plugins', - 'printpreview', - 'serviceworkers', - 'srcdoc', - 'support', - 'telemetry', - 'url-classifier', - 'webrtc', -] - -if defined('MOZ_CRASHREPORTER'): - about_pages.append('crashes') -if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] != 'android': - about_pages.append('profiles') - -Headers = ['/docshell/build/nsDocShellModule.h'] - -InitFunc = 'mozilla::InitDocShellModule' -UnloadFunc = 'mozilla::UnloadDocShellModule' - -Classes = [ - { - 'name': 'SHEntry', - 'cid': '{bfd1a791-ad9f-11d3-bdc7-0050040a9b44}', - 'contract_ids': ['@mozilla.org/browser/session-history-entry;1'], - 'type': 'nsSHEntry', - 'headers': ['/docshell/shistory/nsSHEntry.h'], - }, - { - 'name': 'DocLoader', - 'cid': '{057b04d0-0ccf-11d2-beba-00805f8a66dc}', - 'contract_ids': ['@mozilla.org/docloaderservice;1'], - 'type': 'nsDocLoader', - 'headers': ['nsDocLoader.h'], - 'init_method': 'Init', - }, - { - 'name': 'URIFixup', - 'cid': '{214c48a0-b57f-11d4-959c-0020183bf181}', - 'contract_ids': ['@mozilla.org/docshell/urifixup;1'], - 'type': 'nsDefaultURIFixup', - 'headers': ['/docshell/base/nsDefaultURIFixup.h'], - }, - { - 'cid': '{a7f800e0-4306-11d4-98d0-001083010e9b}', - 'contract_ids': [ - '@mozilla.org/mime;1', - '@mozilla.org/uriloader/external-helper-app-service;1', - '@mozilla.org/uriloader/external-protocol-service;1', - ], - 'type': 'nsOSHelperAppService', - 'headers': ['nsOSHelperAppService.h'], - 'init_method': 'Init', - 'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS, - }, - { - 'cid': '{397b43f3-1470-4542-8a40-c718f7753563}', - 'contract_ids': ['@mozilla.org/network/childProcessChannelListener;1'], - 'singleton': True, - 'type': 'mozilla::dom::ChildProcessChannelListener', - 'constructor': 'mozilla::dom::ChildProcessChannelListener::GetSingleton', - 'headers': ['mozilla/dom/ChildProcessChannelListener.h'], - 'processes': ProcessSelector.CONTENT_PROCESS_ONLY, - }, - { - 'cid': '{56ebedd4-6ccf-48e8-bdae-adc77f044567}', - 'contract_ids': [ - '@mozilla.org/network/protocol/about;1?what=%s' % path - for path in about_pages - ], - 'legacy_constructor': 'nsAboutRedirector::Create', - 'headers': ['/docshell/base/nsAboutRedirector.h'], - }, - { - 'cid': '{bd6390c8-fbea-11d4-98f6-001083010e9b}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=default'], - 'type': 'nsExternalProtocolHandler', - 'headers': ['/uriloader/exthandler/nsExternalProtocolHandler.h'], - 'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS, - }, - { - 'name': 'OfflineCacheUpdate', - 'cid': '{ec06f3fc-70db-4ecd-94e0-a6e91ca44d8a}', - 'contract_ids': ['@mozilla.org/offlinecacheupdate-service;1'], - 'singleton': True, - 'type': 'nsOfflineCacheUpdateService', - 'headers': ['/uriloader/prefetch/nsOfflineCacheUpdate.h'], - 'constructor': 'nsOfflineCacheUpdateService::GetInstance', - }, - { - 'cid': '{95790842-75a0-430d-98bf-f5ce3788ea6d}', - 'contract_ids': ['@mozilla.org/ospermissionrequest;1'], - 'type': 'nsOSPermissionRequest', - 'headers': ['nsOSPermissionRequest.h'], - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - { - 'name': 'Prefetch', - 'cid': '{6b8bdffc-3394-417d-be83-a81b7c0f63bf}', - 'contract_ids': ['@mozilla.org/prefetch-service;1'], - 'type': 'nsPrefetchService', - 'headers': ['/uriloader/prefetch/nsPrefetchService.h'], - 'init_method': 'Init', - }, - { - 'cid': '{c4b6fb7c-bfb1-49dc-a65f-035796524b53}', - 'contract_ids': ['@mozilla.org/uriloader/handler-service;1'], - 'type': 'mozilla::dom::ContentHandlerService', - 'headers': ['ContentHandlerService.h'], - 'init_method': 'Init', - 'processes': ProcessSelector.CONTENT_PROCESS_ONLY, - }, - { - 'cid': '{bc0017e3-2438-47be-a567-41db58f17627}', - 'contract_ids': ['@mozilla.org/uriloader/local-handler-app;1'], - 'type': 'PlatformLocalHandlerApp_t', - 'headers': ['/uriloader/exthandler/nsLocalHandlerApp.h'], - }, - { - 'name': 'URILoader', - 'cid': '{9f6d5d40-90e7-11d3-af80-00a024ffc08c}', - 'contract_ids': ['@mozilla.org/uriloader;1'], - 'type': 'nsURILoader', - 'headers': ['nsURILoader.h'], - }, - { - 'cid': '{f30bc0a2-958b-4287-bf62-ce38ba0c811e}', - 'contract_ids': ['@mozilla.org/webnavigation-info;1'], - 'type': 'nsWebNavigationInfo', - 'headers': ['/docshell/base/nsWebNavigationInfo.h'], - 'init_method': 'Init', - }, -] - -if defined('MOZ_ENABLE_DBUS'): - Classes += [ - { - 'name': 'DBusHandlerApp', - 'cid': '{6c3c274b-4cbf-4bb5-a635-05ad2cbb6535}', - 'contract_ids': ['@mozilla.org/uriloader/dbus-handler-app;1'], - 'type': 'nsDBusHandlerApp', - 'headers': ['/uriloader/exthandler/nsDBusHandlerApp.h'], - }, - ] - -if defined('MOZ_WIDGET_ANDROID'): - Classes += [ - { - 'cid': '{4bf1f8ef-d947-4ba3-9cd3-8c9a54a63a1c}', - 'contract_ids': ['@mozilla.org/uriloader/external-url-handler-service;1'], - 'type': 'nsExternalURLHandlerService', - 'headers': ['nsExternalURLHandlerService.h'], - }, - ]
--- a/docshell/build/moz.build +++ b/docshell/build/moz.build @@ -8,18 +8,18 @@ EXPORTS += [ 'nsDocShellCID.h', ] SOURCES += [ 'nsDocShellModule.cpp', ] LOCAL_INCLUDES += [ + '/docshell/base', '/docshell/shistory', -] - -XPCOM_MANIFESTS += [ - 'components.conf', + '/uriloader/base', + '/uriloader/exthandler', + '/uriloader/prefetch', ] include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul'
--- a/docshell/build/nsDocShellModule.cpp +++ b/docshell/build/nsDocShellModule.cpp @@ -1,29 +1,209 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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 "mozilla/ModuleUtils.h" +#include "nsDocShellCID.h" + #include "mozilla/dom/BrowsingContext.h" +#include "mozilla/dom/ChildProcessChannelListener.h" + +#include "nsDocShell.h" +#include "nsDefaultURIFixup.h" +#include "nsWebNavigationInfo.h" +#include "nsAboutRedirector.h" +#include "nsCDefaultURIFixup.h" + +// uriloader +#include "nsURILoader.h" +#include "nsDocLoader.h" +#include "nsOSHelperAppService.h" +#include "nsOSPermissionRequest.h" +#include "nsExternalProtocolHandler.h" +#include "nsPrefetchService.h" +#include "nsOfflineCacheUpdate.h" +#include "nsLocalHandlerApp.h" +#include "ContentHandlerService.h" +#ifdef MOZ_ENABLE_DBUS +# include "nsDBusHandlerApp.h" +#endif +#if defined(MOZ_WIDGET_ANDROID) +# include "nsExternalURLHandlerService.h" +#endif // session history +#include "nsSHEntry.h" #include "nsSHEntryShared.h" #include "nsSHistory.h" -namespace mozilla { +using mozilla::dom::ChildProcessChannelListener; +using mozilla::dom::ContentHandlerService; + +static bool gInitialized = false; // The one time initialization for this module -nsresult InitDocShellModule() { +static nsresult Initialize() { + MOZ_ASSERT(!gInitialized, "docshell module already initialized"); + if (gInitialized) { + return NS_OK; + } + gInitialized = true; + mozilla::dom::BrowsingContext::Init(); nsresult rv = nsSHistory::Startup(); NS_ENSURE_SUCCESS(rv, rv); return NS_OK; } -void UnloadDocShellModule() { +static void Shutdown() { nsSHistory::Shutdown(); nsSHEntryShared::Shutdown(); + gInitialized = false; } -} // namespace mozilla +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDefaultURIFixup) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWebNavigationInfo, Init) + +// uriloader +NS_GENERIC_FACTORY_CONSTRUCTOR(nsURILoader) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDocLoader, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsOSHelperAppService, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalProtocolHandler) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefetchService, Init) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR( + nsOfflineCacheUpdateService, nsOfflineCacheUpdateService::GetInstance) +NS_GENERIC_FACTORY_CONSTRUCTOR(PlatformLocalHandlerApp_t) +#ifdef MOZ_ENABLE_DBUS +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDBusHandlerApp) +#endif +#if defined(MOZ_WIDGET_ANDROID) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalURLHandlerService) +#endif +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ContentHandlerService, Init) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR( + ChildProcessChannelListener, ChildProcessChannelListener::GetSingleton) + +// OS access permissions +NS_GENERIC_FACTORY_CONSTRUCTOR(nsOSPermissionRequest) + +// session history +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSHEntry) + +NS_DEFINE_NAMED_CID(NS_DEFAULTURIFIXUP_CID); +NS_DEFINE_NAMED_CID(NS_WEBNAVIGATION_INFO_CID); +NS_DEFINE_NAMED_CID(NS_ABOUT_REDIRECTOR_MODULE_CID); +NS_DEFINE_NAMED_CID(NS_URI_LOADER_CID); +NS_DEFINE_NAMED_CID(NS_DOCUMENTLOADER_SERVICE_CID); +NS_DEFINE_NAMED_CID(NS_EXTERNALHELPERAPPSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_EXTERNALPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_PREFETCHSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_OFFLINECACHEUPDATESERVICE_CID); +NS_DEFINE_NAMED_CID(NS_LOCALHANDLERAPP_CID); +NS_DEFINE_NAMED_CID(NS_OSPERMISSIONREQUEST_CID); +#ifdef MOZ_ENABLE_DBUS +NS_DEFINE_NAMED_CID(NS_DBUSHANDLERAPP_CID); +#endif +#if defined(MOZ_WIDGET_ANDROID) +NS_DEFINE_NAMED_CID(NS_EXTERNALURLHANDLERSERVICE_CID); +#endif +NS_DEFINE_NAMED_CID(NS_SHENTRY_CID); +NS_DEFINE_NAMED_CID(NS_CONTENTHANDLERSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_CHILDPROCESSCHANNELLISTENER_CID); + +const mozilla::Module::CIDEntry kDocShellCIDs[] = { + // clang-format off + { &kNS_DEFAULTURIFIXUP_CID, false, nullptr, nsDefaultURIFixupConstructor }, + { &kNS_WEBNAVIGATION_INFO_CID, false, nullptr, nsWebNavigationInfoConstructor }, + { &kNS_ABOUT_REDIRECTOR_MODULE_CID, false, nullptr, nsAboutRedirector::Create }, + { &kNS_URI_LOADER_CID, false, nullptr, nsURILoaderConstructor }, + { &kNS_DOCUMENTLOADER_SERVICE_CID, false, nullptr, nsDocLoaderConstructor }, + { &kNS_EXTERNALHELPERAPPSERVICE_CID, false, nullptr, nsOSHelperAppServiceConstructor, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { &kNS_OSPERMISSIONREQUEST_CID, false, nullptr, nsOSPermissionRequestConstructor }, + { &kNS_CONTENTHANDLERSERVICE_CID, false, nullptr, ContentHandlerServiceConstructor, + mozilla::Module::CONTENT_PROCESS_ONLY }, + { &kNS_EXTERNALPROTOCOLHANDLER_CID, false, nullptr, nsExternalProtocolHandlerConstructor, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { &kNS_PREFETCHSERVICE_CID, false, nullptr, nsPrefetchServiceConstructor }, + { &kNS_OFFLINECACHEUPDATESERVICE_CID, false, nullptr, nsOfflineCacheUpdateServiceConstructor }, + { &kNS_LOCALHANDLERAPP_CID, false, nullptr, PlatformLocalHandlerApp_tConstructor }, +#ifdef MOZ_ENABLE_DBUS + { &kNS_DBUSHANDLERAPP_CID, false, nullptr, nsDBusHandlerAppConstructor }, +#endif +#if defined(MOZ_WIDGET_ANDROID) + { &kNS_EXTERNALURLHANDLERSERVICE_CID, false, nullptr, nsExternalURLHandlerServiceConstructor }, +#endif + { &kNS_SHENTRY_CID, false, nullptr, nsSHEntryConstructor }, + { &kNS_CHILDPROCESSCHANNELLISTENER_CID, false, nullptr, ChildProcessChannelListenerConstructor }, + { nullptr } + // clang-format on +}; + +const mozilla::Module::ContractIDEntry kDocShellContracts[] = { + // clang-format off + { NS_URIFIXUP_CONTRACTID, &kNS_DEFAULTURIFIXUP_CID }, + { NS_WEBNAVIGATION_INFO_CONTRACTID, &kNS_WEBNAVIGATION_INFO_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "about", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "addons", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "buildconfig", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "checkerboard", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "config", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, +#ifdef MOZ_CRASHREPORTER + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "crashes", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, +#endif + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "crashparent", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "crashcontent", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "credits", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "license", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "logo", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "memory", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "mozilla", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "neterror", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "networking", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "performance", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "plugins", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "serviceworkers", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, +#ifndef ANDROID + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "profiles", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, +#endif + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "srcdoc", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "support", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "telemetry", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "webrtc", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "printpreview", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "url-classifier", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_URI_LOADER_CONTRACTID, &kNS_URI_LOADER_CID }, + { NS_DOCUMENTLOADER_SERVICE_CONTRACTID, &kNS_DOCUMENTLOADER_SERVICE_CID }, + { NS_HANDLERSERVICE_CONTRACTID, &kNS_CONTENTHANDLERSERVICE_CID, mozilla::Module::CONTENT_PROCESS_ONLY }, + { NS_EXTERNALHELPERAPPSERVICE_CONTRACTID, &kNS_EXTERNALHELPERAPPSERVICE_CID }, + { NS_EXTERNALPROTOCOLSERVICE_CONTRACTID, &kNS_EXTERNALHELPERAPPSERVICE_CID, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { NS_MIMESERVICE_CONTRACTID, &kNS_EXTERNALHELPERAPPSERVICE_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX"default", &kNS_EXTERNALPROTOCOLHANDLER_CID, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { NS_PREFETCHSERVICE_CONTRACTID, &kNS_PREFETCHSERVICE_CID }, + { NS_OFFLINECACHEUPDATESERVICE_CONTRACTID, &kNS_OFFLINECACHEUPDATESERVICE_CID }, + { NS_LOCALHANDLERAPP_CONTRACTID, &kNS_LOCALHANDLERAPP_CID }, +#ifdef MOZ_ENABLE_DBUS + { NS_DBUSHANDLERAPP_CONTRACTID, &kNS_DBUSHANDLERAPP_CID }, +#endif +#if defined(MOZ_WIDGET_ANDROID) + { NS_EXTERNALURLHANDLERSERVICE_CONTRACTID, &kNS_EXTERNALURLHANDLERSERVICE_CID }, +#endif + { NS_SHENTRY_CONTRACTID, &kNS_SHENTRY_CID }, + { NS_OSPERMISSIONREQUEST_CONTRACTID, &kNS_OSPERMISSIONREQUEST_CID, mozilla::Module::MAIN_PROCESS_ONLY }, + { NS_CHILDPROCESSCHANNELLISTENER_CONTRACTID, &kNS_CHILDPROCESSCHANNELLISTENER_CID, mozilla::Module::CONTENT_PROCESS_ONLY }, + { nullptr } + // clang-format on +}; + +static const mozilla::Module kDocShellModule = { + mozilla::Module::kVersion, + kDocShellCIDs, + kDocShellContracts, + nullptr, + nullptr, + Initialize, + Shutdown, + mozilla::Module::ALLOW_IN_SOCKET_PROCESS}; + +NSMODULE_DEFN(docshell_provider) = &kDocShellModule;
deleted file mode 100644 --- a/docshell/build/nsDocShellModule.h +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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/. */ - -#ifndef nsDocShellModule_h -#define nsDocShellModule_h - -#include "nscore.h" - -namespace mozilla { - -nsresult InitDocShellModule(); - -void UnloadDocShellModule(); - -} // namespace mozilla - -#endif
--- a/docshell/shistory/nsISHEntry.idl +++ b/docshell/shistory/nsISHEntry.idl @@ -392,8 +392,17 @@ interface nsISHEntry : nsISupports /** * Replaces a child which is for the same docshell as aNewChild * with aNewChild. * @throw if nothing was replaced. */ [noscript] void ReplaceChild(in nsISHEntry aNewChild); }; +%{ C++ +// {BFD1A791-AD9F-11d3-BDC7-0050040A9B44} +#define NS_SHENTRY_CID \ +{0xbfd1a791, 0xad9f, 0x11d3, {0xbd, 0xc7, 0x0, 0x50, 0x4, 0xa, 0x9b, 0x44}} + +#define NS_SHENTRY_CONTRACTID \ + "@mozilla.org/browser/session-history-entry;1" +%} +
--- a/dom/base/Link.cpp +++ b/dom/base/Link.cpp @@ -1,30 +1,30 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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 "Link.h" -#include "mozilla/Components.h" #include "mozilla/EventStates.h" #include "mozilla/MemoryReporting.h" #include "mozilla/dom/Element.h" #if defined(MOZ_PLACES) # include "mozilla/places/History.h" #else # include "mozilla/IHistory.h" #endif #include "nsIURL.h" #include "nsIURIMutator.h" #include "nsISizeOf.h" #include "nsIDocShell.h" #include "nsIPrefetchService.h" +#include "nsCPrefetchService.h" #include "nsStyleLinkElement.h" #include "nsEscape.h" #include "nsGkAtoms.h" #include "nsHTMLDNSPrefetch.h" #include "nsString.h" #include "mozAutoDocUpdate.h" @@ -129,17 +129,17 @@ void Link::TryDNSPrefetchOrPreconnectOrP } uint32_t linkTypes = nsStyleLinkElement::ParseLinkTypes(rel); if ((linkTypes & nsStyleLinkElement::ePREFETCH) || (linkTypes & nsStyleLinkElement::eNEXT) || (linkTypes & nsStyleLinkElement::ePRELOAD)) { nsCOMPtr<nsIPrefetchService> prefetchService( - components::Prefetch::Service()); + do_GetService(NS_PREFETCHSERVICE_CONTRACTID)); if (prefetchService) { nsCOMPtr<nsIURI> uri(GetURI()); if (uri) { if (linkTypes & nsStyleLinkElement::ePRELOAD) { nsAttrValue asAttr; nsContentPolicyType policyType; nsAutoString mimeType; nsAutoString media; @@ -204,17 +204,18 @@ void Link::UpdatePreload(nsAtom *aName, } uint32_t linkTypes = nsStyleLinkElement::ParseLinkTypes(rel); if (!(linkTypes & nsStyleLinkElement::ePRELOAD)) { return; } - nsCOMPtr<nsIPrefetchService> prefetchService(components::Prefetch::Service()); + nsCOMPtr<nsIPrefetchService> prefetchService( + do_GetService(NS_PREFETCHSERVICE_CONTRACTID)); if (!prefetchService) { return; } nsCOMPtr<nsIURI> uri(GetURI()); if (!uri) { return; } @@ -304,17 +305,18 @@ void Link::UpdatePreload(nsAtom *aName, if ((policyType != oldPolicyType) || (policyType == nsIContentPolicy::TYPE_INVALID)) { prefetchService->PreloadURI(uri, mElement->OwnerDoc()->GetDocumentURI(), mElement, policyType); } } void Link::CancelPrefetchOrPreload() { - nsCOMPtr<nsIPrefetchService> prefetchService(components::Prefetch::Service()); + nsCOMPtr<nsIPrefetchService> prefetchService( + do_GetService(NS_PREFETCHSERVICE_CONTRACTID)); if (prefetchService) { nsCOMPtr<nsIURI> uri(GetURI()); if (uri) { prefetchService->CancelPrefetchPreloadURI(uri, mElement); } } }
--- a/dom/base/Location.cpp +++ b/dom/base/Location.cpp @@ -6,16 +6,17 @@ #include "Location.h" #include "nsIScriptSecurityManager.h" #include "nsIScriptObjectPrincipal.h" #include "nsIScriptContext.h" #include "nsIDocShell.h" #include "nsDocShellLoadState.h" #include "nsIWebNavigation.h" +#include "nsCDefaultURIFixup.h" #include "nsIURIFixup.h" #include "nsIURL.h" #include "nsIURIMutator.h" #include "nsIJARURI.h" #include "nsNetUtil.h" #include "nsCOMPtr.h" #include "nsEscape.h" #include "nsIDOMWindow.h" @@ -25,17 +26,16 @@ #include "nsError.h" #include "nsReadableUtils.h" #include "nsITextToSubURI.h" #include "nsJSUtils.h" #include "nsContentUtils.h" #include "nsGlobalWindow.h" #include "mozilla/Likely.h" #include "nsCycleCollectionParticipant.h" -#include "mozilla/Components.h" #include "mozilla/NullPrincipal.h" #include "mozilla/Unused.h" #include "mozilla/dom/LocationBinding.h" #include "mozilla/dom/ScriptSettings.h" namespace mozilla { namespace dom { @@ -187,17 +187,18 @@ nsresult Location::GetURI(nsIURI** aURI, while (jarURI) { jarURI->GetJARFile(getter_AddRefs(uri)); jarURI = do_QueryInterface(uri); } } NS_ASSERTION(uri, "nsJARURI screwed up?"); - nsCOMPtr<nsIURIFixup> urifixup(components::URIFixup::Service()); + nsCOMPtr<nsIURIFixup> urifixup(do_GetService(NS_URIFIXUP_CONTRACTID, &rv)); + NS_ENSURE_SUCCESS(rv, rv); return urifixup->CreateExposableURI(uri, aURI); } void Location::SetURI(nsIURI* aURI, nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv, bool aReplace) { nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mDocShell)); if (docShell) {
--- a/dom/base/WindowDestroyedEvent.cpp +++ b/dom/base/WindowDestroyedEvent.cpp @@ -7,20 +7,20 @@ #include "WindowDestroyedEvent.h" #include "nsJSUtils.h" #include "jsapi.h" #include "js/Wrapper.h" #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 { struct BrowserCompartmentMatcher : public js::CompartmentFilter { bool match(JS::Compartment* aC) const override { return !xpc::MightBeWebContentCompartment(aC); } }; @@ -60,17 +60,18 @@ WindowDestroyedEvent::Run() { wrapper->SetData(mID); observerService->NotifyObservers(wrapper, mTopic.get(), nullptr); } switch (mPhase) { case Phase::Destroying: { bool skipNukeCrossCompartment = false; #ifndef DEBUG - nsCOMPtr<nsIAppStartup> appStartup = components::AppStartup::Service(); + nsCOMPtr<nsIAppStartup> appStartup = + do_GetService(NS_APPSTARTUP_CONTRACTID); if (appStartup) { appStartup->GetShuttingDown(&skipNukeCrossCompartment); } #endif if (!skipNukeCrossCompartment) { // The compartment nuking phase might be too expensive, so do that
--- a/dom/base/nsContentSink.cpp +++ b/dom/base/nsContentSink.cpp @@ -5,24 +5,23 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * Base class for the XML and HTML content sinks, which construct a * DOM based on information from the parser. */ #include "nsContentSink.h" -#include "mozilla/Components.h" #include "mozilla/dom/Document.h" #include "mozilla/css/Loader.h" #include "mozilla/dom/SRILogHelper.h" #include "nsStyleLinkElement.h" #include "nsIDocShell.h" #include "nsILoadContext.h" -#include "nsIPrefetchService.h" +#include "nsCPrefetchService.h" #include "nsIURI.h" #include "nsNetUtil.h" #include "nsIMIMEHeaderParam.h" #include "nsIProtocolHandler.h" #include "nsIHttpChannel.h" #include "nsIContent.h" #include "nsIPresShell.h" #include "nsPresContext.h" @@ -821,17 +820,18 @@ nsresult nsContentSink::ProcessMETATag(n return rv; } void nsContentSink::PrefetchPreloadHref(const nsAString& aHref, nsINode* aSource, uint32_t aLinkTypes, const nsAString& aAs, const nsAString& aType, const nsAString& aMedia) { - nsCOMPtr<nsIPrefetchService> prefetchService(components::Prefetch::Service()); + nsCOMPtr<nsIPrefetchService> prefetchService( + do_GetService(NS_PREFETCHSERVICE_CONTRACTID)); if (prefetchService) { // construct URI using document charset auto encoding = mDocument->GetDocumentCharacterSet(); nsCOMPtr<nsIURI> uri; NS_NewURI(getter_AddRefs(uri), aHref, encoding, mDocument->GetDocBaseURI()); if (uri) { if (aLinkTypes & nsStyleLinkElement::ePRELOAD) { nsAttrValue asAttr; @@ -1121,17 +1121,17 @@ void nsContentSink::ProcessOfflineManife } } switch (action) { case CACHE_SELECTION_NONE: break; case CACHE_SELECTION_UPDATE: { nsCOMPtr<nsIOfflineCacheUpdateService> updateService = - components::OfflineCacheUpdate::Service(); + do_GetService(NS_OFFLINECACHEUPDATESERVICE_CONTRACTID); if (updateService) { updateService->ScheduleOnDocumentStop( manifestURI, mDocumentURI, mDocument->NodePrincipal(), mDocument); } break; } case CACHE_SELECTION_RELOAD: {
--- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -35,17 +35,16 @@ #include "mozilla/ArrayUtils.h" #include "mozilla/Attributes.h" #include "mozilla/AutoRestore.h" #include "mozilla/AutoTimelineMarker.h" #include "mozilla/BackgroundHangMonitor.h" #include "mozilla/Base64.h" #include "mozilla/BasePrincipal.h" #include "mozilla/CheckedInt.h" -#include "mozilla/Components.h" #include "mozilla/DebugOnly.h" #include "mozilla/LoadInfo.h" #include "mozilla/dom/BlobURLProtocolHandler.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/dom/CustomElementRegistry.h" #include "mozilla/dom/Document.h" #include "mozilla/dom/MessageBroadcaster.h" #include "mozilla/dom/DocumentFragment.h" @@ -103,16 +102,17 @@ #include "nsCCUncollectableMarker.h" #include "nsCharSeparatedTokenizer.h" #include "nsCOMPtr.h" #include "nsContentCreatorFunctions.h" #include "nsContentDLF.h" #include "nsContentList.h" #include "nsContentPolicyUtils.h" #include "nsContentSecurityManager.h" +#include "nsCPrefetchService.h" #include "nsCRT.h" #include "nsCycleCollectionParticipant.h" #include "nsCycleCollector.h" #include "nsDataHashtable.h" #include "nsDocShellCID.h" #include "nsDOMCID.h" #include "mozilla/dom/DataTransfer.h" #include "nsDOMJSUtils.h" @@ -1783,31 +1783,31 @@ void nsContentUtils::GetOfflineAppManife nsContentUtils::NewURIWithDocumentCharset(aURI, manifestSpec, aDocument, aDocument->GetDocBaseURI()); } /* static */ bool nsContentUtils::OfflineAppAllowed(nsIURI* aURI) { nsCOMPtr<nsIOfflineCacheUpdateService> updateService = - components::OfflineCacheUpdate::Service(); + do_GetService(NS_OFFLINECACHEUPDATESERVICE_CONTRACTID); if (!updateService) { return false; } bool allowed; nsresult rv = updateService->OfflineAppAllowedForURI( aURI, Preferences::GetRootBranch(), &allowed); return NS_SUCCEEDED(rv) && allowed; } /* static */ bool nsContentUtils::OfflineAppAllowed(nsIPrincipal* aPrincipal) { nsCOMPtr<nsIOfflineCacheUpdateService> updateService = - components::OfflineCacheUpdate::Service(); + do_GetService(NS_OFFLINECACHEUPDATESERVICE_CONTRACTID); if (!updateService) { return false; } bool allowed; nsresult rv = updateService->OfflineAppAllowed( aPrincipal, Preferences::GetRootBranch(), &allowed); return NS_SUCCEEDED(rv) && allowed; @@ -1821,17 +1821,17 @@ bool nsContentUtils::MaybeAllowOfflineAp bool allowedByDefault; rv = Preferences::GetRootBranch()->GetBoolPref( "offline-apps.allow_by_default", &allowedByDefault); if (NS_FAILED(rv)) return false; if (!allowedByDefault) return false; nsCOMPtr<nsIOfflineCacheUpdateService> updateService = - components::OfflineCacheUpdate::Service(); + do_GetService(NS_OFFLINECACHEUPDATESERVICE_CONTRACTID); if (!updateService) { return false; } rv = updateService->AllowOfflineApp(aPrincipal); return NS_SUCCEEDED(rv); }
--- a/dom/base/nsGlobalWindowInner.cpp +++ b/dom/base/nsGlobalWindowInner.cpp @@ -144,16 +144,21 @@ #include "nsIScriptError.h" #include "nsIControllers.h" #include "nsIControllerContext.h" #include "nsGlobalWindowCommands.h" #include "nsQueryObject.h" #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" #include "nsIObserverService.h" #include "nsFocusManager.h" #include "nsIXULWindow.h" #include "nsITimedChannel.h" #include "nsServiceManagerUtils.h" #ifdef MOZ_XUL
--- a/dom/base/nsGlobalWindowOuter.cpp +++ b/dom/base/nsGlobalWindowOuter.cpp @@ -90,17 +90,16 @@ #include "mozilla/dom/BarProps.h" #include "nsContentCID.h" #include "nsLayoutStatics.h" #include "nsCCUncollectableMarker.h" #include "mozilla/dom/WorkerCommon.h" #include "mozilla/dom/ToJSValue.h" #include "nsJSPrincipals.h" #include "mozilla/Attributes.h" -#include "mozilla/Components.h" #include "mozilla/Debug.h" #include "mozilla/EventListenerManager.h" #include "mozilla/EventStates.h" #include "mozilla/MouseEvents.h" #include "mozilla/ProcessHangMonitor.h" #include "mozilla/StaticPrefs.h" #include "mozilla/ThrottledEventQueue.h" #include "AudioChannelService.h" @@ -149,16 +148,21 @@ #include "nsIControllers.h" #include "nsIControllerContext.h" #include "nsGlobalWindowCommands.h" #include "nsQueryObject.h" #include "nsContentUtils.h" #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" #include "nsIObserverService.h" #include "nsFocusManager.h" #include "nsIXULWindow.h" #include "nsITimedChannel.h" #include "nsServiceManagerUtils.h" #include "mozilla/dom/CustomEvent.h" @@ -4552,17 +4556,17 @@ void nsGlobalWindowOuter::MakeScriptDial // Try to get a host from the running principal -- this will do the // right thing for javascript: and data: documents. nsCOMPtr<nsIURI> uri; nsresult rv = aSubjectPrincipal->GetURI(getter_AddRefs(uri)); if (NS_SUCCEEDED(rv) && uri) { // remove user:pass for privacy and spoof prevention - nsCOMPtr<nsIURIFixup> fixup(components::URIFixup::Service()); + nsCOMPtr<nsIURIFixup> fixup(do_GetService(NS_URIFIXUP_CONTRACTID)); if (fixup) { nsCOMPtr<nsIURI> fixedURI; rv = fixup->CreateExposableURI(uri, getter_AddRefs(fixedURI)); if (NS_SUCCEEDED(rv) && fixedURI) { nsAutoCString host; fixedURI->GetHost(host); if (!host.IsEmpty()) {
--- a/dom/base/nsObjectLoadingContent.cpp +++ b/dom/base/nsObjectLoadingContent.cpp @@ -69,17 +69,16 @@ #include "GeckoProfiler.h" #include "nsPluginFrame.h" #include "nsWrapperCacheInlines.h" #include "nsDOMJSUtils.h" #include "nsWidgetsCID.h" #include "nsContentCID.h" #include "mozilla/BasicEvents.h" -#include "mozilla/Components.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/Event.h" #include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/PluginCrashedEvent.h" #include "mozilla/AsyncEventDispatcher.h" #include "mozilla/EventDispatcher.h" #include "mozilla/EventStateManager.h" @@ -2236,18 +2235,19 @@ nsresult nsObjectLoadingContent::LoadObj nsLoadFlags flags = 0; mChannel->GetLoadFlags(&flags); flags |= nsIChannel::LOAD_DOCUMENT_URI; mChannel->SetLoadFlags(flags); nsCOMPtr<nsIInterfaceRequestor> req(do_QueryInterface(docShell)); NS_ASSERTION(req, "Docshell must be an ifreq"); - nsCOMPtr<nsIURILoader> uriLoader(components::URILoader::Service()); - if (NS_WARN_IF(!uriLoader)) { + nsCOMPtr<nsIURILoader> uriLoader( + do_GetService(NS_URI_LOADER_CONTRACTID, &rv)); + if (NS_FAILED(rv)) { MOZ_ASSERT_UNREACHABLE("Failed to get uriLoader service"); mFrameLoader->Destroy(); mFrameLoader = nullptr; break; } rv = uriLoader->OpenChannel(mChannel, nsIURILoader::DONT_RETARGET, req, getter_AddRefs(finalListener));
--- a/dom/html/nsHTMLDNSPrefetch.cpp +++ b/dom/html/nsHTMLDNSPrefetch.cpp @@ -15,27 +15,27 @@ #include "nsNetUtil.h" #include "nsNetCID.h" #include "nsIProtocolHandler.h" #include "nsIDNSListener.h" #include "nsIWebProgressListener.h" #include "nsIWebProgress.h" +#include "nsCURILoader.h" #include "nsIDNSRecord.h" #include "nsIDNSService.h" #include "nsICancelable.h" #include "nsGkAtoms.h" #include "mozilla/dom/Document.h" #include "nsThreadUtils.h" #include "nsITimer.h" #include "nsIObserverService.h" #include "mozilla/dom/Link.h" -#include "mozilla/Components.h" #include "mozilla/Preferences.h" using namespace mozilla; using namespace mozilla::dom; using namespace mozilla::net; static NS_DEFINE_CID(kDNSServiceCID, NS_DNSSERVICE_CID); bool sDisablePrefetchHTTPSPref; @@ -405,17 +405,18 @@ void nsHTMLDNSPrefetch::nsDeferrals::Sub if (mTimerArmed) { mTimerArmed = false; mTimer->Cancel(); } } void nsHTMLDNSPrefetch::nsDeferrals::Activate() { // Register as an observer for the document loader - nsCOMPtr<nsIWebProgress> progress = components::DocLoader::Service(); + nsCOMPtr<nsIWebProgress> progress = + do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID); if (progress) progress->AddProgressListener(this, nsIWebProgress::NOTIFY_STATE_DOCUMENT); // Register as an observer for xpcom shutdown events so we can drop any // element refs nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService(); if (observerService)
--- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -28,17 +28,16 @@ #include "imgIContainer.h" #if defined(XP_WIN) && defined(ACCESSIBILITY) # include "mozilla/a11y/AccessibleWrap.h" # include "mozilla/a11y/Compatibility.h" #endif #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" #include "mozilla/docshell/OfflineCacheUpdateParent.h" #include "mozilla/dom/BrowsingContext.h" #include "mozilla/dom/ChromeBrowsingContext.h" #include "mozilla/dom/ClientManager.h" #include "mozilla/dom/ClientOpenWindowOpActors.h" @@ -108,16 +107,17 @@ #include "mozilla/Telemetry.h" #include "mozilla/TelemetryIPC.h" #include "mozilla/WebBrowserPersistDocumentParent.h" #include "mozilla/widget/ScreenManager.h" #include "mozilla/Unused.h" #include "mozilla/HangDetails.h" #include "nsAnonymousTemporaryFile.h" #include "nsAppRunner.h" +#include "nsCDefaultURIFixup.h" #include "nsCExternalHandlerService.h" #include "nsCOMPtr.h" #include "nsChromeRegistryChrome.h" #include "nsConsoleMessage.h" #include "nsConsoleService.h" #include "nsContentUtils.h" #include "nsDebugImpl.h" #include "nsDirectoryServiceDefs.h" @@ -174,16 +174,17 @@ #include "mozilla/dom/ProcessMessageManager.h" #include "mozilla/dom/nsMixedContentBlocker.h" #include "nsMemoryInfoDumper.h" #include "nsMemoryReporterManager.h" #include "nsScriptError.h" #include "nsServiceManagerUtils.h" #include "nsStyleSheetService.h" #include "nsThreadUtils.h" +#include "nsToolkitCompsCID.h" #include "nsWidgetsCID.h" #include "PreallocatedProcessManager.h" #include "ProcessPriorityManager.h" #include "SandboxHal.h" #include "SourceSurfaceRawData.h" #include "TabParent.h" #include "URIUtils.h" #include "nsIWebBrowserChrome.h" @@ -3788,30 +3789,32 @@ mozilla::ipc::IPCResult ContentParent::R } nsCOMPtr<nsIPrincipal> principal; nsresult rv = aAlert->GetPrincipal(getter_AddRefs(principal)); if (NS_WARN_IF(NS_FAILED(rv)) || !HasNotificationPermission(IPC::Principal(principal))) { return IPC_OK(); } - nsCOMPtr<nsIAlertsService> sysAlerts(components::Alerts::Service()); + nsCOMPtr<nsIAlertsService> sysAlerts( + do_GetService(NS_ALERTSERVICE_CONTRACTID)); if (sysAlerts) { sysAlerts->ShowAlert(aAlert, this); } return IPC_OK(); } mozilla::ipc::IPCResult ContentParent::RecvCloseAlert( const nsString& aName, const IPC::Principal& aPrincipal) { if (!HasNotificationPermission(aPrincipal)) { return IPC_OK(); } - nsCOMPtr<nsIAlertsService> sysAlerts(components::Alerts::Service()); + nsCOMPtr<nsIAlertsService> sysAlerts( + do_GetService(NS_ALERTSERVICE_CONTRACTID)); if (sysAlerts) { sysAlerts->CloseAlert(aName, aPrincipal); } return IPC_OK(); } mozilla::ipc::IPCResult ContentParent::RecvDisableNotifications( @@ -4103,17 +4106,17 @@ PBrowserParent* ContentParent::SendPBrow } mozilla::ipc::IPCResult ContentParent::RecvKeywordToURI( const nsCString& aKeyword, nsString* aProviderName, RefPtr<nsIInputStream>* aPostData, OptionalURIParams* aURI) { *aPostData = nullptr; *aURI = void_t(); - nsCOMPtr<nsIURIFixup> fixup = components::URIFixup::Service(); + nsCOMPtr<nsIURIFixup> fixup = do_GetService(NS_URIFIXUP_CONTRACTID); if (!fixup) { return IPC_OK(); } nsCOMPtr<nsIURIFixupInfo> info; if (NS_FAILED(fixup->KeywordToURI(aKeyword, getter_AddRefs(*aPostData), getter_AddRefs(info)))) {
--- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -77,16 +77,17 @@ #include "nsIDOMWindow.h" #include "nsIDOMWindowUtils.h" #include "nsFocusManager.h" #include "EventStateManager.h" #include "nsIDocShell.h" #include "nsIFrame.h" #include "nsIURI.h" #include "nsIURIFixup.h" +#include "nsCDefaultURIFixup.h" #include "nsIWebBrowser.h" #include "nsIWebProgress.h" #include "nsIXULRuntime.h" #include "nsPIDOMWindow.h" #include "nsPIWindowRoot.h" #include "nsPointerHashKeys.h" #include "nsLayoutUtils.h" #include "nsPrintfCString.h"
--- a/dom/notification/Notification.cpp +++ b/dom/notification/Notification.cpp @@ -1,17 +1,16 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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 "mozilla/dom/Notification.h" -#include "mozilla/Components.h" #include "mozilla/Encoding.h" #include "mozilla/EventStateManager.h" #include "mozilla/JSONWriter.h" #include "mozilla/Move.h" #include "mozilla/OwningNonNull.h" #include "mozilla/Preferences.h" #include "mozilla/Services.h" #include "mozilla/StaticPrefs.h" @@ -51,16 +50,17 @@ #include "nsISimpleEnumerator.h" #include "nsIUUIDGenerator.h" #include "nsIXPConnect.h" #include "nsNetUtil.h" #include "nsProxyRelease.h" #include "nsServiceManagerUtils.h" #include "nsStructuredCloneContainer.h" #include "nsThreadUtils.h" +#include "nsToolkitCompsCID.h" #include "nsXULAppAPI.h" namespace mozilla { namespace dom { struct NotificationStrings { const nsString mID; const nsString mTitle; @@ -648,17 +648,18 @@ bool NotificationTelemetryService::GetNo return true; } void NotificationTelemetryService::RecordDNDSupported() { if (mDNDRecorded) { return; } - nsCOMPtr<nsIAlertsService> alertService = components::Alerts::Service(); + nsCOMPtr<nsIAlertsService> alertService = + do_GetService(NS_ALERTSERVICE_CONTRACTID); if (!alertService) { return; } nsCOMPtr<nsIAlertsDoNotDisturb> alertServiceDND = do_QueryInterface(alertService); if (!alertServiceDND) { return; @@ -1405,17 +1406,18 @@ void Notification::ShowInternal() { mozilla::Swap(ownership, mTempRef); MOZ_ASSERT(ownership->GetNotification() == this); nsresult rv = PersistNotification(); if (NS_FAILED(rv)) { NS_WARNING("Could not persist Notification"); } - nsCOMPtr<nsIAlertsService> alertService = components::Alerts::Service(); + nsCOMPtr<nsIAlertsService> alertService = + do_GetService(NS_ALERTSERVICE_CONTRACTID); ErrorResult result; NotificationPermission permission = NotificationPermission::Denied; if (mWorkerPrivate) { permission = GetPermissionInternal(mWorkerPrivate->GetPrincipal(), result); } else { permission = GetPermissionInternal(GetOwner(), result); } @@ -1945,17 +1947,18 @@ void Notification::CloseInternal() { // of this function. This is relevant when the call is from // NotificationTask::Run(). UniquePtr<NotificationRef> ownership; mozilla::Swap(ownership, mTempRef); SetAlertName(); UnpersistNotification(); if (!mIsClosed) { - nsCOMPtr<nsIAlertsService> alertService = components::Alerts::Service(); + nsCOMPtr<nsIAlertsService> alertService = + do_GetService(NS_ALERTSERVICE_CONTRACTID); if (alertService) { nsAutoString alertName; GetAlertName(alertName); alertService->CloseAlert(alertName, GetPrincipal()); } } }
--- a/dom/offline/nsDOMOfflineResourceList.cpp +++ b/dom/offline/nsDOMOfflineResourceList.cpp @@ -2,19 +2,19 @@ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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 "nsDOMOfflineResourceList.h" #include "nsIScriptSecurityManager.h" #include "nsError.h" -#include "mozilla/Components.h" #include "mozilla/dom/DOMStringList.h" #include "nsIPrefetchService.h" +#include "nsCPrefetchService.h" #include "nsMemory.h" #include "nsNetUtil.h" #include "nsNetCID.h" #include "nsServiceManagerUtils.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIOfflineCacheUpdate.h" #include "nsContentUtils.h" #include "nsILoadContext.h" @@ -115,18 +115,18 @@ nsresult nsDOMOfflineResourceList::Init( if (!IS_CHILD_PROCESS()) { mApplicationCacheService = do_GetService(NS_APPLICATIONCACHESERVICE_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); // Check for in-progress cache updates nsCOMPtr<nsIOfflineCacheUpdateService> cacheUpdateService = - components::OfflineCacheUpdate::Service(); - NS_ENSURE_TRUE(cacheUpdateService, NS_ERROR_UNEXPECTED); + do_GetService(NS_OFFLINECACHEUPDATESERVICE_CONTRACTID, &rv); + NS_ENSURE_SUCCESS(rv, rv); uint32_t numUpdates; rv = cacheUpdateService->GetNumUpdates(&numUpdates); NS_ENSURE_SUCCESS(rv, rv); for (uint32_t i = 0; i < numUpdates; i++) { nsCOMPtr<nsIOfflineCacheUpdate> cacheUpdate; rv = cacheUpdateService->GetUpdate(i, getter_AddRefs(cacheUpdate)); @@ -492,19 +492,19 @@ void nsDOMOfflineResourceList::Update(Er } if (!nsContentUtils::OfflineAppAllowed(mDocumentURI)) { aRv.Throw(NS_ERROR_DOM_SECURITY_ERR); return; } nsCOMPtr<nsIOfflineCacheUpdateService> updateService = - components::OfflineCacheUpdate::Service(); - if (NS_WARN_IF(!updateService)) { - aRv.Throw(NS_ERROR_UNEXPECTED); + do_GetService(NS_OFFLINECACHEUPDATESERVICE_CONTRACTID, &rv); + if (NS_WARN_IF(NS_FAILED(rv))) { + aRv.Throw(rv); return; } nsCOMPtr<nsPIDOMWindowInner> window = GetOwner(); nsCOMPtr<nsIOfflineCacheUpdate> update; rv = updateService->ScheduleUpdate(mManifestURI, mDocumentURI, mLoadingPrincipal, window,
--- a/dom/presentation/provider/MulticastDNSDeviceProvider.cpp +++ b/dom/presentation/provider/MulticastDNSDeviceProvider.cpp @@ -104,17 +104,16 @@ NS_IMPL_ISUPPORTS(DNSServiceWrappedListe nsIDNSRegistrationListener, nsIDNSServiceResolveListener, nsIPresentationControlServerListener) NS_IMPL_ISUPPORTS(MulticastDNSDeviceProvider, nsIPresentationDeviceProvider, nsIDNSServiceDiscoveryListener, nsIDNSRegistrationListener, nsIDNSServiceResolveListener, nsIPresentationControlServerListener, nsIObserver) -MulticastDNSDeviceProvider::MulticastDNSDeviceProvider() {} MulticastDNSDeviceProvider::~MulticastDNSDeviceProvider() { Uninit(); } nsresult MulticastDNSDeviceProvider::Init() { MOZ_ASSERT(NS_IsMainThread()); if (mInitialized) { return NS_OK; }
--- a/dom/presentation/provider/MulticastDNSDeviceProvider.h +++ b/dom/presentation/provider/MulticastDNSDeviceProvider.h @@ -40,17 +40,17 @@ class MulticastDNSDeviceProvider final NS_DECL_ISUPPORTS NS_DECL_NSIPRESENTATIONDEVICEPROVIDER NS_DECL_NSIDNSSERVICEDISCOVERYLISTENER NS_DECL_NSIDNSREGISTRATIONLISTENER NS_DECL_NSIDNSSERVICERESOLVELISTENER NS_DECL_NSIPRESENTATIONCONTROLSERVERLISTENER NS_DECL_NSIOBSERVER - explicit MulticastDNSDeviceProvider(); + explicit MulticastDNSDeviceProvider() = default; nsresult Init(); nsresult Uninit(); private: enum class DeviceState : uint32_t { eUnknown, eActive }; class Device final : public nsIPresentationDevice { public:
--- a/dom/presentation/tests/mochitest/PresentationSessionChromeScript.js +++ b/dom/presentation/tests/mochitest/PresentationSessionChromeScript.js @@ -20,33 +20,34 @@ function registerMockedFactory(contractI if (!registrar.isCIDRegistered(mockedClassId)) { try { originalClassId = registrar.contractIDToCID(contractId); originalFactory = Cm.getClassObject(Cc[contractId], Ci.nsIFactory); } catch (ex) { originalClassId = ""; originalFactory = null; } + if (originalFactory) { + registrar.unregisterFactory(originalClassId, originalFactory); + } registrar.registerFactory(mockedClassId, "", contractId, mockedFactory); } return { contractId, mockedClassId, mockedFactory, originalClassId, originalFactory }; } function registerOriginalFactory(contractId, mockedClassId, mockedFactory, originalClassId, originalFactory) { if (originalFactory) { var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); registrar.unregisterFactory(mockedClassId, mockedFactory); - // Passing null for the factory remaps the original CID to the - // contract ID. - registrar.registerFactory(originalClassId, "", contractId, null); + registrar.registerFactory(originalClassId, "", contractId, originalFactory); } } var sessionId = "test-session-id-" + uuidGenerator.generateUUID().toString(); const address = Cc["@mozilla.org/supports-cstring;1"] .createInstance(Ci.nsISupportsCString); address.data = "127.0.0.1";
--- a/dom/security/nsContentSecurityManager.cpp +++ b/dom/security/nsContentSecurityManager.cpp @@ -11,25 +11,25 @@ #include "nsIHttpChannelInternal.h" #include "nsINode.h" #include "nsIStreamListener.h" #include "nsILoadInfo.h" #include "nsIOService.h" #include "nsContentUtils.h" #include "nsCORSListenerProxy.h" #include "nsIStreamListener.h" +#include "nsCDefaultURIFixup.h" #include "nsIURIFixup.h" #include "nsIImageLoadingContent.h" #include "nsIRedirectHistoryEntry.h" #include "mozilla/BasePrincipal.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/nsMixedContentBlocker.h" #include "mozilla/dom/TabChild.h" -#include "mozilla/Components.h" #include "mozilla/Logging.h" NS_IMPL_ISUPPORTS(nsContentSecurityManager, nsIContentSecurityManager, nsIChannelEventSink) static mozilla::LazyLogModule sCSMLog("CSMLog"); /* static */ bool nsContentSecurityManager::AllowTopLevelNavigationToDataURI( @@ -375,18 +375,18 @@ static nsresult DoContentSecurityChecks( nsresult rv = NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri)); NS_ENSURE_SUCCESS(rv, rv); if (contentPolicyType == nsIContentPolicy::TYPE_DOCUMENT || contentPolicyType == nsIContentPolicy::TYPE_SUBDOCUMENT) { // TYPE_DOCUMENT and TYPE_SUBDOCUMENT loads might potentially // be wyciwyg:// channels. Let's fix up the URI so we can // perform proper security checks. - nsCOMPtr<nsIURIFixup> urifixup(components::URIFixup::Service()); - if (urifixup) { + nsCOMPtr<nsIURIFixup> urifixup(do_GetService(NS_URIFIXUP_CONTRACTID, &rv)); + if (NS_SUCCEEDED(rv) && urifixup) { nsCOMPtr<nsIURI> fixedURI; rv = urifixup->CreateExposableURI(uri, getter_AddRefs(fixedURI)); if (NS_SUCCEEDED(rv)) { uri = fixedURI; } } } @@ -917,18 +917,18 @@ nsresult nsContentSecurityManager::Check nsContentPolicyType contentPolicyType = loadInfo->GetExternalContentPolicyType(); if (contentPolicyType == nsIContentPolicy::TYPE_DOCUMENT || contentPolicyType == nsIContentPolicy::TYPE_SUBDOCUMENT) { // TYPE_DOCUMENT and TYPE_SUBDOCUMENT loads might potentially // be wyciwyg:// channels. Let's fix up the URI so we can // perform proper security checks. - nsCOMPtr<nsIURIFixup> urifixup(components::URIFixup::Service()); - if (urifixup) { + nsCOMPtr<nsIURIFixup> urifixup(do_GetService(NS_URIFIXUP_CONTRACTID, &rv)); + if (NS_SUCCEEDED(rv) && urifixup) { nsCOMPtr<nsIURI> fixedURI; rv = urifixup->CreateExposableURI(uri, getter_AddRefs(fixedURI)); if (NS_SUCCEEDED(rv)) { uri = fixedURI; } } }
--- a/dom/system/nsOSPermissionRequestBase.h +++ b/dom/system/nsOSPermissionRequestBase.h @@ -5,16 +5,24 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef nsOSPermissionRequestBase_h__ #define nsOSPermissionRequestBase_h__ #include "nsIOSPermissionRequest.h" #include "nsWeakReference.h" +#define NS_OSPERMISSIONREQUEST_CID \ + { \ + 0x95790842, 0x75a0, 0x430d, { \ + 0x98, 0xbf, 0xf5, 0xce, 0x37, 0x88, 0xea, 0x6d \ + } \ + } +#define NS_OSPERMISSIONREQUEST_CONTRACTID "@mozilla.org/ospermissionrequest;1" + namespace mozilla { namespace dom { class Promise; } // namespace dom } // namespace mozilla using mozilla::dom::Promise;
--- a/extensions/pref/autoconfig/src/nsReadConfig.cpp +++ b/extensions/pref/autoconfig/src/nsReadConfig.cpp @@ -1,37 +1,35 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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 "nsReadConfig.h" #include "nsJSConfigTriggers.h" -#include "mozilla/Components.h" #include "nsAppDirectoryServiceDefs.h" #include "nsIAppStartup.h" #include "nsContentUtils.h" #include "nsDirectoryServiceDefs.h" #include "nsIComponentManager.h" #include "nsIFile.h" #include "nsIObserverService.h" #include "nsIPrefBranch.h" #include "nsIPrefService.h" #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; extern nsresult CentralizedAdminPrefManagerInit(bool aSandboxEnabled); extern nsresult CentralizedAdminPrefManagerFinish(); static nsresult DisplayError(void) { @@ -98,17 +96,17 @@ NS_IMETHODIMP nsReadConfig::Observe(nsIS "https://support.mozilla.org/products/" "firefox-enterprise for more information."), nsIScriptError::warningFlag, NS_LITERAL_CSTRING("autoconfig"), nullptr); } else { rv = DisplayError(); if (NS_FAILED(rv)) { nsCOMPtr<nsIAppStartup> appStartup = - components::AppStartup::Service(); + do_GetService(NS_APPSTARTUP_CONTRACTID); if (appStartup) appStartup->Quit(nsIAppStartup::eAttemptQuit); } } } } return rv; }
--- a/js/xpconnect/src/XPCModule.h +++ b/js/xpconnect/src/XPCModule.h @@ -1,25 +1,37 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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 "xpcprivate.h" +#include "mozilla/ModuleUtils.h" #include "mozJSSubScriptLoader.h" /* Module implementation for the xpconnect library. */ #define XPCVARIANT_CONTRACTID "@mozilla.org/xpcvariant;1" // {FE4F7592-C1FC-4662-AC83-538841318803} #define SCRIPTABLE_INTERFACES_CID \ { \ 0xfe4f7592, 0xc1fc, 0x4662, { \ 0xac, 0x83, 0x53, 0x88, 0x41, 0x31, 0x88, 0x3 \ } \ } #define MOZJSSUBSCRIPTLOADER_CONTRACTID "@mozilla.org/moz/jssubscript-loader;1" +NS_GENERIC_FACTORY_CONSTRUCTOR(mozJSSubScriptLoader) + +NS_DEFINE_NAMED_CID(MOZ_JSSUBSCRIPTLOADER_CID); + +#define XPCONNECT_CIDENTRIES \ + {&kMOZ_JSSUBSCRIPTLOADER_CID, false, nullptr, \ + mozJSSubScriptLoaderConstructor}, + +#define XPCONNECT_CONTRACTS \ + {MOZJSSUBSCRIPTLOADER_CONTRACTID, &kMOZ_JSSUBSCRIPTLOADER_CID}, + nsresult xpcModuleCtor(); void xpcModuleDtor();
deleted file mode 100644 --- a/js/xpconnect/src/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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 = [ - { - 'cid': '{929814d6-1dd2-11b2-8e08-82fa0a339b00}', - 'contract_ids': ['@mozilla.org/moz/jssubscript-loader;1'], - 'type': 'mozJSSubScriptLoader', - 'headers': ['/js/xpconnect/loader/mozJSSubScriptLoader.h'], - }, -]
--- a/js/xpconnect/src/moz.build +++ b/js/xpconnect/src/moz.build @@ -39,20 +39,16 @@ UNIFIED_SOURCES += [ 'XPCWrappedNative.cpp', 'XPCWrappedNativeInfo.cpp', 'XPCWrappedNativeJSOps.cpp', 'XPCWrappedNativeProto.cpp', 'XPCWrappedNativeScope.cpp', 'XPCWrapper.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' LOCAL_INCLUDES += [ '../loader', '../wrappers', '/caps',
deleted file mode 100644 --- a/layout/build/components.conf +++ /dev/null @@ -1,458 +0,0 @@ -# -*- 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/. - -Headers = [ - '/layout/build/nsLayoutModule.h', -] - -UnloadFunc = 'nsLayoutModuleDtor' - -# This module's unload function needs to be called as late as possible. -Priority = 100 - -content_types = [ - 'application/ecmascript', - 'application/javascript', - 'application/json', - 'application/mathml+xml', - 'application/rdf+xml', - 'application/vnd.mozilla.xul+xml', - 'application/vnd.wap.xhtml+xml', - 'application/x-javascript', - 'application/x-view-source', - 'application/xhtml+xml', - 'application/xml', - 'image/svg+xml', - 'mozilla.application/cached-xul', - 'text/cache-manifest', - 'text/css', - 'text/ecmascript', - 'text/html', - 'text/javascript', - 'text/json', - 'text/plain', - 'text/rdf', - 'text/vtt', - 'text/xml', -] - -if defined('MOZ_WEBM'): - content_types += [ - "audio/webm", - "video/webm", - ] - -Classes = [ - { - 'cid': '{1691e1f4-ee41-11d4-9885-00c04fa0cf4b}', - 'type': 'nsIFrameTraversal', - }, - { - 'cid': '{574ce83e-fe9f-4095-b85c-7909abbf7c37}', - 'type': 'nsJSURI::Mutator', - 'headers': ['nsJSProtocolHandler.h'], - }, - { - 'cid': '{58f089ee-512a-42d2-a935-d0c874128930}', - 'type': 'nsJSURI::Mutator', - 'headers': ['nsJSProtocolHandler.h'], - }, - { - 'cid': '{972d8d8f-f0da-11d4-9885-00c04fa0cf4b}', - 'type': 'nsIContentViewer', - }, - { - 'cid': '{bbe50ef2-80eb-469d-b70d-02858275389f}', - 'type': 'mozilla::dom::BlobURL::Mutator', - 'headers': ['mozilla/dom/BlobURL.h'], - }, - { - 'cid': '{f5475c51-59a7-4757-b3d9-e211a9410872}', - 'type': 'mozilla::dom::BlobURL::Mutator', - 'headers': ['mozilla/dom/BlobURL.h'], - }, - { - 'cid': '{fe0ff7c3-8e97-448b-9a8a-86afdb9fbbb6}', - 'contract_ids': ['@mozilla.org/childprocessmessagemanager;1'], - 'legacy_constructor': 'CreateChildMessageManager', - }, - { - 'cid': '{fc886801-e768-11d4-9885-00c04fa0cf4b}', - 'contract_ids': ['@mozilla.org/content/document-loader-factory;1'], - 'type': 'nsIDocumentLoaderFactory', - 'categories': {'Gecko-Content-Viewers': content_types}, - }, - { - 'cid': '{0ddf4df8-4dbb-4133-8b79-9afb966514f5}', - 'contract_ids': ['@mozilla.org/content/plugin/document-loader-factory;1'], - 'type': 'nsIDocumentLoaderFactory', - }, - { - 'cid': '{3b55e72e-ab7e-431b-89c0-3b06a8b14016}', - 'contract_ids': ['@mozilla.org/content/style-sheet-service;1'], - 'type': 'nsStyleSheetService', - 'headers': ['nsStyleSheetService.h'], - 'init_method': 'Init', - }, - { - 'cid': '{cdcc1ab8-3cea-4e6c-a294-a651fa35227f}', - 'contract_ids': ['@mozilla.org/contentsecuritymanager;1'], - 'type': 'nsContentSecurityManager', - 'headers': ['mozilla/dom/nsContentSecurityManager.h'], - }, - { - 'cid': '{09d9ed1a-e5d4-4004-bfe0-27ceb923d9ac}', - 'contract_ids': ['@mozilla.org/cspcontext;1'], - 'type': 'nsCSPContext', - 'headers': ['mozilla/dom/nsCSPContext.h'], - }, - { - 'cid': '{8d2f40b2-4875-4c95-97d9-3f7dca2cb460}', - 'contract_ids': ['@mozilla.org/cspservice;1'], - 'type': 'CSPService', - 'headers': ['mozilla/dom/nsCSPService.h'], - 'categories': {'content-policy': 'CSPService', 'net-channel-event-sinks': 'CSPService'}, - }, - { - 'cid': '{1147d32c-215b-4014-b180-07fe7aedf915}', - 'contract_ids': ['@mozilla.org/data-document-content-policy;1'], - 'type': 'nsDataDocumentContentPolicy', - 'headers': ['/dom/base/nsDataDocumentContentPolicy.h'], - 'categories': {'content-policy': '@mozilla.org/data-document-content-policy;1'}, - }, - { - 'cid': '{ecba5203-77da-465a-865e-78b7af10d8f7}', - 'contract_ids': ['@mozilla.org/devicesensors;1'], - 'type': 'nsDeviceSensors', - 'headers': ['nsDeviceSensors.h'], - }, - { - 'cid': '{38bd0634-0fd4-46f0-b85f-13ced889eeec}', - 'contract_ids': ['@mozilla.org/docshell/structured-clone-container;1'], - 'type': 'nsStructuredCloneContainer', - 'headers': ['nsStructuredCloneContainer.h'], - }, - { - 'cid': '{3160e271-138d-4cc7-9d63-6429f16957c7}', - 'contract_ids': ['@mozilla.org/dom/dom-request-service;1'], - 'singleton': True, - 'type': 'mozilla::dom::DOMRequestService', - 'headers': ['mozilla/dom/DOMRequest.h'], - 'constructor': 'mozilla::dom::DOMRequestService::FactoryCreate', - }, - { - 'cid': '{656db07c-aa80-49e4-bce8-e431baae697d}', - 'contract_ids': ['@mozilla.org/dom/localStorage-manager;1'], - 'legacy_constructor': 'LocalStorageManagerConstructor', - }, - { - 'cid': '{5a75c25a-5e7e-4d90-8f7c-07eb15cc0aa8}', - 'contract_ids': ['@mozilla.org/dom/quota-manager-service;1'], - 'singleton': True, - 'type': 'mozilla::dom::quota::QuotaManagerService', - 'headers': ['mozilla/dom/quota/QuotaManagerService.h'], - 'constructor': 'mozilla::dom::quota::QuotaManagerService::FactoryCreate', - 'categories': {'idle-daily': 'QuotaManagerService'}, - }, - { - 'cid': '{ae2793c0-2ba3-4adb-9c5e-c23525812c64}', - 'contract_ids': ['@mozilla.org/dom/sdb-connection;1'], - 'legacy_constructor': 'mozilla::dom::SDBConnection::Create', - 'headers': ['mozilla/dom/SDBConnection.h'], - }, - { - 'cid': '{62ec8731-55ad-4246-b2ea-f26c1fe19d2d}', - 'contract_ids': ['@mozilla.org/dom/workers/workerdebuggermanager;1'], - 'singleton': True, - 'type': 'mozilla::dom::WorkerDebuggerManager', - 'headers': ['mozilla/dom/WorkerDebuggerManager.h'], - 'constructor': 'mozilla::dom::WorkerDebuggerManager::GetInstance', - }, - { - 'cid': '{baa34652-f1f1-4185-b224-244ee82a413a}', - 'contract_ids': ['@mozilla.org/eventlistenerservice;1'], - 'type': 'nsIEventListenerService', - }, - { - 'cid': '{e8ee88b0-5571-4086-a45b-39a716906bdb}', - 'contract_ids': ['@mozilla.org/expandedprincipal;1'], - 'type': 'ExpandedPrincipal', - 'headers': ['/caps/ExpandedPrincipal.h'], - }, - { - 'cid': '{cf7fd51f-aba2-44c1-9ff0-11f7508efcd4}', - 'contract_ids': ['@mozilla.org/focus-manager;1'], - 'type': 'nsIFocusManager', - }, - { - 'cid': '{7b121f7e-ebe4-43ab-9410-dc9087a1dba6}', - 'contract_ids': ['@mozilla.org/gecko-media-plugin-service;1'], - 'singleton': True, - 'type': 'mozilla::gmp::GeckoMediaPluginService', - 'headers': ['GMPService.h'], - 'constructor': 'mozilla::gmp::GeckoMediaPluginService::GetGeckoMediaPluginService', - }, - { - 'cid': '{01e1c3ff-094a-d048-44b4-62d29c7b4f39}', - 'contract_ids': ['@mozilla.org/geolocation;1'], - 'singleton': True, - 'type': 'mozilla::dom::Geolocation', - 'headers': ['/dom/geolocation/nsGeolocation.h'], - 'constructor': 'mozilla::dom::Geolocation::NonWindowSingleton', - }, - { - 'cid': '{130b016f-fad7-4526-bc7f-827dabf79265}', - 'contract_ids': ['@mozilla.org/globalmessagemanager;1'], - 'legacy_constructor': 'CreateGlobalMessageManager', - }, - { - 'cid': '{bfcb82c2-5611-4318-90d6-baf4a7864252}', - 'contract_ids': ['@mozilla.org/inspector/deep-tree-walker;1'], - 'type': 'inDeepTreeWalker', - 'headers': ['/layout/inspector/inDeepTreeWalker.h'], - }, - { - 'cid': '{0e3afd3d-eb60-4c2b-963b-56d7c439f124}', - 'contract_ids': ['@mozilla.org/layout/content-policy;1'], - 'legacy_constructor': 'CreateContentPolicy', - }, - { - 'cid': '{4aef38b7-6364-4e23-a5e7-12f837fbbd9c}', - 'contract_ids': [ - '@mozilla.org/layout/contentserializer;1?mimetype=application/vnd.mozilla.xul+xml', - '@mozilla.org/layout/contentserializer;1?mimetype=application/xml', - '@mozilla.org/layout/contentserializer;1?mimetype=image/svg+xml', - '@mozilla.org/layout/contentserializer;1?mimetype=text/xml', - ], - 'type': 'nsIContentSerializer', - 'legacy_constructor': 'CreateXMLContentSerializer', - }, - { - 'cid': '{e7c2aaf5-c11a-4954-9dbf-e28edec1fd91}', - 'contract_ids': ['@mozilla.org/layout/contentserializer;1?mimetype=application/xhtml+xml'], - 'legacy_constructor': 'CreateXHTMLContentSerializer', - }, - { - 'cid': '{9d3f70da-86e9-11d4-95ec-00b0d03e37b7}', - 'contract_ids': ['@mozilla.org/layout/contentserializer;1?mimetype=text/html'], - 'type': 'nsIContentSerializer', - 'legacy_constructor': 'CreateHTMLContentSerializer', - }, - { - 'cid': '{6030f7ef-32ed-46a7-9a63-6a5d3f90445f}', - 'contract_ids': ['@mozilla.org/layout/contentserializer;1?mimetype=text/plain'], - 'legacy_constructor': 'CreatePlainTextSerializer', - }, - { - 'cid': '{abc622ea-9655-4123-80d9-22621bdd5465}', - 'contract_ids': ['@mozilla.org/mediaManagerService;1'], - 'singleton': True, - 'type': 'nsIMediaManagerService', - 'headers': ['mozilla/MediaManager.h'], - 'constructor': 'mozilla::MediaManager::GetInstance', - }, - { - 'cid': '{daf1461b-bf29-4f88-8d0e-4bcdf332c862}', - 'contract_ids': ['@mozilla.org/mixedcontentblocker;1'], - 'type': 'nsMixedContentBlocker', - 'headers': ['mozilla/dom/nsMixedContentBlocker.h'], - 'categories': { - 'content-policy': '@mozilla.org/mixedcontentblocker;1', - 'net-channel-event-sinks': '@mozilla.org/mixedcontentblocker;1', - }, - }, - { - 'cid': '{4bbe1b96-8956-457f-a03f-9c27435f2afa}', - 'contract_ids': ['@mozilla.org/net/osfileconstantsservice;1'], - 'singleton': True, - 'type': 'mozilla::OSFileConstantsService', - 'headers': ['mozilla/OSFileConstants.h'], - 'constructor': 'mozilla::OSFileConstantsService::GetOrCreate', - }, - { - 'cid': '{bfc310d2-38a0-11d3-8cd3-0060b0fc14a3}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=javascript'], - 'legacy_constructor': 'nsJSProtocolHandler::Create', - 'headers': ['nsJSProtocolHandler.h'], - }, - { - 'cid': '{ac9e3e82-bfbd-4f26-941e-f58c8ee178c1}', - 'contract_ids': ['@mozilla.org/no-data-protocol-content-policy;1'], - 'type': 'nsNoDataProtocolContentPolicy', - 'headers': ['/dom/base/nsNoDataProtocolContentPolicy.h'], - 'categories': {'content-policy': '@mozilla.org/no-data-protocol-content-policy;1'}, - }, - { - 'cid': '{5995b782-6a0e-4066-aac5-276f0a9ad8cf}', - 'contract_ids': ['@mozilla.org/notificationTelemetryService;1'], - 'type': 'mozilla::dom::NotificationTelemetryService', - 'headers': ['mozilla/dom/Notification.h'], - 'init_method': 'Init', - }, - { - 'cid': '{bd066e5f-146f-4472-8331-7bfd05b1ed90}', - 'contract_ids': ['@mozilla.org/nullprincipal;1'], - 'type': 'mozilla::NullPrincipal', - 'headers': ['/caps/NullPrincipal.h'], - 'init_method': 'Init', - }, - { - 'cid': '{2a058404-fb85-44ec-8cfd-e8cbdc988dc1}', - 'contract_ids': ['@mozilla.org/parentprocessmessagemanager;1'], - 'legacy_constructor': 'CreateParentMessageManager', - }, - { - 'cid': '{af7b24cb-893f-41bb-961f-5a69388e27c3}', - 'contract_ids': ['@mozilla.org/parserutils;1'], - 'type': 'nsParserUtils', - 'headers': ['nsParserUtils.h'], - }, - { - 'cid': '{e1e79dec-4085-4994-ac5b-744b016697e6}', - 'contract_ids': ['@mozilla.org/presentation-device/manager;1'], - 'type': 'mozilla::dom::PresentationDeviceManager', - 'headers': ['mozilla/dom/PresentationDeviceManager.h'], - 'categories': {'profile-after-change': 'PresentationDeviceManager'}, - }, - { - 'cid': '{1d9bb10c-c0ab-4fe8-9e4f-4058b8519832}', - 'contract_ids': ['@mozilla.org/presentation/presentationservice;1'], - 'singleton': True, - 'type': 'nsIPresentationService', - 'constructor': 'NS_CreatePresentationService', - 'headers': ['nsIPresentationService.h', '/layout/build/nsLayoutModule.h'], - 'categories': {'profile-after-change': 'PresentationService'}, - }, - { - 'cid': '{c9d023f4-6228-4c07-8b1d-9c19573faa27}', - 'contract_ids': ['@mozilla.org/presentation/presentationtcpsessiontransport;1'], - 'type': 'mozilla::dom::PresentationTCPSessionTransport', - 'headers': ['mozilla/dom/PresentationTCPSessionTransport.h'], - }, - { - 'cid': '{653e0e4d-3ee4-45fa-b272-97c20bc01eb8}', - 'contract_ids': ['@mozilla.org/principal;1'], - 'type': 'mozilla::ContentPrincipal', - 'headers': ['/caps/ContentPrincipal.h'], - }, - { - 'cid': '{2fc2d3e3-020f-404e-b06a-6ecf3ea2334a}', - 'contract_ids': ['@mozilla.org/push/Notifier;1'], - 'type': 'mozilla::dom::PushNotifier', - 'headers': ['mozilla/dom/PushNotifier.h'], - }, - { - 'cid': '{f68037ec-2790-44c5-8e5f-df5da58b93a7}', - 'contract_ids': ['@mozilla.org/scriptable-content-iterator;1'], - 'type': 'ScriptableContentIterator', - 'headers': ['mozilla/ScriptableContentIterator.h'], - }, - { - 'cid': '{1950539a-90f0-4d22-b5af-71329c68fa35}', - 'contract_ids': ['@mozilla.org/scripterror;1'], - 'type': 'nsScriptError', - 'headers': ['/dom/bindings/nsScriptError.h'], - }, - { - 'cid': '{7ee2a4c0-4b93-17d3-ba18-0060b0f199a2}', - 'contract_ids': ['@mozilla.org/scriptsecuritymanager;1'], - 'legacy_constructor': 'Construct_nsIScriptSecurityManager', - }, - { - 'cid': '{c74bde32-bcc7-4840-8430-c733351b212a}', - 'contract_ids': ['@mozilla.org/serviceworkers/manager;1'], - 'singleton': True, - 'type': 'mozilla::dom::ServiceWorkerManager', - 'headers': ['mozilla/dom/ServiceWorkerManager.h'], - 'constructor': 'mozilla::dom::ServiceWorkerManager::GetInstance', - }, - { - 'cid': '{69da374a-fda3-4a93-9fbc-d9304f66a7fe}', - 'contract_ids': ['@mozilla.org/storage/activity-service;1'], - 'singleton': True, - 'type': 'mozilla::dom::StorageActivityService', - 'headers': ['mozilla/StaticPtr.h', 'mozilla/dom/StorageActivityService.h'], - 'constructor': 'mozilla::dom::StorageActivityService::GetOrCreate', - }, - { - 'cid': '{4a6212db-accb-11d3-b765-0060b0b6cecb}', - 'contract_ids': ['@mozilla.org/systemprincipal;1'], - 'singleton': True, - 'type': 'nsIPrincipal', - 'headers': ['nsScriptSecurityManager.h', '/caps/SystemPrincipal.h'], - 'constructor': 'nsScriptSecurityManager::SystemPrincipalSingletonConstructor', - }, - { - 'cid': '{caaab47f-1e31-478e-8919-970904e9cb72}', - 'contract_ids': ['@mozilla.org/text-input-processor;1'], - 'type': 'mozilla::TextInputProcessor', - 'headers': ['mozilla/TextInputProcessor.h'], - }, - { - 'cid': '{08c6cc8b-cfb0-421d-b1f7-683ff2989681}', - 'contract_ids': ['@mozilla.org/thirdpartyutil;1'], - 'type': 'ThirdPartyUtil', - 'headers': ['/dom/base/ThirdPartyUtil.h'], - 'init_method': 'Init', - }, - { - 'cid': '{31689828-da66-49a6-870c-df62b83fe789}', - 'contract_ids': ['@mozilla.org/websocketevent/service;1'], - 'singleton': True, - 'type': 'mozilla::net::WebSocketEventService', - 'headers': ['mozilla/net/WebSocketEventService.h'], - 'constructor': 'mozilla::net::WebSocketEventService::GetOrCreate', - }, -] - -if defined('DEBUG'): - Classes += [ - { - 'cid': '{NS_LAYOUT_DEBUGGER_CID}', - 'type': 'nsILayoutDebugger', - }, - ] - -if defined('MOZ_WEBSPEECH'): - Classes += [ - { - 'cid': '{7090524d-5574-4492-a77f-d8d558ced59d}', - 'contract_ids': ['@mozilla.org/synth-voice-registry;1'], - 'singleton': True, - 'type': 'mozilla::dom::nsSynthVoiceRegistry', - 'headers': ['mozilla/dom/nsSynthVoiceRegistry.h'], - 'constructor': 'mozilla::dom::nsSynthVoiceRegistry::GetInstanceForService', - }, - ] - -if defined('MOZ_WEBSPEECH_TEST_BACKEND'): - Classes += [ - { - 'cid': '{48c345e7-9929-4f9a-a563-f478222dabcd}', - 'contract_ids': ['@mozilla.org/webspeech/service;1?name=fake'], - 'type': 'mozilla::FakeSpeechRecognitionService', - 'headers': ['mozilla/dom/FakeSpeechRecognitionService.h'], - }, - ] - -if defined('ACCESSIBILITY'): - Classes += [ - { - 'cid': '{3b265b69-f813-48ff-880d-d88d101af404}', - 'contract_ids': ['@mozilla.org/accessibilityService;1'], - 'type': 'nsIAccessibilityService', - }, - ] - -if defined('ANDROID'): - Classes += [ - { - 'cid': '{1f15dbc8-bfaa-45de-8a46-08e2e26326b0}', - 'contract_ids': ['@mozilla.org/widget/hapticfeedback;1'], - 'type': 'nsHapticFeedback', - 'headers': ['/dom/system/android/nsHapticFeedback.h'], - }, - ]
--- a/layout/build/moz.build +++ b/layout/build/moz.build @@ -66,16 +66,18 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co '/dom/system/mac', ] elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': LOCAL_INCLUDES += [ '/dom/system', '/dom/system/android', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] +if CONFIG['MOZ_WEBSPEECH']: + LOCAL_INCLUDES += [ + '/dom/media/webspeech/recognition', + '/dom/media/webspeech/synth', + ] FINAL_LIBRARY = 'xul' if CONFIG['CC_TYPE'] in ('clang', 'gcc'): CXXFLAGS += ['-Wno-error=shadow']
--- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -2,94 +2,225 @@ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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 "base/basictypes.h" #include "XPCModule.h" -#include "mozilla/Components.h" #include "mozilla/ModuleUtils.h" #include "nsImageModule.h" #include "nsLayoutStatics.h" #include "nsContentCID.h" #include "nsContentDLF.h" #include "nsContentPolicyUtils.h" #include "nsDataDocumentContentPolicy.h" #include "nsNoDataProtocolContentPolicy.h" #include "nsDOMCID.h" #include "nsFrameMessageManager.h" #include "nsHTMLContentSerializer.h" #include "nsHTMLParts.h" +#include "nsIComponentManager.h" #include "nsIContentSerializer.h" #include "nsIContentViewer.h" +#include "nsIController.h" +#include "nsIControllers.h" +#include "nsIFactory.h" +#include "nsIIdleService.h" +#include "nsHTMLStyleSheet.h" #include "nsILayoutDebugger.h" +#include "nsNameSpaceManager.h" +#include "nsIObserver.h" +#include "nsIObserverService.h" +#include "nsIScriptError.h" +#include "nsCaret.h" #include "nsPlainTextSerializer.h" #include "nsXMLContentSerializer.h" #include "nsXHTMLContentSerializer.h" +#include "nsContentAreaDragDrop.h" #include "nsIFrameTraversal.h" #include "nsLayoutCID.h" +#include "nsStyleSheetService.h" #include "nsFocusManager.h" #include "ThirdPartyUtil.h" +#include "nsStructuredCloneContainer.h" #include "gfxPlatform.h" #include "mozilla/gfx/gfxVars.h" -#include "mozilla/dom/quota/QuotaManagerService.h" #include "nsIEventListenerService.h" #include "nsIMessageManager.h" +// Transformiix stuff +#include "mozilla/dom/XPathEvaluator.h" + // view stuff #include "nsContentCreatorFunctions.h" +#include "nsGlobalWindowCommands.h" +#include "nsJSProtocolHandler.h" +#include "nsIControllerContext.h" +#include "nsZipArchive.h" +#include "mozilla/Attributes.h" +#include "mozilla/dom/BlobURL.h" +#include "mozilla/dom/DOMRequest.h" +#include "mozilla/dom/SDBConnection.h" #include "mozilla/dom/LocalStorageCommon.h" #include "mozilla/dom/LocalStorageManager.h" #include "mozilla/dom/LocalStorageManager2.h" +#include "mozilla/dom/quota/QuotaManagerService.h" +#include "mozilla/dom/ServiceWorkerManager.h" +#include "mozilla/dom/StorageActivityService.h" +#include "mozilla/dom/WorkerDebuggerManager.h" +#include "mozilla/dom/Notification.h" +#include "mozilla/OSFileConstants.h" +#ifdef MOZ_WEBSPEECH_TEST_BACKEND +# include "mozilla/dom/FakeSpeechRecognitionService.h" +#endif #ifdef MOZ_WEBSPEECH # include "mozilla/dom/nsSynthVoiceRegistry.h" #endif #include "mozilla/dom/PushNotifier.h" using mozilla::dom::PushNotifier; #define PUSHNOTIFIER_CID \ { \ 0x2fc2d3e3, 0x020f, 0x404e, { \ 0xb0, 0x6a, 0x6e, 0xcf, 0x3e, 0xa2, 0x33, 0x4a \ } \ } +// Editor stuff +#include "mozilla/EditorController.h" //CID + #include "nsScriptSecurityManager.h" +#include "ExpandedPrincipal.h" +#include "mozilla/ContentPrincipal.h" +#include "mozilla/NullPrincipal.h" +#include "mozilla/SystemPrincipal.h" #include "nsNetCID.h" #if defined(MOZ_WIDGET_ANDROID) # include "nsHapticFeedback.h" #endif #include "nsParserUtils.h" +#include "nsHTMLCanvasFrame.h" + class nsIDocumentLoaderFactory; #define PRODUCT_NAME "Gecko" /* 0ddf4df8-4dbb-4133-8b79-9afb966514f5 */ #define NS_PLUGINDOCLOADERFACTORY_CID \ { \ 0x0ddf4df8, 0x4dbb, 0x4133, { \ 0x8b, 0x79, 0x9a, 0xfb, 0x96, 0x65, 0x14, 0xf5 \ } \ } #include "inDeepTreeWalker.h" static void Shutdown(); +#include "nsGeolocation.h" +#include "nsDeviceSensors.h" #include "mozilla/dom/nsContentSecurityManager.h" +#include "mozilla/dom/nsCSPService.h" +#include "mozilla/dom/nsCSPContext.h" +#include "nsIMediaManager.h" +#include "mozilla/dom/nsMixedContentBlocker.h" + +#include "mozilla/net/WebSocketEventService.h" + +#include "nsIPresentationService.h" + +#include "MediaManager.h" + +#include "GMPService.h" + +#include "mozilla/dom/PresentationDeviceManager.h" +#include "mozilla/dom/PresentationTCPSessionTransport.h" + +#include "nsScriptError.h" +#include "nsBaseCommandController.h" +#include "nsControllerCommandTable.h" + +#include "mozilla/TextInputProcessor.h" +#include "mozilla/ScriptableContentIterator.h" using namespace mozilla; using namespace mozilla::dom; using namespace mozilla::net; +using mozilla::dom::quota::QuotaManagerService; +using mozilla::gmp::GeckoMediaPluginService; + +#define NS_HAPTICFEEDBACK_CID \ + { \ + 0x1f15dbc8, 0xbfaa, 0x45de, { \ + 0x8a, 0x46, 0x08, 0xe2, 0xe2, 0x63, 0x26, 0xb0 \ + } \ + } + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserUtils) + +// PresentationDeviceManager +/* e1e79dec-4085-4994-ac5b-744b016697e6 */ +#define PRESENTATION_DEVICE_MANAGER_CID \ + { \ + 0xe1e79dec, 0x4085, 0x4994, { \ + 0xac, 0x5b, 0x74, 0x4b, 0x01, 0x66, 0x97, 0xe6 \ + } \ + } + +#define PRESENTATION_TCP_SESSION_TRANSPORT_CID \ + { \ + 0xc9d023f4, 0x6228, 0x4c07, { \ + 0x8b, 0x1d, 0x9c, 0x19, 0x57, 0x3f, 0xaa, 0x27 \ + } \ + } + +already_AddRefed<nsIPresentationService> NS_CreatePresentationService(); + +// Factory Constructor +typedef mozilla::dom::BlobURL::Mutator BlobURLMutator; +NS_GENERIC_FACTORY_CONSTRUCTOR(BlobURLMutator) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(DOMRequestService, + DOMRequestService::FactoryCreate) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(QuotaManagerService, + QuotaManagerService::FactoryCreate) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ServiceWorkerManager, + ServiceWorkerManager::GetInstance) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(WorkerDebuggerManager, + WorkerDebuggerManager::GetInstance) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(StorageActivityService, + StorageActivityService::GetOrCreate) + +#ifdef MOZ_WEBSPEECH +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR( + nsSynthVoiceRegistry, nsSynthVoiceRegistry::GetInstanceForService) +#endif + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceSensors) + +#if defined(ANDROID) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsHapticFeedback) +#endif +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ThirdPartyUtil, Init) + +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMediaManagerService, + MediaManager::GetInstance) +NS_GENERIC_FACTORY_CONSTRUCTOR(PresentationDeviceManager) +NS_GENERIC_FACTORY_CONSTRUCTOR(TextInputProcessor) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPresentationService, + NS_CreatePresentationService) +NS_GENERIC_FACTORY_CONSTRUCTOR(PresentationTCPSessionTransport) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(NotificationTelemetryService, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(PushNotifier) +NS_GENERIC_FACTORY_CONSTRUCTOR(ScriptableContentIterator) //----------------------------------------------------------------------------- static bool gInitialized = false; // Perform our one-time intialization for this module void nsLayoutModuleInitialize() { @@ -135,68 +266,79 @@ already_AddRefed<nsIContentViewer> NS_Ne nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult); nsresult NS_NewContentPolicy(nsIContentPolicy** aResult); nsresult NS_NewEventListenerService(nsIEventListenerService** aResult); nsresult NS_NewGlobalMessageManager(nsISupports** aResult); nsresult NS_NewParentProcessMessageManager(nsISupports** aResult); nsresult NS_NewChildProcessMessageManager(nsISupports** aResult); -#define MAKE_CTOR(ctor_, iface_, func_) \ - nsresult ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) { \ - *aResult = nullptr; \ - if (aOuter) return NS_ERROR_NO_AGGREGATION; \ - iface_* inst; \ - nsresult rv = func_(&inst); \ - if (NS_SUCCEEDED(rv)) { \ - rv = inst->QueryInterface(aIID, aResult); \ - NS_RELEASE(inst); \ - } \ - return rv; \ +#define MAKE_CTOR(ctor_, iface_, func_) \ + static nsresult ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) { \ + *aResult = nullptr; \ + if (aOuter) return NS_ERROR_NO_AGGREGATION; \ + iface_* inst; \ + nsresult rv = func_(&inst); \ + if (NS_SUCCEEDED(rv)) { \ + rv = inst->QueryInterface(aIID, aResult); \ + NS_RELEASE(inst); \ + } \ + return rv; \ } -#define MAKE_GENERIC_CTOR(iface_, func_) \ - NS_IMPL_COMPONENT_FACTORY(iface_) { \ - nsCOMPtr<iface_> inst; \ - if (NS_SUCCEEDED(func_(getter_AddRefs(inst)))) { \ - return inst.forget(); \ - } \ - return nullptr; \ +// As above, but expects +// already_AddRefed<nsIFoo> NS_NewFoo(); +// instead of +// nsresult NS_NewFoo(nsIFoo**); +#define MAKE_CTOR2(ctor_, iface_, func_) \ + static nsresult ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) { \ + *aResult = nullptr; \ + if (aOuter) { \ + return NS_ERROR_NO_AGGREGATION; \ + } \ + nsCOMPtr<iface_> inst = func_(); \ + inst.forget(aResult); \ + return NS_OK; \ } -#define MAKE_GENERIC_CTOR2(iface_, func_) \ - NS_IMPL_COMPONENT_FACTORY(iface_) { return func_(); } - #ifdef DEBUG -MAKE_GENERIC_CTOR(nsILayoutDebugger, NS_NewLayoutDebugger) +MAKE_CTOR(CreateNewLayoutDebugger, nsILayoutDebugger, NS_NewLayoutDebugger) #endif -MAKE_GENERIC_CTOR(nsIFrameTraversal, NS_CreateFrameTraversal) +MAKE_CTOR(CreateNewFrameTraversal, nsIFrameTraversal, NS_CreateFrameTraversal) -MAKE_GENERIC_CTOR2(nsIContentViewer, NS_NewContentViewer) +NS_GENERIC_FACTORY_CONSTRUCTOR(inDeepTreeWalker) +MAKE_CTOR2(CreateContentViewer, nsIContentViewer, NS_NewContentViewer) MAKE_CTOR(CreateXMLContentSerializer, nsIContentSerializer, NS_NewXMLContentSerializer) MAKE_CTOR(CreateHTMLContentSerializer, nsIContentSerializer, NS_NewHTMLContentSerializer) MAKE_CTOR(CreateXHTMLContentSerializer, nsIContentSerializer, NS_NewXHTMLContentSerializer) MAKE_CTOR(CreatePlainTextSerializer, nsIContentSerializer, NS_NewPlainTextSerializer) MAKE_CTOR(CreateContentPolicy, nsIContentPolicy, NS_NewContentPolicy) - -MAKE_GENERIC_CTOR(nsIDocumentLoaderFactory, NS_NewContentDocumentLoaderFactory) -MAKE_GENERIC_CTOR(nsIEventListenerService, NS_NewEventListenerService) +MAKE_CTOR(CreateContentDLF, nsIDocumentLoaderFactory, + NS_NewContentDocumentLoaderFactory) +MAKE_CTOR(CreateEventListenerService, nsIEventListenerService, + NS_NewEventListenerService) MAKE_CTOR(CreateGlobalMessageManager, nsISupports, NS_NewGlobalMessageManager) MAKE_CTOR(CreateParentMessageManager, nsISupports, NS_NewParentProcessMessageManager) MAKE_CTOR(CreateChildMessageManager, nsISupports, NS_NewChildProcessMessageManager) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDataDocumentContentPolicy) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsNoDataProtocolContentPolicy) +MAKE_CTOR(CreateFocusManager, nsIFocusManager, NS_NewFocusManager) -MAKE_GENERIC_CTOR(nsIFocusManager, NS_NewFocusManager) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStyleSheetService, Init) + +typedef nsJSURI::Mutator nsJSURIMutator; +NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSURIMutator) // views are not refcounted, so this is the same as // NS_GENERIC_FACTORY_CONSTRUCTOR without the NS_ADDREF/NS_RELEASE #define NS_GENERIC_FACTORY_CONSTRUCTOR_NOREFS(_InstanceClass) \ static nsresult _InstanceClass##Constructor(nsISupports* aOuter, \ REFNSIID aIID, void** aResult) { \ nsresult rv; \ \ @@ -211,73 +353,357 @@ MAKE_GENERIC_CTOR(nsIFocusManager, NS_Ne rv = NS_ERROR_OUT_OF_MEMORY; \ return rv; \ } \ rv = inst->QueryInterface(aIID, aResult); \ \ return rv; \ } +#define NS_GEOLOCATION_CID \ + { \ + 0x1E1C3FF, 0x94A, 0xD048, { \ + 0x44, 0xB4, 0x62, 0xD2, 0x9C, 0x7B, 0x4F, 0x39 \ + } \ + } + +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Geolocation, + Geolocation::NonWindowSingleton) + +#define NS_WEBSOCKETEVENT_SERVICE_CID \ + { \ + 0x31689828, 0xda66, 0x49a6, { \ + 0x87, 0x0c, 0xdf, 0x62, 0xb8, 0x3f, 0xe7, 0x89 \ + } \ + } + +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(WebSocketEventService, + WebSocketEventService::GetOrCreate) + +#ifdef MOZ_WEBSPEECH_TEST_BACKEND +NS_GENERIC_FACTORY_CONSTRUCTOR(FakeSpeechRecognitionService) +#endif + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsContentSecurityManager) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsCSPContext) +NS_GENERIC_FACTORY_CONSTRUCTOR(CSPService) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsMixedContentBlocker) + +NS_GENERIC_FACTORY_CONSTRUCTOR(ContentPrincipal) +NS_GENERIC_FACTORY_CONSTRUCTOR(ExpandedPrincipal) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR( + SystemPrincipal, + nsScriptSecurityManager::SystemPrincipalSingletonConstructor) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(NullPrincipal, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsStructuredCloneContainer) + +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(OSFileConstantsService, + OSFileConstantsService::GetOrCreate); + +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR( + GeckoMediaPluginService, + GeckoMediaPluginService::GetGeckoMediaPluginService) + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptError) + #ifdef ACCESSIBILITY # include "xpcAccessibilityService.h" -MAKE_GENERIC_CTOR(nsIAccessibilityService, NS_GetAccessibilityService) +MAKE_CTOR(CreateA11yService, nsIAccessibilityService, + NS_GetAccessibilityService) #endif -nsresult Construct_nsIScriptSecurityManager(nsISupports* aOuter, REFNSIID aIID, - void** aResult) { +static nsresult Construct_nsIScriptSecurityManager(nsISupports* aOuter, + REFNSIID aIID, + void** aResult) { if (!aResult) return NS_ERROR_NULL_POINTER; *aResult = nullptr; if (aOuter) return NS_ERROR_NO_AGGREGATION; nsScriptSecurityManager* obj = nsScriptSecurityManager::GetScriptSecurityManager(); if (!obj) return NS_ERROR_OUT_OF_MEMORY; if (NS_FAILED(obj->QueryInterface(aIID, aResult))) return NS_ERROR_FAILURE; return NS_OK; } -nsresult LocalStorageManagerConstructor(nsISupports* aOuter, REFNSIID aIID, - void** aResult) { +#ifdef DEBUG +NS_DEFINE_NAMED_CID(NS_LAYOUT_DEBUGGER_CID); +#endif +NS_DEFINE_NAMED_CID(NS_FRAMETRAVERSAL_CID); +NS_DEFINE_NAMED_CID(IN_DEEPTREEWALKER_CID); +NS_DEFINE_NAMED_CID(NS_CONTENT_VIEWER_CID); +NS_DEFINE_NAMED_CID(NS_XMLCONTENTSERIALIZER_CID); +NS_DEFINE_NAMED_CID(NS_XHTMLCONTENTSERIALIZER_CID); +NS_DEFINE_NAMED_CID(NS_HTMLCONTENTSERIALIZER_CID); +NS_DEFINE_NAMED_CID(NS_PLAINTEXTSERIALIZER_CID); +NS_DEFINE_NAMED_CID(NS_PARSERUTILS_CID); +NS_DEFINE_NAMED_CID(NS_CONTENTPOLICY_CID); +NS_DEFINE_NAMED_CID(NS_DATADOCUMENTCONTENTPOLICY_CID); +NS_DEFINE_NAMED_CID(NS_NODATAPROTOCOLCONTENTPOLICY_CID); +NS_DEFINE_NAMED_CID(NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID); +NS_DEFINE_NAMED_CID(NS_JSPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_JSURI_CID); +NS_DEFINE_NAMED_CID(NS_JSURIMUTATOR_CID); +NS_DEFINE_NAMED_CID(NS_PLUGINDOCLOADERFACTORY_CID); +NS_DEFINE_NAMED_CID(NS_STYLESHEETSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_HOSTOBJECTURI_CID); +NS_DEFINE_NAMED_CID(NS_HOSTOBJECTURIMUTATOR_CID); +NS_DEFINE_NAMED_CID(NS_SDBCONNECTION_CID); +NS_DEFINE_NAMED_CID(NS_DOMLOCALSTORAGEMANAGER_CID); +NS_DEFINE_NAMED_CID(DOMREQUEST_SERVICE_CID); +NS_DEFINE_NAMED_CID(QUOTAMANAGER_SERVICE_CID); +NS_DEFINE_NAMED_CID(SERVICEWORKERMANAGER_CID); +NS_DEFINE_NAMED_CID(STORAGEACTIVITYSERVICE_CID); +NS_DEFINE_NAMED_CID(NOTIFICATIONTELEMETRYSERVICE_CID); +NS_DEFINE_NAMED_CID(PUSHNOTIFIER_CID); +NS_DEFINE_NAMED_CID(WORKERDEBUGGERMANAGER_CID); +NS_DEFINE_NAMED_CID(NS_GEOLOCATION_CID); +NS_DEFINE_NAMED_CID(NS_WEBSOCKETEVENT_SERVICE_CID); +NS_DEFINE_NAMED_CID(NS_FOCUSMANAGER_CID); +NS_DEFINE_NAMED_CID(NS_CONTENTSECURITYMANAGER_CID); +NS_DEFINE_NAMED_CID(CSPSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_CSPCONTEXT_CID); +NS_DEFINE_NAMED_CID(NS_MIXEDCONTENTBLOCKER_CID); +NS_DEFINE_NAMED_CID(NS_EVENTLISTENERSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_GLOBALMESSAGEMANAGER_CID); +NS_DEFINE_NAMED_CID(NS_PARENTPROCESSMESSAGEMANAGER_CID); +NS_DEFINE_NAMED_CID(NS_CHILDPROCESSMESSAGEMANAGER_CID); +NS_DEFINE_NAMED_CID(NS_SCRIPTSECURITYMANAGER_CID); +NS_DEFINE_NAMED_CID(NS_PRINCIPAL_CID); +NS_DEFINE_NAMED_CID(NS_EXPANDEDPRINCIPAL_CID); +NS_DEFINE_NAMED_CID(NS_SYSTEMPRINCIPAL_CID); +NS_DEFINE_NAMED_CID(NS_NULLPRINCIPAL_CID); +NS_DEFINE_NAMED_CID(THIRDPARTYUTIL_CID); +NS_DEFINE_NAMED_CID(NS_STRUCTUREDCLONECONTAINER_CID); +NS_DEFINE_NAMED_CID(NS_DEVICE_SENSORS_CID); +#if defined(ANDROID) +NS_DEFINE_NAMED_CID(NS_HAPTICFEEDBACK_CID); +#endif +NS_DEFINE_NAMED_CID(OSFILECONSTANTSSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_MEDIAMANAGERSERVICE_CID); +#ifdef MOZ_WEBSPEECH_TEST_BACKEND +NS_DEFINE_NAMED_CID(NS_FAKE_SPEECH_RECOGNITION_SERVICE_CID); +#endif +#ifdef MOZ_WEBSPEECH +NS_DEFINE_NAMED_CID(NS_SYNTHVOICEREGISTRY_CID); +#endif + +#ifdef ACCESSIBILITY +NS_DEFINE_NAMED_CID(NS_ACCESSIBILITY_SERVICE_CID); +#endif + +NS_DEFINE_NAMED_CID(GECKO_MEDIA_PLUGIN_SERVICE_CID); + +NS_DEFINE_NAMED_CID(PRESENTATION_SERVICE_CID); +NS_DEFINE_NAMED_CID(PRESENTATION_DEVICE_MANAGER_CID); +NS_DEFINE_NAMED_CID(PRESENTATION_TCP_SESSION_TRANSPORT_CID); + +NS_DEFINE_NAMED_CID(TEXT_INPUT_PROCESSOR_CID); + +NS_DEFINE_NAMED_CID(NS_SCRIPTERROR_CID); + +NS_DEFINE_NAMED_CID(SCRIPTABLE_CONTENT_ITERATOR_CID); + +static nsresult LocalStorageManagerConstructor(nsISupports* aOuter, + REFNSIID aIID, void** aResult) { if (NextGenLocalStorageEnabled()) { RefPtr<LocalStorageManager2> manager = new LocalStorageManager2(); return manager->QueryInterface(aIID, aResult); } RefPtr<LocalStorageManager> manager = new LocalStorageManager(); return manager->QueryInterface(aIID, aResult); } -static const mozilla::Module::CategoryEntry kLayoutCategories[] = { +static const mozilla::Module::CIDEntry kLayoutCIDs[] = { // clang-format off - { "clear-origin-attributes-data", "QuotaManagerService", "service," QUOTAMANAGER_SERVICE_CONTRACTID }, - {nullptr} + XPCONNECT_CIDENTRIES +#ifdef DEBUG + { &kNS_LAYOUT_DEBUGGER_CID, false, nullptr, CreateNewLayoutDebugger }, +#endif + { &kNS_FRAMETRAVERSAL_CID, false, nullptr, CreateNewFrameTraversal }, + { &kIN_DEEPTREEWALKER_CID, false, nullptr, inDeepTreeWalkerConstructor }, + { &kNS_CONTENT_VIEWER_CID, false, nullptr, CreateContentViewer }, + { &kNS_XMLCONTENTSERIALIZER_CID, false, nullptr, CreateXMLContentSerializer }, + { &kNS_HTMLCONTENTSERIALIZER_CID, false, nullptr, CreateHTMLContentSerializer }, + { &kNS_XHTMLCONTENTSERIALIZER_CID, false, nullptr, CreateXHTMLContentSerializer }, + { &kNS_PLAINTEXTSERIALIZER_CID, false, nullptr, CreatePlainTextSerializer }, + { &kNS_PARSERUTILS_CID, false, nullptr, nsParserUtilsConstructor }, + { &kNS_CONTENTPOLICY_CID, false, nullptr, CreateContentPolicy }, + { &kNS_DATADOCUMENTCONTENTPOLICY_CID, false, nullptr, nsDataDocumentContentPolicyConstructor }, + { &kNS_NODATAPROTOCOLCONTENTPOLICY_CID, false, nullptr, nsNoDataProtocolContentPolicyConstructor }, + { &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID, false, nullptr, CreateContentDLF }, + { &kNS_JSPROTOCOLHANDLER_CID, false, nullptr, nsJSProtocolHandler::Create }, + { &kNS_JSURI_CID, false, nullptr, nsJSURIMutatorConstructor }, // do_CreateInstance returns mutator + { &kNS_JSURIMUTATOR_CID, false, nullptr, nsJSURIMutatorConstructor }, + { &kNS_PLUGINDOCLOADERFACTORY_CID, false, nullptr, CreateContentDLF }, + { &kNS_STYLESHEETSERVICE_CID, false, nullptr, nsStyleSheetServiceConstructor }, + { &kNS_HOSTOBJECTURI_CID, false, nullptr, BlobURLMutatorConstructor }, // do_CreateInstance returns mutator + { &kNS_HOSTOBJECTURIMUTATOR_CID, false, nullptr, BlobURLMutatorConstructor }, + { &kNS_SDBCONNECTION_CID, false, nullptr, SDBConnection::Create }, + { &kNS_DOMLOCALSTORAGEMANAGER_CID, false, nullptr, LocalStorageManagerConstructor }, + { &kDOMREQUEST_SERVICE_CID, false, nullptr, DOMRequestServiceConstructor }, + { &kQUOTAMANAGER_SERVICE_CID, false, nullptr, QuotaManagerServiceConstructor }, + { &kSERVICEWORKERMANAGER_CID, false, nullptr, ServiceWorkerManagerConstructor }, + { &kSTORAGEACTIVITYSERVICE_CID, false, nullptr, StorageActivityServiceConstructor }, + { &kNOTIFICATIONTELEMETRYSERVICE_CID, false, nullptr, NotificationTelemetryServiceConstructor }, + { &kPUSHNOTIFIER_CID, false, nullptr, PushNotifierConstructor }, + { &kWORKERDEBUGGERMANAGER_CID, true, nullptr, WorkerDebuggerManagerConstructor }, + { &kNS_GEOLOCATION_CID, false, nullptr, GeolocationConstructor }, + { &kNS_WEBSOCKETEVENT_SERVICE_CID, false, nullptr, WebSocketEventServiceConstructor }, + { &kNS_FOCUSMANAGER_CID, false, nullptr, CreateFocusManager }, +#ifdef MOZ_WEBSPEECH_TEST_BACKEND + { &kNS_FAKE_SPEECH_RECOGNITION_SERVICE_CID, false, nullptr, FakeSpeechRecognitionServiceConstructor }, +#endif +#ifdef MOZ_WEBSPEECH + { &kNS_SYNTHVOICEREGISTRY_CID, true, nullptr, nsSynthVoiceRegistryConstructor }, +#endif + { &kNS_CONTENTSECURITYMANAGER_CID, false, nullptr, nsContentSecurityManagerConstructor }, + { &kCSPSERVICE_CID, false, nullptr, CSPServiceConstructor }, + { &kNS_CSPCONTEXT_CID, false, nullptr, nsCSPContextConstructor }, + { &kNS_MIXEDCONTENTBLOCKER_CID, false, nullptr, nsMixedContentBlockerConstructor }, + { &kNS_EVENTLISTENERSERVICE_CID, false, nullptr, CreateEventListenerService }, + { &kNS_GLOBALMESSAGEMANAGER_CID, false, nullptr, CreateGlobalMessageManager }, + { &kNS_PARENTPROCESSMESSAGEMANAGER_CID, false, nullptr, CreateParentMessageManager }, + { &kNS_CHILDPROCESSMESSAGEMANAGER_CID, false, nullptr, CreateChildMessageManager }, + { &kNS_SCRIPTSECURITYMANAGER_CID, false, nullptr, Construct_nsIScriptSecurityManager }, + { &kNS_PRINCIPAL_CID, false, nullptr, ContentPrincipalConstructor }, + { &kNS_EXPANDEDPRINCIPAL_CID, false, nullptr, ExpandedPrincipalConstructor }, + { &kNS_SYSTEMPRINCIPAL_CID, false, nullptr, SystemPrincipalConstructor }, + { &kNS_NULLPRINCIPAL_CID, false, nullptr, NullPrincipalConstructor }, + { &kNS_DEVICE_SENSORS_CID, false, nullptr, nsDeviceSensorsConstructor }, +#if defined(ANDROID) + { &kNS_HAPTICFEEDBACK_CID, false, nullptr, nsHapticFeedbackConstructor }, +#endif + { &kTHIRDPARTYUTIL_CID, false, nullptr, ThirdPartyUtilConstructor }, + { &kNS_STRUCTUREDCLONECONTAINER_CID, false, nullptr, nsStructuredCloneContainerConstructor }, + { &kOSFILECONSTANTSSERVICE_CID, true, nullptr, OSFileConstantsServiceConstructor }, + { &kGECKO_MEDIA_PLUGIN_SERVICE_CID, true, nullptr, GeckoMediaPluginServiceConstructor }, + { &kNS_MEDIAMANAGERSERVICE_CID, false, nullptr, nsIMediaManagerServiceConstructor }, +#ifdef ACCESSIBILITY + { &kNS_ACCESSIBILITY_SERVICE_CID, false, nullptr, CreateA11yService }, +#endif + { &kPRESENTATION_SERVICE_CID, false, nullptr, nsIPresentationServiceConstructor }, + { &kPRESENTATION_DEVICE_MANAGER_CID, false, nullptr, PresentationDeviceManagerConstructor }, + { &kPRESENTATION_TCP_SESSION_TRANSPORT_CID, false, nullptr, PresentationTCPSessionTransportConstructor }, + { &kTEXT_INPUT_PROCESSOR_CID, false, nullptr, TextInputProcessorConstructor }, + { &kNS_SCRIPTERROR_CID, false, nullptr, nsScriptErrorConstructor }, + { &kSCRIPTABLE_CONTENT_ITERATOR_CID, false, nullptr, ScriptableContentIteratorConstructor }, + { nullptr } // clang-format on }; -void nsLayoutModuleDtor() { - if (XRE_GetProcessType() == GeckoProcessType_GPU || - XRE_GetProcessType() == GeckoProcessType_VR || - XRE_GetProcessType() == GeckoProcessType_RDD) { - return; - } +static const mozilla::Module::ContractIDEntry kLayoutContracts[] = { + // clang-format off + XPCONNECT_CONTRACTS + { "@mozilla.org/inspector/deep-tree-walker;1", &kIN_DEEPTREEWALKER_CID }, + { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/xml", &kNS_XMLCONTENTSERIALIZER_CID }, + { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/xml", &kNS_XMLCONTENTSERIALIZER_CID }, + { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/xhtml+xml", &kNS_XHTMLCONTENTSERIALIZER_CID }, + { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "image/svg+xml", &kNS_XMLCONTENTSERIALIZER_CID }, + { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/html", &kNS_HTMLCONTENTSERIALIZER_CID }, + { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/vnd.mozilla.xul+xml", &kNS_XMLCONTENTSERIALIZER_CID }, + { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/plain", &kNS_PLAINTEXTSERIALIZER_CID }, + { NS_PARSERUTILS_CONTRACTID, &kNS_PARSERUTILS_CID }, + { NS_CONTENTPOLICY_CONTRACTID, &kNS_CONTENTPOLICY_CID }, + { NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID, &kNS_DATADOCUMENTCONTENTPOLICY_CID }, + { NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID, &kNS_NODATAPROTOCOLCONTENTPOLICY_CID }, + { CONTENT_DLF_CONTRACTID, &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID }, + { NS_JSPROTOCOLHANDLER_CONTRACTID, &kNS_JSPROTOCOLHANDLER_CID }, + { PLUGIN_DLF_CONTRACTID, &kNS_PLUGINDOCLOADERFACTORY_CID }, + { NS_STYLESHEETSERVICE_CONTRACTID, &kNS_STYLESHEETSERVICE_CID }, + { NS_SDBCONNECTION_CONTRACTID, &kNS_SDBCONNECTION_CID }, + { "@mozilla.org/dom/localStorage-manager;1", &kNS_DOMLOCALSTORAGEMANAGER_CID }, + { DOMREQUEST_SERVICE_CONTRACTID, &kDOMREQUEST_SERVICE_CID }, + { QUOTAMANAGER_SERVICE_CONTRACTID, &kQUOTAMANAGER_SERVICE_CID }, + { SERVICEWORKERMANAGER_CONTRACTID, &kSERVICEWORKERMANAGER_CID }, + { STORAGE_ACTIVITY_SERVICE_CONTRACTID, &kSTORAGEACTIVITYSERVICE_CID }, + { NOTIFICATIONTELEMETRYSERVICE_CONTRACTID, &kNOTIFICATIONTELEMETRYSERVICE_CID }, + { PUSHNOTIFIER_CONTRACTID, &kPUSHNOTIFIER_CID }, + { WORKERDEBUGGERMANAGER_CONTRACTID, &kWORKERDEBUGGERMANAGER_CID }, + { "@mozilla.org/geolocation;1", &kNS_GEOLOCATION_CID }, + { "@mozilla.org/websocketevent/service;1", &kNS_WEBSOCKETEVENT_SERVICE_CID }, + { "@mozilla.org/focus-manager;1", &kNS_FOCUSMANAGER_CID }, +#ifdef MOZ_WEBSPEECH_TEST_BACKEND + { NS_SPEECH_RECOGNITION_SERVICE_CONTRACTID_PREFIX "fake", &kNS_FAKE_SPEECH_RECOGNITION_SERVICE_CID }, +#endif +#ifdef MOZ_WEBSPEECH + { NS_SYNTHVOICEREGISTRY_CONTRACTID, &kNS_SYNTHVOICEREGISTRY_CID }, +#endif + { NS_CONTENTSECURITYMANAGER_CONTRACTID, &kNS_CONTENTSECURITYMANAGER_CID }, + { CSPSERVICE_CONTRACTID, &kCSPSERVICE_CID }, + { NS_CSPCONTEXT_CONTRACTID, &kNS_CSPCONTEXT_CID }, + { NS_MIXEDCONTENTBLOCKER_CONTRACTID, &kNS_MIXEDCONTENTBLOCKER_CID }, + { NS_EVENTLISTENERSERVICE_CONTRACTID, &kNS_EVENTLISTENERSERVICE_CID }, + { NS_GLOBALMESSAGEMANAGER_CONTRACTID, &kNS_GLOBALMESSAGEMANAGER_CID }, + { NS_PARENTPROCESSMESSAGEMANAGER_CONTRACTID, &kNS_PARENTPROCESSMESSAGEMANAGER_CID }, + { NS_CHILDPROCESSMESSAGEMANAGER_CONTRACTID, &kNS_CHILDPROCESSMESSAGEMANAGER_CID }, + { NS_SCRIPTSECURITYMANAGER_CONTRACTID, &kNS_SCRIPTSECURITYMANAGER_CID }, + { NS_PRINCIPAL_CONTRACTID, &kNS_PRINCIPAL_CID }, + { NS_EXPANDEDPRINCIPAL_CONTRACTID, &kNS_EXPANDEDPRINCIPAL_CID }, + { NS_SYSTEMPRINCIPAL_CONTRACTID, &kNS_SYSTEMPRINCIPAL_CID }, + { NS_NULLPRINCIPAL_CONTRACTID, &kNS_NULLPRINCIPAL_CID }, + { NS_DEVICE_SENSORS_CONTRACTID, &kNS_DEVICE_SENSORS_CID }, +#if defined(ANDROID) + { "@mozilla.org/widget/hapticfeedback;1", &kNS_HAPTICFEEDBACK_CID }, +#endif + { THIRDPARTYUTIL_CONTRACTID, &kTHIRDPARTYUTIL_CID }, + { NS_STRUCTUREDCLONECONTAINER_CONTRACTID, &kNS_STRUCTUREDCLONECONTAINER_CID }, + { OSFILECONSTANTSSERVICE_CONTRACTID, &kOSFILECONSTANTSSERVICE_CID }, + { MEDIAMANAGERSERVICE_CONTRACTID, &kNS_MEDIAMANAGERSERVICE_CID }, +#ifdef ACCESSIBILITY + { "@mozilla.org/accessibilityService;1", &kNS_ACCESSIBILITY_SERVICE_CID }, +#endif + { "@mozilla.org/gecko-media-plugin-service;1", &kGECKO_MEDIA_PLUGIN_SERVICE_CID }, + { PRESENTATION_SERVICE_CONTRACTID, &kPRESENTATION_SERVICE_CID }, + { PRESENTATION_DEVICE_MANAGER_CONTRACTID, &kPRESENTATION_DEVICE_MANAGER_CID }, + { PRESENTATION_TCP_SESSION_TRANSPORT_CONTRACTID, &kPRESENTATION_TCP_SESSION_TRANSPORT_CID }, + { "@mozilla.org/text-input-processor;1", &kTEXT_INPUT_PROCESSOR_CID }, + { NS_SCRIPTERROR_CONTRACTID, &kNS_SCRIPTERROR_CID }, + { "@mozilla.org/scriptable-content-iterator;1", &kSCRIPTABLE_CONTENT_ITERATOR_CID }, + { nullptr } +}; +static const mozilla::Module::CategoryEntry kLayoutCategories[] = { + { "content-policy", NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID, NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID }, + { "content-policy", NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID, NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID }, + { "content-policy", "CSPService", CSPSERVICE_CONTRACTID }, + { "content-policy", NS_MIXEDCONTENTBLOCKER_CONTRACTID, NS_MIXEDCONTENTBLOCKER_CONTRACTID }, + { "net-channel-event-sinks", "CSPService", CSPSERVICE_CONTRACTID }, + { "net-channel-event-sinks", NS_MIXEDCONTENTBLOCKER_CONTRACTID, NS_MIXEDCONTENTBLOCKER_CONTRACTID }, + { "app-startup", "Script Security Manager", "service," NS_SCRIPTSECURITYMANAGER_CONTRACTID }, + { "app-startup", "Push Notifier", "service," PUSHNOTIFIER_CONTRACTID }, + { "clear-origin-attributes-data", "QuotaManagerService", "service," QUOTAMANAGER_SERVICE_CONTRACTID }, + { OBSERVER_TOPIC_IDLE_DAILY, "QuotaManagerService", QUOTAMANAGER_SERVICE_CONTRACTID }, + CONTENTDLF_CATEGORIES + { "profile-after-change", "PresentationDeviceManager", PRESENTATION_DEVICE_MANAGER_CONTRACTID }, + { "profile-after-change", "PresentationService", PRESENTATION_SERVICE_CONTRACTID }, + { "profile-after-change", "Notification Telemetry Service", NOTIFICATIONTELEMETRYSERVICE_CONTRACTID }, + { nullptr } + // clang-format on +}; + +static nsresult Initialize() { + // nsLayoutModuleInitialize should be called first. + MOZ_RELEASE_ASSERT(gInitialized); + return NS_OK; +} + +static void LayoutModuleDtor() { Shutdown(); nsContentUtils::XPCOMShutdown(); // Layout depends heavily on gfx and imagelib, so we want to make sure that // these modules are shut down after all the layout cleanup runs. mozilla::image::ShutdownModule(); gfxPlatform::Shutdown(); gfx::gfxVars::Shutdown(); nsScriptSecurityManager::Shutdown(); xpcModuleDtor(); } -static const mozilla::Module kLayoutModule = {mozilla::Module::kVersion, - nullptr, - nullptr, - kLayoutCategories, - nullptr, - nullptr, - nullptr}; +static const mozilla::Module kLayoutModule = { + mozilla::Module::kVersion, kLayoutCIDs, kLayoutContracts, + kLayoutCategories, nullptr, Initialize, + LayoutModuleDtor}; NSMODULE_DEFN(nsLayoutModule) = &kLayoutModule;
--- a/layout/build/nsLayoutModule.h +++ b/layout/build/nsLayoutModule.h @@ -4,42 +4,14 @@ * 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/. */ #ifndef nsLayoutModule_h #define nsLayoutModule_h #include "nscore.h" -class nsIPresentationService; - // This function initializes various layout statics, as well as XPConnect. // It should be called only once, and before the first time any XPCOM module in // nsLayoutModule is used. void nsLayoutModuleInitialize(); -void nsLayoutModuleDtor(); - -nsresult CreateXMLContentSerializer(nsISupports* aOuter, const nsID& aIID, - void** aResult); -nsresult CreateHTMLContentSerializer(nsISupports* aOuter, const nsID& aIID, - void** aResult); -nsresult CreateXHTMLContentSerializer(nsISupports* aOuter, const nsID& aIID, - void** aResult); -nsresult CreatePlainTextSerializer(nsISupports* aOuter, const nsID& aIID, - void** aResult); -nsresult CreateContentPolicy(nsISupports* aOuter, const nsID& aIID, - void** aResult); -nsresult CreateGlobalMessageManager(nsISupports* aOuter, const nsID& aIID, - void** aResult); -nsresult CreateParentMessageManager(nsISupports* aOuter, const nsID& aIID, - void** aResult); -nsresult CreateChildMessageManager(nsISupports* aOuter, const nsID& aIID, - void** aResult); - -nsresult Construct_nsIScriptSecurityManager(nsISupports* aOuter, - const nsIID& aIID, void** aResult); -nsresult LocalStorageManagerConstructor(nsISupports* aOuter, const nsIID& aIID, - void** aResult); - -already_AddRefed<nsIPresentationService> NS_CreatePresentationService(); - #endif // nsLayoutModule_h
--- a/layout/printing/nsPrintJob.cpp +++ b/layout/printing/nsPrintJob.cpp @@ -105,18 +105,18 @@ static const char kPrintingPromptService #include "nsILayoutHistoryState.h" #include "nsFrameManager.h" #include "mozilla/ReflowInput.h" #include "nsIContentViewer.h" #include "nsIDocumentViewerPrint.h" #include "nsFocusManager.h" #include "nsRange.h" +#include "nsCDefaultURIFixup.h" #include "nsIURIFixup.h" -#include "mozilla/Components.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/HTMLFrameElement.h" #include "nsContentList.h" #include "nsIChannel.h" #include "xpcpublic.h" #include "nsVariant.h" #include "mozilla/ServoStyleSet.h" @@ -293,17 +293,17 @@ static void GetDocumentTitleAndURL(Docum aTitle.Truncate(); aURLStr.Truncate(); aDoc->GetTitle(aTitle); nsIURI* url = aDoc->GetDocumentURI(); if (!url) return; - nsCOMPtr<nsIURIFixup> urifixup(components::URIFixup::Service()); + nsCOMPtr<nsIURIFixup> urifixup(do_GetService(NS_URIFIXUP_CONTRACTID)); if (!urifixup) return; nsCOMPtr<nsIURI> exposableURI; urifixup->CreateExposableURI(url, getter_AddRefs(exposableURI)); if (!exposableURI) return; nsAutoCString urlCStr;
--- a/netwerk/base/moz.build +++ b/netwerk/base/moz.build @@ -143,17 +143,16 @@ EXPORTS += [ 'nsFileStreams.h', 'nsInputStreamPump.h', 'nsMIMEInputStream.h', 'nsNetUtil.h', 'nsReadLine.h', 'nsSerializationHelper.h', 'nsSimpleNestedURI.h', 'nsSimpleURI.h', - 'nsStandardURL.h', 'nsStreamListenerWrapper.h', 'nsURIHashKey.h', 'nsURLHelper.h', 'nsURLParsers.h', 'SimpleChannel.h', ] EXPORTS.mozilla += [
--- a/netwerk/base/nsUDPSocket.h +++ b/netwerk/base/nsUDPSocket.h @@ -3,17 +3,16 @@ * 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/. */ #ifndef nsUDPSocket_h__ #define nsUDPSocket_h__ #include "nsIUDPSocket.h" #include "mozilla/Mutex.h" -#include "mozilla/net/DNS.h" #include "nsIOutputStream.h" #include "nsAutoPtr.h" #include "nsCycleCollectionParticipant.h" //----------------------------------------------------------------------------- namespace mozilla { namespace net {
deleted file mode 100644 --- a/netwerk/build/components.conf +++ /dev/null @@ -1,622 +0,0 @@ -# -*- 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/. - -Headers = [ - '/netwerk/build/nsNetModule.h' -] - -InitFunc = 'nsNetStartup' -UnloadFunc = 'nsNetShutdown' - -Classes = [ - { - 'cid': '{3014dde6-aa1c-41db-87d0-48764a3710f6}', - 'contract_ids': ['@mozilla.org/io/arraybuffer-input-stream;1'], - 'type': 'ArrayBufferInputStream', - 'headers': ['/netwerk/base/ArrayBufferInputStream.h'], - }, - { - 'cid': '{62d4b190-3642-4450-b019-d1c1fba56025}', - 'contract_ids': ['@mozilla.org/load-context-info-factory;1'], - 'type': 'mozilla::net::LoadContextInfoFactory', - 'headers': ['mozilla/LoadContextInfo.h'], - }, - { - 'cid': '{ea70b098-5014-4e21-aee1-75e6b2c4b8e0}', - 'contract_ids': [ - '@mozilla.org/netwerk/cache-storage-service;1', - '@mozilla.org/network/cache-storage-service;1', - ], - 'singleton': True, - 'type': 'mozilla::net::CacheStorageService', - 'headers': ['CacheStorageService.h'], - }, - { - 'cid': '{02bf7a2a-39d8-4a23-a50c-2cbb085ab7a5}', - 'contract_ids': ['@mozilla.org/network/application-cache-service;1'], - 'singleton': True, - 'type': 'nsApplicationCacheService', - 'headers': ['nsApplicationCacheService.h'], - }, - { - 'cid': '{e746a8b1-c97a-4fc5-baa4-66607521bd08}', - 'contract_ids': ['@mozilla.org/network/async-stream-copier;1'], - 'type': 'nsAsyncStreamCopier', - 'headers': ['/netwerk/base/nsAsyncStreamCopier.h'], - }, - { - 'cid': '{6eae857e-4ba9-11e3-9b39-b4036188709b}', - 'contract_ids': ['@mozilla.org/network/atomic-file-output-stream;1'], - 'type': 'nsAtomicFileOutputStream', - 'headers': ['nsFileStreams.h'], - }, - { - 'cid': '{62147d1e-ef6a-40e8-aaf8-d039f5caaa81}', - 'contract_ids': ['@mozilla.org/network/background-file-saver;1?mode=outputstream'], - 'type': 'mozilla::net::BackgroundFileSaverOutputStream', - 'headers': ['/netwerk/base/BackgroundFileSaver.h'], - 'init_method': 'Init', - }, - { - 'cid': '{208de7fc-a781-4031-bbae-cc0de539f61a}', - 'contract_ids': ['@mozilla.org/network/background-file-saver;1?mode=streamlistener'], - 'type': 'mozilla::net::BackgroundFileSaverStreamListener', - 'headers': ['/netwerk/base/BackgroundFileSaver.h'], - 'init_method': 'Init', - }, - { - 'cid': '{a2027ec6-ba0d-4c72-805d-148233f5f33c}', - 'contract_ids': ['@mozilla.org/network/binary-detector;1'], - 'legacy_constructor': 'CreateNewBinaryDetectorFactory', - }, - { - 'cid': '{9226888e-da08-11d3-8cda-0060b0fc14a3}', - 'contract_ids': ['@mozilla.org/network/buffered-input-stream;1'], - 'legacy_constructor': 'nsBufferedInputStream::Create', - 'headers': ['/netwerk/base/nsBufferedStreams.h'], - }, - { - 'cid': '{9868b4ce-da08-11d3-8cda-0060b0fc14a3}', - 'contract_ids': ['@mozilla.org/network/buffered-output-stream;1'], - 'legacy_constructor': 'nsBufferedOutputStream::Create', - 'headers': ['/netwerk/base/nsBufferedStreams.h'], - }, - { - 'cid': '{6c84aec9-29a5-4264-8fbc-bee8f922ea67}', - 'contract_ids': ['@mozilla.org/network/cache-service;1'], - 'legacy_constructor': 'nsCacheServiceConstructor', - }, - { - 'cid': '{bdbe0555-fc3d-4f7b-9205-c309ceb2d641}', - 'contract_ids': ['@mozilla.org/network/captive-portal-service;1'], - 'singleton': True, - 'type': 'nsICaptivePortalService', - 'constructor': 'mozilla::net::CaptivePortalService::GetSingleton', - 'headers': ['mozilla/net/CaptivePortalService.h'], - }, - { - 'cid': '{c79eb3c6-091a-45a6-8544-5a8d1ab79537}', - 'contract_ids': ['@mozilla.org/network/dashboard;1'], - 'type': 'mozilla::net::Dashboard', - 'headers': ['mozilla/net/Dashboard.h'], - }, - { - 'cid': '{b0ff4572-dae4-4bef-a092-83c1b88f6be9}', - 'contract_ids': ['@mozilla.org/network/dns-service;1'], - 'singleton': True, - 'type': 'nsIDNSService', - 'constructor': 'nsDNSService::GetXPCOMSingleton', - 'headers': ['/netwerk/dns/nsDNSService2.h'], - 'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS, - }, - { - 'cid': '{510a86bb-6019-4ed1-bb4f-965cffd23ece}', - 'contract_ids': ['@mozilla.org/network/downloader;1'], - 'type': 'nsDownloader', - 'headers': ['/netwerk/base/nsDownloader.h'], - }, - { - 'cid': '{cb9abbae-66b6-4609-8594-5c4ff300888e}', - 'contract_ids': ['@mozilla.org/network/effective-tld-service;1'], - 'singleton': True, - 'type': 'nsEffectiveTLDService', - 'headers': ['/netwerk/dns/nsEffectiveTLDService.h'], - 'init_method': 'Init', - }, - { - 'cid': '{be9a53ae-c7e9-11d3-8cda-0060b0fc14a3}', - 'contract_ids': ['@mozilla.org/network/file-input-stream;1'], - 'legacy_constructor': 'nsFileInputStream::Create', - 'headers': ['nsFileStreams.h'], - }, - { - 'cid': '{c272fee0-c7e9-11d3-8cda-0060b0fc14a3}', - 'contract_ids': ['@mozilla.org/network/file-output-stream;1'], - 'legacy_constructor': 'nsFileOutputStream::Create', - 'headers': ['nsFileStreams.h'], - }, - { - 'cid': '{15629ada-a41c-4a09-961f-6553cd60b1a2}', - 'contract_ids': ['@mozilla.org/network/http-activity-distributor;1'], - 'type': 'mozilla::net::nsHttpActivityDistributor', - 'headers': ['/netwerk/protocol/http/nsHttpActivityDistributor.h'], - }, - { - 'cid': '{36b63ef3-e0fa-4c49-9fd4-e065e85568f4}', - 'contract_ids': ['@mozilla.org/network/http-auth-manager;1'], - 'type': 'mozilla::net::nsHttpAuthManager', - 'headers': ['/netwerk/protocol/http/nsHttpAuthManager.h'], - 'init_method': 'Init', - }, - { - 'cid': '{62b778a6-bce3-456b-8c31-2865fbb68c91}', - 'contract_ids': ['@mozilla.org/network/idn-service;1'], - 'type': 'nsIDNService', - 'headers': ['/netwerk/dns/nsIDNService.h'], - 'init_method': 'Init', - 'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS, - }, - { - 'cid': '{a62af1ba-79b3-4896-8aaf-b148bfce4280}', - 'contract_ids': ['@mozilla.org/network/incremental-download;1'], - 'legacy_constructor': 'net_NewIncrementalDownload', - }, - { - 'cid': '{5d6352a3-b9c3-4fa3-87aa-b2a3c6e5a501}', - 'contract_ids': ['@mozilla.org/network/incremental-stream-loader;1'], - 'legacy_constructor': 'nsIncrementalStreamLoader::Create', - 'headers': ['/netwerk/base/nsIncrementalStreamLoader.h'], - }, - { - 'cid': '{6ddb050c-0d04-11d4-986e-00c04fa0cf4a}', - 'contract_ids': ['@mozilla.org/network/input-stream-channel;1'], - 'type': 'mozilla::net::nsInputStreamChannel', - 'headers': ['/netwerk/base/nsInputStreamChannel.h'], - 'init_method': 'Init', - }, - { - 'cid': '{ccd0e960-7947-4635-b70e-4c661b63d675}', - 'contract_ids': ['@mozilla.org/network/input-stream-pump;1'], - 'type': 'nsInputStreamPump', - 'headers': ['nsInputStreamPump.h'], - }, - { - 'cid': '{9ac9e770-18bc-11d3-9337-00104ba0fd40}', - 'contract_ids': [ - '@mozilla.org/network/io-service;1', - '@mozilla.org/network/util;1', - ], - 'singleton': True, - 'type': 'mozilla::net::nsIOService', - 'headers': ['/netwerk/base/nsIOService.h'], - 'constructor': 'mozilla::net::nsIOService::GetInstance', - 'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS, - }, - { - 'cid': '{e1c61582-2a84-11d3-8cce-0060b0fc14a3}', - 'contract_ids': ['@mozilla.org/network/load-group;1'], - 'legacy_constructor': 'nsLoadGroupConstructor', - }, - { - 'cid': '{1f4dbcf7-245c-4c8c-943d-8a1da0495e8a}', - 'contract_ids': ['@mozilla.org/network/mime-hdrparam;1'], - 'type': 'nsMIMEHeaderParamImpl', - 'headers': ['/netwerk/mime/nsMIMEHeaderParamImpl.h'], - }, - { - 'cid': '{58a1c31c-1dd2-11b2-a3f6-d36949d48268}', - 'contract_ids': ['@mozilla.org/network/mime-input-stream;1'], - 'legacy_constructor': 'nsMIMEInputStreamConstructor', - 'headers': ['nsMIMEInputStream.h'], - }, - { - 'cid': '{2693457e-3ba5-4455-991f-5350946adb12}', - 'contract_ids': ['@mozilla.org/network/network-connectivity-service;1'], - 'singleton': True, - 'type': 'nsINetworkConnectivityService', - 'constructor': 'mozilla::net::NetworkConnectivityService::GetSingleton', - 'headers': ['mozilla/net/NetworkConnectivityService.h'], - }, - { - 'cid': '{969adfdf-7221-4419-aecf-05f8faf00c9b}', - 'contract_ids': ['@mozilla.org/network/predictor;1'], - 'singleton': True, - 'legacy_constructor': 'mozilla::net::Predictor::Create', - 'headers': ['mozilla/net/Predictor.h'], - }, - { - 'cid': '{e9b301c0-e0e4-11d3-a1a8-0050041caf44}', - 'contract_ids': ['@mozilla.org/network/protocol-proxy-service;1'], - 'singleton': True, - 'type': 'mozilla::net::nsProtocolProxyService', - 'headers': ['/netwerk/base/nsProtocolProxyService.h'], - 'init_method': 'Init', - }, - { - 'cid': '{3decd6c8-30ef-11d3-8cd0-0060b0fc14a3}', - 'contract_ids': ['@mozilla.org/network/protocol/about;1?what=blank'], - 'legacy_constructor': 'nsAboutBlank::Create', - 'headers': ['/netwerk/protocol/about/nsAboutBlank.h'], - }, - { - 'cid': '{9158c470-86e4-11d4-9be2-00e09872a416}', - 'contract_ids': ['@mozilla.org/network/protocol/about;1?what=cache'], - 'legacy_constructor': 'nsAboutCache::Create', - 'headers': ['/netwerk/protocol/about/nsAboutCache.h'], - }, - { - 'cid': '{7fa5237d-b0eb-438f-9e50-ca0166e63788}', - 'contract_ids': ['@mozilla.org/network/protocol/about;1?what=cache-entry'], - 'type': 'nsAboutCacheEntry', - 'headers': ['/netwerk/protocol/about/nsAboutCacheEntry.h'], - }, - { - 'cid': '{9e3b6c90-2f75-11d3-8cd0-0060b0fc14a3}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=about'], - 'singleton': True, - 'type': 'mozilla::net::nsAboutProtocolHandler', - 'headers': ['/netwerk/protocol/about/nsAboutProtocolHandler.h'], - }, - { - 'cid': '{b6ed3030-6183-11d3-a178-0050041caf44}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=data'], - 'singleton': True, - 'legacy_constructor': 'nsDataHandler::Create', - 'headers': ['/netwerk/protocol/data/nsDataHandler.h'], - }, - { - 'cid': '{fbc81170-1f69-11d3-9344-00104ba0fd40}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=file'], - 'singleton': True, - 'type': 'nsFileProtocolHandler', - 'headers': ['mozilla/net/nsFileProtocolHandler.h'], - 'init_method': 'Init', - }, - { - 'cid': '{25029490-f132-11d2-9588-00805f369f95}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=ftp'], - 'singleton': True, - 'type': 'nsFtpProtocolHandler', - 'headers': ['/netwerk/protocol/ftp/nsFtpProtocolHandler.h'], - 'init_method': 'Init', - }, - { - 'cid': '{4f47e42e-4d23-4dd3-bfda-eb29255e9ea3}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=http'], - 'singleton': True, - 'type': 'mozilla::net::nsHttpHandler', - }, - { - 'cid': '{dccbe7e4-7750-466b-a557-5ea36c8ff24e}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=https'], - 'singleton': True, - 'type': 'mozilla::net::nsHttpsHandler', - }, - { - 'cid': '{aea16cd0-f020-4138-b068-0716c4a15b5a}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=moz-extension'], - 'singleton': True, - 'type': 'mozilla::net::ExtensionProtocolHandler', - 'headers': ['mozilla/net/ExtensionProtocolHandler.h'], - 'constructor': 'mozilla::net::ExtensionProtocolHandler::GetSingleton', - }, - { - 'cid': '{1423e739-782c-4081-b5d8-fe6fba68c0ef}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=moz-safe-about'], - 'singleton': True, - 'type': 'mozilla::net::nsSafeAboutProtocolHandler', - 'headers': ['/netwerk/protocol/about/nsAboutProtocolHandler.h'], - }, - { - 'cid': '{e64f152a-9f07-11d3-8cda-0060b0fc14a3}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=resource'], - 'singleton': True, - 'type': 'nsResProtocolHandler', - 'headers': ['/netwerk/protocol/res/nsResProtocolHandler.h'], - 'init_method': 'Init', - }, - { - 'cid': '{9c7ec5d1-23f9-11d5-aea8-8fcc0793e97f}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=view-source'], - 'singleton': True, - 'type': 'mozilla::net::nsViewSourceHandler', - 'headers': ['/netwerk/protocol/viewsource/nsViewSourceHandler.h'], - }, - { - 'cid': '{dc01db59-a513-4c90-824b-085cce06c0aa}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=ws'], - 'singleton': True, - 'legacy_constructor': 'mozilla::net::WebSocketChannelConstructor', - }, - { - 'cid': '{dc01dbbb-a5bb-4cbb-82bb-085cce06c0bb}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=wss'], - 'singleton': True, - 'legacy_constructor': 'mozilla::net::WebSocketSSLChannelConstructor', - }, - { - 'cid': '{e7509b46-2eb2-410a-9d7c-c3ce73284d01}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=wyciwyg'], - 'singleton': True, - 'type': 'nsWyciwygProtocolHandler', - 'headers': ['/netwerk/protocol/wyciwyg/nsWyciwygProtocolHandler.h'], - }, - { - 'cid': '{a181af0d-68b8-4308-94db-d4f859058215}', - 'contract_ids': ['@mozilla.org/network/safe-file-output-stream;1'], - 'type': 'nsAtomicFileOutputStream', - 'headers': ['nsFileStreams.h'], - }, - { - 'cid': '{d6ef593d-a429-4b14-a887-d9e2f765d9ed}', - 'contract_ids': ['@mozilla.org/network/serialization-helper;1'], - 'type': 'nsSerializationHelper', - 'headers': ['nsSerializationHelper.h'], - }, - { - 'cid': '{2ec62893-3b35-48fa-ab1d-5e68a9f45f08}', - 'contract_ids': ['@mozilla.org/network/server-socket;1'], - 'type': 'mozilla::net::nsServerSocket', - 'headers': ['/netwerk/base/nsServerSocket.h'], - }, - { - 'cid': '{fb8cbf4e-4701-4ba1-b1d6-5388e041fb67}', - 'contract_ids': ['@mozilla.org/network/simple-stream-listener;1'], - 'type': 'mozilla::net::nsSimpleStreamListener', - 'headers': ['/netwerk/base/nsSimpleStreamListener.h'], - }, - { - 'cid': '{2be14592-28d4-4a83-8fe9-08e778849f6e}', - 'contract_ids': ['@mozilla.org/network/simple-uri-mutator;1'], - 'type': 'mozilla::net::nsSimpleURI::Mutator', - 'headers': ['nsSimpleURI.h'], - 'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS, - }, - { - 'cid': '{ad56b25f-e6bb-4db3-9f7b-5b7db33fd2b1}', - 'contract_ids': ['@mozilla.org/network/socket-transport-service;1'], - 'singleton': True, - 'type': 'mozilla::net::nsSocketTransportService', - 'headers': ['/netwerk/base/nsSocketTransportService2.h'], - 'init_method': 'Init', - 'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS, - }, - { - 'cid': '{ce7d7da0-fb28-44a3-8c7b-000c165918f4}', - 'contract_ids': ['@mozilla.org/network/standard-url-mutator;1'], - 'type': 'mozilla::net::nsStandardURL::Mutator', - 'headers': ['/netwerk/base/nsStandardURL.h'], - 'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS, - }, - { - 'cid': '{831f8f13-7aa8-485f-b02e-77c881cc5773}', - 'contract_ids': ['@mozilla.org/network/stream-listener-tee;1'], - 'type': 'mozilla::net::nsStreamListenerTee', - 'headers': ['/netwerk/base/nsStreamListenerTee.h'], - }, - { - 'cid': '{5ba6d920-d4e9-11d3-a1a5-0050041caf44}', - 'contract_ids': ['@mozilla.org/network/stream-loader;1'], - 'legacy_constructor': 'mozilla::net::nsStreamLoader::Create', - 'headers': ['/netwerk/base/nsStreamLoader.h'], - }, - { - 'cid': '{0885d4f8-f7b8-4cda-902e-94ba38bc256e}', - 'contract_ids': ['@mozilla.org/network/stream-transport-service;1'], - 'type': 'mozilla::net::nsStreamTransportService', - 'headers': ['/netwerk/base/nsStreamTransportService.h'], - 'init_method': 'Init', - }, - { - 'cid': '{4c39159c-cd90-4dd3-97a7-06af5e6d84c4}', - 'contract_ids': ['@mozilla.org/network/throttlequeue;1'], - 'type': 'mozilla::net::ThrottleQueue', - 'headers': ['/netwerk/base/ThrottleQueue.h'], - }, - { - 'cid': '{1813cbb4-c98e-4622-8c7d-839167f3f272}', - 'contract_ids': ['@mozilla.org/network/tls-server-socket;1'], - 'type': 'mozilla::net::TLSServerSocket', - 'headers': ['/netwerk/base/TLSServerSocket.h'], - }, - { - 'cid': '{c9f74572-7b8e-4fec-bb4a-03c0d3021bd6}', - 'contract_ids': ['@mozilla.org/network/udp-socket;1'], - 'type': 'mozilla::net::nsUDPSocket', - 'headers': ['/netwerk/base/nsUDPSocket.h'], - }, - { - 'cid': '{ff41913b-546a-4bff-9201-dc9b2c032eba}', - 'contract_ids': ['@mozilla.org/network/url-parser;1?auth=maybe'], - 'type': 'nsStdURLParser', - 'headers': ['nsURLParsers.h'], - 'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS, - }, - { - 'cid': '{78804a84-8173-42b6-bb94-789f0816a810}', - 'contract_ids': ['@mozilla.org/network/url-parser;1?auth=no'], - 'type': 'nsNoAuthURLParser', - 'headers': ['nsURLParsers.h'], - 'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS, - }, - { - 'cid': '{275d800e-3f60-4896-adb7-d7f390ce0e42}', - 'contract_ids': ['@mozilla.org/network/url-parser;1?auth=yes'], - 'type': 'nsAuthURLParser', - 'headers': ['nsURLParsers.h'], - 'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS, - }, - { - 'cid': '{892ffeb0-3f80-11d3-a16c-0050041caf44}', - 'contract_ids': ['@mozilla.org/streamConverters;1'], - 'legacy_constructor': 'CreateNewStreamConvServiceFactory', - }, - { - 'cid': '{cf0f71fd-fafd-4e2b-9fdc-134d972e16e2}', - 'contract_ids': ['@mozilla.org/streamconv;1?from=application/http-index-format&to=text/html'], - 'legacy_constructor': 'nsIndexedToHTML::Create', - 'headers': ['/netwerk/streamconv/converters/nsIndexedToHTML.h'], - }, - { - 'cid': '{7d7008a0-c49a-11d3-9b22-0080c7cb1080}', - 'contract_ids': ['@mozilla.org/streamconv;1?from=application/x-unknown-content-type&to=*/*'], - 'legacy_constructor': 'CreateNewUnknownDecoderFactory', - }, - { - 'cid': '{66230b2b-17fa-4bd3-abf4-07986151022d}', - 'contract_ids': [ - '@mozilla.org/streamconv;1?from=br&to=uncompressed', - '@mozilla.org/streamconv;1?from=compress&to=uncompressed', - '@mozilla.org/streamconv;1?from=deflate&to=uncompressed', - '@mozilla.org/streamconv;1?from=gzip&to=uncompressed', - '@mozilla.org/streamconv;1?from=x-compress&to=uncompressed', - '@mozilla.org/streamconv;1?from=x-gzip&to=uncompressed', - ], - 'legacy_constructor': 'CreateNewHTTPCompressConvFactory', - }, - { - 'cid': '{7584ce90-5b25-11d3-a175-0050041caf44}', - 'contract_ids': [ - '@mozilla.org/streamconv;1?from=multipart/byteranges&to=*/*', - '@mozilla.org/streamconv;1?from=multipart/mixed&to=*/*', - '@mozilla.org/streamconv;1?from=multipart/x-mixed-replace&to=*/*', - ], - 'legacy_constructor': 'CreateNewMultiMixedConvFactory', - }, - { - 'cid': '{14c0e880-623e-11d3-a178-0050041caf44}', - 'contract_ids': ['@mozilla.org/streamconv;1?from=text/ftp-dir&to=application/http-index-format'], - 'legacy_constructor': 'CreateNewFTPDirListingConv', - }, - { - 'cid': '{77c0e42a-1dd2-11b2-8ebf-edc6606f2f4b}', - 'contract_ids': ['@mozilla.org/txttohtmlconv;1'], - 'legacy_constructor': 'CreateNewTXTToHTMLConvFactory', - }, - { - 'cid': '{2f277c00-0eaf-4ddb-b936-41326ba48aae}', - 'contract_ids': [], - 'type': 'mozilla::net::nsNestedAboutURI::Mutator', - 'headers': ['/netwerk/protocol/about/nsAboutProtocolHandler.h'], - }, - { - 'cid': '{56388dad-287b-4240-a785-85c394012503}', - 'contract_ids': [], - 'type': 'mozilla::net::nsSimpleNestedURI::Mutator', - 'headers': ['nsSimpleNestedURI.h'], - }, - { - 'cid': '{9c4e9d49-ce64-4ca3-acef-3075c5e5aba7}', - 'contract_ids': [], - 'type': 'mozilla::net::nsSimpleNestedURI::Mutator', - 'headers': ['nsSimpleNestedURI.h'], - }, - { - 'cid': '{b0054ef3-b096-483d-8242-4ee36b7b2115}', - 'contract_ids': [], - 'type': 'mozilla::net::nsNestedAboutURI::Mutator', - 'headers': ['/netwerk/protocol/about/nsAboutProtocolHandler.h'], - }, - { - 'cid': '{b3cfeb91-332a-46c9-ad97-93ff39841494}', - 'contract_ids': [], - 'type': 'mozilla::net::SubstitutingURL::Mutator', - 'headers': ['mozilla/net/SubstitutingURL.h'], - }, - { - 'cid': '{de9472d0-8034-11d3-9399-00104ba0fd40}', - 'contract_ids': [], - 'type': 'mozilla::net::nsStandardURL::Mutator', - 'headers': ['/netwerk/base/nsStandardURL.h'], - 'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS, - }, - { - 'cid': '{dea9657c-18cf-4984-bde9-ccef5d8ab473}', - 'contract_ids': [], - 'type': 'mozilla::net::SubstitutingURL::Mutator', - 'headers': ['mozilla/net/SubstitutingURL.h'], - }, - { - 'cid': '{e0da1d70-2f7b-11d3-8cd0-0060b0fc14a3}', - 'contract_ids': [], - 'type': 'mozilla::net::nsSimpleURI::Mutator', - 'headers': ['nsSimpleURI.h'], - 'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS, - }, -] - -if defined('NECKO_COOKIES'): - Classes += [ - { - 'cid': '{c375fa80-150f-11d6-a618-0010a401eb10}', - 'contract_ids': [ - '@mozilla.org/cookieService;1', - '@mozilla.org/cookiemanager;1', - ], - 'singleton': True, - 'type': 'nsICookieService', - 'constructor': 'nsCookieService::GetXPCOMSingleton', - 'headers': ['/netwerk/cookie/nsCookieService.h'], - }, - ] - -if defined('NECKO_WIFI'): - Classes += [ - { - 'cid': '{3ff8fb9f-ee63-48df-89f0-dace0242fd82}', - 'contract_ids': ['@mozilla.org/wifi/monitor;1'], - 'singleton': True, - 'type': 'nsWifiMonitor', - 'headers': ['/netwerk/wifi/nsWifiMonitor.h'], - }, - ] - -if buildconfig.substs['OS_ARCH'] in ('WINNT', 'Darwin', 'Linux'): - Classes += [ - { - 'cid': '{296d0900-f8ef-4df0-9c35-db5862abc58d}', - 'contract_ids': ['@mozilla.org/network-info-service;1'], - 'type': 'mozilla::net::nsNetworkInfoService', - 'headers': ['/netwerk/base/nsNetworkInfoService.h'], - 'init_method': 'Init', - }, - ] - - -toolkit = buildconfig.substs['MOZ_WIDGET_TOOLKIT'] -link_service = None -if toolkit == 'windows': - link_service = { - 'type': 'nsNotifyAddrListener', - 'headers': ['/netwerk/system/win32/nsNotifyAddrListener.h'], - 'init_method': 'Init', - } -elif toolkit == 'cocoa': - link_service = { - 'type': 'nsNetworkLinkService', - 'headers': ['/netwerk/system/mac/nsNetworkLinkService.h'], - 'init_method': 'Init', - } -elif toolkit == 'android': - link_service = { - 'type': 'nsAndroidNetworkLinkService', - 'headers': ['/netwerk/system/android/nsAndroidNetworkLinkService.h'], - } -elif buildconfig.substs['OS_ARCH'] == 'Linux': - link_service = { - 'type': 'nsNotifyAddrListener', - 'headers': ['/netwerk/system/linux/nsNotifyAddrListener_Linux.h'], - 'init_method': 'Init', - } - -if link_service: - Classes += [ - dict({ - 'cid': '{75a500a2-0030-40f7-86f8-63f225b940ae}', - 'contract_ids': ['@mozilla.org/network/network-link-service;1'], - 'singleton': True, - }, **link_service) - ]
--- a/netwerk/build/moz.build +++ b/netwerk/build/moz.build @@ -7,20 +7,16 @@ EXPORTS += [ 'nsNetCID.h', ] SOURCES += [ 'nsNetModule.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' LOCAL_INCLUDES += [ '/extensions/auth', '/netwerk/base', '/netwerk/cache', @@ -40,13 +36,42 @@ LOCAL_INCLUDES += [ '/netwerk/streamconv/converters', ] if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: LOCAL_INCLUDES += [ '/netwerk/protocol/gio', ] +if CONFIG['OS_ARCH'] == 'WINNT': + LOCAL_INCLUDES += [ + '/netwerk/system/win32', + ] + +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': + LOCAL_INCLUDES += [ + '/netwerk/system/mac', + ] + +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': + LOCAL_INCLUDES += [ + '/netwerk/system/android', + ] + +elif CONFIG['OS_ARCH'] == 'Linux': + LOCAL_INCLUDES += [ + '/netwerk/system/linux', + ] + +if CONFIG['NECKO_COOKIES']: + LOCAL_INCLUDES += [ + '/netwerk/cookie', + ] + +if CONFIG['NECKO_WIFI']: + LOCAL_INCLUDES += [ + '/netwerk/wifi', + ] LOCAL_INCLUDES += [ '!/netwerk/dns', '/modules/brotli/dec', ]
--- a/netwerk/build/nsNetModule.cpp +++ b/netwerk/build/nsNetModule.cpp @@ -6,142 +6,377 @@ #include "necko-config.h" #define ALLOW_LATE_HTTPLOG_H_INCLUDE 1 #include "base/basictypes.h" #include "nsCOMPtr.h" #include "nsIClassInfoImpl.h" -#include "mozilla/Components.h" #include "mozilla/ModuleUtils.h" #include "nsIComponentManager.h" #include "nsIServiceManager.h" #include "nsICategoryManager.h" #include "nscore.h" #include "nsSimpleURI.h" +#include "nsSimpleNestedURI.h" #include "nsLoadGroup.h" +#include "nsStreamLoader.h" +#include "nsIncrementalStreamLoader.h" +#include "nsFileStreams.h" +#include "nsBufferedStreams.h" +#include "nsMIMEInputStream.h" +#include "nsSOCKSSocketProvider.h" +#include "nsCacheService.h" +#include "nsDiskCacheDeviceSQL.h" +#include "nsApplicationCacheService.h" #include "nsMimeTypes.h" #include "nsDNSPrefetch.h" +#include "nsAboutProtocolHandler.h" #include "nsXULAppAPI.h" #include "nsCategoryCache.h" #include "nsIContentSniffer.h" -#include "nsStandardURL.h" +#include "Predictor.h" #include "nsIThreadPool.h" #include "mozilla/net/BackgroundChannelRegistrar.h" #include "mozilla/net/NeckoChild.h" #include "RedirectChannelRegistrar.h" #include "nsAuthGSSAPI.h" #include "nsNetCID.h" #if defined(XP_MACOSX) || defined(XP_WIN) || defined(XP_LINUX) # define BUILD_NETWORK_INFO_SERVICE 1 #endif -using namespace mozilla; - typedef nsCategoryCache<nsIContentSniffer> ContentSnifferCache; ContentSnifferCache* gNetSniffers = nullptr; ContentSnifferCache* gDataSniffers = nullptr; -#define static +/////////////////////////////////////////////////////////////////////////////// + +#include "nsIOService.h" +typedef mozilla::net::nsIOService nsIOService; +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIOService, nsIOService::GetInstance) + +#include "nsDNSService2.h" +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIDNSService, + nsDNSService::GetXPCOMSingleton) + +#include "nsProtocolProxyService.h" +typedef mozilla::net::nsProtocolProxyService nsProtocolProxyService; +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsProtocolProxyService, Init) + +#include "nsStreamTransportService.h" +typedef mozilla::net::nsStreamTransportService nsStreamTransportService; +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStreamTransportService, Init) + +#include "nsSocketTransportService2.h" +typedef mozilla::net::nsSocketTransportService nsSocketTransportService; +#undef LOG +#undef LOG_ENABLED +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSocketTransportService, Init) + +#include "nsServerSocket.h" +typedef mozilla::net::nsServerSocket nsServerSocket; +NS_GENERIC_FACTORY_CONSTRUCTOR(nsServerSocket) + +#include "TLSServerSocket.h" +typedef mozilla::net::TLSServerSocket TLSServerSocket; +NS_GENERIC_FACTORY_CONSTRUCTOR(TLSServerSocket) + +#include "nsUDPSocket.h" +typedef mozilla::net::nsUDPSocket nsUDPSocket; +NS_GENERIC_FACTORY_CONSTRUCTOR(nsUDPSocket) + +#include "nsAsyncStreamCopier.h" +NS_GENERIC_FACTORY_CONSTRUCTOR(nsAsyncStreamCopier) + +#include "nsInputStreamPump.h" +NS_GENERIC_FACTORY_CONSTRUCTOR(nsInputStreamPump) + +#include "nsInputStreamChannel.h" +typedef mozilla::net::nsInputStreamChannel nsInputStreamChannel; +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsInputStreamChannel, Init) + +#include "nsDownloader.h" +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDownloader) + +#include "BackgroundFileSaver.h" +namespace mozilla { +namespace net { +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(BackgroundFileSaverOutputStream, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(BackgroundFileSaverStreamListener, Init) +} // namespace net +} // namespace mozilla + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsAtomicFileOutputStream) + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSafeFileOutputStream) + typedef mozilla::net::nsLoadGroup nsLoadGroup; NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsLoadGroup, Init) -#undef static + +#include "ArrayBufferInputStream.h" +NS_GENERIC_FACTORY_CONSTRUCTOR(ArrayBufferInputStream) + +#include "nsEffectiveTLDService.h" +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsEffectiveTLDService, Init) + +#include "nsSerializationHelper.h" +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSerializationHelper) + +#include "CacheStorageService.h" +typedef mozilla::net::CacheStorageService CacheStorageService; +NS_GENERIC_FACTORY_CONSTRUCTOR(CacheStorageService) + +#include "LoadContextInfo.h" +typedef mozilla::net::LoadContextInfoFactory LoadContextInfoFactory; +NS_GENERIC_FACTORY_CONSTRUCTOR(LoadContextInfoFactory) + +/////////////////////////////////////////////////////////////////////////////// + +#include "mozilla/net/CaptivePortalService.h" +namespace mozilla { +namespace net { +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsICaptivePortalService, + CaptivePortalService::GetSingleton) +} // namespace net +} // namespace mozilla + +#include "mozilla/net/NetworkConnectivityService.h" +namespace mozilla { +namespace net { +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR( + nsINetworkConnectivityService, NetworkConnectivityService::GetSingleton) +} // namespace net +} // namespace mozilla + +/////////////////////////////////////////////////////////////////////////////// + +extern nsresult net_NewIncrementalDownload(nsISupports*, const nsIID&, void**); + +#define NS_INCREMENTALDOWNLOAD_CID \ + { /* a62af1ba-79b3-4896-8aaf-b148bfce4280 */ \ + 0xa62af1ba, 0x79b3, 0x4896, { \ + 0x8a, 0xaf, 0xb1, 0x48, 0xbf, 0xce, 0x42, 0x80 \ + } \ + } + +/////////////////////////////////////////////////////////////////////////////// + +#include "nsMIMEHeaderParamImpl.h" + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsMIMEHeaderParamImpl) +/////////////////////////////////////////////////////////////////////////////// + +#include "nsSimpleStreamListener.h" + +typedef mozilla::net::nsSimpleStreamListener nsSimpleStreamListener; +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSimpleStreamListener) + +/////////////////////////////////////////////////////////////////////////////// + +#include "nsStreamListenerTee.h" +typedef mozilla::net::nsStreamListenerTee nsStreamListenerTee; +NS_GENERIC_FACTORY_CONSTRUCTOR(nsStreamListenerTee) + +/////////////////////////////////////////////////////////////////////////////// + +#ifdef NECKO_COOKIES +# include "nsCookieService.h" +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsICookieService, + nsCookieService::GetXPCOMSingleton) +#endif + +/////////////////////////////////////////////////////////////////////////////// +#ifdef NECKO_WIFI + +# include "nsWifiMonitor.h" +# undef LOG +# undef LOG_ENABLED +NS_GENERIC_FACTORY_CONSTRUCTOR(nsWifiMonitor) + +#endif /////////////////////////////////////////////////////////////////////////////// // protocols /////////////////////////////////////////////////////////////////////////////// +// about:blank is mandatory +#include "nsAboutProtocolHandler.h" +#include "nsAboutBlank.h" +typedef mozilla::net::nsAboutProtocolHandler nsAboutProtocolHandler; +typedef mozilla::net::nsSafeAboutProtocolHandler nsSafeAboutProtocolHandler; +typedef mozilla::net::nsNestedAboutURI::Mutator nsNestedAboutURIMutator; +NS_GENERIC_FACTORY_CONSTRUCTOR(nsAboutProtocolHandler) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSafeAboutProtocolHandler) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsNestedAboutURIMutator) + +// about +#include "nsAboutCache.h" +#include "nsAboutCacheEntry.h" +NS_GENERIC_FACTORY_CONSTRUCTOR(nsAboutCacheEntry) + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsApplicationCacheService) + +// file +#include "nsFileProtocolHandler.h" +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsFileProtocolHandler, Init) + +// ftp +#include "nsFtpProtocolHandler.h" +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsFtpProtocolHandler, Init) + // http/https #include "nsHttpHandler.h" #include "Http2Compression.h" #undef LOG #undef LOG_ENABLED #include "nsHttpAuthManager.h" #include "nsHttpActivityDistributor.h" #include "ThrottleQueue.h" #undef LOG #undef LOG_ENABLED +namespace mozilla { +namespace net { +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsHttpHandler, + nsHttpHandler::GetInstance) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHttpsHandler, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHttpAuthManager, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpActivityDistributor) +NS_GENERIC_FACTORY_CONSTRUCTOR(ThrottleQueue) +} // namespace net +} // namespace mozilla -NS_IMPL_COMPONENT_FACTORY(net::nsHttpHandler) { - return net::nsHttpHandler::GetInstance().downcast<nsIHttpProtocolHandler>(); -} - -NS_IMPL_COMPONENT_FACTORY(net::nsHttpsHandler) { - auto handler = MakeRefPtr<net::nsHttpsHandler>(); +#include "mozilla/net/Dashboard.h" +namespace mozilla { +namespace net { +NS_GENERIC_FACTORY_CONSTRUCTOR(Dashboard) +} // namespace net +} // namespace mozilla - if (NS_FAILED(handler->Init())) { - return nullptr; - } - return handler.forget().downcast<nsIHttpProtocolHandler>(); -} - +// resource +#include "nsResProtocolHandler.h" +#include "ExtensionProtocolHandler.h" +#include "SubstitutingProtocolHandler.h" +typedef mozilla::net::ExtensionProtocolHandler ExtensionProtocolHandler; +typedef mozilla::net::SubstitutingURL::Mutator SubstitutingURLMutator; +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsResProtocolHandler, Init) -#include "nsCacheService.h" +namespace mozilla { +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ExtensionProtocolHandler, + ExtensionProtocolHandler::GetSingleton) +NS_GENERIC_FACTORY_CONSTRUCTOR(SubstitutingURLMutator) +} // namespace mozilla -nsresult nsCacheServiceConstructor(nsISupports* aOuter, const nsIID& aIID, - void** aResult) { - return nsCacheService::Create(aOuter, aIID, aResult); -} +#include "nsViewSourceHandler.h" +typedef mozilla::net::nsViewSourceHandler nsViewSourceHandler; +NS_GENERIC_FACTORY_CONSTRUCTOR(nsViewSourceHandler) + +#include "nsDataHandler.h" + +#include "nsWyciwygProtocolHandler.h" +NS_GENERIC_FACTORY_CONSTRUCTOR(nsWyciwygProtocolHandler) #include "WebSocketChannel.h" #include "WebSocketChannelChild.h" namespace mozilla { namespace net { static BaseWebSocketChannel* WebSocketChannelConstructor(bool aSecure) { if (IsNeckoChild()) { return new WebSocketChannelChild(aSecure); } if (aSecure) { return new WebSocketSSLChannel; } return new WebSocketChannel; } -#define WEB_SOCKET_HANDLER_CONSTRUCTOR(type, secure) \ - nsresult type##Constructor(nsISupports* aOuter, REFNSIID aIID, \ - void** aResult) { \ - nsresult rv; \ - \ - BaseWebSocketChannel* inst; \ - \ - *aResult = nullptr; \ - if (nullptr != aOuter) { \ - rv = NS_ERROR_NO_AGGREGATION; \ - return rv; \ - } \ - inst = WebSocketChannelConstructor(secure); \ - NS_ADDREF(inst); \ - rv = inst->QueryInterface(aIID, aResult); \ - NS_RELEASE(inst); \ - return rv; \ +#define WEB_SOCKET_HANDLER_CONSTRUCTOR(type, secure) \ + static nsresult type##Constructor(nsISupports* aOuter, REFNSIID aIID, \ + void** aResult) { \ + nsresult rv; \ + \ + BaseWebSocketChannel* inst; \ + \ + *aResult = nullptr; \ + if (nullptr != aOuter) { \ + rv = NS_ERROR_NO_AGGREGATION; \ + return rv; \ + } \ + inst = WebSocketChannelConstructor(secure); \ + NS_ADDREF(inst); \ + rv = inst->QueryInterface(aIID, aResult); \ + NS_RELEASE(inst); \ + return rv; \ } WEB_SOCKET_HANDLER_CONSTRUCTOR(WebSocketChannel, false) WEB_SOCKET_HANDLER_CONSTRUCTOR(WebSocketSSLChannel, true) #undef WEB_SOCKET_HANDLER_CONSTRUCTOR } // namespace net } // namespace mozilla /////////////////////////////////////////////////////////////////////////////// +#include "nsURLParsers.h" +NS_GENERIC_FACTORY_CONSTRUCTOR(nsNoAuthURLParser) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsAuthURLParser) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsStdURLParser) + +#include "nsStandardURL.h" +typedef mozilla::net::nsStandardURL::Mutator nsStandardURLMutator; +NS_GENERIC_FACTORY_CONSTRUCTOR(nsStandardURLMutator) +typedef mozilla::net::nsSimpleURI::Mutator nsSimpleURIMutator; +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSimpleURIMutator) + +typedef mozilla::net::nsSimpleNestedURI::Mutator nsSimpleNestedURIMutator; +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSimpleNestedURIMutator) + +/////////////////////////////////////////////////////////////////////////////// + +#include "nsIDNService.h" +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsIDNService, Init) + +/////////////////////////////////////////////////////////////////////////////// +#if defined(XP_WIN) +# include "nsNotifyAddrListener.h" +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNotifyAddrListener, Init) +#elif defined(MOZ_WIDGET_COCOA) +# include "nsNetworkLinkService.h" +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNetworkLinkService, Init) +#elif defined(MOZ_WIDGET_ANDROID) +# include "nsAndroidNetworkLinkService.h" +NS_GENERIC_FACTORY_CONSTRUCTOR(nsAndroidNetworkLinkService) +#elif defined(XP_LINUX) +# include "nsNotifyAddrListener_Linux.h" +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNotifyAddrListener, Init) +#endif + +/////////////////////////////////////////////////////////////////////////////// + #include "nsFTPDirListingConv.h" nsresult NS_NewFTPDirListingConv(nsFTPDirListingConv** result); #include "nsStreamConverterService.h" #include "nsMultiMixedConv.h" #include "nsHTTPCompressConv.h" #include "mozTXTToHTMLConv.h" #include "nsUnknownDecoder.h" /////////////////////////////////////////////////////////////////////////////// +#ifdef BUILD_NETWORK_INFO_SERVICE +# include "nsNetworkInfoService.h" +typedef mozilla::net::nsNetworkInfoService nsNetworkInfoService; +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNetworkInfoService, Init) +#endif // BUILD_NETWORK_INFO_SERVICE + #include "nsIndexedToHTML.h" nsresult NS_NewMultiMixedConv(nsMultiMixedConv** result); nsresult MOZ_NewTXTToHTMLConv(mozTXTToHTMLConv** result); nsresult NS_NewHTTPCompressConv(mozilla::net::nsHTTPCompressConv** result); nsresult NS_NewStreamConv(nsStreamConverterService** aStreamConv); #define FTP_TO_INDEX "?from=text/ftp-dir&to=application/http-index-format" @@ -168,18 +403,19 @@ static const mozilla::Module::CategoryEn {NS_ISTREAMCONVERTER_KEY, XGZIP_TO_UNCOMPRESSED, ""}, {NS_ISTREAMCONVERTER_KEY, BROTLI_TO_UNCOMPRESSED, ""}, {NS_ISTREAMCONVERTER_KEY, COMPRESS_TO_UNCOMPRESSED, ""}, {NS_ISTREAMCONVERTER_KEY, XCOMPRESS_TO_UNCOMPRESSED, ""}, {NS_ISTREAMCONVERTER_KEY, DEFLATE_TO_UNCOMPRESSED, ""}, NS_BINARYDETECTOR_CATEGORYENTRY, {nullptr}}; -nsresult CreateNewStreamConvServiceFactory(nsISupports* aOuter, REFNSIID aIID, - void** aResult) { +static nsresult CreateNewStreamConvServiceFactory(nsISupports* aOuter, + REFNSIID aIID, + void** aResult) { if (!aResult) { return NS_ERROR_INVALID_POINTER; } if (aOuter) { *aResult = nullptr; return NS_ERROR_NO_AGGREGATION; } nsStreamConverterService* inst = nullptr; @@ -191,18 +427,18 @@ nsresult CreateNewStreamConvServiceFacto rv = inst->QueryInterface(aIID, aResult); if (NS_FAILED(rv)) { *aResult = nullptr; } NS_RELEASE(inst); /* get rid of extra refcnt */ return rv; } -nsresult CreateNewFTPDirListingConv(nsISupports* aOuter, REFNSIID aIID, - void** aResult) { +static nsresult CreateNewFTPDirListingConv(nsISupports* aOuter, REFNSIID aIID, + void** aResult) { if (!aResult) { return NS_ERROR_INVALID_POINTER; } if (aOuter) { *aResult = nullptr; return NS_ERROR_NO_AGGREGATION; } nsFTPDirListingConv* inst = nullptr; @@ -214,18 +450,18 @@ nsresult CreateNewFTPDirListingConv(nsIS rv = inst->QueryInterface(aIID, aResult); if (NS_FAILED(rv)) { *aResult = nullptr; } NS_RELEASE(inst); /* get rid of extra refcnt */ return rv; } -nsresult CreateNewMultiMixedConvFactory(nsISupports* aOuter, REFNSIID aIID, - void** aResult) { +static nsresult CreateNewMultiMixedConvFactory(nsISupports* aOuter, + REFNSIID aIID, void** aResult) { if (!aResult) { return NS_ERROR_INVALID_POINTER; } if (aOuter) { *aResult = nullptr; return NS_ERROR_NO_AGGREGATION; } nsMultiMixedConv* inst = nullptr; @@ -237,18 +473,18 @@ nsresult CreateNewMultiMixedConvFactory( rv = inst->QueryInterface(aIID, aResult); if (NS_FAILED(rv)) { *aResult = nullptr; } NS_RELEASE(inst); /* get rid of extra refcnt */ return rv; } -nsresult CreateNewTXTToHTMLConvFactory(nsISupports* aOuter, REFNSIID aIID, - void** aResult) { +static nsresult CreateNewTXTToHTMLConvFactory(nsISupports* aOuter, + REFNSIID aIID, void** aResult) { if (!aResult) { return NS_ERROR_INVALID_POINTER; } if (aOuter) { *aResult = nullptr; return NS_ERROR_NO_AGGREGATION; } mozTXTToHTMLConv* inst = nullptr; @@ -260,18 +496,19 @@ nsresult CreateNewTXTToHTMLConvFactory(n rv = inst->QueryInterface(aIID, aResult); if (NS_FAILED(rv)) { *aResult = nullptr; } NS_RELEASE(inst); /* get rid of extra refcnt */ return rv; } -nsresult CreateNewHTTPCompressConvFactory(nsISupports* aOuter, REFNSIID aIID, - void** aResult) { +static nsresult CreateNewHTTPCompressConvFactory(nsISupports* aOuter, + REFNSIID aIID, + void** aResult) { if (!aResult) { return NS_ERROR_INVALID_POINTER; } if (aOuter) { *aResult = nullptr; return NS_ERROR_NO_AGGREGATION; } mozilla::net::nsHTTPCompressConv* inst = nullptr; @@ -283,18 +520,18 @@ nsresult CreateNewHTTPCompressConvFactor rv = inst->QueryInterface(aIID, aResult); if (NS_FAILED(rv)) { *aResult = nullptr; } NS_RELEASE(inst); /* get rid of extra refcnt */ return rv; } -nsresult CreateNewUnknownDecoderFactory(nsISupports* aOuter, REFNSIID aIID, - void** aResult) { +static nsresult CreateNewUnknownDecoderFactory(nsISupports* aOuter, + REFNSIID aIID, void** aResult) { nsresult rv; if (!aResult) { return NS_ERROR_NULL_POINTER; } *aResult = nullptr; if (aOuter) { @@ -309,18 +546,18 @@ nsresult CreateNewUnknownDecoderFactory( } NS_ADDREF(inst); rv = inst->QueryInterface(aIID, aResult); NS_RELEASE(inst); return rv; } -nsresult CreateNewBinaryDetectorFactory(nsISupports* aOuter, REFNSIID aIID, - void** aResult) { +static nsresult CreateNewBinaryDetectorFactory(nsISupports* aOuter, + REFNSIID aIID, void** aResult) { nsresult rv; if (!aResult) { return NS_ERROR_NULL_POINTER; } *aResult = nullptr; if (aOuter) { @@ -337,23 +574,23 @@ nsresult CreateNewBinaryDetectorFactory( return rv; } /////////////////////////////////////////////////////////////////////////////// // Module implementation for the net library // Net module startup hook -nsresult nsNetStartup() { +static nsresult nsNetStartup() { mozilla::net::nsStandardURL::InitGlobalObjects(); return NS_OK; } // Net module shutdown hook -void nsNetShutdown() { +static void nsNetShutdown() { // Release the url parser that the stdurl is holding. mozilla::net::nsStandardURL::ShutdownGlobalObjects(); // Release global state used by the URL helper module. net_ShutdownURLHelper(); #ifdef XP_MACOSX net_ShutdownURLHelperOSX(); #endif @@ -373,18 +610,334 @@ void nsNetShutdown() { nsAuthGSSAPI::Shutdown(); delete gNetSniffers; gNetSniffers = nullptr; delete gDataSniffers; gDataSniffers = nullptr; } -static const mozilla::Module kNeckoModule = {mozilla::Module::kVersion, - nullptr, - nullptr, - kNeckoCategories, - nullptr, - nullptr, - nullptr, - mozilla::Module::ALLOW_IN_SOCKET_PROCESS}; +NS_DEFINE_NAMED_CID(NS_IOSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_STREAMTRANSPORTSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_SOCKETTRANSPORTSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_SERVERSOCKET_CID); +NS_DEFINE_NAMED_CID(NS_TLSSERVERSOCKET_CID); +NS_DEFINE_NAMED_CID(NS_UDPSOCKET_CID); +NS_DEFINE_NAMED_CID(NS_DNSSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_IDNSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_EFFECTIVETLDSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_SIMPLEURI_CID); +NS_DEFINE_NAMED_CID(NS_SIMPLEURIMUTATOR_CID); +NS_DEFINE_NAMED_CID(NS_SIMPLENESTEDURI_CID); +NS_DEFINE_NAMED_CID(NS_SIMPLENESTEDURIMUTATOR_CID); +NS_DEFINE_NAMED_CID(NS_ASYNCSTREAMCOPIER_CID); +NS_DEFINE_NAMED_CID(NS_INPUTSTREAMPUMP_CID); +NS_DEFINE_NAMED_CID(NS_INPUTSTREAMCHANNEL_CID); +NS_DEFINE_NAMED_CID(NS_STREAMLOADER_CID); +NS_DEFINE_NAMED_CID(NS_INCREMENTALSTREAMLOADER_CID); +NS_DEFINE_NAMED_CID(NS_DOWNLOADER_CID); +NS_DEFINE_NAMED_CID(NS_BACKGROUNDFILESAVEROUTPUTSTREAM_CID); +NS_DEFINE_NAMED_CID(NS_BACKGROUNDFILESAVERSTREAMLISTENER_CID); +NS_DEFINE_NAMED_CID(NS_SIMPLESTREAMLISTENER_CID); +NS_DEFINE_NAMED_CID(NS_STREAMLISTENERTEE_CID); +NS_DEFINE_NAMED_CID(NS_LOADGROUP_CID); +NS_DEFINE_NAMED_CID(NS_LOCALFILEINPUTSTREAM_CID); +NS_DEFINE_NAMED_CID(NS_LOCALFILEOUTPUTSTREAM_CID); +NS_DEFINE_NAMED_CID(NS_ATOMICLOCALFILEOUTPUTSTREAM_CID); +NS_DEFINE_NAMED_CID(NS_SAFELOCALFILEOUTPUTSTREAM_CID); +NS_DEFINE_NAMED_CID(NS_INCREMENTALDOWNLOAD_CID); +NS_DEFINE_NAMED_CID(NS_STDURLPARSER_CID); +NS_DEFINE_NAMED_CID(NS_NOAUTHURLPARSER_CID); +NS_DEFINE_NAMED_CID(NS_AUTHURLPARSER_CID); +NS_DEFINE_NAMED_CID(NS_STANDARDURL_CID); +NS_DEFINE_NAMED_CID(NS_STANDARDURLMUTATOR_CID); +NS_DEFINE_NAMED_CID(NS_ARRAYBUFFERINPUTSTREAM_CID); +NS_DEFINE_NAMED_CID(NS_BUFFEREDINPUTSTREAM_CID); +NS_DEFINE_NAMED_CID(NS_BUFFEREDOUTPUTSTREAM_CID); +NS_DEFINE_NAMED_CID(NS_MIMEINPUTSTREAM_CID); +NS_DEFINE_NAMED_CID(NS_PROTOCOLPROXYSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_STREAMCONVERTERSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_DASHBOARD_CID); +NS_DEFINE_NAMED_CID(NS_FTPDIRLISTINGCONVERTER_CID); +NS_DEFINE_NAMED_CID(NS_NSINDEXEDTOHTMLCONVERTER_CID); +NS_DEFINE_NAMED_CID(NS_MULTIMIXEDCONVERTER_CID); +NS_DEFINE_NAMED_CID(NS_UNKNOWNDECODER_CID); +NS_DEFINE_NAMED_CID(NS_BINARYDETECTOR_CID); +NS_DEFINE_NAMED_CID(NS_HTTPCOMPRESSCONVERTER_CID); +NS_DEFINE_NAMED_CID(MOZITXTTOHTMLCONV_CID); +NS_DEFINE_NAMED_CID(NS_MIMEHEADERPARAM_CID); +NS_DEFINE_NAMED_CID(NS_FILEPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_HTTPPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_HTTPSPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_HTTPAUTHMANAGER_CID); +NS_DEFINE_NAMED_CID(NS_HTTPACTIVITYDISTRIBUTOR_CID); +NS_DEFINE_NAMED_CID(NS_THROTTLEQUEUE_CID); +NS_DEFINE_NAMED_CID(NS_FTPPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_RESPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_EXTENSIONPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_SUBSTITUTINGURL_CID); +NS_DEFINE_NAMED_CID(NS_SUBSTITUTINGURLMUTATOR_CID); +NS_DEFINE_NAMED_CID(NS_ABOUTPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_SAFEABOUTPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_ABOUT_BLANK_MODULE_CID); +NS_DEFINE_NAMED_CID(NS_NESTEDABOUTURI_CID); +NS_DEFINE_NAMED_CID(NS_NESTEDABOUTURIMUTATOR_CID); +NS_DEFINE_NAMED_CID(NS_ABOUT_CACHE_MODULE_CID); +NS_DEFINE_NAMED_CID(NS_ABOUT_CACHE_ENTRY_MODULE_CID); +NS_DEFINE_NAMED_CID(NS_CACHESERVICE_CID); +NS_DEFINE_NAMED_CID(NS_APPLICATIONCACHESERVICE_CID); +#ifdef NECKO_COOKIES +NS_DEFINE_NAMED_CID(NS_COOKIEMANAGER_CID); +NS_DEFINE_NAMED_CID(NS_COOKIESERVICE_CID); +#endif +#ifdef NECKO_WIFI +NS_DEFINE_NAMED_CID(NS_WIFI_MONITOR_COMPONENT_CID); +#endif +NS_DEFINE_NAMED_CID(NS_DATAPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_VIEWSOURCEHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_WYCIWYGPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_WEBSOCKETPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_WEBSOCKETSSLPROTOCOLHANDLER_CID); +#if defined(XP_WIN) +NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID); +#elif defined(MOZ_WIDGET_COCOA) +NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID); +#elif defined(MOZ_WIDGET_ANDROID) +NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID); +#elif defined(XP_LINUX) +NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID); +#endif +NS_DEFINE_NAMED_CID(NS_SERIALIZATION_HELPER_CID); +NS_DEFINE_NAMED_CID(NS_CACHE_STORAGE_SERVICE_CID); +NS_DEFINE_NAMED_CID(NS_NSILOADCONTEXTINFOFACTORY_CID); +NS_DEFINE_NAMED_CID(NS_NETWORKPREDICTOR_CID); +NS_DEFINE_NAMED_CID(NS_CAPTIVEPORTAL_CID); +NS_DEFINE_NAMED_CID(NS_NETWORKCONNECTIVITYSERVICE_CID); +#ifdef BUILD_NETWORK_INFO_SERVICE +NS_DEFINE_NAMED_CID(NETWORKINFOSERVICE_CID); +#endif // BUILD_NETWORK_INFO_SERVICE + +static const mozilla::Module::CIDEntry kNeckoCIDs[] = { + // clang-format off + { &kNS_IOSERVICE_CID, false, nullptr, nsIOServiceConstructor, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { &kNS_STREAMTRANSPORTSERVICE_CID, false, nullptr, nsStreamTransportServiceConstructor }, + { &kNS_SOCKETTRANSPORTSERVICE_CID, false, nullptr, nsSocketTransportServiceConstructor, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { &kNS_SERVERSOCKET_CID, false, nullptr, nsServerSocketConstructor }, + { &kNS_TLSSERVERSOCKET_CID, false, nullptr, TLSServerSocketConstructor }, + { &kNS_UDPSOCKET_CID, false, nullptr, nsUDPSocketConstructor }, + { &kNS_DNSSERVICE_CID, false, nullptr, nsIDNSServiceConstructor, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { &kNS_IDNSERVICE_CID, false, nullptr, nsIDNServiceConstructor, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { &kNS_EFFECTIVETLDSERVICE_CID, false, nullptr, nsEffectiveTLDServiceConstructor }, + { &kNS_SIMPLEURI_CID, false, nullptr, nsSimpleURIMutatorConstructor, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, // do_CreateInstance returns mutator + { &kNS_SIMPLEURIMUTATOR_CID, false, nullptr, nsSimpleURIMutatorConstructor, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { &kNS_SIMPLENESTEDURI_CID, false, nullptr, nsSimpleNestedURIMutatorConstructor }, // do_CreateInstance returns mutator + { &kNS_SIMPLENESTEDURIMUTATOR_CID, false, nullptr, nsSimpleNestedURIMutatorConstructor }, + { &kNS_ASYNCSTREAMCOPIER_CID, false, nullptr, nsAsyncStreamCopierConstructor }, + { &kNS_INPUTSTREAMPUMP_CID, false, nullptr, nsInputStreamPumpConstructor }, + { &kNS_INPUTSTREAMCHANNEL_CID, false, nullptr, nsInputStreamChannelConstructor }, + { &kNS_STREAMLOADER_CID, false, nullptr, mozilla::net::nsStreamLoader::Create }, + { &kNS_INCREMENTALSTREAMLOADER_CID, false, nullptr, nsIncrementalStreamLoader::Create }, + { &kNS_DOWNLOADER_CID, false, nullptr, nsDownloaderConstructor }, + { &kNS_BACKGROUNDFILESAVEROUTPUTSTREAM_CID, false, nullptr, + mozilla::net::BackgroundFileSaverOutputStreamConstructor }, + { &kNS_BACKGROUNDFILESAVERSTREAMLISTENER_CID, false, nullptr, + mozilla::net::BackgroundFileSaverStreamListenerConstructor }, + { &kNS_SIMPLESTREAMLISTENER_CID, false, nullptr, nsSimpleStreamListenerConstructor }, + { &kNS_STREAMLISTENERTEE_CID, false, nullptr, nsStreamListenerTeeConstructor }, + { &kNS_LOADGROUP_CID, false, nullptr, nsLoadGroupConstructor }, + { &kNS_LOCALFILEINPUTSTREAM_CID, false, nullptr, nsFileInputStream::Create }, + { &kNS_LOCALFILEOUTPUTSTREAM_CID, false, nullptr, nsFileOutputStream::Create }, + { &kNS_ATOMICLOCALFILEOUTPUTSTREAM_CID, false, nullptr, nsAtomicFileOutputStreamConstructor }, + { &kNS_SAFELOCALFILEOUTPUTSTREAM_CID, false, nullptr, nsSafeFileOutputStreamConstructor }, + { &kNS_INCREMENTALDOWNLOAD_CID, false, nullptr, net_NewIncrementalDownload }, + { &kNS_STDURLPARSER_CID, false, nullptr, nsStdURLParserConstructor, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { &kNS_NOAUTHURLPARSER_CID, false, nullptr, nsNoAuthURLParserConstructor, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { &kNS_AUTHURLPARSER_CID, false, nullptr, nsAuthURLParserConstructor, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { &kNS_STANDARDURL_CID, false, nullptr, nsStandardURLMutatorConstructor, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, // do_CreateInstance returns mutator + { &kNS_STANDARDURLMUTATOR_CID, false, nullptr, nsStandardURLMutatorConstructor, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { &kNS_ARRAYBUFFERINPUTSTREAM_CID, false, nullptr, ArrayBufferInputStreamConstructor }, + { &kNS_BUFFEREDINPUTSTREAM_CID, false, nullptr, nsBufferedInputStream::Create }, + { &kNS_BUFFEREDOUTPUTSTREAM_CID, false, nullptr, nsBufferedOutputStream::Create }, + { &kNS_MIMEINPUTSTREAM_CID, false, nullptr, nsMIMEInputStreamConstructor }, + { &kNS_PROTOCOLPROXYSERVICE_CID, true, nullptr, nsProtocolProxyServiceConstructor }, + { &kNS_STREAMCONVERTERSERVICE_CID, false, nullptr, CreateNewStreamConvServiceFactory }, + { &kNS_DASHBOARD_CID, false, nullptr, mozilla::net::DashboardConstructor }, + { &kNS_FTPDIRLISTINGCONVERTER_CID, false, nullptr, CreateNewFTPDirListingConv }, + { &kNS_NSINDEXEDTOHTMLCONVERTER_CID, false, nullptr, nsIndexedToHTML::Create }, + { &kNS_MULTIMIXEDCONVERTER_CID, false, nullptr, CreateNewMultiMixedConvFactory }, + { &kNS_UNKNOWNDECODER_CID, false, nullptr, CreateNewUnknownDecoderFactory }, + { &kNS_BINARYDETECTOR_CID, false, nullptr, CreateNewBinaryDetectorFactory }, + { &kNS_HTTPCOMPRESSCONVERTER_CID, false, nullptr, CreateNewHTTPCompressConvFactory }, + { &kMOZITXTTOHTMLCONV_CID, false, nullptr, CreateNewTXTToHTMLConvFactory }, + { &kNS_MIMEHEADERPARAM_CID, false, nullptr, nsMIMEHeaderParamImplConstructor }, + { &kNS_FILEPROTOCOLHANDLER_CID, false, nullptr, nsFileProtocolHandlerConstructor }, + { &kNS_HTTPPROTOCOLHANDLER_CID, false, nullptr, mozilla::net::nsHttpHandlerConstructor }, + { &kNS_HTTPSPROTOCOLHANDLER_CID, false, nullptr, mozilla::net::nsHttpsHandlerConstructor }, + { &kNS_HTTPAUTHMANAGER_CID, false, nullptr, mozilla::net::nsHttpAuthManagerConstructor }, + { &kNS_HTTPACTIVITYDISTRIBUTOR_CID, false, nullptr, mozilla::net::nsHttpActivityDistributorConstructor }, + { &kNS_THROTTLEQUEUE_CID, false, nullptr, mozilla::net::ThrottleQueueConstructor }, + { &kNS_FTPPROTOCOLHANDLER_CID, false, nullptr, nsFtpProtocolHandlerConstructor }, + { &kNS_RESPROTOCOLHANDLER_CID, false, nullptr, nsResProtocolHandlerConstructor }, + { &kNS_EXTENSIONPROTOCOLHANDLER_CID, false, nullptr, mozilla::ExtensionProtocolHandlerConstructor }, + { &kNS_SUBSTITUTINGURL_CID, false, nullptr, mozilla::SubstitutingURLMutatorConstructor }, // do_CreateInstance returns mutator + { &kNS_SUBSTITUTINGURLMUTATOR_CID, false, nullptr, mozilla::SubstitutingURLMutatorConstructor }, + { &kNS_ABOUTPROTOCOLHANDLER_CID, false, nullptr, nsAboutProtocolHandlerConstructor }, + { &kNS_SAFEABOUTPROTOCOLHANDLER_CID, false, nullptr, nsSafeAboutProtocolHandlerConstructor }, + { &kNS_ABOUT_BLANK_MODULE_CID, false, nullptr, nsAboutBlank::Create }, + { &kNS_NESTEDABOUTURI_CID, false, nullptr, nsNestedAboutURIMutatorConstructor }, // do_CreateInstance returns mutator + { &kNS_NESTEDABOUTURIMUTATOR_CID, false, nullptr, nsNestedAboutURIMutatorConstructor }, + { &kNS_ABOUT_CACHE_MODULE_CID, false, nullptr, nsAboutCache::Create }, + { &kNS_ABOUT_CACHE_ENTRY_MODULE_CID, false, nullptr, nsAboutCacheEntryConstructor }, + { &kNS_CACHESERVICE_CID, false, nullptr, nsCacheService::Create }, + { &kNS_APPLICATIONCACHESERVICE_CID, false, nullptr, nsApplicationCacheServiceConstructor }, +#ifdef NECKO_COOKIES + { &kNS_COOKIEMANAGER_CID, false, nullptr, nsICookieServiceConstructor }, + { &kNS_COOKIESERVICE_CID, false, nullptr, nsICookieServiceConstructor }, +#endif +#ifdef NECKO_WIFI + { &kNS_WIFI_MONITOR_COMPONENT_CID, false, nullptr, nsWifiMonitorConstructor }, +#endif + { &kNS_DATAPROTOCOLHANDLER_CID, false, nullptr, nsDataHandler::Create }, + { &kNS_VIEWSOURCEHANDLER_CID, false, nullptr, nsViewSourceHandlerConstructor }, + { &kNS_WYCIWYGPROTOCOLHANDLER_CID, false, nullptr, nsWyciwygProtocolHandlerConstructor }, + { &kNS_WEBSOCKETPROTOCOLHANDLER_CID, false, nullptr, + mozilla::net::WebSocketChannelConstructor }, + { &kNS_WEBSOCKETSSLPROTOCOLHANDLER_CID, false, nullptr, + mozilla::net::WebSocketSSLChannelConstructor }, +#if defined(XP_WIN) + { &kNS_NETWORK_LINK_SERVICE_CID, false, nullptr, nsNotifyAddrListenerConstructor }, +#elif defined(MOZ_WIDGET_COCOA) + { &kNS_NETWORK_LINK_SERVICE_CID, false, nullptr, nsNetworkLinkServiceConstructor }, +#elif defined(MOZ_WIDGET_ANDROID) + { &kNS_NETWORK_LINK_SERVICE_CID, false, nullptr, nsAndroidNetworkLinkServiceConstructor }, +#elif defined(XP_LINUX) + { &kNS_NETWORK_LINK_SERVICE_CID, false, nullptr, nsNotifyAddrListenerConstructor }, +#endif + { &kNS_SERIALIZATION_HELPER_CID, false, nullptr, nsSerializationHelperConstructor }, + { &kNS_CACHE_STORAGE_SERVICE_CID, false, nullptr, CacheStorageServiceConstructor }, + { &kNS_NSILOADCONTEXTINFOFACTORY_CID, false, nullptr, LoadContextInfoFactoryConstructor }, + { &kNS_NETWORKPREDICTOR_CID, false, nullptr, mozilla::net::Predictor::Create }, + { &kNS_CAPTIVEPORTAL_CID, false, nullptr, mozilla::net::nsICaptivePortalServiceConstructor }, + { &kNS_NETWORKCONNECTIVITYSERVICE_CID, false, nullptr, mozilla::net::nsINetworkConnectivityServiceConstructor }, +#ifdef BUILD_NETWORK_INFO_SERVICE + { &kNETWORKINFOSERVICE_CID, false, nullptr, nsNetworkInfoServiceConstructor }, +#endif + { nullptr } + // clang-format on +}; + +static const mozilla::Module::ContractIDEntry kNeckoContracts[] = { + // clang-format off + { NS_IOSERVICE_CONTRACTID, &kNS_IOSERVICE_CID, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { NS_NETUTIL_CONTRACTID, &kNS_IOSERVICE_CID }, + { NS_STREAMTRANSPORTSERVICE_CONTRACTID, &kNS_STREAMTRANSPORTSERVICE_CID }, + { NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &kNS_SOCKETTRANSPORTSERVICE_CID, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { NS_SERVERSOCKET_CONTRACTID, &kNS_SERVERSOCKET_CID }, + { NS_TLSSERVERSOCKET_CONTRACTID, &kNS_TLSSERVERSOCKET_CID }, + { NS_UDPSOCKET_CONTRACTID, &kNS_UDPSOCKET_CID }, + { NS_DNSSERVICE_CONTRACTID, &kNS_DNSSERVICE_CID, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { NS_IDNSERVICE_CONTRACTID, &kNS_IDNSERVICE_CID, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { NS_EFFECTIVETLDSERVICE_CONTRACTID, &kNS_EFFECTIVETLDSERVICE_CID }, + { NS_SIMPLEURIMUTATOR_CONTRACTID, &kNS_SIMPLEURIMUTATOR_CID, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { NS_ASYNCSTREAMCOPIER_CONTRACTID, &kNS_ASYNCSTREAMCOPIER_CID }, + { NS_INPUTSTREAMPUMP_CONTRACTID, &kNS_INPUTSTREAMPUMP_CID }, + { NS_INPUTSTREAMCHANNEL_CONTRACTID, &kNS_INPUTSTREAMCHANNEL_CID }, + { NS_STREAMLOADER_CONTRACTID, &kNS_STREAMLOADER_CID }, + { NS_INCREMENTALSTREAMLOADER_CONTRACTID, &kNS_INCREMENTALSTREAMLOADER_CID }, + { NS_DOWNLOADER_CONTRACTID, &kNS_DOWNLOADER_CID }, + { NS_BACKGROUNDFILESAVEROUTPUTSTREAM_CONTRACTID, &kNS_BACKGROUNDFILESAVEROUTPUTSTREAM_CID }, + { NS_BACKGROUNDFILESAVERSTREAMLISTENER_CONTRACTID, &kNS_BACKGROUNDFILESAVERSTREAMLISTENER_CID }, + { NS_SIMPLESTREAMLISTENER_CONTRACTID, &kNS_SIMPLESTREAMLISTENER_CID }, + { NS_STREAMLISTENERTEE_CONTRACTID, &kNS_STREAMLISTENERTEE_CID }, + { NS_LOADGROUP_CONTRACTID, &kNS_LOADGROUP_CID }, + { NS_LOCALFILEINPUTSTREAM_CONTRACTID, &kNS_LOCALFILEINPUTSTREAM_CID }, + { NS_LOCALFILEOUTPUTSTREAM_CONTRACTID, &kNS_LOCALFILEOUTPUTSTREAM_CID }, + { NS_ATOMICLOCALFILEOUTPUTSTREAM_CONTRACTID, &kNS_ATOMICLOCALFILEOUTPUTSTREAM_CID }, + { NS_SAFELOCALFILEOUTPUTSTREAM_CONTRACTID, &kNS_SAFELOCALFILEOUTPUTSTREAM_CID }, + { NS_INCREMENTALDOWNLOAD_CONTRACTID, &kNS_INCREMENTALDOWNLOAD_CID }, + { NS_STDURLPARSER_CONTRACTID, &kNS_STDURLPARSER_CID, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { NS_NOAUTHURLPARSER_CONTRACTID, &kNS_NOAUTHURLPARSER_CID, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { NS_AUTHURLPARSER_CONTRACTID, &kNS_AUTHURLPARSER_CID, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { NS_STANDARDURLMUTATOR_CONTRACTID, &kNS_STANDARDURLMUTATOR_CID, mozilla::Module::ALLOW_IN_SOCKET_PROCESS }, + { NS_ARRAYBUFFERINPUTSTREAM_CONTRACTID, &kNS_ARRAYBUFFERINPUTSTREAM_CID }, + { NS_BUFFEREDINPUTSTREAM_CONTRACTID, &kNS_BUFFEREDINPUTSTREAM_CID }, + { NS_BUFFEREDOUTPUTSTREAM_CONTRACTID, &kNS_BUFFEREDOUTPUTSTREAM_CID }, + { NS_MIMEINPUTSTREAM_CONTRACTID, &kNS_MIMEINPUTSTREAM_CID }, + { NS_PROTOCOLPROXYSERVICE_CONTRACTID, &kNS_PROTOCOLPROXYSERVICE_CID }, + { NS_STREAMCONVERTERSERVICE_CONTRACTID, &kNS_STREAMCONVERTERSERVICE_CID }, + { NS_DASHBOARD_CONTRACTID, &kNS_DASHBOARD_CID }, + { NS_ISTREAMCONVERTER_KEY FTP_TO_INDEX, &kNS_FTPDIRLISTINGCONVERTER_CID }, + { NS_ISTREAMCONVERTER_KEY INDEX_TO_HTML, &kNS_NSINDEXEDTOHTMLCONVERTER_CID }, + { NS_ISTREAMCONVERTER_KEY MULTI_MIXED_X, &kNS_MULTIMIXEDCONVERTER_CID }, + { NS_ISTREAMCONVERTER_KEY MULTI_BYTERANGES, &kNS_MULTIMIXEDCONVERTER_CID }, + { NS_ISTREAMCONVERTER_KEY MULTI_MIXED, &kNS_MULTIMIXEDCONVERTER_CID }, + { NS_ISTREAMCONVERTER_KEY UNKNOWN_CONTENT, &kNS_UNKNOWNDECODER_CID }, + { NS_BINARYDETECTOR_CONTRACTID, &kNS_BINARYDETECTOR_CID }, + { NS_ISTREAMCONVERTER_KEY GZIP_TO_UNCOMPRESSED, &kNS_HTTPCOMPRESSCONVERTER_CID }, + { NS_ISTREAMCONVERTER_KEY XGZIP_TO_UNCOMPRESSED, &kNS_HTTPCOMPRESSCONVERTER_CID }, + { NS_ISTREAMCONVERTER_KEY BROTLI_TO_UNCOMPRESSED, &kNS_HTTPCOMPRESSCONVERTER_CID }, + { NS_ISTREAMCONVERTER_KEY COMPRESS_TO_UNCOMPRESSED, &kNS_HTTPCOMPRESSCONVERTER_CID }, + { NS_ISTREAMCONVERTER_KEY XCOMPRESS_TO_UNCOMPRESSED, &kNS_HTTPCOMPRESSCONVERTER_CID }, + { NS_ISTREAMCONVERTER_KEY DEFLATE_TO_UNCOMPRESSED, &kNS_HTTPCOMPRESSCONVERTER_CID }, + { MOZ_TXTTOHTMLCONV_CONTRACTID, &kMOZITXTTOHTMLCONV_CID }, + { NS_MIMEHEADERPARAM_CONTRACTID, &kNS_MIMEHEADERPARAM_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "file", &kNS_FILEPROTOCOLHANDLER_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http", &kNS_HTTPPROTOCOLHANDLER_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "https", &kNS_HTTPSPROTOCOLHANDLER_CID }, + { NS_HTTPAUTHMANAGER_CONTRACTID, &kNS_HTTPAUTHMANAGER_CID }, + { NS_HTTPACTIVITYDISTRIBUTOR_CONTRACTID, &kNS_HTTPACTIVITYDISTRIBUTOR_CID }, + { NS_THROTTLEQUEUE_CONTRACTID, &kNS_THROTTLEQUEUE_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "ftp", &kNS_FTPPROTOCOLHANDLER_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "resource", &kNS_RESPROTOCOLHANDLER_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-extension", &kNS_EXTENSIONPROTOCOLHANDLER_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "about", &kNS_ABOUTPROTOCOLHANDLER_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-safe-about", &kNS_SAFEABOUTPROTOCOLHANDLER_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "blank", &kNS_ABOUT_BLANK_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "cache", &kNS_ABOUT_CACHE_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "cache-entry", &kNS_ABOUT_CACHE_ENTRY_MODULE_CID }, + { NS_CACHESERVICE_CONTRACTID, &kNS_CACHESERVICE_CID }, + { NS_APPLICATIONCACHESERVICE_CONTRACTID, &kNS_APPLICATIONCACHESERVICE_CID }, +#ifdef NECKO_COOKIES + { NS_COOKIEMANAGER_CONTRACTID, &kNS_COOKIEMANAGER_CID }, + { NS_COOKIESERVICE_CONTRACTID, &kNS_COOKIESERVICE_CID }, +#endif +#ifdef NECKO_WIFI + { NS_WIFI_MONITOR_CONTRACTID, &kNS_WIFI_MONITOR_COMPONENT_CID }, +#endif + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "data", &kNS_DATAPROTOCOLHANDLER_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "view-source", &kNS_VIEWSOURCEHANDLER_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "wyciwyg", &kNS_WYCIWYGPROTOCOLHANDLER_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "ws", &kNS_WEBSOCKETPROTOCOLHANDLER_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "wss", &kNS_WEBSOCKETSSLPROTOCOLHANDLER_CID }, +#if defined(XP_WIN) + { NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID }, +#elif defined(MOZ_WIDGET_COCOA) + { NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID }, +#elif defined(MOZ_WIDGET_ANDROID) + { NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID }, +#elif defined(XP_LINUX) + { NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID }, +#endif + { NS_SERIALIZATION_HELPER_CONTRACTID, &kNS_SERIALIZATION_HELPER_CID }, + { NS_CACHE_STORAGE_SERVICE_CONTRACTID, &kNS_CACHE_STORAGE_SERVICE_CID }, + { NS_CACHE_STORAGE_SERVICE_CONTRACTID2, &kNS_CACHE_STORAGE_SERVICE_CID }, + { NS_NSILOADCONTEXTINFOFACTORY_CONTRACTID, &kNS_NSILOADCONTEXTINFOFACTORY_CID }, + { NS_NETWORKPREDICTOR_CONTRACTID, &kNS_NETWORKPREDICTOR_CID }, + { NS_CAPTIVEPORTAL_CONTRACTID, &kNS_CAPTIVEPORTAL_CID }, + { NS_NETWORKCONNECTIVITYSERVICE_CONTRACTID, &kNS_NETWORKCONNECTIVITYSERVICE_CID }, +#ifdef BUILD_NETWORK_INFO_SERVICE + { NETWORKINFOSERVICE_CONTRACT_ID, &kNETWORKINFOSERVICE_CID }, +#endif + { nullptr } + // clang-format on +}; + +static const mozilla::Module kNeckoModule = { + mozilla::Module::kVersion, + kNeckoCIDs, + kNeckoContracts, + kNeckoCategories, + nullptr, + nsNetStartup, + nsNetShutdown, + mozilla::Module::ALLOW_IN_SOCKET_PROCESS}; NSMODULE_DEFN(necko) = &kNeckoModule;
deleted file mode 100644 --- a/netwerk/build/nsNetModule.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -#ifndef nsNetModule_h -#define nsNetModule_h - -#include "nsID.h" - -class nsISupports; - -nsresult nsNetStartup(); -void nsNetShutdown(); - -nsresult CreateNewStreamConvServiceFactory(nsISupports* aOuter, - const nsIID& aIID, void** aResult); -nsresult CreateNewFTPDirListingConv(nsISupports* aOuter, const nsIID& aIID, - void** aResult); -nsresult CreateNewMultiMixedConvFactory(nsISupports* aOuter, const nsIID& aIID, - void** aResult); -nsresult CreateNewTXTToHTMLConvFactory(nsISupports* aOuter, const nsIID& aIID, - void** aResult); -nsresult CreateNewHTTPCompressConvFactory(nsISupports* aOuter, - const nsIID& aIID, void** aResult); -nsresult CreateNewUnknownDecoderFactory(nsISupports* aOuter, const nsIID& aIID, - void** aResult); -nsresult CreateNewBinaryDetectorFactory(nsISupports* aOuter, const nsIID& aIID, - void** aResult); -nsresult nsLoadGroupConstructor(nsISupports* aOuter, const nsIID& aIID, - void** aResult); - -nsresult nsCacheServiceConstructor(nsISupports* aOuter, const nsIID& aIID, - void** aResult); - -extern nsresult net_NewIncrementalDownload(nsISupports*, const nsIID&, void**); - -namespace mozilla { -namespace net { -nsresult WebSocketChannelConstructor(nsISupports* aOuter, const nsIID& aIID, - void** aResult); -nsresult WebSocketSSLChannelConstructor(nsISupports* aOuter, const nsIID& aIID, - void** aResult); -} -} - -#endif
--- a/netwerk/protocol/res/ExtensionProtocolHandler.cpp +++ b/netwerk/protocol/res/ExtensionProtocolHandler.cpp @@ -34,17 +34,16 @@ #include "nsIInputStreamPump.h" #include "nsIJARURI.h" #include "nsIStreamListener.h" #include "nsIThread.h" #include "nsIInputStream.h" #include "nsIOutputStream.h" #include "nsIStreamConverterService.h" #include "nsNetUtil.h" -#include "nsURLHelper.h" #include "prio.h" #include "SimpleChannel.h" #if defined(XP_WIN) # include "nsILocalFileWin.h" # include "WinUtils.h" #endif
--- a/netwerk/protocol/res/SubstitutingProtocolHandler.cpp +++ b/netwerk/protocol/res/SubstitutingProtocolHandler.cpp @@ -4,17 +4,16 @@ * 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/chrome/RegistryMessageUtils.h" #include "mozilla/dom/ContentParent.h" #include "mozilla/Unused.h" #include "SubstitutingProtocolHandler.h" -#include "SubstitutingURL.h" #include "nsIChannel.h" #include "nsIIOService.h" #include "nsIFile.h" #include "nsNetCID.h" #include "nsNetUtil.h" #include "nsReadableUtils.h" #include "nsURLHelper.h" #include "nsEscape.h"
--- a/netwerk/protocol/res/SubstitutingProtocolHandler.h +++ b/netwerk/protocol/res/SubstitutingProtocolHandler.h @@ -4,18 +4,20 @@ * 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/. */ #ifndef SubstitutingProtocolHandler_h___ #define SubstitutingProtocolHandler_h___ #include "nsISubstitutingProtocolHandler.h" +#include "nsIOService.h" #include "nsISubstitutionObserver.h" #include "nsDataHashtable.h" +#include "nsStandardURL.h" #include "mozilla/chrome/RegistryMessageUtils.h" #include "mozilla/Maybe.h" class nsIIOService; namespace mozilla { namespace net { @@ -110,12 +112,55 @@ class SubstitutingProtocolHandler { // substituting URIs only map to other URIs of the same type, or to // file:// and jar:// URIs. // // Enforcing this for ye olde resource:// URIs could carry compat risks, so // we just try to enforce it on new protocols going forward. bool mEnforceFileOrJar; }; +// SubstitutingURL : overrides nsStandardURL::GetFile to provide nsIFile +// resolution +class SubstitutingURL : public nsStandardURL { + public: + virtual nsStandardURL* StartClone() override; + virtual MOZ_MUST_USE nsresult EnsureFile() override; + NS_IMETHOD GetClassIDNoAlloc(nsCID* aCID) override; + + private: + explicit SubstitutingURL() : nsStandardURL(true) {} + explicit SubstitutingURL(bool aSupportsFileURL) : nsStandardURL(true) { + MOZ_ASSERT(aSupportsFileURL); + } + virtual nsresult Clone(nsIURI** aURI) override { + return nsStandardURL::Clone(aURI); + } + + public: + class Mutator : public TemplatedMutator<SubstitutingURL> { + NS_DECL_ISUPPORTS + public: + explicit Mutator() = default; + + private: + virtual ~Mutator() = default; + + SubstitutingURL* Create() override { return new SubstitutingURL(); } + }; + + NS_IMETHOD Mutate(nsIURIMutator** aMutator) override { + RefPtr<SubstitutingURL::Mutator> mutator = new SubstitutingURL::Mutator(); + nsresult rv = mutator->InitFromURI(this); + if (NS_FAILED(rv)) { + return rv; + } + mutator.forget(aMutator); + return NS_OK; + } + + friend BaseURIMutator<SubstitutingURL>; + friend TemplatedMutator<SubstitutingURL>; +}; + } // namespace net } // namespace mozilla #endif /* SubstitutingProtocolHandler_h___ */
deleted file mode 100644 --- a/netwerk/protocol/res/SubstitutingURL.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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/. */ - -#ifndef SubstitutingURL_h -#define SubstitutingURL_h - -#include "nsStandardURL.h" - -class nsIIOService; - -namespace mozilla { -namespace net { - -// SubstitutingURL : overrides nsStandardURL::GetFile to provide nsIFile -// resolution -class SubstitutingURL : public nsStandardURL { - public: - virtual nsStandardURL* StartClone() override; - virtual MOZ_MUST_USE nsresult EnsureFile() override; - NS_IMETHOD GetClassIDNoAlloc(nsCID* aCID) override; - - private: - explicit SubstitutingURL() : nsStandardURL(true) {} - explicit SubstitutingURL(bool aSupportsFileURL) : nsStandardURL(true) { - MOZ_ASSERT(aSupportsFileURL); - } - virtual nsresult Clone(nsIURI** aURI) override { - return nsStandardURL::Clone(aURI); - } - - public: - class Mutator : public TemplatedMutator<SubstitutingURL> { - NS_DECL_ISUPPORTS - public: - explicit Mutator() = default; - - private: - virtual ~Mutator() = default; - - SubstitutingURL* Create() override { return new SubstitutingURL(); } - }; - - NS_IMETHOD Mutate(nsIURIMutator** aMutator) override { - RefPtr<SubstitutingURL::Mutator> mutator = new SubstitutingURL::Mutator(); - nsresult rv = mutator->InitFromURI(this); - if (NS_FAILED(rv)) { - return rv; - } - mutator.forget(aMutator); - return NS_OK; - } - - friend BaseURIMutator<SubstitutingURL>; - friend TemplatedMutator<SubstitutingURL>; -}; - -} // namespace net -} // namespace mozilla - -#endif /* SubstitutingURL_h */
--- a/netwerk/protocol/res/moz.build +++ b/netwerk/protocol/res/moz.build @@ -10,17 +10,16 @@ XPIDL_SOURCES += [ 'nsISubstitutionObserver.idl', ] XPIDL_MODULE = 'necko_res' EXPORTS.mozilla.net += [ 'ExtensionProtocolHandler.h', 'SubstitutingProtocolHandler.h', - 'SubstitutingURL.h', ] UNIFIED_SOURCES += [ 'ExtensionProtocolHandler.cpp', 'nsResProtocolHandler.cpp', 'SubstitutingProtocolHandler.cpp', ]
--- a/netwerk/protocol/res/nsResProtocolHandler.h +++ b/netwerk/protocol/res/nsResProtocolHandler.h @@ -6,16 +6,17 @@ #ifndef nsResProtocolHandler_h___ #define nsResProtocolHandler_h___ #include "SubstitutingProtocolHandler.h" #include "nsIResProtocolHandler.h" #include "nsInterfaceHashtable.h" #include "nsWeakReference.h" +#include "nsStandardURL.h" class nsISubstitutionObserver; struct SubstitutionMapping; class nsResProtocolHandler final : public nsIResProtocolHandler, public mozilla::net::SubstitutingProtocolHandler, public nsSupportsWeakReference {
--- a/netwerk/test/gtest/TestPACMan.cpp +++ b/netwerk/test/gtest/TestPACMan.cpp @@ -122,23 +122,23 @@ class TestPACMan : public ::testing::Tes void ProcessAllEventsTenTimes() { for (int i = 0; i < 10; i++) { ProcessAllEvents(); } } virtual void SetUp() { ASSERT_EQ(NS_OK, GetNetworkProxyType(&originalNetworkProxyTypePref)); - nsCOMPtr<nsIFactory> factory; - nsresult rv = nsComponentManagerImpl::gComponentManager->GetClassObject( - kNS_TESTDHCPCLIENTSERVICE_CID, NS_GET_IID(nsIFactory), - getter_AddRefs(factory)); - if (NS_SUCCEEDED(rv) && factory) { - rv = nsComponentManagerImpl::gComponentManager->UnregisterFactory( - kNS_TESTDHCPCLIENTSERVICE_CID, factory); + nsFactoryEntry* factoryEntry = + nsComponentManagerImpl::gComponentManager->GetFactoryEntry( + kNS_TESTDHCPCLIENTSERVICE_CID); + if (factoryEntry) { + nsresult rv = + nsComponentManagerImpl::gComponentManager->UnregisterFactory( + kNS_TESTDHCPCLIENTSERVICE_CID, factoryEntry->mFactory); ASSERT_EQ(NS_OK, rv); } nsComponentManagerImpl::gComponentManager->RegisterModule( &kSysDHCPClientModule); mPACMan = new nsPACMan(nullptr); mPACMan->SetWPADOverDHCPEnabled(true); mPACMan->Init(nullptr);
--- a/netwerk/test/gtest/moz.build +++ b/netwerk/test/gtest/moz.build @@ -31,9 +31,9 @@ LOCAL_INCLUDES += [ include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul-gtest' LOCAL_INCLUDES += [ '!/xpcom', '/xpcom/components' -] +] \ No newline at end of file
--- a/netwerk/url-classifier/AsyncUrlChannelClassifier.cpp +++ b/netwerk/url-classifier/AsyncUrlChannelClassifier.cpp @@ -1,16 +1,15 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim:set expandtab ts=4 sw=2 sts=2 cin: */ /* 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 "Classifier.h" -#include "mozilla/Components.h" #include "mozilla/ErrorNames.h" #include "mozilla/net/AsyncUrlChannelClassifier.h" #include "mozilla/net/UrlClassifierCommon.h" #include "mozilla/net/UrlClassifierFeatureFactory.h" #include "mozilla/net/UrlClassifierFeatureResult.h" #include "nsContentUtils.h" #include "nsIChannel.h" #include "nsIHttpChannel.h" @@ -88,17 +87,17 @@ class URIData { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aURI); MOZ_ASSERT(aInnermostURI); RefPtr<URIData> data = new URIData(); data->mURI = aURI; nsCOMPtr<nsIUrlClassifierUtils> utilsService = - components::UrlClassifierUtils::Service(); + do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID); if (NS_WARN_IF(!utilsService)) { return NS_ERROR_FAILURE; } nsresult rv = utilsService->GetKeyForURI(aInnermostURI, data->mURISpec); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
--- a/netwerk/url-classifier/nsChannelClassifier.cpp +++ b/netwerk/url-classifier/nsChannelClassifier.cpp @@ -19,17 +19,16 @@ #include "nsISupportsPriority.h" #include "nsNetUtil.h" #include "nsXULAppAPI.h" #include "nsQueryObject.h" #include "nsIUrlClassifierDBService.h" #include "nsIUrlClassifierFeature.h" #include "nsPrintfCString.h" -#include "mozilla/Components.h" #include "mozilla/ErrorNames.h" #include "mozilla/Logging.h" #include "mozilla/Preferences.h" #include "mozilla/net/UrlClassifierCommon.h" #include "mozilla/ClearOnShutdown.h" #include "mozilla/Services.h" namespace mozilla { @@ -365,17 +364,17 @@ nsresult nsChannelClassifier::SendThreat if (!Preferences::GetBool(reportEnablePref.get(), false)) { LOG(( "nsChannelClassifier::SendThreatHitReport data sharing disabled for %s", provider.get())); return NS_OK; } nsCOMPtr<nsIURIClassifier> uriClassifier = - components::UrlClassifierDB::Service(); + do_GetService(NS_URLCLASSIFIERDBSERVICE_CONTRACTID); if (!uriClassifier) { return NS_ERROR_UNEXPECTED; } nsresult rv = uriClassifier->SendThreatHitReport(aChannel, aProvider, aList, aFullHash); NS_ENSURE_SUCCESS(rv, rv);
--- a/python/mozbuild/mozbuild/backend/common.py +++ b/python/mozbuild/mozbuild/backend/common.py @@ -37,17 +37,16 @@ from mozbuild.frontend.data import ( IPDLCollection, LocalizedPreprocessedFiles, LocalizedFiles, RustLibrary, SharedLibrary, StaticLibrary, UnifiedSources, XPIDLModule, - XPCOMComponentManifests, WebIDLCollection, ) from mozbuild.jar import ( DeprecatedJarManifest, JarManifestParser, ) from mozbuild.preprocessor import Preprocessor from mozpack.chrome.manifest import parse_manifest_line @@ -144,19 +143,16 @@ class CommonBackend(BuildBackend): self._write_unified_files(obj.unified_source_mapping, obj.objdir, poison_windows_h=False) self._handle_ipdl_sources(obj.objdir, list(sorted(obj.all_sources())), list(sorted(obj.all_preprocessed_sources())), list(sorted(obj.all_regular_sources())), obj.unified_source_mapping) - elif isinstance(obj, XPCOMComponentManifests): - self._handle_xpcom_collection(obj) - elif isinstance(obj, UnifiedSources): # Unified sources aren't relevant to artifact builds. if self.environment.is_artifact_build: return True if obj.have_unified_mapping: self._write_unified_files(obj.unified_source_mapping, obj.objdir) if hasattr(self, '_process_unified_sources'): @@ -368,30 +364,16 @@ class CommonBackend(BuildBackend): self._handle_generated_sources(manager.expected_build_output_files()) self._write_unified_files(webidls.unified_source_mapping, bindings_dir, poison_windows_h=True) self._handle_webidl_build(bindings_dir, webidls.unified_source_mapping, webidls, manager.expected_build_output_files(), manager.GLOBAL_DEFINE_FILES) - def _handle_xpcom_collection(self, manifests): - components_dir = mozpath.join(manifests.topobjdir, - 'xpcom', 'components') - - # The code generators read their configuration from this file, so it - # needs to be written early. - o = dict( - manifests=sorted(manifests.all_sources()), - ) - - conf_file = mozpath.join(components_dir, 'manifest-lists.json') - with self._write_file(conf_file) as fh: - json.dump(o, fh, sort_keys=True, indent=2) - def _write_unified_file(self, unified_file, source_filenames, output_directory, poison_windows_h=False): with self._write_file(mozpath.join(output_directory, unified_file)) as f: f.write('#define MOZ_UNIFIED_BUILD\n') includeTemplate = '#include "%(cppfile)s"' if poison_windows_h: includeTemplate += ( '\n'
--- a/python/mozbuild/mozbuild/frontend/context.py +++ b/python/mozbuild/mozbuild/frontend/context.py @@ -1761,23 +1761,16 @@ VARIABLES = { 'XPIDL_MODULE': (unicode, unicode, """XPCOM Interface Definition Module Name. This is the name of the ``.xpt`` file that is created by linking ``XPIDL_SOURCES`` together. If unspecified, it defaults to be the same as ``MODULE``. """), - 'XPCOM_MANIFESTS': (ContextDerivedTypedList(SourcePath, StrictOrderingOnAppendList), list, - """XPCOM Component Manifest Files. - - This is a list of files that define XPCOM components to be added - to the component registry. - """), - 'PREPROCESSED_IPDL_SOURCES': (StrictOrderingOnAppendList, list, """Preprocessed IPDL source files. These files will be preprocessed, then parsed and converted to ``.cpp`` files. """), 'IPDL_SOURCES': (StrictOrderingOnAppendList, list,
--- a/python/mozbuild/mozbuild/frontend/data.py +++ b/python/mozbuild/mozbuild/frontend/data.py @@ -368,30 +368,16 @@ class IPDLCollection(ContextDerived): unified_prefix='UnifiedProtocols', unified_suffix='cpp', files_per_unified_file=16)) def all_source_files(self): return sorted(set(p for p, _ in self.unified_source_mapping)) -class XPCOMComponentManifests(ContextDerived): - """Collects XPCOM manifest files during the build.""" - - def __init__(self, context): - ContextDerived.__init__(self, context) - self.manifests = set() - - def all_sources(self): - return self.manifests - - def all_source_files(self): - return [] - - class LinkageWrongKindError(Exception): """Error thrown when trying to link objects of the wrong kind""" class LinkageMultipleRustLibrariesError(Exception): """Error thrown when trying to link multiple Rust libraries to an object"""
--- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -67,17 +67,16 @@ from .data import ( SharedLibrary, SimpleProgram, Sources, StaticLibrary, TestHarnessFiles, TestManifest, UnifiedSources, VariablePassthru, - XPCOMComponentManifests, XPIDLModule, ) from mozpack.chrome.manifest import ( Manifest, ) from .reader import SandboxValidationError @@ -209,27 +208,22 @@ class TreeMetadataEmitter(LoggingMixin): ('TEST_WEBIDL_FILES', lambda c: c.test_sources), ('WEBIDL_FILES', lambda c: c.sources), ('WEBIDL_EXAMPLE_INTERFACES', lambda c: c.example_interfaces), ] ipdl_attrs = [ ('IPDL_SOURCES', lambda c: c.sources), ('PREPROCESSED_IPDL_SOURCES', lambda c: c.preprocessed_sources), ] - xpcom_attrs = [ - ('XPCOM_MANIFESTS', lambda c: c.manifests), - ] idl_sources = {} for root, cls, attrs in ((self.config.substs.get('WEBIDL_ROOT'), WebIDLCollection, webidl_attrs), (self.config.substs.get('IPDL_ROOT'), - IPDLCollection, ipdl_attrs), - (self.config.substs.get('XPCOM_ROOT'), - XPCOMComponentManifests, xpcom_attrs)): + IPDLCollection, ipdl_attrs)): if root: collection = cls(contexts[root]) for var, src_getter in attrs: src_getter(collection).update(self._idls[var]) idl_sources[root] = collection.all_source_files() if isinstance(collection, WebIDLCollection): # Test webidl sources are added here as a somewhat special @@ -1165,17 +1159,16 @@ class TreeMetadataEmitter(LoggingMixin): 'GENERATED_EVENTS_WEBIDL_FILES', 'GENERATED_WEBIDL_FILES', 'PREPROCESSED_TEST_WEBIDL_FILES', 'PREPROCESSED_WEBIDL_FILES', 'TEST_WEBIDL_FILES', 'WEBIDL_FILES', 'IPDL_SOURCES', 'PREPROCESSED_IPDL_SOURCES', - 'XPCOM_MANIFESTS', ) for context_var in idl_vars: for name in context.get(context_var, []): self._idls[context_var].add(mozpath.join(context.srcdir, name)) # WEBIDL_EXAMPLE_INTERFACES do not correspond to files. for name in context.get('WEBIDL_EXAMPLE_INTERFACES', []): self._idls['WEBIDL_EXAMPLE_INTERFACES'].add(name)
deleted file mode 100644 --- a/security/manager/ssl/components.conf +++ /dev/null @@ -1,187 +0,0 @@ -# -*- 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/. - -Headers = [ - '/security/manager/ssl/nsNSSModule.h', -] - -Classes = [ - { - 'cid': '{4cb64dfd-ca98-4e24-befd-0d9285a33bcb}', - 'contract_ids': ['@mozilla.org/psm;1'], - 'type': 'nsNSSComponent', - 'headers': ['nsNSSComponent.h'], - 'init_method': 'Init', - }, - { - 'cid': '{c94f4a30-64d7-11d4-9960-00b0d02354a0}', - 'contract_ids': [ - '@mozilla.org/security/psmdownload;1', - '@mozilla.org/uriloader/psm-external-content-listener;1', - ], - 'type': 'mozilla::psm::PSMContentListener', - 'headers': ['mozilla/psm/PSMContentListener.h'], - 'init_method': 'init', - 'categories': { - 'external-uricontentlisteners': [ - 'application/x-x509-ca-cert', - 'application/x-x509-email-cert', - 'application/x-x509-server-cert', - 'application/x-x509-user-cert', - ], - }, - }, - { - 'cid': '{9ef18451-a157-4d17-8132-47afef213689}', - 'contract_ids': ['@mozilla.org/nss_errors_service;1'], - 'type': 'mozilla::psm::NSSErrorsService', - 'headers': ['NSSErrorsService.h'], - 'init_method': 'Init', - }, - { - 'cid': '{23ad3531-11d2-4e8e-805a-6a752e91681a}', - 'contract_ids': ['@mozilla.org/security/nssversion;1'], - 'type': 'nsNSSVersion', - 'headers': ['/security/manager/ssl/nsNSSVersion.h'], - }, - { - 'cid': '{cc75499a-1dd1-11b2-8a82-ca410ac907b8}', - 'contract_ids': ['@mozilla.org/secure_browser_ui;1'], - 'type': 'nsSecureBrowserUIImpl', - 'headers': ['/security/manager/ssl/nsSecureBrowserUIImpl.h'], - }, - { - 'cid': '{47402be2-e653-45d0-8daa-9f0dce0ac148}', - 'contract_ids': ['@mozilla.org/security/local-cert-service;1'], - 'type': 'mozilla::LocalCertService', - 'headers': ['/security/manager/ssl/LocalCertService.h'], - }, - { - 'cid': '{0ae53c0f-8ea2-4916-bedc-717443c3e185}', - 'contract_ids': ['@mozilla.org/layout/form-processor;1'], - 'legacy_constructor': 'nsKeygenFormProcessor::Create', - 'headers': ['/security/manager/ssl/nsKeygenHandler.h'], - }, - { - 'cid': '{0c4f1ddc-1dd2-11b2-9d95-f2fdf113044b}', - 'contract_ids': ['@mozilla.org/security/sdr;1'], - 'type': 'SecretDecoderRing', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<SecretDecoderRing>', - }, - { - 'cid': '{b084a2ce-1dd1-11b2-bf10-8324f8e065cc}', - 'contract_ids': ['@mozilla.org/security/pk11tokendb;1'], - 'type': 'nsPK11TokenDB', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<nsPK11TokenDB>', - }, - { - 'cid': '{ff9fbcd7-9517-4334-b97a-ceed78909974}', - 'contract_ids': ['@mozilla.org/security/pkcs11moduledb;1'], - 'type': 'mozilla::psm::PKCS11ModuleDB', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<mozilla::psm::PKCS11ModuleDB>', - }, - { - 'cid': '{660a3226-915c-4ffb-bb20-8985a632df05}', - 'contract_ids': [], - 'type': 'nsNSSCertificate', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<nsNSSCertificate>', - }, - { - 'cid': '{fb0bbc5c-452e-4783-b32c-80124693d871}', - 'contract_ids': ['@mozilla.org/security/x509certdb;1'], - 'type': 'nsNSSCertificateDB', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<nsNSSCertificateDB>', - }, - { - 'cid': '{959fb165-6517-487f-ab9b-d8913be53197}', - 'contract_ids': ['@mozilla.org/security/x509certlist;1'], - 'type': 'nsNSSCertList', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<nsNSSCertList>', - }, - { - 'cid': '{36a1d3b3-d886-4317-96ff-87b0005cfef7}', - 'contract_ids': ['@mozilla.org/security/hash;1'], - 'type': 'nsCryptoHash', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<nsCryptoHash>', - }, - { - 'cid': '{a496d0a2-dff7-4e23-bd65-1ca742fa178a}', - 'contract_ids': ['@mozilla.org/security/hmac;1'], - 'type': 'nsCryptoHMAC', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<nsCryptoHMAC>', - }, - { - 'cid': '{9d383ddd-6856-4187-8485-f36195b29a0e}', - 'contract_ids': ['@mozilla.org/security/keyobject;1'], - 'type': 'nsKeyObject', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<nsKeyObject>', - }, - { - 'cid': '{2a35dd47-b026-4e8d-b6b7-5740f61ab902}', - 'contract_ids': ['@mozilla.org/security/keyobjectfactory;1'], - 'type': 'nsKeyObjectFactory', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<nsKeyObjectFactory>', - }, - { - 'cid': '{45a5fe2f-c350-4b86-962d-02d5aaaa955a}', - 'contract_ids': ['@mozilla.org/security/contentsignatureverifier;1'], - 'type': 'ContentSignatureVerifier', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<ContentSignatureVerifier>', - }, - { - 'cid': '{67ba681d-5485-4fff-952c-2ee337ffdcd6}', - 'contract_ids': ['@mozilla.org/security/certoverride;1'], - 'type': 'nsCertOverrideService', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<nsCertOverrideService>', - }, - { - 'cid': '{be65e2b7-fe46-4e0f-88e0-4b385db4d68a}', - 'contract_ids': ['@mozilla.org/security/random-generator;1'], - 'type': 'nsRandomGenerator', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<nsRandomGenerator>', - }, - { - 'cid': '{16786594-0296-4471-8096-8f84497ca428}', - 'contract_ids': [], - 'type': 'mozilla::psm::TransportSecurityInfo', - 'legacy_constructor': - 'mozilla::psm::NSSConstructor<mozilla::psm::TransportSecurityInfo>', - }, - { - 'cid': '{16955eee-6c48-4152-9309-c42a465138a1}', - 'contract_ids': ['@mozilla.org/ssservice;1'], - 'type': 'nsSiteSecurityService', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<nsSiteSecurityService>', - }, - { - 'cid': '{11aefd53-2fbb-4c92-a0c1-053212ae42d0}', - 'contract_ids': ['@mozilla.org/security/certblocklist;1'], - 'type': 'CertBlocklist', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<CertBlocklist>', - }, - { - 'cid': '{57972956-5718-42d2-8070-b3fc72212eaf}', - 'contract_ids': ['@mozilla.org/security/oskeystore;1'], - 'type': 'OSKeyStore', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<OSKeyStore>', - }, - { - 'cid': '{4fe082ae-6ff0-4b41-b24f-eaa664f6e46a}', - 'contract_ids': ['@mozilla.org/security/osreauthenticator;1'], - 'type': 'OSReauthenticator', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<OSReauthenticator>', - }, -] - -if defined('MOZ_XUL'): - Classes += [ - { - 'cid': '{4ea60761-31d6-491d-9e34-4b53a26c416c}', - 'contract_ids': ['@mozilla.org/security/nsCertTree;1'], - 'type': 'nsCertTree', - 'legacy_constructor': 'mozilla::psm::NSSConstructor<nsCertTree>', - }, - ]
--- a/security/manager/ssl/moz.build +++ b/security/manager/ssl/moz.build @@ -46,20 +46,16 @@ XPIDL_SOURCES += [ if CONFIG['MOZ_XUL']: XPIDL_SOURCES += [ 'nsICertTree.idl', ] XPIDL_MODULE = 'pipnss' -XPCOM_MANIFESTS += [ - 'components.conf', -] - # These aren't actually used in production code yet, so we don't want to # ship them with the browser. TESTING_JS_MODULES.psm += [ 'DER.jsm', 'RemoteSecuritySettings.jsm', 'X509.jsm', ]
--- a/security/manager/ssl/nsNSSModule.cpp +++ b/security/manager/ssl/nsNSSModule.cpp @@ -1,24 +1,21 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * 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 "nsNSSModule.h" - #include "CertBlocklist.h" #include "ContentSignatureVerifier.h" #include "NSSErrorsService.h" #include "PKCS11ModuleDB.h" #include "PSMContentListener.h" #include "SecretDecoderRing.h" #include "TransportSecurityInfo.h" -#include "mozilla/MacroArgs.h" #include "mozilla/ModuleUtils.h" #include "mozilla/SyncRunnable.h" #include "nsCURILoader.h" #include "nsCertOverrideService.h" #include "nsCryptoHash.h" #include "nsICategoryManager.h" #include "nsKeyModule.h" #include "nsKeygenHandler.h" @@ -112,49 +109,159 @@ static nsresult Constructor(nsISupports* }))); return rv; } return Instantiate<InstanceClass, InitMethod>(aIID, aResult); } -#define IMPL(type, ...) \ - template <> \ - nsresult NSSConstructor<type>(nsISupports * aOuter, const nsIID& aIID, \ - void** aResult) { \ - return Constructor<type, __VA_ARGS__>(aOuter, aIID, aResult); \ - } +} // namespace psm +} // namespace mozilla + +using namespace mozilla::psm; + +namespace { + +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(PSMContentListener, init) + +typedef mozilla::psm::NSSErrorsService NSSErrorsService; +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(NSSErrorsService, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsNSSVersion) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSecureBrowserUIImpl) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNSSComponent, Init) + +NS_DEFINE_NAMED_CID(NS_NSSCOMPONENT_CID); +NS_DEFINE_NAMED_CID(NS_SECRETDECODERRING_CID); +NS_DEFINE_NAMED_CID(NS_PK11TOKENDB_CID); +NS_DEFINE_NAMED_CID(NS_PKCS11MODULEDB_CID); +NS_DEFINE_NAMED_CID(NS_PSMCONTENTLISTEN_CID); +NS_DEFINE_NAMED_CID(NS_X509CERT_CID); +NS_DEFINE_NAMED_CID(NS_X509CERTDB_CID); +NS_DEFINE_NAMED_CID(NS_X509CERTLIST_CID); +NS_DEFINE_NAMED_CID(NS_FORMPROCESSOR_CID); +#ifdef MOZ_XUL +NS_DEFINE_NAMED_CID(NS_CERTTREE_CID); +#endif +NS_DEFINE_NAMED_CID(NS_CRYPTO_HASH_CID); +NS_DEFINE_NAMED_CID(NS_CRYPTO_HMAC_CID); +NS_DEFINE_NAMED_CID(NS_KEYMODULEOBJECT_CID); +NS_DEFINE_NAMED_CID(NS_KEYMODULEOBJECTFACTORY_CID); +NS_DEFINE_NAMED_CID(NS_CONTENTSIGNATUREVERIFIER_CID); +NS_DEFINE_NAMED_CID(NS_CERTOVERRIDE_CID); +NS_DEFINE_NAMED_CID(NS_RANDOMGENERATOR_CID); +NS_DEFINE_NAMED_CID(TRANSPORTSECURITYINFO_CID); +NS_DEFINE_NAMED_CID(NS_NSSERRORSSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_NSSVERSION_CID); +NS_DEFINE_NAMED_CID(NS_SECURE_BROWSER_UI_CID); +NS_DEFINE_NAMED_CID(NS_SITE_SECURITY_SERVICE_CID); +NS_DEFINE_NAMED_CID(NS_CERT_BLOCKLIST_CID); +NS_DEFINE_NAMED_CID(NS_OSKEYSTORE_CID); +NS_DEFINE_NAMED_CID(NS_OSREAUTHENTICATOR_CID); // Components that require main thread initialization could cause a deadlock // in necko code (bug 1418752). To prevent it we initialize all such components // on main thread in advance in net_EnsurePSMInit(). Update that function when // new component with ThreadRestriction::MainThreadOnly is added. -IMPL(SecretDecoderRing, nullptr) -IMPL(nsPK11TokenDB, nullptr) -IMPL(PKCS11ModuleDB, nullptr) -IMPL(nsNSSCertificate, nullptr, ProcessRestriction::AnyProcess) -IMPL(nsNSSCertificateDB, nullptr) -IMPL(nsNSSCertList, nullptr, ProcessRestriction::AnyProcess) +static const mozilla::Module::CIDEntry kNSSCIDs[] = { + {&kNS_NSSCOMPONENT_CID, false, nullptr, nsNSSComponentConstructor}, + {&kNS_SECRETDECODERRING_CID, false, nullptr, + Constructor<SecretDecoderRing>}, + {&kNS_PK11TOKENDB_CID, false, nullptr, Constructor<nsPK11TokenDB>}, + {&kNS_PKCS11MODULEDB_CID, false, nullptr, Constructor<PKCS11ModuleDB>}, + {&kNS_PSMCONTENTLISTEN_CID, false, nullptr, PSMContentListenerConstructor}, + {&kNS_X509CERT_CID, false, nullptr, + Constructor<nsNSSCertificate, nullptr, ProcessRestriction::AnyProcess>}, + {&kNS_X509CERTDB_CID, false, nullptr, Constructor<nsNSSCertificateDB>}, + {&kNS_X509CERTLIST_CID, false, nullptr, + Constructor<nsNSSCertList, nullptr, ProcessRestriction::AnyProcess>}, + {&kNS_FORMPROCESSOR_CID, false, nullptr, nsKeygenFormProcessor::Create}, #ifdef MOZ_XUL -IMPL(nsCertTree, nullptr) + {&kNS_CERTTREE_CID, false, nullptr, Constructor<nsCertTree>}, #endif -IMPL(nsCryptoHash, nullptr, ProcessRestriction::AnyProcess) -IMPL(nsCryptoHMAC, nullptr, ProcessRestriction::AnyProcess) -IMPL(nsKeyObject, nullptr, ProcessRestriction::AnyProcess) -IMPL(nsKeyObjectFactory, nullptr, ProcessRestriction::AnyProcess) -IMPL(ContentSignatureVerifier, nullptr) -IMPL(nsCertOverrideService, &nsCertOverrideService::Init, - ProcessRestriction::ParentProcessOnly, ThreadRestriction::MainThreadOnly) -IMPL(nsRandomGenerator, nullptr, ProcessRestriction::AnyProcess) -IMPL(TransportSecurityInfo, nullptr, ProcessRestriction::AnyProcess) -IMPL(nsSiteSecurityService, &nsSiteSecurityService::Init, - ProcessRestriction::AnyProcess, ThreadRestriction::MainThreadOnly) -IMPL(CertBlocklist, &CertBlocklist::Init, ProcessRestriction::ParentProcessOnly, - ThreadRestriction::MainThreadOnly) -IMPL(OSKeyStore, nullptr, ProcessRestriction::ParentProcessOnly, - ThreadRestriction::MainThreadOnly) -IMPL(OSReauthenticator, nullptr, ProcessRestriction::ParentProcessOnly, - ThreadRestriction::MainThreadOnly) -#undef IMPL + {&kNS_CRYPTO_HASH_CID, false, nullptr, + Constructor<nsCryptoHash, nullptr, ProcessRestriction::AnyProcess>}, + {&kNS_CRYPTO_HMAC_CID, false, nullptr, + Constructor<nsCryptoHMAC, nullptr, ProcessRestriction::AnyProcess>}, + {&kNS_KEYMODULEOBJECT_CID, false, nullptr, + Constructor<nsKeyObject, nullptr, ProcessRestriction::AnyProcess>}, + {&kNS_KEYMODULEOBJECTFACTORY_CID, false, nullptr, + Constructor<nsKeyObjectFactory, nullptr, ProcessRestriction::AnyProcess>}, + {&kNS_CONTENTSIGNATUREVERIFIER_CID, false, nullptr, + Constructor<ContentSignatureVerifier>}, + {&kNS_CERTOVERRIDE_CID, false, nullptr, + Constructor<nsCertOverrideService, &nsCertOverrideService::Init, + ProcessRestriction::ParentProcessOnly, + ThreadRestriction::MainThreadOnly>}, + {&kNS_RANDOMGENERATOR_CID, false, nullptr, + Constructor<nsRandomGenerator, nullptr, ProcessRestriction::AnyProcess>}, + {&kTRANSPORTSECURITYINFO_CID, false, nullptr, + Constructor<TransportSecurityInfo, nullptr, + ProcessRestriction::AnyProcess>}, + {&kNS_NSSERRORSSERVICE_CID, false, nullptr, NSSErrorsServiceConstructor}, + {&kNS_NSSVERSION_CID, false, nullptr, nsNSSVersionConstructor}, + {&kNS_SECURE_BROWSER_UI_CID, false, nullptr, + nsSecureBrowserUIImplConstructor}, + {&kNS_SITE_SECURITY_SERVICE_CID, false, nullptr, + Constructor<nsSiteSecurityService, &nsSiteSecurityService::Init, + ProcessRestriction::AnyProcess, + ThreadRestriction::MainThreadOnly>}, + {&kNS_CERT_BLOCKLIST_CID, false, nullptr, + Constructor<CertBlocklist, &CertBlocklist::Init, + ProcessRestriction::ParentProcessOnly, + ThreadRestriction::MainThreadOnly>}, + {&kNS_OSKEYSTORE_CID, false, nullptr, + Constructor<OSKeyStore, nullptr, ProcessRestriction::ParentProcessOnly, + ThreadRestriction::MainThreadOnly>}, + {&kNS_OSREAUTHENTICATOR_CID, false, nullptr, + Constructor<OSReauthenticator, nullptr, + ProcessRestriction::ParentProcessOnly, + ThreadRestriction::MainThreadOnly>}, + {nullptr}}; -} // namespace psm -} // namespace mozilla +static const mozilla::Module::ContractIDEntry kNSSContracts[] = { + {PSM_COMPONENT_CONTRACTID, &kNS_NSSCOMPONENT_CID}, + {NS_NSS_ERRORS_SERVICE_CONTRACTID, &kNS_NSSERRORSSERVICE_CID}, + {NS_NSSVERSION_CONTRACTID, &kNS_NSSVERSION_CID}, + {NS_SECRETDECODERRING_CONTRACTID, &kNS_SECRETDECODERRING_CID}, + {NS_PK11TOKENDB_CONTRACTID, &kNS_PK11TOKENDB_CID}, + {NS_PKCS11MODULEDB_CONTRACTID, &kNS_PKCS11MODULEDB_CID}, + {NS_PSMCONTENTLISTEN_CONTRACTID, &kNS_PSMCONTENTLISTEN_CID}, + {NS_X509CERTDB_CONTRACTID, &kNS_X509CERTDB_CID}, + {NS_X509CERTLIST_CONTRACTID, &kNS_X509CERTLIST_CID}, + {NS_FORMPROCESSOR_CONTRACTID, &kNS_FORMPROCESSOR_CID}, +#ifdef MOZ_XUL + {NS_CERTTREE_CONTRACTID, &kNS_CERTTREE_CID}, +#endif + {NS_CRYPTO_HASH_CONTRACTID, &kNS_CRYPTO_HASH_CID}, + {NS_CRYPTO_HMAC_CONTRACTID, &kNS_CRYPTO_HMAC_CID}, + {"@mozilla.org/uriloader/psm-external-content-listener;1", + &kNS_PSMCONTENTLISTEN_CID}, + {NS_KEYMODULEOBJECT_CONTRACTID, &kNS_KEYMODULEOBJECT_CID}, + {NS_KEYMODULEOBJECTFACTORY_CONTRACTID, &kNS_KEYMODULEOBJECTFACTORY_CID}, + {NS_CONTENTSIGNATUREVERIFIER_CONTRACTID, &kNS_CONTENTSIGNATUREVERIFIER_CID}, + {NS_CERTOVERRIDE_CONTRACTID, &kNS_CERTOVERRIDE_CID}, + {NS_RANDOMGENERATOR_CONTRACTID, &kNS_RANDOMGENERATOR_CID}, + {NS_SECURE_BROWSER_UI_CONTRACTID, &kNS_SECURE_BROWSER_UI_CID}, + {NS_SSSERVICE_CONTRACTID, &kNS_SITE_SECURITY_SERVICE_CID}, + {NS_CERTBLOCKLIST_CONTRACTID, &kNS_CERT_BLOCKLIST_CID}, + {NS_OSKEYSTORE_CONTRACTID, &kNS_OSKEYSTORE_CID}, + {NS_OSREAUTHENTICATOR_CONTRACTID, &kNS_OSREAUTHENTICATOR_CID}, + {nullptr}}; + +static const mozilla::Module::CategoryEntry kNSSCategories[] = { + {NS_CONTENT_LISTENER_CATEGORYMANAGER_ENTRY, "application/x-x509-ca-cert", + "@mozilla.org/uriloader/psm-external-content-listener;1"}, + {NS_CONTENT_LISTENER_CATEGORYMANAGER_ENTRY, + "application/x-x509-server-cert", + "@mozilla.org/uriloader/psm-external-content-listener;1"}, + {NS_CONTENT_LISTENER_CATEGORYMANAGER_ENTRY, "application/x-x509-user-cert", + "@mozilla.org/uriloader/psm-external-content-listener;1"}, + {NS_CONTENT_LISTENER_CATEGORYMANAGER_ENTRY, "application/x-x509-email-cert", + "@mozilla.org/uriloader/psm-external-content-listener;1"}, + {nullptr}}; + +static const mozilla::Module kNSSModule = {mozilla::Module::kVersion, kNSSCIDs, + kNSSContracts, kNSSCategories}; + +} // unnamed namespace + +NSMODULE_DEFN(NSS) = &kNSSModule;
deleted file mode 100644 --- a/security/manager/ssl/nsNSSModule.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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/. */ - -#ifndef nsNSSModule_h -#define nsNSSModule_h - -#include "nsID.h" - -class nsISupports; - -namespace mozilla { -namespace psm { -template <typename T> -nsresult NSSConstructor(nsISupports* aOuter, const nsIID& aIID, - void** aInstancePtr); - -} -} // namespace mozilla - -#endif // nsNSSModule_h
--- a/security/manager/ssl/nsSecureBrowserUIImpl.h +++ b/security/manager/ssl/nsSecureBrowserUIImpl.h @@ -3,17 +3,16 @@ * 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/. */ #ifndef nsSecureBrowserUIImpl_h #define nsSecureBrowserUIImpl_h #include "nsCOMPtr.h" #include "nsISecureBrowserUI.h" -#include "nsITransportSecurityInfo.h" #include "nsIWebProgressListener.h" #include "nsWeakReference.h" class nsITransportSecurityInfo; class nsIChannel; namespace mozilla { namespace dom {
--- a/testing/modules/MockRegistrar.jsm +++ b/testing/modules/MockRegistrar.jsm @@ -6,23 +6,18 @@ var EXPORTED_SYMBOLS = [ "MockRegistrar", ]; const Cm = Components.manager; const {Log} = ChromeUtils.import("resource://gre/modules/Log.jsm"); -const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); var logger = Log.repository.getLogger("MockRegistrar"); -XPCOMUtils.defineLazyServiceGetter(this, "UUIDGen", - "@mozilla.org/uuid-generator;1", - "nsIUUIDGenerator"); - var MockRegistrar = Object.freeze({ _registeredComponents: new Map(), _originalCIDs: new Map(), get registrar() { return Cm.QueryInterface(Ci.nsIComponentRegistrar); }, /** @@ -44,18 +39,16 @@ var MockRegistrar = Object.freeze({ let originalCID = this._originalCIDs.get(contractID); if (!originalCID) { originalCID = this.registrar.contractIDToCID(contractID); this._originalCIDs.set(contractID, originalCID); } let originalFactory = Cm.getClassObject(originalCID, Ci.nsIFactory); - let cid = UUIDGen.generateUUID(); - let factory = { createInstance(outer, iid) { if (outer) { throw Cr.NS_ERROR_NO_AGGREGATION; } let wrappedMock; if (mock.prototype && mock.prototype.constructor) { @@ -75,48 +68,48 @@ var MockRegistrar = Object.freeze({ return wrappedMock.QueryInterface(iid); }, lockFactory(lock) { throw Cr.NS_ERROR_NOT_IMPLEMENTED; }, QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory]), }; - this.registrar.registerFactory(cid, + this.registrar.unregisterFactory(originalCID, originalFactory); + this.registrar.registerFactory(originalCID, "A Mock for " + contractID, contractID, factory); - this._registeredComponents.set(cid, { + this._registeredComponents.set(originalCID, { contractID, factory, - originalCID, + originalFactory, }); - return cid; + return originalCID; }, /** * Unregister the mock. * * @param cid The CID of the mock. */ unregister(cid) { let component = this._registeredComponents.get(cid); if (!component) { return; } this.registrar.unregisterFactory(cid, component.factory); - if (component.originalCID) { - // Passing `null` for the factory re-maps the contract ID to the - // entry for its original CID. - this.registrar.registerFactory(component.originalCID, "", + if (component.originalFactory) { + this.registrar.registerFactory(cid, + "", component.contractID, - null); + component.originalFactory); } this._registeredComponents.delete(cid); }, /** * Unregister all registered mocks. */
--- a/testing/xpcshell/head.js +++ b/testing/xpcshell/head.js @@ -243,37 +243,43 @@ function _do_quit() { */ var _fakeIdleService = { get registrar() { delete this.registrar; return this.registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); }, contractID: "@mozilla.org/widget/idleservice;1", - CID: Components.ID("{9163a4ae-70c2-446c-9ac1-bbe4ab93004e}"), + get CID() { + return this.registrar.contractIDToCID(this.contractID); + }, activate: function FIS_activate() { - if (!this.originalCID) { + if (!this.originalFactory) { // Save original factory. - this.originalCID = this.registrar.contractIDToCID(this.contractID); + this.originalFactory = + Components.manager.getClassObject(Cc[this.contractID], + Ci.nsIFactory); + // Unregister original factory. + this.registrar.unregisterFactory(this.CID, this.originalFactory); // Replace with the mock. this.registrar.registerFactory(this.CID, "Fake Idle Service", this.contractID, this.factory ); } }, deactivate: function FIS_deactivate() { - if (this.originalCID) { + if (this.originalFactory) { // Unregister the mock. this.registrar.unregisterFactory(this.CID, this.factory); // Restore original factory. - this.registrar.registerFactory(this.originalCID, "Idle Service", - this.contractID, null); - delete this.originalCID; + this.registrar.registerFactory(this.CID, "Idle Service", + this.contractID, this.originalFactory); + delete this.originalFactory; } }, factory: { // nsIFactory createInstance(aOuter, aIID) { if (aOuter) { throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
deleted file mode 100644 --- a/toolkit/components/build/components.conf +++ /dev/null @@ -1,207 +0,0 @@ -# -*- 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'], - }, - ]
--- a/toolkit/components/build/moz.build +++ b/toolkit/components/build/moz.build @@ -10,20 +10,32 @@ with Files('**'): EXPORTS += [ 'nsToolkitCompsCID.h', ] 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
--- a/toolkit/components/build/nsToolkitCompsCID.h +++ b/toolkit/components/build/nsToolkitCompsCID.h @@ -1,53 +1,103 @@ /* 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/. */ +#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 // alerts service at runtime. #define NS_SYSTEMALERTSERVICE_CONTRACTID "@mozilla.org/system-alerts-service;1" #define NS_AUTOCOMPLETECONTROLLER_CONTRACTID \ "@mozilla.org/autocomplete/controller;1" #define NS_AUTOCOMPLETESIMPLERESULT_CONTRACTID \ "@mozilla.org/autocomplete/simple-result;1" #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 \ "@mozilla.org/satchel/form-fill-controller;1" #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" #define NS_NAVHISTORYSERVICE_CONTRACTID \ "@mozilla.org/browser/nav-history-service;1" #define NS_ANNOTATIONSERVICE_CONTRACTID \ "@mozilla.org/browser/annotation-service;1" #define NS_NAVBOOKMARKSSERVICE_CONTRACTID \ "@mozilla.org/browser/nav-bookmarks-service;1" #define NS_TAGGINGSERVICE_CONTRACTID "@mozilla.org/browser/tagging-service;1" #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 \ { \ 0x84e11f80, 0xca55, 0x11dd, { \ 0xad, 0x8b, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 \ } \ } @@ -70,40 +120,87 @@ // {7A6F70B6-2BBD-44b5-9304-501352D44AB5} #define NS_AUTOCOMPLETEMDBRESULT_CID \ { \ 0x7a6f70b6, 0x2bbd, 0x44b5, { \ 0x93, 0x4, 0x50, 0x13, 0x52, 0xd4, 0x4a, 0xb5 \ } \ } +#define NS_DOWNLOADPLATFORM_CID \ + { \ + 0x649a14c9, 0xfe5c, 0x48ec, { \ + 0x9c, 0x85, 0x00, 0xca, 0xd9, 0xcc, 0xf3, 0x2e \ + } \ + } + // {895DB6C7-DBDF-40ea-9F64-B175033243DC} #define NS_FORMFILLCONTROLLER_CID \ { \ 0x895db6c7, 0xdbdf, 0x40ea, { \ 0x9f, 0x64, 0xb1, 0x75, 0x3, 0x32, 0x43, 0xdc \ } \ } // {59648a91-5a60-4122-8ff2-54b839c84aed} #define NS_GLOBALHISTORY_CID \ { \ 0x59648a91, 0x5a60, 0x4122, { \ 0x8f, 0xf2, 0x54, 0xb8, 0x39, 0xc8, 0x4a, 0xed \ } \ } +// {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 \ { \ 0x7a258022, 0x6765, 0x11e5, { \ 0xb3, 0x79, 0xb3, 0x7b, 0x1f, 0x23, 0x54, 0xbe \ } \ } +// 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, { \ 0x8c, 0xd4, 0x84, 0xf3, 0xb8, 0x22, 0x8c, 0x69 \ } \ } #define NS_NAVHISTORYRESULTTREEVIEWER_CID \ @@ -128,8 +225,62 @@ } #define NS_FAVICONSERVICE_CID \ { \ 0x984e3259, 0x9266, 0x49cf, { \ 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
--- a/toolkit/components/build/nsToolkitCompsModule.cpp +++ b/toolkit/components/build/nsToolkitCompsModule.cpp @@ -1,37 +1,257 @@ /* 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 "nsToolkitCompsModule.h" +#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 + +#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 "nsISupports.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" #if defined(XP_WIN) # include "NativeFileWatcherWin.h" #else # include "NativeFileWatcherNotSupported.h" +#endif // (XP_WIN) -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; ///////////////////////////////////////////////////////////////////////////// -nsresult nsUrlClassifierDBServiceConstructor(nsISupports *aOuter, - const nsIID &aIID, - void **aResult) { +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 rv; NS_ENSURE_ARG_POINTER(aResult); NS_ENSURE_NO_AGGREGATION(aOuter); - RefPtr<nsUrlClassifierDBService> inst = - nsUrlClassifierDBService::GetInstance(&rv); - if (!inst) { + nsUrlClassifierDBService *inst = nsUrlClassifierDBService::GetInstance(&rv); + if (nullptr == inst) { return rv; } + /* NS_ADDREF(inst); */ + rv = inst->QueryInterface(aIID, aResult); + NS_RELEASE(inst); - return inst->QueryInterface(aIID, aResult); + return rv; } + +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;
deleted file mode 100644 --- a/toolkit/components/build/nsToolkitCompsModule.h +++ /dev/null @@ -1,12 +0,0 @@ -/* 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);
--- a/toolkit/components/filewatcher/NativeFileWatcherNotSupported.h +++ b/toolkit/components/filewatcher/NativeFileWatcherNotSupported.h @@ -32,11 +32,13 @@ class NativeFileWatcherService final : p }; private: ~NativeFileWatcherService(){}; NativeFileWatcherService(const NativeFileWatcherService& other) = delete; void operator=(const NativeFileWatcherService& other) = delete; }; +NS_IMPL_ISUPPORTS(NativeFileWatcherService, nsINativeFileWatcherService); + } // namespace mozilla #endif // mozilla_nativefilewatcher_h__
--- a/toolkit/components/places/nsAnnotationService.h +++ b/toolkit/components/places/nsAnnotationService.h @@ -7,16 +7,17 @@ #define nsAnnotationService_h___ #include "nsIAnnotationService.h" #include "nsTArray.h" #include "nsCOMArray.h" #include "nsCOMPtr.h" #include "nsServiceManagerUtils.h" #include "nsWeakReference.h" +#include "nsToolkitCompsCID.h" #include "Database.h" #include "nsString.h" #include "mozilla/Attributes.h" class nsAnnotationService final : public nsIAnnotationService, public nsSupportsWeakReference { public: NS_DECL_ISUPPORTS
--- a/toolkit/components/reputationservice/ApplicationReputation.cpp +++ b/toolkit/components/reputationservice/ApplicationReputation.cpp @@ -24,17 +24,16 @@ #include "nsIURL.h" #include "nsIUrlClassifierDBService.h" #include "nsIX509Cert.h" #include "nsIX509CertDB.h" #include "nsIX509CertList.h" #include "mozilla/ArrayUtils.h" #include "mozilla/BasePrincipal.h" -#include "mozilla/Components.h" #include "mozilla/ErrorNames.h" #include "mozilla/LoadContext.h" #include "mozilla/Preferences.h" #include "mozilla/Services.h" #include "mozilla/Telemetry.h" #include "mozilla/TimeStamp.h" #include "mozilla/intl/LocaleService.h" @@ -364,17 +363,17 @@ nsresult PendingDBLookup::LookupSpecInte if (!principal) { return NS_ERROR_FAILURE; } // Check local lists to see if the URI has already been whitelisted or // blacklisted. LOG(("Checking DB service for principal %s [this = %p]", mSpec.get(), this)); nsCOMPtr<nsIUrlClassifierDBService> dbService = - mozilla::components::UrlClassifierDB::Service(&rv); + do_GetService(NS_URLCLASSIFIERDBSERVICE_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); nsAutoCString tables; nsAutoCString allowlist; Preferences::GetCString(PREF_DOWNLOAD_ALLOW_TABLE, allowlist); if ((mLookupType != LookupType::BlocklistOnly) && !allowlist.IsEmpty()) { tables.Append(allowlist); }
--- a/toolkit/components/reputationservice/LoginReputation.cpp +++ b/toolkit/components/reputationservice/LoginReputation.cpp @@ -1,16 +1,15 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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 "LoginReputation.h" #include "nsThreadUtils.h" -#include "mozilla/Components.h" #include "mozilla/ErrorNames.h" #include "mozilla/Logging.h" #include "mozilla/net/UrlClassifierFeatureFactory.h" #include "mozilla/Preferences.h" #include "mozilla/StaticPrefs.h" #include "mozilla/Telemetry.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/dom/HTMLInputElement.h" @@ -109,17 +108,17 @@ RefPtr<ReputationPromise> LoginWhitelist nsCOMPtr<nsIURI> uri; rv = aParam->GetFormURI(getter_AddRefs(uri)); if (NS_WARN_IF(NS_FAILED(rv) || !uri)) { return p; } nsCOMPtr<nsIURIClassifier> uriClassifier = - mozilla::components::UrlClassifierDB::Service(&rv); + do_GetService(NS_URLCLASSIFIERDBSERVICE_CONTRACTID, &rv); if (NS_WARN_IF(NS_FAILED(rv))) { return p; } // AsyncClassifyLocalWithTables API won't trigger a gethash request on // a full-length match, so this API call should only include local operation. // We don't support prefs overwrite for this classification.
--- a/toolkit/components/reputationservice/LoginReputationIPC.cpp +++ b/toolkit/components/reputationservice/LoginReputationIPC.cpp @@ -1,17 +1,16 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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 "LoginReputationIPC.h" -#include "mozilla/Components.h" #include "mozilla/Unused.h" using namespace mozilla; using namespace mozilla::dom; // MOZ_LOG=LoginReputation:5 extern LazyLogModule gLoginReputationLogModule; #define LR_LOG(args) \ @@ -19,17 +18,17 @@ extern LazyLogModule gLoginReputationLog #define LR_LOG_ENABLED() \ MOZ_LOG_TEST(gLoginReputationLogModule, mozilla::LogLevel::Debug) NS_IMPL_ISUPPORTS(LoginReputationParent, nsILoginReputationQueryCallback) mozilla::ipc::IPCResult LoginReputationParent::QueryReputation(nsIURI* aURI) { nsresult rv; nsCOMPtr<nsILoginReputationService> service = - components::LoginReputation::Service(&rv); + do_GetService(NS_LOGIN_REPUTATION_SERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) { Unused << Send__delete__(this); return IPC_OK(); } nsCOMPtr<nsILoginReputationQuery> query = LoginReputationService::ConstructQueryParam(aURI); rv = service->QueryReputation(query, this);
--- a/toolkit/components/url-classifier/Classifier.cpp +++ b/toolkit/components/url-classifier/Classifier.cpp @@ -10,17 +10,16 @@ #include "nsISimpleEnumerator.h" #include "nsIRandomGenerator.h" #include "nsIInputStream.h" #include "nsISeekableStream.h" #include "nsIFile.h" #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" #include "mozilla/Logging.h" #include "mozilla/SyncRunnable.h" #include "mozilla/Base64.h" #include "mozilla/Unused.h" #include "mozilla/UniquePtr.h" @@ -741,17 +740,17 @@ nsresult Classifier::ApplyUpdatesBackgro // been called then we need to interrupt the update process. // We only add checkpoints for non-trivial tasks. if (aUpdates.IsEmpty()) { return NS_OK; } nsCOMPtr<nsIUrlClassifierUtils> urlUtil = - components::UrlClassifierUtils::Service(); + do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID); nsCString provider; // Assume all TableUpdate objects should have the same provider. urlUtil->GetTelemetryProvider(aUpdates[0]->TableName(), provider); Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_CL_KEYED_UPDATE_TIME> keyedTimer(provider); @@ -1179,17 +1178,17 @@ bool Classifier::CheckValidUpdate(TableU return false; } return true; } nsCString Classifier::GetProvider(const nsACString& aTableName) { nsCOMPtr<nsIUrlClassifierUtils> urlUtil = - components::UrlClassifierUtils::Service(); + do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID); nsCString provider; nsresult rv = urlUtil->GetProvider(aTableName, provider); return NS_SUCCEEDED(rv) ? provider : EmptyCString(); } /*
--- a/toolkit/components/url-classifier/ProtocolParser.cpp +++ b/toolkit/components/url-classifier/ProtocolParser.cpp @@ -1,17 +1,16 @@ //* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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 "ProtocolParser.h" #include "LookupCache.h" #include "nsNetCID.h" -#include "mozilla/Components.h" #include "mozilla/Logging.h" #include "prnetdb.h" #include "prprf.h" #include "nsUrlClassifierDBService.h" #include "nsUrlClassifierUtils.h" #include "nsPrintfCString.h" #include "mozilla/Base64.h" @@ -769,17 +768,17 @@ nsresult ProtocolParserProtobuf::Process if (!aResponse.has_threat_type()) { NS_WARNING( "Threat type not initialized. This seems to be an invalid response."); return NS_ERROR_UC_PARSER_MISSING_PARAM; } // Convert threat type to list name. nsCOMPtr<nsIUrlClassifierUtils> urlUtil = - components::UrlClassifierUtils::Service(); + do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID); nsCString possibleListNames; nsresult rv = urlUtil->ConvertThreatTypeToListNames(aResponse.threat_type(), possibleListNames); if (NS_FAILED(rv)) { PARSER_LOG(("Threat type to list name conversion error: %d", aResponse.threat_type())); return NS_ERROR_UC_PARSER_UNKNOWN_THREAT; }
--- a/toolkit/components/url-classifier/nsCheckSummedOutputStream.h +++ b/toolkit/components/url-classifier/nsCheckSummedOutputStream.h @@ -7,16 +7,17 @@ #define nsCheckSummedOutputStream_h__ #include "nsIFile.h" #include "nsIOutputStream.h" #include "nsICryptoHash.h" #include "nsNetCID.h" #include "nsNetUtil.h" #include "nsString.h" +#include "nsToolkitCompsCID.h" #include "../../../netwerk/base/nsBufferedStreams.h" #include "prio.h" class nsCheckSummedOutputStream : public nsBufferedOutputStream { public: NS_DECL_ISUPPORTS_INHERITED // Size of MD5 hash in bytes
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp @@ -9,38 +9,36 @@ #include "nsCRT.h" #include "nsIDirectoryService.h" #include "nsIKeyModule.h" #include "nsIObserverService.h" #include "nsIPermissionManager.h" #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" #include "nsURILoader.h" #include "nsString.h" #include "nsReadableUtils.h" #include "nsTArray.h" #include "nsNetCID.h" #include "nsThreadUtils.h" #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" #include "Classifier.h" #include "ProtocolParser.h" #include "mozilla/Attributes.h" #include "nsIPrincipal.h" #include "Classifier.h" @@ -788,17 +786,17 @@ nsresult nsUrlClassifierDBServiceWorker: // 3) succeeded in obtaining table updates but failed to build new // tables. // 4) succeeded in building new tables but failed to take them. // 5) succeeded in taking new tables. mUpdateStatus = aUpdateStatus; nsCOMPtr<nsIUrlClassifierUtils> urlUtil = - components::UrlClassifierUtils::Service(); + do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID); nsCString provider; // Assume that all the tables in update should have the same provider. urlUtil->GetTelemetryProvider(mUpdateTables.SafeElementAt(0, EmptyCString()), provider); nsresult updateStatus = mUpdateStatus; if (NS_FAILED(mUpdateStatus)) { @@ -1558,17 +1556,17 @@ nsUrlClassifierClassifyCallback::HandleR return NS_ERROR_INVALID_ARG; } ClassifyMatchedInfo* matchedInfo = mMatchedArray.AppendElement(); matchedInfo->table = aTable; matchedInfo->fullhash = aFullHash; nsCOMPtr<nsIUrlClassifierUtils> urlUtil = - components::UrlClassifierUtils::Service(); + do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID); nsCString provider; nsresult rv = urlUtil->GetProvider(aTable, provider); matchedInfo->provider.name = NS_SUCCEEDED(rv) ? provider : EmptyCString(); matchedInfo->provider.priority = 0; for (uint8_t i = 0; i < ArrayLength(kBuiltInProviders); i++) { if (kBuiltInProviders[i].name.Equals(matchedInfo->provider.name)) { @@ -1590,32 +1588,38 @@ NS_INTERFACE_MAP_BEGIN(nsUrlClassifierDB NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIUrlClassifierDBService, XRE_IsParentProcess()) NS_INTERFACE_MAP_ENTRY(nsIURIClassifier) NS_INTERFACE_MAP_ENTRY(nsIUrlClassifierInfo) NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIObserver, XRE_IsParentProcess()) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIURIClassifier) NS_INTERFACE_MAP_END -/* static */ already_AddRefed<nsUrlClassifierDBService> -nsUrlClassifierDBService::GetInstance(nsresult* result) { +/* static */ nsUrlClassifierDBService* nsUrlClassifierDBService::GetInstance( + nsresult* result) { *result = NS_OK; if (!sUrlClassifierDBService) { sUrlClassifierDBService = new (fallible) nsUrlClassifierDBService(); if (!sUrlClassifierDBService) { *result = NS_ERROR_OUT_OF_MEMORY; 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 do_AddRef(sUrlClassifierDBService); + return sUrlClassifierDBService; } nsUrlClassifierDBService::nsUrlClassifierDBService() : mCheckMalware(CHECK_MALWARE_DEFAULT), mCheckPhishing(CHECK_PHISHING_DEFAULT), mCheckBlockedURIs(CHECK_BLOCKED_DEFAULT), mInUpdate(false) {} @@ -1715,18 +1719,17 @@ nsresult nsUrlClassifierDBService::Init( sGethashNoise = Preferences::GetUint(GETHASH_NOISE_PREF, GETHASH_NOISE_DEFAULT); ReadTablesFromPrefs(); nsresult rv; { // Force nsIUrlClassifierUtils loading on main thread. nsCOMPtr<nsIUrlClassifierUtils> dummy = - components::UrlClassifierUtils::Service(&rv); - Unused << dummy; + do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); } // Directory providers must also be accessed on the main thread. nsCOMPtr<nsIFile> cacheDir; rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_LOCAL_50_DIR, getter_AddRefs(cacheDir)); if (NS_FAILED(rv)) { @@ -1989,17 +1992,17 @@ nsUrlClassifierDBService::SendThreatHitR if (urlStr.IsEmpty() || NS_LITERAL_STRING("about:blank").Equals(urlStr)) { LOG(("%s is missing a ThreatHit data reporting URL.", PromiseFlatCString(aProvider).get())); return NS_OK; } nsCOMPtr<nsIUrlClassifierUtils> utilsService = - components::UrlClassifierUtils::Service(); + do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID); if (!utilsService) { return NS_ERROR_FAILURE; } nsAutoCString reportBody; rv = utilsService->MakeThreatHitReport(aChannel, aList, aFullHash, reportBody); NS_ENSURE_SUCCESS(rv, rv); @@ -2091,17 +2094,17 @@ nsresult nsUrlClassifierDBService::Looku NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE); uri = NS_GetInnermostURI(uri); NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE); nsAutoCString key; // Canonicalize the url nsCOMPtr<nsIUrlClassifierUtils> utilsService = - components::UrlClassifierUtils::Service(); + do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID); rv = utilsService->GetKeyForURI(uri, key); if (NS_FAILED(rv)) return rv; if (forceLookup) { *didLookup = true; } else { nsCOMPtr<nsIPermissionManager> permissionManager = services::GetPermissionManager(); @@ -2474,17 +2477,17 @@ nsUrlClassifierDBService::AsyncClassifyL if (AsyncClassifyLocalWithFeaturesUsingPreferences(uri, aFeatures, aListType, aCallback)) { return NS_OK; } nsAutoCString key; // Canonicalize the url nsCOMPtr<nsIUrlClassifierUtils> utilsService = - components::UrlClassifierUtils::Service(); + do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID); nsresult rv = utilsService->GetKeyForURI(uri, key); NS_ENSURE_SUCCESS(rv, rv); if (XRE_IsContentProcess()) { using namespace mozilla::dom; using namespace mozilla::ipc; ContentChild* content = ContentChild::GetSingleton();
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.h +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.h @@ -12,16 +12,17 @@ #include "nsInterfaceHashtable.h" #include "nsIObserver.h" #include "nsUrlClassifierPrefixSet.h" #include "nsIUrlClassifierHashCompleter.h" #include "nsIUrlListManager.h" #include "nsIUrlClassifierDBService.h" #include "nsIUrlClassifierInfo.h" #include "nsIURIClassifier.h" +#include "nsToolkitCompsCID.h" #include "nsICryptoHMAC.h" #include "mozilla/Attributes.h" #include "mozilla/Mutex.h" #include "mozilla/TimeStamp.h" #include "Entries.h" #include "LookupCache.h" #include "HashStore.h" @@ -95,18 +96,17 @@ class nsUrlClassifierDBService final : p friend class mozilla::net::AsyncUrlChannelClassifier; public: // This is thread safe. It throws an exception if the thread is busy. nsUrlClassifierDBService(); nsresult Init(); - static already_AddRefed<nsUrlClassifierDBService> GetInstance( - nsresult* result); + static nsUrlClassifierDBService* GetInstance(nsresult* result); NS_DECLARE_STATIC_IID_ACCESSOR(NS_URLCLASSIFIERDBSERVICE_CID) NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIURLCLASSIFIERDBSERVICE NS_DECL_NSIURICLASSIFIER NS_DECL_NSIURLCLASSIFIERINFO NS_DECL_NSIOBSERVER
--- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp @@ -8,16 +8,17 @@ #include "nsIUrlClassifierPrefixSet.h" #include "crc32c.h" #include "nsCOMPtr.h" #include "nsDebug.h" #include "nsPrintfCString.h" #include "nsTArray.h" #include "nsString.h" #include "nsIFile.h" +#include "nsToolkitCompsCID.h" #include "nsTArray.h" #include "nsThreadUtils.h" #include "nsNetUtil.h" #include "nsISeekableStream.h" #include "nsIBufferedStreams.h" #include "nsIFileStreams.h" #include "mozilla/MemoryReporting.h" #include "mozilla/Telemetry.h"
--- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp @@ -1,25 +1,25 @@ //* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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 "mozilla/Components.h" #include "nsCRT.h" #include "nsIHttpChannel.h" #include "nsIObserverService.h" #include "nsIStringStream.h" #include "nsIUploadChannel.h" #include "nsIURI.h" #include "nsIUrlClassifierDBService.h" #include "nsUrlClassifierUtils.h" #include "nsNetUtil.h" #include "nsStreamUtils.h" #include "nsStringStream.h" +#include "nsToolkitCompsCID.h" #include "nsUrlClassifierStreamUpdater.h" #include "mozilla/BasePrincipal.h" #include "mozilla/ErrorNames.h" #include "mozilla/Logging.h" #include "mozilla/ResultExtensions.h" #include "nsIInterfaceRequestor.h" #include "mozilla/LoadContext.h" #include "mozilla/Telemetry.h" @@ -289,17 +289,17 @@ nsUrlClassifierStreamUpdater::DownloadUp // downloads. quit-application is the same event that the download // manager listens for and uses to cancel pending downloads. nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService(); if (!observerService) return NS_ERROR_FAILURE; observerService->AddObserver(this, gQuitApplicationMessage, false); - mDBService = mozilla::components::UrlClassifierDB::Service(&rv); + mDBService = do_GetService(NS_URLCLASSIFIERDBSERVICE_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); mInitialized = true; } rv = mDBService->BeginUpdate(this, aRequestTables); if (rv == NS_ERROR_NOT_AVAILABLE) { LOG(("Service busy, already updating, queuing update %s from %s", @@ -322,17 +322,17 @@ nsUrlClassifierStreamUpdater::DownloadUp return NS_OK; } if (NS_FAILED(rv)) { return rv; } nsCOMPtr<nsIUrlClassifierUtils> urlUtil = - mozilla::components::UrlClassifierUtils::Service(); + do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID); nsTArray<nsCString> tables; mozilla::safebrowsing::Classifier::SplitTables(aRequestTables, tables); urlUtil->GetTelemetryProvider(tables.SafeElementAt(0, EmptyCString()), mTelemetryProvider); mCurrentRequest = MakeUnique<UpdateRequest>(); BuildUpdateRequest(aRequestTables, aRequestPayload, aIsPostRequest,
--- a/toolkit/components/url-classifier/tests/gtest/Common.cpp +++ b/toolkit/components/url-classifier/tests/gtest/Common.cpp @@ -1,18 +1,16 @@ #include "Common.h" #include "HashStore.h" #include "Classifier.h" #include "nsAppDirectoryServiceDefs.h" #include "nsTArray.h" #include "nsIThread.h" #include "nsThreadUtils.h" #include "nsUrlClassifierUtils.h" -#include "mozilla/Components.h" -#include "mozilla/Unused.h" using namespace mozilla; using namespace mozilla::safebrowsing; #define GTEST_SAFEBROWSING_DIR NS_LITERAL_CSTRING("safebrowsing") #define GTEST_TABLE NS_LITERAL_CSTRING("gtest-malware-proto") template <typename Function> @@ -92,18 +90,17 @@ void ApplyUpdate(TableUpdateArray& updat classifier->Open(*file); { // Force nsIUrlClassifierUtils loading on main thread // because nsIUrlClassifierDBService will not run in advance // in gtest. nsresult rv; nsCOMPtr<nsIUrlClassifierUtils> dummy = - mozilla::components::UrlClassifierUtils::Service(&rv); - Unused << dummy; + do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID, &rv); ASSERT_TRUE(NS_SUCCEEDED(rv)); } SyncApplyUpdates(classifier, updates); } void ApplyUpdate(TableUpdate* update) { TableUpdateArray updates = {update};
--- a/toolkit/components/url-classifier/tests/gtest/TestUrlClassifierTableUpdateV4.cpp +++ b/toolkit/components/url-classifier/tests/gtest/TestUrlClassifierTableUpdateV4.cpp @@ -5,18 +5,16 @@ #include "Classifier.h" #include "HashStore.h" #include "nsAppDirectoryServiceDefs.h" #include "nsIFile.h" #include "nsIThread.h" #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; typedef nsCString _Prefix; typedef nsTArray<_Prefix> _PrefixArray; #define GTEST_SAFEBROWSING_DIR NS_LITERAL_CSTRING("safebrowsing") @@ -188,18 +186,17 @@ static void testUpdate(TableUpdateArray& NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(file)); { // Force nsIUrlClassifierUtils loading on main thread // because nsIUrlClassifierDBService will not run in advance // in gtest. nsresult rv; nsCOMPtr<nsIUrlClassifierUtils> dummy = - components::UrlClassifierUtils::Service(&rv); - Unused << dummy; + do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID, &rv); ASSERT_TRUE(NS_SUCCEEDED(rv)); } RefPtr<Classifier> classifier = new Classifier(); classifier->Open(*file); nsresult rv = SyncApplyUpdates(classifier, tableUpdates); ASSERT_TRUE(rv == NS_OK);
--- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -1072,23 +1072,20 @@ with only_when('--enable-compile-environ set_config('USE_ELF_HACK', depends_if('--enable-elf-hack')(lambda _: True)) @depends(check_build_environment) def idl_roots(build_env): return namespace(ipdl_root=os.path.join(build_env.topobjdir, 'ipc', 'ipdl'), webidl_root=os.path.join(build_env.topobjdir, - 'dom', 'bindings'), - xpcom_root=os.path.join(build_env.topobjdir, - 'xpcom', 'components')) + 'dom', 'bindings')) set_config('WEBIDL_ROOT', idl_roots.webidl_root) set_config('IPDL_ROOT', idl_roots.ipdl_root) -set_config('XPCOM_ROOT', idl_roots.xpcom_root) # Proxy bypass protection # ============================================================== option('--enable-proxy-bypass-protection', help='Prevent suspected or confirmed proxy bypasses') @depends_if('--enable-proxy-bypass-protection')
--- a/toolkit/xre/ProfileReset.cpp +++ b/toolkit/xre/ProfileReset.cpp @@ -11,18 +11,18 @@ #include "ProfileReset.h" #include "nsDirectoryServiceDefs.h" #include "nsDirectoryServiceUtils.h" #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" #include "mozilla/Unused.h" #include "prtime.h" using namespace mozilla; @@ -143,17 +143,17 @@ nsresult ProfileResetCleanup(nsIToolkitP if (NS_FAILED(rv)) return rv; // Show a progress window while the cleanup happens since the disk I/O can // take time. nsCOMPtr<nsIWindowWatcher> windowWatcher( do_GetService(NS_WINDOWWATCHER_CONTRACTID)); if (!windowWatcher) return NS_ERROR_FAILURE; - nsCOMPtr<nsIAppStartup> appStartup(components::AppStartup::Service()); + nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID)); if (!appStartup) return NS_ERROR_FAILURE; nsCOMPtr<mozIDOMWindowProxy> progressWindow; rv = windowWatcher->OpenWindow(nullptr, kResetProgressURL, "_blank", "centerscreen,chrome,titlebar", nullptr, getter_AddRefs(progressWindow)); if (NS_FAILED(rv)) return rv;
--- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -5,17 +5,16 @@ #include "mozilla/dom/ContentParent.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/ipc/GeckoChildProcessHost.h" #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" #include "mozilla/IOInterposer.h" #include "mozilla/Likely.h" #include "mozilla/MemoryChecking.h" #include "mozilla/Poison.h" #include "mozilla/Preferences.h" @@ -146,16 +145,17 @@ #include "nsXPCOMCIDInternal.h" #include "nsString.h" #include "nsPrintfCString.h" #include "nsVersionComparator.h" #include "nsAppDirectoryServiceDefs.h" #include "nsXULAppAPI.h" #include "nsXREDirProvider.h" +#include "nsToolkitCompsCID.h" #include "nsINIParser.h" #include "mozilla/Omnijar.h" #include "mozilla/StartupTimeline.h" #include "mozilla/LateWriteChecks.h" #include <stdlib.h> #include <locale.h> @@ -1293,17 +1293,17 @@ ScopedXPCOMStartup::~ScopedXPCOMStartup( if (mServiceManager) { #ifdef XP_MACOSX // On OS X, we need a pool to catch cocoa objects that are autoreleased // during teardown. mozilla::MacAutoreleasePool pool; #endif - nsCOMPtr<nsIAppStartup> appStartup(components::AppStartup::Service()); + nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID)); if (appStartup) appStartup->DestroyHiddenWindow(); gDirServiceProvider->DoShutdown(); PROFILER_ADD_MARKER("Shutdown early", OTHER); WriteConsoleLog(); NS_ShutdownXPCOM(mServiceManager); @@ -1417,17 +1417,17 @@ nsresult ScopedXPCOMStartup::SetWindowCr NS_IF_ADDREF(gNativeAppSupport = native); // Inform the chrome registry about OS accessibility nsCOMPtr<nsIToolkitChromeRegistry> cr = mozilla::services::GetToolkitChromeRegistryService(); if (cr) cr->CheckForOSAccessibility(); - nsCOMPtr<nsIWindowCreator> creator(components::AppStartup::Service()); + nsCOMPtr<nsIWindowCreator> creator(do_GetService(NS_APPSTARTUP_CONTRACTID)); if (!creator) return NS_ERROR_UNEXPECTED; nsCOMPtr<nsIWindowWatcher> wwatch( do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv)); NS_ENSURE_SUCCESS(rv, rv); return wwatch->SetWindowCreator(creator); } @@ -1993,17 +1993,18 @@ static ReturnAbortOnError ShowProfileMan do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID)); nsCOMPtr<nsIMutableArray> dlgArray( do_CreateInstance(NS_ARRAY_CONTRACTID)); NS_ENSURE_TRUE(windowWatcher && ioParamBlock && dlgArray, NS_ERROR_FAILURE); ioParamBlock->SetObjects(dlgArray); - nsCOMPtr<nsIAppStartup> appStartup(components::AppStartup::Service()); + nsCOMPtr<nsIAppStartup> appStartup( + do_GetService(NS_APPSTARTUP_CONTRACTID)); NS_ENSURE_TRUE(appStartup, NS_ERROR_FAILURE); nsCOMPtr<mozIDOMWindowProxy> newWindow; rv = windowWatcher->OpenWindow(nullptr, kProfileManagerURL, "_blank", "centerscreen,chrome,modal,titlebar", ioParamBlock, getter_AddRefs(newWindow)); NS_ENSURE_SUCCESS_LOG(rv, rv); @@ -4211,17 +4212,17 @@ nsresult XREMain::XRE_mainRun() { #endif // Initialize user preferences before notifying startup observers so they're // ready in time for early consumers, such as the component loader. mDirProvider.InitializeUserPrefs(); nsAppStartupNotifier::NotifyObservers(APPSTARTUP_TOPIC); - nsCOMPtr<nsIAppStartup> appStartup(components::AppStartup::Service()); + nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID)); NS_ENSURE_TRUE(appStartup, NS_ERROR_FAILURE); mDirProvider.DoStartup(); // As FilePreferences need the profile directory, we must initialize right // here. mozilla::FilePreferences::InitDirectoriesWhitelist(); mozilla::FilePreferences::InitPrefs();
--- a/toolkit/xre/nsXREDirProvider.cpp +++ b/toolkit/xre/nsXREDirProvider.cpp @@ -1,14 +1,15 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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 "nsAppRunner.h" +#include "nsToolkitCompsCID.h" #include "nsXREDirProvider.h" #include "jsapi.h" #include "xpcpublic.h" #include "nsIAppStartup.h" #include "nsIDirectoryEnumerator.h" #include "nsIFile.h" @@ -32,17 +33,16 @@ #include "nsEnumeratorUtils.h" #include "nsReadableUtils.h" #include "SpecialSystemDirectory.h" #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" #include "mozilla/Telemetry.h" #include <stdlib.h> #ifdef XP_WIN @@ -957,18 +957,17 @@ nsXREDirProvider::DoStartup() { /* Make sure we've setup prefs before profile-do-change to be able to use them to track crashes and because we want to begin crash tracking before other code run from this notification since they may cause crashes. */ MOZ_ASSERT(mPrefsInitialized); bool safeModeNecessary = false; - nsCOMPtr<nsIAppStartup> appStartup( - mozilla::components::AppStartup::Service()); + nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID)); if (appStartup) { rv = appStartup->TrackStartupCrashBegin(&safeModeNecessary); if (NS_FAILED(rv) && rv != NS_ERROR_NOT_AVAILABLE) NS_WARNING("Error while beginning startup crash tracking"); if (!gSafeMode && safeModeNecessary) { appStartup->RestartInSafeMode(nsIAppStartup::eForceQuit); return NS_OK;
--- a/uriloader/base/nsCURILoader.idl +++ b/uriloader/base/nsCURILoader.idl @@ -8,16 +8,29 @@ /* nsCURILoader implements: ------------------------- nsIURILoader */ %{ C++ +// {9F6D5D40-90E7-11d3-AF93-00A024FFC08C} - +#define NS_URI_LOADER_CID \ +{ 0x9f6d5d40, 0x90e7, 0x11d3, { 0xaf, 0x80, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c } } +#define NS_URI_LOADER_CONTRACTID \ +"@mozilla.org/uriloader;1" + +/* 057b04d0-0ccf-11d2-beba-00805f8a66dc */ +#define NS_DOCUMENTLOADER_SERVICE_CID \ + { 0x057b04d0, 0x0ccf, 0x11d2,{0xbe, 0xba, 0x00, 0x80, 0x5f, 0x8a, 0x66, 0xdc}} + +#define NS_DOCUMENTLOADER_SERVICE_CONTRACTID \ +"@mozilla.org/docloaderservice;1" + #define NS_CONTENT_HANDLER_CONTRACTID "@mozilla.org/uriloader/content-handler;1" #define NS_CONTENT_HANDLER_CONTRACTID_PREFIX NS_CONTENT_HANDLER_CONTRACTID "?type=" /** * A category where content listeners can register. The name of the entry must * be the content that this listener wants to handle, the value must be a * contract ID for the listener. It will be created using createInstance (not * getService).
--- a/uriloader/base/nsDocLoader.cpp +++ b/uriloader/base/nsDocLoader.cpp @@ -1,20 +1,20 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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 "nspr.h" #include "mozilla/dom/Document.h" -#include "mozilla/Components.h" #include "mozilla/Logging.h" #include "mozilla/IntegerPrintfMacros.h" #include "nsDocLoader.h" +#include "nsCURILoader.h" #include "nsNetUtil.h" #include "nsIHttpChannel.h" #include "nsIWebNavigation.h" #include "nsIWebProgressListener2.h" #include "nsIServiceManager.h" #include "nsString.h" @@ -34,17 +34,16 @@ #include "nsISocketTransport.h" #include "nsIDocShell.h" #include "mozilla/dom/Document.h" #include "nsPresContext.h" #include "nsIAsyncVerifyRedirectCallback.h" #include "nsILoadURIDelegate.h" #include "nsIBrowserDOMWindow.h" -using namespace mozilla; using mozilla::DebugOnly; using mozilla::LogLevel; using mozilla::dom::Document; // // Log module for nsIDocumentLoader logging... // // To enable logging (see mozilla/Logging.h for full details): @@ -194,19 +193,20 @@ NS_IMETHODIMP nsDocLoader::GetInterface( already_AddRefed<nsDocLoader> nsDocLoader::GetAsDocLoader( nsISupports* aSupports) { RefPtr<nsDocLoader> ret = do_QueryObject(aSupports); return ret.forget(); } /* static */ nsresult nsDocLoader::AddDocLoaderAsChildOfRoot(nsDocLoader* aDocLoader) { + nsresult rv; nsCOMPtr<nsIDocumentLoader> docLoaderService = - components::DocLoader::Service(); - NS_ENSURE_TRUE(docLoaderService, NS_ERROR_UNEXPECTED); + do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID, &rv); + NS_ENSURE_SUCCESS(rv, rv); RefPtr<nsDocLoader> rootDocLoader = GetAsDocLoader(docLoaderService); NS_ENSURE_TRUE(rootDocLoader, NS_ERROR_UNEXPECTED); return rootDocLoader->AddChildLoader(aDocLoader); } NS_IMETHODIMP
--- a/uriloader/base/nsURILoader.cpp +++ b/uriloader/base/nsURILoader.cpp @@ -34,17 +34,17 @@ #include "nsIChildChannel.h" #include "nsString.h" #include "nsThreadUtils.h" #include "nsReadableUtils.h" #include "nsError.h" #include "nsICategoryManager.h" -#include "nsCExternalHandlerService.h" +#include "nsCExternalHandlerService.h" // contains contractids for the helper app service #include "nsIMIMEHeaderParam.h" #include "nsNetCID.h" #include "nsMimeTypes.h" #include "nsDocLoader.h" #include "mozilla/Attributes.h"
--- a/uriloader/exthandler/ContentHandlerService.h +++ b/uriloader/exthandler/ContentHandlerService.h @@ -1,20 +1,24 @@ #ifndef ContentHandlerService_h #define ContentHandlerService_h -#include "mozilla/dom/PHandlerService.h" #include "nsIHandlerService.h" #include "nsClassHashtable.h" +#include "HandlerServiceChild.h" #include "nsIMIMEInfo.h" -namespace mozilla { +#define NS_CONTENTHANDLERSERVICE_CID \ + { \ + 0xc4b6fb7c, 0xbfb1, 0x49dc, { \ + 0xa6, 0x5f, 0x03, 0x57, 0x96, 0x52, 0x4b, 0x53 \ + } \ + } -class HandlerServiceChild; - +namespace mozilla { namespace dom { class PHandlerServiceChild; class ContentHandlerService : public nsIHandlerService { public: NS_DECL_ISUPPORTS NS_DECL_NSIHANDLERSERVICE
--- a/uriloader/exthandler/android/nsExternalURLHandlerService.h +++ b/uriloader/exthandler/android/nsExternalURLHandlerService.h @@ -3,16 +3,24 @@ * 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/. */ #ifndef NSEXTERNALURLHANDLERSERVICE_H #define NSEXTERNALURLHANDLERSERVICE_H #include "nsIExternalURLHandlerService.h" +// {4BF1F8EF-D947-4BA3-9CD3-8C9A54A63A1C} +#define NS_EXTERNALURLHANDLERSERVICE_CID \ + { \ + 0x4bf1f8ef, 0xd947, 0x4ba3, { \ + 0x9c, 0xd3, 0x8c, 0x9a, 0x54, 0xa6, 0x3a, 0x1c \ + } \ + } + class nsExternalURLHandlerService final : public nsIExternalURLHandlerService { public: NS_DECL_ISUPPORTS NS_DECL_NSIEXTERNALURLHANDLERSERVICE nsExternalURLHandlerService(); private:
--- a/uriloader/exthandler/mac/nsOSHelperAppService.h +++ b/uriloader/exthandler/mac/nsOSHelperAppService.h @@ -9,20 +9,19 @@ // The OS helper app service is a subclass of nsExternalHelperAppService and is // implemented on each platform. It contains platform specific code for finding // helper applications for a given mime type in addition to launching those // applications. This is the Mac version. #include "nsExternalHelperAppService.h" #include "nsCExternalHandlerService.h" +#include "nsMIMEInfoImpl.h" #include "nsCOMPtr.h" -class nsIMimeInfo; - class nsOSHelperAppService : public nsExternalHelperAppService { public: virtual ~nsOSHelperAppService(); // override nsIExternalProtocolService methods NS_IMETHOD GetApplicationDescription(const nsACString& aScheme, nsAString& _retval) override;
--- a/uriloader/exthandler/moz.build +++ b/uriloader/exthandler/moz.build @@ -38,20 +38,16 @@ EXPORTS += [ 'nsExternalHelperAppService.h', ] if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': EXPORTS += [ '%s/%s' % (osdir, f) for f in [ 'nsExternalURLHandlerService.h', ]] -EXPORTS += [ - 'nsLocalHandlerApp.h', -] - EXPORTS.mozilla.dom += [ 'ExternalHelperAppChild.h', 'ExternalHelperAppParent.h', ] UNIFIED_SOURCES += [ 'ContentHandlerService.cpp', 'ExternalHelperAppChild.cpp',
--- a/uriloader/exthandler/nsCExternalHandlerService.idl +++ b/uriloader/exthandler/nsCExternalHandlerService.idl @@ -9,25 +9,50 @@ /* nsCExternalHelperApp implements: ------------------------- nsIExternalHelperAppService */ %{ C++ +/* A7F800E0-4306-11d4-98D0-001083010E9B */ +#define NS_EXTERNALHELPERAPPSERVICE_CID \ + { 0xa7f800e0, 0x4306, 0x11d4, { 0x98, 0xd0, 0x0, 0x10, 0x83, 0x1, 0xe, 0x9b } } + #define NS_EXTERNALHELPERAPPSERVICE_CONTRACTID \ "@mozilla.org/uriloader/external-helper-app-service;1" #define NS_HANDLERSERVICE_CONTRACTID \ "@mozilla.org/uriloader/handler-service;1" #define NS_EXTERNALPROTOCOLSERVICE_CONTRACTID \ "@mozilla.org/uriloader/external-protocol-service;1" #define NS_MIMESERVICE_CONTRACTID \ "@mozilla.org/mime;1" +#define NS_EXTERNALPROTOCOLHANDLER_CID \ +{ 0xbd6390c8, 0xfbea, 0x11d4, {0x98, 0xf6, 0x0, 0x10, 0x83, 0x1, 0xe, 0x9b } } + +/* 9fa83ce7-d0ab-4ed3-938e-afafee435670 */ +#define NS_BLOCKEDEXTERNALPROTOCOLHANDLER_CID \ +{ 0x9fa83ce7, 0xd0ab, 0x4ed3, {0x93, 0x8e, 0xaf, 0xaf, 0xee, 0x43, 0x56, 0x70 } } + +/* bc0017e3-2438-47be-a567-41db58f17627 */ +#define NS_LOCALHANDLERAPP_CID \ +{ 0xbc0017e3, 0x2438, 0x47be, {0xa5, 0x67, 0x41, 0xdb, 0x58, 0xf1, 0x76, 0x27 } } + +/*6c3c274b-4cbf-4bb5-a635-05ad2cbb6535*/ +#define NS_DBUSHANDLERAPP_CID \ +{ 0x6c3c274b, 0x4cbf, 0x4bb5, {0xa6, 0x35, 0x05, 0xad, 0x2c, 0xbb, 0x65, 0x35 } } + +#define NS_DBUSHANDLERAPP_CONTRACTID \ +"@mozilla.org/uriloader/dbus-handler-app;1" + #define NS_LOCALHANDLERAPP_CONTRACTID \ "@mozilla.org/uriloader/local-handler-app;1" +#define NS_WEBHANDLERAPP_CONTRACTID \ +"@mozilla.org/uriloader/web-handler-app;1" + %}
--- a/uriloader/exthandler/nsDBusHandlerApp.cpp +++ b/uriloader/exthandler/nsDBusHandlerApp.cpp @@ -1,29 +1,25 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim:expandtab:shiftwidth=2:tabstop=2:cin: * 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 <dbus/dbus.h> -#include "mozilla/Components.h" #include "mozilla/DBusHelpers.h" #include "nsDBusHandlerApp.h" #include "nsIURI.h" #include "nsIClassInfoImpl.h" #include "nsCOMPtr.h" #include "nsCExternalHandlerService.h" -using namespace mozilla; - // XXX why does nsMIMEInfoImpl have a threadsafe nsISupports? do we need one // here too? -NS_IMPL_CLASSINFO(nsDBusHandlerApp, nullptr, 0, - components::DBusHandlerApp::CID()) +NS_IMPL_CLASSINFO(nsDBusHandlerApp, nullptr, 0, NS_DBUSHANDLERAPP_CID) NS_IMPL_ISUPPORTS_CI(nsDBusHandlerApp, nsIDBusHandlerApp, nsIHandlerApp) //////////////////////////////////////////////////////////////////////////////// //// nsIHandlerApp NS_IMETHODIMP nsDBusHandlerApp::GetName(nsAString &aName) { aName.Assign(mName); return NS_OK;
--- a/uriloader/exthandler/unix/nsOSHelperAppService.h +++ b/uriloader/exthandler/unix/nsOSHelperAppService.h @@ -9,20 +9,20 @@ // The OS helper app service is a subclass of nsExternalHelperAppService and is // implemented on each platform. It contains platform specific code for finding // helper applications for a given mime type in addition to launching those // applications. #include "nsExternalHelperAppService.h" #include "nsCExternalHandlerService.h" +#include "nsMIMEInfoImpl.h" #include "nsCOMPtr.h" class nsILineInputStream; -class nsMIMEInfoBase; class nsOSHelperAppService : public nsExternalHelperAppService { public: virtual ~nsOSHelperAppService(); // method overrides for mime.types and mime.info look up steps already_AddRefed<nsIMIMEInfo> GetMIMEInfoFromOS(const nsACString& aMimeType, const nsACString& aFileExt,
--- a/uriloader/exthandler/win/nsOSHelperAppService.h +++ b/uriloader/exthandler/win/nsOSHelperAppService.h @@ -8,27 +8,27 @@ // The OS helper app service is a subclass of nsExternalHelperAppService and is // implemented on each platform. It contains platform specific code for finding // helper applications for a given mime type in addition to launching those // applications. #include "nsExternalHelperAppService.h" #include "nsCExternalHandlerService.h" +#include "nsMIMEInfoImpl.h" #include "nsCOMPtr.h" #include <windows.h> #ifdef _WIN32_WINNT # undef _WIN32_WINNT #endif #define _WIN32_WINNT 0x0600 #include <shlobj.h> class nsMIMEInfoWin; -class nsIMIMEInfo; class nsOSHelperAppService : public nsExternalHelperAppService { public: nsOSHelperAppService(); virtual ~nsOSHelperAppService(); // override nsIExternalProtocolService methods nsresult OSProtocolHandlerExists(const char* aProtocolScheme,
--- a/uriloader/prefetch/moz.build +++ b/uriloader/prefetch/moz.build @@ -9,16 +9,20 @@ with Files("**"): XPIDL_SOURCES += [ 'nsIOfflineCacheUpdate.idl', 'nsIPrefetchService.idl', ] XPIDL_MODULE = 'prefetch' +EXPORTS += [ + 'nsCPrefetchService.h', +] + EXPORTS.mozilla.docshell += [ 'OfflineCacheUpdateChild.h', 'OfflineCacheUpdateParent.h', ] UNIFIED_SOURCES += [ 'nsOfflineCacheUpdate.cpp', 'nsOfflineCacheUpdateService.cpp',
new file mode 100644 --- /dev/null +++ b/uriloader/prefetch/nsCPrefetchService.h @@ -0,0 +1,34 @@ +/* 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/. */ + +#ifndef nsCPrefetchService_h__ +#define nsCPrefetchService_h__ + +#include "nsIPrefetchService.h" + +/** + * nsPrefetchService : nsIPrefetchService + */ +#define NS_PREFETCHSERVICE_CONTRACTID "@mozilla.org/prefetch-service;1" +#define NS_PREFETCHSERVICE_CID \ + { /* 6b8bdffc-3394-417d-be83-a81b7c0f63bf */ \ + 0x6b8bdffc, 0x3394, 0x417d, { \ + 0xbe, 0x83, 0xa8, 0x1b, 0x7c, 0x0f, 0x63, 0xbf \ + } \ + } + +/** + * nsOfflineCacheUpdateService : nsIOfflineCacheUpdateService + */ + +#define NS_OFFLINECACHEUPDATESERVICE_CONTRACTID \ + "@mozilla.org/offlinecacheupdate-service;1" +#define NS_OFFLINECACHEUPDATESERVICE_CID \ + { /* ec06f3fc-70db-4ecd-94e0-a6e91ca44d8a */ \ + 0xec06f3fc, 0x70db, 0x4ecd, { \ + 0x94, 0xe0, 0xa6, 0xe9, 0x1c, 0xa4, 0x4d, 0x8a \ + } \ + } + +#endif // !nsCPrefetchService_h__
--- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp @@ -1,15 +1,16 @@ /* -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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 "nsOfflineCacheUpdate.h" +#include "nsCPrefetchService.h" #include "nsCURILoader.h" #include "nsIApplicationCacheContainer.h" #include "nsIApplicationCacheChannel.h" #include "nsIApplicationCacheService.h" #include "nsICachingChannel.h" #include "nsIContent.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/OfflineResourceListBinding.h"
--- a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp @@ -4,16 +4,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "OfflineCacheUpdateChild.h" #include "OfflineCacheUpdateParent.h" #include "nsXULAppAPI.h" #include "OfflineCacheUpdateGlue.h" #include "nsOfflineCacheUpdate.h" +#include "nsCPrefetchService.h" #include "nsCURILoader.h" #include "nsIApplicationCacheContainer.h" #include "nsIApplicationCacheChannel.h" #include "nsIApplicationCacheService.h" #include "nsICachingChannel.h" #include "nsIContent.h" #include "nsIDocShell.h" #include "nsIDocumentLoader.h" @@ -22,24 +23,22 @@ #include "nsIObserverService.h" #include "nsIURL.h" #include "nsIWebProgress.h" #include "nsIWebNavigation.h" #include "nsICryptoHash.h" #include "nsIPermissionManager.h" #include "nsIPrincipal.h" #include "nsNetCID.h" -#include "nsNetUtil.h" #include "nsServiceManagerUtils.h" #include "nsStreamUtils.h" #include "nsThreadUtils.h" #include "nsProxyRelease.h" #include "mozilla/Logging.h" #include "nsIAsyncVerifyRedirectCallback.h" -#include "mozilla/Components.h" #include "mozilla/Preferences.h" #include "mozilla/Attributes.h" #include "mozilla/Unused.h" #include "nsIDocShell.h" #include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeOwner.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/dom/PermissionMessageUtils.h" @@ -281,18 +280,17 @@ nsOfflineCacheUpdateService::GetInstance return do_AddRef(gOfflineCacheUpdateService); } /* static */ nsOfflineCacheUpdateService *nsOfflineCacheUpdateService::EnsureService() { if (!gOfflineCacheUpdateService) { // Make the service manager hold a long-lived reference to the service nsCOMPtr<nsIOfflineCacheUpdateService> service = - components::OfflineCacheUpdate::Service(); - Unused << service; + do_GetService(NS_OFFLINECACHEUPDATESERVICE_CONTRACTID); } return gOfflineCacheUpdateService; } nsresult nsOfflineCacheUpdateService::ScheduleUpdate( nsOfflineCacheUpdate *aUpdate) { LOG(("nsOfflineCacheUpdateService::Schedule [%p, update=%p]", this, aUpdate));
--- a/uriloader/prefetch/nsPrefetchService.cpp +++ b/uriloader/prefetch/nsPrefetchService.cpp @@ -3,27 +3,27 @@ * 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 "nsPrefetchService.h" #include "mozilla/AsyncEventDispatcher.h" #include "mozilla/Attributes.h" #include "mozilla/CORSMode.h" -#include "mozilla/Components.h" #include "mozilla/dom/ClientInfo.h" #include "mozilla/dom/HTMLLinkElement.h" #include "mozilla/dom/ServiceWorkerDescriptor.h" #include "mozilla/Preferences.h" #include "nsICacheEntry.h" #include "nsIServiceManager.h" #include "nsICategoryManager.h" #include "nsIObserverService.h" #include "nsIWebProgress.h" +#include "nsCURILoader.h" #include "nsICacheInfoChannel.h" #include "nsIHttpChannel.h" #include "nsIURL.h" #include "nsISimpleEnumerator.h" #include "nsISupportsPriority.h" #include "nsNetUtil.h" #include "nsString.h" #include "nsReadableUtils.h" @@ -476,24 +476,26 @@ void nsPrefetchService::DispatchEvent(ns } //----------------------------------------------------------------------------- // nsPrefetchService <private> //----------------------------------------------------------------------------- void nsPrefetchService::AddProgressListener() { // Register as an observer for the document loader - nsCOMPtr<nsIWebProgress> progress = components::DocLoader::Service(); + nsCOMPtr<nsIWebProgress> progress = + do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID); if (progress) progress->AddProgressListener(this, nsIWebProgress::NOTIFY_STATE_DOCUMENT); } void nsPrefetchService::RemoveProgressListener() { // Register as an observer for the document loader - nsCOMPtr<nsIWebProgress> progress = components::DocLoader::Service(); + nsCOMPtr<nsIWebProgress> progress = + do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID); if (progress) progress->RemoveProgressListener(this); } nsresult nsPrefetchService::EnqueueURI(nsIURI *aURI, nsIURI *aReferrerURI, nsINode *aSource, nsPrefetchNode **aNode) { RefPtr<nsPrefetchNode> node = new nsPrefetchNode( this, aURI, aReferrerURI, aSource, nsIContentPolicy::TYPE_OTHER, false);
--- a/uriloader/prefetch/nsPrefetchService.h +++ b/uriloader/prefetch/nsPrefetchService.h @@ -1,19 +1,19 @@ /* 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/. */ #ifndef nsPrefetchService_h__ #define nsPrefetchService_h__ +#include "nsCPrefetchService.h" #include "nsIObserver.h" #include "nsIInterfaceRequestor.h" #include "nsIChannelEventSink.h" -#include "nsIPrefetchService.h" #include "nsIRedirectResultListener.h" #include "nsIWebProgressListener.h" #include "nsIStreamListener.h" #include "nsIChannel.h" #include "nsIURI.h" #include "nsWeakReference.h" #include "nsCOMPtr.h" #include "nsAutoPtr.h"
--- a/widget/android/nsAppShell.cpp +++ b/widget/android/nsAppShell.cpp @@ -19,20 +19,21 @@ #include "nsIGeolocationProvider.h" #include "nsCacheService.h" #include "nsIDOMEventListener.h" #include "nsIDOMWakeLockListener.h" #include "nsIPowerManagerService.h" #include "nsISpeculativeConnect.h" #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" #include "mozilla/Hal.h" #include "mozilla/dom/TabChild.h" #include "mozilla/intl/OSPreferences.h" #include "mozilla/widget/ScreenManager.h" #include "prenv.h" @@ -230,17 +231,18 @@ class GeckoThreadSupport final nullptr, // aOrigin category.get(), aData ? aData->ToString().get() : nullptr); } static int64_t RunUiThreadCallback() { return RunAndroidUiTasks(); } static void ForceQuit() { - nsCOMPtr<nsIAppStartup> appStartup = components::AppStartup::Service(); + nsCOMPtr<nsIAppStartup> appStartup = + do_GetService(NS_APPSTARTUP_CONTRACTID); if (appStartup) { appStartup->Quit(nsIAppStartup::eForceQuit); } } static void Crash() { printf_stderr("Intentionally crashing...\n"); @@ -561,17 +563,18 @@ nsAppShell::Observe(nsISupports* aSubjec if (jni::IsAvailable()) { java::GeckoThread::SetState(java::GeckoThread::State::PROFILE_READY()); // Gecko on Android follows the Android app model where it never // stops until it is killed by the system or told explicitly to // 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 = components::AppStartup::Service(); + nsCOMPtr<nsIAppStartup> appStartup = + do_GetService(NS_APPSTARTUP_CONTRACTID); if (appStartup) { appStartup->EnterLastWindowClosingSurvivalArea(); } } removeObserver = true; } else if (!strcmp(aTopic, "chrome-document-loaded")) { // Set the global ready state and enable the window event dispatcher @@ -598,17 +601,18 @@ nsAppShell::Observe(nsISupports* aSubjec } removeObserver = true; } else if (!strcmp(aTopic, "quit-application-granted")) { if (jni::IsAvailable()) { // 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 = components::AppStartup::Service(); + nsCOMPtr<nsIAppStartup> appStartup = + do_GetService(NS_APPSTARTUP_CONTRACTID); if (appStartup) { appStartup->ExitLastWindowClosingSurvivalArea(); } } removeObserver = true; } else if (!strcmp(aTopic, "nsPref:changed")) { if (jni::IsAvailable()) { @@ -734,17 +738,17 @@ already_AddRefed<nsIURI> nsAppShell::Res nsCOMPtr<nsIIOService> ioServ = do_GetIOService(); nsCOMPtr<nsIURI> uri; if (NS_SUCCEEDED( ioServ->NewURI(aUriStr, nullptr, nullptr, getter_AddRefs(uri)))) { return uri.forget(); } - nsCOMPtr<nsIURIFixup> fixup = components::URIFixup::Service(); + nsCOMPtr<nsIURIFixup> fixup = do_GetService(NS_URIFIXUP_CONTRACTID); if (fixup && NS_SUCCEEDED(fixup->CreateFixupURI(aUriStr, 0, nullptr, getter_AddRefs(uri)))) { return uri.forget(); } return nullptr; } nsresult nsAppShell::AddObserver(const nsAString& aObserverKey,
--- a/widget/cocoa/nsMenuBarX.mm +++ b/widget/cocoa/nsMenuBarX.mm @@ -21,17 +21,16 @@ #include "nsIContent.h" #include "nsIWidget.h" #include "mozilla/dom/Document.h" #include "nsIAppStartup.h" #include "nsIStringBundle.h" #include "nsToolkitCompsCID.h" -#include "mozilla/Components.h" #include "mozilla/dom/Element.h" NativeMenuItemTarget* nsMenuBarX::sNativeEventTarget = nil; nsMenuBarX* nsMenuBarX::sLastGeckoMenuBarPainted = nullptr; NSMenu* sApplicationMenu = nil; BOOL sApplicationMenuIsFallback = NO; BOOL gSomeMenuBarPainted = NO; @@ -879,17 +878,17 @@ static BOOL gMenuItemsExecuteCommands = nsIContent* mostSpecificContent = sQuitItemContent; if (menuBar && menuBar->mQuitItemContent) mostSpecificContent = menuBar->mQuitItemContent; // If we have some content for quit we execute it. Otherwise we send a native app terminate // message. If you want to stop a quit from happening, provide quit content and return // the event as unhandled. if (mostSpecificContent) { nsMenuUtilsX::DispatchCommandTo(mostSpecificContent); } else { - nsCOMPtr<nsIAppStartup> appStartup = mozilla::components::AppStartup::Service(); + nsCOMPtr<nsIAppStartup> appStartup = do_GetService(NS_APPSTARTUP_CONTRACTID); if (appStartup) { appStartup->Quit(nsIAppStartup::eAttemptQuit); } } return; } // given the commandID, look it up in our hashtable and dispatch to
--- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -127,16 +127,17 @@ #include "nsISound.h" #include "SystemTimeConverter.h" #include "WinTaskbar.h" #include "WidgetUtils.h" #include "nsIWidgetListener.h" #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 #include "mozilla/TextEventDispatcherListener.h" #include "mozilla/widget/nsAutoRollup.h" #include "mozilla/widget/WinNativeEventData.h" #include "mozilla/widget/PlatformWidgetTypes.h" #include "nsStyleConsts.h"
deleted file mode 100644 --- a/xpcom/base/components.conf +++ /dev/null @@ -1,28 +0,0 @@ -# -*- 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 = [ - { - 'cid': '{cb6cdb94-e417-4601-b4a5-f991bf41453d}', - 'contract_ids': ['@mozilla.org/xpcom/debug;1'], - 'legacy_constructor': 'nsDebugImpl::Create', - 'headers': ['nsDebugImpl.h'], - 'processes': ProcessSelector.ALLOW_IN_GPU_AND_SOCKET_PROCESS, - }, - { - 'cid': '{30a04e40-38e7-11d4-8cf5-0060b0fc14a3}', - 'contract_ids': ['@mozilla.org/xpcom/memory-service;1'], - 'legacy_constructor': 'nsMemoryImpl::Create', - 'headers': ['/xpcom/base/nsMemoryImpl.h'], - 'processes': ProcessSelector.ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS, - }, - { - 'cid': '{67b3ac0c-d806-4d48-939e-6a819e6c248f}', - 'contract_ids': ['@mozilla.org/message-loop;1'], - 'legacy_constructor': 'nsMessageLoopConstructor', - 'headers': ['/xpcom/base/nsMessageLoop.h'], - }, -]
--- a/xpcom/base/moz.build +++ b/xpcom/base/moz.build @@ -40,20 +40,16 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'coco UNIFIED_SOURCES += [ 'MacHelpers.mm', 'MacStringHelpers.mm', 'nsMacPreferencesReader.mm', ] XPIDL_MODULE = 'xpcom_base' -XPCOM_MANIFESTS += [ - 'components.conf', -] - EXPORTS += [ '!ErrorList.h', '!ErrorNamesInternal.h', 'CodeAddressService.h', 'nsAgg.h', 'nsAlgorithm.h', 'nsAutoPtr.h', 'nsAutoRef.h',
--- a/xpcom/build/XPCOMInit.cpp +++ b/xpcom/build/XPCOMInit.cpp @@ -1,16 +1,14 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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 "XPCOMModule.h" - #include "base/basictypes.h" #include "mozilla/Atomics.h" #include "mozilla/Poison.h" #include "mozilla/RemoteDecoderManagerChild.h" #include "mozilla/SharedThreadPool.h" #include "mozilla/VideoDecoderManagerChild.h" #include "mozilla/XPCOM.h" @@ -24,61 +22,103 @@ #include "nsXPCOMCIDInternal.h" #include "mozilla/layers/ImageBridgeChild.h" #include "mozilla/layers/CompositorBridgeParent.h" #include "prlink.h" #include "nsCycleCollector.h" +#include "nsObserverList.h" #include "nsObserverService.h" +#include "nsScriptableInputStream.h" +#include "nsBinaryStream.h" +#include "nsStorageStream.h" +#include "nsPipe.h" +#include "nsScriptableBase64Encoder.h" +#include "nsMemoryImpl.h" #include "nsDebugImpl.h" -#include "nsSystemInfo.h" +#include "nsTraceRefcnt.h" +#include "nsArray.h" #include "nsINIParserImpl.h" +#include "nsSupportsPrimitives.h" +#include "nsConsoleService.h" #include "nsComponentManager.h" #include "nsCategoryManagerUtils.h" #include "nsIServiceManager.h" #include "nsThreadManager.h" #include "nsThreadPool.h" #include "nsTimerImpl.h" #include "TimerThread.h" #include "nsThread.h" +#include "nsProcess.h" +#include "nsEnvironment.h" #include "nsVersionComparatorImpl.h" #include "nsIFile.h" #include "nsLocalFile.h" +#if defined(XP_UNIX) +# include "nsNativeCharsetUtils.h" +#endif #include "nsDirectoryService.h" #include "nsDirectoryServiceDefs.h" #include "nsCategoryManager.h" #include "nsICategoryManager.h" #include "nsMultiplexInputStream.h" +#include "nsStringStream.h" +extern nsresult nsStringInputStreamConstructor(nsISupports*, REFNSIID, void**); + #include "nsAtomTable.h" #include "nsISupportsImpl.h" +#include "nsHashPropertyBag.h" + +#include "nsUnicharInputStream.h" +#include "nsVariant.h" + +#include "nsUUIDGenerator.h" + +#include "nsIOUtil.h" + +#include "SpecialSystemDirectory.h" + +#if defined(XP_WIN) +# include "nsWindowsRegKey.h" +#endif + +#ifdef MOZ_WIDGET_COCOA +# include "nsMacUtilsImpl.h" +# include "nsMacPreferencesReader.h" +#endif + #include "nsSystemInfo.h" #include "nsMemoryReporterManager.h" +#include "nsMemoryInfoDumper.h" +#include "nsSecurityConsoleMessage.h" #include "nsMessageLoop.h" #include "nss.h" #include "ssl.h" #include <locale.h> #include "mozilla/Services.h" #include "mozilla/Omnijar.h" #include "mozilla/ScriptPreloader.h" #include "mozilla/SystemGroup.h" #include "mozilla/Telemetry.h" #include "mozilla/BackgroundHangMonitor.h" +#include "nsChromeRegistry.h" +#include "nsChromeProtocolHandler.h" #include "mozilla/PoisonIOInterposer.h" #include "mozilla/LateWriteChecks.h" #include "mozilla/scache/StartupCache.h" #include "base/at_exit.h" #include "base/command_line.h" #include "base/message_loop.h" @@ -125,51 +165,146 @@ static BackgroundHangMonitor* sMainHangM // here rather than in nsIRegistry.h extern nsresult NS_RegistryGetFactory(nsIFactory** aFactory); extern nsresult NS_CategoryManagerGetFactory(nsIFactory**); #ifdef XP_WIN extern nsresult CreateAnonTempFileRemover(); #endif -nsresult nsThreadManagerGetSingleton(nsISupports* aOuter, const nsIID& aIID, - void** aInstancePtr) { +NS_GENERIC_FACTORY_CONSTRUCTOR(nsProcess) + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsID) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsString) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsCString) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRBool) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRUint8) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRUint16) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRUint32) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRUint64) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRTime) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsChar) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRInt16) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRInt32) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRInt64) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsFloat) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsDouble) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsInterfacePointer) + +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsConsoleService, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsBinaryOutputStream) +NS_GEN