Firefox 54 compatibility: File.createFromFileName() returns a promise
This commit is contained in:
parent
a3eea03a38
commit
1b8704f133
|
@ -521,6 +521,10 @@ Zotero.Sync.Storage.Mode.WebDAV.prototype = {
|
||||||
file.append(item.key + '.zip');
|
file.append(item.key + '.zip');
|
||||||
Components.utils.importGlobalProperties(["File"]);
|
Components.utils.importGlobalProperties(["File"]);
|
||||||
file = File.createFromFileName ? File.createFromFileName(file.path) : new File(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);
|
var uri = this._getItemURI(item);
|
||||||
|
|
||||||
|
|
|
@ -613,6 +613,10 @@ Zotero.Sync.Storage.Mode.ZFS.prototype = {
|
||||||
|
|
||||||
Components.utils.importGlobalProperties(["File"]);
|
Components.utils.importGlobalProperties(["File"]);
|
||||||
file = File.createFromFileName ? File.createFromFileName(file.path) : new File(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]);
|
var blob = new Blob([params.prefix, file, params.suffix]);
|
||||||
|
|
||||||
|
|
|
@ -275,6 +275,11 @@ describe("Zotero.Sync.Storage.Mode.ZFS", function () {
|
||||||
var suffix1 = Zotero.Utilities.randomString();
|
var suffix1 = Zotero.Utilities.randomString();
|
||||||
var uploadKey1 = Zotero.Utilities.randomString(32, 'abcdef0123456789');
|
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
|
// HTML file with auxiliary image
|
||||||
var file2 = OS.Path.join(getTestDataDirectory().path, 'snapshot', 'index.html');
|
var file2 = OS.Path.join(getTestDataDirectory().path, 'snapshot', 'index.html');
|
||||||
var parentItem = yield createDataObject('item');
|
var parentItem = yield createDataObject('item');
|
||||||
|
@ -397,9 +402,7 @@ describe("Zotero.Sync.Storage.Mode.ZFS", function () {
|
||||||
(new Blob(
|
(new Blob(
|
||||||
[
|
[
|
||||||
prefix1,
|
prefix1,
|
||||||
File.createFromFileName
|
file1Blob,
|
||||||
? File.createFromFileName(file1.path)
|
|
||||||
: new File(file1),
|
|
||||||
suffix1
|
suffix1
|
||||||
]
|
]
|
||||||
).size)
|
).size)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user