mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 23:23:33 +00:00
Bug 1551306 - Remove context parameter from nsIProgressEventSink.onProgress() and nsIProgressEventSink.onStatus() r=valentin
Differential Revision: https://phabricator.services.mozilla.com/D68235 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
e3d86ceafe
commit
b204bf50aa
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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<nsILoadGroup> 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<nsILoadGroup> 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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -115,7 +115,6 @@ class nsIncrementalDownload final : public nsIIncrementalDownload,
|
||||
nsresult ClearRequestHeader(nsIHttpChannel* channel);
|
||||
|
||||
nsCOMPtr<nsIRequestObserver> mObserver;
|
||||
nsCOMPtr<nsISupports> mObserverContext;
|
||||
nsCOMPtr<nsIProgressEventSink> mProgressSink;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> 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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<uint32_t>(aStatus)));
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -8674,8 +8674,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<nsIParentChannel> parentChannel;
|
||||
NS_QueryNotificationCallbacks(this, parentChannel);
|
||||
@ -8686,7 +8685,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());
|
||||
}
|
||||
}
|
||||
@ -8701,7 +8700,7 @@ nsHttpChannel::OnTransportStatus(nsITransport* trans, nsresult status,
|
||||
GetCallback(mProgressSink);
|
||||
}
|
||||
if (mProgressSink) {
|
||||
mProgressSink->OnProgress(this, nullptr, progress, progressMax);
|
||||
mProgressSink->OnProgress(this, progress, progressMax);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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) {
|
||||
|
@ -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() {
|
||||
|
@ -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([
|
||||
|
@ -26,7 +26,7 @@ use log::{error, info, warn};
|
||||
use moz_task::create_thread;
|
||||
use nserror::{nsresult, NS_ERROR_ABORT, NS_ERROR_NOT_IMPLEMENTED, NS_OK};
|
||||
use nsstring::{nsACString, nsCString};
|
||||
use std::{cell::Cell, fmt, ptr};
|
||||
use std::{cell::Cell, fmt};
|
||||
use xpcom::{
|
||||
interfaces::{
|
||||
nsIBits, nsIBitsCallback, nsILoadGroup, nsIProgressEventSink, nsIRequestObserver,
|
||||
@ -104,7 +104,6 @@ pub struct InitBitsRequest {
|
||||
monitor_thread: Cell<Option<RefPtr<nsIThread>>>,
|
||||
monitor_timeout_ms: u32,
|
||||
observer: RefPtr<nsIRequestObserver>,
|
||||
context: Option<RefPtr<nsISupports>>,
|
||||
// started indicates whether or not OnStartRequest has been fired.
|
||||
started: Cell<bool>,
|
||||
// finished indicates whether or not we have called
|
||||
@ -140,6 +139,7 @@ impl BitsRequest {
|
||||
monitor_client: BitsMonitorClient,
|
||||
action: ServiceAction,
|
||||
) -> Result<RefPtr<BitsRequest>, BitsTaskError> {
|
||||
let _ = context;
|
||||
let action: Action = action.into();
|
||||
let monitor_thread = create_thread(&format!("BitsMonitor {}", id)).map_err(|rv| {
|
||||
BitsTaskError::from_nsresult(FailedToStartThread, action, MainThread, rv)
|
||||
@ -156,7 +156,6 @@ impl BitsRequest {
|
||||
monitor_thread: Cell::new(Some(monitor_thread.clone())),
|
||||
monitor_timeout_ms,
|
||||
observer,
|
||||
context,
|
||||
started: Cell::new(false),
|
||||
finished: Cell::new(false),
|
||||
cancel_action: Cell::new(CancelAction::NotInProgress),
|
||||
@ -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::<nsIProgressEventSink>() {
|
||||
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,
|
||||
);
|
||||
|
@ -2052,7 +2052,6 @@ DownloadCopySaver.prototype = {
|
||||
getInterface: ChromeUtils.generateQI([Ci.nsIProgressEventSink]),
|
||||
onProgress: function DCSE_onProgress(
|
||||
aRequest,
|
||||
aContext,
|
||||
aProgress,
|
||||
aProgressMax
|
||||
) {
|
||||
|
@ -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) {},
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -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(
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user