-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Local rustdocs generate cross-origin errors trying to load fonts in Firefox #34681
Comments
Please take a look at #34702 to see if it solved your issue. |
This might be a bug in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=760436. |
It's because of firefox. But not sure if this is a bug. |
Note that that bug is marked as invalid. |
Triage: still a problem. Reading the discussion in the bugzilla link that @ollie27 linked, it may be deliberate:
If that's the case, i'm not totally sure this is a problem we can fix without asking Firefox to adopt a looser same-origin policy for |
Looking back, this might be part of the reason I wanted #54772. I was opening docs locally in Firefox, and kept seeing the awful fonts that the browser falls back to when it fails to load the rustdoc fonts. I think the situation would be significantly improved (though not entirely fixed) by making the font stacks be only the loaded font + the font style. So, for example, today we have body {
font: 16px/1.4 "Source Serif Pro",Georgia,Times,"Times New Roman",serif;
} The page looks significantly better with just body {
font: 16px/1.4 "Source Serif Pro",serif;
} I don't know why those other intermediate font overrides are even there? |
This is a (much) more constrained version of rust-lang#54772 that also aims at improving the situation in rust-lang#34681. It removes any font specifications that are not the "official" rustdoc font, and instead relies on the browser to provide the fallback font if the official on is not available. On Linux systems, this is particularly important, as fonts like Helvetica, Arial, and Times often look pretty bad since they're pulled from extracted MS fonts. A specification like `serif` or `sans-serif` lets the browser instead choose a good font.
From
|
…llaumeGomez Remove intermediate font specs This is a (much) more constrained version of rust-lang#54772 that also aims at improving the situation in rust-lang#34681. It removes any font specifications that are not the "official" rustdoc font, and instead relies on the browser to provide the fallback font if the official on is not available. On Linux systems, this is particularly important, as fonts like Helvetica, Arial, and Times often look pretty bad since they're pulled from extracted MS fonts. A specification like `serif` or `sans-serif` lets the browser instead choose a good font.
…llaumeGomez Remove intermediate font specs This is a (much) more constrained version of rust-lang#54772 that also aims at improving the situation in rust-lang#34681. It removes any font specifications that are not the "official" rustdoc font, and instead relies on the browser to provide the fallback font if the official on is not available. On Linux systems, this is particularly important, as fonts like Helvetica, Arial, and Times often look pretty bad since they're pulled from extracted MS fonts. A specification like `serif` or `sans-serif` lets the browser instead choose a good font.
For myself this issue is caused by the fact that I go directly to the API search page ( In this case the fonts are actually one folder above my current folder which violates the rule outlined by jfkthame in the mozilla bug:
To verify this I copied the fonts into the std folder and prepended Edit: Verified that this affects |
This seems to work fine now in Firefox 69. For reference it looks like this behavior was changed in Firefox in https://bugzilla.mozilla.org/show_bug.cgi?id=1565942, which landed in Firefox 69 and was backported to 68.0.2. |
Awesome! I guess we can close it then. |
Loading the locally installed copy of the standard library docs in Firefox I see errors in the console about loading fonts:
This is because Firefox implements a strict same-origin policy for file: URLs: https://developer.mozilla.org/en-US/docs/Same-origin_policy_for_file:_URIs
...and web fonts follow the same-origin policy, so a html page loaded from a file: URL can't load a web font from a parent directory.
/cc @Ms2ger
The text was updated successfully, but these errors were encountered: