diff --git a/chrome/content/zotero/preferences/preferences_search.js b/chrome/content/zotero/preferences/preferences_search.js index 42bcc18318..5f7743c053 100644 --- a/chrome/content/zotero/preferences/preferences_search.js +++ b/chrome/content/zotero/preferences/preferences_search.js @@ -392,7 +392,7 @@ Zotero_Preferences.Search = { wbp.progressListener = progressListener; Zotero.debug("Saving " + uri.spec + " to " + fileURL.spec); - Zotero.Utilities.Internal.saveURI(wbp, nsIURL, file); + Zotero.Utilities.Internal.saveURI(wbp, uri, fileURL); }, diff --git a/chrome/content/zotero/webpagedump/common.js b/chrome/content/zotero/webpagedump/common.js index 00dbfb43f7..6583263386 100644 --- a/chrome/content/zotero/webpagedump/common.js +++ b/chrome/content/zotero/webpagedump/common.js @@ -672,7 +672,7 @@ var wpdCommon = { // has the url the same filetype like the file extension? //save file to target - Zotero.Utilities.Internal.saveURI(wbp, nsIURL, file); + Zotero.Utilities.Internal.saveURI(wbp, obj_URI, obj_TargetFile); return true; diff --git a/chrome/content/zotero/xpcom/storage/webdav.js b/chrome/content/zotero/xpcom/storage/webdav.js index e6cf719634..8aebd403eb 100644 --- a/chrome/content/zotero/xpcom/storage/webdav.js +++ b/chrome/content/zotero/xpcom/storage/webdav.js @@ -963,7 +963,7 @@ Zotero.Sync.Storage.WebDAV = (function () { .createInstance(nsIWBP); wbp.persistFlags = nsIWBP.PERSIST_FLAGS_BYPASS_CACHE; wbp.progressListener = listener; - Zotero.Utilities.Internal.saveURI(wbp, nsIURL, file); + Zotero.Utilities.Internal.saveURI(wbp, uri, destFile); return deferred.promise; }); diff --git a/chrome/content/zotero/xpcom/storage/zfs.js b/chrome/content/zotero/xpcom/storage/zfs.js index a4d1efbac4..2638e99b4c 100644 --- a/chrome/content/zotero/xpcom/storage/zfs.js +++ b/chrome/content/zotero/xpcom/storage/zfs.js @@ -944,7 +944,7 @@ Zotero.Sync.Storage.ZFS = (function () { .createInstance(nsIWBP); wbp.persistFlags = nsIWBP.PERSIST_FLAGS_BYPASS_CACHE; wbp.progressListener = listener; - Zotero.Utilities.Internal.saveURI(wbp, nsIURL, file); + Zotero.Utilities.Internal.saveURI(wbp, uri, destFile); return deferred.promise; }); diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js index 5edbf728a3..d04a7bddf4 100644 --- a/chrome/content/zotero/xpcom/utilities_internal.js +++ b/chrome/content/zotero/xpcom/utilities_internal.js @@ -266,6 +266,25 @@ Zotero.Utilities.Internal = { } }, + + /** + * 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); + } + }, + + /** * Launch a process * @param {nsIFile} cmd Path to command to launch @@ -469,21 +488,5 @@ 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); - } - } + } } \ No newline at end of file