You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #387/#389/#391/#393 (openzim/warc2zim#327). After fixing the earlier 4 issues, 3 of MDN's 4 "Try it" live-sample widgets render correctly, but the top, editable "Try it" widget (<interactive-example>) still always fails to load.
Root cause
<mdn-play-runner> (the component that actually renders the sandboxed iframe) picks its id source based on a single boolean property:
letp=i ? l : this._uuid;// i = this.permalink, l = content-hash, this._uuid = crypto.randomUUID()
<mdn-live-sample-result> (the 3 working demos further down the page) always passes a literal permalink attribute to its inner <mdn-play-runner>, so it uses the deterministic, content-derived hash. <interactive-example> (the top widget) never does, across all three of its template variants (choices/console/tabbed) — presumably deliberate on MDN's side, since the widget is live-editable and recomputing a hash on every keystroke would be wasteful. But the initial, pre-edit code is just as content-stable as the other 3 demos; only the id source differs.
Confirmed directly: forcing .permalink = true on the top widget's mdn-play-runner via live DOM manipulation produces the exact same deterministic hash across repeated, completely independent page loads — same mechanism, same reproducibility as the other 3 widgets. But that only affects the live page during a crawl; a real viewer's browser runs the unmodified JS, where permalink still defaults to false, so it always calls crypto.randomUUID() fresh and never matches anything in a WARC.
Suggested fix
Patch interactive-example's JS chunk to always pass permalink to its <mdn-play-runner> templates, the same attribute <mdn-live-sample-result>'s template already always sets. This needs to be a host-scoped patch (developer.mozilla.org only) applied to the JS content during rewriting, not a general-purpose rewriting rule.
I'll attempt a local patch (in zimscraperlib.rewriting.js, alongside a small, explicitly host-gated table for this kind of narrow site-specific content fix) and open a PR against this issue.
Activity
Add host-gated site-specific JS content patches, fix MDN permalink