bug 903426. Add options for sending URLs with crash reports or not. r=jimm,mbrubeck
☠☠ backed out by a213a3eef80d ☠ ☠
authorTim Abraldes <tabraldes@mozilla.com>
Thu, 05 Dec 2013 22:08:02 -0800
changeset 159133 a5e4cf95c43e924ed8d24ea0783e05674632323b
parent 159132 e068a99474a6fc372e5f0971a8c7e55b7a16de8c
child 159134 2c42e70b08c2745d17217405a9863d3e3ea8f684
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersjimm, mbrubeck
bugs903426
milestone28.0a1
bug 903426. Add options for sending URLs with crash reports or not. r=jimm,mbrubeck
browser/metro/base/content/browser-ui.js
browser/metro/base/content/browser.xul
browser/metro/base/content/flyoutpanels/PrefsFlyoutPanel.js
browser/metro/base/content/pages/crashprompt.xhtml
browser/metro/locales/en-US/chrome/crashprompt.dtd
browser/metro/locales/en-US/chrome/preferences.dtd
browser/metro/profile/metro.js
--- a/browser/metro/base/content/browser-ui.js
+++ b/browser/metro/base/content/browser-ui.js
@@ -604,18 +604,22 @@ var BrowserUI = {
   },
 
   submitLastCrashReportOrShowPrompt: function() {
 #ifdef MOZ_CRASHREPORTER
     let lastCrashID = this.lastCrashID;
     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);
         }
       } else if (!Services.prefs.getBoolPref("app.crashreporter.prompted")) {
         BrowserUI.newTab("about:crashprompt", null);
       }
     }
 #endif
--- a/browser/metro/base/content/browser.xul
+++ b/browser/metro/base/content/browser.xul
@@ -667,17 +667,23 @@ Desktop browser's sync prefs.
               <cssthrobber id="clearprivacythrobber"/>
             </hbox>
             <description id="clear-notification-done">&clearPrivateData.done;</description>
           </deck>
         </hbox>
       </settings>
       <setting pref="signon.rememberSignons" title="&optionsHeader.privacy.passwords.label;" type="bool"/>
       <settings id="prefs-reporting" label="&optionsHeader.reporting.title;">
-        <setting pref="app.crashreporter.autosubmit" type="bool" title="&optionsHeader.reporting.crashes.label;" />
+        <setting pref="app.crashreporter.autosubmit"
+                 type="bool"
+                 title="&optionsHeader.reporting.crashes.label;" />
+        <setting pref="app.crashreporter.submitURLs"
+                 id="prefs-reporting-submitURLs"
+                 type="bool"
+                 title="&optionsHeader.reporting.crashes.submitURLs;" />
       </settings>
       <settings id="prefs-telemetry" label="&optionsHeader.telemetry.title;">
         <setting pref="toolkit.telemetry.enabled" type="bool" title="&optionsHeader.telemetry.label;"/>
       </settings>
       <settings id="prefs-dnt" label="&doNotTrack.title;">
         <setting id="prefs-dnt-value" pref="privacy.donottrackheader.value" type="radio" >
           <radiogroup id="prefs-dnt-options">
             <radio id="prefs-dnt-notrack" class="flyoutpanel-hack"
--- a/browser/metro/base/content/flyoutpanels/PrefsFlyoutPanel.js
+++ b/browser/metro/base/content/flyoutpanels/PrefsFlyoutPanel.js
@@ -39,16 +39,22 @@ let PrefsFlyoutPanel = {
       this._hasShown = true;
 
       Services.prefs.addObserver("privacy.donottrackheader.value",
                                  this._prefObserver,
                                  false);
       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();
   },
 
   _prefObserver: function(subject, topic, data) {
     let value = -1;
     try {
@@ -76,11 +82,34 @@ let PrefsFlyoutPanel = {
 
       case "privacy.donottrackheader.enabled":
         // If someone or something modifies this pref, we should update the
         // other pref as well so our UI doesn't give false information
         if (((1 == value) || (0 == value)) && !isEnabled) {
           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;
     }
   },
 };
--- a/browser/metro/base/content/pages/crashprompt.xhtml
+++ b/browser/metro/base/content/pages/crashprompt.xhtml
@@ -48,29 +48,43 @@
       function togglePrivacyDetails() {
         var privacyDetails = document.getElementById("lightboxBackdrop");
         privacyDetails.classList.toggle('hidden');
       }
 
       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();
       }
 
       function onChoseDoNotSend() {
         Services.prefs.setBoolPref("app.crashreporter.prompted", true);
         Services.prefs.setBoolPref("app.crashreporter.autosubmit", false);
         window.close();
       }
+
+
+      function onLoad() {
+        document.getElementById("crashpromptIncludeURLCheckbox").checked =
+          Services.prefs.getBoolPref("app.crashreporter.submitURLs");
+      }
     ]]></script>
 
   </head>
 
