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
parent 14cc86962d
commit bc13c95548
5 changed files with 19 additions and 1 deletions

View File

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

View File

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

View File

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

View File

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

View File

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