<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[282910] branches/safari-612-branch/Source/WebKit</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/282910">282910</a></dd>
<dt>Author</dt> <dd>repstein@apple.com</dd>
<dt>Date</dt> <dd>2021-09-22 21:29:08 -0700 (Wed, 22 Sep 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Cherry-pick <a href="http://trac.webkit.org/projects/webkit/changeset/281982">r281982</a>. rdar://problem/83430119

    Enable WebRTC relay for SafariViewController
    https://bugs.webkit.org/show_bug.cgi?id=229768

    Reviewed by Eric Carlson.

    Use source application bundle identifier instead of attributed bundle identifier for nw_parameters_set_source_application_by_bundle_id.
    Use attributed bundle identifier for nw_parameters_set_attributed_bundle_identifier.
    Make sure to not set token data in case application bundle identifier is available.
    This allows the OS to decide whether to relay the nw_connections or not.

    Introduce a helper routine to share more code between UDP and TCP sockets.

    Manually tested as testing relay would require non-localhost connections
    and an application bundle identifier that would be known by the OS.

    * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
    (WebKit::NetworkRTCProvider::NetworkRTCProvider):
    * NetworkProcess/webrtc/NetworkRTCProvider.h:
    (WebKit::NetworkRTCProvider::applicationBundleIdentifier const):
    * NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm:
    (WebKit::NetworkRTCTCPSocketCocoa::NetworkRTCTCPSocketCocoa):
    * NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
    (WebKit::NetworkRTCUDPSocketCocoaConnections::NetworkRTCUDPSocketCocoaConnections):
    (WebKit::NetworkRTCUDPSocketCocoaConnections::configureParameters):
    * NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.h: Added.
    * NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.mm: Added.
    (WebKit::setNWParametersApplicationIdentifiers):
    * Platform/spi/Cocoa/NWParametersSPI.h:
    * WebKit.xcodeproj/project.pbxproj:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281982 268f45cc-cd09-0410-ab3c-d52691b4dbfc</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari612branchSourceWebKitChangeLog">branches/safari-612-branch/Source/WebKit/ChangeLog</a></li>
<li><a href="#branchessafari612branchSourceWebKitNetworkProcesswebrtcNetworkRTCProvidercpp">branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp</a></li>
<li><a href="#branchessafari612branchSourceWebKitNetworkProcesswebrtcNetworkRTCProviderh">branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.h</a></li>
<li><a href="#branchessafari612branchSourceWebKitNetworkProcesswebrtcNetworkRTCTCPSocketCocoamm">branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm</a></li>
<li><a href="#branchessafari612branchSourceWebKitNetworkProcesswebrtcNetworkRTCUDPSocketCocoamm">branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm</a></li>
<li><a href="#branchessafari612branchSourceWebKitPlatformspiCocoaNWParametersSPIh">branches/safari-612-branch/Source/WebKit/Platform/spi/Cocoa/NWParametersSPI.h</a></li>
<li><a href="#branchessafari612branchSourceWebKitWebKitxcodeprojprojectpbxproj">branches/safari-612-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari612branchSourceWebKitNetworkProcesswebrtcNetworkRTCUtilitiesCocoah">branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.h</a></li>
<li><a href="#branchessafari612branchSourceWebKitNetworkProcesswebrtcNetworkRTCUtilitiesCocoamm">branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari612branchSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebKit/ChangeLog (282909 => 282910)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebKit/ChangeLog       2021-09-23 04:29:04 UTC (rev 282909)
+++ branches/safari-612-branch/Source/WebKit/ChangeLog  2021-09-23 04:29:08 UTC (rev 282910)
</span><span class="lines">@@ -1,5 +1,74 @@
</span><span class="cx"> 2021-09-22  Alan Coon  <alancoon@apple.com>
</span><span class="cx"> 
</span><ins>+        Cherry-pick r281982. rdar://problem/83430119
+
+    Enable WebRTC relay for SafariViewController
+    https://bugs.webkit.org/show_bug.cgi?id=229768
+    
+    Reviewed by Eric Carlson.
+    
+    Use source application bundle identifier instead of attributed bundle identifier for nw_parameters_set_source_application_by_bundle_id.
+    Use attributed bundle identifier for nw_parameters_set_attributed_bundle_identifier.
+    Make sure to not set token data in case application bundle identifier is available.
+    This allows the OS to decide whether to relay the nw_connections or not.
+    
+    Introduce a helper routine to share more code between UDP and TCP sockets.
+    
+    Manually tested as testing relay would require non-localhost connections
+    and an application bundle identifier that would be known by the OS.
+    
+    * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
+    (WebKit::NetworkRTCProvider::NetworkRTCProvider):
+    * NetworkProcess/webrtc/NetworkRTCProvider.h:
+    (WebKit::NetworkRTCProvider::applicationBundleIdentifier const):
+    * NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm:
+    (WebKit::NetworkRTCTCPSocketCocoa::NetworkRTCTCPSocketCocoa):
+    * NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
+    (WebKit::NetworkRTCUDPSocketCocoaConnections::NetworkRTCUDPSocketCocoaConnections):
+    (WebKit::NetworkRTCUDPSocketCocoaConnections::configureParameters):
+    * NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.h: Added.
+    * NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.mm: Added.
+    (WebKit::setNWParametersApplicationIdentifiers):
+    * Platform/spi/Cocoa/NWParametersSPI.h:
+    * WebKit.xcodeproj/project.pbxproj:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281982 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-09-03  Youenn Fablet  <youenn@apple.com>
+
+            Enable WebRTC relay for SafariViewController
+            https://bugs.webkit.org/show_bug.cgi?id=229768
+
+            Reviewed by Eric Carlson.
+
+            Use source application bundle identifier instead of attributed bundle identifier for nw_parameters_set_source_application_by_bundle_id.
+            Use attributed bundle identifier for nw_parameters_set_attributed_bundle_identifier.
+            Make sure to not set token data in case application bundle identifier is available.
+            This allows the OS to decide whether to relay the nw_connections or not.
+
+            Introduce a helper routine to share more code between UDP and TCP sockets.
+
+            Manually tested as testing relay would require non-localhost connections
+            and an application bundle identifier that would be known by the OS.
+
+            * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
+            (WebKit::NetworkRTCProvider::NetworkRTCProvider):
+            * NetworkProcess/webrtc/NetworkRTCProvider.h:
+            (WebKit::NetworkRTCProvider::applicationBundleIdentifier const):
+            * NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm:
+            (WebKit::NetworkRTCTCPSocketCocoa::NetworkRTCTCPSocketCocoa):
+            * NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
+            (WebKit::NetworkRTCUDPSocketCocoaConnections::NetworkRTCUDPSocketCocoaConnections):
+            (WebKit::NetworkRTCUDPSocketCocoaConnections::configureParameters):
+            * NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.h: Added.
+            * NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.mm: Added.
+            (WebKit::setNWParametersApplicationIdentifiers):
+            * Platform/spi/Cocoa/NWParametersSPI.h:
+            * WebKit.xcodeproj/project.pbxproj:
+
+2021-09-22  Alan Coon  <alancoon@apple.com>
+
</ins><span class="cx">         Cherry-pick r281960. rdar://problem/83429573
</span><span class="cx"> 
</span><span class="cx">     [iOS] Gather logs for IOKit class
</span></span></pre></div>
<a id="branchessafari612branchSourceWebKitNetworkProcesswebrtcNetworkRTCProvidercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp (282909 => 282910)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp    2021-09-23 04:29:04 UTC (rev 282909)
+++ branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp       2021-09-23 04:29:08 UTC (rev 282910)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx"> #include "NetworkRTCResolverCocoa.h"
</span><span class="cx"> #include "NetworkRTCTCPSocketCocoa.h"
</span><span class="cx"> #include "NetworkRTCUDPSocketCocoa.h"
</span><ins>+#include "NetworkSessionCocoa.h"
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -91,6 +92,10 @@
</span><span class="cx">     , m_sourceApplicationAuditToken(connection.networkProcess().sourceApplicationAuditToken())
</span><span class="cx"> #endif
</span><span class="cx"> {
</span><ins>+#if PLATFORM(COCOA)
+    if (auto* session = static_cast<NetworkSessionCocoa*>(connection.networkSession()))
+        m_applicationBundleIdentifier = session->sourceApplicationBundleIdentifier().utf8();
+#endif
</ins><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     rtc::LogMessage::SetLogOutput(WebKit2LogWebRTC.state == WTFLogChannelState::On ? rtc::LS_INFO : rtc::LS_WARNING, doReleaseLogging);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari612branchSourceWebKitNetworkProcesswebrtcNetworkRTCProviderh"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.h (282909 => 282910)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.h      2021-09-23 04:29:04 UTC (rev 282909)
+++ branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.h 2021-09-23 04:29:08 UTC (rev 282910)
</span><span class="lines">@@ -108,6 +108,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     const std::optional<audit_token_t>& sourceApplicationAuditToken() const { return m_sourceApplicationAuditToken; }
</span><ins>+    const char* applicationBundleIdentifier() const { return m_applicationBundleIdentifier.data(); }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -160,6 +161,7 @@
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     HashMap<WebPageProxyIdentifier, String> m_attributedBundleIdentifiers;
</span><span class="cx">     std::optional<audit_token_t> m_sourceApplicationAuditToken;
</span><ins>+    CString m_applicationBundleIdentifier;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> };
</span></span></pre></div>
<a id="branchessafari612branchSourceWebKitNetworkProcesswebrtcNetworkRTCTCPSocketCocoamm"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm (282909 => 282910)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm       2021-09-23 04:29:04 UTC (rev 282909)
+++ branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm  2021-09-23 04:29:08 UTC (rev 282910)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "LibWebRTCNetworkMessages.h"
</span><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "NWParametersSPI.h"
</span><ins>+#include "NetworkRTCUtilitiesCocoa.h"
</ins><span class="cx"> #include <WebCore/STUNMessageParsing.h>
</span><span class="cx"> #include <dispatch/dispatch.h>
</span><span class="cx"> #include <wtf/BlockPtr.h>
</span><span class="lines">@@ -96,10 +97,8 @@
</span><span class="cx">         nw_tcp_options_set_no_delay(tcp_options, true);
</span><span class="cx">     }));
</span><span class="cx"> 
</span><del>-    if (auto token = rtcProvider.sourceApplicationAuditToken())
-        nw_parameters_set_source_application(tcpTLS.get(), *token);
-    if (!attributedBundleIdentifier.isEmpty())
-        nw_parameters_set_source_application_by_bundle_id(tcpTLS.get(), attributedBundleIdentifier.utf8().data());
</del><ins>+    setNWParametersApplicationIdentifiers(tcpTLS.get(), rtcProvider.applicationBundleIdentifier(), rtcProvider.sourceApplicationAuditToken(), attributedBundleIdentifier);
+
</ins><span class="cx">     if (isRelayDisabled)
</span><span class="cx">         nw_parameters_set_account_id(tcpTLS.get(), "com.apple.safari.peertopeer");
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari612branchSourceWebKitNetworkProcesswebrtcNetworkRTCUDPSocketCocoamm"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm (282909 => 282910)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm       2021-09-23 04:29:04 UTC (rev 282909)
+++ branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm  2021-09-23 04:29:08 UTC (rev 282910)
</span><span class="lines">@@ -78,6 +78,7 @@
</span><span class="cx"> #endif
</span><span class="cx">     bool m_shouldBypassRelay { false };
</span><span class="cx"> 
</span><ins>+    CString m_sourceApplicationBundleIdentifier;
</ins><span class="cx">     std::optional<audit_token_t> m_sourceApplicationAuditToken;
</span><span class="cx">     String m_attributedBundleIdentifier;
</span><span class="cx"> 
</span><span class="lines">@@ -166,6 +167,7 @@
</span><span class="cx">     , m_isKnownTracker(isKnownTracker(domain))
</span><span class="cx"> #endif
</span><span class="cx">     , m_shouldBypassRelay(isRelayDisabled)
</span><ins>+    , m_sourceApplicationBundleIdentifier(rtcProvider.applicationBundleIdentifier())
</ins><span class="cx">     , m_sourceApplicationAuditToken(rtcProvider.sourceApplicationAuditToken())
</span><span class="cx">     , m_attributedBundleIdentifier(WTFMove(attributedBundleIdentifier))
</span><span class="cx"> {
</span><span class="lines">@@ -242,10 +244,7 @@
</span><span class="cx">     nw_parameters_set_is_known_tracker(parameters, m_isKnownTracker);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    if (m_sourceApplicationAuditToken)
-        nw_parameters_set_source_application(parameters, *m_sourceApplicationAuditToken);
-    if (!m_attributedBundleIdentifier.isEmpty())
-        nw_parameters_set_source_application_by_bundle_id(parameters, m_attributedBundleIdentifier.utf8().data());
</del><ins>+    setNWParametersApplicationIdentifiers(parameters, m_sourceApplicationBundleIdentifier.data(), m_sourceApplicationAuditToken, m_attributedBundleIdentifier);
</ins><span class="cx"> 
</span><span class="cx">     nw_parameters_set_reuse_local_address(parameters, true);
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari612branchSourceWebKitNetworkProcesswebrtcNetworkRTCUtilitiesCocoahfromrev282909branchessafari612branchSourceWebKitPlatformspiCocoaNWParametersSPIh"></a>
<div class="copfile"><h4>Copied: branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.h (from rev 282909, branches/safari-612-branch/Source/WebKit/Platform/spi/Cocoa/NWParametersSPI.h) (0 => 282910)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.h                                (rev 0)
+++ branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.h   2021-09-23 04:29:08 UTC (rev 282910)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if USE(LIBWEBRTC)
+
+#include "NWParametersSPI.h"
+#include <optional>
+#include <wtf/Forward.h>
+
+namespace WebKit {
+
+void setNWParametersApplicationIdentifiers(nw_parameters_t, const char* sourceApplicationBundleIdentifier, std::optional<audit_token_t>, const String& attributedBundleIdentifier);
+
+} // namespace WebKit
+
+#endif // USE(LIBWEBRTC)
</ins></span></pre></div>
<a id="branchessafari612branchSourceWebKitNetworkProcesswebrtcNetworkRTCUtilitiesCocoammfromrev282909branchessafari612branchSourceWebKitPlatformspiCocoaNWParametersSPIh"></a>
<div class="copfile"><h4>Copied: branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.mm (from rev 282909, branches/safari-612-branch/Source/WebKit/Platform/spi/Cocoa/NWParametersSPI.h) (0 => 282910)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.mm                               (rev 0)
+++ branches/safari-612-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.mm  2021-09-23 04:29:08 UTC (rev 282910)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "NetworkRTCUtilitiesCocoa.h"
+
+#if USE(LIBWEBRTC)
+
+#import <wtf/SoftLinking.h>
+#import <wtf/text/WTFString.h>
+
+#if HAVE(NWPARAMETERS_TRACKER_API)
+SOFT_LINK_LIBRARY_OPTIONAL(libnetwork)
+SOFT_LINK_OPTIONAL(libnetwork, nw_parameters_set_attributed_bundle_identifier, void, __cdecl, (nw_parameters_t, const char*))
+#endif
+
+namespace WebKit {
+
+void setNWParametersApplicationIdentifiers(nw_parameters_t parameters, const char* sourceApplicationBundleIdentifier, std::optional<audit_token_t> sourceApplicationAuditToken, const String& attributedBundleIdentifier)
+{
+    if (sourceApplicationBundleIdentifier && *sourceApplicationBundleIdentifier)
+        nw_parameters_set_source_application_by_bundle_id(parameters, sourceApplicationBundleIdentifier);
+    else if (sourceApplicationAuditToken)
+        nw_parameters_set_source_application(parameters, *sourceApplicationAuditToken);
+
+#if HAVE(NWPARAMETERS_TRACKER_API)
+    if (!attributedBundleIdentifier.isEmpty() && nw_parameters_set_attributed_bundle_identifierPtr())
+        nw_parameters_set_attributed_bundle_identifierPtr()(parameters, attributedBundleIdentifier.utf8().data());
+#endif
+}
+
+} // namespace WebKit
+
+#endif // USE(LIBWEBRTC)
</ins></span></pre></div>
<a id="branchessafari612branchSourceWebKitPlatformspiCocoaNWParametersSPIh"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebKit/Platform/spi/Cocoa/NWParametersSPI.h (282909 => 282910)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebKit/Platform/spi/Cocoa/NWParametersSPI.h    2021-09-23 04:29:04 UTC (rev 282909)
+++ branches/safari-612-branch/Source/WebKit/Platform/spi/Cocoa/NWParametersSPI.h       2021-09-23 04:29:08 UTC (rev 282910)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> void nw_parameters_set_account_id(nw_parameters_t, const char * account_id);
</span><span class="cx"> void nw_parameters_set_source_application(nw_parameters_t, audit_token_t);
</span><span class="cx"> void nw_parameters_set_source_application_by_bundle_id(nw_parameters_t, const char*);
</span><ins>+void nw_parameters_set_attributed_bundle_identifier(nw_parameters_t, const char*);
</ins><span class="cx"> nw_endpoint_t nw_endpoint_create_host_with_numeric_port(const char* hostname, uint16_t port_host_order);
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(NWPARAMETERS_TRACKER_API)
</span></span></pre></div>
<a id="branchessafari612branchSourceWebKitWebKitxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj (282909 => 282910)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2021-09-23 04:29:04 UTC (rev 282909)
+++ branches/safari-612-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj   2021-09-23 04:29:08 UTC (rev 282910)
</span><span class="lines">@@ -951,6 +951,7 @@
</span><span class="cx">          41DD72AB2682167300A90C71 /* NWParametersSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 41DD72AA2682167300A90C71 /* NWParametersSPI.h */; };
</span><span class="cx">          41DE7C6C22278F1E00532B65 /* ServiceWorkerFetchTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41518536222704F6005430C6 /* ServiceWorkerFetchTask.cpp */; };
</span><span class="cx">          41E0A7CB23B645CD00561060 /* WebSocketChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 417915AC2256BB7400D6F97E /* WebSocketChannel.cpp */; };
</span><ins>+               41E242E026E0C908009A8C64 /* NetworkRTCUtilitiesCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41E242DF26E0C904009A8C64 /* NetworkRTCUtilitiesCocoa.mm */; };
</ins><span class="cx">           41F060E11654318500F3281C /* WebSocketChannelMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F060DD1654317500F3281C /* WebSocketChannelMessageReceiver.cpp */; };
</span><span class="cx">          41FABD2A1F4DE001006A6C97 /* CacheStorageEngineCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FABD281F4DDFDC006A6C97 /* CacheStorageEngineCache.h */; };
</span><span class="cx">          41FAF5F51E3C0649001AE678 /* WebRTCResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FAF5F41E3C0641001AE678 /* WebRTCResolver.h */; };
</span><span class="lines">@@ -3873,6 +3874,8 @@
</span><span class="cx">          41E0A7C623B6397800561060 /* LibWebRTCCodecsProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LibWebRTCCodecsProxy.h; sourceTree = "<group>"; };
</span><span class="cx">          41E0A7C723B6397900561060 /* LibWebRTCCodecsProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = LibWebRTCCodecsProxy.messages.in; sourceTree = "<group>"; };
</span><span class="cx">          41E0A7C823B6397900561060 /* LibWebRTCCodecsProxy.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LibWebRTCCodecsProxy.mm; sourceTree = "<group>"; };
</span><ins>+               41E242DE26E0C8D6009A8C64 /* NetworkRTCUtilitiesCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NetworkRTCUtilitiesCocoa.h; sourceTree = "<group>"; };
+               41E242DF26E0C904009A8C64 /* NetworkRTCUtilitiesCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkRTCUtilitiesCocoa.mm; sourceTree = "<group>"; };
</ins><span class="cx">           41E67A8C25D2CFD0007B0A4C /* RemoteRealtimeAudioSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteRealtimeAudioSource.h; sourceTree = "<group>"; };
</span><span class="cx">          41E67A8D25D2CFD0007B0A4C /* RemoteRealtimeAudioSource.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteRealtimeAudioSource.cpp; sourceTree = "<group>"; };
</span><span class="cx">          41F060DD1654317500F3281C /* WebSocketChannelMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = WebSocketChannelMessageReceiver.cpp; path = DerivedSources/WebKit2/WebSocketChannelMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="lines">@@ -8493,6 +8496,8 @@
</span><span class="cx">                          410BA139257135F2002E2F8A /* NetworkRTCTCPSocketCocoa.mm */,
</span><span class="cx">                          41DD72A7267B8C3100A90C71 /* NetworkRTCUDPSocketCocoa.h */,
</span><span class="cx">                          41DD72A6267B8C3000A90C71 /* NetworkRTCUDPSocketCocoa.mm */,
</span><ins>+                               41E242DE26E0C8D6009A8C64 /* NetworkRTCUtilitiesCocoa.h */,
+                               41E242DF26E0C904009A8C64 /* NetworkRTCUtilitiesCocoa.mm */,
</ins><span class="cx">                           411223BC26024E8100B0A0B6 /* RTCDataChannelRemoteManagerProxy.cpp */,
</span><span class="cx">                          411223BB26024E8000B0A0B6 /* RTCDataChannelRemoteManagerProxy.h */,
</span><span class="cx">                          411223BD26024E8100B0A0B6 /* RTCDataChannelRemoteManagerProxy.messages.in */,
</span><span class="lines">@@ -14253,6 +14258,7 @@
</span><span class="cx">                          51F060E11654318500F3281E /* NetworkRTCMonitorMessageReceiver.cpp in Sources */,
</span><span class="cx">                          4176901422FDD41B00B1576D /* NetworkRTCProvider.mm in Sources */,
</span><span class="cx">                          51F060E11654318500F3282E /* NetworkRTCProviderMessageReceiver.cpp in Sources */,
</span><ins>+                               41E242E026E0C908009A8C64 /* NetworkRTCUtilitiesCocoa.mm in Sources */,
</ins><span class="cx">                           31F060E11654318500F3281C /* NetworkSocketChannelMessageReceiver.cpp in Sources */,
</span><span class="cx">                          5C0B17781E7C880E00E9123C /* NetworkSocketStreamMessageReceiver.cpp in Sources */,
</span><span class="cx">                          2D92A790212B6AD400F493FD /* NPIdentifierData.cpp in Sources */,
</span></span></pre>
</div>
</div>

</body>
</html>