(In reply to Daniel Holbert [:dholbert] from comment #6) > If we followed the spec's implied resolve-the-promise-asynchronously suggestion for the `FontFace::Load` internals, then I think we'd do the correct/safe thing here, and we'd match other browsers on the event-ordering in my just-attached "reduced testcase 3". This^ is probably the best solution ultimately, but it carries some risk since it'll change timing of when events fire, and the added delays might introduce some perf impact (though maybe/probably negligible). For now I tend to think we should just upgrade the local `nsTArray<FontFace*> faces;` array to be `RefPtr`s, since these FontFace objects are refcounted anyway, which gives us that option. That'll add a bit of refcount traffic which is a nonzero cost, but it gives us a pretty safe/obvious band-aid to mitigate the immediate problem here. Then in the future, if/when we defer the `FontFace::Load` work to happen later as I suggest in comment 4, we can relax `faces` to be storing raw pointers again to save ourselves some refcounting traffic.
Bug 1966423 Comment 7 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 Daniel Holbert [:dholbert] from comment #6) > If we followed the spec's implied resolve-the-promise-asynchronously suggestion for the `FontFace::Load` internals, then I think we'd do the correct/safe thing here, and we'd match other browsers on the event-ordering in my just-attached "reduced testcase 3". This^ is probably the best solution ultimately, but it carries some risk since it'll change timing of when events fire, and the added delays might introduce some perf impact (though maybe/probably negligible). For now I tend to think we should just upgrade the local `nsTArray<FontFace*> faces;` array to be `RefPtr`s, since these FontFace objects are refcounted anyway, which gives us that option. That'll add a bit of refcount traffic which is a nonzero cost, but it gives us a pretty safe/obvious band-aid to mitigate the immediate problem here. Then in the future, if/when we defer the `FontFace::Load` work to happen later as I suggest in comment 6, we can relax `faces` to be storing raw pointers again to save ourselves some refcounting traffic.