Bug 1333567 - Part 0 - Simplfy shutdown data collection. r?sebastian
We've already got a function for collecting the session data from every browser window - we should use it instead of duplicating that code snippet over and over again.
MozReview-Commit-ID: K7pGpBju89i
--- a/mobile/android/components/SessionStore.js
+++ b/mobile/android/components/SessionStore.js
@@ -210,19 +210,17 @@ SessionStore.prototype = {
}
case "domwindowclosed": // catch closed windows
this.onWindowClose(aSubject);
break;
case "quit-application-requested":
log("quit-application-requested");
// Get a current snapshot of all windows
if (this._pendingWrite) {
- this._forEachBrowserWindow((aWindow) => {
- this._collectWindowData(aWindow);
- });
+ this._getCurrentState();
}
break;
case "quit-application-proceeding":
log("quit-application-proceeding");
// Freeze the data at what we've got (ignoring closing windows)
this._loadState = STATE_QUITTING;
break;
case "quit-application":
@@ -599,19 +597,17 @@ SessionStore.prototype = {
aBrowser.addEventListener("resize", this, true);
log("onTabAdd() ran for tab " + aWindow.BrowserApp.getTabForBrowser(aBrowser).id +
", aNoNotification = " + aNoNotification);
if (!aNoNotification) {
if (this._loadState == STATE_QUITTING) {
// A tab arrived just as were starting to shut down. Since we haven't yet received
// application-quit, we refresh the window data one more time before the window closes.
- this._forEachBrowserWindow((aWindow) => {
- this._collectWindowData(aWindow);
- });
+ this._getCurrentState();
}
this.saveStateDelayed();
}
this._updateCrashReportURL(aWindow);
},
onTabRemove: function ss_onTabRemove(aWindow, aBrowser, aNoNotification) {
// Cleanup event listeners