Bug 1530209 - Removed context argument from various methods. r=necko-reviewers,valentin

Differential Revision: https://phabricator.services.mozilla.com/D129797
This commit is contained in:
ssummar 2021-11-24 11:25:41 +00:00
parent 324af6151f
commit b9d6fce436
38 changed files with 95 additions and 146 deletions

View File

@ -51,7 +51,6 @@ uint32_t DynamicImage::GetAnimationConsumers() { return 0; }
#endif
nsresult DynamicImage::OnImageDataAvailable(nsIRequest* aRequest,
nsISupports* aContext,
nsIInputStream* aInStr,
uint64_t aSourceOffset,
uint32_t aCount) {
@ -59,7 +58,6 @@ nsresult DynamicImage::OnImageDataAvailable(nsIRequest* aRequest,
}
nsresult DynamicImage::OnImageDataComplete(nsIRequest* aRequest,
nsISupports* aContext,
nsresult aStatus, bool aLastPart) {
return NS_OK;
}

View File

@ -43,12 +43,10 @@ class DynamicImage : public Image {
#endif
virtual nsresult OnImageDataAvailable(nsIRequest* aRequest,
nsISupports* aContext,
nsIInputStream* aInStr,
uint64_t aSourceOffset,
uint32_t aCount) override;
virtual nsresult OnImageDataComplete(nsIRequest* aRequest,
nsISupports* aContext, nsresult aStatus,
virtual nsresult OnImageDataComplete(nsIRequest* aRequest, nsresult aStatus,
bool aLastPart) override;
virtual void OnSurfaceDiscarded(const SurfaceKey& aSurfaceKey) override;

View File

@ -245,7 +245,6 @@ class Image : public imgIContainer {
* until OnImageDataAvailable is called.
*/
virtual nsresult OnImageDataAvailable(nsIRequest* aRequest,
nsISupports* aContext,
nsIInputStream* aInStr,
uint64_t aSourceOffset,
uint32_t aCount) = 0;
@ -254,12 +253,10 @@ class Image : public imgIContainer {
* Called from OnStopRequest when the image's underlying request completes.
*
* @param aRequest The completed request.
* @param aContext Context from Necko's OnStopRequest.
* @param aStatus A success or failure code.
* @param aLastPart Whether this is the final part of the underlying request.
*/
virtual nsresult OnImageDataComplete(nsIRequest* aRequest,
nsISupports* aContext, nsresult aStatus,
virtual nsresult OnImageDataComplete(nsIRequest* aRequest, nsresult aStatus,
bool aLastPart) = 0;
/**

View File

@ -59,19 +59,16 @@ uint32_t ImageWrapper::GetAnimationConsumers() {
#endif
nsresult ImageWrapper::OnImageDataAvailable(nsIRequest* aRequest,
nsISupports* aContext,
nsIInputStream* aInStr,
uint64_t aSourceOffset,
uint32_t aCount) {
return mInnerImage->OnImageDataAvailable(aRequest, aContext, aInStr,
aSourceOffset, aCount);
return mInnerImage->OnImageDataAvailable(aRequest, aInStr, aSourceOffset,
aCount);
}
nsresult ImageWrapper::OnImageDataComplete(nsIRequest* aRequest,
nsISupports* aContext,
nsresult aStatus, bool aLastPart) {
return mInnerImage->OnImageDataComplete(aRequest, aContext, aStatus,
aLastPart);
return mInnerImage->OnImageDataComplete(aRequest, aStatus, aLastPart);
}
void ImageWrapper::OnSurfaceDiscarded(const SurfaceKey& aSurfaceKey) {

View File

@ -37,12 +37,10 @@ class ImageWrapper : public Image {
#endif
virtual nsresult OnImageDataAvailable(nsIRequest* aRequest,
nsISupports* aContext,
nsIInputStream* aInStr,
uint64_t aSourceOffset,
uint32_t aCount) override;
virtual nsresult OnImageDataComplete(nsIRequest* aRequest,
nsISupports* aContext, nsresult aStatus,
virtual nsresult OnImageDataComplete(nsIRequest* aRequest, nsresult aStatus,
bool aLastPart) override;
virtual void OnSurfaceDiscarded(const SurfaceKey& aSurfaceKey) override;

View File

@ -222,7 +222,6 @@ void MultipartImage::SetProgressTracker(ProgressTracker* aTracker) {
}
nsresult MultipartImage::OnImageDataAvailable(nsIRequest* aRequest,
nsISupports* aContext,
nsIInputStream* aInStr,
uint64_t aSourceOffset,
uint32_t aCount) {
@ -232,18 +231,15 @@ nsresult MultipartImage::OnImageDataAvailable(nsIRequest* aRequest,
// We may trigger notifications that will free mNextPart, so keep it alive.
RefPtr<Image> nextPart = mNextPart;
if (nextPart) {
nextPart->OnImageDataAvailable(aRequest, aContext, aInStr, aSourceOffset,
aCount);
nextPart->OnImageDataAvailable(aRequest, aInStr, aSourceOffset, aCount);
} else {
InnerImage()->OnImageDataAvailable(aRequest, aContext, aInStr,
aSourceOffset, aCount);
InnerImage()->OnImageDataAvailable(aRequest, aInStr, aSourceOffset, aCount);
}
return NS_OK;
}
nsresult MultipartImage::OnImageDataComplete(nsIRequest* aRequest,
nsISupports* aContext,
nsresult aStatus, bool aLastPart) {
// Note that this method is special in that we forward it to the next part if
// one exists, and *not* the current part.
@ -251,9 +247,9 @@ nsresult MultipartImage::OnImageDataComplete(nsIRequest* aRequest,
// We may trigger notifications that will free mNextPart, so keep it alive.
RefPtr<Image> nextPart = mNextPart;
if (nextPart) {
nextPart->OnImageDataComplete(aRequest, aContext, aStatus, aLastPart);
nextPart->OnImageDataComplete(aRequest, aStatus, aLastPart);
} else {
InnerImage()->OnImageDataComplete(aRequest, aContext, aStatus, aLastPart);
InnerImage()->OnImageDataComplete(aRequest, aStatus, aLastPart);
}
return NS_OK;

View File

@ -33,12 +33,10 @@ class MultipartImage : public ImageWrapper, public IProgressObserver {
virtual already_AddRefed<ProgressTracker> GetProgressTracker() override;
virtual void SetProgressTracker(ProgressTracker* aTracker) override;
virtual nsresult OnImageDataAvailable(nsIRequest* aRequest,
nsISupports* aContext,
nsIInputStream* aInStr,
uint64_t aSourceOffset,
uint32_t aCount) override;
virtual nsresult OnImageDataComplete(nsIRequest* aRequest,
nsISupports* aContext, nsresult aStatus,
virtual nsresult OnImageDataComplete(nsIRequest* aRequest, nsresult aStatus,
bool aLastPart) override;
// We don't support locking or track animation consumers for individual parts,

View File

@ -870,8 +870,8 @@ RasterImage::GetImageSpaceInvalidationRect(const IntRect& aRect) {
return aRect;
}
nsresult RasterImage::OnImageDataComplete(nsIRequest*, nsISupports*,
nsresult aStatus, bool aLastPart) {
nsresult RasterImage::OnImageDataComplete(nsIRequest*, nsresult aStatus,
bool aLastPart) {
MOZ_ASSERT(NS_IsMainThread());
// Record that we have all the data we're going to get now.
@ -937,7 +937,7 @@ void RasterImage::NotifyForLoadEvent(Progress aProgress) {
NotifyProgress(aProgress);
}
nsresult RasterImage::OnImageDataAvailable(nsIRequest*, nsISupports*,
nsresult RasterImage::OnImageDataAvailable(nsIRequest*,
nsIInputStream* aInputStream,
uint64_t, uint32_t aCount) {
nsresult rv = mSourceBuffer->AppendFromInputStream(aInputStream, aCount);

View File

@ -232,12 +232,10 @@ class RasterImage final : public ImageResource,
//////////////////////////////////////////////////////////////////////////////
virtual nsresult OnImageDataAvailable(nsIRequest* aRequest,
nsISupports* aContext,
nsIInputStream* aInStr,
uint64_t aSourceOffset,
uint32_t aCount) override;
virtual nsresult OnImageDataComplete(nsIRequest* aRequest,
nsISupports* aContext, nsresult aStatus,
virtual nsresult OnImageDataComplete(nsIRequest* aRequest, nsresult aStatus,
bool aLastPart) override;
void NotifyForLoadEvent(Progress aProgress);

View File

@ -379,7 +379,6 @@ void VectorImage::CollectSizeOfSurfaces(
}
nsresult VectorImage::OnImageDataComplete(nsIRequest* aRequest,
nsISupports* aContext,
nsresult aStatus, bool aLastPart) {
// Call our internal OnStopRequest method, which only talks to our embedded
// SVG document. This won't have any effect on our ProgressTracker.
@ -405,7 +404,6 @@ nsresult VectorImage::OnImageDataComplete(nsIRequest* aRequest,
}
nsresult VectorImage::OnImageDataAvailable(nsIRequest* aRequest,
nsISupports* aContext,
nsIInputStream* aInStr,
uint64_t aSourceOffset,
uint32_t aCount) {

View File

@ -45,12 +45,10 @@ class VectorImage final : public ImageResource, public nsIStreamListener {
MallocSizeOf aMallocSizeOf) const override;
virtual nsresult OnImageDataAvailable(nsIRequest* aRequest,
nsISupports* aContext,
nsIInputStream* aInStr,
uint64_t aSourceOffset,
uint32_t aCount) override;
virtual nsresult OnImageDataComplete(nsIRequest* aRequest,
nsISupports* aContext, nsresult aResult,
virtual nsresult OnImageDataComplete(nsIRequest* aRequest, nsresult aResult,
bool aLastPart) override;
virtual void OnSurfaceDiscarded(const SurfaceKey& aSurfaceKey) override;

View File

@ -728,8 +728,7 @@ imgRequest::OnStopRequest(nsIRequest* aRequest, nsresult status) {
// trigger a failure, since the image might be waiting for more non-optional
// data and this is the point where we break the news that it's not coming.
if (image) {
nsresult rv =
image->OnImageDataComplete(aRequest, nullptr, status, lastPart);
nsresult rv = image->OnImageDataComplete(aRequest, status, lastPart);
// If we got an error in the OnImageDataComplete() call, we don't want to
// proceed as if nothing bad happened. However, we also want to give
@ -1016,7 +1015,7 @@ imgRequest::OnDataAvailable(nsIRequest* aRequest, nsIInputStream* aInStr,
// Notify the image that it has new data.
if (aInStr) {
nsresult rv =
image->OnImageDataAvailable(aRequest, nullptr, aInStr, aOffset, aCount);
image->OnImageDataAvailable(aRequest, aInStr, aOffset, aCount);
if (NS_FAILED(rv)) {
MOZ_LOG(gImgLog, LogLevel::Warning,

View File

@ -103,8 +103,8 @@ class ImageDecoderListener final : public nsIStreamListener,
}
}
return mImage->OnImageDataAvailable(aRequest, nullptr, aInputStream,
aOffset, aCount);
return mImage->OnImageDataAvailable(aRequest, aInputStream, aOffset,
aCount);
}
NS_IMETHOD
@ -118,7 +118,7 @@ class ImageDecoderListener final : public nsIStreamListener,
return NS_OK;
}
mImage->OnImageDataComplete(aRequest, nullptr, aStatus, true);
mImage->OnImageDataComplete(aRequest, aStatus, true);
nsCOMPtr<imgIContainer> container = this;
mCallback->OnImageReady(container, aStatus);
return NS_OK;
@ -188,7 +188,7 @@ class ImageDecoderHelper final : public Runnable,
// operation.
if (NS_IsMainThread()) {
// Let the Image know we've sent all the data.
mImage->OnImageDataComplete(nullptr, nullptr, mStatus, true);
mImage->OnImageDataComplete(nullptr, mStatus, true);
RefPtr<ProgressTracker> tracker = mImage->GetProgressTracker();
tracker->SyncNotifyProgress(FLAG_LOAD_COMPLETE);
@ -231,7 +231,7 @@ class ImageDecoderHelper final : public Runnable,
}
// Send the source data to the Image.
rv = mImage->OnImageDataAvailable(nullptr, nullptr, mInputStream, 0,
rv = mImage->OnImageDataAvailable(nullptr, mInputStream, 0,
uint32_t(length));
if (NS_WARN_IF(NS_FAILED(rv))) {
return OperationCompleted(rv);
@ -347,11 +347,11 @@ imgTools::DecodeImageFromBuffer(const char* aBuffer, uint32_t aSize,
MOZ_ASSERT(stream);
MOZ_ASSERT(NS_InputStreamIsBuffered(stream));
rv = image->OnImageDataAvailable(nullptr, nullptr, stream, 0, aSize);
rv = image->OnImageDataAvailable(nullptr, stream, 0, aSize);
NS_ENSURE_SUCCESS(rv, rv);
// Let the Image know we've sent all the data.
rv = image->OnImageDataComplete(nullptr, nullptr, NS_OK, true);
rv = image->OnImageDataComplete(nullptr, NS_OK, true);
tracker->SyncNotifyProgress(FLAG_LOAD_COMPLETE);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -1034,12 +1034,12 @@ RefPtr<Image> TestCaseToDecodedImage(const ImageTestCase& aTestCase) {
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
// Write the data into the image.
rv = image->OnImageDataAvailable(nullptr, nullptr, inputStream, 0,
rv = image->OnImageDataAvailable(nullptr, inputStream, 0,
static_cast<uint32_t>(length));
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
// Let the image know we've sent all the data.
rv = image->OnImageDataComplete(nullptr, nullptr, NS_OK, true);
rv = image->OnImageDataComplete(nullptr, NS_OK, true);
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
RefPtr<ProgressTracker> tracker = image->GetProgressTracker();

View File

@ -41,12 +41,12 @@ TEST_F(ImageContainers, RasterImageContainer) {
ASSERT_TRUE(NS_SUCCEEDED(rv));
// Write the data into the image.
rv = image->OnImageDataAvailable(nullptr, nullptr, inputStream, 0,
rv = image->OnImageDataAvailable(nullptr, inputStream, 0,
static_cast<uint32_t>(length));
ASSERT_TRUE(NS_SUCCEEDED(rv));
// Let the image know we've sent all the data.
rv = image->OnImageDataComplete(nullptr, nullptr, NS_OK, true);
rv = image->OnImageDataComplete(nullptr, NS_OK, true);
ASSERT_TRUE(NS_SUCCEEDED(rv));
RefPtr<ProgressTracker> tracker = image->GetProgressTracker();

View File

@ -438,12 +438,12 @@ static void CheckDecoderFrameFirst(const ImageTestCase& aTestCase) {
ASSERT_TRUE(NS_SUCCEEDED(rv));
// Write the data into the image.
rv = image->OnImageDataAvailable(nullptr, nullptr, inputStream, 0,
rv = image->OnImageDataAvailable(nullptr, inputStream, 0,
static_cast<uint32_t>(length));
ASSERT_TRUE(NS_SUCCEEDED(rv));
// Let the image know we've sent all the data.
rv = image->OnImageDataComplete(nullptr, nullptr, NS_OK, true);
rv = image->OnImageDataComplete(nullptr, NS_OK, true);
ASSERT_TRUE(NS_SUCCEEDED(rv));
RefPtr<ProgressTracker> tracker = image->GetProgressTracker();
@ -548,12 +548,12 @@ static void CheckDecoderFrameCurrent(const ImageTestCase& aTestCase) {
ASSERT_TRUE(NS_SUCCEEDED(rv));
// Write the data into the image.
rv = image->OnImageDataAvailable(nullptr, nullptr, inputStream, 0,
rv = image->OnImageDataAvailable(nullptr, inputStream, 0,
static_cast<uint32_t>(length));
ASSERT_TRUE(NS_SUCCEEDED(rv));
// Let the image know we've sent all the data.
rv = image->OnImageDataComplete(nullptr, nullptr, NS_OK, true);
rv = image->OnImageDataComplete(nullptr, NS_OK, true);
ASSERT_TRUE(NS_SUCCEEDED(rv));
RefPtr<ProgressTracker> tracker = image->GetProgressTracker();
@ -1057,12 +1057,12 @@ TEST_F(ImageDecoders, MultipleSizesICOSingleChunk) {
ASSERT_TRUE(NS_SUCCEEDED(rv));
// Write the data into the image.
rv = image->OnImageDataAvailable(nullptr, nullptr, inputStream, 0,
rv = image->OnImageDataAvailable(nullptr, inputStream, 0,
static_cast<uint32_t>(length));
ASSERT_TRUE(NS_SUCCEEDED(rv));
// Let the image know we've sent all the data.
rv = image->OnImageDataComplete(nullptr, nullptr, NS_OK, true);
rv = image->OnImageDataComplete(nullptr, NS_OK, true);
ASSERT_TRUE(NS_SUCCEEDED(rv));
RefPtr<ProgressTracker> tracker = image->GetProgressTracker();

View File

@ -214,12 +214,12 @@ TEST_F(ImageDecoderMetadata, NoFrameDelayGIFFullDecode) {
ASSERT_TRUE(NS_SUCCEEDED(rv));
// Write the data into the image.
rv = image->OnImageDataAvailable(nullptr, nullptr, inputStream, 0,
rv = image->OnImageDataAvailable(nullptr, inputStream, 0,
static_cast<uint32_t>(length));
ASSERT_TRUE(NS_SUCCEEDED(rv));
// Let the image know we've sent all the data.
rv = image->OnImageDataComplete(nullptr, nullptr, NS_OK, true);
rv = image->OnImageDataComplete(nullptr, NS_OK, true);
ASSERT_TRUE(NS_SUCCEEDED(rv));
RefPtr<ProgressTracker> tracker = image->GetProgressTracker();

View File

@ -47,12 +47,12 @@ TEST_F(ImageSurfaceCache, Factor2) {
StaticPrefs::image_mem_decode_bytes_at_a_time_AtStartup()));
// Write the data into the image.
rv = image->OnImageDataAvailable(nullptr, nullptr, inputStream, 0,
rv = image->OnImageDataAvailable(nullptr, inputStream, 0,
static_cast<uint32_t>(length));
ASSERT_TRUE(NS_SUCCEEDED(rv));
// Let the image know we've sent all the data.
rv = image->OnImageDataComplete(nullptr, nullptr, NS_OK, true);
rv = image->OnImageDataComplete(nullptr, NS_OK, true);
ASSERT_TRUE(NS_SUCCEEDED(rv));
RefPtr<ProgressTracker> tracker = image->GetProgressTracker();

View File

@ -121,7 +121,7 @@ NS_IMETHODIMP nsDeflateConverter::OnDataAvailable(nsIRequest* aRequest,
while (mZstream.avail_out == 0) {
// buffer is full, push the data out to the listener
rv = PushAvailableData(aRequest, nullptr);
rv = PushAvailableData(aRequest);
NS_ENSURE_SUCCESS(rv, rv);
zerr = deflate(&mZstream, Z_NO_FLUSH);
}
@ -145,7 +145,7 @@ NS_IMETHODIMP nsDeflateConverter::OnStopRequest(nsIRequest* aRequest,
int zerr;
do {
zerr = deflate(&mZstream, Z_FINISH);
rv = PushAvailableData(aRequest, nullptr);
rv = PushAvailableData(aRequest);
NS_ENSURE_SUCCESS(rv, rv);
} while (zerr == Z_OK);
@ -154,8 +154,7 @@ NS_IMETHODIMP nsDeflateConverter::OnStopRequest(nsIRequest* aRequest,
return mListener->OnStopRequest(aRequest, aStatusCode);
}
nsresult nsDeflateConverter::PushAvailableData(nsIRequest* aRequest,
nsISupports* aContext) {
nsresult nsDeflateConverter::PushAvailableData(nsIRequest* aRequest) {
uint32_t bytesToWrite = sizeof(mWriteBuffer) - mZstream.avail_out;
// We don't need to do anything if there isn't any data
if (bytesToWrite == 0) return NS_OK;

View File

@ -51,7 +51,7 @@ class nsDeflateConverter final : public nsIStreamConverter {
unsigned char mWriteBuffer[kZipBufLen];
nsresult Init();
nsresult PushAvailableData(nsIRequest* aRequest, nsISupports* aContext);
nsresult PushAvailableData(nsIRequest* aRequest);
};
#endif

View File

@ -32,8 +32,7 @@ MemoryDownloader::OnStopRequest(nsIRequest* aRequest, nsresult aStatus) {
data.swap(mData);
RefPtr<IObserver> observer;
observer.swap(mObserver);
observer->OnDownloadComplete(this, aRequest, nullptr, aStatus,
std::move(data));
observer->OnDownloadComplete(this, aRequest, aStatus, std::move(data));
return NS_OK;
}

View File

@ -35,8 +35,8 @@ class MemoryDownloader final : public nsIStreamListener {
public:
// Note: aData may be null if (and only if) aStatus indicates failure.
virtual void OnDownloadComplete(MemoryDownloader* aDownloader,
nsIRequest* aRequest, nsISupports* aCtxt,
nsresult aStatus, Data aData) = 0;
nsIRequest* aRequest, nsresult aStatus,
Data aData) = 0;
};
explicit MemoryDownloader(IObserver* aObserver);

View File

@ -72,7 +72,7 @@ nsDownloader::OnStopRequest(nsIRequest* request, nsresult status) {
mSink = nullptr;
}
mObserver->OnDownloadComplete(this, request, nullptr, status, mLocation);
mObserver->OnDownloadComplete(this, request, status, mLocation);
mObserver = nullptr;
return NS_OK;

View File

@ -45,7 +45,6 @@ interface nsIDownloadObserver : nsISupports
*/
void onDownloadComplete(in nsIDownloader downloader,
in nsIRequest request,
in nsISupports ctxt,
in nsresult status,
in nsIFile result);
};

View File

@ -484,7 +484,7 @@ void HttpChannelChild::OnStartRequest(
mSuspendedByWaitingForPermissionCookie = true;
mEventQ->PrependEvent(MakeUnique<NeckoTargetChannelFunctionEvent>(
this, [self = UnsafePtr<HttpChannelChild>(this)]() {
self->DoOnStartRequest(self, nullptr);
self->DoOnStartRequest(self);
}));
return;
}
@ -495,7 +495,7 @@ void HttpChannelChild::OnStartRequest(
nsHttpHandler::IsHttp3SupportedByServer(mResponseHead.get());
}
DoOnStartRequest(this, nullptr);
DoOnStartRequest(this);
}
void HttpChannelChild::ProcessOnAfterLastPart(const nsresult& aStatus) {
@ -543,8 +543,7 @@ void HttpChannelChild::OnAfterLastPart(const nsresult& aStatus) {
}
}
void HttpChannelChild::DoOnStartRequest(nsIRequest* aRequest,
nsISupports* aContext) {
void HttpChannelChild::DoOnStartRequest(nsIRequest* aRequest) {
nsresult rv;
LOG(("HttpChannelChild::DoOnStartRequest [this=%p]\n", this));
@ -666,7 +665,7 @@ void HttpChannelChild::OnTransportAndData(const nsresult& aChannelStatus,
return;
}
DoOnDataAvailable(this, nullptr, stringStream, aOffset, aCount);
DoOnDataAvailable(this, stringStream, aOffset, aCount);
stringStream->Close();
// TODO: Bug 1523916 backpressure needs to take into account if the data is
@ -756,7 +755,6 @@ void HttpChannelChild::DoOnProgress(nsIRequest* aRequest, int64_t progress,
}
void HttpChannelChild::DoOnDataAvailable(nsIRequest* aRequest,
nsISupports* aContext,
nsIInputStream* aStream,
uint64_t aOffset, uint32_t aCount) {
AUTO_PROFILER_LABEL("HttpChannelChild::DoOnDataAvailable", NETWORK);
@ -904,7 +902,7 @@ void HttpChannelChild::OnStopRequest(
// so make sure this goes out of scope before then.
AutoEventEnqueuer ensureSerialDispatch(mEventQ);
DoOnStopRequest(this, aChannelStatus, nullptr);
DoOnStopRequest(this, aChannelStatus);
// DoOnStopRequest() calls ReleaseListeners()
}
}
@ -978,8 +976,7 @@ void HttpChannelChild::CollectOMTTelemetry() {
}
void HttpChannelChild::DoOnStopRequest(nsIRequest* aRequest,
nsresult aChannelStatus,
nsISupports* aContext) {
nsresult aChannelStatus) {
AUTO_PROFILER_LABEL("HttpChannelChild::DoOnStopRequest", NETWORK);
LOG(("HttpChannelChild::DoOnStopRequest [this=%p]\n", this));
MOZ_ASSERT(NS_IsMainThread());

View File

@ -236,16 +236,14 @@ class HttpChannelChild final : public PHttpChannelChild,
int32_t mUnreportBytesRead = 0;
void DoOnConsoleReport(nsTArray<ConsoleReportCollected>&& aConsoleReports);
void DoOnStartRequest(nsIRequest* aRequest, nsISupports* aContext);
void DoOnStartRequest(nsIRequest* aRequest);
void DoOnStatus(nsIRequest* aRequest, nsresult status);
void DoOnProgress(nsIRequest* aRequest, int64_t progress,
int64_t progressMax);
void DoOnDataAvailable(nsIRequest* aRequest, nsISupports* aContext,
nsIInputStream* aStream, uint64_t offset,
uint32_t count);
void DoOnDataAvailable(nsIRequest* aRequest, nsIInputStream* aStream,
uint64_t offset, uint32_t count);
void DoPreOnStopRequest(nsresult aStatus);
void DoOnStopRequest(nsIRequest* aRequest, nsresult aChannelStatus,
nsISupports* aContext);
void DoOnStopRequest(nsIRequest* aRequest, nsresult aChannelStatus);
void ContinueOnStopRequest();
// Try send DeletingChannel message to parent side. Dispatch an async task to

View File

@ -150,7 +150,7 @@ NS_IMETHODIMP
nsDirIndexParser::OnStopRequest(nsIRequest* aRequest, nsresult aStatusCode) {
// Finish up
if (mBuf.Length() > (uint32_t)mLineStart) {
ProcessData(aRequest, nullptr);
ProcessData(aRequest);
}
return NS_OK;
@ -367,11 +367,10 @@ nsDirIndexParser::OnDataAvailable(nsIRequest* aRequest, nsIInputStream* aStream,
// work on other strings.
mBuf.SetLength(len + count);
return ProcessData(aRequest, nullptr);
return ProcessData(aRequest);
}
nsresult nsDirIndexParser::ProcessData(nsIRequest* aRequest,
nsISupports* aCtxt) {
nsresult nsDirIndexParser::ProcessData(nsIRequest* aRequest) {
if (!mListener) return NS_ERROR_FAILURE;
int32_t numItems = 0;
@ -401,7 +400,7 @@ nsresult nsDirIndexParser::ProcessData(nsIRequest* aRequest,
char* value = ((char*)buf) + 4;
nsUnescape(value);
mListener->OnInformationAvailable(aRequest, aCtxt,
mListener->OnInformationAvailable(aRequest,
NS_ConvertUTF8toUTF16(value));
} else if (buf[2] == '2' && buf[3] == ':') {
@ -419,7 +418,7 @@ nsresult nsDirIndexParser::ProcessData(nsIRequest* aRequest,
nsCOMPtr<nsIDirIndex> idx = new nsDirIndex();
ParseData(idx, ((char*)buf) + 4, lineLen - 4);
mListener->OnIndexAvailable(aRequest, aCtxt, idx);
mListener->OnIndexAvailable(aRequest, idx);
}
}
} else if (buf[0] == '3') {

View File

@ -57,7 +57,7 @@ class nsDirIndexParser : public nsIDirIndexParser {
bool mHasDescription{false};
int mFormat[8]{-1};
nsresult ProcessData(nsIRequest* aRequest, nsISupports* aCtxt);
nsresult ProcessData(nsIRequest* aRequest);
void ParseFormat(const char* aFormatStr);
void ParseData(nsIDirIndex* aIdx, char* aDataStr, int32_t lineLen);

View File

@ -244,8 +244,7 @@ nsresult nsHTTPCompressConv::BrotliHandler(nsIInputStream* stream,
}
if (outSize > 0) {
nsresult rv = self->do_OnDataAvailable(
self->mBrotli->mRequest, self->mBrotli->mContext,
self->mBrotli->mSourceOffset,
self->mBrotli->mRequest, self->mBrotli->mSourceOffset,
reinterpret_cast<const char*>(outBuffer.get()), outSize);
LOG(("nsHttpCompressConv %p BrotliHandler ODA rv=%" PRIx32, self,
static_cast<uint32_t>(rv)));
@ -361,8 +360,8 @@ nsHTTPCompressConv::OnDataAvailable(nsIRequest* request, nsIInputStream* iStr,
if (code == Z_STREAM_END) {
if (bytesWritten) {
rv = do_OnDataAvailable(request, nullptr, aSourceOffset,
(char*)mOutBuffer, bytesWritten);
rv = do_OnDataAvailable(request, aSourceOffset, (char*)mOutBuffer,
bytesWritten);
if (NS_FAILED(rv)) {
return rv;
}
@ -374,16 +373,16 @@ nsHTTPCompressConv::OnDataAvailable(nsIRequest* request, nsIInputStream* iStr,
}
if (code == Z_OK) {
if (bytesWritten) {
rv = do_OnDataAvailable(request, nullptr, aSourceOffset,
(char*)mOutBuffer, bytesWritten);
rv = do_OnDataAvailable(request, aSourceOffset, (char*)mOutBuffer,
bytesWritten);
if (NS_FAILED(rv)) {
return rv;
}
}
} else if (code == Z_BUF_ERROR) {
if (bytesWritten) {
rv = do_OnDataAvailable(request, nullptr, aSourceOffset,
(char*)mOutBuffer, bytesWritten);
rv = do_OnDataAvailable(request, aSourceOffset, (char*)mOutBuffer,
bytesWritten);
if (NS_FAILED(rv)) {
return rv;
}
@ -444,8 +443,8 @@ nsHTTPCompressConv::OnDataAvailable(nsIRequest* request, nsIInputStream* iStr,
if (code == Z_STREAM_END) {
if (bytesWritten) {
rv = do_OnDataAvailable(request, nullptr, aSourceOffset,
(char*)mOutBuffer, bytesWritten);
rv = do_OnDataAvailable(request, aSourceOffset, (char*)mOutBuffer,
bytesWritten);
if (NS_FAILED(rv)) {
return rv;
}
@ -457,16 +456,16 @@ nsHTTPCompressConv::OnDataAvailable(nsIRequest* request, nsIInputStream* iStr,
}
if (code == Z_OK) {
if (bytesWritten) {
rv = do_OnDataAvailable(request, nullptr, aSourceOffset,
(char*)mOutBuffer, bytesWritten);
rv = do_OnDataAvailable(request, aSourceOffset, (char*)mOutBuffer,
bytesWritten);
if (NS_FAILED(rv)) {
return rv;
}
}
} else if (code == Z_BUF_ERROR) {
if (bytesWritten) {
rv = do_OnDataAvailable(request, nullptr, aSourceOffset,
(char*)mOutBuffer, bytesWritten);
rv = do_OnDataAvailable(request, aSourceOffset, (char*)mOutBuffer,
bytesWritten);
if (NS_FAILED(rv)) {
return rv;
}
@ -523,7 +522,6 @@ nsHTTPCompressConv::Convert(nsIInputStream* aFromStream, const char* aFromType,
}
nsresult nsHTTPCompressConv::do_OnDataAvailable(nsIRequest* request,
nsISupports* context,
uint64_t offset,
const char* buffer,
uint32_t count) {

View File

@ -85,9 +85,8 @@ class nsHTTPCompressConv : public nsIStreamConverter,
const char* dataIn, uint32_t, uint32_t avail,
uint32_t* countRead);
nsresult do_OnDataAvailable(nsIRequest* request, nsISupports* aContext,
uint64_t aSourceOffset, const char* buffer,
uint32_t aCount);
nsresult do_OnDataAvailable(nsIRequest* request, uint64_t aSourceOffset,
const char* buffer, uint32_t aCount);
bool mCheckHeaderDone{false};
Atomic<bool> mStreamEnded{false};

View File

@ -100,7 +100,7 @@ nsIndexedToHTML::GetConvertedType(const nsACString& aFromType,
NS_IMETHODIMP
nsIndexedToHTML::OnStartRequest(nsIRequest* request) {
nsCString buffer;
nsresult rv = DoOnStartRequest(request, nullptr, buffer);
nsresult rv = DoOnStartRequest(request, buffer);
if (NS_FAILED(rv)) {
request->Cancel(rv);
}
@ -115,12 +115,11 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request) {
// Push our buffer to the listener.
rv = SendToListener(request, nullptr, buffer);
rv = SendToListener(request, buffer);
return rv;
}
nsresult nsIndexedToHTML::DoOnStartRequest(nsIRequest* request,
nsISupports* aContext,
nsCString& aBuffer) {
nsresult rv;
@ -595,7 +594,7 @@ nsIndexedToHTML::OnStopRequest(nsIRequest* request, nsresult aStatus) {
nsCString buffer;
buffer.AssignLiteral("</tbody></table></body></html>\n");
aStatus = SendToListener(request, nullptr, buffer);
aStatus = SendToListener(request, buffer);
}
mParser->OnStopRequest(request, aStatus);
@ -605,7 +604,6 @@ nsIndexedToHTML::OnStopRequest(nsIRequest* request, nsresult aStatus) {
}
nsresult nsIndexedToHTML::SendToListener(nsIRequest* aRequest,
nsISupports* aContext,
const nsACString& aBuffer) {
nsCOMPtr<nsIInputStream> inputData;
nsresult rv = NS_NewCStringInputStream(getter_AddRefs(inputData), aBuffer);
@ -638,8 +636,7 @@ static nsresult FormatTime(const nsDateFormatSelector aDateFormatSelector,
}
NS_IMETHODIMP
nsIndexedToHTML::OnIndexAvailable(nsIRequest* aRequest, nsISupports* aCtxt,
nsIDirIndex* aIndex) {
nsIndexedToHTML::OnIndexAvailable(nsIRequest* aRequest, nsIDirIndex* aIndex) {
nsresult rv;
if (!aIndex) return NS_ERROR_NULL_POINTER;
@ -794,12 +791,11 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest* aRequest, nsISupports* aCtxt,
pushBuffer.AppendLiteral("</td>\n</tr>");
return SendToListener(aRequest, aCtxt, pushBuffer);
return SendToListener(aRequest, pushBuffer);
}
NS_IMETHODIMP
nsIndexedToHTML::OnInformationAvailable(nsIRequest* aRequest,
nsISupports* aCtxt,
const nsAString& aInfo) {
nsAutoCString pushBuffer;
nsAutoCString escapedUtf8;
@ -811,7 +807,7 @@ nsIndexedToHTML::OnInformationAvailable(nsIRequest* aRequest,
pushBuffer.AppendLiteral(
"</td>\n <td></td>\n <td></td>\n <td></td>\n</tr>\n");
return SendToListener(aRequest, aCtxt, pushBuffer);
return SendToListener(aRequest, pushBuffer);
}
void nsIndexedToHTML::FormatSizeString(int64_t inSize,

View File

@ -37,11 +37,9 @@ class nsIndexedToHTML : public nsIStreamConverter, public nsIDirIndexListener {
protected:
void FormatSizeString(int64_t inSize, nsCString& outSizeString);
nsresult SendToListener(nsIRequest* aRequest, nsISupports* aContext,
const nsACString& aBuffer);
nsresult SendToListener(nsIRequest* aRequest, const nsACString& aBuffer);
// Helper to properly implement OnStartRequest
nsresult DoOnStartRequest(nsIRequest* request, nsISupports* aContext,
nsCString& aBuffer);
nsresult DoOnStartRequest(nsIRequest* request, nsCString& aBuffer);
protected:
nsCOMPtr<nsIDirIndexParser> mParser;

View File

@ -18,22 +18,18 @@ interface nsIDirIndexListener : nsISupports {
* Called for each directory entry
*
* @param request - the request
* @param ctxt - opaque parameter
* @param index - new index to add
*/
void onIndexAvailable(in nsIRequest aRequest,
in nsISupports aCtxt,
in nsIDirIndex aIndex);
/**
* Called for each information line
*
* @param request - the request
* @param ctxt - opaque parameter
* @param info - new info to add
*/
void onInformationAvailable(in nsIRequest aRequest,
in nsISupports aCtxt,
in AString aInfo);
};

View File

@ -8,7 +8,7 @@ const BUGID = "263127";
var listener = {
QueryInterface: ChromeUtils.generateQI(["nsIDownloadObserver"]),
onDownloadComplete(downloader, request, ctxt, status, file) {
onDownloadComplete(downloader, request, status, file) {
do_test_pending();
server.stop(do_test_finished);

View File

@ -684,9 +684,8 @@ class PendingLookup final : public nsIStreamListener,
// Wrapper function for nsIStreamListener.onStopRequest to make it easy to
// guarantee calling the callback
nsresult OnStopRequestInternal(nsIRequest* aRequest, nsISupports* aContext,
nsresult aResult, uint32_t& aVerdict,
Reason& aReason);
nsresult OnStopRequestInternal(nsIRequest* aRequest, nsresult aResult,
uint32_t& aVerdict, Reason& aReason);
// Return the hex-encoded hash of the whole URI.
nsresult GetSpecHash(nsACString& aSpec, nsACString& hexEncodedHash);
@ -1779,14 +1778,12 @@ PendingLookup::OnStopRequest(nsIRequest* aRequest, nsresult aResult) {
uint32_t verdict = nsIApplicationReputationService::VERDICT_SAFE;
Reason reason = Reason::NotSet;
nsresult rv =
OnStopRequestInternal(aRequest, nullptr, aResult, verdict, reason);
nsresult rv = OnStopRequestInternal(aRequest, aResult, verdict, reason);
OnComplete(verdict, reason, rv);
return rv;
}
nsresult PendingLookup::OnStopRequestInternal(nsIRequest* aRequest,
nsISupports* aContext,
nsresult aResult,
uint32_t& aVerdict,
Reason& aReason) {

View File

@ -152,7 +152,7 @@ NS_IMETHODIMP nsDocumentOpenInfo::OnStartRequest(nsIRequest* request) {
return NS_OK;
}
rv = DispatchContent(request, nullptr);
rv = DispatchContent(request);
LOG((" After dispatch, m_targetStreamListener: 0x%p, rv: 0x%08" PRIX32,
m_targetStreamListener.get(), static_cast<uint32_t>(rv)));
@ -224,8 +224,7 @@ NS_IMETHODIMP nsDocumentOpenInfo::OnStopRequest(nsIRequest* request,
return NS_OK;
}
nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest* request,
nsISupports* aCtxt) {
nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest* request) {
LOG(("[0x%p] nsDocumentOpenInfo::DispatchContent for type '%s'", this,
mContentType.get()));

View File

@ -83,7 +83,7 @@ class nsDocumentOpenInfo : public nsIStreamListener,
// Call this (from OnStartRequest) to attempt to find an nsIStreamListener to
// take the data off our hands.
nsresult DispatchContent(nsIRequest* request, nsISupports* aCtxt);
nsresult DispatchContent(nsIRequest* request);
// Call this if we need to insert a stream converter from aSrcContentType to
// aOutContentType into the StreamListener chain. DO NOT call it if the two

View File

@ -1202,8 +1202,8 @@ AsyncFaviconDataReady::AsyncFaviconDataReady(
NS_IMETHODIMP
myDownloadObserver::OnDownloadComplete(nsIDownloader* downloader,
nsIRequest* request, nsISupports* ctxt,
nsresult status, nsIFile* result) {
nsIRequest* request, nsresult status,
nsIFile* result) {
return NS_OK;
}