Repository navigation
fix: notice in Safari when a served stylesheet failed to load - #487
Merged
Merged
Conversation
JuroOravec
added a commit
that referenced
this pull request
Oct 28, 2026
JuroOravec
force-pushed
the
fix/safari-failed-stylesheet
branch
from
October 28, 2026 11:36
a5881d5 to
065f322
Compare
When a Citry page mounts, the Vue runtime keeps the stylesheet links the server wrote into the page. It skips one that failed: the link has no sheet, or its resource timing entry reports an error status. Safari reports no status, and it gives a link whose response failed an empty sheet, so in Safari a page whose stylesheet failed mounted without its styles and reported nothing. When no status is available and the served link's sheet has no rules, the runtime now loads the same URL again in a link whose media matches nothing. If that link fails, the runtime requests the stylesheet again as it does in other browsers, and reports the error if that fails too. The check waits at most 3 seconds, then keeps the served link, so a stalled request cannot hold the mount. A healthy page, whose sheet has rules, needs no extra request. Co-Authored-By: Claude Opus 5.5 <[email protected]>
JuroOravec
force-pushed
the
fix/safari-failed-stylesheet
branch
from
October 28, 2026 16:13
065f322 to
83c384b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a Citry page mounts, the Vue runtime keeps the stylesheet links that the server already wrote into the page, so the page paints with its styles before any script runs. The runtime skips a link that failed. In Chromium and Firefox it can tell: a failed link has no sheet, or its resource timing entry (the browser's record of the download) reports an error status. Safari reports no status in resource timing, and it gives a link whose response failed an empty sheet. So in Safari, a page whose stylesheet failed to load (a 404, or a 503) mounted without its styles, and no error appeared anywhere.
The fix
When no timing entry gives a status and the served link's sheet has no rules, the runtime now loads the same URL again in a probe link whose media matches nothing (
media="not all"), so the probe does not change the page's styles. The probe carries the sameintegrity,crossoriginand nonce as the links the runtime creates, so it uses the same cached copy and passes the same CSP checks.Citry Vue stylesheet failed to load: <url>if it fails too, as in other browsers. The served link's sheet is empty in this case, so removing it first takes no styles off the page.Cost and error modes
Tests
In
packages/py/citry/tests/e2e/test_asset_cors_e2e.py, an init script deletesPerformanceResourceTiming.prototype.responseStatus, so that Chromium and Firefox take the path the runtime takes in Safari. These tests now run both with and without the status:test_a_served_stylesheet_that_fails_to_load_is_reported: the failed stylesheet is reported and the page does not mount. On main's runtime the without-status case fails, because the page mounts and nothing is reported.test_served_page_paints_with_its_component_styles_before_the_runtime_runs: the runtime keeps the served link, and no other stylesheet link is left behind.test_top_level_page_downloads_each_asset_once: still one request per asset.test_a_served_stylesheet_with_no_rules_is_adopted: a stylesheet that holds only a comment loads with no rules, so without a status the probe runs, loads, and the page mounts with exactly one stylesheet link. With the line that removes the probe link taken out of the runtime, the without-status case of this test fails.Not covered by a test:
Evidence
test_asset_cors_e2e.py: 13 passed on Chromium and 13 on Firefox.debug/webkit-e2ebranch:text/plainand a 503text/css. The timing entry has noresponseStatus. A probe link withmedia="not all"fireserror, andfetch()sees the 404.test_asset_cors_e2e.pypass on WebKit. That includes the failure being reported, the stylesheet with no rules being adopted, and one request per asset, with and without integrity.pnpm --dir packages/js/citry-client run checkpasses (241), andruntime.jsis rebuilt fromclient.js.test_vue_listener_modifiers_e2e.pyandtest_vue_slot_props_e2e.py. Those 12 fail the same way on main with my locally installedcitry_core, because they need a newer Rust build. PR CI builds it.test_asset_cors_e2e.pyruns on WebKit only in the weekly cross-browser job, not in PR CI, so the debug run above is this PR's WebKit evidence.🤖 Generated with Claude Code