Bug 1309316 - Hide email field in about:tabcrashed by default. r=Felipe
authorMike Conley <mconley@mozilla.com>
Thu, 10 Nov 2016 22:13:09 -0500
changeset 322209 44af2c3d71ea627858f269f61c80a82800e6ffe1
parent 322208 a80600db579d50ee38991545f93bff07a2fc86e4
child 322210 a8a3319572786338113ac02ba70e950c45c238ae
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersFelipe
bugs1309316
milestone52.0a1
Bug 1309316 - Hide email field in about:tabcrashed by default. r=Felipe As requested by UX. Disabling it behind a pref in case we decide we really need to expose users to that form field again. MozReview-Commit-ID: 4ICZXuApFBL
browser/app/profile/firefox.js
browser/base/content/aboutTabCrashed.js
browser/base/content/aboutTabCrashed.xhtml
browser/base/content/test/tabcrashed/browser_clearEmail.js
browser/modules/ContentCrashHandlers.jsm
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1433,16 +1433,17 @@ pref("privacy.usercontext.about_newtab_s
 // us to change everybody to true in the future, when desired.
 pref("browser.tabs.remote.autostart.1", false);
 pref("browser.tabs.remote.autostart.2", true);
 #endif
 
 // For the about:tabcrashed page
 pref("browser.tabs.crashReporting.sendReport", true);
 pref("browser.tabs.crashReporting.includeURL", false);
+pref("browser.tabs.crashReporting.requestEmail", false);
 pref("browser.tabs.crashReporting.emailMe", false);
 pref("browser.tabs.crashReporting.email", "");
 
 // Enable e10s add-on interposition by default.
 pref("extensions.interposition.enabled", true);
 pref("extensions.interposition.prefetching", true);
 
 // Enable blocking of e10s for add-on users on beta/release.
--- a/browser/base/content/aboutTabCrashed.js
+++ b/browser/base/content/aboutTabCrashed.js
@@ -177,19 +177,23 @@ var AboutTabCrashed = {
     let data = message.data;
 
     if (data.hasReport) {
       this.hasReport = true;
       document.documentElement.classList.add("crashDumpAvailable");
 
       document.getElementById("sendReport").checked = data.sendReport;
       document.getElementById("includeURL").checked = data.includeURL;
-      document.getElementById("emailMe").checked = data.emailMe;
-      if (data.emailMe) {
-        document.getElementById("email").value = data.email;
+
+      if (data.requestEmail) {
+        document.getElementById("requestEmail").hidden = false;
+        document.getElementById("emailMe").checked = data.emailMe;
+        if (data.emailMe) {
+          document.getElementById("email").value = data.email;
+        }
       }
 
       this.showCrashReportUI(data.sendReport);
     } else {
       this.showCrashReportUI(false);
     }
 
     if (data.requestAutoSubmit) {
@@ -266,19 +270,21 @@ var AboutTabCrashed = {
       if (sendReport) {
         comments = document.getElementById("comments").value.trim();
 
         includeURL = document.getElementById("includeURL").checked;
         if (includeURL) {
           URL = this.pageData.URL.trim();
         }
 
-        emailMe = document.getElementById("emailMe").checked;
-        if (emailMe) {
-          email = document.getElementById("email").value.trim();
+        if (!document.getElementById("requestEmail").hidden) {
+          emailMe = document.getElementById("emailMe").checked;
+          if (emailMe) {
+            email = document.getElementById("email").value.trim();
+          }
         }
       }
     }
 
     let requestAutoSubmit = document.getElementById("requestAutoSubmit");
     if (requestAutoSubmit.hidden) {
       // The checkbox is hidden if the user has already opted in to sending
       // backlogged crash reports.
--- a/browser/base/content/aboutTabCrashed.xhtml
+++ b/browser/base/content/aboutTabCrashed.xhtml
@@ -58,17 +58,17 @@
             <textarea id="comments" placeholder="&tabCrashed.commentPlaceholder2;" rows="4"></textarea>
           </li>
 
           <li class="checkbox-with-label">
             <input type="checkbox" id="includeURL"/>
             <label for="includeURL">&tabCrashed.includeURL2;</label>
           </li>
 
-          <li>
+          <li id="requestEmail" hidden="true">
             <div class="checkbox-with-label">
               <input type="checkbox" id="emailMe"/>
               <label for="emailMe">&tabCrashed.emailMe;</label>
             </div>
             <input type="text" id="email" placeholder="&tabCrashed.emailPlaceholder;"/>
           </li>
         </ul>
 
--- a/browser/base/content/test/tabcrashed/browser_clearEmail.js
+++ b/browser/base/content/test/tabcrashed/browser_clearEmail.js
@@ -16,16 +16,22 @@ add_task(function* setup() {
   // which CrashSubmit.jsm uses as a server override.
   let env = Cc["@mozilla.org/process/environment;1"]
               .getService(Components.interfaces.nsIEnvironment);
   let noReport = env.get("MOZ_CRASHREPORTER_NO_REPORT");
   let serverUrl = env.get("MOZ_CRASHREPORTER_URL");
   env.set("MOZ_CRASHREPORTER_NO_REPORT", "");
   env.set("MOZ_CRASHREPORTER_URL", SERVER_URL);
 
+  // By default, requesting the email address of the user is disabled.
+  // For the purposes of this test, we turn it back on.
+  yield SpecialPowers.pushPrefEnv({
+    set: [["browser.tabs.crashReporting.requestEmail", true]],
+  });
+
   registerCleanupFunction(function() {
     env.set("MOZ_CRASHREPORTER_NO_REPORT", noReport);
     env.set("MOZ_CRASHREPORTER_URL", serverUrl);
   });
 });
 
 /**
  * Test that if we have an email address stored in prefs, and we decide
--- a/browser/modules/ContentCrashHandlers.jsm
+++ b/browser/modules/ContentCrashHandlers.jsm
@@ -451,26 +451,28 @@ this.TabCrashHandler = {
     if (!dumpID) {
       message.target.sendAsyncMessage("SetCrashReportAvailable", {
         hasReport: false,
       });
       return;
     }
 
     let requestAutoSubmit = !UnsubmittedCrashHandler.autoSubmit;
+    let requestEmail = this.prefs.getBoolPref("requestEmail");
     let sendReport = this.prefs.getBoolPref("sendReport");
     let includeURL = this.prefs.getBoolPref("includeURL");
     let emailMe = this.prefs.getBoolPref("emailMe");
 
     let data = {
       hasReport: true,
       sendReport,
       includeURL,
       emailMe,
       requestAutoSubmit,
+      requestEmail,
     };
 
     if (emailMe) {
       data.email = this.prefs.getCharPref("email", "");
     }
 
     // Make sure to only count once even if there are multiple windows
     // that will all show about:tabcrashed.