PSA: uBlock Origin will interfere with your DNS prefetching setting

Add-ons for Pale Moon and other applications
General discussion, compatibility, contributed extensions, themes, plugins, and more.

Moderators: Lootyhoof, FranklinDM

User avatar
jobbautista9
Keeps coming back
Keeps coming back
Posts: 855
Joined: 2020-11-03, 06:47
Location: Philippines
Contact:

PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by jobbautista9 » 2024-08-13, 09:42

Just updated to 33.3.0, and I noticed that my DNS prefetching was disabled, which surprised me. I enabled it and then restarted only to see it got flipped back to false again. I had to go through all my add-ons, and turns out I had the Disable pre-fetching checkbox ticked in my uBlock's settings, which explains why the DNS prefetcher pref gets flipped every restart...
Image

merry mimas

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

Mima avatar by 絵虎. Pixiv post: https://www.pixiv.net/en/artworks/15431817

Image

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 36384
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by Moonchild » 2024-08-13, 10:05

When prefetching is enabled, the browser can establish connections to remote servers even if the resources from these remote servers were supposed to be blocked by uBO.
This is incorrect for DNS prefetching. This only applies to prefetching of content/predictor/prefetch-next -- uBO should not block DNS prefetching if what is described in the quote is the intent.
"A programmer is someone who solves a problem you didn't know you had, in a way you don't understand." -- unknown
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
jobbautista9
Keeps coming back
Keeps coming back
Posts: 855
Joined: 2020-11-03, 06:47
Location: Philippines
Contact:

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by jobbautista9 » 2024-08-13, 10:27

Indeed. It shouldn't bypass the user's filters, which seems what uBlock intends to avoid. This might also be why the checkbox is ticked by default; everyone who has uBlock Origin installed will most likely have DNS prefetching forcibly disabled too instead of being flipped by the browser update. Hopefully UCyborg will fix this in their fork.
Image

merry mimas

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

Mima avatar by 絵虎. Pixiv post: https://www.pixiv.net/en/artworks/15431817

Image


User avatar
gepus
Keeps coming back
Keeps coming back
Posts: 961
Joined: 2017-12-14, 12:59

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by gepus » 2024-08-13, 12:05

DNS-prefetch is off
DNS-prefetch is on
Attachments
DNS_prefetch-off.png
DNS_prefetch-on.png

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 36384
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by Moonchild » 2024-08-13, 12:17

gepus wrote:
2024-08-13, 12:05
DNS-prefetch is off
DNS-prefetch is on
Working exactly as-intended. Standard DNS queries don't connect to the addresses looked up.
"A programmer is someone who solves a problem you didn't know you had, in a way you don't understand." -- unknown
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
gepus
Keeps coming back
Keeps coming back
Posts: 961
Joined: 2017-12-14, 12:59

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by gepus » 2024-08-13, 12:37

Moonchild wrote:
2024-08-13, 12:17
Working exactly as-intended. Standard DNS queries don't connect to the addresses looked up.
Of course they don't.
Bombing the DNS-server for milliseconds of speed up?

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 36384
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by Moonchild » 2024-08-13, 12:52

gepus wrote:
2024-08-13, 12:37
Bombing the DNS-server for milliseconds of speed up?
Wow, so dramatic!

Remember that lookups are cached. Whether they are looked up in a burst right away or piecemeal doesn't matter for that. But if you don't want to "bomb" the DNS server with work it's designed to be doing (it's all UDP so it's not like you have a connection overhead...) then feel free to switch it off.
"A programmer is someone who solves a problem you didn't know you had, in a way you don't understand." -- unknown
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
back2themoon
Moon Magic practitioner
Moon Magic practitioner
Posts: 2502
Joined: 2012-08-19, 20:32

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by back2themoon » 2024-08-13, 12:57

jobbautista9 wrote:
2024-08-13, 09:42
Just updated to 33.3.0, and I noticed that my DNS prefetching was disabled, which surprised me.
Wait, doesn't disablePrefetch=True (the default setting) mean that prefetching is in fact, disabled?

That's what I get from the wording anyway.

User avatar
jobbautista9
Keeps coming back
Keeps coming back
Posts: 855
Joined: 2020-11-03, 06:47
Location: Philippines
Contact:

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by jobbautista9 » 2024-08-13, 13:45

Oh yeah you're right, my bad
Image

merry mimas

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

Mima avatar by 絵虎. Pixiv post: https://www.pixiv.net/en/artworks/15431817

Image

User avatar
LuftWafflePilot
Lunatic
Lunatic
Posts: 265
Joined: 2021-02-19, 20:46

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by LuftWafflePilot » 2024-08-13, 14:20

So is this actually a problem or not? I can't figure out whether the addon is doing something it shouldn't or what's going on.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 36384
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by Moonchild » 2024-08-13, 14:57

To clarify...

The default for network.dns.disablePrefetch in 33.3.0 is false. disable=false means it's prefetching (i.e. the feature is enabled).
"A programmer is someone who solves a problem you didn't know you had, in a way you don't understand." -- unknown
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
back2themoon
Moon Magic practitioner
Moon Magic practitioner
Posts: 2502
Joined: 2012-08-19, 20:32

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by back2themoon » 2024-08-13, 15:40

Right, this setting's default state changed in 33.0.0. Was probably looking at 33.2.1, sorry for the confusion.

