Bug 1389184 Avoid crashing in worker MemoryReporter if the GlobalScope is nullptr. r=asuth

This commit is contained in:
Ben Kelly 2017-08-10 18:00:05 -07:00
Родитель cc3f3645bc
Коммит 4364d9066e
1 изменённых файлов: 3 добавлений и 2 удалений

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

@ -2598,8 +2598,9 @@ WorkerPrivate::MemoryReporter::CollectReportsRunnable::WorkerRun(JSContext* aCx,
{ {
aWorkerPrivate->AssertIsOnWorkerThread(); aWorkerPrivate->AssertIsOnWorkerThread();
RefPtr<Performance> performance = RefPtr<WorkerGlobalScope> scope = aWorkerPrivate->GlobalScope();
aWorkerPrivate->GlobalScope()->GetPerformanceIfExists(); RefPtr<Performance> performance = scope ? scope->GetPerformanceIfExists()
: nullptr;
if (performance) { if (performance) {
size_t userEntries = performance->SizeOfUserEntries(JsWorkerMallocSizeOf); size_t userEntries = performance->SizeOfUserEntries(JsWorkerMallocSizeOf);
size_t resourceEntries = size_t resourceEntries =