From 02d06252fa6811efdb85f51d6d77f544b1abc708 Mon Sep 17 00:00:00 2001 From: Gabor Krizsanits Date: Thu, 3 Mar 2016 12:05:52 +0100 Subject: [PATCH] Bug 1248806 - Splitting out protocol handlers from nsLayoutModule. r=bholley --- dom/base/nsHostObjectProtocolHandler.cpp | 51 ++++++++++++++++++++++++ dom/base/nsHostObjectProtocolHandler.h | 16 -------- layout/build/nsLayoutModule.cpp | 17 -------- 3 files changed, 51 insertions(+), 33 deletions(-) diff --git a/dom/base/nsHostObjectProtocolHandler.cpp b/dom/base/nsHostObjectProtocolHandler.cpp index 82074572b1d0..9614bb822e92 100644 --- a/dom/base/nsHostObjectProtocolHandler.cpp +++ b/dom/base/nsHostObjectProtocolHandler.cpp @@ -10,6 +10,7 @@ #include "mozilla/dom/File.h" #include "mozilla/dom/MediaSource.h" #include "mozilla/LoadInfo.h" +#include "mozilla/ModuleUtils.h" #include "mozilla/Preferences.h" #include "nsClassHashtable.h" #include "nsError.h" @@ -743,3 +744,53 @@ NS_GetSourceForMediaSourceURI(nsIURI* aURI, mozilla::dom::MediaSource** aSource) source.forget(aSource); return NS_OK; } + +#define NS_BLOBPROTOCOLHANDLER_CID \ +{ 0xb43964aa, 0xa078, 0x44b2, \ + { 0xb0, 0x6b, 0xfd, 0x4d, 0x1b, 0x17, 0x2e, 0x66 } } + +#define NS_MEDIASTREAMPROTOCOLHANDLER_CID \ +{ 0x27d1fa24, 0x2b73, 0x4db3, \ + { 0xab, 0x48, 0xb9, 0x83, 0x83, 0x40, 0xe0, 0x81 } } + +#define NS_MEDIASOURCEPROTOCOLHANDLER_CID \ +{ 0x12ef31fc, 0xa8fb, 0x4661, \ + { 0x9a, 0x63, 0xfb, 0x61, 0x04,0x5d, 0xb8, 0x61 } } + +#define NS_FONTTABLEPROTOCOLHANDLER_CID \ +{ 0x3fc8f04e, 0xd719, 0x43ca, \ + { 0x9a, 0xd0, 0x18, 0xee, 0x32, 0x02, 0x11, 0xf2 } } + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsBlobProtocolHandler) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsMediaStreamProtocolHandler) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsMediaSourceProtocolHandler) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontTableProtocolHandler) + +NS_DEFINE_NAMED_CID(NS_BLOBPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_MEDIASTREAMPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_MEDIASOURCEPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_FONTTABLEPROTOCOLHANDLER_CID); + +static const mozilla::Module::CIDEntry kHostObjectProtocolHandlerCIDs[] = { + { &kNS_BLOBPROTOCOLHANDLER_CID, false, nullptr, nsBlobProtocolHandlerConstructor }, + { &kNS_MEDIASTREAMPROTOCOLHANDLER_CID, false, nullptr, nsMediaStreamProtocolHandlerConstructor }, + { &kNS_MEDIASOURCEPROTOCOLHANDLER_CID, false, nullptr, nsMediaSourceProtocolHandlerConstructor }, + { &kNS_FONTTABLEPROTOCOLHANDLER_CID, false, nullptr, nsFontTableProtocolHandlerConstructor }, + { nullptr } +}; + +static const mozilla::Module::ContractIDEntry kHostObjectProtocolHandlerContracts[] = { + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX BLOBURI_SCHEME, &kNS_BLOBPROTOCOLHANDLER_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX MEDIASTREAMURI_SCHEME, &kNS_MEDIASTREAMPROTOCOLHANDLER_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX MEDIASOURCEURI_SCHEME, &kNS_MEDIASOURCEPROTOCOLHANDLER_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX FONTTABLEURI_SCHEME, &kNS_FONTTABLEPROTOCOLHANDLER_CID }, + { nullptr } +}; + +static const mozilla::Module kHostObjectProtocolHandlerModule = { + mozilla::Module::kVersion, + kHostObjectProtocolHandlerCIDs, + kHostObjectProtocolHandlerContracts +}; + +NSMODULE_DEFN(HostObjectProtocolHandler) = &kHostObjectProtocolHandlerModule; diff --git a/dom/base/nsHostObjectProtocolHandler.h b/dom/base/nsHostObjectProtocolHandler.h index 909631f37e2e..d38a93a34d3d 100644 --- a/dom/base/nsHostObjectProtocolHandler.h +++ b/dom/base/nsHostObjectProtocolHandler.h @@ -136,20 +136,4 @@ NS_GetStreamForMediaStreamURI(nsIURI* aURI, mozilla::DOMMediaStream** aStream); extern nsresult NS_GetSourceForMediaSourceURI(nsIURI* aURI, mozilla::dom::MediaSource** aSource); -#define NS_BLOBPROTOCOLHANDLER_CID \ -{ 0xb43964aa, 0xa078, 0x44b2, \ - { 0xb0, 0x6b, 0xfd, 0x4d, 0x1b, 0x17, 0x2e, 0x66 } } - -#define NS_MEDIASTREAMPROTOCOLHANDLER_CID \ -{ 0x27d1fa24, 0x2b73, 0x4db3, \ - { 0xab, 0x48, 0xb9, 0x83, 0x83, 0x40, 0xe0, 0x81 } } - -#define NS_MEDIASOURCEPROTOCOLHANDLER_CID \ -{ 0x12ef31fc, 0xa8fb, 0x4661, \ - { 0x9a, 0x63, 0xfb, 0x61, 0x04,0x5d, 0xb8, 0x61 } } - -#define NS_FONTTABLEPROTOCOLHANDLER_CID \ -{ 0x3fc8f04e, 0xd719, 0x43ca, \ - { 0x9a, 0xd0, 0x18, 0xee, 0x32, 0x02, 0x11, 0xf2 } } - #endif /* nsHostObjectProtocolHandler_h */ diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index 143c746438e6..0e21d645cedc 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -68,7 +68,6 @@ #include "nsContentCreatorFunctions.h" #include "mozilla/dom/FormData.h" -#include "nsHostObjectProtocolHandler.h" #include "nsHostObjectURI.h" #include "nsGlobalWindowCommands.h" #include "nsIControllerCommandTable.h" @@ -306,10 +305,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(txNodeSetAdaptor, Init) NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMSerializer) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsXMLHttpRequest, Init) NS_GENERIC_FACTORY_CONSTRUCTOR(FormData) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsBlobProtocolHandler) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsMediaStreamProtocolHandler) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsMediaSourceProtocolHandler) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontTableProtocolHandler) NS_GENERIC_FACTORY_CONSTRUCTOR(nsHostObjectURI) NS_GENERIC_FACTORY_CONSTRUCTOR(DOMParser) NS_GENERIC_FACTORY_CONSTRUCTOR(Exception) @@ -756,10 +751,6 @@ NS_DEFINE_NAMED_CID(TRANSFORMIIX_XPATH_EVALUATOR_CID); NS_DEFINE_NAMED_CID(TRANSFORMIIX_NODESET_CID); NS_DEFINE_NAMED_CID(NS_XMLSERIALIZER_CID); NS_DEFINE_NAMED_CID(NS_FORMDATA_CID); -NS_DEFINE_NAMED_CID(NS_BLOBPROTOCOLHANDLER_CID); -NS_DEFINE_NAMED_CID(NS_MEDIASTREAMPROTOCOLHANDLER_CID); -NS_DEFINE_NAMED_CID(NS_MEDIASOURCEPROTOCOLHANDLER_CID); -NS_DEFINE_NAMED_CID(NS_FONTTABLEPROTOCOLHANDLER_CID); NS_DEFINE_NAMED_CID(NS_HOSTOBJECTURI_CID); NS_DEFINE_NAMED_CID(NS_XMLHTTPREQUEST_CID); NS_DEFINE_NAMED_CID(NS_DOMPARSER_CID); @@ -1067,10 +1058,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = { { &kTRANSFORMIIX_NODESET_CID, false, nullptr, txNodeSetAdaptorConstructor }, { &kNS_XMLSERIALIZER_CID, false, nullptr, nsDOMSerializerConstructor }, { &kNS_FORMDATA_CID, false, nullptr, FormDataConstructor }, - { &kNS_BLOBPROTOCOLHANDLER_CID, false, nullptr, nsBlobProtocolHandlerConstructor }, - { &kNS_MEDIASTREAMPROTOCOLHANDLER_CID, false, nullptr, nsMediaStreamProtocolHandlerConstructor }, - { &kNS_MEDIASOURCEPROTOCOLHANDLER_CID, false, nullptr, nsMediaSourceProtocolHandlerConstructor }, - { &kNS_FONTTABLEPROTOCOLHANDLER_CID, false, nullptr, nsFontTableProtocolHandlerConstructor }, { &kNS_HOSTOBJECTURI_CID, false, nullptr, nsHostObjectURIConstructor }, { &kNS_XMLHTTPREQUEST_CID, false, nullptr, nsXMLHttpRequestConstructor }, { &kNS_DOMPARSER_CID, false, nullptr, DOMParserConstructor }, @@ -1237,10 +1224,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = { { TRANSFORMIIX_NODESET_CONTRACTID, &kTRANSFORMIIX_NODESET_CID }, { NS_XMLSERIALIZER_CONTRACTID, &kNS_XMLSERIALIZER_CID }, { NS_FORMDATA_CONTRACTID, &kNS_FORMDATA_CID }, - { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX BLOBURI_SCHEME, &kNS_BLOBPROTOCOLHANDLER_CID }, - { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX MEDIASTREAMURI_SCHEME, &kNS_MEDIASTREAMPROTOCOLHANDLER_CID }, - { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX MEDIASOURCEURI_SCHEME, &kNS_MEDIASOURCEPROTOCOLHANDLER_CID }, - { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX FONTTABLEURI_SCHEME, &kNS_FONTTABLEPROTOCOLHANDLER_CID }, { NS_XMLHTTPREQUEST_CONTRACTID, &kNS_XMLHTTPREQUEST_CID }, { NS_DOMPARSER_CONTRACTID, &kNS_DOMPARSER_CID }, { XPC_EXCEPTION_CONTRACTID, &kNS_XPCEXCEPTION_CID },