Change 'dontCache' option to 'noCache' in HTTP.request()

This commit is contained in:
Dan Stillman 2019-05-20 05:33:37 -04:00
parent 20d7ef6c0b
commit d394db61e5
5 changed files with 11 additions and 7 deletions

View file

@ -583,7 +583,7 @@ var Zotero_File_Interface = new function() {
'GET', 'GET',
fileURI, fileURI,
{ {
dontCache: true, noCache: true,
responseType: 'text' responseType: 'text'
} }
); );

View file

@ -56,7 +56,7 @@ Zotero_Import_Mendeley.prototype.translate = async function (options = {}) {
'GET', 'GET',
fileURI, fileURI,
{ {
dontCache: true, noCache: true,
responseType: 'text' responseType: 'text'
} }
); );

View file

@ -123,8 +123,9 @@ Zotero.HTTP = new function() {
* @param {Zotero.CookieSandbox} [options.cookieSandbox] - The sandbox from which cookies should * @param {Zotero.CookieSandbox} [options.cookieSandbox] - The sandbox from which cookies should
* be taken * be taken
* @param {Boolean} [options.debug] - Log response text and status code * @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 * fulfilled from the cache
* @param {Boolean} [options.dontCache] - Deprecated
* @param {Boolean} [options.foreground] - Make a foreground request, showing * @param {Boolean} [options.foreground] - Make a foreground request, showing
* certificate/authentication dialogs if necessary * certificate/authentication dialogs if necessary
* @param {Number} [options.logBodyLength=1024] - Length of request body to log * @param {Number} [options.logBodyLength=1024] - Length of request body to log
@ -312,7 +313,10 @@ Zotero.HTTP = new function() {
} }
// Disable caching if requested // 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; 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"); Zotero.debug("Proxy required for " + uri + " -- making HEAD request to trigger auth prompt");
yield Zotero.HTTP.request("HEAD", uri, { yield Zotero.HTTP.request("HEAD", uri, {
foreground: true, foreground: true,
dontCache: true noCache: true
}) })
.catch(function (e) { .catch(function (e) {
// Show error icon at startup // Show error icon at startup

View file

@ -1134,7 +1134,7 @@ Zotero.Sync.Storage.Mode.WebDAV.prototype = {
successCodes: [200, 300, 404], successCodes: [200, 300, 404],
responseType: 'text', responseType: 'text',
requestObserver: xmlhttp => request.setChannel(xmlhttp.channel), requestObserver: xmlhttp => request.setChannel(xmlhttp.channel),
dontCache: true, noCache: true,
errorDelayIntervals: this.ERROR_DELAY_INTERVALS, errorDelayIntervals: this.ERROR_DELAY_INTERVALS,
errorDelayMax: this.ERROR_DELAY_MAX, errorDelayMax: this.ERROR_DELAY_MAX,
debug: true debug: true

View file

@ -641,7 +641,7 @@ Zotero.Sync.APIClient.prototype = {
let opts = {} let opts = {}
Object.assign(opts, options); Object.assign(opts, options);
opts.headers = this.getHeaders(options.headers); opts.headers = this.getHeaders(options.headers);
opts.dontCache = true; opts.noCache = true;
opts.foreground = !options.background; opts.foreground = !options.background;
opts.responseType = options.responseType || 'text'; opts.responseType = options.responseType || 'text';
if (options.body && options.body.length >= this.MIN_GZIP_SIZE if (options.body && options.body.length >= this.MIN_GZIP_SIZE