Skip to content

Loading…

uBlock slow/with delay blocking ads (banners) and elements on page twitch. #1048

Closed
thejustsoul opened this Issue · 15 comments

5 participants

@thejustsoul

uBlock does not have time (slow blocking) block/hide ads in Firefox 36.0.1. If you refresh the page, the banners are still visible for a while, then disappear (accompanied by twitching/blinking elements (tables, for example) where there should be a banner).

Checked on the clean Firefox 24.8.1 esr, 31.5 esr, 35.0.1, 36.0 - all ok, did not twitch and banners lurk unnoticed. The problem with only (?) Firefox 36.0.1.

uBlock version: 0.8.8.2, 0.9.1.1 and 0.9.1.2-dev.6
OS and version: Windows 7 x64

Examples sites (refresh page to see effect)
  • https://btdigg.org/search?info_hash=f330fea7a56be4db805fb79712b3aec6319806df&q=ubuntu%2014.04 (looking to place Ads field)
  • http://forum.ru-board.com (top and bottom banners)
@thejustsoul thejustsoul changed the title from [Firefox] uBlock slow (with delay) blocking ads (and at the location of the banners, twitching elements) to [Firefox] uBlock slow/with delay blocking ads (banners) and elements on page twitch.
@gorhill

still visible for a while

Firefox 36..0.1, I couldn't see any blinking out of what is expected.

Unable to repro.

For the first site, only 2 CSS rules were injected.

For the second site, only 3 CSS rules injected.

(ABP would have injected ~23,500 CSS rules on both these pages if you have RU Adlist enabled.)

So whatever slowness you are experiencing can't possibly be caused by uBlock injecting only 2-3 CSS rules. Check your other extensions or browser settings, I can't see what you describe with Firefox 36.0.1 (Linux though).

@StVol33

I have the exact same problem!

@thejustsoul

Here's how it looks, I recorded a video (uBlock and ABP) (download the file, quality embedded video is bad).
Is the first website in a similar way.

If need, test link which was on video.
RU Adlist enabled on uBlock and ABP.

Tried it on my Firefox to disable all extensions and plugins, and also copied my work profile to old (ESR) versions Firefox, similarly, the problem is also there. I don't know what to do :-(

@sn260591

I confirm existence of a problem. And it does not seem to depend on the version of firefox, because flicker was before.

Another example on https://2ch.hk/s/, if you block the top banner (||2ch.hk/ololo/*).

@gorhill

I looked more into this, and I could see the flickering. There are many parts to the answer.

First, uBlock normally would cache and reuse the CSS rules which causes the placeholder of the banner to collapse. However in the current case, the cache is defeated because the URL of the banner is relative, and uBlock assumes an absolute URL. So the CSS rule to collapse the placeholder before the page loads ends up not working. This probably can be fixed, I will look into this.

However, this doesn't mean the flickering would not occur the first time the site is visited: the banner is blocked, however the placeholder needs to be collapsed. So even if the CSS rules cache was working for the current case, there would still be a chance of flickering the first time the site is visited: this is by design.

On Chromium, ABP/uBlock behaves similarly. But there is a difference, I can see ABP collapsing the placeholder earlier. This is because of different implementation choices as of now. In uBlock, I do not want the pre-load content script to linger in memory, so I ensure that once its job is done, it can be removed from memory. The post-load content script is the one taking care of collapsing the placeholder. With ABP, my understanding is that both the pre-load and post-load linger in memory, so the collapsing of the placeholder is taken care by the pre-load content script in ABP.

Now this is an implementation choice I made: I did not want the pre-load content script to linger in memory, and thus consume browser resources.

Now this was for Chromium. uBlock/Firefox is essentially the same thing as the Chromium implementation, so as to minimize as much as possible platform-specific code -- this makes portability easier, this is why you have pretty much exactly the same UI for all platform. Apparently ABP does something differently on Firefox than it does on Chromium regarding the collapsing of placeholder, but certainly this appears to be Firefox-specific.

So in any case, uBlock works differently than ABP, and thus the workaround for the current visual nuisance is to use these two site-specific cosmetic filters:

forum.ru-board.com##body > table:nth-of-type(1) > tbody > tr > td:nth-of-type(2)
forum.ru-board.com##body > table:nth-of-type(2) > tbody > tr > td:nth-of-type(1)

ABP/Chromium would also benefit from these filters above, as the flickering is also noticeable.

