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

--HG--
extra : rebase_source : 1325632b3877125347c34b7dc88e131199a508d4
This commit is contained in:
Cervantes Yu 2016-07-26 18:29:54 +08:00
parent b67ae659b3
commit b9c7c1d62b

View File

@ -86,6 +86,10 @@ var AboutTabCrashed = {
this.onClick(event);
break;
}
case "input": {
this.onInput(event);
break;
}
}
},
@ -95,6 +99,9 @@ var AboutTabCrashed = {
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);
@ -126,6 +133,14 @@ var AboutTabCrashed = {
}
},
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