Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Keep escaped Unicode characters in CSS strings instead of turning them into literal characters when rewriting (#377)
- Patch vendored `wombat.js` so element properties (`img.src`, `script.src`, `link.href`, `a.href` and its derived `.pathname`/`.search`/..., `Attr.value`) return and forget a server-side-rewriter-recorded original the same way `getAttribute` already does (#386, webrecorder/wombat#240)
- Detect `export const`/`let`/`var`/`function`/`async function`/`*` as module code (`EXPORT_RX` only recognized `export {...}`, `export default` and `export class`), fixing JS rewriting wrongly injecting a non-module `let arguments;` wrapper into ES modules using these common export forms, which is a syntax error in strict/module code (#387)
- Patch vendored `wombat.js` so `retrieveWBOSRCAsURL` (the helper behind the above element-property fix) resolves a recorded original against the frame's true original URL (`wb_info.url`) instead of its replay-time `ownerDocument`, fixing it returning/using a URL under the wrong host for a page whose own URL was changed by a fuzzy rule (e.g. YouTube embeds), which broke playback (#398)

## [5.5.2] - 2026-11-06

Expand Down
13 changes: 11 additions & 2 deletions rules/patch_wombat.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,15 @@
# Location getters above, cannot reverse our own urlRewriteFunction's
# path+query flattening. `retrieveWBOSRCAsURL` is a new helper, resolving a
# recorded original the way the browser resolves these properties (as an
# absolute URL), reusing wombat's own `resolveRelUrl`.
# absolute URL).
#
# The recorded original is a literal snapshot of the attribute as it stood
# in the source HTML, so it must be resolved against that source document's
# *true* URL (`wb_info.url`) -- not `ownerDocument`'s replay-time one, which
# can diverge from it, e.g. a page served under a fuzzy-rule-normalized
# path (openzim/python-scraperlib#398). Passing a `{baseURI: wb_info.url}`
# stand-in into wombat's own `resolveRelUrl` reuses its existing fallback chain
# (current/top document baseURI) for the rare case `wb_info.url` isn't set.
#
# Each property's setter is also patched to forget the recorded original
# (via `removeWBOSRC`) when the property is assigned, same as `setAttribute`
Expand All @@ -241,7 +249,8 @@
"wb_getAttribute.call(t,i):t.getAttribute(i);return null==o?void 0:o}},"
"b.prototype.retrieveWBOSRCAsURL=function(t,e){if(!t||1!==t.nodeType||"
"!t.hasAttribute(e))return;var r=this.retrieveWBOSRC(t,e);if(!r)"
"return;try{return this.resolveRelUrl(r,t.ownerDocument)}catch(i){"
"return;try{return this.resolveRelUrl(r,{baseURI:this.wb_info&&"
"this.wb_info.url})}catch(i){"
"return}}"
)

Expand Down