WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
73419
WebFonts are re-fetched from the server upon Document::styleSelectorChanged call.
https://bugs.webkit.org/show_bug.cgi?id=73419
Summary
WebFonts are re-fetched from the server upon Document::styleSelectorChanged c...
Kenichi Ishibashi
Reported
2011-11-30 02:50:50 PST
See
http://crbug.com/103510
for details. This problem could happen when the response header of a webfont contains 'Cache-control: no-cache'. When style recalculation occurs, styleSelector is recreated. During styleSelector recreation, the webfont is re-validated via CSSFontSelector::addFontFaceRule(). As the result, the webfont is reloaded. WebKit shouldn't re-validate the cache in this case. I think we can avoid re-validation by holding a CachedFont handle in CSSFontFaceSrcValue object, like CSSImageValue does.
Attachments
Patch
(4.07 KB, patch)
2011-11-30 03:02 PST
,
Kenichi Ishibashi
no flags
Details
Formatted Diff
Diff
Patch
(4.18 KB, patch)
2011-12-04 22:23 PST
,
Kenichi Ishibashi
no flags
Details
Formatted Diff
Diff
Patch
(9.22 KB, patch)
2011-12-12 02:43 PST
,
Kenichi Ishibashi
no flags
Details
Formatted Diff
Diff
Patch
(9.26 KB, patch)
2011-12-18 20:39 PST
,
Kenichi Ishibashi
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Kenichi Ishibashi
Comment 1
2011-11-30 03:02:15 PST
Created
attachment 117157
[details]
Patch
Kenichi Ishibashi
Comment 2
2011-11-30 03:02:48 PST
(In reply to
comment #1
)
> Created an attachment (id=117157) [details] > Patch
No tests so far. How can we test this?
Kenichi Ishibashi
Comment 3
2011-11-30 03:06:22 PST
Hi mitz, Could you please take a look?
Alexey Proskuryakov
Comment 4
2011-11-30 11:10:48 PST
See also:
bug 27971
,
bug 43704
.
Kenichi Ishibashi
Comment 5
2011-12-04 22:23:02 PST
Created
attachment 117843
[details]
Patch
Alexey Proskuryakov
Comment 6
2011-12-04 22:31:15 PST
Does this also fix
bug 27971
?
Kenichi Ishibashi
Comment 7
2011-12-04 22:44:03 PST
Moritta suggested me in person that resource should be acquired in CSSFontFaceSrcValue. Could you take a look? (bdakin?) (In reply to
comment #6
)
> Does this also fix
bug 27971
?
Thanks for letting me know the bug. I couldn't reproduce the problem with my Safari, but I think this patch can fix
bug 27971
if the corresponding document object is not discarded.
Kenichi Ishibashi
Comment 8
2011-12-05 16:48:57 PST
Ping?
Kenichi Ishibashi
Comment 9
2011-12-07 01:51:18 PST
(In reply to
comment #7
)
> (In reply to
comment #6
) > > Does this also fix
bug 27971
? > > Thanks for letting me know the bug. I couldn't reproduce the problem with my Safari, but I think this patch can fix
bug 27971
if the corresponding document object is not discarded.
As far as I checked with WebInspector (on Chromium Linux build), WebKit doesn't try to reload the fonts when 'Back' is pressed. I also confirmed that the fonts were reloaded when 'Reload' is pressed in accordance with the response header.
Julien Chaffraix
Comment 10
2011-12-07 08:23:45 PST
> As far as I checked with WebInspector (on Chromium Linux build), WebKit doesn't try to reload the fonts when 'Back' is pressed. I also confirmed that the fonts were reloaded when 'Reload' is pressed in accordance with the response header.
It sounds like you could test your change if you use a PHP script that remembers that it was called (look at LayoutTests/http/tests/xmlhttprequest/resources/access-control-basic-preflight-cache-invalidation.php for an example) and use a location.reload(). If that's not possible, your ChangeLog should mention why you could not land a test case.
Alexey Proskuryakov
Comment 11
2011-12-07 09:07:55 PST
> As far as I checked with WebInspector (on Chromium Linux build), WebKit doesn't try to reload the fonts when 'Back' is pressed. I also confirmed that the fonts were reloaded when 'Reload' is pressed in accordance with the response header.
This is not what I'm seeing in Safari with ToT WebKit. The fonts are reloaded on Back. The fact that the test passes appears to mean that it no longer functions properly (perhaps a workaround was added server side).
Kenichi Ishibashi
Comment 12
2011-12-07 18:54:26 PST
(In reply to
comment #10
)
> It sounds like you could test your change if you use a PHP script that remembers that it was called (look at LayoutTests/http/tests/xmlhttprequest/resources/access-control-basic-preflight-cache-invalidation.php for an example) and use a location.reload(). If that's not possible, your ChangeLog should mention why you could not land a test case.
Thank you for the information. I'll try it (page navigation behavior looks different between ports as I mention below, though).
> This is not what I'm seeing in Safari with ToT WebKit. The fonts are reloaded on Back. The fact that the test passes appears to mean that it no longer functions properly (perhaps a workaround was added server side).
You are right. I confirmed the behavior in Safari with ToT WebKit. And my patch doesn't solve the problem. It seems the cause of
bug 27971
is different from this bug.
Hajime Morrita
Comment 13
2011-12-11 21:09:20 PST
As jchaffraix@ pointed, having a test case makes this change more solid. Using some server is good for end-to-end perspective. Another idea is to add some Internals API to purge caches, then use it in the test.
Kenichi Ishibashi
Comment 14
2011-12-12 02:43:39 PST
Created
attachment 118758
[details]
Patch
Kenichi Ishibashi
Comment 15
2011-12-12 02:50:15 PST
(In reply to
comment #13
)
> As jchaffraix@ pointed, having a test case makes this change more solid. > Using some server is good for end-to-end perspective. > Another idea is to add some Internals API to purge caches, > then use it in the test.
Thank you for the suggestion. LayoutTests/http/tests/xmlhttprequest/resources/access-control-basic-preflight-cache-invalidation.php is an useful reference and I wrote a test case (The test uses ugly setTimeout() to check whether font re-fetching has happened, though).
Kenichi Ishibashi
Comment 16
2011-12-14 17:35:23 PST
Could someone review the patch?
Alexey Proskuryakov
Comment 17
2011-12-14 21:12:07 PST
One question someone asked me is why we need a new reference to CachedFont, given that document already has a CachedResource for it.
Kenichi Ishibashi
Comment 18
2011-12-14 22:26:34 PST
(In reply to
comment #17
)
> One question someone asked me is why we need a new reference to CachedFont, given that document already has a CachedResource for it.
"document already has a CachedResource for it" means we can get the CachedFont by calling document->cachedResourceLoader()->requestFont()? If so, the problem is that requestFont() re-validates the cache, as I described in the bug description. Holding a reference to CachedFont avoids it, as the same manner as CSSImageValue does.
Kenichi Ishibashi
Comment 19
2011-12-18 20:39:13 PST
Created
attachment 119804
[details]
Patch
Kenichi Ishibashi
Comment 20
2011-12-18 20:40:22 PST
(In reply to
comment #19
)
> Created an attachment (id=119804) [details] > Patch
Just rebased to ToT.
Eric Seidel (no email)
Comment 21
2011-12-21 12:47:40 PST
I know we've had issues before with cache sharing between documents. I'm not sure if that is still a risk or not.
mitz
Comment 22
2012-01-09 21:52:12 PST
Comment on
attachment 119804
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=119804&action=review
> Source/WebCore/css/CSSFontFaceSrcValue.cpp:29 > +#include "CachedFont.h"
I’m surprised that this header is needed.
Kenichi Ishibashi
Comment 23
2012-01-09 22:55:29 PST
Comment on
attachment 119804
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=119804&action=review
Thank you so much for review.
>> Source/WebCore/css/CSSFontFaceSrcValue.cpp:29 >> +#include "CachedFont.h" > > I’m surprised that this header is needed.
"m_cachedFont = document->cachedResourceLoader()->requestFont(request);" requires the header.
WebKit Review Bot
Comment 24
2012-01-10 02:13:20 PST
Comment on
attachment 119804
[details]
Patch Clearing flags on attachment: 119804 Committed
r104542
: <
http://trac.webkit.org/changeset/104542
>
WebKit Review Bot
Comment 25
2012-01-10 02:13:27 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug