Bug 1333567 - Part 0 - Simplfy shutdown data collection. r?sebastian draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Wed, 25 Jan 2017 20:58:05 +0100
changeset 466328 6113294a9a16619453a7df74b43470148e8782a4
parent 466327 8ccda93dabb3d72ab73685f007ded2159d4438a2
child 466329 5b39e8e6eb4269a5794c5ffa14794d03d6690066
push id42863
push usermozilla@buttercookie.de
push dateWed, 25 Jan 2017 20:05:28 +0000
reviewerssebastian
bugs1333567
milestone54.0a1
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
mobile/android/components/SessionStore.js
--- 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