summaryrefslogtreecommitdiffstats
path: root/toolkit/xre
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/xre')
-rw-r--r--toolkit/xre/nsAppRunner.cpp17
-rw-r--r--toolkit/xre/nsSigHandlers.cpp56
-rw-r--r--toolkit/xre/nsUpdateDriver.cpp31
3 files changed, 77 insertions, 27 deletions
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
index 5a51fd3e7..035d35a9d 100644
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -2173,9 +2173,9 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
return ShowProfileManager(aProfileSvc, aNative);
}
-#ifndef MOZ_DEV_EDITION
- // If the only existing profile is the dev-edition-profile and this is not
- // Developer Edition, then no valid profiles were found.
+ // Dev edition leftovers:
+ // If the only existing profile is the dev-edition-profile,
+ // then no valid profiles were found.
if (count == 1) {
nsCOMPtr<nsIToolkitProfile> deProfile;
// GetSelectedProfile will auto-select the only profile if there's just one
@@ -2186,7 +2186,6 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
count = 0;
}
}
-#endif
if (!count) {
gDoMigration = true;
@@ -2195,25 +2194,15 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
// create a default profile
nsCOMPtr<nsIToolkitProfile> profile;
nsresult rv = aProfileSvc->CreateProfile(nullptr, // choose a default dir for us
-#ifdef MOZ_DEV_EDITION
- NS_LITERAL_CSTRING("dev-edition-default"),
-#else
NS_LITERAL_CSTRING("default"),
-#endif
getter_AddRefs(profile));
if (NS_SUCCEEDED(rv)) {
-#ifndef MOZ_DEV_EDITION
aProfileSvc->SetDefaultProfile(profile);
-#endif
aProfileSvc->Flush();
rv = profile->Lock(nullptr, aResult);
if (NS_SUCCEEDED(rv)) {
if (aProfileName)
-#ifdef MOZ_DEV_EDITION
- aProfileName->AssignLiteral("dev-edition-default");
-#else
aProfileName->AssignLiteral("default");
-#endif
return NS_OK;
}
}
diff --git a/toolkit/xre/nsSigHandlers.cpp b/toolkit/xre/nsSigHandlers.cpp
index 454882c1b..660af4522 100644
--- a/toolkit/xre/nsSigHandlers.cpp
+++ b/toolkit/xre/nsSigHandlers.cpp
@@ -32,6 +32,11 @@
#endif
#endif
+#ifdef XP_SOLARIS
+#include <sys/resource.h>
+#include <ucontext.h>
+#endif
+
static const char* gProgname = "huh?";
// Note: some tests manipulate this value.
@@ -193,6 +198,32 @@ static void fpehandler(int signum, siginfo_t *si, void *context)
*mxcsr &= ~SSE_STATUS_FLAGS; /* clear all pending SSE exceptions */
#endif
#endif
+#ifdef XP_SOLARIS
+ ucontext_t *uc = (ucontext_t *)context;
+
+#if defined(__i386)
+ uint32_t *cw = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.state[0];
+ *cw |= FPU_EXCEPTION_MASK;
+
+ uint32_t *sw = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.state[1];
+ *sw &= ~FPU_STATUS_FLAGS;
+
+ /* address of the instruction that caused the exception */
+ uint32_t *ip = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.state[3];
+ uc->uc_mcontext.gregs[REG_PC] = *ip;
+#endif
+#if defined(__amd64__)
+ uint16_t *cw = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.cw;
+ *cw |= FPU_EXCEPTION_MASK;
+
+ uint16_t *sw = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.sw;
+ *sw &= ~FPU_STATUS_FLAGS;
+
+ uint32_t *mxcsr = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.mxcsr;
+ *mxcsr |= SSE_EXCEPTION_MASK; /* disable all SSE exceptions */
+ *mxcsr &= ~SSE_STATUS_FLAGS; /* clear all pending SSE exceptions */
+#endif
+#endif
}
#endif
@@ -255,6 +286,31 @@ void InstallSignalHandlers(const char *aProgname)
}
#endif
+#ifdef XP_SOLARIS
+#define NOFILES 512
+
+ // Boost Solaris file descriptors
+ {
+ struct rlimit rl;
+
+ if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
+
+ if (rl.rlim_cur < NOFILES) {
+ rl.rlim_cur = NOFILES;
+
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
+ perror("setrlimit(RLIMIT_NOFILE)");
+ fprintf(stderr, "Cannot exceed hard limit for open files");
+ }
+#if defined(DEBUG)
+ if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
+ printf("File descriptors set to %d\n", rl.rlim_cur);
+#endif //DEBUG
+ }
+ }
+#endif //XP_SOLARIS
+
+
#if defined(MOZ_WIDGET_GTK) && (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6))
const char *assertString = PR_GetEnv("XPCOM_DEBUG_BREAK");
if (assertString &&
diff --git a/toolkit/xre/nsUpdateDriver.cpp b/toolkit/xre/nsUpdateDriver.cpp
index aac856d6e..be11fb158 100644
--- a/toolkit/xre/nsUpdateDriver.cpp
+++ b/toolkit/xre/nsUpdateDriver.cpp
@@ -75,21 +75,26 @@ GetUpdateLog()
#endif
static nsresult
-GetCurrentWorkingDir(char *buf, size_t size)
+GetCurrentWorkingDir(nsACString& aOutPath)
{
// Cannot use NS_GetSpecialDirectory because XPCOM is not yet initialized.
- // This code is duplicated from xpcom/io/SpecialSystemDirectory.cpp:
-
+
+ // Just in case junk has been passed in.
+ aOutPath.Truncate();
+
#if defined(XP_WIN)
wchar_t wpath[MAX_PATH];
- if (!_wgetcwd(wpath, size))
+ if (!_wgetcwd(wpath, ArrayLength(wpath)))
return NS_ERROR_FAILURE;
- NS_ConvertUTF16toUTF8 path(wpath);
- strncpy(buf, path.get(), size);
+ CopyUTF16toUTF8(nsDependentString(wpath), aOutPath);
#else
- if(!getcwd(buf, size))
+ char path[MAXPATHLEN];
+ if (!getcwd(path, ArrayLength(path))) {
return NS_ERROR_FAILURE;
+ }
+ aOutPath = path;
#endif
+
return NS_OK;
}
@@ -535,8 +540,8 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir,
return;
// Get the current working directory.
- char workingDirPath[MAXPATHLEN];
- rv = GetCurrentWorkingDir(workingDirPath, sizeof(workingDirPath));
+ nsAutoCString workingDirPath;
+ rv = GetCurrentWorkingDir(workingDirPath);
if (NS_FAILED(rv))
return;
@@ -565,7 +570,7 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir,
argv[3] = (char*) applyToDir.get();
argv[4] = (char*) pid.get();
if (appArgc) {
- argv[5] = workingDirPath;
+ argv[5] = (char*) workingDirPath.get();
argv[6] = (char*) appFilePath.get();
for (int i = 1; i < appArgc; ++i)
argv[6 + i] = appArgv[i];
@@ -743,8 +748,8 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
}
// Get the current working directory.
- char workingDirPath[MAXPATHLEN];
- rv = GetCurrentWorkingDir(workingDirPath, sizeof(workingDirPath));
+ nsAutoCString workingDirPath;
+ rv = GetCurrentWorkingDir(workingDirPath);
if (NS_FAILED(rv))
return;
@@ -786,7 +791,7 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
argv[3] = (char*) applyToDir.get();
argv[4] = (char*) pid.get();
if (restart && appArgc) {
- argv[5] = workingDirPath;
+ argv[5] = (char*) workingDirPath.get();
argv[6] = (char*) appFilePath.get();
for (int i = 1; i < appArgc; ++i)
argv[6 + i] = appArgv[i];