RESOLVED DUPLICATE of bug 222709 154811
Feature request: add "xmlhttprequest" resource type for content blockers
https://bugs.webkit.org/show_bug.cgi?id=154811
Summary Feature request: add "xmlhttprequest" resource type for content blockers
Andrey Meshkov
Reported 2016-02-29 02:13:13 PST
Currently there is no way to distinguish XHR requests from other requests, yet it may be very useful for ad blocking. For instance, ad blocking on speedtest.net involves blocking scripts and XHR requests |http://$script,xmlhttprequest,domain=speedtest.net |https://$script,xmlhttprequest,domain=speedtest.net
Attachments
Radar WebKit Bug Importer
Comment 1 2019-04-11 22:54:04 PDT
Alex Christensen
Comment 2 2019-04-15 13:09:20 PDT
I assume this would still package xhr and fetch together, right? We wouldn't want to block xhr but not fetch.
Andrey Meshkov
Comment 3 2019-04-15 13:34:21 PDT
Hi Alex, I can't think of any case when distinguishing fetch from xhr would be useful.
Maciej Stachowiak
Comment 4 2020-02-18 22:50:01 PST
What type do XHR and Fetch currently show up as? "raw"? Or are they not blockable?
Andrey Meshkov
Comment 5 2020-02-18 23:56:57 PST
They show up as "raw".
Maciej Stachowiak
Comment 6 2020-02-19 02:30:08 PST
I guess it's worthwhile to distinguish from other "raw" types such as WebSockets? Perhaps every distinct use of "raw" should also have a more specific type. (For compatibility reasons "raw" would likely remain defined as it is currently.)
Andrey Meshkov
Comment 7 2020-02-19 03:47:10 PST
> I guess it's worthwhile to distinguish from other "raw" types such as WebSockets? Perhaps every distinct use of "raw" should also have a more specific type. (For compatibility reasons "raw" would likely remain defined as it is currently.) To be honest, I wanted to request a distinct request type for websocket as well. WebSockets are often used by adblocking circumvention scripts and this would be really useful to be able to distinguish them. For instance, there are a couple of rules in EasyList that block WebSocket connections on >300 websites.
Andrey Meshkov
Comment 8 2020-02-19 03:54:24 PST
Oh, and there's another feature request - about "subdocument" resource type: https://bugs.webkit.org/show_bug.cgi?id=153559 Should I merge them all in one? The final list of resource types we'd like to have is: * "subdocument" -- for non-top-level frames * "xmlhttprequest" -- fetch/xhr * "websocket"
Maciej Stachowiak
Comment 9 2020-02-19 21:35:01 PST
No need to merge (unless somebody wants to add all of them in a single patch). If anyone wants to post a patch for this, some thoughts: - The type should probably be named "fetch" rather than "xmlhttprequest", better to name it after the modern API than the legacy version. - We likely need to keep "raw" matching everything it does not, so the xhr/fetch and web socket types would have to be synonyms for subsets of "raw". I believe we already did this with "ping", so there should be an example to follow. - Same thing for "subdocument" being a subset of "document" (maybe this means we would need a separate "main-document"?)
Alex Christensen
Comment 10 2021-05-19 14:11:49 PDT
*** This bug has been marked as a duplicate of bug 222709 ***
Note You need to log in before you can comment on or make changes to this bug.