зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1293690 P2 Set explicit status levels to fail at when calling WorkerHolder::HoldWorker. r=baku
This commit is contained in:
Родитель
5f493ecd47
Коммит
fa520e1fdd
|
@ -701,7 +701,7 @@ nsresult
|
|||
FileReader::IncreaseBusyCounter()
|
||||
{
|
||||
if (mWorkerPrivate && mBusyCount++ == 0 &&
|
||||
!HoldWorker(mWorkerPrivate)) {
|
||||
!HoldWorker(mWorkerPrivate, Closing)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -2270,7 +2270,7 @@ WebSocketImpl::RegisterWorkerHolder()
|
|||
MOZ_ASSERT(!mWorkerHolder);
|
||||
mWorkerHolder = new WebSocketWorkerHolder(this);
|
||||
|
||||
if (NS_WARN_IF(!mWorkerHolder->HoldWorker(mWorkerPrivate))) {
|
||||
if (NS_WARN_IF(!mWorkerHolder->HoldWorker(mWorkerPrivate, Canceling))) {
|
||||
mWorkerHolder = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -395,7 +395,7 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,
|
|||
}
|
||||
} else {
|
||||
bc->mWorkerHolder = new BroadcastChannelWorkerHolder(bc);
|
||||
if (NS_WARN_IF(!bc->mWorkerHolder->HoldWorker(workerPrivate))) {
|
||||
if (NS_WARN_IF(!bc->mWorkerHolder->HoldWorker(workerPrivate, Closing))) {
|
||||
bc->mWorkerHolder = nullptr;
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
|
|
|
@ -24,7 +24,7 @@ CacheWorkerHolder::Create(WorkerPrivate* aWorkerPrivate)
|
|||
MOZ_ASSERT(aWorkerPrivate);
|
||||
|
||||
RefPtr<CacheWorkerHolder> workerHolder = new CacheWorkerHolder();
|
||||
if (NS_WARN_IF(!workerHolder->HoldWorker(aWorkerPrivate))) {
|
||||
if (NS_WARN_IF(!workerHolder->HoldWorker(aWorkerPrivate, Terminating))) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ const SEC_ASN1Template SGN_DigestInfoTemplate[] = {
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
using mozilla::dom::workers::Canceling;
|
||||
using mozilla::dom::workers::GetCurrentThreadWorkerPrivate;
|
||||
using mozilla::dom::workers::Status;
|
||||
using mozilla::dom::workers::WorkerHolder;
|
||||
|
@ -161,7 +162,7 @@ public:
|
|||
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
RefPtr<InternalWorkerHolder> ref = new InternalWorkerHolder();
|
||||
if (NS_WARN_IF(!ref->HoldWorker(workerPrivate))) {
|
||||
if (NS_WARN_IF(!ref->HoldWorker(workerPrivate, Canceling))) {
|
||||
return nullptr;
|
||||
}
|
||||
return ref.forget();
|
||||
|
|
|
@ -918,7 +918,7 @@ FetchBody<Derived>::RegisterWorkerHolder()
|
|||
MOZ_ASSERT(!mWorkerHolder);
|
||||
mWorkerHolder = new FetchBodyWorkerHolder<Derived>(this);
|
||||
|
||||
if (!mWorkerHolder->HoldWorker(mWorkerPrivate)) {
|
||||
if (!mWorkerHolder->HoldWorker(mWorkerPrivate, Closing)) {
|
||||
NS_WARNING("Failed to add workerHolder");
|
||||
mWorkerHolder = nullptr;
|
||||
return false;
|
||||
|
|
|
@ -575,7 +575,7 @@ IDBOpenDBRequest::CreateForJS(JSContext* aCx,
|
|||
workerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
nsAutoPtr<WorkerHolder> workerHolder(new WorkerHolder(workerPrivate));
|
||||
if (NS_WARN_IF(!workerHolder->HoldWorker(workerPrivate))) {
|
||||
if (NS_WARN_IF(!workerHolder->HoldWorker(workerPrivate, Canceling))) {
|
||||
workerHolder->NoteAddWorkerHolderFailed();
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -240,7 +240,7 @@ IDBTransaction::Create(JSContext* aCx, IDBDatabase* aDatabase,
|
|||
workerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
transaction->mWorkerHolder = new WorkerHolder(workerPrivate, transaction);
|
||||
MOZ_ALWAYS_TRUE(transaction->mWorkerHolder->HoldWorker(workerPrivate));
|
||||
MOZ_ALWAYS_TRUE(transaction->mWorkerHolder->HoldWorker(workerPrivate, Canceling));
|
||||
}
|
||||
|
||||
return transaction.forget();
|
||||
|
|
|
@ -360,7 +360,7 @@ MessagePort::Initialize(const nsID& aUUID,
|
|||
MOZ_ASSERT(!mWorkerHolder);
|
||||
|
||||
nsAutoPtr<WorkerHolder> workerHolder(new MessagePortWorkerHolder(this));
|
||||
if (NS_WARN_IF(!workerHolder->HoldWorker(workerPrivate))) {
|
||||
if (NS_WARN_IF(!workerHolder->HoldWorker(workerPrivate, Closing))) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2564,7 +2564,7 @@ Notification::RegisterWorkerHolder()
|
|||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
MOZ_ASSERT(!mWorkerHolder);
|
||||
mWorkerHolder = MakeUnique<NotificationWorkerHolder>(this);
|
||||
if (NS_WARN_IF(!mWorkerHolder->HoldWorker(mWorkerPrivate))) {
|
||||
if (NS_WARN_IF(!mWorkerHolder->HoldWorker(mWorkerPrivate, Canceling))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -2768,7 +2768,7 @@ Promise::Settle(JS::Handle<JS::Value> aValue, PromiseState aState)
|
|||
worker->AssertIsOnWorkerThread();
|
||||
|
||||
mWorkerHolder = new PromiseReportRejectWorkerHolder(this);
|
||||
if (NS_WARN_IF(!mWorkerHolder->HoldWorker(worker))) {
|
||||
if (NS_WARN_IF(!mWorkerHolder->HoldWorker(worker, Closing))) {
|
||||
mWorkerHolder = nullptr;
|
||||
// Worker is shutting down, report rejection immediately since it is
|
||||
// unlikely that reject callbacks will be added after this point.
|
||||
|
@ -3025,7 +3025,7 @@ PromiseWorkerProxy::AddRefObject()
|
|||
|
||||
MOZ_ASSERT(!mWorkerHolder);
|
||||
mWorkerHolder.reset(new PromiseWorkerHolder(this));
|
||||
if (NS_WARN_IF(!mWorkerHolder->HoldWorker(mWorkerPrivate))) {
|
||||
if (NS_WARN_IF(!mWorkerHolder->HoldWorker(mWorkerPrivate, Canceling))) {
|
||||
mWorkerHolder = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2098,7 +2098,7 @@ LoadAllScripts(WorkerPrivate* aWorkerPrivate,
|
|||
|
||||
ScriptLoaderHolder workerHolder(loader);
|
||||
|
||||
if (NS_WARN_IF(!workerHolder.HoldWorker(aWorkerPrivate))) {
|
||||
if (NS_WARN_IF(!workerHolder.HoldWorker(aWorkerPrivate, Terminating))) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ class KeepAliveHandler final
|
|||
MOZ_ASSERT(mWorkerPrivate);
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
MOZ_ASSERT(!mWorkerHolderAdded);
|
||||
mWorkerHolderAdded = HoldWorker(mWorkerPrivate);
|
||||
mWorkerHolderAdded = HoldWorker(mWorkerPrivate, Terminating);
|
||||
return mWorkerHolderAdded;
|
||||
}
|
||||
|
||||
|
@ -601,7 +601,7 @@ public:
|
|||
// case the registration/update promise will be rejected
|
||||
// 2. A new service worker is registered which will terminate the current
|
||||
// installing worker.
|
||||
if (NS_WARN_IF(!HoldWorker(mWorkerPrivate))) {
|
||||
if (NS_WARN_IF(!HoldWorker(mWorkerPrivate, Terminating))) {
|
||||
NS_WARNING("LifeCycleEventWatcher failed to add feature.");
|
||||
ReportResult(false);
|
||||
return false;
|
||||
|
|
|
@ -1192,7 +1192,7 @@ ServiceWorkerRegistrationWorkerThread::InitListener()
|
|||
worker->AssertIsOnWorkerThread();
|
||||
|
||||
mListener = new WorkerListener(worker, this);
|
||||
if (!HoldWorker(worker)) {
|
||||
if (!HoldWorker(worker, Closing)) {
|
||||
mListener = nullptr;
|
||||
NS_WARNING("Could not add feature");
|
||||
return;
|
||||
|
|
|
@ -1645,7 +1645,7 @@ XMLHttpRequestWorker::MaybePin(ErrorResult& aRv)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!HoldWorker(mWorkerPrivate)) {
|
||||
if (!HoldWorker(mWorkerPrivate, Canceling)) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ namespace mozilla {
|
|||
namespace ipc {
|
||||
|
||||
using mozilla::dom::PContentChild;
|
||||
using mozilla::dom::workers::Canceling;
|
||||
using mozilla::dom::workers::GetCurrentThreadWorkerPrivate;
|
||||
using mozilla::dom::workers::Status;
|
||||
using mozilla::dom::workers::WorkerHolder;
|
||||
|
@ -184,7 +185,7 @@ SendStreamChildImpl::AddAsWorkerHolder(WorkerPrivate* aWorkerPrivate)
|
|||
{
|
||||
NS_ASSERT_OWNINGTHREAD(SendStreamChild);
|
||||
MOZ_ASSERT(aWorkerPrivate);
|
||||
bool result = HoldWorker(aWorkerPrivate);
|
||||
bool result = HoldWorker(aWorkerPrivate, Canceling);
|
||||
if (result) {
|
||||
mWorkerPrivate = aWorkerPrivate;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче