Repository navigation
fix: navigate the frame by replace from the first package, and run the demo's tests in every engine - #23
Merged
Conversation
…e demo's tests in every engine WebKit adds a history step when a top-level page sets the src of a frame whose first document has loaded, so in Safari the first Back after opening a package emptied the frame and left the page showing it. Every navigation is a location.replace now; only a frame out of the document still gets src. Found by running the demo's tests in Firefox and WebKit, which the root test:engine, and so CI's engines job, now does. The tests allow for four engine differences: Option-Tab in WebKit, WebKit's private profile keeping no File in IndexedDB, Firefox's Back passing over an untouched step, and Firefox closing a page on cmi5's Exit. Three app tests stay Chromium's. Refs #22 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Closes #22.
The demo's tests (the installable app, the embed page and the cmi5 page) now run in Firefox and WebKit as well as Chromium. The first runs found a bug in the player that affects Safari, and this fixes it.
Changes
Player: the frame's first navigation is a replace (
packages/player/src/h5p-offline-player.ts)navigateFrameset the frame'ssrcfor the first package and usedcontentWindow.location.replaceafter that. WebKit adds a history step for thatsrcwhen the frame's first document has loaded and the page is top-level. So in Safari, the first Back after opening a package emptied the frame and left the page showing an empty player.location.replace. A frame out of the document has no window to navigate, so it still getssrc, which loads on insertion and adds no step.playback.test.tsnow counts history from before the first package. It doesn't catch the WebKit case: the player's suite runs inside the test runner's frame, where WebKit adds no step. The app's tests, which run in a top-level page, do catch it.Demo tests in every engine (
apps/demo/tests/)engine.tspicks the browser fromH5P_TEST_BROWSER, as the player's config does. All three test files launch through it.pnpm test:engineruns the demo's tests after the player's suite. The existingenginesjob in CI therefore covers them in Firefox and WebKit, with no new job.What the tests now allow for (each is a real browser behaviour, not an app bug):
Filein IndexedDB, as a Safari private window does, so the app keeps no copy there. The copy test runs in a profile on disk, where WebKit keeps the copy.window.close(): Firefox closes a top-level page Playwright opened when cmi5's Exit asks it to; Chromium ignores the request. That test stands in forcloseand now asserts that Exit asked to close, in every engine.Docs: AGENTS.md (the commands, the engine notes, the invariant), CONTRIBUTING.md and docs/development.md.
Testing
Locally, on macOS:
browser-emulated) / Firefox / WebKitH5P_TEST_BROWSER=webkit pnpm test:engineFlake: that one failure came right after the player's full suite. The same test passed 3 runs alone and every run of the full demo set afterwards. I didn't catch its error message. If CI shows it, it needs a look rather than a retry.
Not verified
location.replacethat every later navigation already used in Safari.Release
Player patch, 0.9.3, for the Safari fix, when you choose. Nothing else published changes.
🤖 Generated with Claude Code