Opened 5 years ago

Closed 5 years ago

#1527 closed defect (fixed)

Generated CSS selectors aren't always correctly escaped

Reported by: sebastian Assignee: sebastian
Priority: P3 Milestone: Adblock-Plus-1.8.8-for-Chrome-Opera-Safari
Module: Platform Keywords:
Cc: Blocked By:
Blocking: Platform: Unknown
Ready: yes Confidential: no
Tester: Verified working: no
Review URL(s):

http://codereview.adblockplus.org/4935175632846848

Description (last modified by sebastian)

Background

Some of the element hiding filters generated by the "Block element" dialog use improperly escaped CSS selectors, breaking those filters, or element hiding all together when those filters are used.

What to change

Properly escape CSS selectors when generating element hiding filters, considering following rules:

  • Non-alphanumeric ASCII characters, except for the - (dash) and _ (underscore), must be escaped everywhere in an id or class.
  • Digits must be escaped when in the first place of an id or class.
  • Dashes (-) must be escaped when in the first place of an id or class, and not followed by a character which isn't another dash or digit.
  • Colons (:) must be escaped in tag names (other characters that would need escaping can not occur in a tag name).
  • Quoted attribute values must still escape \r (carriage return), \n (new line), \f (new page) and \0 (null).
  • Control characters and digits must be escaped based on their code point (e.g. \n -> \0a ). Other characters can be escaped by prepending a \ (backslash).

Change History (5)

comment:1 Changed 5 years ago by sebastian

  • Description modified (diff)

comment:2 Changed 5 years ago by sebastian

  • Description modified (diff)

comment:3 Changed 5 years ago by sebastian

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

comment:4 Changed 5 years ago by sebastian

  • Description modified (diff)

comment:5 Changed 5 years ago by sebastian

  • Milestone set to Adblock-Plus-for-Chrome-Opera-Safari-next
  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.