зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1391594 - If a window closes while hosting a <xul:browser> hung on script, clear the hang. r=billm
MozReview-Commit-ID: 88oj1bqA9To --HG-- extra : rebase_source : 1a5e5c81aae3e5df6cc0d8acc1d637513d01535b extra : source : 746826b8d17cdd1ce98ecf1d0529ae6e3e7e570a
This commit is contained in:
Родитель
e9f61a739a
Коммит
5ad52e1334
|
@ -255,6 +255,12 @@ var ProcessHangMonitor = {
|
|||
win.addEventListener("load", listener, true);
|
||||
break;
|
||||
}
|
||||
|
||||
case "domwindowclosed": {
|
||||
let win = subject.QueryInterface(Ci.nsIDOMWindow);
|
||||
this.onWindowClosed(win);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -270,6 +276,48 @@ var ProcessHangMonitor = {
|
|||
this.updateWindows();
|
||||
},
|
||||
|
||||
onWindowClosed(win) {
|
||||
let maybeStopHang = (report) => {
|
||||
if (report.hangType == report.SLOW_SCRIPT) {
|
||||
let hungBrowserWindow = null;
|
||||
try {
|
||||
hungBrowserWindow = report.scriptBrowser.ownerGlobal;
|
||||
} catch (e) {
|
||||
// Ignore failures to get the script browser - we'll be
|
||||
// conservative, and assume that if we cannot access the
|
||||
// window that belongs to this report that we should stop
|
||||
// the hang.
|
||||
}
|
||||
if (!hungBrowserWindow || hungBrowserWindow == win) {
|
||||
this.stopHang(report);
|
||||
return true;
|
||||
}
|
||||
} else if (report.hangType == report.PLUGIN_HANG) {
|
||||
// If any window has closed during a plug-in hang, we'll
|
||||
// do the conservative thing and terminate the plug-in.
|
||||
this.stopHang(report);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// If there are any script hangs for browsers that are in this window
|
||||
// that is closing, we can stop them now.
|
||||
for (let report of this._activeReports) {
|
||||
if (maybeStopHang(report)) {
|
||||
this._activeReports.delete(report);
|
||||
}
|
||||
}
|
||||
|
||||
for (let [pausedReport, ] of this._pausedReports) {
|
||||
if (maybeStopHang(pausedReport)) {
|
||||
this.removePausedReport(pausedReport);
|
||||
}
|
||||
}
|
||||
|
||||
this.updateWindows();
|
||||
},
|
||||
|
||||
stopAllHangs() {
|
||||
for (let report of this._activeReports) {
|
||||
this.stopHang(report);
|
||||
|
|
Загрузка…
Ссылка в новой задаче