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,
referrerInfo,
doc.cookieJarSettings,
doc
);
event.preventDefault();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -60,6 +60,7 @@ function saveURL(
aShouldBypassCache,
aSkipPrompt,
aReferrerInfo,
aCookieJarSettings,
aSourceDocument,
aIsContentWindowPrivate,
aPrincipal
@@ -74,7 +75,7 @@ function saveURL(
aFilePickerTitleKey,
null,
aReferrerInfo,
null,
aCookieJarSettings,
aSourceDocument,
aSkipPrompt,
null,
@@ -394,8 +395,10 @@ function internalSave(
* @param persistArgs.contentPolicyType
* The type of content we're saving. Will be used to determine what
* content is accepted, enforce sniffing restrictions, etc.
* @param persistArgs.cookieJarSettings
* The nsICookieJarSettings that we need to use.
* @param persistArgs.cookieJarSettings [optional]
* 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
* Required and used only when persistArgs.sourceDocument is present,
* determines the final content type of the saved file, or null to use