Bypass cache by default in Zotero.Utilities.Internal.saveURI()

This commit is contained in:
Dan Stillman 2017-09-07 23:54:59 -04:00
parent 5248b08de0
commit d271683968
2 changed files with 6 additions and 4 deletions

View File

@ -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);

View File

@ -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);