Bug 1185893 - abuse of bind(this) with add/removeEventListener r=gijs

--HG--
extra : commitid : 1GYxHS8fyOs
extra : histedit_source : 076c55f9015ed8289581a0d52ae03e03b9352267
This commit is contained in:
Nazim Can Altinova 2015-08-21 15:31:00 +01:00
Родитель 4214bb816c
Коммит 59729e31e7
3 изменённых файлов: 9 добавлений и 6 удалений

Просмотреть файл

@ -332,7 +332,7 @@ WindowListener.prototype = {
let domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
domwindow.addEventListener("load", function onLoad(aEvent) {
let onLoad = aEvent => {
is(domwindow.document.location.href, this.test_url,
"Opened Window is expected: "+ this.test_title);
if (this.callback_onSuccess) {
@ -352,7 +352,8 @@ WindowListener.prototype = {
domwindow.close();
executeSoon(this.callBack_onFinalize);
}
}.bind(this), true);
};
domwindow.addEventListener("load", onLoad, true);
},
onCloseWindow: function(aXULWindow) {},
onWindowTitleChange: function(aXULWindow, aNewTitle) {},

Просмотреть файл

@ -898,7 +898,7 @@ let MozLoopServiceInternal = {
return;
}
chatbox.addEventListener("DOMContentLoaded", function loaded(event) {
let loaded = event => {
if (event.target != chatbox.contentDocument) {
return;
}
@ -987,7 +987,8 @@ let MozLoopServiceInternal = {
pc_static.registerPeerConnectionLifecycleCallback(onPCLifecycleChange);
UITour.notify("Loop:ChatWindowOpened");
}.bind(this), true);
};
chatbox.addEventListener("DOMContentLoaded", loaded, true);
};
let chatboxInstance = Chat.open(null, origin, "", url, undefined, undefined,

Просмотреть файл

@ -292,7 +292,7 @@ Cookies.prototype = {
_readCookieFile: function C__readCookieFile(aFile, aCallback) {
let fileReader = Cc["@mozilla.org/files/filereader;1"].
createInstance(Ci.nsIDOMFileReader);
fileReader.addEventListener("loadend", (function onLoadEnd() {
let onLoadEnd = () => {
fileReader.removeEventListener("loadend", onLoadEnd, false);
if (fileReader.readyState != fileReader.DONE) {
@ -310,7 +310,8 @@ Cookies.prototype = {
} finally {
aCallback(success);
}
}).bind(this), false);
};
fileReader.addEventListener("loadend", onLoadEnd, false);
fileReader.readAsText(new File(aFile));
},