This commit is contained in:
Ryan VanderMeulen 2014-10-21 14:49:26 -04:00
Родитель b4e2d4ace0 ed15334031
Коммит 963387ab51
11 изменённых файлов: 143 добавлений и 30 удалений

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

@ -2576,8 +2576,8 @@ let BrowserOnClick = {
TabCrashReporter.submitCrashReport(browser);
}
#endif
TabCrashReporter.reloadCrashedTab(browser);
let tab = gBrowser.getTabForBrowser(browser);
SessionStore.reviveCrashedTab(tab);
}
},

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

@ -44,7 +44,8 @@ const WINDOW_HIDEABLE_FEATURES = [
"menubar", "toolbar", "locationbar", "personalbar", "statusbar", "scrollbars"
];
const MESSAGES = [
// Messages that will be received via the Frame Message Manager.
const FMM_MESSAGES = [
// The content script gives us a reference to an object that performs
// synchronous collection of session data.
"SessionStore:setupSyncHandler",
@ -73,6 +74,16 @@ const 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",
@ -97,7 +108,9 @@ 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",
@ -263,6 +276,10 @@ this.SessionStore = {
return SessionStoreInternal.getCurrentState(aUpdateAll);
},
reviveCrashedTab(aTab) {
return SessionStoreInternal.reviveCrashedTab(aTab);
},
/**
* Backstage pass to implementation details, used for testing purpose.
* Controlled by preference "browser.sessionstore.testmode".
@ -297,6 +314,11 @@ 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,
@ -383,6 +405,8 @@ let SessionStoreInternal = {
Services.obs.addObserver(this, aTopic, true);
}, this);
PPMM_MESSAGES.forEach(msg => ppmm.addMessageListener(msg, this));
this._initPrefs();
this._initialized = true;
},
@ -509,6 +533,8 @@ let SessionStoreInternal = {
// Make sure to cancel pending saves.
SessionSaver.cancel();
PPMM_MESSAGES.forEach(msg => ppmm.removeMessageListener(msg, this));
},
/**
@ -551,9 +577,18 @@ let SessionStoreInternal = {
/**
* This method handles incoming messages sent by the session store content
* script and thus enables communication with OOP tabs.
* script via the Frame Message Manager or Parent Process Message Manager,
* and thus enables communication with OOP tabs.
*/
receiveMessage: function ssi_receiveMessage(aMessage) {
receiveMessage(aMessage) {
// We'll deal with any Parent Process Message Manager messages first...
if (aMessage.name == "SessionStore:RemoteTabRevived") {
this._crashedBrowsers.delete(aMessage.objects.browser.permanentKey);
return;
}
// If we got here, that means we're dealing with a frame message
// manager message, so the target will be a <xul:browser>.
var browser = aMessage.target;
var win = browser.ownerDocument.defaultView;
let tab = this._getTabForBrowser(browser);
@ -567,6 +602,11 @@ 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);
@ -651,7 +691,7 @@ let SessionStoreInternal = {
}
break;
default:
debug("received unknown message '" + aMessage.name + "'");
debug(`received unknown message '${aMessage.name}'`);
break;
}
},
@ -675,7 +715,6 @@ 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);
@ -700,6 +739,9 @@ let SessionStoreInternal = {
case "SwapDocShells":
this.saveStateDelayed(win);
break;
case "oop-browser-crashed":
this._crashedBrowsers.add(aEvent.originalTarget.permanentKey);
break;
}
this._clearRestoringWindows();
},
@ -738,7 +780,7 @@ let SessionStoreInternal = {
aWindow.__SSi = this._generateWindowID();
let mm = aWindow.getGroupMessageManager("browsers");
MESSAGES.forEach(msg => mm.addMessageListener(msg, this));
FMM_MESSAGES.forEach(msg => mm.addMessageListener(msg, this));
// Load the frame script after registering listeners.
mm.loadFrameScript("chrome://browser/content/content-sessionStore.js", true);
@ -1067,7 +1109,7 @@ let SessionStoreInternal = {
DyingWindowCache.set(aWindow, winData);
let mm = aWindow.getGroupMessageManager("browsers");
MESSAGES.forEach(msg => mm.removeMessageListener(msg, this));
FMM_MESSAGES.forEach(msg => mm.removeMessageListener(msg, this));
delete aWindow.__SSi;
},
@ -1260,6 +1302,7 @@ 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);
}
@ -1278,6 +1321,7 @@ 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
@ -1908,6 +1952,35 @@ let SessionStoreInternal = {
LastSession.clear();
},
/**
* Revive a crashed tab and restore its state from before it crashed.
*
* @param aTab
* A <xul:tab> linked to a crashed browser. This is a no-op if the
* browser hasn't actually crashed, or is not associated with a tab.
* This function will also throw if the browser happens to be remote.
*/
reviveCrashedTab(aTab) {
if (!aTab) {
throw new Error("SessionStore.reviveCrashedTab expected a tab, but got null.");
}
let browser = aTab.linkedBrowser;
if (!this._crashedBrowsers.has(browser.permanentKey)) {
return;
}
// Sanity check - the browser to be revived should not be remote
// at this point.
if (browser.isRemoteBrowser) {
throw new Error("SessionStore.reviveCrashedTab: " +
"Somehow a crashed browser is still remote.")
}
let data = TabState.collect(aTab);
this.restoreTab(aTab, data);
},
/**
* See if aWindow is usable for use when restoring a previous session via
* restoreLastSession. If usable, prepare it for use.

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

@ -29,6 +29,10 @@ 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);
@ -711,7 +715,42 @@ ScrollPositionListener.init();
DocShellCapabilitiesListener.init();
PrivacyListener.init();
function handleRevivedTab() {
if (!content) {
removeEventListener("pagehide", handleRevivedTab);
return;
}
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.");
}
removeEventListener("pagehide", handleRevivedTab);
// 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();

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

@ -1,5 +1,4 @@
[DEFAULT]
skip-if = e10s # Most of these tests fail due to Bug ?????? - SessionStore is disabled in e10s
support-files =
dummy_page.html
head.js
@ -23,6 +22,7 @@ skip-if = buildapp == 'mulet'
[browser_tabview_bug587990.js]
[browser_tabview_bug588265.js]
[browser_tabview_bug589324.js]
skip-if = e10s # Bug 1086190
[browser_tabview_bug590606.js]
[browser_tabview_bug591706.js]
[browser_tabview_bug593283.js]
@ -36,6 +36,7 @@ skip-if = buildapp == 'mulet'
[browser_tabview_bug595930.js]
[browser_tabview_bug595943.js]
[browser_tabview_bug595965.js]
skip-if = e10s # Bug 1086190
[browser_tabview_bug596781.js]
[browser_tabview_bug597360.js]
[browser_tabview_bug597399.js]
@ -48,6 +49,7 @@ skip-if = true # Bug 711907
skip-if = os == 'linux' || e10s # Disabled on Linux: Bug 939620, much fail, so amaze; Disabled for e10s: Bug ??????
[browser_tabview_bug600645.js]
[browser_tabview_bug600812.js]
skip-if = e10s # Bug 1086190
[browser_tabview_bug602432.js]
skip-if = true # Bug 704417
[browser_tabview_bug604098.js]
@ -56,6 +58,7 @@ skip-if = true # Bug 704417
[browser_tabview_bug607108.js]
skip-if = os == 'linux' # Bug 947521
[browser_tabview_bug608037.js]
skip-if = e10s # Bug 1086190
[browser_tabview_bug608153.js]
[browser_tabview_bug608158.js]
[browser_tabview_bug608184.js]
@ -67,6 +70,7 @@ skip-if = true # Bug 736036
[browser_tabview_bug613541.js]
skip-if = os == "win" # Bug 951477
[browser_tabview_bug616729.js]
skip-if = e10s # Bug 1086190
[browser_tabview_bug616967.js]
[browser_tabview_bug618816.js]
[browser_tabview_bug618828.js]
@ -74,12 +78,14 @@ skip-if = buildapp == 'mulet'
[browser_tabview_bug619937.js]
[browser_tabview_bug622835.js]
[browser_tabview_bug623768.js]
skip-if = e10s # Bug 1086190
[browser_tabview_bug624265_perwindowpb.js]
skip-if = true # Bug 921984, hopefully fixed by bug 930202
[browser_tabview_bug624692.js]
[browser_tabview_bug624727_perwindowpb.js]
skip-if = buildapp == 'mulet'
[browser_tabview_bug624847.js]
skip-if = e10s # Bug 1086190
[browser_tabview_bug624931.js]
[browser_tabview_bug624953.js]
[browser_tabview_bug625195.js]
@ -87,7 +93,9 @@ skip-if = buildapp == 'mulet'
[browser_tabview_bug625424.js]
[browser_tabview_bug625955.js]
[browser_tabview_bug626368.js]
skip-if = e10s # Bug 1086190
[browser_tabview_bug626455.js]
skip-if = e10s # Bug 1086190
[browser_tabview_bug626525.js]
[browser_tabview_bug626791.js]
skip-if = buildapp == 'mulet'
@ -133,6 +141,7 @@ skip-if = true # Bug 754222
[browser_tabview_bug656778.js]
skip-if = os == "mac" # Bug 946918
[browser_tabview_bug656913.js]
skip-if = e10s # Bug 1086190
[browser_tabview_bug659594.js]
skip-if = os == "mac" || e10s # mac: Bug 939617; e10s - Bug ?????? - "leaked until shutdown [nsGlobalWindow #82 about:blank]"
[browser_tabview_bug662266.js]
@ -173,6 +182,7 @@ skip-if = buildapp == 'mulet'
skip-if = os == "mac" || os == "win" # Bug 945687
[browser_tabview_launch.js]
[browser_tabview_multiwindow_search.js]
skip-if = e10s # Bug 1086190
[browser_tabview_pending_tabs.js]
[browser_tabview_privatebrowsing_perwindowpb.js]
skip-if = os == 'linux' || e10s # linux: Bug 944300; e10s: bug ?????? - "leaked until shutdown [nsGlobalWindow #82 about:blank]"

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

@ -63,9 +63,8 @@ function endGame() {
}
function newWindowWithTabView(callback, completeCallback) {
let charsetArg = "charset=" + window.content.document.characterSet;
let win = window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no,height=800,width=800",
"about:blank", charsetArg, null, null, true);
"about:blank", null, null, null, true);
let onLoad = function() {
win.removeEventListener("load", onLoad, false);
let onShown = function() {

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

@ -9,10 +9,9 @@ function animateZoom() prefsBranch.getBoolPref("animate_zoom");
function test() {
waitForExplicitFinish();
let charsetArg = "charset=" + window.content.document.characterSet;
let win = window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no",
"about:blank", charsetArg, null, null, true);
"about:blank", null, null, null, true);
registerCleanupFunction(function() {
prefsBranch.setBoolPref("animate_zoom", true);

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

@ -103,7 +103,7 @@ loop-call-button3.label = Hello
loop-call-button3.tooltiptext = Start a conversation
social-share-button.label = Share This Page
social-share-button.tooltiptext = Share This Page
social-share-button.tooltiptext = Share this page
panic-button.label = Forget
panic-button.tooltiptext = Forget about some browsing history

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

@ -87,18 +87,6 @@ this.TabCrashReporter = {
}
},
reloadCrashedTab: function (browser) {
if (browser.isRemoteBrowser)
return;
let doc = browser.contentDocument;
if (!doc.documentURI.startsWith("about:tabcrashed"))
return;
let url = browser.currentURI.spec;
browser.loadURIWithFlags(url, Ci.nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
},
onAboutTabCrashedLoad: function (aBrowser) {
if (!this.childMap)
return;

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

@ -1937,6 +1937,10 @@ toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-icon {
background-clip: padding-box;
}
#urlbar[readonly] {
background-color: -moz-field;
}
@media (-moz-mac-lion-theme) {
#urlbar,
.searchbar-textbox {

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

@ -77,6 +77,7 @@ function init() {
// Fill "Last visited site" input with most recent history entry URL.
Services.obs.addObserver(function observer(aSubject, aTopic, aData) {
aData = aData.substring(0, 200);
document.getElementById("last-url").value = aData;
// Enable the parent div iff the URL is valid.
if (aData.length != 0) {

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

@ -59,7 +59,7 @@
<h1 class="header">&sad.header;</h1>
<form>
<div class="message">&sad.message;</div>
<textarea class="description" placeholder="&sad.placeholder;" rows="4" required="true"/>
<textarea class="description" placeholder="&sad.placeholder;" rows="4" required="true" maxlength="10000"/>
<div class="message" id="last-url-div">
<span>&sad.lastSite2;</span>
<input id="last-checkbox" type="checkbox" checked="checked"/>