Add Base64 encoded web font resource data to dev tools fontsUpdated event.
Reported by
br...@amazon.com,
Oct 9
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/69.0.3497.81 Chrome/69.0.3497.81 Safari/537.36 Steps to reproduce the problem: Note: I have an upcoming CL to implement this change. This bug is for tracking purposes. The dev tools protocol currently implements a fontsUpdated event which provides details of updated fonts when a font has successfully loaded. Currently, these details omit the font resource data itself. We have a headless use-case that requires access to the font resource data. Successfully loaded fonts could be Base64 encoded and provided by the fontsUpdated event. What is the expected behavior? The font resource data is surfaced through devtools. What went wrong? The font resource data is not surfaced through devtools. Did this work before? No Chrome version: 69.0.3497.81 Channel: n/a OS Version: Flash Version:
,
Oct 9
Using the Network domain was my initial idea for how to implement this. |Network.responseReceived| includes a |ResourceType| and |RequestId|. One of the |ResourceType|s is |Font|, and it looks like |RequestId| can be passed to |Network.getResponseBody| to retrieve the response body, so that theoretically connects the dots. With using the Network domain however, the missing piece is how to connect this back to all of the CSS styling information and metadata like resolved platform font family, at the time the font is loaded. The code change I have locally extends my earlier CL in https://chromium.googlesource.com/chromium/src/+/bf7bdf59830d9d9e48d73278457cc1e9173f702d%5E%21/#F14 to include the base64-encoded font. I can post the CL shortly if you'd like to see what it looks like in practice. I'm open to suggestions on other approaches.
,
Oct 10
Can we find a link from the SharedBuffer in which Blink holds the font blob to a RequestId - this way we could combine the Network Domain and the fonts event. If that's impractical, how about a hash over the raw font data in the event? Then you could capture the ResourceType=Font matches and compare them by checksum to the one in the fontsUpdated event?
,
Oct 10
1. This approach will definitely introduce extra traffic, which I'd like to avoid. Most clients are not interested in the font data, but they will get huge payloads with it when enabling CSS domain. Network.getResponseBody is an explicit call, which mitigates this issue. 2. Can we match the request by url, to use Network.getResponseBody? I believe that blink will issue each FontFace.src just once, so there should be no confusion. Dominik should know better though. 3. We also have Page.getResourceContent method which can fetch the resource by url, so that you don't have to listen to all Network notifications to find the RequestId for the resource. Will that work for you?
,
Oct 12
Thanks for the suggestions. I'm AFK next week, though will take a closer look at these approaches when I am back.
,
Dec 4
I don't think anyone has enough cycles to do this, feel free to reopen once you have a patch! |
|||
►
Sign in to add a comment |
|||
Comment 1 by dgozman@chromium.org
, Oct 9