Closed Bug 1163446 Opened 5 years ago Closed 5 years ago

drop reference to FontFace once a FontFaceBufferSource is loaded

Categories

(Core :: DOM: CSS Object Model, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox40 --- affected
firefox41 --- fixed

People

(Reporter: heycam, Assigned: heycam)

References

Details

Attachments

(1 file)

Attached patch patchSplinter Review
A FontFaceBufferSource encapsulates an ArrayBuffer(Source) for gfxUserFontSet.  It holds a strong reference to the FontFace which initially owns the buffer.  Once the gfxUserFontSet takes ownership of the buffer to parse it as a font, the FontFaceBufferSource no longer needs a reference to the FontFace.

Dropping the reference to the FontFace is needed for bug 1161413, where we can no longer rely on a call to FontFaceSet::DestroyUserFontSet at pres context destruction time to drop enough references so that we don't leak.  Otherwise a simple document like this will leak:

  <script>new FontFace("x", new ArrayBuffer(0))</script>

as the gfxUserFontSet holds on to the FontFace (through the FontFaceBufferSource in its mSrcList).

We could alternatively traverse/unlink the FontFace reference in FontFaceBufferSource from FontFaceSet's CC macros, but it's easier to just drop the reference here.
Attachment #8603895 - Flags: review?(jdaggett)
Attachment #8603895 - Flags: review?(jdaggett) → review+
https://hg.mozilla.org/mozilla-central/rev/6325283ba40b
https://hg.mozilla.org/mozilla-central/rev/651e2c2015f6
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.