youtube icon indicating copy to clipboard operation
youtube copied to clipboard

🐞PR #4112 Video Filters fail to set innerHTML on YouTube

Open hkzo opened this issue 1 month ago • 2 comments

Bug Report:

  • Description: The Video Filters feature added in PR #4112 does not work. When enabling Video Filters and selecting a preset (e.g., Vivid), no color or contrast adjustments are applied to the video player. This is caused by a CSP (Content Security Policy) / TrustedHTML violation when directly setting innerHTML in appearance.js.

  • Steps to reproduce this:

    1. Open any YouTube video page.
    2. Navigate to Player -> Video Filters and turn Activate ON.
    3. Change the Preset to Vivid.
    4. Observe that the filter is not applied to the player and check the browser console.
  • Since when?: Since PR #4112 was merged into the master branch.

  • Browser:

    • Firefox 157.0
    • Google Chrome 154.0.8037.98
  • Are any errors shown in the Browser-Console?: Yes, the following errors occur depending on the browser:

    Firefox:

    Uncaught TypeError: Element.innerHTML setter: Sink type mismatch violation blocked by CSP
        videoFilters moz-extension://16d6c7ed-4d2a-46b7-8bc5-a4ab9e9ccdc7/js&css/web-accessible/www.youtube.com/appearance.js:1136
        <anonymous> moz-extension://16d6c7ed-4d2a-46b7-8bc5-a4ab9e9ccdc7/js&css/web-accessible/core.js:255
    

    Google Chrome:

    Uncaught TypeError: Failed to set the 'innerHTML' property on 'Element': This document requires 'TrustedHTML' assignment.
        at ImprovedTube.videoFilters (appearance.js:1127:19)
        at HTMLDocument.<anonymous> (core.js:255:20)
    

https://github.com/code-charity/youtube/blob/c3bd743b7c97d87a952ab20fe02b73c3b7a327a0/js%26css/web-accessible/www.youtube.com/appearance.js#L1127-L1137

OPTIONAL (usually):

  • Expected preferred behavior: Video Filters should safely update player styles or DOM elements without triggering TrustedHTML / CSP violations.

  • ImprovedTube Version: Current master branch (commit id c3bd743b)
    (Note: Tested on an unreleased store build. Maybe some special setup or configuration is required?)

  • Tested as only active extension or in incognito mode?: Yes

  • Your Settings: Default settings with Player > Video Filters > Activate turned ON.

  • YouTube-Document:

  • OS / Device: macOS 15.7

hkzo avatar Oct 06 '26 12:10 hkzo

Hi! I would love to work on this issue. Could you please assign it to me?

abhijeetnardele24-hash avatar Oct 06 '26 12:10 abhijeetnardele24-hash

@abhijeetnardele24-hash Thanks for offering to help! I don't have write permissions to assign issues in this repository, but please feel free to start working on it and submit a PR. Looking forward to your contribution!

hkzo avatar Oct 06 '26 13:10 hkzo