Open Bug 1694375 Opened 5 years ago

Review usage of pending watchers in resource-watcher

Categories

(DevTools :: Framework, task, P3)

task

Tracking

(Not tracked)

People

(Reporter: jdescottes, Unassigned)

References

Details

In https://bugzilla.mozilla.org/show_bug.cgi?id=1692995 we are adding a new internal set _pendingWatchers in the resource-watcher, to store all the watchers which are still being created. watchResources is an async method and there is a window where you can interact with the ResourceWatcher while the call to watchResources has not fully resolved and the new "watcher" has not been added to the internal "_watchers" array.

In Bug 1692995 we are explicitly fixing an issue around unwatchResources. But in theory all call sites in resource-watcher.js relying on this._watchers should be reviewed to understand if they should process all watchers, or exclude pending watchers.

Note that instead of 2 sets/arrays, we could also simply use a flag in the "watcher" object (eg "pending: true") but this will require reviewing all call sites for _watchers carefully, while the current approach with _pendingWatchers is more conservative.

You need to log in before you can comment on or make changes to this bug.