From d2716839680cb6857db2b1e00fe310f92e7717ca Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 7 Sep 2017 23:54:59 -0400 Subject: [PATCH] Bypass cache by default in Zotero.Utilities.Internal.saveURI() --- chrome/content/zotero/xpcom/attachments.js | 4 +--- chrome/content/zotero/xpcom/utilities_internal.js | 6 +++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index 20d07a4ad7..82c548075d 100644 --- 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 index df74d48da8..a0b0160fea 100644 --- 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);