Open Bug 1074058 Opened 5 years ago

don't cancel loading FontFaces if they fall out of the array of rule-backed faces

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set

Tracking

()

People

(Reporter: heycam, Unassigned)

References

Details

If you have an @font-face rule that is loading, and which has a FontFace object representing it, and you then remove that rule from the document, FontFaceSet::UpdateRules will cancel the loading of the FontFace's user font entry.  But since the author could have kept a reference to the FontFace, we shouldn't cancel it.

There is an edge case problem that exists with the pre-bug 1028497 code, where if you have two duplicate @font-face rules in the document, backed by the same user font entry, and remove one of the rules, then the load will be cancelled even though there's still another rule using that entry in the document.

The natural place to cancel seems to be in FontFace's destructor.  We can check whether its Entry array is empty after it deregisters itself from the Entry, and if so, it can call Cancel on the entry's loader.  Checking that the array is empty will handle that edge case.
You need to log in before you can comment on or make changes to this bug.