Bug 1689601, Add DocumentChannel ID to DocumentLoadListener, r=peterv

Differential Revision: https://phabricator.services.mozilla.com/D105231
This commit is contained in:
Olli Pettay 2021-03-02 09:44:09 +00:00
Родитель 6122b9c018
Коммит 9343c38009
3 изменённых файлов: 11 добавлений и 3 удалений

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

@ -39,7 +39,8 @@ bool DocumentChannelParent::Init(dom::CanonicalBrowsingContext* aContext,
RefPtr<DocumentLoadListener::OpenPromise> promise;
if (loadState->GetChannelInitialized()) {
promise = DocumentLoadListener::ClaimParentLoad(
getter_AddRefs(mDocumentLoadListener), loadState->GetLoadIdentifier());
getter_AddRefs(mDocumentLoadListener), loadState->GetLoadIdentifier(),
Some(aArgs.channelId()));
}
if (!promise) {
bool isDocumentLoad =

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

@ -520,6 +520,7 @@ auto DocumentLoadListener::Open(nsDocShellLoadState* aLoadState,
if (identChannel && aChannelId) {
Unused << identChannel->SetChannelId(*aChannelId);
}
mDocumentChannelId = aChannelId;
RefPtr<nsHttpChannel> httpChannelImpl = do_QueryObject(mChannel);
if (httpChannelImpl) {
@ -904,7 +905,8 @@ void DocumentLoadListener::CleanupParentLoadAttempt(uint64_t aLoadIdent) {
}
auto DocumentLoadListener::ClaimParentLoad(DocumentLoadListener** aListener,
uint64_t aLoadIdent)
uint64_t aLoadIdent,
Maybe<uint64_t> aChannelId)
-> RefPtr<OpenPromise> {
nsCOMPtr<nsIRedirectChannelRegistrar> registrar =
RedirectChannelRegistrar::GetOrCreate();
@ -920,6 +922,8 @@ auto DocumentLoadListener::ClaimParentLoad(DocumentLoadListener** aListener,
return nullptr;
}
loadListener->mDocumentChannelId = aChannelId;
MOZ_DIAGNOSTIC_ASSERT(loadListener->mOpenPromise);
loadListener.forget(aListener);

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

@ -195,7 +195,8 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
// Looks up aLoadIdent to find the associated, cleans up the registration
static RefPtr<OpenPromise> ClaimParentLoad(DocumentLoadListener** aListener,
uint64_t aLoadIdent);
uint64_t aLoadIdent,
Maybe<uint64_t> aChannelId);
// Called by the DocumentChannelParent if actor got destroyed or the parent
// channel got deleted.
@ -464,6 +465,8 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
nsCOMPtr<nsIChannel> mChannel;
Maybe<uint64_t> mDocumentChannelId;
// An instance of ParentChannelListener that we use as a listener
// between mChannel (and any future redirected mChannels) and us.
// This handles service worker interception, and retargetting