Bug 1306329 part F - Stop exporting XPCOM and XUL symbols, r?glandium
MozReview-Commit-ID: GepG28oB2ow
--- a/media/webrtc/signaling/fuzztest/sdp_file_parser.cpp
+++ b/media/webrtc/signaling/fuzztest/sdp_file_parser.cpp
@@ -21,25 +21,23 @@ void CSFLog(CSFLogLevel priority, const
va_start(ap, format);
printf("%s\n:", tag);
vprintf(format, ap);
va_end(ap);
}
-extern "C" {
void NS_DebugBreak(uint32_t aSeverity,
const char* aStr, const char* aExpr,
const char* aFile, int32_t aLine)
{
fprintf(stderr, "NS_DebugBreak: %u %s %s %s %u", aSeverity, aStr, aExpr,
aFile, aLine);
}
-} // end extern "C".
namespace mozilla {
enum class LogLevel {
};
namespace detail {
--- a/xpcom/base/nscore.h
+++ b/xpcom/base/nscore.h
@@ -171,33 +171,21 @@
#define NS_IMETHODIMP NS_IMETHODIMP_(nsresult)
#define NS_METHOD NS_METHOD_(nsresult)
#define NS_CALLBACK(_name) NS_CALLBACK_(nsresult, _name)
/**
* Import/Export macros for XPCOM APIs
*/
-#ifdef __cplusplus
-#define NS_EXTERN_C extern "C"
-#else
-#define NS_EXTERN_C
-#endif
+#define EXPORT_XPCOM_API(type) type
+#define IMPORT_XPCOM_API(type) type
+#define GLUE_XPCOM_API(type) type
-#define EXPORT_XPCOM_API(type) NS_EXTERN_C NS_EXPORT type NS_FROZENCALL
-#define IMPORT_XPCOM_API(type) NS_EXTERN_C NS_IMPORT type NS_FROZENCALL
-#define GLUE_XPCOM_API(type) NS_EXTERN_C NS_HIDDEN_(type) NS_FROZENCALL
-
-#ifdef IMPL_LIBXUL
-#define XPCOM_API(type) EXPORT_XPCOM_API(type)
-#elif defined(XPCOM_GLUE)
-#define XPCOM_API(type) GLUE_XPCOM_API(type)
-#else
-#define XPCOM_API(type) IMPORT_XPCOM_API(type)
-#endif
+#define XPCOM_API(type) type
#ifdef MOZILLA_INTERNAL_API
/*
The frozen string API has different definitions of nsAC?String
classes than the internal API. On systems that explicitly declare
dllexport symbols this is not a problem, but on ELF systems
internal symbols can accidentally "shine through"; we rename the
internal classes to avoid symbol conflicts.
deleted file mode 100644
--- a/xpcom/build/FrozenFunctions.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/* -*- 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;
-}
--- a/xpcom/build/moz.build
+++ b/xpcom/build/moz.build
@@ -45,17 +45,16 @@ else:
SOURCES += ['PoisonIOInterposerStub.cpp']
include('../glue/objs.mozbuild')
UNIFIED_SOURCES += xpcom_gluens_src_cppsrcs
UNIFIED_SOURCES += xpcom_glue_src_cppsrcs
UNIFIED_SOURCES += [
- 'FrozenFunctions.cpp',
'IOInterposer.cpp',
'LateWriteChecks.cpp',
'MainThreadIOLogger.cpp',
'nsXPCOMStrings.cpp',
'Services.cpp',
'XPCOMInit.cpp',
]
--- a/xpcom/build/nsXPCOMPrivate.h
+++ b/xpcom/build/nsXPCOMPrivate.h
@@ -4,207 +4,30 @@
* 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/. */
#ifndef nsXPCOMPrivate_h__
#define nsXPCOMPrivate_h__
#include "nscore.h"
#include "nsXPCOM.h"
-#include "nsXPCOMStrings.h"
#include "xptcall.h"
-class nsStringContainer;
-class nsCStringContainer;
-class nsPurpleBufferEntry;
-
/**
* During this shutdown notification all threads which run XPCOM code must
* be joined.
*/
#define NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID "xpcom-shutdown-threads"
/**
* During this shutdown notification all module loaders must unload XPCOM
* modules.
*/
#define NS_XPCOM_SHUTDOWN_LOADERS_OBSERVER_ID "xpcom-shutdown-loaders"
-// PUBLIC
-typedef nsresult (*InitFunc)(nsIServiceManager** aResult,
- nsIFile* aBinDirectory,
- nsIDirectoryServiceProvider* aAppFileLocationProvider);
-typedef nsresult (*ShutdownFunc)(nsIServiceManager* aServMgr);
-typedef nsresult (*GetServiceManagerFunc)(nsIServiceManager** aResult);
-typedef nsresult (*GetComponentManagerFunc)(nsIComponentManager** aResult);
-typedef nsresult (*GetComponentRegistrarFunc)(nsIComponentRegistrar** aResult);
-typedef nsresult (*GetMemoryManagerFunc)(nsIMemory** aResult);
-typedef nsresult (*NewLocalFileFunc)(const nsAString& aPath,
- bool aFollowLinks, nsIFile** aResult);
-typedef nsresult (*NewNativeLocalFileFunc)(const nsACString& aPath,
- bool aFollowLinks,
- nsIFile** aResult);
-
-typedef nsresult (*GetDebugFunc)(nsIDebug2** aResult);
-
-typedef nsresult (*StringContainerInitFunc)(nsStringContainer&);
-typedef nsresult (*StringContainerInit2Func)(nsStringContainer&,
- const char16_t*,
- uint32_t, uint32_t);
-typedef void (*StringContainerFinishFunc)(nsStringContainer&);
-typedef uint32_t (*StringGetDataFunc)(const nsAString&, const char16_t**,
- bool*);
-typedef uint32_t (*StringGetMutableDataFunc)(nsAString&, uint32_t,
- char16_t**);
-typedef char16_t* (*StringCloneDataFunc)(const nsAString&);
-typedef nsresult (*StringSetDataFunc)(nsAString&, const char16_t*, uint32_t);
-typedef nsresult (*StringSetDataRangeFunc)(nsAString&, uint32_t, uint32_t,
- const char16_t*, uint32_t);
-typedef nsresult (*StringCopyFunc)(nsAString&, const nsAString&);
-typedef void (*StringSetIsVoidFunc)(nsAString&, const bool);
-typedef bool (*StringGetIsVoidFunc)(const nsAString&);
-
-typedef nsresult (*CStringContainerInitFunc)(nsCStringContainer&);
-typedef nsresult (*CStringContainerInit2Func)(nsCStringContainer&,
- const char*,
- uint32_t, uint32_t);
-typedef void (*CStringContainerFinishFunc)(nsCStringContainer&);
-typedef uint32_t (*CStringGetDataFunc)(const nsACString&, const char**,
- bool*);
-typedef uint32_t (*CStringGetMutableDataFunc)(nsACString&, uint32_t, char**);
-typedef char* (*CStringCloneDataFunc)(const nsACString&);
-typedef nsresult (*CStringSetDataFunc)(nsACString&, const char*, uint32_t);
-typedef nsresult (*CStringSetDataRangeFunc)(nsACString&, uint32_t, uint32_t,
- const char*, uint32_t);
-typedef nsresult (*CStringCopyFunc)(nsACString&, const nsACString&);
-typedef void (*CStringSetIsVoidFunc)(nsACString&, const bool);
-typedef bool (*CStringGetIsVoidFunc)(const nsACString&);
-
-typedef nsresult (*CStringToUTF16)(const nsACString&, nsCStringEncoding,
- nsAString&);
-typedef nsresult (*UTF16ToCString)(const nsAString&, nsCStringEncoding,
- nsACString&);
-
-typedef void* (*AllocFunc)(size_t aSize);
-typedef void* (*ReallocFunc)(void* aPtr, size_t aSize);
-typedef void (*FreeFunc)(void* aPtr);
-
-typedef void (*DebugBreakFunc)(uint32_t aSeverity,
- const char* aStr, const char* aExpr,
- const char* aFile, int32_t aLine);
-
-typedef void (*xpcomVoidFunc)();
-typedef void (*LogAddRefFunc)(void*, nsrefcnt, const char*, uint32_t);
-typedef void (*LogReleaseFunc)(void*, nsrefcnt, const char*);
-typedef void (*LogCtorFunc)(void*, const char*, uint32_t);
-typedef void (*LogCOMPtrFunc)(void*, nsISupports*);
-
-typedef nsresult (*GetXPTCallStubFunc)(REFNSIID, nsIXPTCProxy*,
- nsISomeInterface**);
-typedef void (*DestroyXPTCallStubFunc)(nsISomeInterface*);
-typedef nsresult (*InvokeByIndexFunc)(nsISupports*, uint32_t, uint32_t,
- nsXPTCVariant*);
-typedef bool (*CycleCollectorFunc)(nsISupports*);
-typedef nsPurpleBufferEntry*
- (*CycleCollectorSuspect2Func)(void*,
- nsCycleCollectionParticipant*);
-typedef bool (*CycleCollectorForget2Func)(nsPurpleBufferEntry*);
-typedef void (*CycleCollectorSuspect3Func)(void*,
- nsCycleCollectionParticipant*,
- nsCycleCollectingAutoRefCnt*,
- bool*);
-// PRIVATE AND DEPRECATED
-typedef NS_CALLBACK(XPCOMExitRoutine)(void);
-
-typedef nsresult (*RegisterXPCOMExitRoutineFunc)(XPCOMExitRoutine aExitRoutine,
- uint32_t aPriority);
-typedef nsresult (*UnregisterXPCOMExitRoutineFunc)(XPCOMExitRoutine aExitRoutine);
-
-typedef struct XPCOMFunctions
-{
- uint32_t version;
- uint32_t size;
-
- InitFunc init;
- ShutdownFunc shutdown;
- GetServiceManagerFunc getServiceManager;
- GetComponentManagerFunc getComponentManager;
- GetComponentRegistrarFunc getComponentRegistrar;
- GetMemoryManagerFunc getMemoryManager;
- NewLocalFileFunc newLocalFile;
- NewNativeLocalFileFunc newNativeLocalFile;
-
- RegisterXPCOMExitRoutineFunc registerExitRoutine;
- UnregisterXPCOMExitRoutineFunc unregisterExitRoutine;
-
- // Added for Mozilla 1.5
- GetDebugFunc getDebug;
- void* getTraceRefcnt;
-
- // Added for Mozilla 1.7
- StringContainerInitFunc stringContainerInit;
- StringContainerFinishFunc stringContainerFinish;
- StringGetDataFunc stringGetData;
- StringSetDataFunc stringSetData;
- StringSetDataRangeFunc stringSetDataRange;
- StringCopyFunc stringCopy;
- CStringContainerInitFunc cstringContainerInit;
- CStringContainerFinishFunc cstringContainerFinish;
- CStringGetDataFunc cstringGetData;
- CStringSetDataFunc cstringSetData;
- CStringSetDataRangeFunc cstringSetDataRange;
- CStringCopyFunc cstringCopy;
- CStringToUTF16 cstringToUTF16;
- UTF16ToCString utf16ToCString;
- StringCloneDataFunc stringCloneData;
- CStringCloneDataFunc cstringCloneData;
-
- // Added for Mozilla 1.8
- AllocFunc allocFunc;
- ReallocFunc reallocFunc;
- FreeFunc freeFunc;
- StringContainerInit2Func stringContainerInit2;
- CStringContainerInit2Func cstringContainerInit2;
- StringGetMutableDataFunc stringGetMutableData;
- CStringGetMutableDataFunc cstringGetMutableData;
- void* init3; // obsolete
-
- // Added for Mozilla 1.9
- DebugBreakFunc debugBreakFunc;
- xpcomVoidFunc logInitFunc;
- xpcomVoidFunc logTermFunc;
- LogAddRefFunc logAddRefFunc;
- LogReleaseFunc logReleaseFunc;
- LogCtorFunc logCtorFunc;
- LogCtorFunc logDtorFunc;
- LogCOMPtrFunc logCOMPtrAddRefFunc;
- LogCOMPtrFunc logCOMPtrReleaseFunc;
- GetXPTCallStubFunc getXPTCallStubFunc;
- DestroyXPTCallStubFunc destroyXPTCallStubFunc;
- InvokeByIndexFunc invokeByIndexFunc;
- CycleCollectorFunc cycleSuspectFunc; // obsolete: use cycleSuspect3Func
- CycleCollectorFunc cycleForgetFunc; // obsolete
- StringSetIsVoidFunc stringSetIsVoid;
- StringGetIsVoidFunc stringGetIsVoid;
- CStringSetIsVoidFunc cstringSetIsVoid;
- CStringGetIsVoidFunc cstringGetIsVoid;
-
- // Added for Mozilla 1.9.1
- CycleCollectorSuspect2Func cycleSuspect2Func; // obsolete: use cycleSuspect3Func
- CycleCollectorForget2Func cycleForget2Func; // obsolete
-
- CycleCollectorSuspect3Func cycleSuspect3Func;
-
-} XPCOMFunctions;
-
-typedef nsresult (*GetFrozenFunctionsFunc)(XPCOMFunctions* aEntryPoints,
- const char* aLibraryPath);
-XPCOM_API(nsresult) NS_GetFrozenFunctions(XPCOMFunctions* aEntryPoints,
- const char* aLibraryPath);
-
namespace mozilla {
/**
* Shutdown XPCOM. You must call this method after you are finished
* using xpcom.
*
* @param aServMgr The service manager which was returned by NS_InitXPCOM.
@@ -222,20 +45,16 @@ void SetICUMemoryFunctions();
/**
* C++ namespaced version of NS_LogTerm.
*/
void LogTerm();
} // namespace mozilla
-// think hard before changing this
-#define XPCOM_GLUE_VERSION 1
-
-
/* XPCOM Specific Defines
*
* XPCOM_DLL - name of the loadable xpcom library on disk.
* XUL_DLL - name of the loadable XUL library on disk
* XPCOM_SEARCH_KEY - name of the environment variable that can be
* modified to include additional search paths.
* GRE_CONF_NAME - Name of the GRE Configuration file
*/
--- a/xpcom/build/xrecore.h
+++ b/xpcom/build/xrecore.h
@@ -7,19 +7,11 @@
#ifndef xrecore_h__
#define xrecore_h__
#include "nscore.h"
/**
* Import/export macros for libXUL APIs.
*/
-#ifdef XPCOM_GLUE
-#define XRE_API(type, name, params) \
- typedef type (NS_FROZENCALL * name##Type) params; \
- extern name##Type name NS_HIDDEN;
-#elif defined(IMPL_LIBXUL)
-#define XRE_API(type, name, params) EXPORT_XPCOM_API(type) name params;
-#else
-#define XRE_API(type, name, params) IMPORT_XPCOM_API(type) name params;
-#endif
+#define XRE_API(type, name, params) type name params;
#endif // xrecore_h__
--- a/xpcom/glue/standalone/moz.build
+++ b/xpcom/glue/standalone/moz.build
@@ -4,22 +4,18 @@
# 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/.
# On win we build two glue libs - glue linked to crt dlls here and in staticruntime we build
# a statically linked glue lib.
if CONFIG['OS_ARCH'] == 'WINNT':
DIRS += ['staticruntime']
-include('../objs.mozbuild')
-
-SOURCES += xpcom_glue_src_cppsrcs
-
SOURCES += [
- '../nsStringAPI.cpp',
+ '../FileUtils.cpp',
'nsXPCOMGlue.cpp',
]
Library('xpcomglue')
EXPORTS += [
'nsXPCOMGlue.h',
]
@@ -33,26 +29,18 @@ if CONFIG['_MSC_VER']:
# Don't include directives about which CRT to use
CFLAGS += ['-Zl']
CXXFLAGS += ['-Zl']
DEFINES['XPCOM_GLUE'] = True
LOCAL_INCLUDES += [
'../../build',
- '../../threads',
]
# Don't use STL wrappers here (i.e. wrapped <new>); they require mozalloc
DISABLE_STL_WRAPPING = True
-# Include fallible for third party code using the xpcom glue
-USE_LIBS += [
- 'fallible',
-]
-
# Force to build a static library only
NO_EXPAND_LIBS = True
-DIST_INSTALL = True
-
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
CXXFLAGS += CONFIG['GLIB_CFLAGS']
--- a/xpcom/reflect/xptcall/xptcall.h
+++ b/xpcom/reflect/xptcall/xptcall.h
@@ -181,13 +181,14 @@ XPCOM_API(void)
NS_DestroyXPTCallStub(nsISomeInterface* aStub);
/**
* Measures the size of an XPTCall stub previously created with NS_GetXPTCallStub.
*/
XPCOM_API(size_t)
NS_SizeOfIncludingThisXPTCallStub(const nsISomeInterface* aStub, mozilla::MallocSizeOf aMallocSizeOf);
-XPCOM_API(nsresult)
+// this is extern "C" because on some platforms it is implemented in assembly
+extern "C" nsresult
NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
uint32_t paramCount, nsXPTCVariant* params);
#endif /* xptcall_h___ */