Bug 1597159 - Defer creating DocumentLoadListener's stream filter until after we process switch. r=kmag

Differential Revision: https://phabricator.services.mozilla.com/D64698
This commit is contained in:
Matt Woodrow
2020-04-09 07:03:49 +00:00
parent 88d78dbe09
commit 3dd12ef035
19 changed files with 317 additions and 58 deletions

View File

@@ -12520,10 +12520,12 @@ nsDocShell::ResumeRedirectedLoad(uint64_t aIdentifier, int32_t aHistoryIndex) {
// Call into InternalLoad with the pending channel when it is received.
cpcl->RegisterCallback(
aIdentifier,
[self, aHistoryIndex](nsDocShellLoadState* aLoadState,
nsTArray<net::DocumentChannelRedirect>&& aRedirects,
nsDOMNavigationTiming* aTiming) {
aIdentifier, [self, aHistoryIndex](
nsDocShellLoadState* aLoadState,
nsTArray<net::DocumentChannelRedirect>&& aRedirects,
nsTArray<Endpoint<extensions::PStreamFilterParent>>&&
aStreamFilterEndpoints,
nsDOMNavigationTiming* aTiming) {
MOZ_ASSERT(aLoadState->GetPendingRedirectedChannel());
if (NS_WARN_IF(self->mIsBeingDestroyed)) {
aLoadState->GetPendingRedirectedChannel()->Cancel(NS_BINDING_ABORTED);
@@ -12563,6 +12565,11 @@ nsDocShell::ResumeRedirectedLoad(uint64_t aIdentifier, int32_t aHistoryIndex) {
self->InternalLoad(aLoadState, nullptr, nullptr);
for (auto& endpoint : aStreamFilterEndpoints) {
extensions::StreamFilterParent::Attach(
aLoadState->GetPendingRedirectedChannel(), std::move(endpoint));
}
// If the channel isn't pending, then it means that InternalLoad
// never connected it, and we shouldn't try to continue. This
// can happen even if InternalLoad returned NS_OK.