commit a5316cedc669bcec09efae23521e0af6b9d3d257
parent 71a99f8c272bfc0253db898105f5571f58dfb848
Author: Matthew Gaudet <mgaudet@mozilla.com>
Date: Tue, 21 Oct 2025 16:48:09 +0000
Bug 1995409 - Don't try to check for microtasks if there is no JSContext available r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D269437
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/xpcom/base/CycleCollectedJSContext.cpp b/xpcom/base/CycleCollectedJSContext.cpp
@@ -1120,6 +1120,12 @@ bool CycleCollectedJSContext::PerformMicroTaskCheckPoint(bool aForce) {
JSContext* cx = Context();
if (StaticPrefs::javascript_options_use_js_microtask_queue()) {
+ // If we have no JSContext we are not capable of checking for
+ // nor running microtasks, and so simply return false early here.
+ if (!cx) {
+ return false;
+ }
+
if (!JS::HasAnyMicroTasks(cx)) {
MOZ_ASSERT(mDebuggerMicroTaskQueue.empty());
MOZ_ASSERT(mPendingMicroTaskRunnables.empty());