From d394db61e53652464214acb802ef4811a25a1976 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 20 May 2019 05:33:37 -0400 Subject: [PATCH] Change 'dontCache' option to 'noCache' in HTTP.request() --- chrome/content/zotero/fileInterface.js | 2 +- .../content/zotero/import/mendeley/mendeleyImport.js | 2 +- chrome/content/zotero/xpcom/http.js | 10 +++++++--- chrome/content/zotero/xpcom/storage/webdav.js | 2 +- chrome/content/zotero/xpcom/sync/syncAPIClient.js | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index 0509f5374e..46a2e9d8e6 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -583,7 +583,7 @@ var Zotero_File_Interface = new function() { 'GET', fileURI, { - dontCache: true, + noCache: true, responseType: 'text' } ); diff --git a/chrome/content/zotero/import/mendeley/mendeleyImport.js b/chrome/content/zotero/import/mendeley/mendeleyImport.js index 8d693ee6fe..7a48d85858 100644 --- a/chrome/content/zotero/import/mendeley/mendeleyImport.js +++ b/chrome/content/zotero/import/mendeley/mendeleyImport.js @@ -56,7 +56,7 @@ Zotero_Import_Mendeley.prototype.translate = async function (options = {}) { 'GET', fileURI, { - dontCache: true, + noCache: true, responseType: 'text' } ); diff --git a/chrome/content/zotero/xpcom/http.js b/chrome/content/zotero/xpcom/http.js index 99f05d4504..68de9a4db0 100644 --- a/chrome/content/zotero/xpcom/http.js +++ b/chrome/content/zotero/xpcom/http.js @@ -123,8 +123,9 @@ Zotero.HTTP = new function() { * @param {Zotero.CookieSandbox} [options.cookieSandbox] - The sandbox from which cookies should * be taken * @param {Boolean} [options.debug] - Log response text and status code - * @param {Boolean} [options.dontCache] - If set, specifies that the request should not be + * @param {Boolean} [options.noCache] - If set, specifies that the request should not be * fulfilled from the cache + * @param {Boolean} [options.dontCache] - Deprecated * @param {Boolean} [options.foreground] - Make a foreground request, showing * certificate/authentication dialogs if necessary * @param {Number} [options.logBodyLength=1024] - Length of request body to log @@ -312,7 +313,10 @@ Zotero.HTTP = new function() { } // Disable caching if requested - if (options.dontCache) { + if (options.noCache || options.dontCache) { + if (options.dontCache) { + Zotero.warn("HTTP.request() 'dontCache' option is deprecated -- use noCache instead"); + } channel.loadFlags |= Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE; } @@ -870,7 +874,7 @@ Zotero.HTTP = new function() { Zotero.debug("Proxy required for " + uri + " -- making HEAD request to trigger auth prompt"); yield Zotero.HTTP.request("HEAD", uri, { foreground: true, - dontCache: true + noCache: true }) .catch(function (e) { // Show error icon at startup diff --git a/chrome/content/zotero/xpcom/storage/webdav.js b/chrome/content/zotero/xpcom/storage/webdav.js index 3e9ef7dbb2..22576ef041 100644 --- a/chrome/content/zotero/xpcom/storage/webdav.js +++ b/chrome/content/zotero/xpcom/storage/webdav.js @@ -1134,7 +1134,7 @@ Zotero.Sync.Storage.Mode.WebDAV.prototype = { successCodes: [200, 300, 404], responseType: 'text', requestObserver: xmlhttp => request.setChannel(xmlhttp.channel), - dontCache: true, + noCache: true, errorDelayIntervals: this.ERROR_DELAY_INTERVALS, errorDelayMax: this.ERROR_DELAY_MAX, debug: true diff --git a/chrome/content/zotero/xpcom/sync/syncAPIClient.js b/chrome/content/zotero/xpcom/sync/syncAPIClient.js index 9fd6bca200..8515ccf007 100644 --- a/chrome/content/zotero/xpcom/sync/syncAPIClient.js +++ b/chrome/content/zotero/xpcom/sync/syncAPIClient.js @@ -641,7 +641,7 @@ Zotero.Sync.APIClient.prototype = { let opts = {} Object.assign(opts, options); opts.headers = this.getHeaders(options.headers); - opts.dontCache = true; + opts.noCache = true; opts.foreground = !options.background; opts.responseType = options.responseType || 'text'; if (options.body && options.body.length >= this.MIN_GZIP_SIZE