RESOLVED FIXED 228649
Attribute nw connections to the page bundle identifier
https://bugs.webkit.org/show_bug.cgi?id=228649
Summary Attribute nw connections to the page bundle identifier
youenn fablet
Reported 2021-07-30 10:23:07 PDT
Attribute nw connections to the page bundle identifier
Attachments
Patch (39.42 KB, patch)
2021-07-30 10:31 PDT, youenn fablet
no flags
Patch (40.05 KB, patch)
2021-08-02 00:47 PDT, youenn fablet
no flags
Patch for landing (40.05 KB, patch)
2021-08-02 11:04 PDT, youenn fablet
no flags
Patch for landing (40.28 KB, patch)
2021-08-02 11:21 PDT, youenn fablet
ews-feeder: commit-queue-
Patch for landing (40.27 KB, patch)
2021-08-02 11:33 PDT, youenn fablet
ews-feeder: commit-queue-
youenn fablet
Comment 1 2021-07-30 10:31:32 PDT
youenn fablet
Comment 2 2021-08-02 00:47:51 PDT
Radar WebKit Bug Importer
Comment 3 2021-08-02 09:43:09 PDT
Eric Carlson
Comment 4 2021-08-02 09:44:19 PDT
Comment on attachment 434743 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=434743&action=review > Source/WebKit/NetworkProcess/NetworkSession.cpp:411 > + return m_attributedBundleIdentifierFromPageIdentifiers.get(identifier); It is worth ASSERTing that the identifier is in the map? > Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp:159 > + if (auto socket = NetworkRTCUDPSocketCocoa::createUDPSocket(identifier, *this, address.value, minPort, maxPort, m_ipcConnection.copyRef(), String(attributedBundleIdentifierFromPageIdentifier(pageIdentifier)), isFirstParty, isRelayDisabled, WTFMove(domain))) { Nit: extra space before `WTFMove` Is this called often enough that it would be worth keeping a pageIdentifier -> attributedBundleIdentifier map in the provider instead of doing the synchronous cross-thread hop every time? > Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp:202 > + if (auto socket = NetworkRTCTCPSocketCocoa::createClientTCPSocket(identifier, *this, remoteAddress.value, options, attributedBundleIdentifierFromPageIdentifier(pageIdentifier), isRelayDisabled, m_ipcConnection.copyRef())) { Ditto.
Alex Christensen
Comment 5 2021-08-02 10:50:34 PDT
Comment on attachment 434743 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=434743&action=review > Source/WebKit/ChangeLog:9 > + Use page identifier to get the bundle identifier. attributed bundle identifier, not the bundle identifier. The former is set via SPI in contexts such as SFSafariViewController when the view is made on behalf of another application, the latter is set for the executable. >> Source/WebKit/NetworkProcess/NetworkSession.cpp:411 >> + return m_attributedBundleIdentifierFromPageIdentifiers.get(identifier); > > It is worth ASSERTing that the identifier is in the map? no, it is likely not in the map. > Source/WebKit/NetworkProcess/NetworkSession.h:180 > + String attributedBundleIdentifierFromPageIdentifier(WebPageProxyIdentifier) const; This could return a const String& > Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp:149 > + return value; I feel like there should be an isolatedCopy somewhere in here.
youenn fablet
Comment 6 2021-08-02 11:04:57 PDT
Created attachment 434771 [details] Patch for landing
youenn fablet
Comment 7 2021-08-02 11:11:25 PDT
> > Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp:159 > > + if (auto socket = NetworkRTCUDPSocketCocoa::createUDPSocket(identifier, *this, address.value, minPort, maxPort, m_ipcConnection.copyRef(), String(attributedBundleIdentifierFromPageIdentifier(pageIdentifier)), isFirstParty, isRelayDisabled, WTFMove(domain))) { > > Nit: extra space before `WTFMove` OK > Is this called often enough that it would be worth keeping a pageIdentifier > -> attributedBundleIdentifier map in the provider instead of doing the > synchronous cross-thread hop every time? Yep, this is in the patch. > > Source/WebKit/ChangeLog:9 > > + Use page identifier to get the bundle identifier. > > attributed bundle identifier, not the bundle identifier. The former is set > via SPI in contexts such as SFSafariViewController when the view is made on > behalf of another application, the latter is set for the executable. OK > > Source/WebKit/NetworkProcess/NetworkSession.h:180 > > + String attributedBundleIdentifierFromPageIdentifier(WebPageProxyIdentifier) const; > > This could return a const String& OK > > Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp:149 > > + return value; > > I feel like there should be an isolatedCopy somewhere in here. There is one when adding the NetworkSession string to the NetworkRTCProvider map (line 147). I do not think we need an isolated copy every time we return the string: - The map is only accessed in the background thread. - The sockets keep a ref of the strings but the sockets are deleted in the background thread.
youenn fablet
Comment 8 2021-08-02 11:11:55 PDT
> - The map is only accessed in the background thread. I'll clear the map in the background thread when closing even though this is not strictly needed.
youenn fablet
Comment 9 2021-08-02 11:21:05 PDT
Created attachment 434776 [details] Patch for landing
youenn fablet
Comment 10 2021-08-02 11:33:05 PDT
Created attachment 434778 [details] Patch for landing
EWS
Comment 11 2021-08-02 14:09:59 PDT
Committed r280556 (240180@main): <https://commits.webkit.org/240180@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 434778 [details].
Note You need to log in before you can comment on or make changes to this bug.