mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 963358 - [e10s] Crashed tab page's Try Again button doesn't always work. r=billm.
Instead of attaching / listening for click events in BrowserOnClick for the Try Again button, we instead bubble up an event when the Try Again button is clicked. That event has a listener set up for it that is established during delayedStartup, so it has a very high probability of being set. This bypasses some error cases where we hadn't successfully attached BrowserOnClick in the past. --HG-- extra : rebase_source : 19c7d7157a8bd24a1a39bda4072d7c01cd398756
This commit is contained in:
parent
f448c583e7
commit
65b0f9a470
@ -12,6 +12,22 @@ function parseQueryString() {
|
||||
|
||||
document.title = parseQueryString();
|
||||
|
||||
addEventListener("DOMContentLoaded", () => {
|
||||
let tryAgain = document.getElementById("tryAgain");
|
||||
let sendCrashReport = document.getElementById("checkSendReport");
|
||||
|
||||
tryAgain.addEventListener("click", () => {
|
||||
let event = new CustomEvent("AboutTabCrashedTryAgain", {
|
||||
bubbles: true,
|
||||
detail: {
|
||||
sendCrashReport: sendCrashReport.checked,
|
||||
},
|
||||
});
|
||||
|
||||
document.dispatchEvent(event);
|
||||
});
|
||||
});
|
||||
|
||||
// Error pages are loaded as LOAD_BACKGROUND, so they don't get load events.
|
||||
var event = new CustomEvent("AboutTabCrashedLoad", {bubbles:true});
|
||||
document.dispatchEvent(event);
|
||||
|
@ -1142,6 +1142,28 @@ var gBrowserInit = {
|
||||
#endif
|
||||
}, false, true);
|
||||
|
||||
gBrowser.addEventListener("AboutTabCrashedTryAgain", function(event) {
|
||||
let ownerDoc = event.originalTarget;
|
||||
|
||||
if (!ownerDoc.documentURI.startsWith("about:tabcrashed")) {
|
||||
return;
|
||||
}
|
||||
|
||||
let isTopFrame = (ownerDoc.defaultView.parent === ownerDoc.defaultView);
|
||||
if (!isTopFrame) {
|
||||
return;
|
||||
}
|
||||
|
||||
let browser = gBrowser.getBrowserForDocument(ownerDoc);
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
if (event.detail.sendCrashReport) {
|
||||
TabCrashReporter.submitCrashReport(browser);
|
||||
}
|
||||
#endif
|
||||
let tab = gBrowser.getTabForBrowser(browser);
|
||||
SessionStore.reviveCrashedTab(tab);
|
||||
}, false, true);
|
||||
|
||||
if (uriToLoad && uriToLoad != "about:blank") {
|
||||
if (uriToLoad instanceof Ci.nsISupportsArray) {
|
||||
let count = uriToLoad.Count();
|
||||
@ -2606,9 +2628,6 @@ let BrowserOnClick = {
|
||||
ownerDoc.documentURI.toLowerCase() == "about:newtab") {
|
||||
this.onE10sAboutNewTab(event, ownerDoc);
|
||||
}
|
||||
else if (ownerDoc.documentURI.startsWith("about:tabcrashed")) {
|
||||
this.onAboutTabCrashed(event, ownerDoc);
|
||||
}
|
||||
},
|
||||
|
||||
receiveMessage: function (msg) {
|
||||
@ -2869,29 +2888,6 @@ let BrowserOnClick = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* The about:tabcrashed can't do window.reload() because that
|
||||
* would reload the page but not use a remote browser.
|
||||
*/
|
||||
onAboutTabCrashed: function(event, ownerDoc) {
|
||||
let isTopFrame = (ownerDoc.defaultView.parent === ownerDoc.defaultView);
|
||||
if (!isTopFrame) {
|
||||
return;
|
||||
}
|
||||
|
||||
let button = event.originalTarget;
|
||||
if (button.id == "tryAgain") {
|
||||
let browser = gBrowser.getBrowserForDocument(ownerDoc);
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
if (ownerDoc.getElementById("checkSendReport").checked) {
|
||||
TabCrashReporter.submitCrashReport(browser);
|
||||
}
|
||||
#endif
|
||||
let tab = gBrowser.getTabForBrowser(browser);
|
||||
SessionStore.reviveCrashedTab(tab);
|
||||
}
|
||||
},
|
||||
|
||||
ignoreWarningButton: function (isMalware) {
|
||||
// Allow users to override and continue through to the site,
|
||||
// but add a notify bar as a reminder, so that they don't lose
|
||||
|
Loading…
Reference in New Issue
Block a user