зеркало из https://github.com/mozilla/pjs.git
Bug 414214 - Download Manager window doesn't stay open when browser.download.manager.closeWhenDone is true. r=Mano, a=mconnor
This commit is contained in:
Родитель
d0bb7cb8a4
Коммит
c6e00ccede
|
@ -2993,7 +2993,7 @@ function toJavaScriptConsole()
|
|||
function BrowserDownloadsUI()
|
||||
{
|
||||
Cc["@mozilla.org/download-manager-ui;1"].
|
||||
getService(Ci.nsIDownloadManagerUI).show();
|
||||
getService(Ci.nsIDownloadManagerUI).show(window);
|
||||
}
|
||||
|
||||
function toOpenWindowByType(inType, uri, features)
|
||||
|
|
|
@ -47,6 +47,7 @@ include $(topsrcdir)/config/rules.mk
|
|||
|
||||
_BROWSER_FILES = \
|
||||
browser_nsIDownloadManagerUI.js \
|
||||
browser_bug414214.js \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_BROWSER_FILES)
|
||||
|
|
|
@ -56,10 +56,23 @@ function test()
|
|||
Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch).
|
||||
setBoolPref(PREF_BDM_CLOSEWHENDONE, true);
|
||||
|
||||
// OK, let's pull up the UI
|
||||
// Linux uses y, everything else is j
|
||||
var key = navigator.platform.match("Linux") ? "y" : "j";
|
||||
EventUtils.synthesizeKey(key, {metaKey: true}, window.opener);
|
||||
var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
||||
getService(Ci.nsIWindowWatcher);
|
||||
|
||||
// register a callback to add a load listener to know when the download
|
||||
// manager opens
|
||||
var obs = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
// unregister ourself
|
||||
ww.unregisterNotification(this);
|
||||
|
||||
var win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
|
||||
win.addEventListener("DOMContentLoaded", finishUp, false);
|
||||
}
|
||||
};
|
||||
|
||||
// register our observer
|
||||
ww.registerNotification(obs);
|
||||
|
||||
// The window doesn't open once we call show, so we need to wait a little bit
|
||||
function finishUp() {
|
||||
|
@ -74,6 +87,10 @@ function test()
|
|||
finish();
|
||||
}
|
||||
|
||||
// OK, let's pull up the UI
|
||||
// Linux uses y, everything else is j
|
||||
var key = navigator.platform.match("Linux") ? "y" : "j";
|
||||
EventUtils.synthesizeKey(key, {metaKey: true}, window.opener);
|
||||
|
||||
waitForExplicitFinish();
|
||||
window.setTimeout(finishUp, 1000);
|
||||
}
|
||||
|
|
|
@ -107,6 +107,24 @@ function test()
|
|||
if (win)
|
||||
win.close();
|
||||
|
||||
var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
||||
getService(Ci.nsIWindowWatcher);
|
||||
|
||||
// register a callback to add a load listener to know when the download
|
||||
// manager opens
|
||||
var obs = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
// unregister ourself
|
||||
ww.unregisterNotification(this);
|
||||
|
||||
var win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
|
||||
win.addEventListener("DOMContentLoaded", finishUp, false);
|
||||
}
|
||||
};
|
||||
|
||||
// register our observer
|
||||
ww.registerNotification(obs);
|
||||
|
||||
// OK, now that all the data is in, let's pull up the UI
|
||||
Cc["@mozilla.org/download-manager-ui;1"].
|
||||
getService(Ci.nsIDownloadManagerUI).show();
|
||||
|
@ -123,5 +141,4 @@ function test()
|
|||
}
|
||||
|
||||
waitForExplicitFinish();
|
||||
window.setTimeout(finishUp, 1000);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче