Merge branch 'fx36-saveURI' into 4.0
This commit is contained in:
commit
d8f2d4b268
6 changed files with 24 additions and 43 deletions
|
@ -392,13 +392,7 @@ Zotero_Preferences.Search = {
|
|||
|
||||
wbp.progressListener = progressListener;
|
||||
Zotero.debug("Saving " + uri.spec + " to " + fileURL.spec);
|
||||
try {
|
||||
wbp.saveURI(uri, null, null, null, null, fileURL);
|
||||
} catch(e if e.name === "NS_ERROR_XPC_NOT_ENOUGH_ARGS") {
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=794602
|
||||
// XXX Always use when we no longer support Firefox < 18
|
||||
wbp.saveURI(uri, null, null, null, null, fileURL, null);
|
||||
}
|
||||
Zotero.Utilities.Internal.saveURI(wbp, nsIURL, file);
|
||||
},
|
||||
|
||||
|
||||
|
|
|
@ -672,13 +672,7 @@ var wpdCommon = {
|
|||
|
||||
// has the url the same filetype like the file extension?
|
||||
//save file to target
|
||||
try {
|
||||
obj_Persist.saveURI(obj_URI, null, null, null, null, obj_TargetFile);
|
||||
} catch(e if e.name === "NS_ERROR_XPC_NOT_ENOUGH_ARGS") {
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=794602
|
||||
// XXX Always use when we no longer support Firefox < 18
|
||||
obj_Persist.saveURI(obj_URI, null, null, null, null, obj_TargetFile, null);
|
||||
}
|
||||
Zotero.Utilities.Internal.saveURI(wbp, nsIURL, file);
|
||||
|
||||
return true;
|
||||
|
||||
|
|
|
@ -347,13 +347,8 @@ Zotero.Attachments = new function(){
|
|||
var nsIURL = Components.classes["@mozilla.org/network/standard-url;1"]
|
||||
.createInstance(Components.interfaces.nsIURL);
|
||||
nsIURL.spec = url;
|
||||
try {
|
||||
wbp.saveURI(nsIURL, null, null, null, null, file);
|
||||
} catch(e if e.name === "NS_ERROR_XPC_NOT_ENOUGH_ARGS") {
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=794602
|
||||
// XXX Always use when we no longer support Firefox < 18
|
||||
wbp.saveURI(nsIURL, null, null, null, null, file, null);
|
||||
}
|
||||
Zotero.Utilities.saveURI(wbp, nsIURL, file);
|
||||
|
||||
|
||||
return attachmentItem;
|
||||
}
|
||||
|
@ -664,13 +659,7 @@ Zotero.Attachments = new function(){
|
|||
throw (e);
|
||||
}
|
||||
});
|
||||
try {
|
||||
wbp.saveURI(nsIURL, null, null, null, null, file);
|
||||
} catch(e if e.name === "NS_ERROR_XPC_NOT_ENOUGH_ARGS") {
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=794602
|
||||
// XXX Always use when we no longer support Firefox < 18
|
||||
wbp.saveURI(nsIURL, null, null, null, null, file, null);
|
||||
}
|
||||
Zotero.Utilities.Internal.saveURI(wbp, nsIURL, file);
|
||||
}
|
||||
|
||||
// Add to collections
|
||||
|
|
|
@ -963,13 +963,7 @@ Zotero.Sync.Storage.WebDAV = (function () {
|
|||
.createInstance(nsIWBP);
|
||||
wbp.persistFlags = nsIWBP.PERSIST_FLAGS_BYPASS_CACHE;
|
||||
wbp.progressListener = listener;
|
||||
try {
|
||||
wbp.saveURI(uri, null, null, null, null, destFile);
|
||||
} catch(e if e.name === "NS_ERROR_XPC_NOT_ENOUGH_ARGS") {
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=794602
|
||||
// XXX Always use when we no longer support Firefox < 18
|
||||
wbp.saveURI(uri, null, null, null, null, destFile, null);
|
||||
}
|
||||
Zotero.Utilities.Internal.saveURI(wbp, nsIURL, file);
|
||||
|
||||
return deferred.promise;
|
||||
});
|
||||
|
|
|
@ -944,13 +944,7 @@ Zotero.Sync.Storage.ZFS = (function () {
|
|||
.createInstance(nsIWBP);
|
||||
wbp.persistFlags = nsIWBP.PERSIST_FLAGS_BYPASS_CACHE;
|
||||
wbp.progressListener = listener;
|
||||
try {
|
||||
wbp.saveURI(uri, null, null, null, null, destFile);
|
||||
} catch(e if e.name === "NS_ERROR_XPC_NOT_ENOUGH_ARGS") {
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=794602
|
||||
// XXX Always use when we no longer support Firefox < 18
|
||||
wbp.saveURI(uri, null, null, null, null, destFile, null);
|
||||
}
|
||||
Zotero.Utilities.Internal.saveURI(wbp, nsIURL, file);
|
||||
|
||||
return deferred.promise;
|
||||
});
|
||||
|
|
|
@ -469,5 +469,21 @@ Zotero.Utilities.Internal.Base64 = {
|
|||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* saveURI wrapper function
|
||||
* @param {nsIWebBrowserPersist} nsIWebBrowserPersist
|
||||
* @param {nsIURI} source URL
|
||||
* @param {nsISupports} target file
|
||||
*/
|
||||
saveURI: function (wbp, source, target) {
|
||||
// Firefox 35 and below
|
||||
try {
|
||||
wbp.saveURI(source, null, null, null, null, target, null);
|
||||
}
|
||||
// Firefox 36+ needs one more parameter
|
||||
catch (e if e.name === "NS_ERROR_XPC_NOT_ENOUGH_ARGS") {
|
||||
wbp.saveURI(source, null, null, null, null, null, target, null);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue