Bug 1578624 - P2: Extend nsDocShellLoadState for the extra options needed to describe front end loads. r=kmag,nika

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Woodrow 2019-10-09 04:53:06 +00:00
Родитель 4ae52d1f45
Коммит 4a351e1a82
5 изменённых файлов: 46 добавлений и 0 удалений

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

@ -704,6 +704,16 @@ nsDocShell::LoadURI(nsDocShellLoadState* aLoadState) {
}
}
if (aLoadState->GetOriginalURIString().isSome()) {
// Save URI string in case it's needed later when
// sending to search engine service in EndPageLoad()
mOriginalUriString = *aLoadState->GetOriginalURIString();
}
if (aLoadState->GetCancelContentJSEpoch().isSome()) {
SetCancelContentJSEpoch(*aLoadState->GetCancelContentJSEpoch());
}
// Note: we allow loads to get through here even if mFiredUnloadEvent is
// true; that case will get handled in LoadInternal or LoadHistoryEntry,
// so we pass false as the second parameter to IsNavigationAllowed.

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

@ -66,6 +66,8 @@ nsDocShellLoadState::nsDocShellLoadState(
mTriggeringPrincipal = aLoadState.TriggeringPrincipal();
mPrincipalToInherit = aLoadState.PrincipalToInherit();
mCsp = aLoadState.Csp();
mOriginalURIString = aLoadState.OriginalURIString();
mCancelContentJSEpoch = aLoadState.CancelContentJSEpoch();
mPostDataStream = aLoadState.PostDataStream();
mHeadersStream = aLoadState.HeadersStream();
}
@ -480,6 +482,8 @@ DocShellLoadStateInit nsDocShellLoadState::Serialize() {
loadState.TriggeringPrincipal() = mTriggeringPrincipal;
loadState.PrincipalToInherit() = mPrincipalToInherit;
loadState.Csp() = mCsp;
loadState.OriginalURIString() = mOriginalURIString;
loadState.CancelContentJSEpoch() = mCancelContentJSEpoch;
loadState.ReferrerInfo() = mReferrerInfo;
loadState.PostDataStream() = mPostDataStream;
loadState.HeadersStream() = mHeadersStream;

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

@ -192,6 +192,20 @@ class nsDocShellLoadState final {
return mPendingRedirectedChannel;
}
void SetOriginalURIString(const nsCString& aOriginalURI) {
mOriginalURIString.emplace(aOriginalURI);
}
const Maybe<nsCString>& GetOriginalURIString() const {
return mOriginalURIString;
}
void SetCancelContentJSEpoch(int32_t aCancelEpoch) {
mCancelContentJSEpoch.emplace(aCancelEpoch);
}
const Maybe<int32_t>& GetCancelContentJSEpoch() const {
return mCancelContentJSEpoch;
}
// When loading a document through nsDocShell::LoadURI(), a special set of
// flags needs to be set based on other values in nsDocShellLoadState. This
// function calculates those flags, before the LoadState is passed to
@ -338,6 +352,15 @@ class nsDocShellLoadState final {
// If set, a pending cross-process redirected channel should be used to
// perform the load. The channel will be stored in this value.
nsCOMPtr<nsIChildChannel> mPendingRedirectedChannel;
// An optional string representation of mURI, before any
// fixups were applied, so that we can send it to a search
// engine service if needed.
Maybe<nsCString> mOriginalURIString;
// An optional value to pass to nsIDocShell::setCancelJSEpoch
// when initiating the load.
Maybe<int32_t> mCancelContentJSEpoch;
};
#endif /* nsDocShellLoadState_h__ */

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

@ -232,6 +232,9 @@ struct DocShellLoadStateInit
// encounters a server side redirect.
nsIContentSecurityPolicy Csp;
nsCString? OriginalURIString;
int32_t? CancelContentJSEpoch;
nsIInputStream PostDataStream;
nsIInputStream HeadersStream;

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

@ -61,4 +61,10 @@ dictionary LoadURIOptions {
* and cannot be used to resolve aURI.
*/
URI? baseURI = null;
/**
* If non-0, a value to pass to nsIDocShell::setCancelContentJSEpoch
* when initiating the load.
*/
long cancelContentJSEpoch = 0;
};