Bug 1583700 - Create a new ClientSource from a parent-allocated ClientInfo even for same-origin redirects, since there might have been a prior cross-origin redirect. r=perry,asuth

We fail navigation-redirect.https.html?client without this (with the subtest to redirects to a cross-origin page and then redirects back again to a same-origin page). In this case the ClientChannelHelper running in the child only sees a same-origin redirect (the first URL to the final one), but we've still allocated a new ClientInfo in the parent and we want to create the corresponding ClientSource.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Woodrow 2019-10-21 21:47:02 +00:00
parent a4046507c0
commit ac69d4fff8
3 changed files with 13 additions and 5 deletions

View File

@ -83,13 +83,16 @@ class ClientChannelHelper final : public nsIInterfaceRequestor,
if (NS_SUCCEEDED(rv)) {
// If we're running in the child, but redirects are handled by the parent
// then our reserved/initial info should already have been moved to the
// new channel via the parent. If they still match, then we can copy our
// reserved client source to the new channel, since that isn't passed
// between processes.
// new channel via the parent. If they don't match, then we need to create
// a new reserved client for the specified info, otherwise we can copy our
// reserved client source to the new channel.
if (mMode == Mode::Mode_Child) {
Maybe<ClientInfo> newClientInfo = newLoadInfo->GetReservedClientInfo();
if (reservedClient && newClientInfo &&
reservedClient->Info() == *newClientInfo) {
if (newClientInfo) {
if (!reservedClient || reservedClient->Info() != *newClientInfo) {
reservedClient = ClientManager::CreateSourceFromInfo(*newClientInfo,
mEventTarget);
}
newLoadInfo->GiveReservedClientSource(std::move(reservedClient));
}
} else {

View File

@ -48,6 +48,10 @@ bool ClientInfo::operator==(const ClientInfo& aRight) const {
return *mData == *aRight.mData;
}
bool ClientInfo::operator!=(const ClientInfo& aRight) const {
return *mData != *aRight.mData;
}
const nsID& ClientInfo::Id() const { return mData->id(); }
void ClientInfo::SetAgentClusterId(const nsID& aId) {

View File

@ -46,6 +46,7 @@ class ClientInfo final {
~ClientInfo();
bool operator==(const ClientInfo& aRight) const;
bool operator!=(const ClientInfo& aRight) const;
// Get the unique identifier chosen at the time of the global's creation.
const nsID& Id() const;