Bug 1824803; r=allstarschh

Differential Revision: https://phabricator.services.mozilla.com/D174100
This commit is contained in:
Yulia
2023-04-14 16:26:01 +00:00
parent 494bd4a34b
commit 812fd2df00

View File

@@ -1528,8 +1528,20 @@ bool ScriptExecutorRunnable::PreRun(WorkerPrivate* aWorkerPrivate) {
mScriptLoader->mSyncLoopTarget == mSyncLoopTarget,
"Unexpected SyncLoopTarget. Check if the sync loop was closed early");
if (!mLoadedRequests[0]->GetContext()->IsTopLevel()) {
return true;
{
// There is a possibility that we cleaned up while this task was waiting to
// run. If this has happened, return and exit.
MutexAutoLock lock(mScriptLoader->CleanUpLock());
if (mScriptLoader->CleanedUp()) {
return true;
}
const auto& requestHandle = mLoadedRequests[0];
// Check if the request is still valid.
if (requestHandle->IsEmpty() ||
!requestHandle->GetContext()->IsTopLevel()) {
return true;
}
}
return mScriptLoader->StoreCSP();