Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#2396 closed change (fixed)

Add code for CSS property filters to message responder

Reported by: trev Assignee: kzar
Priority: P2 Milestone:
Module: User-Interface Keywords:
Cc: sebastian Blocked By:
Blocking: #2388, #2392, #2395, #2397, #2401 Platform: Unknown
Ready: yes Confidential: no
Tester: Ross Verified working: yes
Review URL(s):

https://codereview.adblockplus.org/29329677/

Description (last modified by kzar)

Background

The content script created in #2395 will have to request CSS property filters from the background page. There is currently no message for that.

What to change

Add a filters.get message to messageResponder.js in the adblockplusui repository. When received with what: "cssproperties" it should query CSSRules container for matching filters and respond with a list like [{prefix: "foo > ", suffix: "", regexp: "background-image: .*"} and {prefix: "", suffix " > bar", regexp: "margin-left: -50px"}]. The list should be filters that apply to the current domain, see sender.frame.url.

Change History (12)

comment:1 Changed 4 years ago by trev

  • Blocking 2397 added

comment:2 Changed 4 years ago by trev

  • Blocking 2401 added

comment:3 Changed 4 years ago by sebastian

So far for separating backend logic from UI code. I think the the common logic here should rather belong into the core code. Hence the messaging code should be fairly trivial and implemented directly in the individual extensions.

comment:4 Changed 4 years ago by trev

Arguably, the message responder is there to support UI code. The main question is whether content scripts are UI - looking at Chrome's content scripts they probably can be considered as such.

comment:5 Changed 4 years ago by sebastian

I wouldn't consider any of our content scripts UI, as they mainly support adblocking functionality, and well the "Block element" functionality on Chrome, but not even it's UI but only the logic to select and highlight elements.

comment:6 Changed 4 years ago by sebastian

Does the content script actually have to send the domain? Usually we retrieve the domain with extractHostnameFromFrame(sender.frame) in the background page.

comment:7 Changed 4 years ago by trev

You don't have to send the domain, but sharing the message responder will become rather complicated then - you need to expose some API for the browser-specific processing of the URL.

comment:8 Changed 4 years ago by kzar

  • Owner set to kzar
  • Tester set to Unknown

comment:9 Changed 4 years ago by kzar

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

comment:10 Changed 4 years ago by kzar

  • Description modified (diff)

comment:11 Changed 4 years ago by kzar

  • Blocked By 2392, 2395 removed
  • Blocking 2392, 2395 added
  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:12 Changed 3 years ago by Ross

  • Tester changed from Unknown to Ross
  • Verified working set

CSS property filters are in the build and working.
(Followed from #3813).

ABP 2.7.2.4166
Firefox 38 / 44 / Windows 8
Nightly 48.0a1 (2016-04-19) / Windows 8
Firefox 38 / 44 / OS X 10.11
Firefox 45.01 / Ubuntu 14.04
Nightly 48.0a1 (2016-04-19) / Ubuntu 14.04

Note: See TracTickets for help on using tickets.