mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-19 01:10:22 +00:00
Bug 1318506 - Label XHR timer runnables with DocGroup (r=bkelly)
MozReview-Commit-ID: LYB8LFuVs1w
This commit is contained in:
parent
2336b52695
commit
2d57ca5e03
@ -13,6 +13,7 @@
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/dom/BlobSet.h"
|
||||
#include "mozilla/dom/DocGroup.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/FetchUtil.h"
|
||||
#include "mozilla/dom/FormData.h"
|
||||
@ -3148,6 +3149,15 @@ XMLHttpRequestMainThread::SetTimeout(uint32_t aTimeout, ErrorResult& aRv)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
XMLHttpRequestMainThread::SetTimerEventTarget(nsITimer* aTimer)
|
||||
{
|
||||
if (nsCOMPtr<nsIGlobalObject> global = GetOwnerGlobal()) {
|
||||
nsCOMPtr<nsIEventTarget> target = global->EventTargetFor(TaskCategory::Other);
|
||||
aTimer->SetTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
XMLHttpRequestMainThread::StartTimeoutTimer()
|
||||
{
|
||||
@ -3168,6 +3178,7 @@ XMLHttpRequestMainThread::StartTimeoutTimer()
|
||||
|
||||
if (!mTimeoutTimer) {
|
||||
mTimeoutTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
|
||||
SetTimerEventTarget(mTimeoutTimer);
|
||||
}
|
||||
uint32_t elapsed =
|
||||
(uint32_t)((PR_Now() - mRequestSentTime) / PR_USEC_PER_MSEC);
|
||||
@ -3643,6 +3654,7 @@ XMLHttpRequestMainThread::StartProgressEventTimer()
|
||||
{
|
||||
if (!mProgressNotifier) {
|
||||
mProgressNotifier = do_CreateInstance(NS_TIMER_CONTRACTID);
|
||||
SetTimerEventTarget(mProgressNotifier);
|
||||
}
|
||||
if (mProgressNotifier) {
|
||||
mProgressTimerIsActive = true;
|
||||
@ -3669,6 +3681,7 @@ XMLHttpRequestMainThread::MaybeStartSyncTimeoutTimer()
|
||||
}
|
||||
|
||||
mSyncTimeoutTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
|
||||
SetTimerEventTarget(mSyncTimeoutTimer);
|
||||
if (!mSyncTimeoutTimer) {
|
||||
return eErrorOrExpired;
|
||||
}
|
||||
@ -3805,6 +3818,19 @@ XMLHttpRequestMainThread::BlobStoreCompleted(MutableBlobStorage* aBlobStorage,
|
||||
ChangeStateToDone();
|
||||
}
|
||||
|
||||
nsresult
|
||||
XMLHttpRequestMainThread::GetName(nsACString& aName)
|
||||
{
|
||||
aName.AssignLiteral("XMLHttpRequest");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
XMLHttpRequestMainThread::SetName(const char* aName)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// nsXMLHttpRequestXPCOMifier implementation
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXMLHttpRequestXPCOMifier)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
|
||||
|
@ -164,6 +164,7 @@ class XMLHttpRequestMainThread final : public XMLHttpRequest,
|
||||
public nsSupportsWeakReference,
|
||||
public nsITimerCallback,
|
||||
public nsISizeOfEventTarget,
|
||||
public nsINamed,
|
||||
public MutableBlobStorageCallback
|
||||
{
|
||||
friend class nsXHRParseEndListener;
|
||||
@ -230,6 +231,9 @@ public:
|
||||
// nsITimerCallback
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
// nsINamed
|
||||
NS_DECL_NSINAMED
|
||||
|
||||
// nsISizeOfEventTarget
|
||||
virtual size_t
|
||||
SizeOfEventTargetIncludingThis(MallocSizeOf aMallocSizeOf) const override;
|
||||
@ -593,6 +597,8 @@ protected:
|
||||
|
||||
nsresult OnRedirectVerifyCallback(nsresult result);
|
||||
|
||||
void SetTimerEventTarget(nsITimer* aTimer);
|
||||
|
||||
already_AddRefed<nsXMLHttpRequestXPCOMifier> EnsureXPCOMifier();
|
||||
|
||||
nsCOMPtr<nsISupports> mContext;
|
||||
|
Loading…
x
Reference in New Issue
Block a user