Skip to content

content.js: types/messages.d.ts describes replies that do not exist, dead plumbing that still costs round trips, and handleCaptionsScrape answers early on a synchronous request failure #233

Closed

Description

@Nawid3333

Severity: low

  1. types/messages.d.ts: interface FSVideoSize { width; height } while content.js answers GET_VIDEO_SIZE with sendResponse(video ? video.size : 0) (a number, the visible area) and the background sorts by b.videoSize - a.videoSize. FSOpenPlayer omits attempt (content.js uses it) and its noRedirect comment ("True only for the top frame, which navigates rather than redirects") is backwards: the top frame never navigates, it overlays. The file's own header says an inaccurate type is worse than none. Fix: type FSVideoSizeReply = number, add attempt, reword.

  2. Dead plumbing (content.js, main.mjs): Config.customVideoQuery/hasCustomPlaylist/hasCustomLinkHandler/customIframeId and the 'config' message: nothing under chrome/ sends SEND_TO_CONTENT or a config message. sendToOtherContents({type: 'active-state', ...}) goes background -> same frame with destination: 'custom', which no script handles: two wasted messages per player open and close. request.force and request.softReplace in the OPEN_PLAYER handler are never sent by openPlayer, so the "overlay without a video" branch and the per-request soft/hard choice are unreachable. httpRequest's POST and bust branches have no caller. main.mjs's 'key_down'/'seek_to' MESSAGE_FROM_PAGE handlers: nothing sends them. Fix: delete, or wire up the custom-script config path if the site scripts are meant to use it.

  3. handleCaptionsScrape answers early when a request fails synchronously: if (done === pending) sendResponse(tracks) inside the callback, with pending++ per track in the same loop, and httpRequest's catch (e) { callback(e); } runs synchronously. Two <track> elements where xhr.open throws for the first (a malformed src): done becomes 1 while pending is still 1, sendResponse([]) goes out before the second track is even requested, and the player opens with no captions although one was loadable. Fix: count pending for all tracks before issuing any request, or defer the sync failure with queueMicrotask.

  4. Overlay guard and windowed fullscreen ignore shadow trees (overlay-guard.js and fillScreenIframe use document.querySelectorAll('*') while the rest of content.js walks shadow roots): a web-component player keeps its control bar inside the host's shadow root; elementsFromPoint retargets the iframe to the host, host.contains(iframe) is false across the boundary, nothing is examined, so the site's bar stays over the player; in windowed fullscreen the host is expanded but its shadow siblings are never hidden. Fix: walk openOrClosedShadowRoot (already used in content.js) in both scans and use getRootNode().host for containment.

Confidence: high (1, 2, 3), medium (4).


From a line-by-line code review of the tree at 41363fd (2026-10-02). Each claim above was checked against the source before filing; the reproduction steps and line references are as of that commit.


Generated by Claude Code

Activity

  1. added
    bugSomething isn't working
    code-reviewFound by the 2026-10-02 line-by-line review
    on Oct 2, 2026
  2. added a commit that references this issue on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcode-reviewFound by the 2026-10-02 line-by-line review

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions