1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
10 #include "nsIComponentManager.h"
11 #include "nsIServiceManager.h"
13 #include "mozilla/ModuleUtils.h"
14 #include "nsIJARFactory.h"
15 #include "nsJARProtocolHandler.h"
19 NS_GENERIC_FACTORY_CONSTRUCTOR(nsJAR
)
20 NS_GENERIC_FACTORY_CONSTRUCTOR(nsZipReaderCache
)
21 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsJARProtocolHandler
,
22 nsJARProtocolHandler::GetSingleton
)
23 NS_GENERIC_FACTORY_CONSTRUCTOR(nsJARURI
)
25 NS_DEFINE_NAMED_CID(NS_ZIPREADER_CID
);
26 NS_DEFINE_NAMED_CID(NS_ZIPREADERCACHE_CID
);
27 NS_DEFINE_NAMED_CID(NS_JARPROTOCOLHANDLER_CID
);
28 NS_DEFINE_NAMED_CID(NS_JARURI_CID
);
30 static const mozilla::Module::CIDEntry kJARCIDs
[] = {
31 { &kNS_ZIPREADER_CID
, false, nullptr, nsJARConstructor
},
32 { &kNS_ZIPREADERCACHE_CID
, false, nullptr, nsZipReaderCacheConstructor
},
33 { &kNS_JARPROTOCOLHANDLER_CID
, false, nullptr, nsJARProtocolHandlerConstructor
},
34 { &kNS_JARURI_CID
, false, nullptr, nsJARURIConstructor
},
38 static const mozilla::Module::ContractIDEntry kJARContracts
[] = {
39 { "@mozilla.org/libjar/zip-reader;1", &kNS_ZIPREADER_CID
},
40 { "@mozilla.org/libjar/zip-reader-cache;1", &kNS_ZIPREADERCACHE_CID
},
41 { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX
"jar", &kNS_JARPROTOCOLHANDLER_CID
},
45 // Jar module shutdown hook
46 static void nsJarShutdown()
48 // Make sure to not null out gJarHandler here, because we may have
49 // still-live nsJARChannels that will want to release it.
50 nsJARProtocolHandler
*handler
= gJarHandler
;
51 NS_IF_RELEASE(handler
);
54 static const mozilla::Module kJARModule
= {
55 mozilla::Module::kVersion
,
64 NSMODULE_DEFN(nsJarModule
) = &kJARModule
;