Bug 961861 - [e10s] Make sure content-sessionStore.js is always loaded (r=ttaubert)

This commit is contained in:
Bill McCloskey 2014-01-31 12:13:23 -08:00
parent 013fc50cd5
commit 684abfe257
2 changed files with 17 additions and 12 deletions

View File

@ -50,6 +50,9 @@ let SessionHistoryInternal = {
isEmpty: function (docShell) {
let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
let history = webNavigation.sessionHistory;
if (!webNavigation.currentURI) {
return true;
}
let uri = webNavigation.currentURI.spec;
return uri == "about:blank" && history.count == 0;
},

View File

@ -580,6 +580,11 @@ let SessionStoreInternal = {
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:setupSyncHandler":
@ -593,7 +598,6 @@ let SessionStoreInternal = {
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
@ -644,7 +648,6 @@ let SessionStoreInternal = {
Services.obs.notifyObservers(browser, NOTIFY_TAB_RESTORED, null);
}
let tab = this._getTabForBrowser(browser);
if (tab) {
SessionStoreInternal._resetLocalTabRestoringState(tab);
SessionStoreInternal.restoreNextTab();
@ -666,7 +669,6 @@ let SessionStoreInternal = {
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);
}
@ -760,6 +762,12 @@ let SessionStoreInternal = {
// 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 };
@ -1082,6 +1090,9 @@ let SessionStoreInternal = {
// Cache the window state until it is completely gone.
DyingWindowCache.set(aWindow, winData);
let mm = aWindow.messageManager;
MESSAGES.forEach(msg => mm.removeMessageListener(msg, this));
delete aWindow.__SSi;
},
@ -1280,12 +1291,6 @@ let SessionStoreInternal = {
* bool Do not save state if we're updating an existing tab
*/
onTabAdd: function ssi_onTabAdd(aWindow, aTab, aNoNotification) {
let mm = aTab.linkedBrowser.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);
}
@ -1302,9 +1307,6 @@ let SessionStoreInternal = {
*/
onTabRemove: function ssi_onTabRemove(aWindow, aTab, aNoNotification) {
let browser = aTab.linkedBrowser;
let mm = browser.messageManager;
MESSAGES.forEach(msg => mm.removeMessageListener(msg, this));
delete browser.__SS_data;
// If this tab was in the middle of restoring or still needs to be restored,