Note that there are already site-specific cosmetic filters for that site, in RU Adlist:

forum.ru-board.com##body > table[cellpadding="2"] td.sh1[align="left"]:first-child
forum.ru-board.com##td:not([class="lgf"]) > table[width][cellpadding][bordercolor="#EEEEEE"][border="1"][bgcolor="#FFFFFF"]:not([width$="%"])

So as far as I can concerned, the only thing I need to look to fix, is the ensure the CSS rules inferred by uBlock properly apply to the placeholder, so that they owkr when they are cached, which is not the case here. In such case, you would not see any flickering when refreshing.

@gorhill gorhill added a commit that closed this issue
@gorhill gorhill this fixes #1048 cb69ff9
@gorhill gorhill closed this in cb69ff9
@gorhill gorhill changed the title from [Firefox] uBlock slow/with delay blocking ads (banners) and elements on page twitch. to uBlock slow/with delay blocking ads (banners) and elements on page twitch.
@gorhill

I can confirm that for the other test case, https://btdigg.org/search?info_hash=f330fea7a56be4db805fb79712b3aec6319806df&q=ubuntu%2014.04, it was also a case of relative URL[1], thus also fixed by cb69ff9.

[1] //ads.exoclick.com/iframe.php?idzone=1322418&size=468x60

@thejustsoul

Thank you very much, large banners are not visible anymore after you refresh the page (but you can see when you first log into the site), at least on ru-board, the other remains to be verified. Btw small banner (counter) is still visible for some time - https://i.imgur.com/wm61S7l.png.

@gorhill

Btw small banner (counter) is still visible for some time

This I definitely cannot reproduce. The only way I can think this could happen is that the banner is pulled from the browser cache without going through uBlock's network request handler. One way to be sure it's never shown regardless of browser cache is to use a cosmetic filter:

! 3/19/2015, 2:22:27 PM http://forum.ru-board.com/topic.cgi?forum=5&topic=46752
forum.ru-board.com##body > center:nth-of-type(2) > a[href="http://www.liveinternet.ru/click"]
@thejustsoul

Again comparing with ABP, under the same subscription filters, this "counter-image" not visible after refresh, cache in browser, enable/disable, not affected. Maybe it's a small thing, and not worth the bother, but... It would be desirable that uBlock worked ideally. :)

@gorhill

It would be desirable that uBlock worked ideally

I can't reproduce. You need to find a way for me how to reproduce. You may have custom filters, dynamic filtering rules, etc.

@gorhill

That counter is blocked by a filter in EasyPrivacy:

c

Can you show me something like above, i.e. the result + the request log for that result?

@thejustsoul

Can you show me something like above, i.e. the result + the request log for that result?

Also as on your screenshot + block ru-board.com/board/temp/ (rule: ||ru-board.com*/temp/ )
Record video?

Or try this steps:
  • scroll page to bottom (constantly) with mouse wheel
  • press F5
  • counter visible (or empty image) for a short time and disappears, sometimes through time.
@gorhill

counter visible (or empty image) for a short time and disappears

Ok so it does disappear. So this is by design: the counter seems to use URL which changes often, so this mean no reliable CSS rule can be create for such widget. So uBlock works as expected.

Workaround if you really do not want the placeholder to appear is to create a cosmetic filter for the area.

@AlexVallat AlexVallat added a commit to AlexVallat/uBlock that referenced this issue
@gorhill gorhill this fixes #1048 b4c9840
@AlexVallat AlexVallat added a commit to AlexVallat/uBlock that referenced this issue
@gorhill gorhill #1048: also need the fix for resources loaded later 4a91258
@zhou13

I have been an ABP/Firefox user for a long time and I have never noticed any ads on any websites. However, when I tried uBlock, I still frequently see the advertisements through they will disappear after the page is totally loaded. I have observed the same problem for ABP/chrome (that's why I don't use chrome!). Therefore, I think this is because uBlock does not totally utilize the flexibility of the Firefox's extension system to totally stop the ads from being loaded. I wish this will be improved in the later Firefox version of uBlock.

@gorhill

uBlock does not totally utilize the flexibility of the Firefox's extension system to totally stop the ads from being loaded

Ads are not "loaded". You are contributing to propagate FUD: see https://github.com/gorhill/uBlock/wiki/Does-uBlock-block-ads-or-just-hide-them%3F.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.