New issue
Advanced search Search tips

Issue 641322 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

Document font state stuck at loading

Project Member Reported by joco@google.com, Aug 26 2016

Issue description

Version: 54.0.2816.0 beta (64-bit)
OS: Goobuntu

What steps will reproduce the problem?
1. Load some huge websites, eg. http://index.hu or http://www.bbc.co.uk
2. Wait for the page to be loaded
3. Observe document.fonts.status in the devtool console

What is the expected output? What do you see instead?
Should be "loaded", but is stuck "loading" and never completes. This happens quite randomly, some websites produce this more often than others.

*

I can reproduce this bug quite easily, and debugged this quite deeply by adding custom logging to the Chromium source code. I'm pretty sure the problem is this:
* A font starts to load. CSSFontFace::setLoadStatus(Loading) is called. m_segmentedFontFace is not null, so it sets the loading status in FontFaceSet.
* Somehow, m_segmentedFontFace gets cleared. I have no idea what it is, why it is a feature that it can be removed, etc., but it does get cleared.
* The font finishes loading. CSSFontFace::setLoadStatus(Loaded) is called. m_segmentedFontFace is null, so the method does an early exit.
* Noone ever clears the loading status in the FontFaceSet, it gets stuck forever.

The fix seems simple enough, clearing the segmented font face in a loading state should not be allowed, or if it must be allowed, then the FontFaceSet needs to be told about it when it happens.

*

Disclaimer: I work at Google, we need to watch font status to deflake some tests, and this bug is hurting us.

 

Comment 1 by joco@google.com, Aug 26 2016

If you tell me what's the expected behavior, and which branch this can go into, I'd like to try and fix it myself. I hope to get this released ASAP.
Project Member

Comment 2 by sheriffbot@chromium.org, Aug 28 2016

Labels: Hotlist-Google
Components: Blink>CSS Blink>Fonts

Comment 4 by suzyh@chromium.org, Aug 31 2016

Components: -Blink>CSS
This belongs to the Fonts folks, not CSS.

Comment 5 by joco@google.com, Sep 7 2016

Hey Fonts folks,

As mentioned earlier, I'm looking for direction and a reviewer, then I'd love to fix this bug myself.

Comment 6 by e...@chromium.org, Sep 8 2016

Components: -Blink>Fonts Blink>WebFonts Blink>Loader
Thanks joco, the webfonts team in Tokyo should be able to point you in the right direction.
Components: -Blink>Loader
Labels: OS-All
Owner: ksakamoto@chromium.org
Status: Assigned (was: Unconfirmed)
I will take a look next week.
Status: Started (was: Assigned)
Small repro case: https://jsbin.com/moxemuzoja/edit?html,console

CSSFontFace fails to notify FontFaceSet of the load completion if the FontFace is removed while loading. This may happen on pages that dynamically manipulates stylesheets too (bug 347460).

I'll send a patch shortly.

Comment 9 by joco@google.com, Sep 21 2016

Do you have an estimate when the fix can hit chrome stable/beta? If you're too busy, I can commit the fix if you give me some pointers.
The fix is under review: https://codereview.chromium.org/2340273002/

It will be shipped with Chrome 55, beta in mid October and stable in early December.
Project Member

Comment 11 by bugdroid1@chromium.org, Sep 27 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/035a2a978b7ec4f87439c355af25941fb0b9cfca

commit 035a2a978b7ec4f87439c355af25941fb0b9cfca
Author: ksakamoto <ksakamoto@chromium.org>
Date: Tue Sep 27 05:18:22 2016

Fix FontFaceSet state getting stuck at loading

This fixes a bug where the status attribute of FontFaceSet gets stuck
at "loading" when @font-face rule is removed while the font is loading.

Before this patch, font load completion was notified from
CSSFontFace::setLoadStatus() via m_segmentedFontFace, but if the
@font-face rule is detached, m_segmentedFontFace is null.
After this patch, FontFaceSet registers itself as an observer of
FontFace for load completion.

BUG= 641322 

Review-Url: https://codereview.chromium.org/2340273002
Cr-Commit-Position: refs/heads/master@{#421114}

[delete] https://crrev.com/34ceeb456810e5f24f2f233e30d98423385cb614/third_party/WebKit/LayoutTests/http/tests/webfont/fontfaceset-status-attribute-expected.txt
[modify] https://crrev.com/035a2a978b7ec4f87439c355af25941fb0b9cfca/third_party/WebKit/LayoutTests/http/tests/webfont/fontfaceset-status-attribute.html
[modify] https://crrev.com/035a2a978b7ec4f87439c355af25941fb0b9cfca/third_party/WebKit/Source/core/css/CSSFontFace.cpp
[modify] https://crrev.com/035a2a978b7ec4f87439c355af25941fb0b9cfca/third_party/WebKit/Source/core/css/FontFace.cpp
[modify] https://crrev.com/035a2a978b7ec4f87439c355af25941fb0b9cfca/third_party/WebKit/Source/core/css/FontFace.h
[modify] https://crrev.com/035a2a978b7ec4f87439c355af25941fb0b9cfca/third_party/WebKit/Source/core/css/FontFaceSet.cpp
[modify] https://crrev.com/035a2a978b7ec4f87439c355af25941fb0b9cfca/third_party/WebKit/Source/core/css/FontFaceSet.h

Status: Fixed (was: Started)
This should be fixed in Canary 55.0.2874.0 or later.

Comment 13 by joco@google.com, Sep 29 2016

Thank you!

Sign in to add a comment