Repository navigation
Conversation
…s one Embed pages often carry their stream in the query string: embed.php?file=https://cdn/.../index.m3u8. For a response whose URL has no stream extension, onHeadersReceived looks for one in the query parameters. That is right for a stream fetched through a proxy (proxy?url=...m3u8), but it did the same for page loads, so the embed page itself (HTML) was added to the frame's sources as an HLS stream. With the site on the auto-enable list the player opened on the page before the page's own player had requested the real stream, and nothing ever loaded; otherwise the page URL sat in the source list next to the real stream. A main_frame or sub_frame load answered with text/html or application/xhtml+xml now skips the query-string check. A proxy link opened in a tab or iframe, answered with the stream itself, is still detected. The listener now asks for responseHeaders to read the Content-Type. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Owner
|
I believe that unfortunately Chrome does not allow getting response as per new Manifest V3 changes |
Contributor
Author
|
That could be the case. I only target Firefox, so I haven’t looked into Chrome too much. |
Nawid3333
referenced
this pull request
in Nawid3333/FastStream
Oct 9, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What breaks
Embed pages often carry their stream in the query string:
onHeadersReceivedhandled that by looking for a stream extension in thequery parameters of any response whose URL has no stream extension. That is
right for a stream fetched through a proxy (
proxy?url=...m3u8), but thecheck ran for page loads too, so the embed page itself (an HTML document)
was added to the frame's sources as an HLS stream. Two visible outcomes:
before the page's own player had requested the real stream, and nothing
ever loaded;
The fix
A
main_frameorsub_frameload answered withtext/htmlorapplication/xhtml+xmlnow skips the query-string check - an HTML page isnot a stream, whatever its query string names. Everything else keeps the
existing behavior:
itself, is not HTML, and is still detected;
before;
media-type responses are unaffected.Reading the Content-Type required one opt-in: the listener now asks for
responseHeaders(webRequestPerms2, previously an empty array). TheContent-Type header is not otherwise exposed, and asking for it adds no
permission (webRequest is already granted).
Diff: 1 file, 24 insertions, 2 deletions - a 10-line
isHtmlResponse()helper, a gated early
return, and the opt-in.Why this can't break anything else
background.mjsis the extension's service worker; thechange is confined to the
onHeadersReceiveddetection callback - threestatements inside its
if (!mode)block plus the helper. Nothing outsidethe file changed.
of:
main_frame/sub_frametype, no extension-based mode, and an HTMLContent-Type. Every combination outside that keeps the previous path:
mediaresponses → unchanged (ACCELERATED_MP4branch is first);with the stream) → falls through to the query-string check as before;
isSubtitles, untouched;CustomSourcePatternsMatcherpaths → earlier in thelistener, untouched.
dropped from FastStream's tracking - it is simply not registered as a
source. The page's player requests the stream itself, and that response
is detected exactly as it always was.
statusCode >= 400 || 204),so the new branch never sees them.
Verification
npm ci+node localescript.mjs+node build.mjs(thisrepo's own build path) - all three targets build.
embed.php?file=...m3u8answered withtext/html→ no source added for the page; the stream request frominside the page → still detected. A
proxy?url=...m3u8opened directly →still detected, HTML check does not apply (not an HTML response).
webRequestPerms2is passed as theextraInfoSpecat theonHeadersReceived.addListenercall, sodetails.responseHeadersis populated on both engines;isHtmlResponsetolerates a missing header array via optional chaining.
eslintwith this repo's.eslintrc.js(google config): noproblems.
git diff --numstatagainstmain:24 2 chrome/background/background.mjs.