Opened 3 months ago

Closed 2 months ago

Last modified 6 weeks ago

#6543 closed change (fixed)

Match requests without tabId/frameId in their originating context

Reported by: sebastian Assignee: sebastian
Priority: P3 Milestone: Adblock-Plus-3.1-for-Chrome-Opera-Firefox
Module: Platform Keywords:
Cc: greiner Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Ross Verified working: yes
Review URL(s):

https://codereview.adblockplus.org/29739594

Description (last modified by sebastian)

Background

Currently, requests that don't relate to any tab or frame (e.g. requests sent by Service/Shared Workers) are matched out of context. This means the $domain filter option doesn't work, neither does document-based whitelisting. However, Firefox and Chrome >=63, now, provide information about the origin of the request through the orignUrl (Firefox) and initiator (Chrome) properties, even if no tabId is assigned.

What to change

Fall back to originUrl on Firefox, and initiator on Chrome, when either the tabId or frameId is set to -1. So that the $domain filter option as well as document-based whitelisting (including $sitekey) work for requests sent from Service Workers (and other scenarios where no tab is associated).

Hints for testers

Make sure that requests sent by Service Workers (e.g. on https://regex101.com/) show up in the "Adblock Plus" devtools panel (for the correct tab only), and are subject to request blocking (with $domain option) and $document exception rules applied to the document that caused the worker to spawn. Requests sent by Service Workers are indicated with a gear icon in the (built-in) "Network" panel in the devtools.

Note that this change involved a refactoring of large parts of the request blocking and whitelisting logic, so watch out for potential regressions (which might not directly relate to the Service Worker scenario).

Change History (6)

comment:1 Changed 3 months ago by sebastian

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

comment:2 Changed 2 months ago by greiner

  • Cc greiner added

comment:4 Changed 2 months ago by sebastian

  • Milestone set to Adblock-Plus-for-Chrome-Opera-Firefox-next
  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:5 Changed 6 weeks ago by sebastian

  • Description modified (diff)

comment:6 Changed 6 weeks ago by Ross

  • Tester changed from Unknown to Ross
  • Verified working set

Done. Has not caused any issues as far. Requests from service workers appear in the devtools and can be blocked. They can also be whitelisted with $document and $genericblock/hide etc.

ABP 3.0.4.2042
Firefox 59 / 55 / 51 / Windows 10
Chrome 66 / 58 / 49 / Windows 7
Opera 52 / 45 / 36 / Windows 10

Note: See TracTickets for help on using tickets.