+18
−3
Loading
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