This commit is contained in:
Bill McCloskey 2014-01-22 16:52:07 -08:00
Родитель 67913e8980
Коммит 163ee6130a
1 изменённых файлов: 9 добавлений и 11 удалений

Просмотреть файл

@ -607,11 +607,6 @@ let SessionStoreInternal = {
receiveMessage: function ssi_receiveMessage(aMessage) { receiveMessage: function ssi_receiveMessage(aMessage) {
var browser = aMessage.target; var browser = aMessage.target;
var win = browser.ownerDocument.defaultView; 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) { switch (aMessage.name) {
case "SessionStore:pageshow": case "SessionStore:pageshow":
@ -635,6 +630,7 @@ let SessionStoreInternal = {
case "SessionStore:restoreHistoryComplete": case "SessionStore:restoreHistoryComplete":
if (this.isCurrentEpoch(browser, aMessage.data.epoch)) { if (this.isCurrentEpoch(browser, aMessage.data.epoch)) {
// Notify the tabbrowser that the tab chrome has been restored. // Notify the tabbrowser that the tab chrome has been restored.
let tab = this._getTabForBrowser(browser);
let tabData = browser.__SS_data; let tabData = browser.__SS_data;
// wall-paper fix for bug 439675: make sure that the URL to be loaded // wall-paper fix for bug 439675: make sure that the URL to be loaded
@ -685,6 +681,7 @@ let SessionStoreInternal = {
Services.obs.notifyObservers(browser, NOTIFY_TAB_RESTORED, null); Services.obs.notifyObservers(browser, NOTIFY_TAB_RESTORED, null);
} }
let tab = this._getTabForBrowser(browser);
if (tab) { if (tab) {
SessionStoreInternal._resetLocalTabRestoringState(tab); SessionStoreInternal._resetLocalTabRestoringState(tab);
SessionStoreInternal.restoreNextTab(); SessionStoreInternal.restoreNextTab();
@ -706,6 +703,7 @@ let SessionStoreInternal = {
break; break;
case "SessionStore:reloadPendingTab": case "SessionStore:reloadPendingTab":
if (this.isCurrentEpoch(browser, aMessage.data.epoch)) { if (this.isCurrentEpoch(browser, aMessage.data.epoch)) {
let tab = this._getTabForBrowser(browser);
if (tab && browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) { if (tab && browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) {
this.restoreTabContent(tab); this.restoreTabContent(tab);
} }
@ -821,12 +819,6 @@ let SessionStoreInternal = {
// internal data about the window. // internal data about the window.
aWindow.__SSi = this._generateWindowID(); 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 // and create its data object
this._windows[aWindow.__SSi] = { tabs: [], selected: 0, _closedTabs: [], busy: false }; this._windows[aWindow.__SSi] = { tabs: [], selected: 0, _closedTabs: [], busy: false };
@ -1351,6 +1343,12 @@ let SessionStoreInternal = {
let browser = aTab.linkedBrowser; let browser = aTab.linkedBrowser;
BROWSER_EVENTS.forEach(msg => browser.addEventListener(msg, this, true)); 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) { if (!aNoNotification) {
this.saveStateDelayed(aWindow); this.saveStateDelayed(aWindow);
} }