2002-04-04 22:28:17 +00:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
2000-01-04 01:53:13 +00:00
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "nscore.h"
|
|
|
|
|
|
|
|
#include "nsIComponentManager.h"
|
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2010-06-10 18:11:40 +00:00
|
|
|
#include "mozilla/ModuleUtils.h"
|
2000-01-04 01:53:13 +00:00
|
|
|
#include "nsIJARFactory.h"
|
2004-09-14 18:40:26 +00:00
|
|
|
#include "nsJARProtocolHandler.h"
|
2004-12-02 07:00:25 +00:00
|
|
|
#include "nsJARURI.h"
|
2010-06-10 18:11:40 +00:00
|
|
|
#include "nsJAR.h"
|
2002-04-04 22:28:17 +00:00
|
|
|
|
2003-03-14 18:59:51 +00:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJAR)
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsZipReaderCache)
|
2005-09-16 07:09:35 +00:00
|
|
|
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsJARProtocolHandler,
|
|
|
|
nsJARProtocolHandler::GetSingleton)
|
2004-12-02 07:00:25 +00:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJARURI)
|
2002-04-04 22:28:17 +00:00
|
|
|
|
2010-06-10 18:11:40 +00:00
|
|
|
NS_DEFINE_NAMED_CID(NS_ZIPREADER_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_ZIPREADERCACHE_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_JARPROTOCOLHANDLER_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_JARURI_CID);
|
|
|
|
|
|
|
|
static const mozilla::Module::CIDEntry kJARCIDs[] = {
|
2013-10-23 20:36:26 +00:00
|
|
|
{ &kNS_ZIPREADER_CID, false, nullptr, nsJARConstructor },
|
|
|
|
{ &kNS_ZIPREADERCACHE_CID, false, nullptr, nsZipReaderCacheConstructor },
|
|
|
|
{ &kNS_JARPROTOCOLHANDLER_CID, false, nullptr, nsJARProtocolHandlerConstructor },
|
|
|
|
{ &kNS_JARURI_CID, false, nullptr, nsJARURIConstructor },
|
|
|
|
{ nullptr }
|
2010-06-10 18:11:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const mozilla::Module::ContractIDEntry kJARContracts[] = {
|
|
|
|
{ "@mozilla.org/libjar/zip-reader;1", &kNS_ZIPREADER_CID },
|
|
|
|
{ "@mozilla.org/libjar/zip-reader-cache;1", &kNS_ZIPREADERCACHE_CID },
|
|
|
|
{ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "jar", &kNS_JARPROTOCOLHANDLER_CID },
|
2013-10-23 20:36:26 +00:00
|
|
|
{ nullptr }
|
2000-01-03 23:20:25 +00:00
|
|
|
};
|
1999-10-07 03:39:36 +00:00
|
|
|
|
2001-12-15 06:31:49 +00:00
|
|
|
// Jar module shutdown hook
|
2010-06-10 18:11:40 +00:00
|
|
|
static void nsJarShutdown()
|
2001-12-15 06:31:49 +00:00
|
|
|
{
|
2013-12-18 16:20:45 +00:00
|
|
|
// Make sure to not null out gJarHandler here, because we may have
|
|
|
|
// still-live nsJARChannels that will want to release it.
|
|
|
|
nsJARProtocolHandler *handler = gJarHandler;
|
|
|
|
NS_IF_RELEASE(handler);
|
2001-12-15 06:31:49 +00:00
|
|
|
}
|
2000-01-03 23:56:38 +00:00
|
|
|
|
2010-06-10 18:11:40 +00:00
|
|
|
static const mozilla::Module kJARModule = {
|
|
|
|
mozilla::Module::kVersion,
|
|
|
|
kJARCIDs,
|
|
|
|
kJARContracts,
|
2013-10-23 20:36:26 +00:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2010-06-10 18:11:40 +00:00
|
|
|
nsJarShutdown
|
|
|
|
};
|
|
|
|
|
|
|
|
NSMODULE_DEFN(nsJarModule) = &kJARModule;
|