Opened on 04/02/2018 at 02:52:36 AM

Closed on 04/05/2018 at 06:34:03 PM

Last modified on 05/10/2018 at 07:29:44 PM

#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).

Attachments (0)

Change History (6)

comment:1 Changed on 04/02/2018 at 02:55:35 AM by sebastian

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

comment:2 Changed on 04/05/2018 at 04:42:49 PM by greiner

  • Cc greiner added

comment:3 Changed on 04/05/2018 at 06:32:02 PM by abpbot

comment:4 Changed on 04/05/2018 at 06:34:03 PM 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 on 05/10/2018 at 01:54:21 PM by sebastian

  • Description modified (diff)

comment:6 Changed on 05/10/2018 at 07:29:44 PM 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

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from sebastian.
 
Note: See TracTickets for help on using tickets.