Bug 1196144 - source window disappearance still breaks downloading to custom directories on windows, r=felipe

--HG--
extra : commitid : BEPBh9mXgLl
extra : rebase_source : c8ba4642f694c163355483cdcaba189c864cea8b
This commit is contained in:
Gijs Kruitbosch 2015-09-25 16:17:27 +01:00
Родитель 7d1a62abc2
Коммит 1098b0f5ba
1 изменённых файлов: 15 добавлений и 1 удалений

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

@ -228,7 +228,21 @@ nsUnknownContentTypeDialog.prototype = {
// because the original one is definitely gone (and nsIFilePicker doesn't like
// a null parent):
gDownloadLastDir = this._mDownloadDir;
parent = Services.wm.getMostRecentWindow("");
let windowsEnum = Services.wm.getEnumerator("");
while (windowsEnum.hasMoreElements()) {
let someWin = windowsEnum.getNext();
// We need to make sure we don't end up with this dialog, because otherwise
// that's going to go away when the user clicks "Save", and that breaks the
// windows file picker that's supposed to show up if we let the user choose
// where to save files...
if (someWin != this.mDialog) {
parent = someWin;
}
}
if (!parent) {
Cu.reportError("No candidate parent windows were found for the save filepicker." +
"This should never happen.");
}
}
Task.spawn(function() {