Skip to content

1.15.0

Compare
Choose a tag to compare
@gorhill gorhill released this 31 Jan 17:57
· 7488 commits to master since this release
7f9435f

New

HTML filtering

Ability to remove DOM elements from a source document before it is parsed by the browser. The platform must support an extension API to modify the response body on the fly. Currently only Firefox 57+ allows this.

The filter syntax is similar to cosmetic filtering, except that the character ^ is used before a valid selector to denote that the filter is to be applied to the source data. Contrary to cosmetic filtering, with HTML filtering the elements matching a selector are removed from the source. Example:

twitter.com##^meta[http-equiv="refresh"]
www.google.ca##^#hplogo
boards.4chan.org##^script:has-text(7c9e3a5d51cdacfc)

Note that procedural operators are supported. Procedural operators which are senseless to use on source data will be ignored. For example, it makes no sense to use procedural operator such :matches-css(...) for HTML filtering.

Note that HTML filtering essentially brings back support for inline script tag filtering. I plan on deprecating the syntax ##script:contains(...) in favor of ##^script:has-text(...). For the time being, uBO will conveniently convert the old syntax to the new HTML filtering syntax.

Given that HTML filters are to be applied to the source data of a document, the best way to create such filters is to view-source: the document and from there analyze what should be removed. Thus the element picker won't be extended as a tool to create HTML filters.

In case it's still not clear at point: this is a big deal feature.

Sub-filter lists

Ability for filter list maintainers to force uBO to load extra filter lists from within a filter list, using an !#include directive. Example:

!#include adblock_ublock.txt

When uBO encounters the above directive inside a filter list, it tells uBO to load the extra filter list and append it to the current one. The main purpose of such directive is to allow filter list maintainers to be able to make use of uBO's extended filter syntax, without forfeiting the ABP-compatibility of their main filter list: ABP will ignore such directive since it will be seen as a mere comment.

All the details of the new directives syntax is being fleshed out at AdguardTeam/AdguardBrowserExtension#917. At this point only !#include is implemented by uBO, because it solves immediately a current issue by simplifying the work of filter list maintainers who want to make use of uBO's extended filter syntax.

Important: uBO forbids sublists which are outside the directory of the main list. Typically, filter list maintainers will just use a single file name, as seen in the example above, in which case same-origin and same directory is implicit.

Changes

Logger

The logger can now be opened in a sidebar on Firefox. Just open the side bar and "uBlock₀ -- Logger" will be available as a choice.

Given this new ability, I added the following enhancements:

  • A new entry in the tab selector: "Current tab":
    • This will cause the logger to automatically filter out rows which do not belong to the currently active tab.
  • The rows related to behind-the-scene scope are now always shown.
  • If you close a tab while "Current tab" is selected, the resulting void rows will be automatically deleted.
  • You can expand/collapse a single row by clicking on the time stamp cell.

Given that uBO's logger is unified, being able to open the logger in a sidebar means you could end up having multiple views opened for the logger: only one view will work at any given time.

Mind that there are minor visual issues which I have no control over:

  • The maximum horizontal space is limited by the browser.
  • Firefox: the font size is smaller than dictated in the DOM inspector view: I have no clue why, uBO's chosen font size is overridden by Firefox for some reasons.
    -Firefox: it's not possible to select text in the logger when it is embedded in a sidebar.
  • If you have the logger already opened in a tab or separate window, you will have to close these for the logger-in-a-sidebar to start working. However some internal message events are lost in Firefox and as a result the logger-in-a-sidebar may take over 30 seconds to start working after you close the logger-in-a-tab or window.

Closed as fixed:

Firefox

Core