зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 74dc73d33c56 (bug 1070096) for bustage on a CLOSED TREE
This commit is contained in:
Родитель
acb658c47e
Коммит
79b0a57f21
|
@ -44,8 +44,7 @@ const WINDOW_HIDEABLE_FEATURES = [
|
|||
"menubar", "toolbar", "locationbar", "personalbar", "statusbar", "scrollbars"
|
||||
];
|
||||
|
||||
// Messages that will be received via the Frame Message Manager.
|
||||
const FMM_MESSAGES = [
|
||||
const MESSAGES = [
|
||||
// The content script gives us a reference to an object that performs
|
||||
// synchronous collection of session data.
|
||||
"SessionStore:setupSyncHandler",
|
||||
|
@ -74,16 +73,6 @@ const FMM_MESSAGES = [
|
|||
"SessionStore:reloadPendingTab",
|
||||
];
|
||||
|
||||
// Messages that will be received via the Parent Process Message Manager.
|
||||
const PPMM_MESSAGES = [
|
||||
// A tab is being revived from the crashed state. The sender of this
|
||||
// message should actually be running in the parent process, since this
|
||||
// will be the crashed tab interface. We use the Child and Parent Process
|
||||
// Message Managers because the message is sent during framescript unload
|
||||
// when the Frame Message Manager is not available.
|
||||
"SessionStore:RemoteTabRevived",
|
||||
];
|
||||
|
||||
// These are tab events that we listen to.
|
||||
const TAB_EVENTS = [
|
||||
"TabOpen", "TabClose", "TabSelect", "TabShow", "TabHide", "TabPinned",
|
||||
|
@ -108,9 +97,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "gScreenManager",
|
|||
"@mozilla.org/gfx/screenmanager;1", "nsIScreenManager");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "Telemetry",
|
||||
"@mozilla.org/base/telemetry;1", "nsITelemetry");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageListenerManager");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "console",
|
||||
"resource://gre/modules/devtools/Console.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
|
||||
|
@ -310,11 +297,6 @@ let SessionStoreInternal = {
|
|||
// For each <browser> element being restored, records the current epoch.
|
||||
_browserEpochs: new WeakMap(),
|
||||
|
||||
// Any browsers that fires the oop-browser-crashed event gets stored in
|
||||
// here - that way we know which browsers to ignore messages from (until
|
||||
// they get restored).
|
||||
_crashedBrowsers: new WeakSet(),
|
||||
|
||||
// whether a setBrowserState call is in progress
|
||||
_browserSetState: false,
|
||||
|
||||
|
@ -401,8 +383,6 @@ let SessionStoreInternal = {
|
|||
Services.obs.addObserver(this, aTopic, true);
|
||||
}, this);
|
||||
|
||||
PPMM_MESSAGES.forEach(msg => ppmm.addMessageListener(msg, this));
|
||||
|
||||
this._initPrefs();
|
||||
this._initialized = true;
|
||||
},
|
||||
|
@ -529,8 +509,6 @@ let SessionStoreInternal = {
|
|||
|
||||
// Make sure to cancel pending saves.
|
||||
SessionSaver.cancel();
|
||||
|
||||
PPMM_MESSAGES.forEach(msg => ppmm.removeMessageListener(msg, this));
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -573,18 +551,9 @@ let SessionStoreInternal = {
|
|||
|
||||
/**
|
||||
* This method handles incoming messages sent by the session store content
|
||||
* script via the Frame Message Manager or Parent Process Message Manager,
|
||||
* and thus enables communication with OOP tabs.
|
||||
* script and thus enables communication with OOP tabs.
|
||||
*/
|
||||
receiveMessage(aMessage) {
|
||||
// We'll deal with any Parent Process Message Manager messages first...
|
||||
if (aMessage.name == "SessionStore:RemoteTabRevived") {
|
||||
this._crashedBrowsers.delete(aMessage.objects.browser);
|
||||
return;
|
||||
}
|
||||
|
||||
// If we got here, that means we're dealing with a frame message
|
||||
// manager message, so the target will be a <xul:browser>.
|
||||
receiveMessage: function ssi_receiveMessage(aMessage) {
|
||||
var browser = aMessage.target;
|
||||
var win = browser.ownerDocument.defaultView;
|
||||
let tab = this._getTabForBrowser(browser);
|
||||
|
@ -598,11 +567,6 @@ let SessionStoreInternal = {
|
|||
TabState.setSyncHandler(browser, aMessage.objects.handler);
|
||||
break;
|
||||
case "SessionStore:update":
|
||||
if (this._crashedBrowsers.has(browser.permanentKey)) {
|
||||
// Ignore messages from <browser> elements that have crashed
|
||||
// and not yet been revived.
|
||||
return;
|
||||
}
|
||||
this.recordTelemetry(aMessage.data.telemetry);
|
||||
TabState.update(browser, aMessage.data);
|
||||
this.saveStateDelayed(win);
|
||||
|
@ -687,7 +651,7 @@ let SessionStoreInternal = {
|
|||
}
|
||||
break;
|
||||
default:
|
||||
debug(`received unknown message '${aMessage.name}'`);
|
||||
debug("received unknown message '" + aMessage.name + "'");
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
@ -711,6 +675,7 @@ let SessionStoreInternal = {
|
|||
*/
|
||||
handleEvent: function ssi_handleEvent(aEvent) {
|
||||
var win = aEvent.currentTarget.ownerDocument.defaultView;
|
||||
let browser;
|
||||
switch (aEvent.type) {
|
||||
case "TabOpen":
|
||||
this.onTabAdd(win, aEvent.originalTarget);
|
||||
|
@ -735,9 +700,6 @@ let SessionStoreInternal = {
|
|||
case "SwapDocShells":
|
||||
this.saveStateDelayed(win);
|
||||
break;
|
||||
case "oop-browser-crashed":
|
||||
this._crashedBrowsers.add(aEvent.originalTarget);
|
||||
break;
|
||||
}
|
||||
this._clearRestoringWindows();
|
||||
},
|
||||
|
@ -776,7 +738,7 @@ let SessionStoreInternal = {
|
|||
aWindow.__SSi = this._generateWindowID();
|
||||
|
||||
let mm = aWindow.getGroupMessageManager("browsers");
|
||||
FMM_MESSAGES.forEach(msg => mm.addMessageListener(msg, this));
|
||||
MESSAGES.forEach(msg => mm.addMessageListener(msg, this));
|
||||
|
||||
// Load the frame script after registering listeners.
|
||||
mm.loadFrameScript("chrome://browser/content/content-sessionStore.js", true);
|
||||
|
@ -1105,7 +1067,7 @@ let SessionStoreInternal = {
|
|||
DyingWindowCache.set(aWindow, winData);
|
||||
|
||||
let mm = aWindow.getGroupMessageManager("browsers");
|
||||
FMM_MESSAGES.forEach(msg => mm.removeMessageListener(msg, this));
|
||||
MESSAGES.forEach(msg => mm.removeMessageListener(msg, this));
|
||||
|
||||
delete aWindow.__SSi;
|
||||
},
|
||||
|
@ -1298,7 +1260,6 @@ let SessionStoreInternal = {
|
|||
onTabAdd: function ssi_onTabAdd(aWindow, aTab, aNoNotification) {
|
||||
let browser = aTab.linkedBrowser;
|
||||
browser.addEventListener("SwapDocShells", this);
|
||||
browser.addEventListener("oop-browser-crashed", this);
|
||||
if (!aNoNotification) {
|
||||
this.saveStateDelayed(aWindow);
|
||||
}
|
||||
|
@ -1317,7 +1278,6 @@ let SessionStoreInternal = {
|
|||
let browser = aTab.linkedBrowser;
|
||||
delete browser.__SS_data;
|
||||
browser.removeEventListener("SwapDocShells", this);
|
||||
browser.removeEventListener("oop-browser-crashed", this);
|
||||
|
||||
// If this tab was in the middle of restoring or still needs to be restored,
|
||||
// we need to reset that state. If the tab was restoring, we will attempt to
|
||||
|
|
|
@ -29,10 +29,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "SessionHistory",
|
|||
XPCOMUtils.defineLazyModuleGetter(this, "SessionStorage",
|
||||
"resource:///modules/sessionstore/SessionStorage.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsISyncMessageSender");
|
||||
|
||||
Cu.import("resource:///modules/sessionstore/FrameTree.jsm", this);
|
||||
let gFrameTree = new FrameTree(this);
|
||||
|
||||
|
@ -715,35 +711,7 @@ ScrollPositionListener.init();
|
|||
DocShellCapabilitiesListener.init();
|
||||
PrivacyListener.init();
|
||||
|
||||
function handleRevivedTab() {
|
||||
if (content.document.documentURI.startsWith("about:tabcrashed")) {
|
||||
if (Services.appinfo.processType != Services.appinfo.PROCESS_TYPE_DEFAULT) {
|
||||
// Sanity check - we'd better be loading this in a non-remote browser.
|
||||
throw new Error("We seem to be navigating away from about:tabcrashed in " +
|
||||
"a non-remote browser. This should really never happen.");
|
||||
}
|
||||
|
||||
// We can't send a message using the frame message manager because by
|
||||
// the time we reach the unload event handler, it's "too late", and messages
|
||||
// won't be sent or received. The child-process message manager works though,
|
||||
// despite the fact that we're really running in the parent process.
|
||||
let browser = docShell.chromeEventHandler;
|
||||
cpmm.sendSyncMessage("SessionStore:RemoteTabRevived", null, {browser: browser});
|
||||
}
|
||||
}
|
||||
|
||||
// If we're browsing from the tab crashed UI to a blacklisted URI that keeps
|
||||
// this browser non-remote, we'll handle that in a pagehide event.
|
||||
addEventListener("pagehide", handleRevivedTab);
|
||||
|
||||
addEventListener("unload", () => {
|
||||
// If we're browsing from the tab crashed UI to a URI that causes the tab
|
||||
// to go remote again, we catch this in the unload event handler, because
|
||||
// swapping out the non-remote browser for a remote one in
|
||||
// tabbrowser.xml's updateBrowserRemoteness doesn't cause the pagehide
|
||||
// event to be fired.
|
||||
handleRevivedTab();
|
||||
|
||||
// Remove all registered nsIObservers.
|
||||
PageStyleListener.uninit();
|
||||
SessionStorageListener.uninit();
|
||||
|
|
Загрузка…
Ссылка в новой задаче