mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 12:37:37 +00:00
Bug 1059308 - Switch to the next available top level window when the current one is destroyed. r=jryans
This commit is contained in:
parent
f99c89ffdd
commit
a5270da9e8
@ -1017,10 +1017,24 @@ TabActor.prototype = {
|
||||
}
|
||||
|
||||
if (webProgress.DOMWindow == this._originalWindow) {
|
||||
// If the original top level document we connected to is removed,
|
||||
// we try to switch to any other top level document
|
||||
let rootDocShells = this.docShells
|
||||
.filter(d => {
|
||||
return d != this.docShell &&
|
||||
this._isRootDocShell(d);
|
||||
});
|
||||
if (rootDocShells.length > 0) {
|
||||
let newRoot = rootDocShells[0];
|
||||
this._originalWindow = newRoot.DOMWindow;
|
||||
this._changeTopLevelDocument(this._originalWindow);
|
||||
} else {
|
||||
// If for some reason (typically during Firefox shutdown), the original
|
||||
// document is destroyed, we detach the tab actor to unregister all listeners
|
||||
// and prevent any exception.
|
||||
// document is destroyed, and there is no other top level docshell,
|
||||
// we detach the tab actor to unregister all listeners and prevent any
|
||||
// exception
|
||||
this.exit();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user