зеркало из https://github.com/mozilla/gecko-dev.git
23 строки
555 B
JavaScript
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]);
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
}
|
||
|
};
|