Repository navigation
fix: the play page offers a new tab or another browser where the player cannot start (#116) - #117
Conversation
…the play page offers a new tab or another browser, and a save with no word says the way by hand after 10 s (#116)
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
…eed; a frame with no origin and a tab off https get words of their own; no name placeholders beside the way on (#116)
There was a problem hiding this comment.
2 issues found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/h5p/play/play-page.ts">
<violation number="1" location="src/h5p/play/play-page.ts:257">
P2: Apply the https rewrite only for `insecure`. Right now it runs for every reason, so a `kept` tab on http://localhost gets an https address that a plain-http dev server does not serve. A framed `insecure` page skips the rewrite, so the address it offers stays http and will not play, although the text says it plays in a tab of its own.</violation>
<violation number="2" location="src/h5p/play/play-page.ts:268">
P3: The phrase "as where it blocks third-party cookies" is unclear. Use "as it does where it blocks third-party cookies".</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| // The address's own origin, which is the page's URL's even in a frame with no origin of its own | ||
| // (`self.origin` is "null" there, `location.origin` is not: Chromium, Firefox and WebKit, | ||
| // 2026-11-25). A tab of its own off https is sent to https, where the player starts. | ||
| const origin = framed ? location.origin : location.origin.replace(/^http:/, 'https:') |
There was a problem hiding this comment.
P2: Apply the https rewrite only for insecure. Right now it runs for every reason, so a kept tab on http://localhost gets an https address that a plain-http dev server does not serve. A framed insecure page skips the rewrite, so the address it offers stays http and will not play, although the text says it plays in a tab of its own.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/h5p/play/play-page.ts, line 257:
<comment>Apply the https rewrite only for `insecure`. Right now it runs for every reason, so a `kept` tab on http://localhost gets an https address that a plain-http dev server does not serve. A framed `insecure` page skips the rewrite, so the address it offers stays http and will not play, although the text says it plays in a tab of its own.</comment>
<file context>
@@ -248,17 +251,27 @@ function cannotStart(): Why | null {
+ // The address's own origin, which is the page's URL's even in a frame with no origin of its own
+ // (`self.origin` is "null" there, `location.origin` is not: Chromium, Firefox and WebKit,
+ // 2026-11-25). A tab of its own off https is sent to https, where the player starts.
+ const origin = framed ? location.origin : location.origin.replace(/^http:/, 'https:')
+ const address = `${origin}${location.pathname}${Object.keys(given).length ? fragmentWithLinks(ownFragment, given, false) : ownFragment}`
elsewhereAddress.value = address
</file context>
| const origin = framed ? location.origin : location.origin.replace(/^http:/, 'https:') | |
| const origin = why === 'insecure' ? location.origin.replace(/^http:/, 'https:') : location.origin |
| elsewhereText.textContent = { | ||
| insecure: 'This chat’s page is not on a secure connection, and the player starts only on one. In a tab of its own it plays, still built in your browser.', | ||
| sandboxed: 'This chat does not let the player start inside its reply. In a tab of its own it plays, still built in your browser.', | ||
| kept: 'Your browser does not let the player start inside this chat’s reply, as where it blocks third-party cookies. In a tab of its own it plays, still built in your browser.' |
There was a problem hiding this comment.
P3: The phrase "as where it blocks third-party cookies" is unclear. Use "as it does where it blocks third-party cookies".
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/h5p/play/play-page.ts, line 268:
<comment>The phrase "as where it blocks third-party cookies" is unclear. Use "as it does where it blocks third-party cookies".</comment>
<file context>
@@ -248,17 +251,27 @@ function cannotStart(): Why | null {
+ elsewhereText.textContent = {
+ insecure: 'This chat’s page is not on a secure connection, and the player starts only on one. In a tab of its own it plays, still built in your browser.',
+ sandboxed: 'This chat does not let the player start inside its reply. In a tab of its own it plays, still built in your browser.',
+ kept: 'Your browser does not let the player start inside this chat’s reply, as where it blocks third-party cookies. In a tab of its own it plays, still built in your browser.'
+ }[why]
elsewhereNote.textContent = 'If no tab opens, copy this address into your browser.'
</file context>
| kept: 'Your browser does not let the player start inside this chat’s reply, as where it blocks third-party cookies. In a tab of its own it plays, still built in your browser.' | |
| kept: 'Your browser does not let the player start inside this chat’s reply, as it does where it blocks third-party cookies. In a tab of its own it plays, still built in your browser.' |
Closes #116.
Where the player cannot start for the frame's sake or the browser's, the play page now says so and gives the way on, in place of a technical error. A content error of the activity's own is shown as before.
How the page knows, from the browser alone
&save=1), which needs no player.no-workererror (a worker that could not register, as where third-party cookies are blocked), and, framed only,bad-archiveorquota. The page built that archive a moment before, so a read or store that fails is the frame's, not the package's.What is seen (a new seventh state,
elsewhere, in the stage's place, in the design of the other states)target="_blank"); elsewhere the link opens a tab where the frame lets it. The address carries the addresses the parent gave for the person's files (&links=), so the tab plays them from there, and never&save=1(fragmentWithLinkstakessave = falsefor it).location.origin, which is the URL's origin even in a frame with no origin of its own (self.originis"null"there): checked in Chromium, Firefox and WebKit.A save with no word. A parent that took the package to save and says nothing for 10 s: "Nothing saved yet? Right-click Download, or press and hold it, and open the link in a new tab." under the stage, Download pressable again. Before, "The chat is saving the .h5p…" for a minute. A yes that comes later is still said, as before.
Checked against this branch's build, the page served from 127.0.0.1 and a stand-in chat from localhost (another site, so the frame is third-party, as in a chat), the stand-in saying it opens links:
cookieBehavior1)chat.test)&save=1), no Service Worker.h5psite.test)pnpm typecheckandpnpm buildpass. cubic's review: four points fixed in 0764266 (the save-only tab, the two wordings, the name placeholders); the fifth,location.originin a frame with no origin, answered with the three engines' values. Not tried: Safari itself, iOS in-app browsers, the real chats' frames.Paired with missing-elements/h5p-toolkit#276, the card's and the server's fallbacks; neither needs the other.
Summary by cubic
Fixes the play page so that when the player cannot start inside a chat's frame or the browser, it explains why and offers a new tab or another browser with a copyable address, instead of a technical error. A save the chat never confirms now says how to save by hand after 10 seconds instead of waiting a minute.
no-workererror, and a framedbad-archiveorquotaerror.&save=1, so it plays from there; on plain http the address is rewritten to https.Written for commit 0764266. Summary will update on new commits.