Skip to content

Fix mark-watched button crash on channel videos tab#251

Merged
OsaSoft merged 2 commits intomasterfrom
fix/channel-videos-tab-247
Mar 23, 2026
Merged

Fix mark-watched button crash on channel videos tab#251
OsaSoft merged 2 commits intomasterfrom
fix/channel-videos-tab-247

Conversation

@OsaSoft
Copy link
Copy Markdown
Owner

@OsaSoft OsaSoft commented Mar 23, 2026

Summary

  • Fixes Chanel's 'videos' tab not working #247 — mark-watched buttons not appearing on channel "Videos" tab, with Node.insertBefore: Child to insert before is not a child of this node error
  • On channel pages, #video-title's parent is deeply nested (#dismissible > #details > #meta > h3 > a), not a direct child of the button container — insertBefore requires a direct child as reference node
  • Adds a defensive guard: checks if the reference node is a direct child first, falls back to inserting into #meta area for channel page layouts

Test plan

  • Load extension in Firefox
  • Navigate to any channel's "Videos" tab — mark-watched buttons should appear, no console errors
  • Navigate to subscriptions page — verify no regression, buttons still work
  • Navigate to home page (with Hide watched on home enabled) — verify no regression
  • Check browser console for absence of insertBefore errors

🤖 Generated with Claude Code

OsaSoft and others added 2 commits March 23, 2026 21:46
On channel pages, #video-title's parent element is deeply nested inside
#dismissible > #details > #meta > h3 > a, not a direct child of the
button container. This caused insertBefore to throw "Child to insert
before is not a child of this node". Now checks if the reference node
is a direct child first, and falls back to inserting into #meta area.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds a channel-videos.html fixture mirroring the real YouTube channel
page DOM structure and 23 integration tests covering: video detection,
URL/ID extraction, SubscriptionVideo construction, addButton() placement
(verifying it doesn't crash and inserts into #meta, not above thumbnail),
YouTube watched detection, and hide logic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a DOM insertion crash that prevented “mark watched” buttons from appearing on YouTube channel Videos tabs (issue #247) by making the old-layout insertion logic resilient to deeply nested #video-title structures.

Changes:

  • Add a defensive guard in SubscriptionVideo.addButton() to avoid calling insertBefore() with a non-child reference node; fall back to inserting into the #meta region on channel layouts.
  • Add an integration test suite covering channel “Videos” tab DOM structure, video extraction, and button placement behavior.
  • Add a new HTML fixture that mirrors the channel “Videos” tab markup hierarchy.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
videos/SubscriptionsVideo.js Prevents insertBefore crash by verifying the reference node is a direct child; adds channel-layout fallback insertion into #meta.
tests/integration/channel-page.test.js New integration tests validating channel-page video detection/extraction and ensuring addButton() doesn’t throw and places the button in #meta.
tests/fixtures/channel-videos.html New fixture representing the nested channel “Videos” tab DOM needed to reproduce/regress-test #247.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@OsaSoft OsaSoft merged commit 3171f91 into master Mar 23, 2026
5 checks passed
@OsaSoft OsaSoft deleted the fix/channel-videos-tab-247 branch March 23, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chanel's 'videos' tab not working

2 participants