summaryrefslogtreecommitdiffstats
path: root/modules/libjar/nsJARFactory.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /modules/libjar/nsJARFactory.cpp
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'modules/libjar/nsJARFactory.cpp')
-rw-r--r--modules/libjar/nsJARFactory.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/modules/libjar/nsJARFactory.cpp b/modules/libjar/nsJARFactory.cpp
new file mode 100644
index 000000000..01d8d73f3
--- /dev/null
+++ b/modules/libjar/nsJARFactory.cpp
@@ -0,0 +1,64 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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 <string.h>
+
+#include "nscore.h"
+
+#include "nsIComponentManager.h"
+#include "nsIServiceManager.h"
+#include "nsCOMPtr.h"
+#include "mozilla/ModuleUtils.h"
+#include "nsIJARFactory.h"
+#include "nsJARProtocolHandler.h"
+#include "nsJARURI.h"
+#include "nsJAR.h"
+
+NS_GENERIC_FACTORY_CONSTRUCTOR(nsJAR)
+NS_GENERIC_FACTORY_CONSTRUCTOR(nsZipReaderCache)
+NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsJARProtocolHandler,
+ nsJARProtocolHandler::GetSingleton)
+NS_GENERIC_FACTORY_CONSTRUCTOR(nsJARURI)
+
+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[] = {
+ { &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 }
+};
+
+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 },
+ { nullptr }
+};
+
+// Jar module shutdown hook
+static void nsJarShutdown()
+{
+ // 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);
+}
+
+static const mozilla::Module kJARModule = {
+ mozilla::Module::kVersion,
+ kJARCIDs,
+ kJARContracts,
+ nullptr,
+ nullptr,
+ nullptr,
+ nsJarShutdown
+};
+
+NSMODULE_DEFN(nsJarModule) = &kJARModule;