Bug 1565956 adjust IsCurrentThreadRunningChromeWorker() for worklet threads r=baku
authorKarl Tomlinson <karlt+@karlt.net>
Sun, 17 Nov 2019 21:17:40 +0000
changeset 502358 a1849f162702113fc3e66790787e93bc55d46eb0
parent 502357 370d932f9681bbf85b1c1417b27936a839248be9
child 502359 44a3e5f050de4aff4e3080532319595185f1db3a
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1565956
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1565956 adjust IsCurrentThreadRunningChromeWorker() for worklet threads r=baku Depends on D53135 Differential Revision: https://phabricator.services.mozilla.com/D53136
dom/workers/RuntimeService.cpp
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -2489,17 +2489,18 @@ WorkerPrivate* GetCurrentThreadWorkerPri
   return workerjscx->GetWorkerPrivate();
 }
 
 bool IsCurrentThreadRunningWorker() {
   return !NS_IsMainThread() && !!GetCurrentThreadWorkerPrivate();
 }
 
 bool IsCurrentThreadRunningChromeWorker() {
-  return GetCurrentThreadWorkerPrivate()->UsesSystemPrincipal();
+  WorkerPrivate* wp = GetCurrentThreadWorkerPrivate();
+  return wp && wp->UsesSystemPrincipal();
 }
 
 JSContext* GetCurrentWorkerThreadJSContext() {
   WorkerPrivate* wp = GetCurrentThreadWorkerPrivate();
   if (!wp) {
     return nullptr;
   }
   return wp->GetJSContext();