mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
bug 424960 - only enable crash reporting for X% of release builds. r=bsmedberg (blocking 1.9)
This commit is contained in:
parent
47f49fb1f9
commit
68517aaff0
11
configure.in
11
configure.in
@ -5387,6 +5387,17 @@ if test -n "$MOZ_CRASHREPORTER"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
|
||||
[ --with-crashreporter-enable-percent=NN Enable sending crash reports by default on NN% of users. (default=100)],
|
||||
[ val=`echo $withval | sed 's/[^0-9]//g'`
|
||||
MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
|
||||
|
||||
if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
|
||||
MOZ_CRASHREPORTER_ENABLE_PERCENT=100
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
|
||||
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Build mochitest JS/DOM tests (on by default)
|
||||
dnl ========================================================
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include <sstream>
|
||||
#include <memory>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
using std::string;
|
||||
@ -365,6 +366,12 @@ bool SendCompleted(bool success, const string& serverResponse)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ShouldEnableSending()
|
||||
{
|
||||
srand(time(0));
|
||||
return ((rand() % 100) < MOZ_CRASHREPORTER_ENABLE_PERCENT);
|
||||
}
|
||||
|
||||
} // namespace CrashReporter
|
||||
|
||||
using namespace CrashReporter;
|
||||
|
@ -102,6 +102,7 @@ namespace CrashReporter {
|
||||
bool escape);
|
||||
void LogMessage(const std::string& message);
|
||||
void DeleteDump();
|
||||
bool ShouldEnableSending();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -110,10 +110,13 @@ static void LoadSettings()
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gIncludeURLCheck),
|
||||
settings["IncludeURL"][0] != '0');
|
||||
}
|
||||
if (settings.find("SubmitReport") != settings.end()) {
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gSubmitReportCheck),
|
||||
settings["SubmitReport"][0] != '0');
|
||||
}
|
||||
bool enabled;
|
||||
if (settings.find("SubmitReport") != settings.end())
|
||||
enabled = settings["SubmitReport"][0] != '0';
|
||||
else
|
||||
enabled = ShouldEnableSending();
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gSubmitReportCheck),
|
||||
enabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,6 +159,21 @@ static bool RestartApplication()
|
||||
// resize some buttons horizontally and possibly some controls vertically
|
||||
[self doInitialResizing];
|
||||
|
||||
// load default state of submit checkbox
|
||||
// we don't just do this via IB because we want the default to be
|
||||
// off a certain percentage of the time
|
||||
BOOL submitChecked = NO;
|
||||
NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
if (nil != [userDefaults objectForKey:@"submitReport"]) {
|
||||
submitChecked = [userDefaults boolForKey:@"submitReport"];
|
||||
}
|
||||
else {
|
||||
// use compile-time specified enable percentage
|
||||
submitChecked = ShouldEnableSending();
|
||||
[userDefaults setBool:submitChecked forKey:@"submitReport"];
|
||||
}
|
||||
[mSubmitReportButton setState:(submitChecked ? NSOnState : NSOffState)];
|
||||
|
||||
[self updateSubmit];
|
||||
[self updateURL];
|
||||
[self updateEmail];
|
||||
@ -244,6 +259,9 @@ static bool RestartApplication()
|
||||
-(IBAction)submitReportClicked:(id)sender
|
||||
{
|
||||
[self updateSubmit];
|
||||
NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
[userDefaults setBool:[mSubmitReportButton state] == NSOnState
|
||||
forKey:@"submitReport"];
|
||||
}
|
||||
|
||||
-(IBAction)viewReportClicked:(id)sender
|
||||
|
@ -539,7 +539,8 @@ static void UpdateEmail(HWND hwndDlg)
|
||||
wchar_t email[MAX_EMAIL_LENGTH];
|
||||
GetDlgItemText(hwndDlg, IDC_EMAILTEXT, email, sizeof(email));
|
||||
gQueryParameters[L"Email"] = email;
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EMAILTEXT), true);
|
||||
if (IsDlgButtonChecked(hwndDlg, IDC_SUBMITREPORTCHECK))
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EMAILTEXT), true);
|
||||
} else {
|
||||
gQueryParameters.erase(L"Email");
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EMAILTEXT), false);
|
||||
@ -781,6 +782,19 @@ static void StretchControlsToFit(HWND hwndDlg)
|
||||
}
|
||||
}
|
||||
|
||||
static void SubmitReportChecked(HWND hwndDlg)
|
||||
{
|
||||
bool enabled = (IsDlgButtonChecked(hwndDlg, IDC_SUBMITREPORTCHECK) != 0);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_VIEWREPORTBUTTON), enabled);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_COMMENTTEXT), enabled);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_INCLUDEURLCHECK), enabled);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EMAILMECHECK), enabled);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EMAILTEXT),
|
||||
enabled && (IsDlgButtonChecked(hwndDlg, IDC_EMAILMECHECK)
|
||||
!= 0));
|
||||
SetDlgItemVisible(hwndDlg, IDC_PROGRESSTEXT, enabled);
|
||||
}
|
||||
|
||||
static BOOL CALLBACK CrashReporterDialogProc(HWND hwndDlg, UINT message,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
@ -816,20 +830,13 @@ static BOOL CALLBACK CrashReporterDialogProc(HWND hwndDlg, UINT message,
|
||||
SetDlgItemText(hwndDlg, IDC_SUBMITREPORTCHECK,
|
||||
Str(ST_CHECKSUBMIT).c_str());
|
||||
|
||||
if (CheckBoolKey(gCrashReporterKey.c_str(),
|
||||
SUBMIT_REPORT_VALUE, &enabled) &&
|
||||
!enabled) {
|
||||
CheckDlgButton(hwndDlg, IDC_SUBMITREPORTCHECK, BST_UNCHECKED);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_VIEWREPORTBUTTON), enabled);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_COMMENTTEXT), enabled);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_INCLUDEURLCHECK), enabled);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EMAILMECHECK), enabled);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EMAILTEXT), enabled);
|
||||
SetDlgItemVisible(hwndDlg, IDC_PROGRESSTEXT, enabled);
|
||||
} else {
|
||||
CheckDlgButton(hwndDlg, IDC_SUBMITREPORTCHECK, BST_CHECKED);
|
||||
}
|
||||
if (!CheckBoolKey(gCrashReporterKey.c_str(),
|
||||
SUBMIT_REPORT_VALUE, &enabled))
|
||||
enabled = ShouldEnableSending();
|
||||
|
||||
CheckDlgButton(hwndDlg, IDC_SUBMITREPORTCHECK, enabled ? BST_CHECKED
|
||||
: BST_UNCHECKED);
|
||||
SubmitReportChecked(hwndDlg);
|
||||
|
||||
HWND hwndComment = GetDlgItem(hwndDlg, IDC_COMMENTTEXT);
|
||||
WNDPROC OldWndProc = (WNDPROC)SetWindowLongPtr(hwndComment,
|
||||
@ -1040,15 +1047,7 @@ static BOOL CALLBACK CrashReporterDialogProc(HWND hwndDlg, UINT message,
|
||||
(DLGPROC)ViewReportDialogProc, 0);
|
||||
break;
|
||||
case IDC_SUBMITREPORTCHECK:
|
||||
enabled = (IsDlgButtonChecked(hwndDlg, IDC_SUBMITREPORTCHECK) != 0);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_VIEWREPORTBUTTON), enabled);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_COMMENTTEXT), enabled);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_INCLUDEURLCHECK), enabled);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EMAILMECHECK), enabled);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EMAILTEXT),
|
||||
enabled && (IsDlgButtonChecked(hwndDlg, IDC_EMAILMECHECK)
|
||||
!= 0));
|
||||
SetDlgItemVisible(hwndDlg, IDC_PROGRESSTEXT, enabled);
|
||||
SubmitReportChecked(hwndDlg);
|
||||
break;
|
||||
case IDC_INCLUDEURLCHECK:
|
||||
UpdateURL(hwndDlg);
|
||||
|
@ -8,10 +8,10 @@
|
||||
<integer>5</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>21</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>9B18</string>
|
||||
<string>9C7010</string>
|
||||
<key>targetFramework</key>
|
||||
<string>IBCocoaFramework</string>
|
||||
</dict>
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user