From 57478c35de11408d34d27a18bd64d2ae6ab1dae5 Mon Sep 17 00:00:00 2001 From: "ted.mielczarek@gmail.com" Date: Thu, 21 Feb 2008 16:00:14 -0800 Subject: [PATCH] bug 417669 - crashreporter displays details: firefox. r=dcamp --- .../crashreporter/client/crashreporter.cpp | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/toolkit/crashreporter/client/crashreporter.cpp b/toolkit/crashreporter/client/crashreporter.cpp index 72be3a0d2ee..f5ed15548b6 100644 --- a/toolkit/crashreporter/client/crashreporter.cpp +++ b/toolkit/crashreporter/client/crashreporter.cpp @@ -384,12 +384,26 @@ void RewriteStrings(StringTable& queryParameters) vendor.c_str()); gStrings[ST_CRASHREPORTERTITLE] = buf; - // Leave a format specifier for UIError to fill in - UI_SNPRINTF(buf, sizeof(buf), - gStrings[ST_CRASHREPORTERPRODUCTERROR].c_str(), - product.c_str(), - "%s"); - gStrings[ST_CRASHREPORTERERROR] = buf; + + string str = gStrings[ST_CRASHREPORTERPRODUCTERROR]; + // Only do the replacement here if the string has two + // format specifiers to start. Otherwise + // we assume it has the product name hardcoded. + string::size_type pos = str.find("%s"); + if (pos != string::npos) + pos = str.find("%s", pos+2); + if (pos != string::npos) { + // Leave a format specifier for UIError to fill in + UI_SNPRINTF(buf, sizeof(buf), + gStrings[ST_CRASHREPORTERPRODUCTERROR].c_str(), + product.c_str(), + "%s"); + gStrings[ST_CRASHREPORTERERROR] = buf; + } + else { + // product name is hardcoded + gStrings[ST_CRASHREPORTERERROR] = str; + } UI_SNPRINTF(buf, sizeof(buf), gStrings[ST_CRASHREPORTERDESCRIPTION].c_str(),