(In reply to Mike Conley (:mconley) (:⚙️) (Extremely busy) from comment #8) > (In reply to Olli Pettay [:smaug] from comment #7) > > Why is https://searchfox.org/mozilla-central/rev/4bb2401ecbfce89af06fb2b4d0ea3557682bd8ff/dom/base/nsGlobalWindowInner.cpp#6698 safe? > > Can't something something modify the array while it is being iterated because https://searchfox.org/mozilla-central/rev/4bb2401ecbfce89af06fb2b4d0ea3557682bd8ff/dom/base/nsGlobalWindowInner.cpp#806 calls random JS ? > > It looks like we have a `mIteratingDocumentFlushedResolvers` guard to prevent appending more PromiseDocumentFlushed resolvers while iterating the list, so I suspect no. Only if Unlink doesn't happen somehow during iteration. Unlikely though. I would use effectively a kungfuDeathGrip on stack when dealing with RefreshDriver callbacks (which are weak).
Bug 1643874 Comment 9 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
(In reply to Mike Conley (:mconley) (:⚙️) (Extremely busy) from comment #8) > (In reply to Olli Pettay [:smaug] from comment #7) > > Why is https://searchfox.org/mozilla-central/rev/4bb2401ecbfce89af06fb2b4d0ea3557682bd8ff/dom/base/nsGlobalWindowInner.cpp#6698 safe? > > Can't something something modify the array while it is being iterated because https://searchfox.org/mozilla-central/rev/4bb2401ecbfce89af06fb2b4d0ea3557682bd8ff/dom/base/nsGlobalWindowInner.cpp#806 calls random JS ? > > It looks like we have a `mIteratingDocumentFlushedResolvers` guard to prevent appending more PromiseDocumentFlushed resolvers while iterating the list, so I suspect no. Only if Unlink doesn't happen somehow during iteration. Unlikely though. I would use effectively a kungfuDeathGrip on stack when dealing with RefreshDriver callbacks (which are weak).