Bug 1621337 - Check if existingTargets is still defined when processing listWorkerChanged r=ochameau

Differential Revision: https://phabricator.services.mozilla.com/D74699
This commit is contained in:
Julian Descottes 2020-05-22 06:46:31 +00:00
parent 8a87d1b582
commit 0eaaeb886a

View File

@ -82,6 +82,10 @@ class LegacyWorkersWatcher {
// Fetch the list of already existing worker targets for this process target front.
const existingTargets = this.targetsByProcess.get(targetFront);
if (!existingTargets) {
// unlisten was called while processing the workerListChanged callback.
return;
}
// Process the new list to detect the ones being destroyed
// Force destroying the targets