Bug 1241436 - Update the "email me" checkbox in accordance with the email input field in the tab crash reporter. r=Felipe
authorCervantes Yu <cyu@mozilla.com>
Tue, 26 Jul 2016 18:29:54 +0800
changeset 351498 2ce7bd81fd0673ec5b45a56e4236168879c49a80
parent 351497 603abe52e6879bb81d5274c91d3808e892598fd4
child 351499 6732d24079ca1c6f7337bc786d75c0dd2ecd598c
push id1324
push usermtabara@mozilla.com
push dateMon, 16 Jan 2017 13:07:44 +0000
treeherdermozilla-release@a01c49833940 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFelipe
bugs1241436
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1241436 - Update the "email me" checkbox in accordance with the email input field in the tab crash reporter. r=Felipe MozReview-Commit-ID: EnIe7NRwMes
browser/base/content/aboutTabCrashed.js
--- a/browser/base/content/aboutTabCrashed.js
+++ b/browser/base/content/aboutTabCrashed.js
@@ -81,25 +81,32 @@ var AboutTabCrashed = {
       case "DOMContentLoaded": {
         this.onDOMContentLoaded();
         break;
       }
       case "click": {
         this.onClick(event);
         break;
       }
+      case "input": {
+        this.onInput(event);
+        break;
+      }
     }
   },
 
   onDOMContentLoaded() {
     this.CLICK_TARGETS.forEach((targetID) => {
       let el = document.getElementById(targetID);
       el.addEventListener("click", this);
     });
 
+    // For setting "emailMe" checkbox automatically on email value change.
+    document.getElementById("email").addEventListener("input", this);
+
     // Error pages are loaded as LOAD_BACKGROUND, so they don't get load events.
     let event = new CustomEvent("AboutTabCrashedLoad", {bubbles:true});
     document.dispatchEvent(event);
 
     sendAsyncMessage("Load");
   },
 
   onClick(event) {
@@ -121,16 +128,24 @@ var AboutTabCrashed = {
 
       case "sendReport": {
         this.showCrashReportUI(event.target.checked);
         break;
       }
     }
   },
 
+  onInput(event) {
+    switch(event.target.id) {
+      case "email": {
+        document.getElementById("emailMe").checked = !!event.target.value;
+        break;
+      }
+    }
+  },
   /**
    * After this page tells the parent that it has loaded, the parent
    * will respond with whether or not a crash report is available. This
    * method handles that message.
    *
    * @param message
    *        The message from the parent, which should contain a data
    *        Object property with the following properties: