From b79b897b6e399dcb94d91a2567448c169e16e925 Mon Sep 17 00:00:00 2001 From: roytam1 Date: Thu, 30 Apr 2026 10:33:36 +0800 Subject: [PATCH] import from UXP: [DOM] Do not interrupt worker execution if already scheduled. (bf526d70) --- dom/workers/ScriptLoader.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp index 313baf166..c237bfa37 100644 --- a/dom/workers/ScriptLoader.cpp +++ b/dom/workers/ScriptLoader.cpp @@ -1474,6 +1474,10 @@ CachePromiseHandler::ResolvedCallback(JSContext* aCx, JS::Handle aValue) { AssertIsOnMainThread(); + // If execution is already schuled, bail. + if (mLoadInfo.mExecutionScheduled) { + return; + } // May already have been canceled by CacheScriptLoader::Fail from // CancelMainThread. MOZ_ASSERT(mLoadInfo.mCacheStatus == ScriptLoadInfo::WritingToCache || @@ -1492,6 +1496,10 @@ CachePromiseHandler::RejectedCallback(JSContext* aCx, JS::Handle aValue) { AssertIsOnMainThread(); + // If execution is already schuled, bail. + if (mLoadInfo.mExecutionScheduled) { + return; + } // May already have been canceled by CacheScriptLoader::Fail from // CancelMainThread. MOZ_ASSERT(mLoadInfo.mCacheStatus == ScriptLoadInfo::WritingToCache ||