Bug 1211637 - if there's no docShell (on a local tab) or permitUnload times out (on a remote tab), close the tab, r=billm

MozReview-Commit-ID: Cihru0TVxNc

--HG--
extra : rebase_source : 5c9bcee84eb0b1f6daaa1fa8d317fc700fe40909
This commit is contained in:
Gijs Kruitbosch 2016-09-15 16:17:17 +01:00
parent 6724430882
commit 8a285ee959
2 changed files with 3 additions and 3 deletions

View File

@ -2368,12 +2368,12 @@
// processes the event queue and may lead to another removeTab() // processes the event queue and may lead to another removeTab()
// call before permitUnload() returns. // call before permitUnload() returns.
aTab._pendingPermitUnload = true; aTab._pendingPermitUnload = true;
let {permitUnload} = browser.permitUnload(); let {permitUnload, timedOut} = browser.permitUnload();
delete aTab._pendingPermitUnload; delete aTab._pendingPermitUnload;
// If we were closed during onbeforeunload, we return false now // If we were closed during onbeforeunload, we return false now
// so we don't (try to) close the same tab again. Of course, we // so we don't (try to) close the same tab again. Of course, we
// also stop if the unload was cancelled by the user: // also stop if the unload was cancelled by the user:
if (aTab.closing || !permitUnload) { if (aTab.closing || (!timedOut && !permitUnload)) {
// NB: deliberately keep the _closedDuringPermitUnload set to // NB: deliberately keep the _closedDuringPermitUnload set to
// true so we keep exiting early in case of multiple calls. // true so we keep exiting early in case of multiple calls.
return false; return false;

View File

@ -1312,7 +1312,7 @@
<body> <body>
<![CDATA[ <![CDATA[
if (!this.docShell || !this.docShell.contentViewer) { if (!this.docShell || !this.docShell.contentViewer) {
return true; return {permitUnload: true, timedOut: false};
} }
return {permitUnload: this.docShell.contentViewer.permitUnload(), timedOut: false}; return {permitUnload: this.docShell.contentViewer.permitUnload(), timedOut: false};
]]> ]]>