Closed Bug 1899563 Opened 1 month ago Closed 1 month ago

Perform SW upgrade before http-on-before-connect

Categories

(Core :: Networking, task, P2)

task
Points:
1

Tracking

()

RESOLVED FIXED
128 Branch
Tracking Status
firefox128 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

Details

(Whiteboard: [necko-triaged][necko-priority-next][webdriver:m11])

Attachments

(1 file)

With Bug 1880803, the NetworkObserver can create network events as early as http-on-before-connect. However at that point requests which are supposed to be handled by a service worker are still using an early channel that will be swapped with another channel (but keeping the same channelId) later.

With our current implementation, the NetworkObserver sets up a Response listener as soon as we detect the channel (here), but since the channel is going to be replaced later on, this leads to various issues.

If the SW upgrade could be performed before http-on-before-connect, then we would always deal with the "final" channel and this would simplify handling of service worker requests for DevTools and BiDi.

Discussed about this with :Valentin on slack. If this proves difficult to change, let me know, I can probably try to handle it differently in the NetworkObserver.

Component: Netmonitor → Networking
Product: DevTools → Core

I think this should be as easy as moving the lines here https://searchfox.org/mozilla-central/rev/ccb101be8f27d837b655ccee51a52c0337dd1eb8/netwerk/protocol/http/nsHttpChannel.cpp#879-881 to line 863, just before calling OnBeforeConnect.
If this doesn't cause any issues on try it should be easy to land... otherwise we might have to figure out how things should really work :)

Severity: -- → S3
Points: --- → 1
Priority: -- → P2
Whiteboard: [necko-triaged][necko-priority-next]

(In reply to Valentin Gosu [:valentin] (he/him) from comment #2)

I think this should be as easy as moving the lines here https://searchfox.org/mozilla-central/rev/ccb101be8f27d837b655ccee51a52c0337dd1eb8/netwerk/protocol/http/nsHttpChannel.cpp#879-881 to line 863, just before calling OnBeforeConnect.
If this doesn't cause any issues on try it should be easy to land... otherwise we might have to figure out how things should really work :)

Just tried it locally and it seems to work fine, and it fixes my issues with service worker requests in WebDriver BiDi! I'll check if try is happy with this.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Blocks: 1899789
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dfa0c6371ff0
Upgrade service worker request before http-on-before-connect r=valentin,necko-reviewers,asuth
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch
Whiteboard: [necko-triaged][necko-priority-next] → [web
Whiteboard: [web → [necko-triaged][necko-priority-next][webdriver:m11]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: