Bug 386959 - crashreporter gets wrong restart arguments for xulrunner apps, r=bsmedberg
--- a/toolkit/crashreporter/client/crashreporter.cpp
+++ b/toolkit/crashreporter/client/crashreporter.cpp
@@ -429,16 +429,31 @@ int main(int argc, char** argv)
if (!MoveCrashData(pendingDir, gDumpFile, gExtraFile)) {
return 0;
}
string sendURL = queryParameters["ServerURL"];
// we don't need to actually send this
queryParameters.erase("ServerURL");
+ // re-set XUL_APP_FILE for xulrunner wrapped apps
+ const char *appfile = getenv("MOZ_CRASHREPORTER_RESTART_XUL_APP_FILE");
+ if (appfile && *appfile) {
+ const char prefix[] = "XUL_APP_FILE=";
+ char *env = (char*) malloc(strlen(appfile)+strlen(prefix));
+ if (!env) {
+ UIError("Out of memory");
+ return 0;
+ }
+ strcpy(env, prefix);
+ strcat(env, appfile);
+ putenv(env);
+ free(env);
+ }
+
vector<string> restartArgs;
ostringstream paramName;
int i = 0;
paramName << "MOZ_CRASHREPORTER_RESTART_ARG_" << i++;
const char *param = getenv(paramName.str().c_str());
while (param && *param) {
restartArgs.push_back(param);
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -465,11 +465,20 @@ SetRestartArgs(int argc, char **argv)
// PR_SetEnv() wants the string to be available for the lifetime
// of the app, so dup it here
env = ToNewCString(envVar);
if (!env)
return NS_ERROR_OUT_OF_MEMORY;
PR_SetEnv(env);
+ // make sure we save the info in XUL_APP_FILE for the reporter
+ const char *appfile = PR_GetEnv("XUL_APP_FILE");
+ if (appfile && *appfile) {
+ envVar = "MOZ_CRASHREPORTER_RESTART_XUL_APP_FILE=";
+ envVar += appfile;
+ env = ToNewCString(envVar);
+ PR_SetEnv(env);
+ }
+
return NS_OK;
}
} // namespace CrashReporter