gecko-dev/toolkit/components/extensions/ext-c-downloads.js

23 строки
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]);
},
},
};
}
};