User avatar
jobbautista9
Keeps coming back
Keeps coming back
Posts: 855
Joined: 2020-11-03, 06:47
Location: Philippines
Contact:

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by jobbautista9 » 2024-08-14, 02:14

LuftWafflePilot wrote:
2024-08-13, 14:20
So is this actually a problem or not? I can't figure out whether the addon is doing something it shouldn't or what's going on.
As MC just said earlier network.dns.disablePrefetch should be false by default in 33.3.0. But uBlock Origin's default settings (which has the offending "Disable pre-fetching" checkbox ticked) is forcing that pref to be true even with browser restarts (as long as that uBlock checkbox is ticked). This can confuse users who upgrade to 33.3.0 while having uBlock Origin installed expecting for DNS prefetching to be enabled.
Image

merry mimas

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

Mima avatar by 絵虎. Pixiv post: https://www.pixiv.net/en/artworks/15431817

Image

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 5261
Joined: 2015-12-09, 15:45
Contact:

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by moonbat » 2024-08-14, 02:19

To add - using the FoxyProxy addon will also result in disabling DNS prefetches.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
KDE Neon on a Slimbook Excalibur (Ryzen 7 8845HS, 64 GB RAM)
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
back2themoon
Moon Magic practitioner
Moon Magic practitioner
Posts: 2502
Joined: 2012-08-19, 20:32

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by back2themoon » 2024-08-15, 09:29

Am I correct to assume that this uBO setting does not make a direct change in how uBO operates? It only toggles this particular browser setting?

User avatar
jobbautista9
Keeps coming back
Keeps coming back
Posts: 855
Joined: 2020-11-03, 06:47
Location: Philippines
Contact:

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by jobbautista9 » 2024-08-15, 09:41

It seems to only toggle the browser's own prefs, AFAICS.
Image

merry mimas

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

Mima avatar by 絵虎. Pixiv post: https://www.pixiv.net/en/artworks/15431817

Image

User avatar
jobbautista9
Keeps coming back
Keeps coming back
Posts: 855
Joined: 2020-11-03, 06:47
Location: Philippines
Contact:

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by jobbautista9 » 2024-08-16, 05:42

FWIW, this is the add-on author's justification in 2016 on why DNS prefetching is forcibly disabled: https://github.com/gorhill/uBlock/issues/1716
Image

merry mimas

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

Mima avatar by 絵虎. Pixiv post: https://www.pixiv.net/en/artworks/15431817

Image

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 36384
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by Moonchild » 2024-08-16, 08:49

Misinterpretation of wireshark results, I think. There's obvious lookups missing in Chromium's dump that should occur for a page load, i.e. googleapis.com for the fonts used in the page, etc., so he was probably seeing the caching in effect, and deciding to block DNS based on "I see fewer queries in Chromium so Firefox needs more aggressive settings" while that's not really the case.
Regardless, those lookups do not mean connections to the looked-up servers are made, which has been my point here.

In case people still don't understand I'll try to break down the sequence, AFAIU without combing through the code in question (some steps may be combined or out of order):

A. Original page request
  1. Request is made for example.com
  2. DNS lookup for example.com -> IP + caching of result
  3. Connection to example.com's IP
  4. Page load from example.com
  5. Parsing of page, scanning for resource URLs, e.g. images
  6. DNS lookup of resource URLs of display elements -> IP + caching of result
  7. Connection to resource URL locations, and loading page elements from them.
  8. Scan of page content for links (external.com)
  9. DNS lookup for link URLs -> IP + caching of result
Done.

B. Navigation to linked URL:
  1. Request is made for external.com
  2. DNS cache lookup of external.com. Found? -> IP and skip next step, otherwise do next step
  3. if not cached: DNS lookup for external.com -> IP + caching of result
  4. Connection to external.com's IP
  5. Page load from external.com
followed by the rest of the steps in the sequence above.

Steps A8 and A9 happen when prefetching is enabled, resulting in B2 always having a cached IP, skipping B3. As you can see there are no connecting steps after A8 and A9, the page load is done. A9 happens when the original page is being displayed and viewed by the user (i.e. in the background when the browser is otherwise idle), while without prefetching it would be done when actively navigating, incurring a wait.
"A programmer is someone who solves a problem you didn't know you had, in a way you don't understand." -- unknown
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
UCyborg
Fanatic
Fanatic
Posts: 236
Joined: 2019-01-10, 09:37
Location: Slovenia

Re: PSA: uBlock Origin will interfere with your DNS prefetching setting

Unread post by UCyborg » 2024-08-20, 20:25

So this checkbox hasn't practically altered the behavior of Pale Moon as set out-of-the-box in any way until now, as the 3 prefs' default values were already set like the checked box sets them.

Code: Select all

if ( settingVal ) {
    this.clear('network', 'prefetch-next');
    this.clear('network.http', 'speculative-parallel-limit');
    this.clear('network.dns', 'disablePrefetch');
} else {
    this.setValue('network', 'prefetch-next', false);
    this.setValue('network.http', 'speculative-parallel-limit', 0);
    this.setValue('network.dns', 'disablePrefetch', true);
}
Until now that network.dns.disablePrefetch's default value has changed, which would be better handled by separate checkbox, if at all, considering the option is exposed in Pale Moon's own settings window?

To conclude, clearing the checkbox for now will allow DNS prefetching to remain enabled while other prefetching will still be disabled, unless manually changing settings in about:config.

Post Reply