Issue #1829 - Revert "Issue #1751"

This commit is contained in:
Brian Smith 2022-04-26 11:34:08 -05:00 committed by roytam1
commit 13fcc4a046
949 changed files with 95662 additions and 444 deletions

View file

@ -131,6 +131,17 @@ SandboxDump(JSContext* cx, unsigned argc, Value* vp)
__android_log_write(ANDROID_LOG_INFO, "GeckoDump", cstr);
#endif
#if defined(XP_MACOSX)
// Be nice and convert all \r to \n.
char* c = cstr;
char* cEnd = cstr + strlen(cstr);
while (c < cEnd) {
if (*c == '\r')
*c = '\n';
c++;
}
#endif
fputs(cstr, stdout);
fflush(stdout);
args.rval().setBoolean(true);

View file

@ -3209,7 +3209,12 @@ XPCJSContext::Initialize()
// the web to base this decision primarily on the default stack size that the
// underlying platform makes available, but that seems to be what we do. :-(
#if defined(MOZ_ASAN)
#if defined(XP_MACOSX) || defined(DARWIN)
// MacOS has a gargantuan default stack size of 8MB. Go wild with 7MB,
// and give trusted script 180k extra. The stack is huge on mac anyway.
const size_t kStackQuota = 7 * 1024 * 1024;
const size_t kTrustedScriptBuffer = 180 * 1024;
#elif defined(MOZ_ASAN)
// ASan requires more stack space due to red-zones, so give it double the
// default (1MB on 32-bit, 2MB on 64-bit). ASAN stack frame measurements
// were not taken at the time of this writing, so we hazard a guess that

View file

@ -1283,6 +1283,22 @@ XRE_XPCShellMain(int argc, char** argv, char** envp)
argc -= 2;
argv += 2;
} else {
#ifdef XP_MACOSX
// On OSX, the GreD needs to point to Contents/Resources in the .app
// bundle. Libraries will be loaded at a relative path to GreD, i.e.
// ../MacOS.
nsCOMPtr<nsIFile> tmpDir;
XRE_GetFileFromPath(argv[0], getter_AddRefs(greDir));
greDir->GetParent(getter_AddRefs(tmpDir));
tmpDir->Clone(getter_AddRefs(greDir));
tmpDir->SetNativeLeafName(NS_LITERAL_CSTRING("Resources"));
bool dirExists = false;
tmpDir->Exists(&dirExists);
if (dirExists) {
greDir = tmpDir.forget();
}
dirprovider.SetGREDirs(greDir);
#else
nsAutoString workingDir;
if (!GetCurrentWorkingDirectory(workingDir)) {
printf("GetCurrentWorkingDirectory failed.\n");
@ -1293,6 +1309,7 @@ XRE_XPCShellMain(int argc, char** argv, char** envp)
printf("NS_NewLocalFile failed.\n");
return 1;
}
#endif
}
if (argc > 1 && !strcmp(argv[1], "-a")) {
@ -1547,6 +1564,13 @@ XPCShellDirProvider::SetGREDirs(nsIFile* greDir)
{
mGREDir = greDir;
mGREDir->Clone(getter_AddRefs(mGREBinDir));
#ifdef XP_MACOSX
nsAutoCString leafName;
mGREDir->GetNativeLeafName(leafName);
if (leafName.Equals("Resources")) {
mGREBinDir->SetNativeLeafName(NS_LITERAL_CSTRING("MacOS"));
}
#endif
}
void