pulse-browser / browser

Pulse Browser: An experimental firefox fork
https://pulsebrowser.app/
Mozilla Public License 2.0
773 stars 46 forks source link

Fix uBo (network blocking) in sidebar webpages #238

Closed trickypr closed 1 year ago

trickypr commented 1 year ago

@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

surapunoyousei commented 1 year ago

@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.

fushra-robot commented 1 year ago

This PR/issue depends on:

wordpure commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

I will test it.

surapunoyousei commented 1 year ago

https://github.com/pulse-browser/browser/assets/73892113/5c1d921a-4a47-4103-ac76-7d6a9c212411

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

surapunoyousei commented 1 year ago

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

image

wordpure commented 1 year ago

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

It's a pity

R0M4N0F5K7 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

trickypr commented 1 year ago

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.