diff --git a/chrome/content/zotero/xpcom/storage/webdav.js b/chrome/content/zotero/xpcom/storage/webdav.js index 1633efc1c8..b6953d14c7 100644 --- a/chrome/content/zotero/xpcom/storage/webdav.js +++ b/chrome/content/zotero/xpcom/storage/webdav.js @@ -521,6 +521,10 @@ Zotero.Sync.Storage.Mode.WebDAV.prototype = { file.append(item.key + '.zip'); Components.utils.importGlobalProperties(["File"]); file = File.createFromFileName ? File.createFromFileName(file.path) : new File(file); + // File.createFromFileName() returns a Promise in Fx54+ + if (file.then) { + file = yield file; + } var uri = this._getItemURI(item); diff --git a/chrome/content/zotero/xpcom/storage/zfs.js b/chrome/content/zotero/xpcom/storage/zfs.js index 15d3af8be8..563a78a3c6 100644 --- a/chrome/content/zotero/xpcom/storage/zfs.js +++ b/chrome/content/zotero/xpcom/storage/zfs.js @@ -613,6 +613,10 @@ Zotero.Sync.Storage.Mode.ZFS.prototype = { Components.utils.importGlobalProperties(["File"]); file = File.createFromFileName ? File.createFromFileName(file.path) : new File(file); + // File.createFromFileName() returns a Promise in Fx54+ + if (file.then) { + file = yield file; + } var blob = new Blob([params.prefix, file, params.suffix]); diff --git a/test/tests/zfsTest.js b/test/tests/zfsTest.js index 434bad715e..f21bd3624b 100644 --- a/test/tests/zfsTest.js +++ b/test/tests/zfsTest.js @@ -275,6 +275,11 @@ describe("Zotero.Sync.Storage.Mode.ZFS", function () { var suffix1 = Zotero.Utilities.randomString(); var uploadKey1 = Zotero.Utilities.randomString(32, 'abcdef0123456789'); + let file1Blob = File.createFromFileName ? File.createFromFileName(file1.path) : new File(file1); + if (file1Blob.then) { + file1Blob = yield file1Blob; + } + // HTML file with auxiliary image var file2 = OS.Path.join(getTestDataDirectory().path, 'snapshot', 'index.html'); var parentItem = yield createDataObject('item'); @@ -397,9 +402,7 @@ describe("Zotero.Sync.Storage.Mode.ZFS", function () { (new Blob( [ prefix1, - File.createFromFileName - ? File.createFromFileName(file1.path) - : new File(file1), + file1Blob, suffix1 ] ).size)