commit d2716839680cb6857db2b1e00fe310f92e7717ca
parent 5248b08de0d0f0b82cd1bf45626c9f4b01d9b909
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 7 Sep 2017 23:54:59 -0400
Bypass cache by default in Zotero.Utilities.Internal.saveURI()
Diffstat:
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js
@@ -317,7 +317,6 @@ Zotero.Attachments = new function(){
const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
var wbp = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
.createInstance(nsIWBP);
- wbp.persistFlags = nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
if(cookieSandbox) cookieSandbox.attachToInterfaceRequestor(wbp);
var encodingFlags = false;
@@ -609,8 +608,7 @@ Zotero.Attachments = new function(){
const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
var wbp = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
.createInstance(nsIWBP);
- wbp.persistFlags = nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION
- | nsIWBP.PERSIST_FLAGS_FROM_CACHE;
+ wbp.persistFlags = nsIWBP.PERSIST_FLAGS_FROM_CACHE;
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var nsIURL = ioService.newURI(url, null, null);
diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js
@@ -405,7 +405,11 @@ Zotero.Utilities.Internal = {
*/
saveURI: function (wbp, uri, target, headers) {
// Handle gzip encoding
- wbp.persistFlags |= Ci.nsIWebBrowserPersist.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
+ wbp.persistFlags |= wbp.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
+ // If not explicitly using cache, skip it
+ if (!(wbp.persistFlags & wbp.PERSIST_FLAGS_FROM_CACHE)) {
+ wbp.persistFlags |= wbp.PERSIST_FLAGS_BYPASS_CACHE;
+ }
if (typeof uri == 'string') {
uri = Services.io.newURI(uri, null, null);