Skip to content

Fixing Youtube infinite reload on Brave with uBO extension - #34162

Closed
griffinallen wants to merge 1 commit into
uBlockOrigin:masterfrom
griffinallen:youtube_brave_reload_issue_fix
Closed

Fixing Youtube infinite reload on Brave with uBO extension#34162
griffinallen wants to merge 1 commit into
uBlockOrigin:masterfrom
griffinallen:youtube_brave_reload_issue_fix

Conversation

@griffinallen

Copy link
Copy Markdown
Contributor

URL(s) where the issue occurs

youtube.com

Describe the issue

This filter rule has an issue that surfaces when this rule is run in multiple environments simultaneously. For example, Brave Shields and uBO extension running on the same Brave browser instance. The script has a mutation observer and when this observer fires, the video refreshes. This triggers the mutation observer in the other script, which causes a video refresh and triggers the mutation observer in the first script. This starts a video refresh loop.

To avoid this loop, this change creates a shared variable between the two environments which indicates that the other script has triggered a video refresh. Once the other script starts running, if it sees that a video refresh is in progress, it aborts and breaks the loop.

Screenshot(s)

image

Versions

  • Browser/version: Brave 1.95.70
  • uBlock Origin version: uBlock Origin Lite 2026.818.1422

Notes

Typically, users have been told to "choose one" adblock tool because having more than one active tool can create issues like this. However, a considerable amount of Brave users have the uBO extension enabled. As a test, we added an exception rule for this filter on Brave and saw a 30% reduction in issues being reported for Youtube on Brave. When we removed our exception rule, we saw a 30% increase in issues being reported for Youtube on Brave.

If necessary, I can provide video or further testing. Please give suggestions if you have a better approach to this.

This filter rule has an issue that surfaces when this rule is run in multiple environments simultaneously. For example, Brave Shields and uBO extension. The script has a mutation observer and when this observer fires, the video refreshes. This triggers the mutation observer in the other script, which causes a video refresh and triggers the mutation observer in the first script. This starts a video refresh loop.

To avoid this loop, this change creates a shared variable between the two environments which indicates that the other script has triggered a video refresh. Once the other script starts running, if it sees that a video refresh is in progress, it aborts and breaks the loop.
@stephenhawk8054

stephenhawk8054 commented Aug 19, 2026

Copy link
Copy Markdown
Member

We don't want to create a global variable so that YouTube can easily know that there's uBO installed just because there's another blocker interfering.

Users should not use multiple blockers at the same time.

@griffinallen

Copy link
Copy Markdown
Contributor Author

That's understandable. Would you have any other suggestions for a fix to this?

This is affecting a large number of Brave users and we are hoping to find a solution that works while Brave users are using the uBO extension, instead of forcing users to pick one tool.

@stephenhawk8054

stephenhawk8054 commented Aug 19, 2026

Copy link
Copy Markdown
Member

We always tell users to just use 1 blocker for years, regardless of which one users choose:

Making exceptions to one tool will just lead to endless requests of making exceptions to all other tools, and make us waste more time for issues that don't present with uBO alone.

ryanbr added a commit to ryanbr/uBlock that referenced this pull request Aug 20, 2026
Brave can't be told apart from Chrome through the user agent string, so
detection uses `navigator.brave` with `navigator.userAgentData.brands`
as fallback. Both are synchronous, unlike `navigator.brave.isBrave()` --
the flavor must be settled before filter lists are compiled and cached.

Brave still offers uBO in MV2, and a considerable number of Brave users
run Brave Shields and uBO at the same time. Filters which are safe on
their own can conflict when both blockers apply them, and list
maintainers currently have no way to express that:
uBlockOrigin/uAssets#34162
@ryanbr

ryanbr commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

@gorhill can you consider env_brave since we're still shipping MV2 uBO and Shields users? ryanbr/uBlock#2

gorhill pushed a commit to gorhill/uBlock that referenced this pull request Aug 20, 2026
Brave can't be told apart from Chrome through the user agent string, so
detection uses `navigator.brave` with `navigator.userAgentData.brands`
as fallback. Both are synchronous, unlike `navigator.brave.isBrave()` --
the flavor must be settled before filter lists are compiled and cached.

Brave still offers uBO in MV2, and a considerable number of Brave users
run Brave Shields and uBO at the same time. Filters which are safe on
their own can conflict when both blockers apply them, and list
maintainers currently have no way to express that:
uBlockOrigin/uAssets#34162
@gorhill

gorhill commented Aug 20, 2026

Copy link
Copy Markdown
Member

gorhill/uBlock@0c56103

