Block some specific resources in Network Panel across reloads

RESOLVED FIXED in Firefox 68

Status

enhancement
RESOLVED FIXED
4 years ago
26 days ago

People

(Reporter: karlcow, Assigned: jryans)

Tracking

(Blocks 4 bugs, {dev-doc-needed})

unspecified
Firefox 68
Other
Linux
Dependency tree / graph

Firefox Tracking Flags

(firefox68 fixed)

Details

Attachments

(6 attachments)

(Reporter)

Description

4 years ago
Use cases:

Some CSS, some JS, etc have specific effects on the Web page such as completely transforming the content in unexpected ways. For example, through XHR a script will be loaded rewriting the page entirely. Or an image will completely change the rendering. 

It would be good to be able through a checkbox or icon to block one or more specific resources AND that this blocking persists across reloads, so we can better understand the effect of this specific resource on the rest of the page.

Updated

11 months ago
Product: Firefox → DevTools
Blocks: 1493094
Severity: normal → enhancement

Note that we can:

  1. Block particular request
  2. Block domain or URL
  3. Block requests using glob pattern (*.js)

Honza

Updated

3 months ago
Duplicate of this bug: 1530906

@Michal: do we have any platform API that would help us to implement this feature?
Honza

Flags: needinfo?(michal.novotny)
(Assignee)

Comment 5

a month ago

I'll make an attempt! 😄 Feel free to steal if I am taking too long...

Assignee: nobody → jryans
Status: NEW → ASSIGNED
(Assignee)

Comment 6

a month ago
Posted image blocked-request.png

Here's how I am currently displaying blocked requests.

(Assignee)

Comment 7

a month ago

It seems like we can just cancel requests from DevTools, so I don't think a platform API is required here.

Flags: needinfo?(michal.novotny)

It seems like we can just cancel requests from DevTools, so I don't think a platform API is required here.

I see ok.

Here's how I am currently displaying blocked requests.

The UI looks good to me!

Thanks!
Honza

(Assignee)

Comment 10

a month ago

This is a very basic form of request blocking for the Network Monitor. It only
supports blocking a request via right-click. This change adds the minimal UI and
server support to block the request.

There is no UI to indicate what happened to the request yet, so it will just
look like a "confused" request that never started. Future patches will improve
from here.

(Assignee)

Comment 11

a month ago

This updates the request list to indicate a request was blocked by marking the
entire request item and also replaces transferred size column with "blocked by
DevTools". In the future, we may show other reasons for blocking in this way,
such as CORS, etc.

Depends on D26579

(Assignee)

Comment 12

a month ago

This is nearly the same the first patch for blocking, but adds the unblock
option as well.

Depends on D26580

While this patch queue is correct code-wise, I'm wondering where we are going from this first iteration?
I've not found any followup bugs to know where we are going.

The feature is great, but is strictly limited to block resources one by one and via absolute URLs.
Also, there is no feedback when you do block a request.
It currently feels a bit broken because of that, we should have some UI to say that this request will be blocked.

Flags: needinfo?(hkirschner)

One follow up filled as bug 1543400.

Honza

Blocks: 1543400

Another follow up:
Bug 1543613 - Use DevTools specific blocking reason for manual resource blocking

We yet need a bug to cover the UI changes - I am waiting for Harald with this.

Honza

Posted image image.png

This is the UI Chrome is using:

Context menu actions:

  • Block request URL
  • Block request Domain

Honza

(Assignee)

Comment 19

a month ago

Hoping to investigate the headers issue that Alex spotted: https://phabricator.services.mozilla.com/D26582#789722.

(Assignee)

Updated

a month ago
No longer blocks: 1543400
Duplicate of this bug: 1543400

@jryans: thanks for the update, I tested it and I can see the headers now.
I think it's ready to land.

The feature is great, but is strictly limited to block resources one by one and via absolute URLs.
Also, there is no feedback when you do block a request.
It currently feels a bit broken because of that, we should have some UI to say that this request will be blocked.

Yes agree, more work on the UI is needed, but it shouldn't block the patch provided here. The current minimal UI (actions in the context) menu works too.

Anyway, there are two follow ups:

  • Bug 1545739 - Indicate that resources might be blocked
  • Bug 1543613 - Use DevTools specific blocking reason for manual resource blocking

Thank you both Alex and Jryans for the help with this!

(I am also resolving NI for Harald since we discussed this offline)

Honza

Flags: needinfo?(hkirschner)

Comment 24

a month ago
Pushed by jryans@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/eaf2a199d4ea
Block requests by URL in DevTools. r=ochameau
https://hg.mozilla.org/integration/autoland/rev/6b031fd49d1e
Display blocked requests in Network Monitor. r=ochameau,Honza
https://hg.mozilla.org/integration/autoland/rev/b9a2a553d0c4
Unblock requests by URL in DevTools. r=ochameau
https://hg.mozilla.org/integration/autoland/rev/6d168f63dd8d
Add test for DevTools request blocking. r=Honza
(Assignee)

Updated

26 days ago
Keywords: dev-doc-needed
You need to log in before you can comment on or make changes to this bug.