Closed Bug 1815934 Opened 2 years ago Closed 2 years ago

Early Hints: Verify in Parent that channel connecting from content process is the same as the channel in EarlyHintPreloader

Categories

(Core :: Networking: HTTP, defect, P2)

defect

Tracking

()

RESOLVED FIXED
115 Branch
Tracking Status
firefox115 --- fixed

People

(Reporter: manuel, Assigned: manuel)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file, 3 obsolete files)

No description provided.

One way of doing this would be to store the EarlyHintRegistrar in the ContentParent instead of a global one. Maybe we can remove the need of the EarlyHintRegistrar by storing the EarlyHintsService in ContentProcess.

That would have the benefits that we could clear up the EarlyHint preloads when the tab gets closed no matter where in the process we are in (reducing the need for the ParentConnectTimout timer).

Roughly the plan:

  • Have a structure like OngoingEarlyHints that gets stored in ContentParent, right before or within the DocumentLoadListener::RedirectToRealChannel. Essentially moving the ownership of OngoingEarlyHints from DocumentLoadListener to ContentParent. This allows us to cancel all Early Hints when the tab gets closed (and the ContentParent destructed). I either reuse the OngoingEarlyHint class or create a new one that can't add further preloads.
  • The earlyHintPreloadId will be the index in the array of OngoingEarlyHints holding the EarlyHintPreloaders.
  • When the HttpChannelParent connects back, the EarlyHintPreloader gets removed from the array, moving the ownership to the new HttpChannelParent. (similar to how the EarlyHintPreloader gets removed from the EarlyHintRegistrar now.
Assignee: nobody → manuel
Status: NEW → ASSIGNED

A problem I currently have implementing checks is, that when Registering the EarlyHintPreloaders

https://searchfox.org/mozilla-central/rev/aa3ccd258b64abfd4c5ce56c1f512bc7f65b844c/netwerk/ipc/DocumentLoadListener.cpp#2143

mEarlyHintsService.RegisterLinksAndGetConnectArgs(ehArgs);

the ContentParent isn't available for loads initiated in the parent:

https://searchfox.org/mozilla-central/rev/aa3ccd258b64abfd4c5ce56c1f512bc7f65b844c/netwerk/ipc/DocumentLoadListener.cpp#964-965,1019,1025

Therefore I can neither store the EarlyHintRegistrar in the ContentParent nor pass the processId of the ContentParent to the EarlyHintPreloaders for later verfication.

Also the mParentChannelListener->GetBrowsingContext()->OwnerProcessId() == 0 in DocumentLoadListener during that stage.

To verify in Parent that channel connecting from content process is the same as the channel in EarlyHintPreloader

Attached file Bug 1815934 - Add timer back r=#necko (obsolete) —

This commit is planned to be squashed with the previous one.

Depends on D171557

To verify in Parent that channel connecting from content process is the same as the channel in EarlyHintPreloader

Attachment #9321009 - Attachment is obsolete: true
Attachment #9326264 - Attachment is obsolete: true
Attachment #9321008 - Attachment description: Bug 1815934 - Separate EarlyHintRegistrar by ContentParent r=#necko → WIP: Bug 1815934 - Separate EarlyHintRegistrar by ContentParent r=#necko
Attachment #9321008 - Attachment is obsolete: true
Pushed by mbucher@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d8f21cb15dfe Only allow correct ContentParent to connect to EarlyHintPreloader r=necko-reviewers,kershaw
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 115 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: