From 9faa499d9dd5a09d4bf47ecea531e1af6f5fe778 Mon Sep 17 00:00:00 2001 From: Tim Abraldes Date: Thu, 5 Dec 2013 22:08:02 -0800 Subject: [PATCH] bug 903426. Add options for sending URLs with crash reports or not. r=jimm,mbrubeck --- browser/metro/base/content/browser-ui.js | 6 +++- browser/metro/base/content/browser.xul | 8 ++++- .../content/flyoutpanels/PrefsFlyoutPanel.js | 29 +++++++++++++++++++ .../base/content/pages/crashprompt.xhtml | 23 ++++++++++++++- .../locales/en-US/chrome/crashprompt.dtd | 1 + .../locales/en-US/chrome/preferences.dtd | 1 + browser/metro/profile/metro.js | 2 ++ 7 files changed, 67 insertions(+), 3 deletions(-) diff --git a/browser/metro/base/content/browser-ui.js b/browser/metro/base/content/browser-ui.js index 8444cebe14f3..65aafd534615 100644 --- a/browser/metro/base/content/browser-ui.js +++ b/browser/metro/base/content/browser-ui.js @@ -609,8 +609,12 @@ var BrowserUI = { if (lastCrashID && lastCrashID.length) { if (Services.prefs.getBoolPref("app.crashreporter.autosubmit")) { Util.dumpLn("Submitting last crash id:", lastCrashID); + let params = {}; + if (!Services.prefs.getBoolPref("app.crashreporter.submitURLs")) { + params['extraExtraKeyVals'] = { URL: '' }; + } try { - this.CrashSubmit.submit(lastCrashID); + this.CrashSubmit.submit(lastCrashID, params); } catch (ex) { Util.dumpLn(ex); } diff --git a/browser/metro/base/content/browser.xul b/browser/metro/base/content/browser.xul index 76099ba20a6a..6b790627228e 100644 --- a/browser/metro/base/content/browser.xul +++ b/browser/metro/base/content/browser.xul @@ -672,7 +672,13 @@ Desktop browser's sync prefs. - + + diff --git a/browser/metro/base/content/flyoutpanels/PrefsFlyoutPanel.js b/browser/metro/base/content/flyoutpanels/PrefsFlyoutPanel.js index 6eec2ac7add1..7867edf061c1 100644 --- a/browser/metro/base/content/flyoutpanels/PrefsFlyoutPanel.js +++ b/browser/metro/base/content/flyoutpanels/PrefsFlyoutPanel.js @@ -44,6 +44,12 @@ let PrefsFlyoutPanel = { Services.prefs.addObserver("privacy.donottrackheader.enabled", this._prefObserver, false); + Services.prefs.addObserver("app.crashreporter.autosubmit", + this._prefObserver, + false); + Services.prefs.addObserver("app.crashreporter.submitURLs", + this._prefObserver, + false); } this._topmostElement.show(); @@ -81,6 +87,29 @@ let PrefsFlyoutPanel = { Services.prefs.setIntPref('privacy.donottrackheader.value', -1); } break; + + case "app.crashreporter.autosubmit": + let autosubmit = Services.prefs.getBoolPref("app.crashreporter.autosubmit"); + if (!autosubmit) { + // If the user has selected not to submit crash reports, the UI + // should reflect also that URLs will not be included. + // TODO: Ideally we would grey out the text and the toggle for + // the "include URLs" pref, but the |setting| binding doesn't + // appear to support enabling/disabling. In the meantime, we just + // set the "include URLs" pref to false if the "send crash reports" + // pref has been set to false. + Services.prefs.setBoolPref('app.crashreporter.submitURLs', false); + } + break; + + case "app.crashreporter.submitURLs": + let submitURLs = Services.prefs.getBoolPref("app.crashreporter.submitURLs"); + if (submitURLs) { + // If the user has selected to submit URLs, they are implicitly also + // selecting to submit crash reports. Let's update the autosubmit pref + Services.prefs.setBoolPref('app.crashreporter.autosubmit', true); + } + break; } }, }; diff --git a/browser/metro/base/content/pages/crashprompt.xhtml b/browser/metro/base/content/pages/crashprompt.xhtml index 5f7f24ece814..2875b5dbb35d 100644 --- a/browser/metro/base/content/pages/crashprompt.xhtml +++ b/browser/metro/base/content/pages/crashprompt.xhtml @@ -53,6 +53,14 @@ function onChoseSendReports() { Services.prefs.setBoolPref("app.crashreporter.prompted", true); Services.prefs.setBoolPref("app.crashreporter.autosubmit", true); + + var includeURLCheckbox = document.getElementById("crashpromptIncludeURLCheckbox"); + if (includeURLCheckbox.checked) { + Services.prefs.setBoolPref("app.crashreporter.submitURLs", true); + } else { + Services.prefs.setBoolPref("app.crashreporter.submitURLs", false); + } + window.close(); } @@ -61,11 +69,17 @@ Services.prefs.setBoolPref("app.crashreporter.autosubmit", false); window.close(); } + + + function onLoad() { + document.getElementById("crashpromptIncludeURLCheckbox").checked = + Services.prefs.getBoolPref("app.crashreporter.submitURLs"); + } ]]> - +

&crashprompt.title;


@@ -95,6 +109,13 @@

+
+ +