From da81dcd19588560c2cc4004399541d8cc77ce325 Mon Sep 17 00:00:00 2001 From: sonakshi Date: Fri, 27 Mar 2020 14:05:02 +0000 Subject: [PATCH] Bug 1551306 - Remove context parameter from nsIProgressEventSink.onProgress() and nsIProgressEventSink.onStatus() r=valentin Differential Revision: https://phabricator.services.mozilla.com/D68235 --- .../content/aboutDialog-appUpdater-legacy.js | 4 ++-- browser/modules/AppUpdater.jsm | 4 ++-- .../network-response-listener.js | 2 +- dom/plugins/base/nsPluginStreamListenerPeer.cpp | 2 -- dom/webbrowserpersist/nsWebBrowserPersist.cpp | 7 +++---- dom/xhr/XMLHttpRequestMainThread.cpp | 10 ++++------ image/imgLoader.cpp | 11 +++++------ modules/libjar/nsJARChannel.cpp | 2 +- netwerk/base/nsBaseChannel.cpp | 4 ++-- netwerk/base/nsIProgressEventSink.idl | 8 -------- netwerk/base/nsIncrementalDownload.cpp | 6 +----- netwerk/protocol/http/HttpChannelChild.cpp | 17 ++++++++--------- netwerk/protocol/http/HttpChannelParent.cpp | 8 ++++---- .../protocol/http/InterceptedHttpChannel.cpp | 5 ++--- netwerk/protocol/http/nsHttpChannel.cpp | 7 +++---- netwerk/test/unit/test_post.js | 4 ++-- netwerk/test/unit/test_progress.js | 4 ++-- netwerk/test/unit/test_synthesized_response.js | 4 ++-- toolkit/components/bitsdownload/Bits.jsm | 12 +++--------- .../bitsdownload/src/bits_interface/request.rs | 6 ------ toolkit/components/downloads/DownloadCore.jsm | 1 - toolkit/components/search/SearchEngine.jsm | 4 ++-- toolkit/mozapps/update/UpdateService.jsm | 17 ++++------------- .../update/tests/data/xpcshellUtilsAUS.js | 2 +- uriloader/base/nsDocLoader.cpp | 7 +++---- 25 files changed, 57 insertions(+), 101 deletions(-) diff --git a/browser/base/content/aboutDialog-appUpdater-legacy.js b/browser/base/content/aboutDialog-appUpdater-legacy.js index a50927cff59ba..0629e8eaf41a3 100644 --- a/browser/base/content/aboutDialog-appUpdater-legacy.js +++ b/browser/base/content/aboutDialog-appUpdater-legacy.js @@ -435,12 +435,12 @@ appUpdater.prototype = { /** * See nsIProgressEventSink.idl */ - onStatus(aRequest, aContext, aStatus, aStatusArg) {}, + onStatus(aRequest, aStatus, aStatusArg) {}, /** * See nsIProgressEventSink.idl */ - onProgress(aRequest, aContext, aProgress, aProgressMax) { + onProgress(aRequest, aProgress, aProgressMax) { this.downloadStatus.textContent = DownloadUtils.getTransferTotal( aProgress, aProgressMax diff --git a/browser/modules/AppUpdater.jsm b/browser/modules/AppUpdater.jsm index a8f42aa46af9f..d326dc414f0d5 100644 --- a/browser/modules/AppUpdater.jsm +++ b/browser/modules/AppUpdater.jsm @@ -339,12 +339,12 @@ class AppUpdater { /** * See nsIProgressEventSink.idl */ - onStatus(aRequest, aContext, aStatus, aStatusArg) {} + onStatus(aRequest, aStatus, aStatusArg) {} /** * See nsIProgressEventSink.idl */ - onProgress(aRequest, aContext, aProgress, aProgressMax) { + onProgress(aRequest, aProgress, aProgressMax) { this._setStatus(AppUpdater.STATUS.DOWNLOADING, aProgress, aProgressMax); } diff --git a/devtools/server/actors/network-monitor/network-response-listener.js b/devtools/server/actors/network-monitor/network-response-listener.js index 1128065a0f25f..d5ebeac06449d 100644 --- a/devtools/server/actors/network-monitor/network-response-listener.js +++ b/devtools/server/actors/network-monitor/network-response-listener.js @@ -379,7 +379,7 @@ NetworkResponseListener.prototype = { * Handle progress event as data is transferred. This is used to record the * size on the wire, which may be compressed / encoded. */ - onProgress: function(request, context, progress, progressMax) { + onProgress: function(request, progress, progressMax) { this.transferredSize = progress; // Need to forward as well to keep things like Download Manager's progress // bar working properly. diff --git a/dom/plugins/base/nsPluginStreamListenerPeer.cpp b/dom/plugins/base/nsPluginStreamListenerPeer.cpp index f2aaa3eed3978..8b3dec50684ad 100644 --- a/dom/plugins/base/nsPluginStreamListenerPeer.cpp +++ b/dom/plugins/base/nsPluginStreamListenerPeer.cpp @@ -226,7 +226,6 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIRequest* request) { } NS_IMETHODIMP nsPluginStreamListenerPeer::OnProgress(nsIRequest* request, - nsISupports* aContext, int64_t aProgress, int64_t aProgressMax) { nsresult rv = NS_OK; @@ -234,7 +233,6 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnProgress(nsIRequest* request, } NS_IMETHODIMP nsPluginStreamListenerPeer::OnStatus(nsIRequest* request, - nsISupports* aContext, nsresult aStatus, const char16_t* aStatusArg) { return NS_OK; diff --git a/dom/webbrowserpersist/nsWebBrowserPersist.cpp b/dom/webbrowserpersist/nsWebBrowserPersist.cpp index 4fdf4f0e5c79f..c112cc6a393a4 100644 --- a/dom/webbrowserpersist/nsWebBrowserPersist.cpp +++ b/dom/webbrowserpersist/nsWebBrowserPersist.cpp @@ -976,7 +976,6 @@ nsWebBrowserPersist::OnDataAvailable(nsIRequest* request, //***************************************************************************** NS_IMETHODIMP nsWebBrowserPersist::OnProgress(nsIRequest* request, - nsISupports* ctxt, int64_t aProgress, int64_t aProgressMax) { if (!mProgressListener) { @@ -1013,14 +1012,14 @@ NS_IMETHODIMP nsWebBrowserPersist::OnProgress(nsIRequest* request, // If our progress listener implements nsIProgressEventSink, // forward the notification if (mEventSink) { - mEventSink->OnProgress(request, ctxt, aProgress, aProgressMax); + mEventSink->OnProgress(request, aProgress, aProgressMax); } return NS_OK; } NS_IMETHODIMP nsWebBrowserPersist::OnStatus(nsIRequest* request, - nsISupports* ctxt, nsresult status, + nsresult status, const char16_t* statusArg) { if (mProgressListener) { // We need to filter out non-error error codes. @@ -1051,7 +1050,7 @@ NS_IMETHODIMP nsWebBrowserPersist::OnStatus(nsIRequest* request, // If our progress listener implements nsIProgressEventSink, // forward the notification if (mEventSink) { - mEventSink->OnStatus(request, ctxt, status, statusArg); + mEventSink->OnStatus(request, status, statusArg); } return NS_OK; diff --git a/dom/xhr/XMLHttpRequestMainThread.cpp b/dom/xhr/XMLHttpRequestMainThread.cpp index 69467d1db8a76..2101288dc1140 100644 --- a/dom/xhr/XMLHttpRequestMainThread.cpp +++ b/dom/xhr/XMLHttpRequestMainThread.cpp @@ -3277,8 +3277,7 @@ nsresult XMLHttpRequestMainThread::OnRedirectVerifyCallback(nsresult result) { // NS_IMETHODIMP -XMLHttpRequestMainThread::OnProgress(nsIRequest* aRequest, - nsISupports* aContext, int64_t aProgress, +XMLHttpRequestMainThread::OnProgress(nsIRequest* aRequest, int64_t aProgress, int64_t aProgressMax) { // When uploading, OnProgress reports also headers in aProgress and // aProgressMax. So, try to remove the headers, if possible. @@ -3303,18 +3302,17 @@ XMLHttpRequestMainThread::OnProgress(nsIRequest* aRequest, } if (mProgressEventSink) { - mProgressEventSink->OnProgress(aRequest, aContext, aProgress, aProgressMax); + mProgressEventSink->OnProgress(aRequest, aProgress, aProgressMax); } return NS_OK; } NS_IMETHODIMP -XMLHttpRequestMainThread::OnStatus(nsIRequest* aRequest, nsISupports* aContext, - nsresult aStatus, +XMLHttpRequestMainThread::OnStatus(nsIRequest* aRequest, nsresult aStatus, const char16_t* aStatusArg) { if (mProgressEventSink) { - mProgressEventSink->OnStatus(aRequest, aContext, aStatus, aStatusArg); + mProgressEventSink->OnStatus(aRequest, aStatus, aStatusArg); } return NS_OK; diff --git a/image/imgLoader.cpp b/image/imgLoader.cpp index e1916f406b5b6..675a55a984aef 100644 --- a/image/imgLoader.cpp +++ b/image/imgLoader.cpp @@ -549,8 +549,8 @@ NS_IMPL_ISUPPORTS(nsProgressNotificationProxy, nsIProgressEventSink, nsIChannelEventSink, nsIInterfaceRequestor) NS_IMETHODIMP -nsProgressNotificationProxy::OnProgress(nsIRequest* request, nsISupports* ctxt, - int64_t progress, int64_t progressMax) { +nsProgressNotificationProxy::OnProgress(nsIRequest* request, int64_t progress, + int64_t progressMax) { nsCOMPtr loadGroup; request->GetLoadGroup(getter_AddRefs(loadGroup)); @@ -561,12 +561,11 @@ nsProgressNotificationProxy::OnProgress(nsIRequest* request, nsISupports* ctxt, if (!target) { return NS_OK; } - return target->OnProgress(mImageRequest, ctxt, progress, progressMax); + return target->OnProgress(mImageRequest, progress, progressMax); } NS_IMETHODIMP -nsProgressNotificationProxy::OnStatus(nsIRequest* request, nsISupports* ctxt, - nsresult status, +nsProgressNotificationProxy::OnStatus(nsIRequest* request, nsresult status, const char16_t* statusArg) { nsCOMPtr loadGroup; request->GetLoadGroup(getter_AddRefs(loadGroup)); @@ -578,7 +577,7 @@ nsProgressNotificationProxy::OnStatus(nsIRequest* request, nsISupports* ctxt, if (!target) { return NS_OK; } - return target->OnStatus(mImageRequest, ctxt, status, statusArg); + return target->OnStatus(mImageRequest, status, statusArg); } NS_IMETHODIMP diff --git a/modules/libjar/nsJARChannel.cpp b/modules/libjar/nsJARChannel.cpp index 689f1b878a6b2..8b7a1b8e85685 100644 --- a/modules/libjar/nsJARChannel.cpp +++ b/modules/libjar/nsJARChannel.cpp @@ -532,7 +532,7 @@ void nsJARChannel::FireOnProgress(uint64_t aProgress) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(mProgressSink); - mProgressSink->OnProgress(this, nullptr, aProgress, mContentLength); + mProgressSink->OnProgress(this, aProgress, mContentLength); } //----------------------------------------------------------------------------- diff --git a/netwerk/base/nsBaseChannel.cpp b/netwerk/base/nsBaseChannel.cpp index e923810fd82fe..9ce44b5b6b6a8 100644 --- a/netwerk/base/nsBaseChannel.cpp +++ b/netwerk/base/nsBaseChannel.cpp @@ -757,12 +757,12 @@ nsBaseChannel::OnTransportStatus(nsITransport* transport, nsresult status, if (!HasLoadFlag(LOAD_BACKGROUND)) { nsAutoString statusArg; if (GetStatusArg(status, statusArg)) { - mProgressSink->OnStatus(this, nullptr, status, statusArg.get()); + mProgressSink->OnStatus(this, status, statusArg.get()); } } if (progress) { - mProgressSink->OnProgress(this, nullptr, progress, progressMax); + mProgressSink->OnProgress(this, progress, progressMax); } return NS_OK; diff --git a/netwerk/base/nsIProgressEventSink.idl b/netwerk/base/nsIProgressEventSink.idl index 68f8bf05971a5..5420239e4c2dd 100644 --- a/netwerk/base/nsIProgressEventSink.idl +++ b/netwerk/base/nsIProgressEventSink.idl @@ -36,9 +36,6 @@ interface nsIProgressEventSink : nsISupports * * @param aRequest * the request being observed (may QI to nsIChannel). - * @param aContext - * if aRequest is a channel, then this parameter is the listener - * context passed to nsIChannel::asyncOpen. * @param aProgress * numeric value in the range 0 to aProgressMax indicating the * number of bytes transfered thus far. @@ -47,7 +44,6 @@ interface nsIProgressEventSink : nsISupports * transfered (or -1 if total is unknown). */ void onProgress(in nsIRequest aRequest, - in nsISupports aContext, in long long aProgress, in long long aProgressMax); @@ -57,9 +53,6 @@ interface nsIProgressEventSink : nsISupports * * @param aRequest * the request being observed (may QI to nsIChannel). - * @param aContext - * if aRequest is a channel, then this parameter is the listener - * context passed to nsIChannel::asyncOpen. * @param aStatus * status code (not necessarily an error code) indicating the * state of the channel (usually the state of the underlying @@ -73,7 +66,6 @@ interface nsIProgressEventSink : nsISupports * indicates the host:port associated with the status code. */ void onStatus(in nsIRequest aRequest, - in nsISupports aContext, in nsresult aStatus, in wstring aStatusArg); diff --git a/netwerk/base/nsIncrementalDownload.cpp b/netwerk/base/nsIncrementalDownload.cpp index a9d0d33996bbe..2f351a8f63226 100644 --- a/netwerk/base/nsIncrementalDownload.cpp +++ b/netwerk/base/nsIncrementalDownload.cpp @@ -115,7 +115,6 @@ class nsIncrementalDownload final : public nsIIncrementalDownload, nsresult ClearRequestHeader(nsIHttpChannel* channel); nsCOMPtr mObserver; - nsCOMPtr mObserverContext; nsCOMPtr mProgressSink; nsCOMPtr mURI; nsCOMPtr mFinalURI; @@ -174,8 +173,7 @@ void nsIncrementalDownload::UpdateProgress() { mLastProgressUpdate = PR_Now(); if (mProgressSink) - mProgressSink->OnProgress(this, mObserverContext, mCurrentSize + mChunkLen, - mTotalSize); + mProgressSink->OnProgress(this, mCurrentSize + mChunkLen, mTotalSize); } nsresult nsIncrementalDownload::CallOnStartRequest() { @@ -196,7 +194,6 @@ void nsIncrementalDownload::CallOnStopRequest() { mObserver->OnStopRequest(this, mStatus); mObserver = nullptr; - mObserverContext = nullptr; } nsresult nsIncrementalDownload::StartTimer(int32_t interval) { @@ -468,7 +465,6 @@ nsIncrementalDownload::Start(nsIRequestObserver* observer, if (NS_FAILED(rv)) return rv; mObserver = observer; - mObserverContext = context; mProgressSink = do_QueryInterface(observer); // ok if null mIsPending = true; diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index 162df4ce74a84..bd9fe0819bad4 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -89,8 +89,8 @@ InterceptStreamListener::OnStartRequest(nsIRequest* aRequest) { } NS_IMETHODIMP -InterceptStreamListener::OnStatus(nsIRequest* aRequest, nsISupports* aContext, - nsresult status, const char16_t* aStatusArg) { +InterceptStreamListener::OnStatus(nsIRequest* aRequest, nsresult status, + const char16_t* aStatusArg) { if (mOwner) { mOwner->DoOnStatus(mOwner, status); } @@ -98,8 +98,8 @@ InterceptStreamListener::OnStatus(nsIRequest* aRequest, nsISupports* aContext, } NS_IMETHODIMP -InterceptStreamListener::OnProgress(nsIRequest* aRequest, nsISupports* aContext, - int64_t aProgress, int64_t aProgressMax) { +InterceptStreamListener::OnProgress(nsIRequest* aRequest, int64_t aProgress, + int64_t aProgressMax) { if (mOwner) { mOwner->DoOnProgress(mOwner, aProgress, aProgressMax); } @@ -124,11 +124,10 @@ InterceptStreamListener::OnDataAvailable(nsIRequest* aRequest, nsAutoCString host; uri->GetHost(host); - OnStatus(mOwner, nullptr, NS_NET_STATUS_READING, - NS_ConvertUTF8toUTF16(host).get()); + OnStatus(mOwner, NS_NET_STATUS_READING, NS_ConvertUTF8toUTF16(host).get()); int64_t progress = aOffset + aCount; - OnProgress(mOwner, nullptr, progress, mOwner->mSynthesizedStreamLength); + OnProgress(mOwner, progress, mOwner->mSynthesizedStreamLength); } mOwner->DoOnDataAvailable(mOwner, nullptr, aInputStream, aOffset, aCount); @@ -930,7 +929,7 @@ void HttpChannelChild::DoOnStatus(nsIRequest* aRequest, nsresult status) { !(mLoadFlags & LOAD_BACKGROUND)) { nsAutoCString host; mURI->GetHost(host); - mProgressSink->OnStatus(aRequest, nullptr, status, + mProgressSink->OnStatus(aRequest, status, NS_ConvertUTF8toUTF16(host).get()); } } @@ -951,7 +950,7 @@ void HttpChannelChild::DoOnProgress(nsIRequest* aRequest, int64_t progress, // OnProgress // if (progress > 0) { - mProgressSink->OnProgress(aRequest, nullptr, progress, progressMax); + mProgressSink->OnProgress(aRequest, progress, progressMax); } } } diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index 59690f3c247ba..58e477c213a62 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -1835,8 +1835,8 @@ mozilla::ipc::IPCResult HttpChannelParent::RecvOpenAltDataCacheInputStream( //----------------------------------------------------------------------------- NS_IMETHODIMP -HttpChannelParent::OnProgress(nsIRequest* aRequest, nsISupports* aContext, - int64_t aProgress, int64_t aProgressMax) { +HttpChannelParent::OnProgress(nsIRequest* aRequest, int64_t aProgress, + int64_t aProgressMax) { LOG(("HttpChannelParent::OnProgress [this=%p progress=%" PRId64 "max=%" PRId64 "]\n", this, aProgress, aProgressMax)); @@ -1865,8 +1865,8 @@ HttpChannelParent::OnProgress(nsIRequest* aRequest, nsISupports* aContext, } NS_IMETHODIMP -HttpChannelParent::OnStatus(nsIRequest* aRequest, nsISupports* aContext, - nsresult aStatus, const char16_t* aStatusArg) { +HttpChannelParent::OnStatus(nsIRequest* aRequest, nsresult aStatus, + const char16_t* aStatusArg) { LOG(("HttpChannelParent::OnStatus [this=%p status=%" PRIx32 "]\n", this, static_cast(aStatus))); MOZ_ASSERT(NS_IsMainThread()); diff --git a/netwerk/protocol/http/InterceptedHttpChannel.cpp b/netwerk/protocol/http/InterceptedHttpChannel.cpp index d7d81e9b06e29..507df81cd4d45 100644 --- a/netwerk/protocol/http/InterceptedHttpChannel.cpp +++ b/netwerk/protocol/http/InterceptedHttpChannel.cpp @@ -414,10 +414,9 @@ void InterceptedHttpChannel::MaybeCallStatusAndProgress() { CopyUTF8toUTF16(host, mStatusHost); } - mProgressSink->OnStatus(this, nullptr, NS_NET_STATUS_READING, - mStatusHost.get()); + mProgressSink->OnStatus(this, NS_NET_STATUS_READING, mStatusHost.get()); - mProgressSink->OnProgress(this, nullptr, progress, mSynthesizedStreamLength); + mProgressSink->OnProgress(this, progress, mSynthesizedStreamLength); mProgressReported = progress; } diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index ed64cd7a33507..1196537de6cbd 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -8659,8 +8659,7 @@ nsHttpChannel::OnTransportStatus(nsITransport* trans, nsresult status, nsAutoCString host; mURI->GetHost(host); if (!(mLoadFlags & LOAD_BACKGROUND)) { - mProgressSink->OnStatus(this, nullptr, status, - NS_ConvertUTF8toUTF16(host).get()); + mProgressSink->OnStatus(this, status, NS_ConvertUTF8toUTF16(host).get()); } else { nsCOMPtr parentChannel; NS_QueryNotificationCallbacks(this, parentChannel); @@ -8671,7 +8670,7 @@ nsHttpChannel::OnTransportStatus(nsITransport* trans, nsresult status, // LOAD_BACKGROUND is checked again in |HttpChannelChild|, so the final // consumer won't get this event. if (SameCOMIdentity(parentChannel, mProgressSink)) { - mProgressSink->OnStatus(this, nullptr, status, + mProgressSink->OnStatus(this, status, NS_ConvertUTF8toUTF16(host).get()); } } @@ -8686,7 +8685,7 @@ nsHttpChannel::OnTransportStatus(nsITransport* trans, nsresult status, GetCallback(mProgressSink); } if (mProgressSink) { - mProgressSink->OnProgress(this, nullptr, progress, progressMax); + mProgressSink->OnProgress(this, progress, progressMax); } } } diff --git a/netwerk/test/unit/test_post.js b/netwerk/test/unit/test_post.js index d4c8355113700..20c37bddba9c7 100644 --- a/netwerk/test/unit/test_post.js +++ b/netwerk/test/unit/test_post.js @@ -45,14 +45,14 @@ var listenerCallback = { throw Cr.NS_ERROR_NO_INTERFACE; }, - onProgress(request, context, progress, progressMax) { + onProgress(request, progress, progressMax) { // this works because the response is 0 bytes and does not trigger onprogress if (progress === progressMax) { correctOnProgress = true; } }, - onStatus(request, context, status, statusArg) {}, + onStatus(request, status, statusArg) {}, }; function run_test() { diff --git a/netwerk/test/unit/test_progress.js b/netwerk/test/unit/test_progress.js index 095212ab58f0e..1ccc735c487b9 100644 --- a/netwerk/test/unit/test_progress.js +++ b/netwerk/test/unit/test_progress.js @@ -68,7 +68,7 @@ var progressCallback = { delete this._listener; }, - onProgress(request, context, progress, progressMax) { + onProgress(request, progress, progressMax) { Assert.equal(this._last_callback_handled, TYPE_ONSTATUS); this._last_callback_handled = TYPE_ONPROGRESS; @@ -77,7 +77,7 @@ var progressCallback = { max = progressMax; }, - onStatus(request, context, status, statusArg) { + onStatus(request, status, statusArg) { if (!this._got_onstartrequest) { // Ensure that all messages before onStartRequest are onStatus if (this._last_callback_handled) { diff --git a/netwerk/test/unit/test_synthesized_response.js b/netwerk/test/unit/test_synthesized_response.js index bd5076b06fbdd..b0e9f340a2071 100644 --- a/netwerk/test/unit/test_synthesized_response.js +++ b/netwerk/test/unit/test_synthesized_response.js @@ -51,10 +51,10 @@ function make_channel(url, body, cb) { getInterface(iid) { return this.QueryInterface(iid); }, - onProgress(request, context, progress, progressMax) { + onProgress(request, progress, progressMax) { gotOnProgress = true; }, - onStatus(request, context, status, statusArg) { + onStatus(request, status, statusArg) { gotOnStatus = true; }, shouldPrepareForIntercept() { diff --git a/toolkit/components/bitsdownload/Bits.jsm b/toolkit/components/bitsdownload/Bits.jsm index 6fd4d9b8d78d9..70f92a5241da2 100644 --- a/toolkit/components/bitsdownload/Bits.jsm +++ b/toolkit/components/bitsdownload/Bits.jsm @@ -648,7 +648,6 @@ async function servicePromise(errorAction, observer, actionFn) { }, onProgress: function wrappedObserver_onProgress( request, - context, progress, progressMax ) { @@ -656,20 +655,15 @@ async function servicePromise(errorAction, observer, actionFn) { if (!wrappedRequest) { wrappedRequest = new BitsRequest(request); } - observer.onProgress(wrappedRequest, context, progress, progressMax); + observer.onProgress(wrappedRequest, progress, progressMax); } }, - onStatus: function wrappedObserver_onStatus( - request, - context, - status, - statusArg - ) { + onStatus: function wrappedObserver_onStatus(request, status, statusArg) { if (isProgressEventSink) { if (!wrappedRequest) { wrappedRequest = new BitsRequest(request); } - observer.onStatus(wrappedRequest, context, status, statusArg); + observer.onStatus(wrappedRequest, status, statusArg); } }, QueryInterface: ChromeUtils.generateQI([ diff --git a/toolkit/components/bitsdownload/src/bits_interface/request.rs b/toolkit/components/bitsdownload/src/bits_interface/request.rs index b4029fae7d5e8..885be4ab30334 100644 --- a/toolkit/components/bitsdownload/src/bits_interface/request.rs +++ b/toolkit/components/bitsdownload/src/bits_interface/request.rs @@ -104,7 +104,6 @@ pub struct InitBitsRequest { monitor_thread: Cell>>, monitor_timeout_ms: u32, observer: RefPtr, - context: Option>, // started indicates whether or not OnStartRequest has been fired. started: Cell, // finished indicates whether or not we have called @@ -242,14 +241,9 @@ impl BitsRequest { pub fn on_progress(&self, transferred_bytes: i64, total_bytes: i64) { if let Some(progress_event_sink) = self.observer.query_interface::() { - let context: *const nsISupports = match self.context.as_ref() { - Some(context) => &**context, - None => ptr::null(), - }; unsafe { progress_event_sink.OnProgress( self.coerce(), - context, transferred_bytes, total_bytes, ); diff --git a/toolkit/components/downloads/DownloadCore.jsm b/toolkit/components/downloads/DownloadCore.jsm index 6613f2015b519..7baefca75f7d7 100644 --- a/toolkit/components/downloads/DownloadCore.jsm +++ b/toolkit/components/downloads/DownloadCore.jsm @@ -2052,7 +2052,6 @@ DownloadCopySaver.prototype = { getInterface: ChromeUtils.generateQI([Ci.nsIProgressEventSink]), onProgress: function DCSE_onProgress( aRequest, - aContext, aProgress, aProgressMax ) { diff --git a/toolkit/components/search/SearchEngine.jsm b/toolkit/components/search/SearchEngine.jsm index b0b30d327a4a6..787cb3a5a81aa 100644 --- a/toolkit/components/search/SearchEngine.jsm +++ b/toolkit/components/search/SearchEngine.jsm @@ -190,8 +190,8 @@ loadListener.prototype = { }, // nsIProgressEventSink - onProgress(request, context, progress, progressMax) {}, - onStatus(request, context, status, statusArg) {}, + onProgress(request, progress, progressMax) {}, + onStatus(request, status, statusArg) {}, }; /** diff --git a/toolkit/mozapps/update/UpdateService.jsm b/toolkit/mozapps/update/UpdateService.jsm index 4e086024f511f..1f6de902e738a 100644 --- a/toolkit/mozapps/update/UpdateService.jsm +++ b/toolkit/mozapps/update/UpdateService.jsm @@ -4838,19 +4838,12 @@ Downloader.prototype = { * When new data has been downloaded * @param request * The nsIRequest object for the transfer - * @param context - * Additional data * @param progress * The current number of bytes transferred * @param maxProgress * The total number of bytes that must be transferred */ - onProgress: function Downloader_onProgress( - request, - context, - progress, - maxProgress - ) { + onProgress: function Downloader_onProgress(request, progress, maxProgress) { LOG("Downloader:onProgress - progress: " + progress + "/" + maxProgress); if (progress > this._patch.size) { @@ -4892,7 +4885,7 @@ Downloader.prototype = { for (var i = 0; i < listenerCount; ++i) { var listener = listeners[i]; if (listener instanceof Ci.nsIProgressEventSink) { - listener.onProgress(request, context, progress, maxProgress); + listener.onProgress(request, progress, maxProgress); } } this.updateService._consecutiveSocketErrors = 0; @@ -4902,14 +4895,12 @@ Downloader.prototype = { * When we have new status text * @param request * The nsIRequest object for the transfer - * @param context - * Additional data * @param status * A status code * @param statusText * Human readable version of |status| */ - onStatus: function Downloader_onStatus(request, context, status, statusText) { + onStatus: function Downloader_onStatus(request, status, statusText) { LOG( "Downloader:onStatus - status: " + status + ", statusText: " + statusText ); @@ -4920,7 +4911,7 @@ Downloader.prototype = { for (var i = 0; i < listenerCount; ++i) { var listener = listeners[i]; if (listener instanceof Ci.nsIProgressEventSink) { - listener.onStatus(request, context, status, statusText); + listener.onStatus(request, status, statusText); } } }, diff --git a/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js b/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js index acea93f8234c6..2cf484855acf1 100644 --- a/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js +++ b/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js @@ -4064,7 +4064,7 @@ function waitForUpdateDownload(aUpdates, aExpectedStatus) { gAUS.addDownloadListener({ onStartRequest: aRequest => {}, onProgress: (aRequest, aContext, aProgress, aMaxProgress) => {}, - onStatus: (aRequest, aContext, aStatus, aStatusText) => {}, + onStatus: (aRequest, aStatus, aStatusText) => {}, onStopRequest: (request, status) => { gAUS.removeDownloadListener(this); Assert.equal( diff --git a/uriloader/base/nsDocLoader.cpp b/uriloader/base/nsDocLoader.cpp index ff2640416106c..52cfb32b42a1f 100644 --- a/uriloader/base/nsDocLoader.cpp +++ b/uriloader/base/nsDocLoader.cpp @@ -1071,8 +1071,8 @@ int64_t nsDocLoader::GetMaxTotalProgress() { // on this information. //////////////////////////////////////////////////////////////////////////////////// -NS_IMETHODIMP nsDocLoader::OnProgress(nsIRequest* aRequest, nsISupports* ctxt, - int64_t aProgress, int64_t aProgressMax) { +NS_IMETHODIMP nsDocLoader::OnProgress(nsIRequest* aRequest, int64_t aProgress, + int64_t aProgressMax) { int64_t progressDelta = 0; // @@ -1167,8 +1167,7 @@ NS_IMETHODIMP nsDocLoader::OnProgress(nsIRequest* aRequest, nsISupports* ctxt, return NS_OK; } -NS_IMETHODIMP nsDocLoader::OnStatus(nsIRequest* aRequest, nsISupports* ctxt, - nsresult aStatus, +NS_IMETHODIMP nsDocLoader::OnStatus(nsIRequest* aRequest, nsresult aStatus, const char16_t* aStatusArg) { // // Fire progress notifications out to any registered nsIWebProgressListeners