Opened 4 years ago

Closed 4 years ago

#3670 closed change (fixed)

[abp2blocklist] Make rules case-sensitive whereever possible

Reported by: sebastian Assignee: kzar
Priority: P3 Milestone:
Module: Platform Keywords:
Cc: kzar, CraftyDeano Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29336787/

Description (last modified by sebastian)

Background

By default the regular expression given by trigger.url-filter matches case-insensitive. That's fine as it is the default behavior of Adblock Plus filters as well.

However, when the block list is compiled to a finite state machine by Safari, case-insensitive rules compile slower, result in larger code, and are slightly slower at runtime, as outlined in an official blog post.

While Adblock Plus filters are supposed to match case-insensitive (by default), it doesn't matter much for filters that can only possibly match the protocol + host part, as that part is always lowercase anyway.

Moreover, there is the $match_case filter option which is currently ignored when converting Adblock Plus filters to WebKit blocking rules.

What to change

Set trigger.url-filter-is-case-sensitive to true for rules generated from filters that either specify the $match_case option, or filters that can potentially only match the protocol + host part. These are:

  • Element hiding filters, as those can only be limited to a domain in the first place
  • Blocking filters and exception rules ...
    • with implied begin of host (starting with ||) or protocol delimiter (://)
    • that don't match any further alpha characters after the next occurrence of any of these:
      • / (begin of path)
      • ? (begin of query)
      • * (wildcard)
      • ^ (boundary)

Change History (5)

comment:1 Changed 4 years ago by sebastian

  • Description modified (diff)

comment:2 Changed 4 years ago by kzar

  • Owner set to kzar

comment:3 Changed 4 years ago by sebastian

  • Description modified (diff)

comment:4 Changed 4 years ago by kzar

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:5 Changed 4 years ago by kzar

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.