blitz-script: web compat needed by Flexbox Froggy (localStorage, createHTMLDocument, select options) - #757
Conversation
…Document, select options)
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
GUI test: Flexbox Froggy plays end-to-end in the Blitz browserTested this branch in the full browser GUI (release build, It should render the Flexbox Froggy game UI — ✅
Note: unrelated blank-window issue with plain cargo buildsWith |
Summary
Makes https://flexboxfroggy.com/ work on top of #738. The site failed for three reasons, fixed in order of discovery:
document.implementation.createHTMLDocument("").body, which threw (implementationwas undefined), so$was never defined and every site script failed. Added a bootstrap-JSdocument.implementationshim whosecreateHTMLDocument(title)builds a detachedhtml/head/bodytree in the current document's arena and returns a document-like object delegating node creation to the main document (covers jQuery'sparseHTML-style template parsing; not a real separateDocument).localStorage is not defined:game.jsreadslocalStorage.colorblindat top level. Added in-memorylocalStorage/sessionStorageshims (Proxy-based, so named access likelocalStorage.levelfollows Storage's WebIDL named getter/setter semantics).game.start()threw:window.navigator.language.split("-")— addednavigator.language/navigator.platform..val(...)on<select>useselem.options,elem.selectedIndex, and option.selected. Added native accessors inelement.rs:Also extends
examples/screenshot_script.rs(offscreen JS+render harness) to load http(s) URLs with prefetched external scripts and to pump JS timers before rendering — jQuery fires its deferred-ready callback viasetTimeout, sogame.start()only runs once timers are pumped.After the fixes, the live site renders the full game (level selector "1 of 24", instructions, CSS editor, frog + lilypad on the pond):
Remaining JS errors on the page are from Google ads/analytics only (
adsbygoogle.jsinternalconsole.error, andXMLHttpRequest is not definedfrom analytics.js) and don't affect the game.Added
tests/dom.rscoverage forlocalStorage,createHTMLDocument, and the<select>accessors (24 tests pass).Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/446d0cb01a7b4cb3bced0e16920f5e28
Requested by: @nicoburns
WPT results
2825 newly passing, 208 newly failing (net +2617), 4406 other status changes.
Full diff (7439 changed tests)
Generated by the WPT workflow.