Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Fix uBo (network blocking) in sidebar webpages #238

Merged
merged 4 commits into from
Apr 21, 2023
Merged

Conversation

trickypr
Copy link
Member

@surapunoyousei you might find this interesting. The reason why ads aren't blocked in the sidebar is because the messagemanagergroup is set to webext-browsers on the container <browser> element. If you set it to browsers, it treats it as a regular browser (e.g. no webext permissions, content scripts work, etc).

References

Depends on #237
Fixes #157

@trickypr trickypr added the bug Something isn't working label Apr 14, 2023
@trickypr trickypr requested a review from PressJump April 14, 2023 08:48
@trickypr trickypr marked this pull request as ready for review April 14, 2023 08:48
@fushra-robot fushra-robot added the dependent Requires another bug or pull request to be merged label Apr 14, 2023
@trickypr trickypr changed the title Ublock sidebar Fix uBo in sidebar webpages Apr 14, 2023
@surapunoyousei
Copy link
Contributor

@surapunoyousei you might find this interesting. The reason why ads aren't blocked in the sidebar is because the messagemanagergroup is set to webext-browsers on the container <browser> element. If you set it to browsers, it treats it as a regular browser (e.g. no webext permissions, content scripts work, etc).

References

Depends on #237 Fixes #157

I didn't notice that at all. I never noticed this because the console was giving me an error about not having permissions as a tab.

wonderful. Thank you for the information.

Copy link
Member

@PressJump PressJump left a comment

Choose a reason for hiding this comment

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

This is great news for sidebar! LGTM

@fushra-robot fushra-robot removed the dependent Requires another bug or pull request to be merged label Apr 21, 2023
@fushra-robot
Copy link
Member

This PR/issue depends on:

@trickypr trickypr merged commit 79f15ee into alpha Apr 21, 2023
@trickypr trickypr deleted the ublock-sidebar branch April 21, 2023 04:01
@wordpure
Copy link

wordpure commented May 9, 2023

@trickypr

If I may be so bold, 🐛 Fix uBo in sidebar webpages (#238) pulse-browser/browser@79f15ee seems to only work with 3rd party builds version, is there a way to apply this change to the official version of Firefox?

@surapunoyousei
Copy link
Contributor

You can edit browser/base/content/webext-panels.js in omni.ja file.

  1. into Firefox installed dir.

  2. search omni.ja file.

  3. Extract omni.ja file use 7zip.

  4. search "webext-panels.js" in extracted files.

  5. edit the file. search:

browser.setAttribute("messagemanagergroup", "webext-browsers");

replace it with:

browser.setAttribute("messagemanagergroup", browsers");

finish.

move edited file into omni.ja & boot firefox.

@wordpure
Copy link

Thanks for your pointers🌹

According to the steps you mentioned, I modified chrome\browser\content\browser\webext-panels.js in <Firefox Installed Dir>\browser\omni.ja.

After restarting the browser (Firefox 114.0b2), the messagemanagergroup attribute of the browser element in the sidebar does change to browsers, but Ublock Origin still cannot work on the web pages in the sidebar.

图片

@surapunoyousei
Copy link
Contributor

I will test it.

@surapunoyousei
Copy link
Contributor

surapunoyousei commented May 10, 2023

2023-05-11.010839.mp4

I think it works. but, cannnot block contents. The blocked ads number is up.

@surapunoyousei
Copy link
Contributor

In Pulse, YouTube Video ads cannnot block. I think this happens regardless of Firefox.
image

image

@wordpure
Copy link

I think it works. but, cannnot block contents. The blocked ads number is up.

It's a pity

@R0M4N0F5K7
Copy link

R0M4N0F5K7 commented May 12, 2023

Sorry for asking, but did this really
change anything or are any additional steps/flags required? I tested in floorp and pulse, but didn't notice any perceivable difference in adds blocked or other add-ons (like darkreader) working there. I still have static adds in the sidebar too and can't select anything with unlock in the sidebar...

@surapunoyousei
Copy link
Contributor

Sorry for asking, but did this really change anything or are any additional steps/flags required? I tested in floorp and pulse, but didn't notice any perceivable difference in adds blocked or other add-ons (like darkreader) working there. I still have static adds in the sidebar too and can't select anything with unlock in the sidebar...

What are you asking "did this really" for? against my validation? Or on this PR itself?

As I am Japanese, I may not be able to grasp the intentions properly.

@R0M4N0F5K7
Copy link

R0M4N0F5K7 commented May 12, 2023

Hi @surapunoyousei,
No worries.
I'm referring to this fix ("Fix uBo in sidebar webpages #238) in general, as using releases with this fix applied doesn't seem to make uBo work in the sidebar on my end. It seems like @wordpure is also experiencing these changes not actually fixing uBo in the sidebar.

@surapunoyousei
Copy link
Contributor

I see. We still need to make the addon work in a different way. I research it.

@trickypr
Copy link
Member Author

Hmm... Messing around a bit, it looks like networks requests are blocked but content scripts aren't executing correctly. So, if your ads are loaded via an external script (e.g. adsense) or trackers (e.g. GA) can be easily blocked. But ads that are server side rendered (e.g. search engine ads, youtube's voodoo wizardry) can bypass adblocking.

There are probably some primitives that are missing. I'll open a new issue and work on it eventually.

@trickypr trickypr changed the title Fix uBo in sidebar webpages Fix uBo (network blocking) in sidebar webpages May 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uBlock on Sidebar
6 participants