A WebCore::WebSocketChannel is created unconditionally in WorkerThreadableWebSocketChannel::Peer.
Created attachment 374960 [details] Patch
Related a couple bugs that this will hopefully fix.
Committed r247902: <https://trac.webkit.org/changeset/247902>
<rdar://problem/53653192>
I don't think this is related to bug #199906 since that's a Safari bug report and Safari releases are not using the new CFNet WebSockets yet. This could only fix problems in the new codepath, not the old one. Also bug #193636 predates the new codepath by a lot. Thanks for looking for possibly-related bugs though!
The problem in bug 199906 is that WebSockets in service workers attempt to use in-process loading instead of Networking process. This patch doesn't fix that, but I think that the nature of the issue is similar enough for someone working on that to be aware of this too.