Bug 1330422 - Use arrow functions instead of capturing "this" in the session store. r=sebastian

MozReview-Commit-ID: AlLHJipN6kL

--HG--
extra : rebase_source : f279021f013bcfb4e671b9c6d609f342b57faac9
This commit is contained in:
Jan Henning 2017-01-12 21:36:01 +01:00
parent c90cc004dc
commit 7886887a86

View File

@ -172,7 +172,6 @@ SessionStore.prototype = {
},
observe: function ss_observe(aSubject, aTopic, aData) {
let self = this;
let observerService = Services.obs;
switch (aTopic) {
case "app-startup":
@ -201,8 +200,8 @@ SessionStore.prototype = {
break;
case "domwindowopened": {
let window = aSubject;
window.addEventListener("load", function() {
self.onWindowOpen(window);
window.addEventListener("load", () => {
this.onWindowOpen(window);
window.removeEventListener("load", arguments.callee);
});
break;
@ -214,8 +213,8 @@ SessionStore.prototype = {
log("quit-application-requested");
// Get a current snapshot of all windows
if (this._pendingWrite) {
this._forEachBrowserWindow(function(aWindow) {
self._collectWindowData(aWindow);
this._forEachBrowserWindow((aWindow) => {
this._collectWindowData(aWindow);
});
}
break;
@ -1011,9 +1010,8 @@ SessionStore.prototype = {
},
_getCurrentState: function ss_getCurrentState() {
let self = this;
this._forEachBrowserWindow(function(aWindow) {
self._collectWindowData(aWindow);
this._forEachBrowserWindow((aWindow) => {
this._collectWindowData(aWindow);
});
let data = { windows: [] };