forked from mirrors/gecko-dev
MozReview-Commit-ID: 9RkIOfZEfnf --HG-- extra : rebase_source : 0fa336cb476cb560fc2bb0117be32d463d11b414
22 lines
555 B
JavaScript
22 lines
555 B
JavaScript
"use strict";
|
|
|
|
var {
|
|
ExtensionError,
|
|
} = ExtensionUtils;
|
|
|
|
this.downloads = class extends ExtensionAPI {
|
|
getAPI(context) {
|
|
return {
|
|
downloads: {
|
|
open(downloadId) {
|
|
let winUtils = context.contentWindow.getInterface(Ci.nsIDOMWindowUtils);
|
|
if (!winUtils.isHandlingUserInput) {
|
|
throw new ExtensionError("May only open downloads from a user input handler");
|
|
}
|
|
|
|
return context.childManager.callParentAsyncFunction("downloads.open_parent", [downloadId]);
|
|
},
|
|
},
|
|
};
|
|
}
|
|
};
|