Backout bug 961861
authorBill McCloskey <wmccloskey@mozilla.com>
Wed, 22 Jan 2014 16:52:07 -0800
changeset 164793 b9d9649e7ec015a5d68baa3606db9b53637a3a56
parent 164752 cad591993bfa410da4954c2f9e8617818b6a216d
child 164794 d418cc97bacb83e47684134af5d496c583e67341
child 165087 2e872f3b2b3e4d2f21d966acbeb268a1ce345887
push id38817
push usercbook@mozilla.com
push dateThu, 23 Jan 2014 10:29:13 +0000
treeherdermozilla-inbound@7fdda1995af8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs961861
milestone29.0a1
first release with
nightly linux32
b9d9649e7ec0 / 29.0a1 / 20140123030204 / files
nightly linux64
b9d9649e7ec0 / 29.0a1 / 20140123030204 / files
nightly mac
b9d9649e7ec0 / 29.0a1 / 20140123030204 / files
nightly win32
b9d9649e7ec0 / 29.0a1 / 20140123030204 / files
nightly win64
b9d9649e7ec0 / 29.0a1 / 20140123030204 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backout bug 961861
browser/components/sessionstore/src/SessionStore.jsm
--- a/browser/components/sessionstore/src/SessionStore.jsm
+++ b/browser/components/sessionstore/src/SessionStore.jsm
@@ -602,21 +602,16 @@ let SessionStoreInternal = {
 
   /**
    * This method handles incoming messages sent by the session store content
    * script and thus enables communication with OOP tabs.
    */
   receiveMessage: function ssi_receiveMessage(aMessage) {
     var browser = aMessage.target;
     var win = browser.ownerDocument.defaultView;
-    let tab = this._getTabForBrowser(browser);
-    if (!tab) {
-      // Ignore messages from <browser> elements that are not tabs.
-      return;
-    }
 
     switch (aMessage.name) {
       case "SessionStore:pageshow":
         this.onTabLoad(win, browser);
         break;
       case "SessionStore:loadStart":
         TabStateCache.delete(browser);
         break;
@@ -630,16 +625,17 @@ let SessionStoreInternal = {
         break;
       case "SessionStore:load":
         TabStateCache.delete(browser);
         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
           let activePageData = tabData.entries[tabData.index - 1] || null;
           let uri = activePageData ? activePageData.url || null : null;
           browser.userTypedValue = uri;
 
@@ -680,16 +676,17 @@ let SessionStoreInternal = {
       case "SessionStore:restoreTabContentComplete":
         if (this.isCurrentEpoch(browser, aMessage.data.epoch)) {
           // This callback is used exclusively by tests that want to
           // monitor the progress of network loads.
           if (gDebuggingEnabled) {
             Services.obs.notifyObservers(browser, NOTIFY_TAB_RESTORED, null);
           }
 
+          let tab = this._getTabForBrowser(browser);
           if (tab) {
             SessionStoreInternal._resetLocalTabRestoringState(tab);
             SessionStoreInternal.restoreNextTab();
           }
         }
         break;
       case "SessionStore:restoreDocumentComplete":
         if (this.isCurrentEpoch(browser, aMessage.data.epoch)) {
@@ -701,16 +698,17 @@ let SessionStoreInternal = {
           delete browser.__SS_restore_tab;
           delete browser.__SS_data;
 
           this._sendTabRestoredNotification(tab);
         }
         break;
       case "SessionStore:reloadPendingTab":
         if (this.isCurrentEpoch(browser, aMessage.data.epoch)) {
+          let tab = this._getTabForBrowser(browser);
           if (tab && browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) {
             this.restoreTabContent(tab);
           }
         }
         break;
       default:
         debug("received unknown message '" + aMessage.name + "'");
         break;
@@ -816,22 +814,16 @@ let SessionStoreInternal = {
     // ignore windows opened while shutting down
     if (this._loadState == STATE_QUITTING)
       return;
 
     // Assign the window a unique identifier we can use to reference
     // internal data about the window.
     aWindow.__SSi = this._generateWindowID();
 
-    let mm = aWindow.messageManager;
-    MESSAGES.forEach(msg => mm.addMessageListener(msg, this));
-
-    // Load the frame script after registering listeners.
-    mm.loadFrameScript("chrome://browser/content/content-sessionStore.js", true);
-
     // and create its data object
     this._windows[aWindow.__SSi] = { tabs: [], selected: 0, _closedTabs: [], busy: false };
 
     let isPrivateWindow = false;
     if (PrivateBrowsingUtils.isWindowPrivate(aWindow))
       this._windows[aWindow.__SSi].isPrivate = isPrivateWindow = true;
     if (!this._isWindowLoaded(aWindow))
       this._windows[aWindow.__SSi]._restoring = true;
@@ -1346,16 +1338,22 @@ let SessionStoreInternal = {
    *        Tab reference
    * @param aNoNotification
    *        bool Do not save state if we're updating an existing tab
    */
   onTabAdd: function ssi_onTabAdd(aWindow, aTab, aNoNotification) {
     let browser = aTab.linkedBrowser;
     BROWSER_EVENTS.forEach(msg => browser.addEventListener(msg, this, true));
 
+    let mm = browser.messageManager;
+    MESSAGES.forEach(msg => mm.addMessageListener(msg, this));
+
+    // Load the frame script after registering listeners.
+    mm.loadFrameScript("chrome://browser/content/content-sessionStore.js", false);
+
     if (!aNoNotification) {
       this.saveStateDelayed(aWindow);
     }
 
     this._updateCrashReportURL(aWindow);
   },
 
   /**