Skip to content

Patch vendored wombat.js so element properties return/forget a recorded original - #386

Merged
benoit74 merged 1 commit into
mainfrom
benoit74/patch-wombat-element-properties-recorded-original
Nov 6, 2026
Merged

benoit74 merged 1 commit into
mainfrom
benoit74/patch-wombat-element-properties-recorded-original

Conversation

@benoit74

@benoit74 benoit74 commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • getAttribute('src'|'href'|...) already returns a server-side rewriter's recorded original (via __wb_orig_<attr>), but the element properties that reflect those attributes (img.src, script.src, link.href, a.href and its derived .pathname/.search/..., and Attr.value) did not: they always re-derived their value from the rewritten attribute via extractOriginalURL, which cannot reverse our own urlRewriteFunction's path+query flattening (same underlying cause as the Location-getter patch already in place).
  • Assigning any of those properties also left the previously recorded original behind, unlike setAttribute, which already forgets it.
  • This has been proposed upstream as Return a recorded original from element properties too webrecorder/wombat#240; rules/patch_wombat.py patches our vendored copy in the meantime, following the exact same pattern as the existing fetch()/Request() and Location-getter patches.

Only rules/patch_wombat.py (and CHANGELOG.md) are touched here; the vendored wombat.js itself is regenerated by the get_file build step, not committed alongside script changes (same as the two prior patches).

benoit74 added a commit that referenced this pull request Nov 6, 2026
@benoit74 benoit74 self-assigned this Nov 6, 2026
…ed original

img.src, script.src, link.href, a.href (and its derived .pathname/.search/...)
and Attr.value only re-derived their value from the rewritten attribute via
extractOriginalURL, unlike getAttribute which already prefers a server-side
rewriter's recorded original. Assigning any of those properties also left the
recorded original behind, unlike setAttribute.

Proposed upstream as webrecorder/wombat#240; patch our vendored copy in the
meantime, the same way the fetch()/Request() and Location-getter patches
already do. (#386)
@benoit74
benoit74 force-pushed the benoit74/patch-wombat-element-properties-recorded-original branch from 9f5d303 to 1cd1e64 Compare November 6, 2026 16:58
@benoit74
benoit74 merged commit c209d81 into main Nov 6, 2026
8 checks passed
@benoit74
benoit74 deleted the benoit74/patch-wombat-element-properties-recorded-original branch November 6, 2026 17:02
@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (783464d) to head (1cd1e64).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #386   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           42        42           
  Lines         2937      2937           
  Branches       450       450           
=========================================
  Hits          2937      2937           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

benoit74 added a commit to pawank925/python-scraperlib that referenced this pull request Nov 12, 2026
…frame's true URL

retrieveWBOSRCAsURL (added in openzim#386) resolved a server-recorded original
attribute value against ownerDocument's replay-time baseURI. For a page
whose own URL was changed by a fuzzy rule when it was stored in the ZIM
(e.g. YouTube's embed page, served under youtube.fuzzy.replayweb.page/...
while its real URL is www.youtube.com/embed/...), that's not the frame's
true original URL, so a relative recorded value resolved to the wrong
host -- the fuzzy-normalized replay path instead of the real one -- and
a later fetch built from it 404'd, breaking playback.

wb_info.url already holds the frame's true original URL (used the same
way for Location getters, openzim#384); resolve against that instead, via a
{baseURI: wb_info.url} stand-in so resolveRelUrl's own fallback chain
still applies if wb_info.url isn't set.

Fixes openzim#398
@benoit74 benoit74 added this to the 5.6.0 milestone Nov 20, 2026
@benoit74 benoit74 mentioned this pull request Nov 20, 2026
18 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant