Bug 936271 - Remove load event handling from SessionStore.jsm r=yoric
authorTim Taubert <ttaubert@mozilla.com>
Mon, 27 Jan 2014 08:56:00 -0800
changeset 182231 e6cf021cd5e60fed3cc8603cafe8f253d6b0061e
parent 182230 007345409abff999d599dd7c46487fa47b5dc703
child 182232 97b90c0dc96c317921b25eaf72edbb628a40ae95
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyoric
bugs936271
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 936271 - Remove load event handling from SessionStore.jsm r=yoric
browser/components/sessionstore/content/content-sessionStore.js
browser/components/sessionstore/src/SessionStore.jsm
--- a/browser/components/sessionstore/content/content-sessionStore.js
+++ b/browser/components/sessionstore/content/content-sessionStore.js
@@ -82,26 +82,25 @@ let EventListener = {
     // Ignore load events from subframes.
     if (event.target != content.document) {
       return;
     }
 
     // If we're in the process of restoring, this load may signal
     // the end of the restoration.
     let epoch = gContentRestore.getRestoreEpoch();
-    if (epoch) {
-      // Restore the form data and scroll position.
-      gContentRestore.restoreDocument();
-
-      // Ask SessionStore.jsm to trigger SSTabRestored.
-      sendAsyncMessage("SessionStore:restoreDocumentComplete", {epoch: epoch});
+    if (!epoch) {
+      return;
     }
 
-    // Send a load message for all loads.
-    sendAsyncMessage("SessionStore:load");
+    // Restore the form data and scroll position.
+    gContentRestore.restoreDocument();
+
+    // Ask SessionStore.jsm to trigger SSTabRestored.
+    sendAsyncMessage("SessionStore:restoreDocumentComplete", {epoch: epoch});
   }
 };
 
 /**
  * Listens for and handles messages sent by the session store service.
  */
 let MessageListener = {
 
--- a/browser/components/sessionstore/src/SessionStore.jsm
+++ b/browser/components/sessionstore/src/SessionStore.jsm
@@ -52,19 +52,16 @@ const MESSAGES = [
   // The content script gives us a reference to an object that performs
   // synchronous collection of session data.
   "SessionStore:setupSyncHandler",
 
   // The content script sends us data that has been invalidated and needs to
   // be saved to disk.
   "SessionStore:update",
 
-  // A "load" event happened.
-  "SessionStore:load",
-
   // The restoreHistory code has run. This is a good time to run SSTabRestoring.
   "SessionStore:restoreHistoryComplete",
 
   // The load for the restoring tab has begun. We update the URL bar at this
   // time; if we did it before, the load would overwrite it.
   "SessionStore:restoreTabContentStarted",
 
   // All network loads for a restoring tab are done, so we should consider
@@ -588,19 +585,16 @@ let SessionStoreInternal = {
       case "SessionStore:setupSyncHandler":
         TabState.setSyncHandler(browser, aMessage.objects.handler);
         break;
       case "SessionStore:update":
         this.recordTelemetry(aMessage.data.telemetry);
         TabState.update(browser, aMessage.data);
         this.saveStateDelayed(win);
         break;
-      case "SessionStore:load":
-        this.onTabLoad(win, browser);
-        break;
       case "SessionStore:restoreHistoryComplete":
         if (this.isCurrentEpoch(browser, aMessage.data.epoch)) {
           // Notify the tabbrowser that the tab chrome has been restored.
           let tab = this._getTabForBrowser(browser);
           let tabData = browser.__SS_data;
 
           // wall-paper fix for bug 439675: make sure that the URL to be loaded
           // is always visible in the address bar
@@ -1374,36 +1368,16 @@ let SessionStoreInternal = {
       });
       var length = this._windows[aWindow.__SSi]._closedTabs.length;
       if (length > this._max_tabs_undo)
         this._windows[aWindow.__SSi]._closedTabs.splice(this._max_tabs_undo, length - this._max_tabs_undo);
     }
   },
 
   /**
-   * When a tab loads, invalidate its cached state, trigger async save.
-   *
-   * @param aWindow
-   *        Window reference
-   * @param aBrowser
-   *        Browser reference
-   */
-  onTabLoad: function ssi_onTabLoad(aWindow, aBrowser) {
-    // It's possible to get a load event after calling stop on a browser (when
-    // overwriting tabs). We want to return early if the tab hasn't been restored yet.
-    if (aBrowser.__SS_restoreState &&
-        aBrowser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) {
-      return;
-    }
-
-    delete aBrowser.__SS_data;
-    this.saveStateDelayed(aWindow);
-  },
-
-  /**
    * When a tab is selected, save session data
    * @param aWindow
    *        Window reference
    */
   onTabSelect: function ssi_onTabSelect(aWindow) {
     if (this._loadState == STATE_RUNNING) {
       this._windows[aWindow.__SSi].selected = aWindow.gBrowser.tabContainer.selectedIndex;