summaryrefslogtreecommitdiffstats
path: root/xpcom/build/FrozenFunctions.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 /xpcom/build/FrozenFunctions.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 'xpcom/build/FrozenFunctions.cpp')
-rw-r--r--xpcom/build/FrozenFunctions.cpp138
1 files changed, 138 insertions, 0 deletions
diff --git a/xpcom/build/FrozenFunctions.cpp b/xpcom/build/FrozenFunctions.cpp
new file mode 100644
index 000000000..8a957ca45
--- /dev/null
+++ b/xpcom/build/FrozenFunctions.cpp
@@ -0,0 +1,138 @@
+/* -*- 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 "nsXPCOM.h"
+#include "nsXPCOMPrivate.h"
+#include "nsXPCOMStrings.h"
+#include "xptcall.h"
+
+#include <string.h>
+
+/**
+ * Private Method to register an exit routine. This method
+ * used to allow you to setup a callback that will be called from
+ * the NS_ShutdownXPCOM function after all services and
+ * components have gone away. It was fatally flawed in that the component
+ * DLL could be released before the exit function was called; it is now a
+ * stub implementation that does nothing.
+ */
+XPCOM_API(nsresult)
+NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine aExitRoutine, uint32_t aPriority);
+
+XPCOM_API(nsresult)
+NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine aExitRoutine);
+
+static const XPCOMFunctions kFrozenFunctions = {
+ XPCOM_GLUE_VERSION,
+ sizeof(XPCOMFunctions),
+ &NS_InitXPCOM2,
+ &NS_ShutdownXPCOM,
+ &NS_GetServiceManager,
+ &NS_GetComponentManager,
+ &NS_GetComponentRegistrar,
+ &NS_GetMemoryManager,
+ &NS_NewLocalFile,
+ &NS_NewNativeLocalFile,
+ &NS_RegisterXPCOMExitRoutine,
+ &NS_UnregisterXPCOMExitRoutine,
+
+ // these functions were added post 1.4
+ &NS_GetDebug,
+ nullptr,
+
+ // these functions were added post 1.6
+ &NS_StringContainerInit,
+ &NS_StringContainerFinish,
+ &NS_StringGetData,
+ &NS_StringSetData,
+ &NS_StringSetDataRange,
+ &NS_StringCopy,
+ &NS_CStringContainerInit,
+ &NS_CStringContainerFinish,
+ &NS_CStringGetData,
+ &NS_CStringSetData,
+ &NS_CStringSetDataRange,
+ &NS_CStringCopy,
+ &NS_CStringToUTF16,
+ &NS_UTF16ToCString,
+ &NS_StringCloneData,
+ &NS_CStringCloneData,
+
+ // these functions were added post 1.7 (post Firefox 1.0)
+ &moz_xmalloc,
+ &moz_xrealloc,
+ &free,
+ &NS_StringContainerInit2,
+ &NS_CStringContainerInit2,
+ &NS_StringGetMutableData,
+ &NS_CStringGetMutableData,
+ nullptr,
+
+ // these functions were added post 1.8
+ &NS_DebugBreak,
+ &NS_LogInit,
+ &NS_LogTerm,
+ &NS_LogAddRef,
+ &NS_LogRelease,
+ &NS_LogCtor,
+ &NS_LogDtor,
+ &NS_LogCOMPtrAddRef,
+ &NS_LogCOMPtrRelease,
+ &NS_GetXPTCallStub,
+ &NS_DestroyXPTCallStub,
+ &NS_InvokeByIndex,
+ nullptr,
+ nullptr,
+ &NS_StringSetIsVoid,
+ &NS_StringGetIsVoid,
+ &NS_CStringSetIsVoid,
+ &NS_CStringGetIsVoid,
+
+ // these functions were added post 1.9, but then made obsolete
+ nullptr,
+ nullptr,
+
+ &NS_CycleCollectorSuspect3,
+};
+
+EXPORT_XPCOM_API(nsresult)
+NS_GetFrozenFunctions(XPCOMFunctions* aFunctions, const char* /* aLibraryPath */)
+{
+ if (!aFunctions) {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ if (aFunctions->version != XPCOM_GLUE_VERSION) {
+ return NS_ERROR_FAILURE;
+ }
+
+ uint32_t size = aFunctions->size;
+ if (size > sizeof(XPCOMFunctions)) {
+ size = sizeof(XPCOMFunctions);
+ }
+
+ size -= offsetof(XPCOMFunctions, init);
+
+ memcpy(&aFunctions->init, &kFrozenFunctions.init, size);
+
+ return NS_OK;
+}
+
+/*
+ * Stubs for nsXPCOMPrivate.h
+ */
+
+EXPORT_XPCOM_API(nsresult)
+NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine aExitRoutine, uint32_t aPriority)
+{
+ return NS_OK;
+}
+
+EXPORT_XPCOM_API(nsresult)
+NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine aExitRoutine)
+{
+ return NS_OK;
+}