Bug 1561079 - Add `referrerInfo` to <browser> r=ckerschb

Differential Revision: https://phabricator.services.mozilla.com/D36525

--HG--
extra : moz-landing-system : lando
This commit is contained in:
James Willcox 2019-07-29 15:34:30 +00:00
Родитель 14cc86962d
Коммит bc13c95548
5 изменённых файлов: 19 добавлений и 1 удалений

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

@ -7,6 +7,7 @@ interface nsIContentSecurityPolicy;
interface nsIPrincipal;
interface nsIURI;
interface nsIWebProgress;
interface nsIReferrerInfo;
webidl FrameLoader;
@ -81,6 +82,7 @@ interface nsIBrowser : nsISupports
readonly attribute nsIPrincipal contentPrincipal;
readonly attribute nsIContentSecurityPolicy csp;
readonly attribute nsIReferrerInfo referrerInfo;
/**
* Whether or not the browser is in the process of an nsIWebNavigation
@ -136,6 +138,7 @@ interface nsIBrowser : nsISupports
* @param aContentStoragePrincipal the security principal for the new
* document's storage
* @param aCSP the content security policy of the new document
* @param aReferrerInfo the referrer info of the new document
* @param aIsSynthetic whether or not the document is synthetic
* @param aInnerWindowID the inner window ID of the document
* @param aHasRequestContextID whether or not the the request context has a
@ -152,6 +155,7 @@ interface nsIBrowser : nsISupports
in nsIPrincipal aContentPrincipal,
in nsIPrincipal aContentStoragePrincipal,
in nsIContentSecurityPolicy aCSP,
in nsIReferrerInfo aReferrerInfo,
in boolean aIsSynthetic,
in uint64_t aInnerWindowID,
in boolean aHasRequestContextID,

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

@ -3617,6 +3617,7 @@ NS_IMETHODIMP BrowserChild::OnLocationChange(nsIWebProgress* aWebProgress,
MOZ_TRY(CSPToCSPInfo(csp, &locationChangeData->csp().ref()));
}
locationChangeData->referrerInfo() = document->ReferrerInfo();
locationChangeData->isSyntheticDocument() = document->IsSyntheticDocument();
if (nsCOMPtr<nsILoadGroup> loadGroup = document->GetDocumentLoadGroup()) {

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

@ -2494,6 +2494,8 @@ mozilla::ipc::IPCResult BrowserParent::RecvOnLocationChange(
PrincipalInfoToPrincipal(aLocationChangeData->contentPrincipal());
nsCOMPtr<nsIPrincipal> contentStoragePrincipal = PrincipalInfoToPrincipal(
aLocationChangeData->contentStoragePrincipal());
nsCOMPtr<nsIReferrerInfo> referrerInfo =
aLocationChangeData->referrerInfo();
Unused << browser->SetIsNavigating(aLocationChangeData->isNavigating());
Unused << browser->UpdateForLocationChange(
@ -2501,7 +2503,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvOnLocationChange(
aLocationChangeData->mayEnableCharacterEncodingMenu(),
aLocationChangeData->charsetAutodetected(),
aLocationChangeData->documentURI(), aLocationChangeData->title(),
contentPrincipal, contentStoragePrincipal, csp,
contentPrincipal, contentStoragePrincipal, csp, referrerInfo,
aLocationChangeData->isSyntheticDocument(),
aWebProgressData->innerDOMWindowID(),
aLocationChangeData->requestContextID().isSome(),

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

@ -153,6 +153,7 @@ struct WebProgressLocationChangeData
PrincipalInfo contentPrincipal;
PrincipalInfo contentStoragePrincipal;
CSPInfo? csp;
nsIReferrerInfo referrerInfo;
uint64_t? requestContextID;
};

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

@ -306,6 +306,8 @@
this._csp = null;
this._referrerInfo = null;
this._contentRequestContextID = null;
this._fullZoom = 1;
@ -803,6 +805,12 @@
}
}
get referrerInfo() {
return this.isRemoteBrowser
? this._referrerInfo
: this.contentDocument.referrerInfo;
}
get fullZoom() {
if (this.isRemoteBrowser) {
return this._fullZoom;
@ -1560,6 +1568,7 @@
aContentPrincipal,
aContentStoragePrincipal,
aCSP,
aReferrerInfo,
aIsSynthetic,
aInnerWindowID,
aHaveRequestContextID,
@ -1584,6 +1593,7 @@
this._contentPrincipal = aContentPrincipal;
this._contentStoragePrincipal = aContentStoragePrincipal;
this._csp = aCSP;
this._referrerInfo = aReferrerInfo;
this._isSyntheticDocument = aIsSynthetic;
this._innerWindowID = aInnerWindowID;
this._contentRequestContextID = aHaveRequestContextID