Bug 1706594 - Add nsICancelable out param to nsBaseChannel::BeginAsyncRead virtual...
authorLuca Greco <lgreco@mozilla.com>
Mon, 11 Oct 2021 11:06:47 +0000 (11:06 +0000)
committerMike Hommey <glandium@debian.org>
Tue, 11 Jan 2022 21:58:53 +0000 (21:58 +0000)
commit56247acfeaa2d62469467c8c900b9b6a0666eb9c
treeb2b74bc784345ebd52ba6c82b637f7c54a905ad1
parentffa58a4c1a45f1ea5c2d13e8c1ad6262bd75b42b
Bug 1706594 - Add nsICancelable out param to nsBaseChannel::BeginAsyncRead virtual method. r=nika,necko-reviewers,valentin

This patch introduces:

- a second nsICancelable out param in nsBaseChannel::BeginAsyncRead, which is meant to be non-null
  when the subclass is unable to set the nsIRequest out param right away (e.g because there is
  some async work needed before the subclass is able to get an nsIRequest instance).
  The nsICancelable does only allow the channel to cancel the underlying request (and stream pump),
  but it doesn't allow the channel to be suspended and resumed, but that was already the case
  for the subclasses that were already not returning an nsIRequest instance (e.g. like the
  ExtensionProtocolHandler was doing when it is asynchrously retriving a stream from the parent
  process).

- require NotNull<nsCOMPtr<...>> in the SimpleChannel's BeginAsyncRead callback signature, to make harder
  to overlook the requirement of returning an nsIRequest or nsICancelable.

- a diagnostic assertion (from SimpleChannel's BeginAsyncRead method) to more visible fail if we still end
  up with neither an nsIRequest or nsICancelable result as SimpleChannel callback result.

- changes to ExtensionProtocolHandler, PageThumbProtocolHandler and nsAnnoProtocolHandler to adapt them
  to the new nsBaseChannel::BeginAsyncRead signature.

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

Gbp-Pq: Topic fixes
Gbp-Pq: Name Bug-1706594-Add-nsICancelable-out-param-to-nsBaseCha.patch
netwerk/base/SimpleChannel.cpp
netwerk/base/SimpleChannel.h
netwerk/base/nsBaseChannel.cpp
netwerk/base/nsBaseChannel.h
netwerk/protocol/res/ExtensionProtocolHandler.cpp
netwerk/protocol/res/PageThumbProtocolHandler.cpp
toolkit/components/places/nsAnnoProtocolHandler.cpp