Bug 1412190 - Allow active context to be null during profiling (r=jandem)
authorBill McCloskey <billm@mozilla.com>
Fri, 22 Sep 2017 10:56:08 -0700
changeset 444705 ece293c2e9abbf0b10c9e5f587c5f20979aefd1a
parent 444704 d1666bcca1a5c90372b9849dda2a1fa2b9326d9f
child 444706 f367f91a3bde6553e3d93a479dca222a35a23904
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1412190
milestone58.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 1412190 - Allow active context to be null during profiling (r=jandem) MozReview-Commit-ID: 3bLcXBPpxtY
js/src/vm/GeckoProfiler.cpp
--- a/js/src/vm/GeckoProfiler.cpp
+++ b/js/src/vm/GeckoProfiler.cpp
@@ -436,17 +436,17 @@ ProfileEntry::script() const
     // If profiling is supressed then we can't trust the script pointers to be
     // valid as they could be in the process of being moved by a compacting GC
     // (although it's still OK to get the runtime from them).
     //
     // We only need to check the active context here, as
     // AutoSuppressProfilerSampling prohibits the runtime's active context from
     // being changed while it exists.
     JSContext* cx = script->runtimeFromAnyThread()->activeContext();
-    if (!cx->isProfilerSamplingEnabled())
+    if (!cx || !cx->isProfilerSamplingEnabled())
         return nullptr;
 
     MOZ_ASSERT(!IsForwarded(script));
     return script;
 }
 
 JS_FRIEND_API(jsbytecode*)
 ProfileEntry::pc() const