diff --git a/netwerk/ipc/NeckoChild.cpp b/netwerk/ipc/NeckoChild.cpp index 9b0ad46f9f57..fbef3725ccd1 100644 --- a/netwerk/ipc/NeckoChild.cpp +++ b/netwerk/ipc/NeckoChild.cpp @@ -119,9 +119,9 @@ NeckoChild::AllocPAltDataOutputStreamChild( const nsCString& type, PHttpChannelChild* channel) { - AltDataOutputStreamChild* stream = new AltDataOutputStreamChild(); - stream->AddIPDLReference(); - return stream; + // We don't allocate here: see HttpChannelChild::OpenAlternativeOutputStream() + NS_NOTREACHED("AllocPAltDataOutputStreamChild should not be called"); + return nullptr; } bool diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index f50415de2091..41d125aae715 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -2715,8 +2715,20 @@ HttpChannelChild::OpenAlternativeOutputStream(const nsACString & aType, nsIOutpu return NS_ERROR_NOT_AVAILABLE; } - RefPtr stream = - static_cast(gNeckoChild->SendPAltDataOutputStreamConstructor(nsCString(aType), this)); + nsCOMPtr neckoTarget = GetNeckoTarget(); + MOZ_ASSERT(neckoTarget); + + RefPtr stream = new AltDataOutputStreamChild(); + stream->AddIPDLReference(); + + gNeckoChild->SetEventTargetForActor(stream, neckoTarget); + + if (!gNeckoChild->SendPAltDataOutputStreamConstructor(stream, + nsCString(aType), + this)) { + return NS_ERROR_FAILURE; + } + stream.forget(_retval); return NS_OK; }