<!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>[242383] branches/safari-607.1.40.0-branch</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/242383">242383</a></dd>
<dt>Author</dt> <dd>kocsen_chung@apple.com</dd>
<dt>Date</dt> <dd>2019-03-04 13:26:52 -0800 (Mon, 04 Mar 2019)</dd>
</dl>

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

    Add setters on WKWebsiteDataStore for sourceApplicationBundleIdentifier and sourceApplicationSecondaryIdentifier
    https://bugs.webkit.org/show_bug.cgi?id=195229
    <rdar://problem/48520362>

    Reviewed by Chris Dumez.

    Source/WebKit:

    Just like _setBoundInterfaceIdentifier, we need a way to set these properties after instantiation of a WKWebsiteDataStore,
    but we need to make sure we don't set it after the parameters have been copied to the NetworkProcess.

    Functionality verified by manual testing.  See radar.
    Added an API test that verifies the setter restrictions work as expected.

    * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
    (-[WKWebsiteDataStore _sourceApplicationBundleIdentifier]):
    (-[WKWebsiteDataStore _setSourceApplicationBundleIdentifier:]):
    (-[WKWebsiteDataStore _sourceApplicationSecondaryIdentifier]):
    (-[WKWebsiteDataStore _setSourceApplicationSecondaryIdentifier:]):
    * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
    * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
    (WebKit::toPKPaymentRequest):
    * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
    (WebKit::WebsiteDataStore::parameters):
    * UIProcess/WebsiteData/WebsiteDataStore.cpp:
    (WebKit::WebsiteDataStore::WebsiteDataStore):
    (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
    (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
    * UIProcess/WebsiteData/WebsiteDataStore.h:
    (WebKit::WebsiteDataStore::sourceApplicationBundleIdentifier):
    (WebKit::WebsiteDataStore::sourceApplicationSecondaryIdentifier):

    Tools:

    * TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:
    (TEST):

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

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6071400branchSourceWebKitChangeLog">branches/safari-607.1.40.0-branch/Source/WebKit/ChangeLog</a></li>
<li><a href="#branchessafari6071400branchSourceWebKitUIProcessAPICocoaWKWebsiteDataStoremm">branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm</a></li>
<li><a href="#branchessafari6071400branchSourceWebKitUIProcessAPICocoaWKWebsiteDataStorePrivateh">branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h</a></li>
<li><a href="#branchessafari6071400branchSourceWebKitUIProcessApplePaycocoaWebPaymentCoordinatorProxyCocoamm">branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm</a></li>
<li><a href="#branchessafari6071400branchSourceWebKitUIProcessWebProcessPoolcpp">branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/WebProcessPool.cpp</a></li>
<li><a href="#branchessafari6071400branchSourceWebKitUIProcessWebsiteDataCocoaWebsiteDataStoreCocoamm">branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm</a></li>
<li><a href="#branchessafari6071400branchSourceWebKitUIProcessWebsiteDataWebsiteDataStorecpp">branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp</a></li>
<li><a href="#branchessafari6071400branchSourceWebKitUIProcessWebsiteDataWebsiteDataStoreh">branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h</a></li>
<li><a href="#branchessafari6071400branchToolsChangeLog">branches/safari-607.1.40.0-branch/Tools/ChangeLog</a></li>
<li><a href="#branchessafari6071400branchToolsTestWebKitAPITestsWebKitCocoaWebsiteDataStoreCustomPathsmm">branches/safari-607.1.40.0-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6071400branchSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-607.1.40.0-branch/Source/WebKit/ChangeLog (242382 => 242383)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607.1.40.0-branch/Source/WebKit/ChangeLog        2019-03-04 21:20:14 UTC (rev 242382)
+++ branches/safari-607.1.40.0-branch/Source/WebKit/ChangeLog   2019-03-04 21:26:52 UTC (rev 242383)
</span><span class="lines">@@ -1,3 +1,78 @@
</span><ins>+2019-03-04  Null  <null@apple.com>
+
+        Cherry-pick r242302. rdar://problem/48520362
+
+    Add setters on WKWebsiteDataStore for sourceApplicationBundleIdentifier and sourceApplicationSecondaryIdentifier
+    https://bugs.webkit.org/show_bug.cgi?id=195229
+    <rdar://problem/48520362>
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebKit:
+    
+    Just like _setBoundInterfaceIdentifier, we need a way to set these properties after instantiation of a WKWebsiteDataStore,
+    but we need to make sure we don't set it after the parameters have been copied to the NetworkProcess.
+    
+    Functionality verified by manual testing.  See radar.
+    Added an API test that verifies the setter restrictions work as expected.
+    
+    * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+    (-[WKWebsiteDataStore _sourceApplicationBundleIdentifier]):
+    (-[WKWebsiteDataStore _setSourceApplicationBundleIdentifier:]):
+    (-[WKWebsiteDataStore _sourceApplicationSecondaryIdentifier]):
+    (-[WKWebsiteDataStore _setSourceApplicationSecondaryIdentifier:]):
+    * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
+    * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
+    (WebKit::toPKPaymentRequest):
+    * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+    (WebKit::WebsiteDataStore::parameters):
+    * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+    (WebKit::WebsiteDataStore::WebsiteDataStore):
+    (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
+    (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
+    * UIProcess/WebsiteData/WebsiteDataStore.h:
+    (WebKit::WebsiteDataStore::sourceApplicationBundleIdentifier):
+    (WebKit::WebsiteDataStore::sourceApplicationSecondaryIdentifier):
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:
+    (TEST):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242302 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-03-01  Alex Christensen  <achristensen@webkit.org>
+
+            Add setters on WKWebsiteDataStore for sourceApplicationBundleIdentifier and sourceApplicationSecondaryIdentifier
+            https://bugs.webkit.org/show_bug.cgi?id=195229
+            <rdar://problem/48520362>
+
+            Reviewed by Chris Dumez.
+
+            Just like _setBoundInterfaceIdentifier, we need a way to set these properties after instantiation of a WKWebsiteDataStore,
+            but we need to make sure we don't set it after the parameters have been copied to the NetworkProcess.
+
+            Functionality verified by manual testing.  See radar.
+            Added an API test that verifies the setter restrictions work as expected.
+
+            * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+            (-[WKWebsiteDataStore _sourceApplicationBundleIdentifier]):
+            (-[WKWebsiteDataStore _setSourceApplicationBundleIdentifier:]):
+            (-[WKWebsiteDataStore _sourceApplicationSecondaryIdentifier]):
+            (-[WKWebsiteDataStore _setSourceApplicationSecondaryIdentifier:]):
+            * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
+            * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
+            (WebKit::toPKPaymentRequest):
+            * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+            (WebKit::WebsiteDataStore::parameters):
+            * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+            (WebKit::WebsiteDataStore::WebsiteDataStore):
+            (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
+            (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
+            * UIProcess/WebsiteData/WebsiteDataStore.h:
+            (WebKit::WebsiteDataStore::sourceApplicationBundleIdentifier):
+            (WebKit::WebsiteDataStore::sourceApplicationSecondaryIdentifier):
+
</ins><span class="cx"> 2019-03-04  Babak Shafiei  <bshafiei@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Cherry-pick r242355. rdar://problem/48563891
</span></span></pre></div>
<a id="branchessafari6071400branchSourceWebKitUIProcessAPICocoaWKWebsiteDataStoremm"></a>
<div class="modfile"><h4>Modified: branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm (242382 => 242383)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm        2019-03-04 21:20:14 UTC (rev 242382)
+++ branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm   2019-03-04 21:26:52 UTC (rev 242383)
</span><span class="lines">@@ -318,6 +318,28 @@
</span><span class="cx">     _websiteDataStore->websiteDataStore().setProxyConfiguration((__bridge CFDictionaryRef)configuration);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (NSString *)_sourceApplicationBundleIdentifier
+{
+    return _websiteDataStore->websiteDataStore().sourceApplicationBundleIdentifier();
+}
+
+- (void)_setSourceApplicationBundleIdentifier:(NSString *)identifier
+{
+    if (!_websiteDataStore->websiteDataStore().setSourceApplicationBundleIdentifier(identifier))
+        [NSException raise:NSGenericException format:@"_setSourceApplicationBundleIdentifier cannot be called after networking has begun"];
+}
+
+- (NSString *)_sourceApplicationSecondaryIdentifier
+{
+    return _websiteDataStore->websiteDataStore().sourceApplicationSecondaryIdentifier();
+}
+
+- (void)_setSourceApplicationSecondaryIdentifier:(NSString *)identifier
+{
+    if (!_websiteDataStore->websiteDataStore().setSourceApplicationSecondaryIdentifier(identifier))
+        [NSException raise:NSGenericException format:@"_setSourceApplicationSecondaryIdentifier cannot be called after networking has begun"];
+}
+
</ins><span class="cx"> - (NSDictionary *)_proxyConfiguration
</span><span class="cx"> {
</span><span class="cx">     return (__bridge NSDictionary *)_websiteDataStore->websiteDataStore().proxyConfiguration();
</span></span></pre></div>
<a id="branchessafari6071400branchSourceWebKitUIProcessAPICocoaWKWebsiteDataStorePrivateh"></a>
<div class="modfile"><h4>Modified: branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h (242382 => 242383)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h  2019-03-04 21:20:14 UTC (rev 242382)
+++ branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h     2019-03-04 21:26:52 UTC (rev 242383)
</span><span class="lines">@@ -55,6 +55,8 @@
</span><span class="cx"> @property (nonatomic, setter=_setBoundInterfaceIdentifier:) NSString *_boundInterfaceIdentifier WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
</span><span class="cx"> @property (nonatomic, setter=_setAllowsCellularAccess:) BOOL _allowsCellularAccess WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
</span><span class="cx"> @property (nonatomic, setter=_setProxyConfiguration:) NSDictionary *_proxyConfiguration WK_API_AVAILABLE(macosx(10.14), ios(12.0));
</span><ins>+@property (nonatomic, copy, setter=_setSourceApplicationBundleIdentifier:) NSString *_sourceApplicationBundleIdentifier WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+@property (nonatomic, copy, setter=_setSourceApplicationSecondaryIdentifier:) NSString *_sourceApplicationSecondaryIdentifier WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
</ins><span class="cx"> 
</span><span class="cx"> - (void)_resourceLoadStatisticsSetShouldSubmitTelemetry:(BOOL)value WK_API_AVAILABLE(macosx(10.13), ios(11.0));
</span><span class="cx"> - (void)_setResourceLoadStatisticsTestingCallback:(nullable void (^)(WKWebsiteDataStore *, NSString *))callback WK_API_AVAILABLE(macosx(10.13), ios(11.0));
</span></span></pre></div>
<a id="branchessafari6071400branchSourceWebKitUIProcessApplePaycocoaWebPaymentCoordinatorProxyCocoamm"></a>
<div class="modfile"><h4>Modified: branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (242382 => 242383)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm      2019-03-04 21:20:14 UTC (rev 242382)
+++ branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2019-03-04 21:26:52 UTC (rev 242383)
</span><span class="lines">@@ -506,13 +506,13 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Instead of using respondsToSelector, this should use a proper #if version check.
</span><del>-    auto& configuration = webPageProxy.websiteDataStore().configuration();
</del><ins>+    auto& websiteDataStore = webPageProxy.websiteDataStore();
</ins><span class="cx"> 
</span><del>-    if (!configuration.sourceApplicationBundleIdentifier().isEmpty() && [result respondsToSelector:@selector(setSourceApplicationBundleIdentifier:)])
-        [result setSourceApplicationBundleIdentifier:configuration.sourceApplicationBundleIdentifier()];
</del><ins>+    if (!websiteDataStore.sourceApplicationBundleIdentifier().isEmpty() && [result respondsToSelector:@selector(setSourceApplicationBundleIdentifier:)])
+        [result setSourceApplicationBundleIdentifier:websiteDataStore.sourceApplicationBundleIdentifier()];
</ins><span class="cx"> 
</span><del>-    if (!configuration.sourceApplicationSecondaryIdentifier().isEmpty() && [result respondsToSelector:@selector(setSourceApplicationSecondaryIdentifier:)])
-        [result setSourceApplicationSecondaryIdentifier:configuration.sourceApplicationSecondaryIdentifier()];
</del><ins>+    if (!websiteDataStore.sourceApplicationSecondaryIdentifier().isEmpty() && [result respondsToSelector:@selector(setSourceApplicationSecondaryIdentifier:)])
+        [result setSourceApplicationSecondaryIdentifier:websiteDataStore.sourceApplicationSecondaryIdentifier()];
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS_FAMILY)
</span><span class="cx">     if (!webPageProxy.process().processPool().configuration().ctDataConnectionServiceType().isEmpty() && [result respondsToSelector:@selector(setCTDataConnectionServiceType:)])
</span></span></pre></div>
<a id="branchessafari6071400branchSourceWebKitUIProcessWebProcessPoolcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/WebProcessPool.cpp (242382 => 242383)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/WebProcessPool.cpp     2019-03-04 21:20:14 UTC (rev 242382)
+++ branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/WebProcessPool.cpp        2019-03-04 21:26:52 UTC (rev 242383)
</span><span class="lines">@@ -492,6 +492,9 @@
</span><span class="cx">     if (m_websiteDataStore) {
</span><span class="cx">         parameters.defaultDataStoreParameters.pendingCookies = copyToVector(m_websiteDataStore->websiteDataStore().pendingCookies());
</span><span class="cx">         m_websiteDataStore->websiteDataStore().clearPendingCookies();
</span><ins>+        parameters.defaultDataStoreParameters.networkSessionParameters.sourceApplicationBundleIdentifier = m_websiteDataStore->websiteDataStore().sourceApplicationBundleIdentifier();
+        parameters.defaultDataStoreParameters.networkSessionParameters.sourceApplicationSecondaryIdentifier = m_websiteDataStore->websiteDataStore().sourceApplicationSecondaryIdentifier();
+        m_websiteDataStore->websiteDataStore().finalizeApplicationIdentifiers();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     parameters.cacheModel = cacheModel();
</span></span></pre></div>
<a id="branchessafari6071400branchSourceWebKitUIProcessWebsiteDataCocoaWebsiteDataStoreCocoamm"></a>
<div class="modfile"><h4>Modified: branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (242382 => 242383)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm     2019-03-04 21:20:14 UTC (rev 242382)
+++ branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm        2019-03-04 21:26:52 UTC (rev 242383)
</span><span class="lines">@@ -89,13 +89,14 @@
</span><span class="cx">         m_boundInterfaceIdentifier,
</span><span class="cx">         m_allowsCellularAccess,
</span><span class="cx">         m_proxyConfiguration,
</span><del>-        m_configuration->sourceApplicationBundleIdentifier(),
-        m_configuration->sourceApplicationSecondaryIdentifier(),
</del><ins>+        m_sourceApplicationBundleIdentifier,
+        m_sourceApplicationSecondaryIdentifier,
</ins><span class="cx">         shouldLogCookieInformation,
</span><span class="cx">         Seconds { [defaults integerForKey:WebKitNetworkLoadThrottleLatencyMillisecondsDefaultsKey] / 1000. },
</span><span class="cx">         WTFMove(httpProxy),
</span><span class="cx">         WTFMove(httpsProxy),
</span><span class="cx">     };
</span><ins>+    finalizeApplicationIdentifiers();
</ins><span class="cx"> 
</span><span class="cx">     auto cookieFile = resolvedCookieStorageFile();
</span><span class="cx"> 
</span><span class="lines">@@ -107,8 +108,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     parameters.uiProcessCookieStorageIdentifier = m_uiProcessCookieStorageIdentifier;
</span><del>-    parameters.networkSessionParameters.sourceApplicationBundleIdentifier = m_configuration->sourceApplicationBundleIdentifier();
-    parameters.networkSessionParameters.sourceApplicationSecondaryIdentifier = m_configuration->sourceApplicationSecondaryIdentifier();
</del><ins>+    parameters.networkSessionParameters.sourceApplicationBundleIdentifier = m_sourceApplicationBundleIdentifier;
+    parameters.networkSessionParameters.sourceApplicationSecondaryIdentifier = m_sourceApplicationSecondaryIdentifier;
</ins><span class="cx"> 
</span><span class="cx">     parameters.pendingCookies = copyToVector(m_pendingCookies);
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6071400branchSourceWebKitUIProcessWebsiteDataWebsiteDataStorecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (242382 => 242383)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp       2019-03-04 21:20:14 UTC (rev 242382)
+++ branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp  2019-03-04 21:26:52 UTC (rev 242383)
</span><span class="lines">@@ -95,6 +95,8 @@
</span><span class="cx">     , m_storageManager(StorageManager::create(m_configuration->localStorageDirectory()))
</span><span class="cx">     , m_deviceIdHashSaltStorage(DeviceIdHashSaltStorage::create(isPersistent() ? m_configuration->deviceIdHashSaltsStorageDirectory() : String()))
</span><span class="cx">     , m_queue(WorkQueue::create("com.apple.WebKit.WebsiteDataStore"))
</span><ins>+    , m_sourceApplicationBundleIdentifier(m_configuration->sourceApplicationBundleIdentifier())
+    , m_sourceApplicationSecondaryIdentifier(m_configuration->sourceApplicationSecondaryIdentifier())
</ins><span class="cx"> #if ENABLE(WEB_AUTHN)
</span><span class="cx">     , m_authenticatorManager(makeUniqueRef<AuthenticatorManager>())
</span><span class="cx"> #endif
</span><span class="lines">@@ -1711,4 +1713,20 @@
</span><span class="cx">         m_resourceLoadStatistics->didCreateNetworkProcess();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool WebsiteDataStore::setSourceApplicationSecondaryIdentifier(String&& identifier)
+{
+    if (!m_allowedToSetApplicationIdentifiers)
+        return false;
+    m_sourceApplicationSecondaryIdentifier = WTFMove(identifier);
+    return true;
</ins><span class="cx"> }
</span><ins>+
+bool WebsiteDataStore::setSourceApplicationBundleIdentifier(String&& identifier)
+{
+    if (!m_allowedToSetApplicationIdentifiers)
+        return false;
+    m_sourceApplicationBundleIdentifier = WTFMove(identifier);
+    return true;
+}
+
+}
</ins></span></pre></div>
<a id="branchessafari6071400branchSourceWebKitUIProcessWebsiteDataWebsiteDataStoreh"></a>
<div class="modfile"><h4>Modified: branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (242382 => 242383)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2019-03-04 21:20:14 UTC (rev 242382)
+++ branches/safari-607.1.40.0-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h    2019-03-04 21:26:52 UTC (rev 242383)
</span><span class="lines">@@ -158,7 +158,15 @@
</span><span class="cx"> 
</span><span class="cx">     void setBoundInterfaceIdentifier(String&& identifier) { m_boundInterfaceIdentifier = WTFMove(identifier); }
</span><span class="cx">     const String& boundInterfaceIdentifier() { return m_boundInterfaceIdentifier; }
</span><ins>+
+    const String& sourceApplicationBundleIdentifier() const { return m_sourceApplicationBundleIdentifier; }
+    bool setSourceApplicationBundleIdentifier(String&&);
+
+    const String& sourceApplicationSecondaryIdentifier() const { return m_sourceApplicationSecondaryIdentifier; }
+    bool setSourceApplicationSecondaryIdentifier(String&&);
</ins><span class="cx">     
</span><ins>+    void finalizeApplicationIdentifiers() { m_allowedToSetApplicationIdentifiers = false; }
+    
</ins><span class="cx">     void setAllowsCellularAccess(AllowsCellularAccess allows) { m_allowsCellularAccess = allows; }
</span><span class="cx">     AllowsCellularAccess allowsCellularAccess() { return m_allowsCellularAccess; }
</span><span class="cx"> 
</span><span class="lines">@@ -248,6 +256,9 @@
</span><span class="cx"> 
</span><span class="cx">     String m_boundInterfaceIdentifier;
</span><span class="cx">     AllowsCellularAccess m_allowsCellularAccess { AllowsCellularAccess::Yes };
</span><ins>+    String m_sourceApplicationBundleIdentifier;
+    String m_sourceApplicationSecondaryIdentifier;
+    bool m_allowedToSetApplicationIdentifiers { true };
</ins><span class="cx"> 
</span><span class="cx"> #if HAVE(SEC_KEY_PROXY)
</span><span class="cx">     Vector<Ref<SecKeyProxyStore>> m_secKeyProxyStores;
</span></span></pre></div>
<a id="branchessafari6071400branchToolsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-607.1.40.0-branch/Tools/ChangeLog (242382 => 242383)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607.1.40.0-branch/Tools/ChangeLog        2019-03-04 21:20:14 UTC (rev 242382)
+++ branches/safari-607.1.40.0-branch/Tools/ChangeLog   2019-03-04 21:26:52 UTC (rev 242383)
</span><span class="lines">@@ -1,3 +1,57 @@
</span><ins>+2019-03-04  Null  <null@apple.com>
+
+        Cherry-pick r242302. rdar://problem/48520362
+
+    Add setters on WKWebsiteDataStore for sourceApplicationBundleIdentifier and sourceApplicationSecondaryIdentifier
+    https://bugs.webkit.org/show_bug.cgi?id=195229
+    <rdar://problem/48520362>
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebKit:
+    
+    Just like _setBoundInterfaceIdentifier, we need a way to set these properties after instantiation of a WKWebsiteDataStore,
+    but we need to make sure we don't set it after the parameters have been copied to the NetworkProcess.
+    
+    Functionality verified by manual testing.  See radar.
+    Added an API test that verifies the setter restrictions work as expected.
+    
+    * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+    (-[WKWebsiteDataStore _sourceApplicationBundleIdentifier]):
+    (-[WKWebsiteDataStore _setSourceApplicationBundleIdentifier:]):
+    (-[WKWebsiteDataStore _sourceApplicationSecondaryIdentifier]):
+    (-[WKWebsiteDataStore _setSourceApplicationSecondaryIdentifier:]):
+    * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
+    * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
+    (WebKit::toPKPaymentRequest):
+    * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+    (WebKit::WebsiteDataStore::parameters):
+    * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+    (WebKit::WebsiteDataStore::WebsiteDataStore):
+    (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
+    (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
+    * UIProcess/WebsiteData/WebsiteDataStore.h:
+    (WebKit::WebsiteDataStore::sourceApplicationBundleIdentifier):
+    (WebKit::WebsiteDataStore::sourceApplicationSecondaryIdentifier):
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:
+    (TEST):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242302 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-03-01  Alex Christensen  <achristensen@webkit.org>
+
+            Add setters on WKWebsiteDataStore for sourceApplicationBundleIdentifier and sourceApplicationSecondaryIdentifier
+            https://bugs.webkit.org/show_bug.cgi?id=195229
+            <rdar://problem/48520362>
+
+            Reviewed by Chris Dumez.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:
+            (TEST):
+
</ins><span class="cx"> 2019-02-27  Babak Shafiei  <bshafiei@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Apply patch. rdar://problem/48429676
</span></span></pre></div>
<a id="branchessafari6071400branchToolsTestWebKitAPITestsWebKitCocoaWebsiteDataStoreCustomPathsmm"></a>
<div class="modfile"><h4>Modified: branches/safari-607.1.40.0-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm (242382 => 242383)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607.1.40.0-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm   2019-03-04 21:20:14 UTC (rev 242382)
+++ branches/safari-607.1.40.0-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm      2019-03-04 21:26:52 UTC (rev 242383)
</span><span class="lines">@@ -28,6 +28,8 @@
</span><span class="cx"> #import "PlatformUtilities.h"
</span><span class="cx"> #import "Test.h"
</span><span class="cx"> #import "TestNavigationDelegate.h"
</span><ins>+#import "TestWKWebView.h"
+#import <WebKit/WKPreferencesRef.h>
</ins><span class="cx"> #import <WebKit/WKProcessPoolPrivate.h>
</span><span class="cx"> #import <WebKit/WKUserContentControllerPrivate.h>
</span><span class="cx"> #import <WebKit/WKWebViewConfigurationPrivate.h>
</span><span class="lines">@@ -448,4 +450,29 @@
</span><span class="cx">     [webView _test_waitForDidFinishNavigation];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+TEST(WebKit, ApplicationIdentifiers)
+{
+    auto websiteDataStoreConfiguration = adoptNS([[_WKWebsiteDataStoreConfiguration alloc] init]);
+    [websiteDataStoreConfiguration setSourceApplicationBundleIdentifier:@"testidentifier"];
+
+    auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    auto websiteDataStore = [[[WKWebsiteDataStore alloc] _initWithConfiguration:websiteDataStoreConfiguration.get()] autorelease];
+    EXPECT_TRUE([websiteDataStore._sourceApplicationBundleIdentifier isEqualToString:@"testidentifier"]);
+    [websiteDataStore _setSourceApplicationBundleIdentifier:@"otheridentifier"];
+
+    [webViewConfiguration setWebsiteDataStore:websiteDataStore];
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
+    [webView synchronouslyLoadTestPageNamed:@"simple"];
+    
+    RetainPtr<NSException> exception;
+    @try {
+        [websiteDataStore _setSourceApplicationBundleIdentifier:@"settingShouldFailNow"];
+    } @catch(NSException *caught) {
+        exception = caught;
+    }
+    EXPECT_TRUE([[exception reason] isEqualToString:@"_setSourceApplicationBundleIdentifier cannot be called after networking has begun"]);
+    EXPECT_TRUE([websiteDataStore._sourceApplicationBundleIdentifier isEqualToString:@"otheridentifier"]);
+    EXPECT_TRUE([[websiteDataStoreConfiguration sourceApplicationBundleIdentifier] isEqualToString:@"testidentifier"]);
+}
+
</ins><span class="cx"> #endif
</span></span></pre>
</div>
</div>

</body>
</html>