🐞PR #4112 Video Filters fail to set innerHTML on YouTube
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
innerHTMLinappearance.js. -
Steps to reproduce this:
- Open any YouTube video page.
- Navigate to
Player->Video Filtersand turnActivateON. - Change the
PresettoVivid. - Observe that the filter is not applied to the player and check the browser console.
-
Since when?: Since PR #4112 was merged into the
masterbranch. -
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:255Google 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
masterbranch (commit idc3bd743b)
(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 > Activateturned ON. -
YouTube-Document:
-
OS / Device: macOS 15.7
Hi! I would love to work on this issue. Could you please assign it to me?
@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!