зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1198235 - abuse of bind(this) with add/removeEventListener in downloads.js. r=mak
This commit is contained in:
Родитель
5286a5716f
Коммит
5483bf7f34
|
@ -287,8 +287,14 @@ const DownloadsPanel = {
|
|||
* visualization.
|
||||
*/
|
||||
handleEvent(aEvent) {
|
||||
if (aEvent.type == "mousemove") {
|
||||
switch (aEvent.type) {
|
||||
case "mousemove":
|
||||
this.keyFocusing = false;
|
||||
break;
|
||||
case "keydown":
|
||||
return this._onKeyDown(aEvent);
|
||||
case "keypress":
|
||||
return this._onKeyPress(aEvent);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -378,10 +384,10 @@ const DownloadsPanel = {
|
|||
*/
|
||||
_attachEventListeners() {
|
||||
// Handle keydown to support accel-V.
|
||||
this.panel.addEventListener("keydown", this._onKeyDown.bind(this), false);
|
||||
this.panel.addEventListener("keydown", this, false);
|
||||
// Handle keypress to be able to preventDefault() events before they reach
|
||||
// the richlistbox, for keyboard navigation.
|
||||
this.panel.addEventListener("keypress", this._onKeyPress.bind(this), false);
|
||||
this.panel.addEventListener("keypress", this, false);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -389,10 +395,8 @@ const DownloadsPanel = {
|
|||
* is called automatically on panel termination.
|
||||
*/
|
||||
_unattachEventListeners() {
|
||||
this.panel.removeEventListener("keydown", this._onKeyDown.bind(this),
|
||||
false);
|
||||
this.panel.removeEventListener("keypress", this._onKeyPress.bind(this),
|
||||
false);
|
||||
this.panel.removeEventListener("keydown", this, false);
|
||||
this.panel.removeEventListener("keypress", this, false);
|
||||
},
|
||||
|
||||
_onKeyPress(aEvent) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче