fx-compat: Fix Zotero.File.download()
This commit is contained in:
parent
8f7a160ba1
commit
dfff86df72
2 changed files with 10 additions and 7 deletions
|
@ -474,7 +474,6 @@ Zotero.File = new function(){
|
|||
// NOTE: This noop callback is required, do not remove.
|
||||
},
|
||||
onStopRequest(request, status) {
|
||||
const responseStatus = 'responseStatus' in request ? request.responseStatus : null;
|
||||
pipe.outputStream.close();
|
||||
|
||||
if (!Components.isSuccessCode(status)) {
|
||||
|
@ -490,11 +489,14 @@ Zotero.File = new function(){
|
|||
return;
|
||||
}
|
||||
|
||||
if (isHTTP && responseStatus != 200) {
|
||||
let msg = `Download failed with response code ${responseStatus}`;
|
||||
Zotero.logError(msg);
|
||||
deferred.reject(new Error(msg));
|
||||
return;
|
||||
if (isHTTP) {
|
||||
let statusCode = request.QueryInterface(Ci.nsIHttpChannel).responseStatus;
|
||||
if (statusCode != 200) {
|
||||
let msg = `Download failed with response code ${responseStatus}`;
|
||||
Zotero.logError(msg);
|
||||
deferred.reject(new Error(msg));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -493,7 +493,8 @@ describe("Zotero.File", function () {
|
|||
|
||||
it("should concurrently download three large files", async function () {
|
||||
const url = `${baseURL}/file1.txt`;
|
||||
|
||||
|
||||
var { ConcurrentCaller } = ChromeUtils.import("resource://zotero/concurrentCaller.js");
|
||||
var caller = new ConcurrentCaller({
|
||||
numConcurrent: 3,
|
||||
Promise: Zotero.Promise,
|
||||
|
|
Loading…
Add table
Reference in a new issue