Bug 1679325 - Part 1: Making contentAreaUtils.saveURL to accept cookieJarSettings. r=smaug

This patch makes the contentAreaUtils.saveURL to be aware of the
cookieJarSettings, and updates all callers.

This also updates the documentation of the persistArgs
'cookieJarSettings' for internalPersist().

Differential Revision: https://phabricator.services.mozilla.com/D98455
This commit is contained in:
Tim Huang
2020-12-03 20:10:36 +00:00
parent 3f3e8a0647
commit b77a2550da
7 changed files with 17 additions and 5 deletions

View File

@@ -6969,6 +6969,7 @@ function handleLinkClick(event, href, linkNode) {
true, true,
true, true,
referrerInfo, referrerInfo,
doc.cookieJarSettings,
doc doc
); );
event.preventDefault(); event.preventDefault();

View File

@@ -1426,6 +1426,7 @@ class nsContextMenu {
bypassCache, bypassCache,
doc, doc,
referrerInfo, referrerInfo,
cookieJarSettings,
windowID, windowID,
linkDownload, linkDownload,
isContentWindowPrivate isContentWindowPrivate
@@ -1494,6 +1495,7 @@ class nsContextMenu {
bypassCache, bypassCache,
false, false,
referrerInfo, referrerInfo,
cookieJarSettings,
doc, doc,
isContentWindowPrivate, isContentWindowPrivate,
this._triggeringPrincipal this._triggeringPrincipal
@@ -1579,6 +1581,8 @@ class nsContextMenu {
if (channel instanceof Ci.nsIHttpChannelInternal) { if (channel instanceof Ci.nsIHttpChannelInternal) {
channel.forceAllowThirdPartyCookie = true; channel.forceAllowThirdPartyCookie = true;
} }
channel.loadInfo.cookieJarSettings = cookieJarSettings;
} }
// fallback to the old way if we don't see the headers quickly // fallback to the old way if we don't see the headers quickly
@@ -1610,6 +1614,7 @@ class nsContextMenu {
true, true,
this.ownerDoc, this.ownerDoc,
referrerInfo, referrerInfo,
this.contentData.cookieJarSettings,
this.frameOuterWindowID, this.frameOuterWindowID,
this.linkDownload, this.linkDownload,
isContentWindowPrivate isContentWindowPrivate

View File

@@ -720,6 +720,7 @@ function saveMedia() {
false, false,
referrerInfo, referrerInfo,
null, null,
null,
gDocInfo.isContentWindowPrivate, gDocInfo.isContentWindowPrivate,
gDocInfo.principal gDocInfo.principal
); );

View File

@@ -398,6 +398,7 @@ function openLinkIn(url, where, params) {
true, true,
aReferrerInfo, aReferrerInfo,
null, null,
null,
params.isContentWindowPrivate, params.isContentWindowPrivate,
aPrincipal aPrincipal
); );
@@ -409,7 +410,7 @@ function openLinkIn(url, where, params) {
); );
return; return;
} }
saveURL(url, null, null, true, true, aReferrerInfo, aInitiatingDoc); saveURL(url, null, null, true, true, aReferrerInfo, null, aInitiatingDoc);
} }
return; return;
} }

View File

@@ -606,7 +606,7 @@ const DownloadsIndicatorView = {
if (link.url.startsWith("about:")) { if (link.url.startsWith("about:")) {
continue; continue;
} }
saveURL(link.url, link.name, null, true, true, null, sourceDoc); saveURL(link.url, link.name, null, true, true, null, null, sourceDoc);
handled = true; handled = true;
} }
if (handled) { if (handled) {

View File

@@ -105,6 +105,7 @@ class PdfjsParent extends JSWindowActorParent {
true /* aShouldBypassCache */, true /* aShouldBypassCache */,
false /* aSkipPrompt */, false /* aSkipPrompt */,
null /* aReferrerInfo */, null /* aReferrerInfo */,
null /* aCookieJarSettings*/,
null /* aSourceDocument */, null /* aSourceDocument */,
PrivateBrowsingUtils.isBrowserPrivate( PrivateBrowsingUtils.isBrowserPrivate(
this.browser this.browser

View File

@@ -60,6 +60,7 @@ function saveURL(
aShouldBypassCache, aShouldBypassCache,
aSkipPrompt, aSkipPrompt,
aReferrerInfo, aReferrerInfo,
aCookieJarSettings,
aSourceDocument, aSourceDocument,
aIsContentWindowPrivate, aIsContentWindowPrivate,
aPrincipal aPrincipal
@@ -74,7 +75,7 @@ function saveURL(
aFilePickerTitleKey, aFilePickerTitleKey,
null, null,
aReferrerInfo, aReferrerInfo,
null, aCookieJarSettings,
aSourceDocument, aSourceDocument,
aSkipPrompt, aSkipPrompt,
null, null,
@@ -394,8 +395,10 @@ function internalSave(
* @param persistArgs.contentPolicyType * @param persistArgs.contentPolicyType
* The type of content we're saving. Will be used to determine what * The type of content we're saving. Will be used to determine what
* content is accepted, enforce sniffing restrictions, etc. * content is accepted, enforce sniffing restrictions, etc.
* @param persistArgs.cookieJarSettings * @param persistArgs.cookieJarSettings [optional]
* The nsICookieJarSettings that we need to use. * The nsICookieJarSettings that will be used for the saving channel, or
* null that savePrivacyAwareURI will create one based on the current
* state of the prefs/permissions
* @param persistArgs.targetContentType * @param persistArgs.targetContentType
* Required and used only when persistArgs.sourceDocument is present, * Required and used only when persistArgs.sourceDocument is present,
* determines the final content type of the saved file, or null to use * determines the final content type of the saved file, or null to use