Repository navigation
Vendor a stopgap wombat.js patch for CSSStyleSheet.replaceSync()/.replace() - #410
Merged
Merged
Conversation
…lace() insertRule() already runs its argument through rewriteStyle() before applying it, but replaceSync()/.replace() (the Constructable Stylesheets API used by Shadow DOM web components to adopt a stylesheet built from a plain JS string) don't, leaving any url() in that text unrewritten and 404ing on replay. Confirmed on developer.mozilla.org, where several web components (mdn-compat-table-lazy, mdn-survey, mdn-user-menu, mdn-placement-sidebar) adopt stylesheets this way for shared icons. Reported upstream as webrecorder/wombat#249; this is the same kind of interim local patch already used here for #240/#242/#244, kept until upstream lands the real fix.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #410 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 42 42
Lines 2989 2989
Branches 457 457
=========================================
Hits 2989 2989 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
benoit74
deleted the
benoit74/vendor-css-stylesheet-replacesync-patch
branch
November 17, 2026 20:03
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.
Summary
insertRule()on the vendoredwombat.jsalready runs its argument throughrewriteStyle()before applying it, so anyurl()reference inside gets rewritten the same way an inline<style>tag would.replaceSync()/.replace()— the Constructable Stylesheets API used by Shadow DOM web components to adopt a stylesheet built from a plain JS string (new CSSStyleSheet().replaceSync(cssText)) — were not patched at all, leaving anyurl()in that text absolute and unrewritten, 404ing on replay.mdn-compat-table-lazy,mdn-survey,mdn-user-menu,mdn-placement-sidebar) each adopt a stylesheet this way for shared icons (browser-compat-table icons, external-link markers, etc.), none of which are visible to any other part of the rewriting pipeline — not atext/cssHTTP response, not an inline<style>/style=""attribute in captured HTML, andJsRewriterdeliberately doesn't rewrite arbitrary JS string literals.insertRule()already is: wrapsreplaceSync/replace(each guarded on its own existence) to run their CSS text through the existingrewriteStyle()helper first.Verified on a real built ZIM of developer.mozilla.org content: all previously-404ing compat-table icons (chrome/firefox/safari/edge/opera/samsung-internet/webview/monitor/smartphone/check/external-link) now load correctly in both light and dark mode, with no regression in
tests/rewriting/(767 passed) and the patch applying idempotently against a freshwombat.jsdownload.