Issue #1751 -- Remove XP_MACOSX conditionals and support files from /xpcom

This commit is contained in:
Moonchild 2021-05-03 11:35:41 +00:00 committed by roytam1
commit df94ccb22c
40 changed files with 27 additions and 2812 deletions

View file

@ -97,11 +97,7 @@ static LibHandleType
GetLibHandle(pathstr_t aDependentLib)
{
LibHandleType libHandle = dlopen(aDependentLib,
RTLD_GLOBAL | RTLD_LAZY
#ifdef XP_MACOSX
| RTLD_FIRST
#endif
);
RTLD_GLOBAL | RTLD_LAZY);
if (!libHandle) {
fprintf(stderr, "XPCOMGlueLoad error for file %s:\n%s\n", aDependentLib,
dlerror());
@ -235,22 +231,6 @@ XPCOMGlueLoad(const char* aXPCOMFile)
char xpcomDir[MAXPATHLEN];
#ifdef XP_WIN
const char* lastSlash = ns_strrpbrk(aXPCOMFile, "/\\");
#elif XP_MACOSX
// On OSX, the dependentlibs.list file lives under Contents/Resources.
// However, the actual libraries listed in dependentlibs.list live under
// Contents/MacOS. We want to read the list from Contents/Resources, then
// load the libraries from Contents/MacOS.
const char *tempSlash = strrchr(aXPCOMFile, '/');
size_t tempLen = size_t(tempSlash - aXPCOMFile);
if (tempLen > MAXPATHLEN) {
return nullptr;
}
char tempBuffer[MAXPATHLEN];
memcpy(tempBuffer, aXPCOMFile, tempLen);
tempBuffer[tempLen] = '\0';
const char *slash = strrchr(tempBuffer, '/');
tempLen = size_t(slash - tempBuffer);
const char *lastSlash = aXPCOMFile + tempLen;
#else
const char* lastSlash = strrchr(aXPCOMFile, '/');
#endif
@ -259,19 +239,11 @@ XPCOMGlueLoad(const char* aXPCOMFile)
size_t len = size_t(lastSlash - aXPCOMFile);
if (len > MAXPATHLEN - sizeof(XPCOM_FILE_PATH_SEPARATOR
#ifdef XP_MACOSX
"Resources"
XPCOM_FILE_PATH_SEPARATOR
#endif
XPCOM_DEPENDENT_LIBS_LIST)) {
return nullptr;
}
memcpy(xpcomDir, aXPCOMFile, len);
strcpy(xpcomDir + len, XPCOM_FILE_PATH_SEPARATOR
#ifdef XP_MACOSX
"Resources"
XPCOM_FILE_PATH_SEPARATOR
#endif
XPCOM_DEPENDENT_LIBS_LIST);
cursor = xpcomDir + len + 1;
} else {
@ -289,14 +261,6 @@ XPCOMGlueLoad(const char* aXPCOMFile)
return nullptr;
}
#ifdef XP_MACOSX
tempLen = size_t(cursor - xpcomDir);
if (tempLen > MAXPATHLEN - sizeof("MacOS" XPCOM_FILE_PATH_SEPARATOR) - 1) {
return nullptr;
}
strcpy(cursor, "MacOS" XPCOM_FILE_PATH_SEPARATOR);
cursor += strlen(cursor);
#endif
*cursor = '\0';
char buffer[MAXPATHLEN];