Bug 1304623 - Create a pref to control the default referrer policy - part 3. r=bkelly

MozReview-Commit-ID: 1A6IHPeNYBQ
This commit is contained in:
Thomas Nguyen 2017-01-05 11:29:56 +08:00
Родитель 8cd72c67ca
Коммит 0aaea58b69
40 изменённых файлов: 59 добавлений и 60 удалений

Просмотреть файл

@ -855,7 +855,7 @@ function _loadURIWithFlags(browser, uri, params) {
let flags = params.flags || 0; let flags = params.flags || 0;
let referrer = params.referrerURI; let referrer = params.referrerURI;
let referrerPolicy = ('referrerPolicy' in params ? params.referrerPolicy : let referrerPolicy = ('referrerPolicy' in params ? params.referrerPolicy :
Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT); Ci.nsIHttpChannel.REFERRER_POLICY_UNSET);
let postData = params.postData; let postData = params.postData;
let currentRemoteType = browser.remoteType; let currentRemoteType = browser.remoteType;
@ -1196,7 +1196,7 @@ var gBrowserInit = {
} }
} }
let referrerPolicy = (window.arguments[5] != undefined ? let referrerPolicy = (window.arguments[5] != undefined ?
window.arguments[5] : Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT); window.arguments[5] : Ci.nsIHttpChannel.REFERRER_POLICY_UNSET);
let userContextId = (window.arguments[6] != undefined ? let userContextId = (window.arguments[6] != undefined ?
window.arguments[6] : Ci.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID); window.arguments[6] : Ci.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID);
loadURI(uriToLoad, referrerURI, window.arguments[3] || null, loadURI(uriToLoad, referrerURI, window.arguments[3] || null,
@ -5014,7 +5014,7 @@ nsBrowserAccess.prototype = {
} }
let referrer = aOpener ? makeURI(aOpener.location.href) : null; let referrer = aOpener ? makeURI(aOpener.location.href) : null;
let referrerPolicy = Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT; let referrerPolicy = Ci.nsIHttpChannel.REFERRER_POLICY_UNSET;
if (aOpener && aOpener.document) { if (aOpener && aOpener.document) {
referrerPolicy = aOpener.document.referrerPolicy; referrerPolicy = aOpener.document.referrerPolicy;
} }

Просмотреть файл

@ -4846,7 +4846,7 @@
let newTab = this.loadOneTab(data.href, { let newTab = this.loadOneTab(data.href, {
referrerURI: (data.referrer ? makeURI(data.referrer) : null), referrerURI: (data.referrer ? makeURI(data.referrer) : null),
referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT, referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_UNSET,
postData: null, postData: null,
allowThirdPartyFixup: true, allowThirdPartyFixup: true,
relatedToCurrent: true, relatedToCurrent: true,

Просмотреть файл

@ -62,7 +62,7 @@ add_task(function* () {
yield BrowserTestUtils.withNewTab({ gBrowser, url: "data:text/html,a" }, function* (browser1) { yield BrowserTestUtils.withNewTab({ gBrowser, url: "data:text/html,a" }, function* (browser1) {
// Set up the grouped SHEntry setup // Set up the grouped SHEntry setup
let tab2 = gBrowser.loadOneTab("data:text/html,b", { let tab2 = gBrowser.loadOneTab("data:text/html,b", {
referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT, referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_UNSET,
allowThirdPartyFixup: true, allowThirdPartyFixup: true,
relatedToCurrent: true, relatedToCurrent: true,
isPrerendered: true, isPrerendered: true,

Просмотреть файл

@ -90,7 +90,7 @@ function openUILink(url, event, aIgnoreButton, aIgnoreAlt, aAllowThirdPartyFixup
allowThirdPartyFixup: aAllowThirdPartyFixup, allowThirdPartyFixup: aAllowThirdPartyFixup,
postData: aPostData, postData: aPostData,
referrerURI: aReferrerURI, referrerURI: aReferrerURI,
referrerPolicy: Components.interfaces.nsIHttpChannel.REFERRER_POLICY_DEFAULT, referrerPolicy: Components.interfaces.nsIHttpChannel.REFERRER_POLICY_UNSET,
initiatingDoc: event ? event.target.ownerDocument : null, initiatingDoc: event ? event.target.ownerDocument : null,
}; };
} }
@ -185,7 +185,7 @@ function openUILinkIn(url, where, aAllowThirdPartyFixup, aPostData, aReferrerURI
allowThirdPartyFixup: aAllowThirdPartyFixup, allowThirdPartyFixup: aAllowThirdPartyFixup,
postData: aPostData, postData: aPostData,
referrerURI: aReferrerURI, referrerURI: aReferrerURI,
referrerPolicy: Components.interfaces.nsIHttpChannel.REFERRER_POLICY_DEFAULT, referrerPolicy: Components.interfaces.nsIHttpChannel.REFERRER_POLICY_UNSET,
}; };
} }
@ -206,7 +206,7 @@ function openLinkIn(url, where, params) {
var aCharset = params.charset; var aCharset = params.charset;
var aReferrerURI = params.referrerURI; var aReferrerURI = params.referrerURI;
var aReferrerPolicy = ('referrerPolicy' in params ? var aReferrerPolicy = ('referrerPolicy' in params ?
params.referrerPolicy : Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT); params.referrerPolicy : Ci.nsIHttpChannel.REFERRER_POLICY_UNSET);
var aRelatedToCurrent = params.relatedToCurrent; var aRelatedToCurrent = params.relatedToCurrent;
var aAllowMixedContent = params.allowMixedContent; var aAllowMixedContent = params.allowMixedContent;
var aInBackground = params.inBackground; var aInBackground = params.inBackground;

Просмотреть файл

@ -201,7 +201,7 @@ ContentRestoreInternal.prototype = {
Utils.makeURI(loadArguments.referrer) : null; Utils.makeURI(loadArguments.referrer) : null;
let referrerPolicy = ('referrerPolicy' in loadArguments let referrerPolicy = ('referrerPolicy' in loadArguments
? loadArguments.referrerPolicy ? loadArguments.referrerPolicy
: Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT); : Ci.nsIHttpChannel.REFERRER_POLICY_UNSET);
let postData = loadArguments.postData ? let postData = loadArguments.postData ?
Utils.makeInputStream(loadArguments.postData) : null; Utils.makeInputStream(loadArguments.postData) : null;

Просмотреть файл

@ -64,7 +64,7 @@ add_task(function* () {
// Create a new hidden prerendered tab to swap to. // Create a new hidden prerendered tab to swap to.
let tab2 = gBrowser.loadOneTab(URIs[2], { let tab2 = gBrowser.loadOneTab(URIs[2], {
referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT, referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_UNSET,
allowThirdPartyFixup: true, allowThirdPartyFixup: true,
relatedToCurrent: true, relatedToCurrent: true,
isPrerendered: true, isPrerendered: true,
@ -106,7 +106,7 @@ add_task(function* () {
// Create a new hidden prerendered tab to swap to // Create a new hidden prerendered tab to swap to
let tab3 = gBrowser.loadOneTab(URIs[4], { let tab3 = gBrowser.loadOneTab(URIs[4], {
referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT, referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_UNSET,
allowThirdPartyFixup: true, allowThirdPartyFixup: true,
relatedToCurrent: true, relatedToCurrent: true,
isPrerendered: true, isPrerendered: true,

Просмотреть файл

@ -60,7 +60,7 @@ BrowserElementWebNavigation.prototype = {
loadURI(uri, flags, referrer, postData, headers) { loadURI(uri, flags, referrer, postData, headers) {
// No equivalent in the current BrowserElement API // No equivalent in the current BrowserElement API
this.loadURIWithOptions(uri, flags, referrer, this.loadURIWithOptions(uri, flags, referrer,
Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT, Ci.nsIHttpChannel.REFERRER_POLICY_UNSET,
postData, headers, null); postData, headers, null);
}, },

Просмотреть файл

@ -559,8 +559,7 @@ var saveToFile = Task.async(function* (context, reply) {
persist.savePrivacyAwareURI(sourceURI, persist.savePrivacyAwareURI(sourceURI,
null, null,
document.documentURIObject, document.documentURIObject,
Ci.nsIHttpChannel Ci.nsIHttpChannel.REFERRER_POLICY_UNSET,
.REFERRER_POLICY_NO_REFERRER_WHEN_DOWNGRADE,
null, null,
null, null,
targetFileURI, targetFileURI,

Просмотреть файл

@ -1262,7 +1262,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
bool inheritPrincipal = false; bool inheritPrincipal = false;
bool principalIsExplicit = false; bool principalIsExplicit = false;
bool sendReferrer = true; bool sendReferrer = true;
uint32_t referrerPolicy = mozilla::net::RP_Default; uint32_t referrerPolicy = mozilla::net::RP_Unset;
bool isSrcdoc = false; bool isSrcdoc = false;
nsCOMPtr<nsISHEntry> shEntry; nsCOMPtr<nsISHEntry> shEntry;
nsXPIDLString target; nsXPIDLString target;
@ -4697,7 +4697,7 @@ nsDocShell::LoadURI(const char16_t* aURI,
nsIInputStream* aHeaderStream) nsIInputStream* aHeaderStream)
{ {
return LoadURIWithOptions(aURI, aLoadFlags, aReferringURI, return LoadURIWithOptions(aURI, aLoadFlags, aReferringURI,
mozilla::net::RP_Default, aPostStream, mozilla::net::RP_Unset, aPostStream,
aHeaderStream, nullptr); aHeaderStream, nullptr);
} }
@ -5363,7 +5363,7 @@ nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL,
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
return InternalLoad(errorPageURI, nullptr, false, nullptr, return InternalLoad(errorPageURI, nullptr, false, nullptr,
mozilla::net::RP_Default, mozilla::net::RP_Unset,
nsContentUtils::GetSystemPrincipal(), nullptr, nsContentUtils::GetSystemPrincipal(), nullptr,
INTERNAL_LOAD_FLAGS_NONE, EmptyString(), INTERNAL_LOAD_FLAGS_NONE, EmptyString(),
nullptr, NullString(), nullptr, nullptr, LOAD_ERROR_PAGE, nullptr, NullString(), nullptr, nullptr, LOAD_ERROR_PAGE,
@ -12230,7 +12230,7 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
nsCOMPtr<nsIURI> originalURI; nsCOMPtr<nsIURI> originalURI;
bool loadReplace = false; bool loadReplace = false;
nsCOMPtr<nsIURI> referrerURI; nsCOMPtr<nsIURI> referrerURI;
uint32_t referrerPolicy = mozilla::net::RP_Default; uint32_t referrerPolicy = mozilla::net::RP_Unset;
nsCOMPtr<nsISupports> cacheKey; nsCOMPtr<nsISupports> cacheKey;
nsCOMPtr<nsIPrincipal> triggeringPrincipal = aTriggeringPrincipal; nsCOMPtr<nsIPrincipal> triggeringPrincipal = aTriggeringPrincipal;
nsCOMPtr<nsIPrincipal> principalToInherit = aPrincipalToInherit; nsCOMPtr<nsIPrincipal> principalToInherit = aPrincipalToInherit;

Просмотреть файл

@ -16,7 +16,7 @@ nsDocShellLoadInfo::nsDocShellLoadInfo()
, mInheritPrincipal(false) , mInheritPrincipal(false)
, mPrincipalIsExplicit(false) , mPrincipalIsExplicit(false)
, mSendReferrer(true) , mSendReferrer(true)
, mReferrerPolicy(mozilla::net::RP_Default) , mReferrerPolicy(mozilla::net::RP_Unset)
, mLoadType(nsIDocShellLoadInfo::loadNormal) , mLoadType(nsIDocShellLoadInfo::loadNormal)
, mIsSrcdocLoad(false) , mIsSrcdocLoad(false)
{ {

Просмотреть файл

@ -264,7 +264,7 @@ interface nsIWebNavigation : nsISupports
* URI will be inferred internally. * URI will be inferred internally.
* @param aReferrerPolicy * @param aReferrerPolicy
* One of the REFERRER_POLICY_* constants from nsIHttpChannel. * One of the REFERRER_POLICY_* constants from nsIHttpChannel.
* Normal case is REFERRER_POLICY_DEFAULT. * Normal case is REFERRER_POLICY_NO_REFERRER_WHEN_DOWNGRADE.
* @param aPostData * @param aPostData
* If the URI corresponds to a HTTP request, then this stream is * If the URI corresponds to a HTTP request, then this stream is
* appended directly to the HTTP request headers. It may be prefixed * appended directly to the HTTP request headers. It may be prefixed

Просмотреть файл

@ -24,7 +24,7 @@ static uint32_t gEntryID = 0;
nsSHEntry::nsSHEntry() nsSHEntry::nsSHEntry()
: mShared(new nsSHEntryShared()) : mShared(new nsSHEntryShared())
, mLoadReplace(false) , mLoadReplace(false)
, mReferrerPolicy(mozilla::net::RP_Default) , mReferrerPolicy(mozilla::net::RP_Unset)
, mLoadType(0) , mLoadType(0)
, mID(gEntryID++) , mID(gEntryID++)
, mScrollPositionX(0) , mScrollPositionX(0)

Просмотреть файл

@ -23,7 +23,7 @@ add_task(function* () {
yield BrowserTestUtils.withNewTab({ gBrowser, url: "data:text/html,a" }, function* (browser1) { yield BrowserTestUtils.withNewTab({ gBrowser, url: "data:text/html,a" }, function* (browser1) {
// Set up the grouped SHEntry setup // Set up the grouped SHEntry setup
let tab2 = gBrowser.loadOneTab("data:text/html,b", { let tab2 = gBrowser.loadOneTab("data:text/html,b", {
referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT, referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_UNSET,
allowThirdPartyFixup: true, allowThirdPartyFixup: true,
relatedToCurrent: true, relatedToCurrent: true,
isPrerendered: true, isPrerendered: true,

Просмотреть файл

@ -28,7 +28,7 @@ add_task(function* () {
yield BrowserTestUtils.withNewTab({ gBrowser, url: "data:text/html,a" }, function* (browser1) { yield BrowserTestUtils.withNewTab({ gBrowser, url: "data:text/html,a" }, function* (browser1) {
// Set up the grouped SHEntry setup // Set up the grouped SHEntry setup
let tab2 = gBrowser.loadOneTab("data:text/html,b", { let tab2 = gBrowser.loadOneTab("data:text/html,b", {
referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT, referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_UNSET,
allowThirdPartyFixup: true, allowThirdPartyFixup: true,
relatedToCurrent: true, relatedToCurrent: true,
isPrerendered: true, isPrerendered: true,

Просмотреть файл

@ -17,7 +17,7 @@ add_task(function* () {
yield BrowserTestUtils.withNewTab({ gBrowser, url: "data:text/html,a" }, function* (browser1) { yield BrowserTestUtils.withNewTab({ gBrowser, url: "data:text/html,a" }, function* (browser1) {
// Set up the grouped SHEntry setup // Set up the grouped SHEntry setup
let tab2 = gBrowser.loadOneTab("data:text/html,b", { let tab2 = gBrowser.loadOneTab("data:text/html,b", {
referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT, referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_UNSET,
allowThirdPartyFixup: true, allowThirdPartyFixup: true,
relatedToCurrent: true, relatedToCurrent: true,
isPrerendered: true, isPrerendered: true,

Просмотреть файл

@ -109,7 +109,7 @@ Location::CheckURL(nsIURI* aURI, nsIDocShellLoadInfo** aLoadInfo)
nsCOMPtr<nsIPrincipal> triggeringPrincipal; nsCOMPtr<nsIPrincipal> triggeringPrincipal;
nsCOMPtr<nsIURI> sourceURI; nsCOMPtr<nsIURI> sourceURI;
net::ReferrerPolicy referrerPolicy = net::RP_Default; net::ReferrerPolicy referrerPolicy = net::RP_Unset;
if (JSContext *cx = nsContentUtils::GetCurrentJSContext()) { if (JSContext *cx = nsContentUtils::GetCurrentJSContext()) {
// No cx means that there's no JS running, or at least no JS that // No cx means that there's no JS running, or at least no JS that

Просмотреть файл

@ -165,7 +165,7 @@ nsContentAreaDragDropDataProvider::SaveURIToFile(nsAString& inSourceURIString,
// referrer policy can be anything since the referrer is nullptr // referrer policy can be anything since the referrer is nullptr
return persist->SavePrivacyAwareURI(sourceURI, nullptr, nullptr, return persist->SavePrivacyAwareURI(sourceURI, nullptr, nullptr,
mozilla::net::RP_Default, mozilla::net::RP_Unset,
nullptr, nullptr, nullptr, nullptr,
inDestFile, isPrivate); inDestFile, isPrivate);
} }

Просмотреть файл

@ -8514,9 +8514,7 @@ nsContentUtils::SetFetchReferrerURIWithPolicy(nsIPrincipal* aPrincipal,
referrerURI = principalURI; referrerURI = principalURI;
} }
net::ReferrerPolicy referrerPolicy = (aReferrerPolicy != net::RP_Unset) ? return aChannel->SetReferrerWithPolicy(referrerURI, aReferrerPolicy);
aReferrerPolicy : net::RP_Default;
return aChannel->SetReferrerWithPolicy(referrerURI, referrerPolicy);
} }
// static // static
@ -8530,6 +8528,9 @@ nsContentUtils::GetReferrerPolicyFromHeader(const nsAString& aHeader)
net::ReferrerPolicy referrerPolicy = mozilla::net::RP_Unset; net::ReferrerPolicy referrerPolicy = mozilla::net::RP_Unset;
while (tokenizer.hasMoreTokens()) { while (tokenizer.hasMoreTokens()) {
token = tokenizer.nextToken(); token = tokenizer.nextToken();
if (token.IsEmpty()) {
continue;
}
net::ReferrerPolicy policy = net::ReferrerPolicyFromString(token); net::ReferrerPolicy policy = net::ReferrerPolicyFromString(token);
if (policy != net::RP_Unset) { if (policy != net::RP_Unset) {
referrerPolicy = policy; referrerPolicy = policy;

Просмотреть файл

@ -1279,7 +1279,7 @@ static already_AddRefed<mozilla::dom::NodeInfo> nullNodeInfo;
nsIDocument::nsIDocument() nsIDocument::nsIDocument()
: nsINode(nullNodeInfo), : nsINode(nullNodeInfo),
mReferrerPolicySet(false), mReferrerPolicySet(false),
mReferrerPolicy(mozilla::net::RP_Default), mReferrerPolicy(mozilla::net::RP_Unset),
mBlockAllMixedContent(false), mBlockAllMixedContent(false),
mBlockAllMixedContentPreloads(false), mBlockAllMixedContentPreloads(false),
mUpgradeInsecureRequests(false), mUpgradeInsecureRequests(false),
@ -2468,7 +2468,7 @@ nsDocument::ApplySettingsFromCSP(bool aSpeculative)
if (csp) { if (csp) {
// Set up any Referrer Policy specified by CSP // Set up any Referrer Policy specified by CSP
bool hasReferrerPolicy = false; bool hasReferrerPolicy = false;
uint32_t referrerPolicy = mozilla::net::RP_Default; uint32_t referrerPolicy = mozilla::net::RP_Unset;
rv = csp->GetReferrerPolicy(&referrerPolicy, &hasReferrerPolicy); rv = csp->GetReferrerPolicy(&referrerPolicy, &hasReferrerPolicy);
NS_ENSURE_SUCCESS_VOID(rv); NS_ENSURE_SUCCESS_VOID(rv);
if (hasReferrerPolicy) { if (hasReferrerPolicy) {

Просмотреть файл

@ -91,7 +91,7 @@ public:
mLineNo(1), mLineNo(1),
mCORSMode(aCORSMode), mCORSMode(aCORSMode),
mIntegrity(aIntegrity), mIntegrity(aIntegrity),
mReferrerPolicy(mozilla::net::RP_Default) mReferrerPolicy(mozilla::net::RP_Unset)
{ {
} }

Просмотреть файл

@ -3304,7 +3304,7 @@ nsresult nsPluginHost::NewPluginURLStream(const nsString& aURL,
// errors about malformed requests if we include it in POSTs. See // errors about malformed requests if we include it in POSTs. See
// bug 724465. // bug 724465.
nsCOMPtr<nsIURI> referer; nsCOMPtr<nsIURI> referer;
net::ReferrerPolicy referrerPolicy = net::RP_Default; net::ReferrerPolicy referrerPolicy = net::RP_Unset;
nsCOMPtr<nsIObjectLoadingContent> olc = do_QueryInterface(element); nsCOMPtr<nsIObjectLoadingContent> olc = do_QueryInterface(element);
if (olc) if (olc)

Просмотреть файл

@ -346,9 +346,9 @@ NS_IMETHODIMP
nsCSPContext::GetReferrerPolicy(uint32_t* outPolicy, bool* outIsSet) nsCSPContext::GetReferrerPolicy(uint32_t* outPolicy, bool* outIsSet)
{ {
*outIsSet = false; *outIsSet = false;
*outPolicy = mozilla::net::RP_Default; *outPolicy = mozilla::net::RP_Unset;
nsAutoString refpol; nsAutoString refpol;
mozilla::net::ReferrerPolicy previousPolicy = mozilla::net::RP_Default; mozilla::net::ReferrerPolicy previousPolicy = mozilla::net::RP_Unset;
for (uint32_t i = 0; i < mPolicies.Length(); i++) { for (uint32_t i = 0; i < mPolicies.Length(); i++) {
mPolicies[i]->getReferrerPolicy(refpol); mPolicies[i]->getReferrerPolicy(refpol);
// only set the referrer policy if not delievered through a CSPRO and // only set the referrer policy if not delievered through a CSPRO and

Просмотреть файл

@ -2603,7 +2603,7 @@ XMLHttpRequestMainThread::InitiateFetch(nsIInputStream* aUploadStream,
nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner(); nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner();
nsCOMPtr<nsIDocument> doc = owner ? owner->GetExtantDoc() : nullptr; nsCOMPtr<nsIDocument> doc = owner ? owner->GetExtantDoc() : nullptr;
mozilla::net::ReferrerPolicy referrerPolicy = doc ? mozilla::net::ReferrerPolicy referrerPolicy = doc ?
doc->GetReferrerPolicy() : mozilla::net::RP_Default; doc->GetReferrerPolicy() : mozilla::net::RP_Unset;
nsContentUtils::SetFetchReferrerURIWithPolicy(mPrincipal, doc, nsContentUtils::SetFetchReferrerURIWithPolicy(mPrincipal, doc,
httpChannel, referrerPolicy); httpChannel, referrerPolicy);
} }

Просмотреть файл

@ -105,7 +105,7 @@ nsXMLPrettyPrinter::PrettyPrint(nsIDocument* aDocument,
rv = nsSyncLoadService::LoadDocument(xslUri, nsIContentPolicy::TYPE_XSLT, rv = nsSyncLoadService::LoadDocument(xslUri, nsIContentPolicy::TYPE_XSLT,
nsContentUtils::GetSystemPrincipal(), nsContentUtils::GetSystemPrincipal(),
nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL, nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
nullptr, true, mozilla::net::RP_Default, nullptr, true, mozilla::net::RP_Unset,
getter_AddRefs(xslDocument)); getter_AddRefs(xslDocument));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -1037,7 +1037,7 @@ NS_IMETHODIMP
txMozillaXSLTProcessor::LoadStyleSheet(nsIURI* aUri, txMozillaXSLTProcessor::LoadStyleSheet(nsIURI* aUri,
nsIDocument* aLoaderDocument) nsIDocument* aLoaderDocument)
{ {
mozilla::net::ReferrerPolicy refpol = mozilla::net::RP_Default; mozilla::net::ReferrerPolicy refpol = mozilla::net::RP_Unset;
if (mStylesheetDocument) { if (mStylesheetDocument) {
refpol = mStylesheetDocument->GetReferrerPolicy(); refpol = mStylesheetDocument->GetReferrerPolicy();
} }

Просмотреть файл

@ -1069,7 +1069,7 @@ TX_XSLTFunctionAvailable(nsIAtom* aName, int32_t aNameSpaceID)
{ {
RefPtr<txStylesheetCompiler> compiler = RefPtr<txStylesheetCompiler> compiler =
new txStylesheetCompiler(EmptyString(), new txStylesheetCompiler(EmptyString(),
mozilla::net::RP_Default, nullptr); mozilla::net::RP_Unset, nullptr);
NS_ENSURE_TRUE(compiler, false); NS_ENSURE_TRUE(compiler, false);
nsAutoPtr<FunctionCall> fnCall; nsAutoPtr<FunctionCall> fnCall;

Просмотреть файл

@ -630,7 +630,7 @@ nsWebBrowserPersist::SerializeNextFile()
// The Referrer Policy doesn't matter here since the referrer is // The Referrer Policy doesn't matter here since the referrer is
// nullptr. // nullptr.
rv = SaveURIInternal(uri, nullptr, nullptr, rv = SaveURIInternal(uri, nullptr, nullptr,
mozilla::net::RP_Default, nullptr, nullptr, mozilla::net::RP_Unset, nullptr, nullptr,
fileAsURI, true, mIsPrivate); fileAsURI, true, mIsPrivate);
// If SaveURIInternal fails, then it will have called EndDownload, // If SaveURIInternal fails, then it will have called EndDownload,
// which means that |data| is no longer valid memory. We MUST bail. // which means that |data| is no longer valid memory. We MUST bail.

Просмотреть файл

@ -2009,8 +2009,7 @@ imgLoader::LoadImageXPCOM(nsIURI* aURI,
nsresult rv = LoadImage(aURI, nsresult rv = LoadImage(aURI,
aInitialDocumentURI, aInitialDocumentURI,
aReferrerURI, aReferrerURI,
refpol == mozilla::net::RP_Unset ? refpol,
mozilla::net::RP_Default : refpol,
aLoadingPrincipal, aLoadingPrincipal,
aLoadGroup, aLoadGroup,
aObserver, aObserver,
@ -2365,7 +2364,7 @@ imgLoader::LoadImageWithChannel(nsIChannel* channel,
? loadInfo->InternalContentPolicyType() ? loadInfo->InternalContentPolicyType()
: nsIContentPolicy::TYPE_INTERNAL_IMAGE; : nsIContentPolicy::TYPE_INTERNAL_IMAGE;
if (ValidateEntry(entry, uri, nullptr, nullptr, RP_Default, if (ValidateEntry(entry, uri, nullptr, nullptr, RP_Unset,
nullptr, aObserver, aCX, requestFlags, nullptr, aObserver, aCX, requestFlags,
policyType, false, nullptr, policyType, false, nullptr,
nullptr, imgIRequest::CORS_NONE)) { nullptr, imgIRequest::CORS_NONE)) {
@ -2454,7 +2453,7 @@ imgLoader::LoadImageWithChannel(nsIChannel* channel,
// can set aHadInsecureRedirect to false here. // can set aHadInsecureRedirect to false here.
rv = request->Init(originalURI, uri, /* aHadInsecureRedirect = */ false, rv = request->Init(originalURI, uri, /* aHadInsecureRedirect = */ false,
channel, channel, entry, aCX, nullptr, channel, channel, entry, aCX, nullptr,
imgIRequest::CORS_NONE, RP_Default); imgIRequest::CORS_NONE, RP_Unset);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
RefPtr<ProxyListener> pl = RefPtr<ProxyListener> pl =

Просмотреть файл

@ -57,7 +57,7 @@ imgRequest::imgRequest(imgLoader* aLoader, const ImageCacheKey& aCacheKey)
, mValidator(nullptr) , mValidator(nullptr)
, mInnerWindowId(0) , mInnerWindowId(0)
, mCORSMode(imgIRequest::CORS_NONE) , mCORSMode(imgIRequest::CORS_NONE)
, mReferrerPolicy(mozilla::net::RP_Default) , mReferrerPolicy(mozilla::net::RP_Unset)
, mImageErrorCode(NS_OK) , mImageErrorCode(NS_OK)
, mMutex("imgRequest") , mMutex("imgRequest")
, mProgressTracker(new ProgressTracker()) , mProgressTracker(new ProgressTracker())

Просмотреть файл

@ -2210,7 +2210,7 @@ nsImageFrame::LoadIcon(const nsAString& aSpec,
relevant for cookies, so does not relevant for cookies, so does not
apply to icons. */ apply to icons. */
nullptr, /* referrer (not relevant for icons) */ nullptr, /* referrer (not relevant for icons) */
mozilla::net::RP_Default, mozilla::net::RP_Unset,
nullptr, /* principal (not relevant for icons) */ nullptr, /* principal (not relevant for icons) */
loadGroup, loadGroup,
gIconLoad, gIconLoad,

Просмотреть файл

@ -372,7 +372,7 @@ public:
const nsCString& aCharset, const nsCString& aCharset,
nsICSSLoaderObserver* aObserver, nsICSSLoaderObserver* aObserver,
CORSMode aCORSMode = CORS_NONE, CORSMode aCORSMode = CORS_NONE,
ReferrerPolicy aReferrerPolicy = mozilla::net::RP_Default, ReferrerPolicy aReferrerPolicy = mozilla::net::RP_Unset,
const nsAString& aIntegrity = EmptyString()); const nsAString& aIntegrity = EmptyString());
/** /**
@ -500,7 +500,7 @@ private:
RefPtr<StyleSheet>* aSheet, RefPtr<StyleSheet>* aSheet,
nsICSSLoaderObserver* aObserver, nsICSSLoaderObserver* aObserver,
CORSMode aCORSMode = CORS_NONE, CORSMode aCORSMode = CORS_NONE,
ReferrerPolicy aReferrerPolicy = mozilla::net::RP_Default, ReferrerPolicy aReferrerPolicy = mozilla::net::RP_Unset,
const nsAString& aIntegrity = EmptyString()); const nsAString& aIntegrity = EmptyString());
// Post a load event for aObserver to be notified about aSheet. The // Post a load event for aObserver to be notified about aSheet. The

Просмотреть файл

@ -869,10 +869,10 @@ nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr<StyleSheet>* aSheet,
{ {
if (mBackendType == StyleBackendType::Gecko) { if (mBackendType == StyleBackendType::Gecko) {
*aSheet = new CSSStyleSheet(eAgentSheetFeatures, CORS_NONE, *aSheet = new CSSStyleSheet(eAgentSheetFeatures, CORS_NONE,
mozilla::net::RP_Default); mozilla::net::RP_Unset);
} else { } else {
*aSheet = new ServoStyleSheet(eAgentSheetFeatures, CORS_NONE, *aSheet = new ServoStyleSheet(eAgentSheetFeatures, CORS_NONE,
mozilla::net::RP_Default, dom::SRIMetadata()); mozilla::net::RP_Unset, dom::SRIMetadata());
} }
StyleSheet* sheet = *aSheet; StyleSheet* sheet = *aSheet;

Просмотреть файл

@ -66,7 +66,7 @@ static nsITimer* gFlushTimer = nullptr;
nsHtml5TreeOpExecutor::nsHtml5TreeOpExecutor() nsHtml5TreeOpExecutor::nsHtml5TreeOpExecutor()
: nsHtml5DocumentBuilder(false) : nsHtml5DocumentBuilder(false)
, mPreloadedURLs(23) // Mean # of preloadable resources per page on dmoz , mPreloadedURLs(23) // Mean # of preloadable resources per page on dmoz
, mSpeculationReferrerPolicy(mozilla::net::RP_Default) , mSpeculationReferrerPolicy(mozilla::net::RP_Unset)
{ {
// zeroing operator new for everything else // zeroing operator new for everything else
} }
@ -1058,7 +1058,7 @@ nsHtml5TreeOpExecutor::AddSpeculationCSP(const nsAString& aCSP)
// Record "speculated" referrer policy for preloads // Record "speculated" referrer policy for preloads
bool hasReferrerPolicy = false; bool hasReferrerPolicy = false;
uint32_t referrerPolicy = mozilla::net::RP_Default; uint32_t referrerPolicy = mozilla::net::RP_Unset;
rv = preloadCsp->GetReferrerPolicy(&referrerPolicy, &hasReferrerPolicy); rv = preloadCsp->GetReferrerPolicy(&referrerPolicy, &hasReferrerPolicy);
NS_ENSURE_SUCCESS_VOID(rv); NS_ENSURE_SUCCESS_VOID(rv);
if (hasReferrerPolicy) { if (hasReferrerPolicy) {

Просмотреть файл

@ -1871,7 +1871,7 @@ nsDownloadManager::RetryDownload(nsDownload* dl)
// referrer policy can be anything since referrer is nullptr // referrer policy can be anything since referrer is nullptr
rv = wbp->SavePrivacyAwareURI(dl->mSource, nullptr, rv = wbp->SavePrivacyAwareURI(dl->mSource, nullptr,
nullptr, mozilla::net::RP_Default, nullptr, mozilla::net::RP_Unset,
nullptr, nullptr, nullptr, nullptr,
dl->mTarget, dl->mPrivate); dl->mTarget, dl->mPrivate);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {

Просмотреть файл

@ -69,7 +69,7 @@ RemoteWebNavigation.prototype = {
}, },
loadURI(aURI, aLoadFlags, aReferrer, aPostData, aHeaders) { loadURI(aURI, aLoadFlags, aReferrer, aPostData, aHeaders) {
this.loadURIWithOptions(aURI, aLoadFlags, aReferrer, this.loadURIWithOptions(aURI, aLoadFlags, aReferrer,
Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT, Ci.nsIHttpChannel.REFERRER_POLICY_UNSET,
aPostData, aHeaders, null); aPostData, aHeaders, null);
}, },
loadURIWithOptions(aURI, aLoadFlags, aReferrer, aReferrerPolicy, loadURIWithOptions(aURI, aLoadFlags, aReferrer, aReferrerPolicy,

Просмотреть файл

@ -391,7 +391,7 @@ var ViewSourceContent = {
docShell.QueryInterface(Ci.nsIWebNavigation) docShell.QueryInterface(Ci.nsIWebNavigation)
.loadURIWithOptions(content.location.href, .loadURIWithOptions(content.location.href,
Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CLASSIFIER, Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CLASSIFIER,
null, Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT, null, Ci.nsIHttpChannel.REFERRER_POLICY_UNSET,
null, null, null); null, null, null);
} }
} }
@ -770,7 +770,7 @@ var ViewSourceContent = {
// all our content is held by the data:URI and URIs are internally stored as utf-8 (see nsIURI.idl) // all our content is held by the data:URI and URIs are internally stored as utf-8 (see nsIURI.idl)
let loadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE; let loadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
let referrerPolicy = Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT; let referrerPolicy = Ci.nsIHttpChannel.REFERRER_POLICY_UNSET;
let webNav = docShell.QueryInterface(Ci.nsIWebNavigation); let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
webNav.loadURIWithOptions(uri, loadFlags, webNav.loadURIWithOptions(uri, loadFlags,
null, referrerPolicy, // referrer null, referrerPolicy, // referrer

Просмотреть файл

@ -559,7 +559,7 @@ function internalPersist(persistArgs) {
persist.savePrivacyAwareURI(persistArgs.sourceURI, persist.savePrivacyAwareURI(persistArgs.sourceURI,
persistArgs.sourceCacheKey, persistArgs.sourceCacheKey,
persistArgs.sourceReferrer, persistArgs.sourceReferrer,
Components.interfaces.nsIHttpChannel.REFERRER_POLICY_NO_REFERRER_WHEN_DOWNGRADE, Components.interfaces.nsIHttpChannel.REFERRER_POLICY_UNSET,
persistArgs.sourcePostData, persistArgs.sourcePostData,
null, null,
targetFileURL, targetFileURL,

Просмотреть файл

@ -133,7 +133,7 @@
if (!aURI) if (!aURI)
aURI = "about:blank"; aURI = "about:blank";
var aReferrerPolicy = Components.interfaces.nsIHttpChannel.REFERRER_POLICY_DEFAULT; var aReferrerPolicy = Components.interfaces.nsIHttpChannel.REFERRER_POLICY_UNSET;
// Check for loadURIWithFlags(uri, { ... }); // Check for loadURIWithFlags(uri, { ... });
var params = arguments[1]; var params = arguments[1];

Просмотреть файл

@ -868,7 +868,7 @@ function _persistImage(sourceURL, localFileName, successCallback) {
persist.progressListener = new _persistProgressListener(successCallback); persist.progressListener = new _persistProgressListener(successCallback);
persist.saveURI(sourceURI, null, persist.saveURI(sourceURI, null,
null, Ci.nsIHttpChannel.REFERRER_POLICY_NO_REFERRER_WHEN_DOWNGRADE, null, Ci.nsIHttpChannel.REFERRER_POLICY_UNSET,
null, null, targetURI, null); null, null, targetURI, null);
} }

Просмотреть файл

@ -310,7 +310,7 @@ nsMenuItemIconX::LoadIcon(nsIURI* aIconURI)
} }
nsresult rv = loader->LoadImage(aIconURI, nullptr, nullptr, nsresult rv = loader->LoadImage(aIconURI, nullptr, nullptr,
mozilla::net::RP_Default, mozilla::net::RP_Unset,
nullptr, loadGroup, this, nullptr, loadGroup, this,
nullptr, nullptr, nsIRequest::LOAD_NORMAL, nullptr, nullptr, nullptr, nsIRequest::LOAD_NORMAL, nullptr,
nsIContentPolicy::TYPE_INTERNAL_IMAGE, EmptyString(), nsIContentPolicy::TYPE_INTERNAL_IMAGE, EmptyString(),