github-actions Bot pushed a commit to brave/uBlock that referenced this pull request Aug 20, 2026
Brave can't be told apart from Chrome through the user agent string, so
detection uses `navigator.brave` with `navigator.userAgentData.brands`
as fallback. Both are synchronous, unlike `navigator.brave.isBrave()` --
the flavor must be settled before filter lists are compiled and cached.

Brave still offers uBO in MV2, and a considerable number of Brave users
run Brave Shields and uBO at the same time. Filters which are safe on
their own can conflict when both blockers apply them, and list
maintainers currently have no way to express that:
uBlockOrigin/uAssets#34162
@ShivanKaul

ShivanKaul commented Aug 20, 2026

Copy link
Copy Markdown

We don't want to create a global variable so that YouTube can easily know that there's uBO installed just because there's another blocker interfering.

Yep agreed.

Making exceptions to one tool will just lead to endless requests of making exceptions to all other tools, and make us waste more time for issues that don't present with uBO alone.

This is a pretty disappointing stance. We are trying our best to support uBO in Brave, including going out of our way to offer it in brave://settings/extensions/v2 which means a lot of work both in the browser (with MV2-related patching) and on our backend (especially once Google removes uBO MV2 from Chrome Web Store in 10 days).

This is a pretty bad bug: a uBO user on Brave basically can't watch YouTube videos. We want to support uBO on Brave, but we can't if uBO's stance is "don't use uBO with other ad & tracker blocking tools".

@stephenhawk8054

stephenhawk8054 commented Aug 21, 2026

Copy link
Copy Markdown
Member

a uBO user on Brave basically can't watch YouTube videos

If they use Brave Shields' content blocking function with uBO.


Yes, multiple blockers interfering with each other happens all the time. That's the correct stance. We are volunteers here, not a company like Brave. We won't spend more of our little free time resources left to resolve every single conflict which don't appear with uBO alone. And vice versa, we don't go around and ask other tools to make them always compatible with uBO.


We are trying our best to support uBO in Brave, including going out of our way to offer it in brave://settings/extensions/v2 which means a lot of work both in the browser (with MV2-related patching) and on our backend (especially once Google removes uBO MV2 from Chrome Web Store in 10 days).

And what is your point here? Brave is also using uBO's filters for many complicated issues (which also take a lot of work and time of the volunteers to resolve too). This sounds like we are asking for favors and Brave receives nothing at the end? What kind of logic is this?


Brave ignores the discussion of env_brave for years: brave/adblock-rust#234 and now we are the ones who receive the complaints here?

@ShivanKaul

Copy link
Copy Markdown

And what is your point here? Brave is also using uBO's filters for many complicated issues (which also take a lot of work and time of the volunteers to resolve too). This sounds like we are asking for favors and Brave receives nothing at the end? What kind of logic is this?

I never said anyone is asking for favors, where are you getting that from? Not sure why you had the worst-possible interpretation of my comment. Brave contributes heavily to the open-source adblocking ecosystem as well. We just want uBO to work for Brave users, full stop, and are happy to put in the time and energy to make that happen.

@stephenhawk8054

stephenhawk8054 commented Aug 21, 2026

Copy link
Copy Markdown
Member

You are the one who started about "mean a lot of work", not me, and I just stated the truth back. And you are the one who calls our stance "a disappointing stance", not me started talking anything about Brave. In which that stance is correct, and one of the stances we consistently tell users for years, to reserve our time and not burn out resolving conflicts with countless different blocking tools, which happen all the time for years. Again, we are volunteers here.

You are free to do what you want on your sides. If the changes on our sides don't affect how websites see uBO and easy for us to understand, maintain and adjust, we can consider. I also said about both points from beginning: #34162 (comment) . If the proposed solutions don't fit us, we won't spend more time to resolve those conflicts. Again, we are volunteers here.

@ShivanKaul

Copy link
Copy Markdown

If the changes on our sides don't affect how websites see uBO and easy for us to understand, maintain and adjust, we can consider.

Sounds good, thanks.

@Yuki2718

Yuki2718 commented Aug 22, 2026

Copy link
Copy Markdown
Member

This is a pretty bad bug: a uBO user on Brave basically can't watch YouTube videos.

No, uBO works fine on Brave. Did you miss that the issue occurs only if both uBO and Shields are enabled at the same time? We have been doing all the best to prevent running more than one blocker concurrently and really don't want to make any exception for this stance, and I personally hope Brave to be in line with us. I remember Brave's official X account validated running uBO on top of the Shield, which is quite against this: https://x.com/brave/status/1845950855322747046

stephenhawk8054 added a commit that referenced this pull request Aug 22, 2026
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.

7 participants