<!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>[213331] trunk</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/213331">213331</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2017-03-02 17:34:32 -0800 (Thu, 02 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Update WKWebsiteDatastoreConfiguration SPI.
https://bugs.webkit.org/show_bug.cgi?id=169102

Reviewed by Tim Horton.
Source/WebKit2:

Make these strings URLs, and throw exceptions if you try to use non-file URLs.

* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _initWithConfiguration:]):

* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(checkURLArgument):
(-[_WKWebsiteDataStoreConfiguration _webStorageDirectory]):
(-[_WKWebsiteDataStoreConfiguration _setWebStorageDirectory:]):
(-[_WKWebsiteDataStoreConfiguration _indexedDBDatabaseDirectory]):
(-[_WKWebsiteDataStoreConfiguration _setIndexedDBDatabaseDirectory:]):
(-[_WKWebsiteDataStoreConfiguration _webSQLDatabaseDirectory]):
(-[_WKWebsiteDataStoreConfiguration _setWebSQLDatabaseDirectory:]):

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.mm:
(-[WebsiteDataStoreCustomPathsMessageHandler userContentController:didReceiveScriptMessage:]):
(TEST):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebsiteDataStoremm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKWebsiteDataStoreConfigurationh">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKWebsiteDataStoreConfigurationmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaWebsiteDataStoreCustomPathsmm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (213330 => 213331)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-03-03 01:29:51 UTC (rev 213330)
+++ trunk/Source/WebKit2/ChangeLog        2017-03-03 01:34:32 UTC (rev 213331)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2017-03-02  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Update WKWebsiteDatastoreConfiguration SPI.
+        https://bugs.webkit.org/show_bug.cgi?id=169102
+
+        Reviewed by Tim Horton.
+        
+        Make these strings URLs, and throw exceptions if you try to use non-file URLs.
+
+        * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+        (-[WKWebsiteDataStore _initWithConfiguration:]):
+
+        * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
+        * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
+        (checkURLArgument):
+        (-[_WKWebsiteDataStoreConfiguration _webStorageDirectory]):
+        (-[_WKWebsiteDataStoreConfiguration _setWebStorageDirectory:]):
+        (-[_WKWebsiteDataStoreConfiguration _indexedDBDatabaseDirectory]):
+        (-[_WKWebsiteDataStoreConfiguration _setIndexedDBDatabaseDirectory:]):
+        (-[_WKWebsiteDataStoreConfiguration _webSQLDatabaseDirectory]):
+        (-[_WKWebsiteDataStoreConfiguration _setWebSQLDatabaseDirectory:]):
+
</ins><span class="cx"> 2017-03-02  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Move part of NetworkRTCProvider::close implementation in NetworkRTCProvider destructor
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebsiteDataStoremm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm (213330 => 213331)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm        2017-03-03 01:29:51 UTC (rev 213330)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm        2017-03-03 01:34:32 UTC (rev 213331)
</span><span class="lines">@@ -153,12 +153,12 @@
</span><span class="cx"> 
</span><span class="cx">     auto config = API::WebsiteDataStore::defaultDataStoreConfiguration();
</span><span class="cx"> 
</span><del>-    if (configuration.webStorageDirectory)
-        config.localStorageDirectory = configuration.webStorageDirectory;
-    if (configuration.webSQLDatabaseDirectory)
-        config.webSQLDatabaseDirectory = configuration.webSQLDatabaseDirectory;
-    if (configuration.indexedDBDatabaseDirectory)
-        config.indexedDBDatabaseDirectory = configuration.indexedDBDatabaseDirectory;
</del><ins>+    if (configuration._webStorageDirectory)
+        config.localStorageDirectory = configuration._webStorageDirectory.path;
+    if (configuration._webSQLDatabaseDirectory)
+        config.webSQLDatabaseDirectory = configuration._webSQLDatabaseDirectory.path;
+    if (configuration._indexedDBDatabaseDirectory)
+        config.indexedDBDatabaseDirectory = configuration._indexedDBDatabaseDirectory.path;
</ins><span class="cx"> 
</span><span class="cx">     API::Object::constructInWrapper&lt;API::WebsiteDataStore&gt;(self, config);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKWebsiteDataStoreConfigurationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h (213330 => 213331)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h        2017-03-03 01:29:51 UTC (rev 213330)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h        2017-03-03 01:34:32 UTC (rev 213331)
</span><span class="lines">@@ -34,9 +34,9 @@
</span><span class="cx"> WK_CLASS_AVAILABLE(macosx(10.13), ios(11.0))
</span><span class="cx"> @interface _WKWebsiteDataStoreConfiguration : NSObject
</span><span class="cx"> 
</span><del>-@property (nonatomic, copy) NSString *webStorageDirectory;
-@property (nonatomic, copy) NSString *indexedDBDatabaseDirectory;
-@property (nonatomic, copy) NSString *webSQLDatabaseDirectory;
</del><ins>+@property (nonatomic, copy, setter=_setWebStorageDirectory:) NSURL *_webStorageDirectory;
+@property (nonatomic, copy, setter=_setIndexedDBDatabaseDirectory:) NSURL *_indexedDBDatabaseDirectory;
+@property (nonatomic, copy, setter=_setWebSQLDatabaseDirectory:) NSURL *_webSQLDatabaseDirectory;
</ins><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKWebsiteDataStoreConfigurationmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm (213330 => 213331)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm        2017-03-03 01:29:51 UTC (rev 213330)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm        2017-03-03 01:34:32 UTC (rev 213331)
</span><span class="lines">@@ -28,8 +28,46 @@
</span><span class="cx"> 
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx"> 
</span><del>-@implementation _WKWebsiteDataStoreConfiguration
</del><ins>+#import &lt;wtf/RetainPtr.h&gt;
</ins><span class="cx"> 
</span><ins>+static void checkURLArgument(NSURL *url)
+{
+    if (url &amp;&amp; ![url isFileURL])
+        [NSException raise:NSInvalidArgumentException format:@&quot;%@ is not a file URL&quot;, url];
+}
+
+@implementation _WKWebsiteDataStoreConfiguration {
+    RetainPtr&lt;NSURL&gt; _webStorageDirectoryURL;
+    RetainPtr&lt;NSURL&gt; _indexedDBDatabaseDirectoryURL;
+    RetainPtr&lt;NSURL&gt; _webSQLDatabaseDirectoryURL;
+}
+
+-(NSURL *)_webStorageDirectory {
+    return _webStorageDirectoryURL.get();
+}
+
+-(void)_setWebStorageDirectory:(NSURL *)url {
+    checkURLArgument(url);
+    _webStorageDirectoryURL = adoptNS([url copy]);
+}
+
+-(NSURL *)_indexedDBDatabaseDirectory {
+    return _indexedDBDatabaseDirectoryURL.get();
+}
+
+-(void)_setIndexedDBDatabaseDirectory:(NSURL *)url {
+    checkURLArgument(url);
+    _indexedDBDatabaseDirectoryURL = adoptNS([url copy]);
+}
+
+-(NSURL *)_webSQLDatabaseDirectory {
+    return _webSQLDatabaseDirectoryURL.get();
+}
+
+-(void)_setWebSQLDatabaseDirectory:(NSURL *)url {
+    checkURLArgument(url);
+    _webSQLDatabaseDirectoryURL = adoptNS([url copy]);
+}
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (213330 => 213331)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-03-03 01:29:51 UTC (rev 213330)
+++ trunk/Tools/ChangeLog        2017-03-03 01:34:32 UTC (rev 213331)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-03-02  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Update WKWebsiteDatastoreConfiguration SPI.
+        https://bugs.webkit.org/show_bug.cgi?id=169102
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.mm:
+        (-[WebsiteDataStoreCustomPathsMessageHandler userContentController:didReceiveScriptMessage:]):
+        (TEST):
+
</ins><span class="cx"> 2017-03-02  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Sufficently large timeValue and timeScale arguments to MediaTime will cause wrapping in toTimeScale().
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaWebsiteDataStoreCustomPathsmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.mm (213330 => 213331)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.mm        2017-03-03 01:29:51 UTC (rev 213330)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsiteDataStoreCustomPaths.mm        2017-03-03 01:34:32 UTC (rev 213331)
</span><span class="lines">@@ -52,7 +52,6 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message
</span><span class="cx"> {
</span><del>-    printf(&quot;Message!\n&quot;);
</del><span class="cx">     receivedScriptMessage = true;
</span><span class="cx">     scriptMessages.append(message);
</span><span class="cx"> }
</span><span class="lines">@@ -75,23 +74,23 @@
</span><span class="cx">     RetainPtr&lt;WKWebViewConfiguration&gt; configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:handler.get() name:@&quot;testHandler&quot;];
</span><span class="cx"> 
</span><del>-    NSString *sqlPath = [@&quot;~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/WebSQL/&quot; stringByExpandingTildeInPath];
-    NSString *idbPath = [@&quot;~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/IndexedDB/&quot; stringByExpandingTildeInPath];
-    NSString *localStoragePath = [@&quot;~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/LocalStorage/&quot; stringByExpandingTildeInPath];
</del><ins>+    NSURL *sqlPath = [NSURL fileURLWithPath:[@&quot;~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/WebSQL/&quot; stringByExpandingTildeInPath]];
+    NSURL *idbPath = [NSURL fileURLWithPath:[@&quot;~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/IndexedDB/&quot; stringByExpandingTildeInPath]];
+    NSURL *localStoragePath = [NSURL fileURLWithPath:[@&quot;~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/LocalStorage/&quot; stringByExpandingTildeInPath]];
</ins><span class="cx"> 
</span><del>-    [[NSFileManager defaultManager] removeItemAtURL:[NSURL fileURLWithPath:sqlPath] error:nil];
-    [[NSFileManager defaultManager] removeItemAtURL:[NSURL fileURLWithPath:idbPath] error:nil];
-    [[NSFileManager defaultManager] removeItemAtURL:[NSURL fileURLWithPath:localStoragePath] error:nil];
</del><ins>+    [[NSFileManager defaultManager] removeItemAtURL:sqlPath error:nil];
+    [[NSFileManager defaultManager] removeItemAtURL:idbPath error:nil];
+    [[NSFileManager defaultManager] removeItemAtURL:localStoragePath error:nil];
</ins><span class="cx"> 
</span><del>-    EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:sqlPath]);
-    EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:localStoragePath]);
-    EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:idbPath]);
</del><ins>+    EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:sqlPath.path]);
+    EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:localStoragePath.path]);
+    EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:idbPath.path]);
</ins><span class="cx"> 
</span><span class="cx">     _WKWebsiteDataStoreConfiguration *websiteDataStoreConfiguration = [[_WKWebsiteDataStoreConfiguration alloc] init];
</span><del>-    websiteDataStoreConfiguration.webSQLDatabaseDirectory = sqlPath;
-    websiteDataStoreConfiguration.indexedDBDatabaseDirectory = idbPath;
-    websiteDataStoreConfiguration.webStorageDirectory = localStoragePath;
-    
</del><ins>+    websiteDataStoreConfiguration._webSQLDatabaseDirectory = sqlPath;
+    websiteDataStoreConfiguration._indexedDBDatabaseDirectory = idbPath;
+    websiteDataStoreConfiguration._webStorageDirectory = localStoragePath;
+
</ins><span class="cx">     configuration.get().websiteDataStore = [[WKWebsiteDataStore alloc] _initWithConfiguration:websiteDataStoreConfiguration];
</span><span class="cx">     [websiteDataStoreConfiguration release];
</span><span class="cx"> 
</span><span class="lines">@@ -105,8 +104,8 @@
</span><span class="cx">     getNextMessage();
</span><span class="cx">     getNextMessage();
</span><span class="cx"> 
</span><del>-    EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:sqlPath]);
-    EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:localStoragePath]);
</del><ins>+    EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:sqlPath.path]);
+    EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:localStoragePath.path]);
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: &lt;rdar://problem/30785618&gt; - We don't yet support IDB database processes at custom paths per WebsiteDataStore
</span><span class="cx">     // EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:idbPath]);
</span></span></pre>
</div>
</div>

</body>
</html>