Closed Bug 1544799 Opened 5 years ago Closed 5 years ago

Socket process needs to support NeckoChild

Categories

(Core :: Networking, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla68
Fission Milestone M2
Tracking Status
firefox68 --- fixed

People

(Reporter: bwc, Assigned: kershaw)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

Webrtc http proxy (to a TURN TCP server) support needs the following under the hood:

https://searchfox.org/mozilla-central/rev/1b2636e8517aa48422ed516affe4d28cb7fa220a/netwerk/ipc/NeckoParent.cpp#336

This is because the underlying implementation needs an nsIAuthProvider here:

https://searchfox.org/mozilla-central/rev/1b2636e8517aa48422ed516affe4d28cb7fa220a/media/mtransport/ipc/WebrtcProxyChannel.cpp#52

This is so the http channel can get the auth prompt for proxy credentials.

This code works fine on the parent process, but does not on the socket process. Presumably, someday the socket process will be able to open an http channel with auth support, but I don't know how close we are to having something like that, or what the API might look like. We might be able to work around this problem by using the NeckoChild API on the socket process, and running this code on the parent just like we do in the case where there is no socket process.

What do you think the way forward is here?

Flags: needinfo?(honzab.moz)
Type: defect → enhancement

I no longer lead the project.

Flags: needinfo?(honzab.moz) → needinfo?(dd.mozilla)

I'll take a look at this one.

Assignee: nobody → kershaw
Flags: needinfo?(dd.mozilla)

(In reply to Byron Campen [:bwc] from comment #0)

Webrtc http proxy (to a TURN TCP server) support needs the following under the hood:

https://searchfox.org/mozilla-central/rev/1b2636e8517aa48422ed516affe4d28cb7fa220a/netwerk/ipc/NeckoParent.cpp#336

This is because the underlying implementation needs an nsIAuthProvider here:

https://searchfox.org/mozilla-central/rev/1b2636e8517aa48422ed516affe4d28cb7fa220a/media/mtransport/ipc/WebrtcProxyChannel.cpp#52

This is so the http channel can get the auth prompt for proxy credentials.

This code works fine on the parent process, but does not on the socket process. Presumably, someday the socket process will be able to open an http channel with auth support, but I don't know how close we are to having something like that, or what the API might look like. We might be able to work around this problem by using the NeckoChild API on the socket process, and running this code on the parent just like we do in the case where there is no socket process.

Can you explain to me how you did it with NeckoChild API without the socket process?
Can you point me to the code? I am interested to know because I may need something similar.
Thanks

Flags: needinfo?(docfaraday)

This code works fine on the parent process, but does not on the socket process. Presumably, someday the socket process will be able to open an http channel with auth support, but I don't know how close we are to having something like that, or what the API might look like. We might be able to work around this problem by using the NeckoChild API on the socket process, and running this code on the parent just like we do in the case where there is no socket process.

I am not sure when we can support creating an http channel on socket process. FWIW, we need something similar for supporting TRR on socket process.

A short term solution could be still creating WebrtcProxyChannel on parent process. To do this, we have to:

  1. Send the TabId to socket process. Note that we can't use PBrowserOrId. We have to use TabId since we don't have TabParent on socket process.
  2. Make socket process child support "NeckoChild API", which I think is SendPWebrtcProxyChannelConstructor.
  3. Create WebrtcProxyChannelParent on parent process and use the TabId to get the correct TabParent.
  4. The rest is the same.

I think we can implement the workaround first and file a follow up bug for directly using WebrtcProxyChannel on socket process.

(In reply to Dragana Damjanovic [:dragana] from comment #4)

(In reply to Byron Campen [:bwc] from comment #0)

Webrtc http proxy (to a TURN TCP server) support needs the following under the hood:

https://searchfox.org/mozilla-central/rev/1b2636e8517aa48422ed516affe4d28cb7fa220a/netwerk/ipc/NeckoParent.cpp#336

This is because the underlying implementation needs an nsIAuthProvider here:

https://searchfox.org/mozilla-central/rev/1b2636e8517aa48422ed516affe4d28cb7fa220a/media/mtransport/ipc/WebrtcProxyChannel.cpp#52

This is so the http channel can get the auth prompt for proxy credentials.

This code works fine on the parent process, but does not on the socket process. Presumably, someday the socket process will be able to open an http channel with auth support, but I don't know how close we are to having something like that, or what the API might look like. We might be able to work around this problem by using the NeckoChild API on the socket process, and running this code on the parent just like we do in the case where there is no socket process.

Can you explain to me how you did it with NeckoChild API without the socket process?
Can you point me to the code? I am interested to know because I may need something similar.
Thanks

So in the non-socket-process case, the content process uses the PWebrtcProxyChannel protocol. This protocol relies on gNeckoChild here, because it is managed by PNecko:

https://searchfox.org/mozilla-central/rev/d33d470140ce3f9426af523eaa8ecfa83476c806/media/mtransport/ipc/WebrtcProxyChannelChild.cpp#80

https://searchfox.org/mozilla-central/rev/d33d470140ce3f9426af523eaa8ecfa83476c806/media/mtransport/ipc/PWebrtcProxyChannel.ipdl#17

In the socket process case, the code that uses PWebrtcProxyChannel runs in the socket process, because it is internal to our transport code:

https://searchfox.org/mozilla-central/rev/d33d470140ce3f9426af523eaa8ecfa83476c806/media/mtransport/nr_socket_proxy.cpp#107

This does not work for a number of reasons right now, but I can fix most of them. The sticking point is that WebrtcProxyChannelChild cannot be used on the socket process, because it requires PNeckoChild, which works only on the content process.

I could attempt to teach our transport code to avoid using IPC for the proxy stuff, and just use the real implementation, but the real implementation also does not work on the socket process because of the TabParent problem.

Flags: needinfo?(docfaraday)

(In reply to Kershaw Chang [:kershaw] from comment #5)

This code works fine on the parent process, but does not on the socket process. Presumably, someday the socket process will be able to open an http channel with auth support, but I don't know how close we are to having something like that, or what the API might look like. We might be able to work around this problem by using the NeckoChild API on the socket process, and running this code on the parent just like we do in the case where there is no socket process.

I am not sure when we can support creating an http channel on socket process. FWIW, we need something similar for supporting TRR on socket process.

A short term solution could be still creating WebrtcProxyChannel on parent process. To do this, we have to:

  1. Send the TabId to socket process. Note that we can't use PBrowserOrId. We have to use TabId since we don't have TabParent on socket process.

Yep, I already have a prototype that does this.

  1. Make socket process child support "NeckoChild API", which I think is SendPWebrtcProxyChannelConstructor.

Right; if the socket process can use the NeckoChild, I think my prototype code will work.

  1. Create WebrtcProxyChannelParent on parent process and use the TabId to get the correct TabParent.

Yep; I have this code written already.

  1. The rest is the same.

I think we can implement the workaround first and file a follow up bug for directly using WebrtcProxyChannel on socket process.

That sounds great!

Summary: Socket process either needs to support TabParent, or NeckoChild → Socket process either needs to support NeckoChild
Summary: Socket process either needs to support NeckoChild → Socket process needs to support NeckoChild

:bwc, could you try to apply this patch [1] and see if this works with your prototype?
Thanks.

[1] https://phabricator.services.mozilla.com/D28038

Flags: needinfo?(docfaraday)

Yes, I am able to make this work with my prototype! Just tested a webrtc TURN TCP call through an http proxy, and it worked with and without a socket process!

Flags: needinfo?(docfaraday)
Fission Milestone: --- → M2
Priority: -- → P2
Whiteboard: [necko-triaged]
Blocks: 1545827
Pushed by kjang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/56f46d0eafe2
Make PSocketProcess manage PWebrtcProxyChannel r=dragana
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: