Repository navigation
Fix: resolve Video Filters CSP TrustedHTML violation and toggle deactivation - #4376
Conversation
|
Thank you for the fixes! I tested this PR in Firefox and Google Chrome and confirmed that:
However, I noticed a button appearance issue in the following case:
After the button reappears, it is highlighted blue even though the preset is still Normal and no filter effect is applied to the video. I would expect the button to remain dim without the blue highlight, as it was before hiding it, since the filter settings and the video appearance have not changed. Could you please take a look at why the button's appearance changes after hiding and showing it? Separately, there are a couple of possible usability improvements for future consideration:
These are suggestions for future consideration, and I do not consider them blockers for merging this PR. |
- Align isActive calculation with preset logic so 'normal' preset keeps button dim even if custom slider values are present in storage - Ensure .it-video-filters-active is removed when button is initialized in inactive state
|
Hi @hkzo, Thank you for the thorough testing and detailed report! I have investigated and fixed the button appearance issue in commit 54b8376. Cause:When re-creating the button in Fix:Updated Also, thank you for the usability suggestions regarding automatic switching to Custom and menu/toggle alignment—those are great points for future follow-up iterations. |
|
Awesome! |
Resolves #4374
Summary
This PR completely resolves the CSP / TrustedHTML violations and toggle deactivation issues affecting the Video Filters feature.
Details & Fixes
appearance.js):svgEl.innerHTMLstring assignments with safe DOM methods (document.createElementNS,setAttribute,textContent = ''), eliminating Content Security Policy andTrustedHTMLsink violations on YouTube in modern Chromium and Firefox.appearance.js):if (!isEnabled) return;) that was returning before reachingstyleEl.remove()andsvgEl.remove()whenvideo_filters_activatewas turned OFF.<style>and<svg>elements from the DOM and immediately restores the video back to normal.player.js):ImprovedTube.storage.video_filters_activate !== true) to properly handle when the storage key is unset/removed (undefined), enabling reliable back-and-forth toggling between ON and OFF.'vivid'so changes are immediately apparent..it-video-filters-activeCSS class on toggle.Testing
git diff --check.