Closed Bug 1884645 Opened 7 months ago Closed 7 months ago

Send an observer notification with the decodedBodySize before calling OnStopRequest listeners

Categories

(Core :: Networking, task, P2)

task

Tracking

()

RESOLVED FIXED
125 Branch
Tracking Status
firefox125 --- fixed

People

(Reporter: jdescottes, Assigned: valentin)

References

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

To monitor network events DevTools and WebDriver BiDi setup a response listener that will decode the input stream of the response in the parent process. We use this to get the response body and the response's decoded body size. The closing of the input stream is also used to consider a request as "completed". For BiDi, this is when we emit the network.responseCompleted event.

However this decoding can be async and might be completed significantly later than the actual "stop" of the request. This can be an issue for webdriver BiDi, because the network.responseCompleted event might be fired after the domContentLoaded and load events are fired (for the special case of a navigation request).

We would like to stop decoding the input stream in the parent process, and instead try to retrieve the information we need from the content processes, where the decoding already happens anyway.

At the moment, BiDi doesn't need the response body, so we only need a solution for the decoded body size.
Could we add an observer notification with the decoded body size, emitted in the content process before the OnStopRequest listeners are called ?
BiDi would listen to this notification and take care of sending it to the parent process, so that we avoid extra IPC when BiDi is not enabled.

Valentin, we discussed about something similar last year, can you check if the summary above makes sense?

Flags: needinfo?(valentin.gosu)

Hi Julian,

Yes, I think that makes sense.
Just to clarify, the problem is that the content process request loads and fires the load event, but for some reason we're not able to get the decodedBodySize from the channel that triggers the load event? Or is devtools not able to access the channel for the load event?

Flags: needinfo?(valentin.gosu) → needinfo?(jdescottes)

As of now we are only monitoring channels in the parent process, and there decodedBodySize is always set 0.

We could add some logic in content processes in order to get the channel that triggered domContentLoaded & load events, read decodedBodySize there and send it to the parent process before we send domContentLoaded & load. Typically we could look this up when we catch domContentLoaded.

But we need the decodedBodySize information for all requests, not only navigation requests. For a non-navigation request we would not really know where to get the decodedBodySize. That's why having a dedicated notification which is consistently emitted before OnStopRequest listeners are called seems like a good fit.

Flags: needinfo?(jdescottes)

This notification would be sent by HttpChannelChild before
calling onStopRequest for a channel.

This patch also updates some comments regarding the on stop topic
which referenced the non-existent http-on-stop-connect

Assignee: nobody → valentin.gosu
Status: NEW → ASSIGNED
Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged]
Pushed by valentin.gosu@gmail.com: https://hg.mozilla.org/integration/autoland/rev/b8bdd0ebb46b Add NS_HTTP_ON_BEFORE_STOP_REQUEST_TOPIC r=necko-reviewers,kershaw
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 125 Branch
Blocks: 1885559
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: