зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1353762 - Check for OOM when creating WebCryptoTasks r=keeler,mt
This commit is contained in:
Родитель
00e96badb1
Коммит
70d6a12be6
|
@ -57,6 +57,10 @@ SubtleCrypto::RecordTelemetryOnce() {
|
|||
RecordTelemetryOnce(); \
|
||||
RefPtr<WebCryptoTask> task = \
|
||||
WebCryptoTask::Create ## Operation ## Task(__VA_ARGS__); \
|
||||
if (!task) { \
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY); \
|
||||
return nullptr; \
|
||||
} \
|
||||
task->DispatchWithPromise(p); \
|
||||
return p.forget();
|
||||
|
||||
|
|
|
@ -280,6 +280,10 @@ RTCCertificate::GenerateCertificate(
|
|||
RefPtr<WebCryptoTask> task =
|
||||
new GenerateRTCCertificateTask(global, aGlobal.Context(),
|
||||
aOptions, usages, expires);
|
||||
if (!task) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
task->DispatchWithPromise(p);
|
||||
return p.forget();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче