Open petemill opened 5 years ago
Note that this is a higher priority for android, which is why I've been working on it now
After discussion with @bridiver, current plan is to create a new route at chrome://brave-resources
which copies what the SharedResourcesDataSource
does. This avoids creating dependencies from brave to non-public content/browser target, or vice versa.
Currently, custom fonts are bundled as data URIs inside each and every JS bundle. This has the following negative impacts:
Luckily our web fonts (woff2) are split in to a large amount of files by font-name, font-weight and character set.
Ideally they would be served from the same URL across all web-uis to take advantage of the same cache, although since this is all local then I guess this is a secondary requirement.
I solved this in the android codebase by serving these assets from
chrome://resources
. An alternative would be to setupchrome://brave-resources
to split brave's from chromium's. However, I found this to be a lot of code to copy or setup, versus adding a brave grdp. This implementation for android can be seen here: https://github.com/brave/browser-android-tabs/pull/814/commits/8aaa14521cf5eef12c95144cc34bdb3d76a1e7a2Note that I first thought of solving this by adding the many common paths to all the font files in all webui data sources, via
brave_webui_source
. However the parent class of the underlying data source does not support sending the .woff2 mime type as acontent-type
http header. It is also difficult to modify this classes behavior since it is not a public output of thecontent
module. So the easiest way (and probably best anyway) to solve this would be to serve from a different data source, and such a compatible one exists inchrome://resources
.