Skip to content

Add Support for AdGuard Special Case Pre-Processor Directives #1205

@yourduskquibbles

Description

@yourduskquibbles

Prerequisites

  • I verified that this is not a filter issue
  • This is not a support issue or a question
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue
    • Your issue may already be reported.
  • I tried to reproduce the issue when...
    • uBlock Origin is the only extension
    • uBlock Origin with default lists/settings
    • using a new, unmodified browser profile
  • I am running the latest version of uBlock Origin
  • I checked the documentation to understand that the issue I report is not a normal behavior

Description

From AdGuard's KB Allowed Pre-Processor Directive List they use additional AdGuard product specific directives in special cases that uBO doesn't recognize.

I'd like to use the adguard_app_ios directive to conditionally load a sublist in Web Annoyances Ultralist only in the iOS AdGuard environment (Due to iOS not allowing CSS modifications and needing to remove some companion filters that make the page incorrect render when the CSS rules don't get loaded) but uBO doesn't recognize the adguard_app_ios directive and then loads the sublist wrapped in directive not recognized that I only want to conditionally load when it is iOS AdGuard envionment.

The same behavior is observed if when only loading the sublist directly - The filters wrapped in the unrecognized directive gets loaded because uBO just ignores the directive rather than recognize the directive as false and treat everything until the closing !#endif as not to be loaded.

  1. If uBO encounters a directive it doesn't understand does it make more sense to throw out all content between the invalid directive and the closing !#endif?

  2. Is it possible to add additional directives that uBO will recognize to mirror AdGuard used directives? I can elaborate more on what issue this specific sublist fixes (screenshots, video) if you'd like.

adguard_app_mac -- AG for Mac
adguard_app_android -- AG for Android
adguard_app_ios -- AG for iOS
adguard_ext_safari -- AG browser extension for Safari
adguard_ext_android_cb -- AG content blocker for Samsung/Yandex

Related:
yourduskquibbles/webannoyances#241

A specific URL where the issue occurs

N/A

Steps to Reproduce

  1. Add custom list https://raw.githubusercontent.com/yourduskquibbles/webannoyances/master/ultralist.txt
  2. Observe Logger is loading sublist filters/adguard_app_ios_exclusion_filters.txt wrapped in invalid directive adguard_app_ios
  3. Unsubscribe from custom list https://raw.githubusercontent.com/yourduskquibbles/webannoyances/master/ultralist.txt
  4. Add custom list https://raw.githubusercontent.com/yourduskquibbles/webannoyances/master/filters/adguard_app_ios_exclusion_filters.txt
  5. Observe logger loads the custom filters wrapped in invalid directive adguard_app_ios

Expected behavior:

uBO ignores everything inside of invalid !#if directive until closing !#endif

Actual behavior:

uBO ignores only the 1 line of the invalid directive and proceeds to load content within the invalid !#if statement

Your environment

  • uBlock Origin version: 1.29.1b0
  • Browser Name and version: Firefox Nightly
  • Operating System and version:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfixedissue has been addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions