[Webkit-unassigned] [Bug 249887] New: preloading local file with "crossorigin" leads to the file not being loaded at all
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sun Dec 25 14:10:39 PST 2022
https://bugs.webkit.org/show_bug.cgi?id=249887
Bug ID: 249887
Summary: preloading local file with "crossorigin" leads to the
file not being loaded at all
Product: WebKit
Version: Safari 16
Hardware: All
OS: All
Status: NEW
Severity: Normal
Priority: P2
Component: Page Loading
Assignee: webkit-unassigned at lists.webkit.org
Reporter: kalle.wachsmuth at gmail.com
CC: beidson at apple.com
Created attachment 464209
--> https://bugs.webkit.org/attachment.cgi?id=464209&action=review
example HTML document
Issue encountered here: https://github.com/rust-lang/rust/issues/98769
The problematic preload link looks like this:
<link rel="preload" as="font" type="font/woff2" crossorigin href="SourceSerif4-Regular.ttf.woff2">
crossorigin is apparently needed for preloading fonts (https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preload#cors-enabled_fetches).
The issue arises when the file to be loaded is on the local machine (file:/// URLs). This doesn't work in conjunction with crossorigin.
Dev console:
[Error] Origin null is not allowed by Access-Control-Allow-Origin. Status code: 0
[Error] Failed to load resource: Origin null is not allowed by Access-Control-Allow-Origin. Status code: 0 (SourceSerif4-Regular.ttf.woff2, line 0)
Failing to preload a local file isn't much of a problem, but attempting to fetch the font later (it's being pulled in from CSS) will then also fail. As a result, the preload link prevents the font from being loaded at all.
## Reproducing
Safari 16.2 (18614.3.7.1.5) / macOS 13.1 on x86-64
Example font: https://github.com/rust-lang/rust/raw/298d763fc0ac206cf3ae202459101e36a17071f7/src/librustdoc/html/static/fonts/SourceSerif4-Regular.ttf.woff2
Example HTML document is in the attachments
Put them both in the same folder and open the document.
serif font --> success
sans-serif font --> failure
The same thing works fine in Firefox 108.0.1 for example
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20221225/83eb4e71/attachment.htm>
More information about the webkit-unassigned
mailing list