-  <body id="crashPromptPage" dir="&locale.dir;">
+  <body id="crashPromptPage" dir="&locale.dir;" onload="onLoad();">
     <div id="crashPromptContainer">
       <h1 id="crashPromptTitle">&crashprompt.title;</h1>
       <hr id="crashPromptSeparator" />
       <p>&crashprompt.message;</p>
       <p id="detailsGrid">
         <a href="javascript:toggleDetailsVisible();"
            id="detailsLink">
           <img id="detailsArrow"
@@ -90,16 +104,23 @@
             &crashprompt.detailedMessage.thirdParagraph;
             <a id="privacyPolicyLink"
                href="javascript:togglePrivacyDetails();">
               &crashprompt.privacyPolicyLink;
             </a>
           </label>
         </div>
       </p>
+      <div id="crashpromptURLCheckboxContainer">
+        <label id="crashpromptIncludeURLLabel">
+          <input type="checkbox"
+                 id="crashpromptIncludeURLCheckbox" />
+          &crashprompt.includeURLLabel;
+        </label>
+      </div>
       <div id="crashPromptButtonContainer">
         <button class="button-default"
                 onclick="onChoseSendReports();">
           &crashprompt.acceptbutton;
         </button>
         <button id="refuseButton"
                 onclick="onChoseDoNotSend();">
           &crashprompt.refusebutton;
--- a/browser/metro/locales/en-US/chrome/crashprompt.dtd
+++ b/browser/metro/locales/en-US/chrome/crashprompt.dtd
@@ -5,11 +5,12 @@
 
 <!ENTITY crashprompt.title           "Would you like to send Mozilla crash reports?">
 <!ENTITY crashprompt.message         "We are sorry, &brandShortName; just recovered from a crash. Sending crash reports will help Mozilla make &brandShortName; more stable and secure. You can always change your preference in Settings/Options.">
 <!ENTITY crashprompt.detailsLink     "What's in a crash report?">
 <!ENTITY crashprompt.detailedMessage.firstParagraph "A crash report contains some details about the crash, your machine, as well as a snapshot of the state of your browser when it crashed.">
 <!ENTITY crashprompt.detailedMessage.secondParagraph "This may include things like open pages, text typed into forms and the content of open messages, recent browsing history, or geolocation shared with a site.">
 <!ENTITY crashprompt.detailedMessage.thirdParagraph "We use crash reports to try to fix problems and improve our products. We handle your information as we describe in our ">
 <!ENTITY crashprompt.privacyPolicyLink "&brandShortName; privacy policy">
+<!ENTITY crashprompt.includeURLLabel "Include the address of the page I was on">
 <!ENTITY crashprompt.acceptbutton    "Send reports">
 <!ENTITY crashprompt.refusebutton    "Don't send">
 <!ENTITY crashprompt.privacyPolicy.title "&brandShortName; privacy policy">
--- a/browser/metro/locales/en-US/chrome/preferences.dtd
+++ b/browser/metro/locales/en-US/chrome/preferences.dtd
@@ -30,10 +30,11 @@
 <!ENTITY doNotTrack.title                                        "Do Not Track">
 <!ENTITY doNotTrack.options.doNotTrack                           "Tell websites that I do not want to be tracked">
 <!ENTITY doNotTrack.options.doTrack                              "Tell websites that I want to be tracked">
 <!ENTITY doNotTrack.options.default                              "Do not tell websites anything about my tracking preferences">
 <!ENTITY doNotTrack.learnMoreLink                                "Learn more&#x2026;">
 
 <!ENTITY optionsHeader.reporting.title                           "Crash Reporter">
 <!ENTITY optionsHeader.reporting.crashes.label                   "&brandShortName; submits crash reports to help Mozilla make your browser more stable and secure">
+<!ENTITY optionsHeader.reporting.crashes.submitURLs             "Include the address of the page I was on">
 <!ENTITY optionsHeader.telemetry.title                            "Telemetry">
 <!ENTITY optionsHeader.telemetry.label                            "Shares usage statistics about &brandShortName; with Mozilla to help us make your browser better">
--- a/browser/metro/profile/metro.js
+++ b/browser/metro/profile/metro.js
@@ -13,19 +13,21 @@ pref("devtools.chrome.enabled", true);
 #else
 pref("devtools.errorconsole.enabled", false);
 pref("devtools.chrome.enabled", false);
 #endif
 
 // Automatically submit crash reports
 #ifdef RELEASE_BUILD
 pref("app.crashreporter.autosubmit", false);
+pref("app.crashreporter.submitURLs", false);
 #else
 // For Nightly and Aurora we turn this on by default
 pref("app.crashreporter.autosubmit", true);
+pref("app.crashreporter.submitURLs", false);
 #endif
 // Has the user been prompted about crash reporting?
 pref("app.crashreporter.prompted", false);
 
 // Debug prefs, see input.js
 pref("metro.debug.colorizeInputOverlay", false);
 pref("metro.debug.selection.displayRanges", false);
 pref("metro.debug.selection.dumpRanges", false);