Adblock Plus and (a little) more

New element hiding approach in Firefox · 2016-10-10 15:46 by Wladimir Palant

Traditionally, element hiding on Firefox worked quite differently from all other platforms supported by Adblock Plus. Rather than decide on the filters for each website individually, all element hiding rules would be written into a single elemhide.css stylesheet file that would apply to all websites unconditionally. This approach had a few disadvantages:

  • The global stylesheet could not consider exceptions, such as websites where a particular rule should not apply — we had to implement a complicated mechanism to make sure that the rule didn’t have any effect in such cases, and on some websites there still were side-effects.
  • Changing a single element hiding rule caused the global stylesheet to apply again to all open tabs, this could cause significant delays.
  • With multiprocess Firefox coming up and sandboxing enabled on some platforms, we could no longer rely on being able to access that file.

Luckily, Firefox implemented better mechanisms to apply stylesheets to documents a while ago and as of Adblock Plus 2.7.3.4206-beta development build we are now taking full advantage of these. We will now make a separate decision for each website, which (if any) element hiding rules should apply. And we don’t sacrifice performance for that because the majority of element hiding rules will go into a preloaded stylesheet with all the rules which apply unconditionally.

There are a few drawbacks here:

  • New element hiding rules will no longer apply immediately, just like blocking rules they now require the document to be reloaded (can actually be seen as a good thing because consistent). This also affects Element Hiding Helper extension which will need to be updated.
  • We are no longer able to count hits for element hiding exception rules (issue 4509). We simply don’t know any more whether the rule that the exception applies to would have matched anything.
  • Element hiding rules apply with a slight delay which in theory might cause some ads being shown and then flashing out. In practice, I haven’t seen this yet.

This is a huge change to the inner workings of Adblock Plus and while we tested it quite thoroughly some issues are expected — let us know if you notice any.

To the install page

Tags:

Comment [2]

  1. John · 2016-10-18 07:55 · #

    https://adblockplus.org//blog/
    is different from
    https://adblockplus.org/blog/
    Why?

    Reply from Wladimir Palant:

    Looks like you found a flaw in Textpattern’s request parsing :)

    This is the blog “homepage” which we are normally not using. It is showing the posts for all sections – meaning development builds, releases and regular blog posts.

  2. Aslanex · 2016-10-28 15:05 · #

    Well, the fact a reload is required is quite annoying for filter writers, because now I am not able check whether it was blocked correctly.

    Reply from Wladimir Palant:

    But it’s exactly the same with all other filters.

Commenting is closed for this article.