Skip to content

fix(player): stop plyr sprite xhr from crashing the page#2906

Merged
seferturan merged 2 commits into
mainfrom
fix/plyr-sprite-xhr-crash
Jul 14, 2026
Merged

fix(player): stop plyr sprite xhr from crashing the page#2906
seferturan merged 2 commits into
mainfrom
fix/plyr-sprite-xhr-crash

Conversation

@seferturan

@seferturan seferturan commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

🎶 Notes 🎶

  • Fixes Frequent crashes in the Microsoft Edge (KEEPS HAPPENING) #2387
  • Fixes problem report #2803
  • Fixes Supergirl page problem #2819
  • Fixes 04e906d1-b713-403f-9bd4-842f741304ea #2879
  • All four are the same bug: users randomly hit the full-page error screen with Error: 0 from cdn.plyr.io/3.8.3/plyr.js.
  • Plyr's sprite loader throws new Error(xhr.status) from the XHR error listener, outside its own try/catch. Any network blip (offline, ad-block, flaky connection) escapes uncaught as Error: 0.
    • Our .catch() never sees it, it lands in the global onerror in ErrorProvider instead.
    • The external-noise filter should drop it, but Sentry wraps XMLHttpRequest and injects an app.trakt.tv frame, so the hostname check passes and it escalates to the error screen.
  • Fix: loadSprite: false so icons reference the same-origin sprite via <use> instead of being XHR-fetched. Throwing path never runs.
  • Also filter cdn.plyr.io frames in ErrorProvider as a safety net.
  • Not reproducible on a healthy connection, which is why it slipped.
    • ⚠️ Icons load via external <use> now instead of inlined sprite. Fine locally, worth a glance on prod.

Plyr's sprite loader throws new Error(xhr.status) from the XHR error
listener, outside its own try/catch. Any network-layer failure fetching
the icon sprite (offline, ad-block, flaky connection) escapes uncaught as
Error: 0 and escalates to the full-page error screen. Disable loadSprite
so icons reference the same-origin sprite via <use> instead.

Fixes #2387
Fixes #2803
Fixes #2819
Fixes #2879
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a recurring issue where network-layer failures during Plyr's sprite loading process caused unhandled exceptions, leading to full-page error screens for users. By disabling the automatic sprite loading and refining the global error handling logic to ignore third-party player script errors, the application is now more resilient to transient network conditions.

Highlights

  • Preventing Uncaught XHR Errors: Disabled the loadSprite option in the Plyr configuration to prevent the library from attempting to XHR-fetch and inline icon sprites, which was causing uncaught 'Error: 0' exceptions during network failures.
  • Enhanced Error Filtering: Updated the ErrorProvider to treat frames originating from cdn.plyr.io as external noise, ensuring that minor player-related network blips do not trigger the application's full-page error screen.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@trakt-bot trakt-bot Bot enabled auto-merge (rebase) July 14, 2026 18:02

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request addresses uncaught network-layer errors thrown by Plyr by setting loadSprite: false in YoutubePlayerProvider.svelte and ignoring errors originating from cdn.plyr.io in ErrorProvider.svelte. The reviewer suggested making the error filtering more robust and environment-independent by also checking for plyr.js in the stack trace, which covers cases where Plyr is self-hosted or loaded from other CDNs.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread projects/client/src/lib/features/errors/ErrorProvider.svelte Outdated
@deepsource-io

deepsource-io Bot commented Jul 14, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 26c3d51...35e057c on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Coverage  

Code Review Summary

Analyzer Status Updated (UTC) Details
JavaScript Jul 14, 2026 6:05p.m. Review ↗
Code coverage Jul 14, 2026 6:05p.m. Review ↗

Code Coverage Summary

Language Line Coverage (Overall)
Aggregate
65.5%
Javascript
65.5%

➟ Additional coverage metrics may have been reported. See full coverage report ↗


Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

Sentry wraps XMLHttpRequest and injects an app-origin stack frame, so the
hostname-based external-noise filter fails to drop errors thrown from
cdn.plyr.io. Treat plyr-originated errors as external noise so a network
hiccup in the player never triggers the full-page error screen.
@seferturan seferturan force-pushed the fix/plyr-sprite-xhr-crash branch from 78a1483 to 35e057c Compare July 14, 2026 18:05
@seferturan

Copy link
Copy Markdown
Contributor Author

@gemini-code-assist addressed: widened the filter to also match plyr.js, not only cdn.plyr.io, so self-hosted/bundled Plyr is covered. Absorbed into 35e057c.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Thanks for the update, @seferturan. That sounds like a solid improvement to ensure broader coverage for self-hosted or bundled instances of Plyr. The changes look good and address the issue effectively.

@seferturan seferturan requested a review from vladjerca July 14, 2026 18:11
@seferturan seferturan disabled auto-merge July 14, 2026 18:11
@seferturan seferturan merged commit 1f024b6 into main Jul 14, 2026
23 checks passed
@seferturan seferturan deleted the fix/plyr-sprite-xhr-crash branch July 14, 2026 18:12
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.

04e906d1-b713-403f-9bd4-842f741304ea Supergirl page problem problem report Frequent crashes in the Microsoft Edge (KEEPS HAPPENING)

1 participant