mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-21 15:57:31 +09:00
Patch Bug 1346515, 1348955 and 1368981
This commit is contained in:
parent
a982bb3205
commit
c90243e4ee
2 changed files with 220 additions and 73 deletions
|
|
@ -645,6 +645,16 @@ extensions.registerSchemaAPI("downloads", "addon_parent", context => {
|
|||
},
|
||||
|
||||
open(downloadId) {
|
||||
// Restrict downloads.open() to explicit user-initiated calls.
|
||||
let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
if (browserWindow) {
|
||||
let winUtils = browserWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
if (!winUtils.isHandlingUserInput) {
|
||||
return Promise.reject({message: "downloads.open() may only be called from a user input handler"});
|
||||
}
|
||||
}
|
||||
|
||||
return DownloadMap.lazyInit().then(() => {
|
||||
let download = DownloadMap.fromId(downloadId).download;
|
||||
if (download.succeeded) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue