Allow setting a cookie sandbox for Zotero.Utilities.Internal.saveURI()

This isn't used or tested.
This commit is contained in:
Dan Stillman 2020-01-04 00:50:55 -05:00
parent 6070743ff0
commit b9d5c33993

View file

@ -433,9 +433,9 @@ Zotero.Utilities.Internal = {
* @param {nsIURI} uri URL
* @param {nsIFile|string path} target file
* @param {Object} [headers]
* @param {Boolean} [isPrivate=false] - Treat as private request (e.g., don't send cookies)
* @param {Zotero.CookieSandbox} [cookieSandbox]
*/
saveURI: function (wbp, uri, target, headers, isPrivate = false) {
saveURI: function (wbp, uri, target, headers, cookieSandbox) {
// Handle gzip encoding
wbp.persistFlags |= wbp.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
// If not explicitly using cache, skip it
@ -453,12 +453,12 @@ Zotero.Utilities.Internal = {
headers = Object.keys(headers).map(x => x + ": " + headers[x]).join("\r\n") + "\r\n";
}
if (isPrivate) {
wbp.savePrivacyAwareURI(uri, null, null, null, null, headers, target, true);
}
else {
wbp.saveURI(uri, null, null, null, null, headers, target, null);
// Untested
if (cookieSandbox) {
cookieSandbox.attachToInterfaceRequestor(wbp.progressListener);
}
wbp.saveURI(uri, null, null, null, null, headers, target, null);
},