Bug 1141026 - BroadcastChannel should throw if it fails registering the worker feature, r=smaug

This commit is contained in:
Andrea Marchesini 2015-03-09 13:51:47 +00:00
Родитель 96b90bb043
Коммит 117c2d6e8e
2 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -513,6 +513,8 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,
JSContext* cx = workerPrivate->GetJSContext();
if (NS_WARN_IF(!workerPrivate->AddFeature(cx, bc->mWorkerFeature))) {
NS_WARNING("Failed to register the BroadcastChannel worker feature.");
bc->mWorkerFeature = nullptr;
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
}

Просмотреть файл

@ -5415,7 +5415,7 @@ WorkerPrivate::AddFeature(JSContext* aCx, WorkerFeature* aFeature)
}
}
NS_ASSERTION(!mFeatures.Contains(aFeature), "Already know about this one!");
MOZ_ASSERT(!mFeatures.Contains(aFeature), "Already know about this one!");
mFeatures.AppendElement(aFeature);
return mFeatures.Length() == 1 ?
@ -5428,7 +5428,7 @@ WorkerPrivate::RemoveFeature(JSContext* aCx, WorkerFeature* aFeature)
{
AssertIsOnWorkerThread();
NS_ASSERTION(mFeatures.Contains(aFeature), "Didn't know about this one!");
MOZ_ASSERT(mFeatures.Contains(aFeature), "Didn't know about this one!");
mFeatures.RemoveElement(aFeature);
if (mFeatures.IsEmpty() && !ModifyBusyCountFromWorker(aCx, false)) {