Bug 1266223 - Add logging for session store closed tab data messaging. r=margaret draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Wed, 27 Apr 2016 16:14:28 +0200
changeset 356911 fbbfde000f060686d3599877ac8bdaf0f6311f41
parent 356903 c8a63768230b925c88ca3afb6761fbe090feadc7
child 519520 cc2e46a4406fb935360d32706b7e72f800197fbc
push id16641
push usermozilla@buttercookie.de
push dateWed, 27 Apr 2016 14:44:39 +0000
reviewersmargaret
bugs1266223
milestone49.0a1
Bug 1266223 - Add logging for session store closed tab data messaging. r=margaret MozReview-Commit-ID: AWyq0q7HiB0
mobile/android/components/SessionStore.js
--- a/mobile/android/components/SessionStore.js
+++ b/mobile/android/components/SessionStore.js
@@ -188,20 +188,22 @@ SessionStore.prototype = {
         // executed. After onPause, the application may be terminated at any
         // point without notice; therefore, we must synchronously write out any
         // pending save state to ensure that this data does not get lost.
         log("application-background");
         this.flushPendingState();
         break;
       case "ClosedTabs:StartNotifications":
         this._notifyClosedTabs = true;
+        log("ClosedTabs:StartNotifications");
         this._sendClosedTabsToJava(Services.wm.getMostRecentWindow("navigator:browser"));
         break;
       case "ClosedTabs:StopNotifications":
         this._notifyClosedTabs = false;
+        log("ClosedTabs:StopNotifications");
         break;
       case "last-pb-context-exited":
         // Clear private closed tab data when we leave private browsing.
         for (let [, window] in Iterator(this._windows)) {
           window.closedTabs = window.closedTabs.filter(tab => !tab.isPrivate);
         }
         this._lastClosedTabIndex = -1;
         break;
@@ -1221,16 +1223,17 @@ SessionStore.prototype = {
         tab.browser.__SS_restore = true;
         tab.browser.setAttribute("pending", "true");
       }
     }
 
     // Restore the closed tabs array on the current window.
     if (state.windows[0].closedTabs) {
       this._windows[window.__SSID].closedTabs = state.windows[0].closedTabs;
+      log("_restoreWindow() loaded " + state.windows[0].closedTabs.length + " closed tabs");
     }
   },
 
   getClosedTabCount: function ss_getClosedTabCount(aWindow) {
     if (!aWindow || !aWindow.__SSID || !this._windows[aWindow.__SSID]) {
       return 0; // not a browser window, or not otherwise tracked by SS.
     }
 
@@ -1324,16 +1327,17 @@ SessionStore.prototype = {
         let lastEntry = tab.entries[tab.entries.length - 1];
         return {
           url: lastEntry.url,
           title: lastEntry.title || "",
           data: tab
         };
       });
 
+    log("sending " + tabs.length + " closed tabs to Java");
     Messaging.sendRequest({
       type: "ClosedTabs:Data",
       tabs: tabs
     });
   },
 
   getTabValue: function ss_getTabValue(aTab, aKey) {
     let browser = aTab.browser;