[macOS, iOS] Adopt new secure coding APIs in WebKit
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-01-02  Brent Fulgham  <bfulgham@apple.com>
2
3         [macOS, iOS] Adopt new secure coding APIs in WebKit
4         https://bugs.webkit.org/show_bug.cgi?id=181085
5         <rdar://problem/34837397>
6
7         Reviewed by Tim Horton.
8
9         Update WebKit code to use NSSecureCoding when the underlying operating system supports it. Use new
10         wrapper functions so the same code can be built on all supported OS releases, while enabling
11         seure coding when possible.
12
13         Note that NSView-based classes cannot be migrated at present due to AppKit not supporting NSSecureCoding
14         in its class hierarchy.
15
16         Tested by exising TestWebKitAPI tests for Coding and data transfer.
17
18         * Platform/ios/AccessibilityIOS.mm:
19         (WebKit::newAccessibilityRemoteToken): Encode using NSSecureCoding.
20         * UIProcess/API/Cocoa/WKPreferences.h:
21         * UIProcess/API/Cocoa/WKPreferences.mm:
22         (+[WKPreferences supportsSecureCoding]): Added to enable NSSecureCoding.
23         * UIProcess/API/Cocoa/WKProcessPool.h:
24         * UIProcess/API/Cocoa/WKProcessPool.mm:
25         (+[WKProcessPool supportsSecureCoding]): Ditto.
26         * UIProcess/API/Cocoa/WKUserContentController.h:
27         * UIProcess/API/Cocoa/WKUserContentController.mm:
28         (+[WKUserContentController supportsSecureCoding]): Ditto.
29         * UIProcess/API/Cocoa/WKWebView.mm:
30         (-[WKWebView initWithCoder:]): Use coding initialization that supports secure coding if
31         it is available in the supplied class.
32         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
33         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
34         (+[WKWebViewConfiguration supportsSecureCoding]): Added to enable NSSecureCoding.
35         (-[WKWebViewConfiguration initWithCoder:]): Use secure coding when possible.
36         * UIProcess/API/Cocoa/WKWebsiteDataStore.h:
37         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
38         (+[WKWebsiteDataStore supportsSecureCoding]): Added to enable NSSecureCoding.
39         * UIProcess/API/Cocoa/_WKApplicationManifest.h:
40         * UIProcess/API/Cocoa/_WKApplicationManifest.mm:
41         (+[_WKApplicationManifest supportsSecureCoding]): Added to enable NSSecureCoding.
42         (-[_WKApplicationManifest initWithCoder:]): Use secure coding when possible.
43
44 2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
45
46         Remove std::chrono completely
47         https://bugs.webkit.org/show_bug.cgi?id=181186
48
49         Reviewed by Alex Christensen.
50
51         Use MonotonicTime, WallTime, and Seconds instead.
52         Changes are mechanical ones.
53
54         * NetworkProcess/NetworkProcess.cpp:
55         (WebKit::NetworkProcess::deleteWebsiteData):
56         * NetworkProcess/NetworkProcess.h:
57         * NetworkProcess/NetworkProcess.messages.in:
58         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
59         (WebKit::CacheStorage::Caches::clear):
60         * NetworkProcess/cache/NetworkCache.cpp:
61         (WebKit::NetworkCache::responseHasExpired):
62         (WebKit::NetworkCache::responseNeedsRevalidation):
63         (WebKit::NetworkCache::makeStoreDecision):
64         (WebKit::NetworkCache::Cache::clear):
65         (WebKit::NetworkCache::Cache::storeData):
66         * NetworkProcess/cache/NetworkCache.h:
67         * NetworkProcess/cache/NetworkCacheEntry.cpp:
68         (WebKit::NetworkCache::Entry::Entry):
69         (WebKit::NetworkCache::Entry::asJSON const):
70         * NetworkProcess/cache/NetworkCacheEntry.h:
71         (WebKit::NetworkCache::Entry::timeStamp const):
72         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
73         (WebKit::NetworkCache::fileTimes):
74         (WebKit::NetworkCache::updateFileModificationTimeIfNeeded):
75         * NetworkProcess/cache/NetworkCacheFileSystem.h:
76         * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
77         (WebKit::NetworkCache::IOChannel::IOChannel):
78         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
79         (WebKit::NetworkCache::responseNeedsRevalidation):
80         (WebKit::NetworkCache::canRevalidate):
81         * NetworkProcess/cache/NetworkCacheStorage.cpp:
82         (WebKit::NetworkCache::Storage::readRecord):
83         (WebKit::NetworkCache::Storage::clear):
84         (WebKit::NetworkCache::computeRecordWorth):
85         * NetworkProcess/cache/NetworkCacheStorage.h:
86         Bump the cache version. We now change the data in persistent cache.
87         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
88         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
89         (WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry):
90         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
91         (WebKit::NetworkCache::SubresourceInfo::lastSeen const):
92         (WebKit::NetworkCache::SubresourceInfo::firstSeen const):
93         (WebKit::NetworkCache::SubresourcesEntry::timeStamp const):
94         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
95         (WebKit::NetworkProcess::clearHSTSCache):
96         (WebKit::clearNSURLCache):
97         (WebKit::NetworkProcess::clearDiskCache):
98         * NetworkProcess/curl/NetworkProcessCurl.cpp:
99         (WebKit::NetworkProcess::clearDiskCache):
100         * NetworkProcess/mac/NetworkProcessMac.mm:
101         (WebKit::NetworkProcess::clearCacheForAllOrigins):
102         * NetworkProcess/soup/NetworkProcessSoup.cpp:
103         (WebKit::NetworkProcess::clearCacheForAllOrigins):
104         (WebKit::NetworkProcess::clearDiskCache):
105         * Platform/IPC/ArgumentCoders.cpp:
106         (IPC::ArgumentCoder<WallTime>::encode):
107         (IPC::ArgumentCoder<WallTime>::decode):
108         (IPC::ArgumentCoder<std::chrono::system_clock::time_point>::encode): Deleted.
109         (IPC::ArgumentCoder<std::chrono::system_clock::time_point>::decode): Deleted.
110         * Platform/IPC/ArgumentCoders.h:
111         * PluginProcess/PluginProcess.cpp:
112         (WebKit::PluginProcess::deleteWebsiteData):
113         * PluginProcess/PluginProcess.h:
114         * PluginProcess/PluginProcess.messages.in:
115         * Scripts/webkit/messages.py:
116         (headers_for_type):
117         * Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
118         (WebKit::RemoteLayerBackingStore::lastDisplayTime const):
119         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
120         (WebKit::RemoteLayerBackingStore::RemoteLayerBackingStore):
121         (WebKit::RemoteLayerBackingStore::display):
122         * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h:
123         * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm:
124         (WebKit::RemoteLayerBackingStoreCollection::markBackingStoreVolatile):
125         (WebKit::RemoteLayerBackingStoreCollection::volatilityTimerFired):
126         * Shared/WebCoreArgumentCoders.cpp:
127         (IPC::ArgumentCoder<RecentSearch>::decode):
128         (IPC::ArgumentCoder<WallTime>::encode): Deleted.
129         (IPC::ArgumentCoder<WallTime>::decode): Deleted.
130         * Shared/WebCoreArgumentCoders.h:
131         * StorageProcess/StorageProcess.cpp:
132         (WebKit::StorageProcess::deleteWebsiteData):
133         * StorageProcess/StorageProcess.h:
134         * StorageProcess/StorageProcess.messages.in:
135         * UIProcess/API/C/WKApplicationCacheManager.cpp:
136         (WKApplicationCacheManagerDeleteAllEntries):
137         * UIProcess/API/C/WKCookieManager.cpp:
138         (WKCookieManagerDeleteAllCookiesModifiedAfterDate):
139         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
140         (WKKeyValueStorageManagerDeleteAllEntries):
141         * UIProcess/API/C/WKResourceCacheManager.cpp:
142         (WKResourceCacheManagerClearCacheForAllOrigins):
143         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
144         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
145         (WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemoval):
146         (WKWebsiteDataStoreRemoveAllFetchCaches):
147         (WKWebsiteDataStoreRemoveAllIndexedDatabases):
148         (WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations):
149         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
150         (toSystemClockTime):
151         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:]):
152         * UIProcess/API/glib/WebKitWebContext.cpp:
153         (webkit_web_context_clear_cache):
154         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
155         (webkit_website_data_manager_clear):
156         * UIProcess/DrawingAreaProxy.h:
157         * UIProcess/Network/NetworkProcessProxy.cpp:
158         (WebKit::NetworkProcessProxy::deleteWebsiteData):
159         * UIProcess/Network/NetworkProcessProxy.h:
160         * UIProcess/Plugins/PluginProcessManager.cpp:
161         (WebKit::PluginProcessManager::deleteWebsiteData):
162         * UIProcess/Plugins/PluginProcessManager.h:
163         * UIProcess/Plugins/PluginProcessProxy.cpp:
164         (WebKit::PluginProcessProxy::deleteWebsiteData):
165         * UIProcess/Plugins/PluginProcessProxy.h:
166         * UIProcess/Storage/StorageProcessProxy.cpp:
167         (WebKit::StorageProcessProxy::deleteWebsiteData):
168         * UIProcess/Storage/StorageProcessProxy.h:
169         * UIProcess/WebCookieManagerProxy.cpp:
170         (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
171         * UIProcess/WebCookieManagerProxy.h:
172         * UIProcess/WebProcessProxy.cpp:
173         (WebKit::WebProcessProxy::deleteWebsiteData):
174         * UIProcess/WebProcessProxy.h:
175         * UIProcess/WebResourceLoadStatisticsStore.cpp:
176         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
177         * UIProcess/WebResourceLoadStatisticsStore.h:
178         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
179         (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince):
180         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
181         * UIProcess/WebStorage/StorageManager.cpp:
182         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
183         * UIProcess/WebStorage/StorageManager.h:
184         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
185         (WebKit::WebsiteDataStore::platformRemoveRecentSearches):
186         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
187         (WebKit::WebsiteDataStore::removeData):
188         (WebKit::WebsiteDataStore::removeMediaKeys):
189         * UIProcess/WebsiteData/WebsiteDataStore.h:
190         * UIProcess/gtk/WebPageProxyGtk.cpp:
191         (WebKit::WebsiteDataStore::platformRemoveRecentSearches):
192         * UIProcess/wpe/WebPageProxyWPE.cpp:
193         (WebKit::WebsiteDataStore::platformRemoveRecentSearches):
194         * WebProcess/Cookies/WebCookieManager.cpp:
195         (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
196         * WebProcess/Cookies/WebCookieManager.h:
197         * WebProcess/Cookies/WebCookieManager.messages.in:
198         * WebProcess/Plugins/PluginView.cpp:
199         (WebKit::lastModifiedDateMS):
200         * WebProcess/WebProcess.cpp:
201         (WebKit::WebProcess::deleteWebsiteData):
202         * WebProcess/WebProcess.h:
203         * WebProcess/WebProcess.messages.in:
204
205 2018-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
206
207         [Attachment Support] Introduce data structures and IPC support for writing promised blobs
208         https://bugs.webkit.org/show_bug.cgi?id=181189
209
210         Reviewed by Tim Horton.
211
212         Add IPC support for PromisedBlobInfo and PromisedBlobData. See WebCore/ChangeLog for more detail.
213
214         * Shared/WebCoreArgumentCoders.cpp:
215         (IPC::ArgumentCoder<PromisedBlobData>::encode):
216         (IPC::ArgumentCoder<PromisedBlobData>::decode):
217         (IPC::ArgumentCoder<PromisedBlobInfo>::encode):
218         (IPC::ArgumentCoder<PromisedBlobInfo>::decode):
219         * Shared/WebCoreArgumentCoders.h:
220
221 2018-01-02  Michael Catanzaro  <mcatanzaro@igalia.com>
222
223         REGRESSION(r223253): Broke ResourceLoadStatistics layout tests for non-Cocoa ports
224         https://bugs.webkit.org/show_bug.cgi?id=181231
225
226         Reviewed by Alex Christensen.
227
228         Add new C API for use by WebKitTestRunner.
229
230         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
231         (WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder):
232         (WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo):
233         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
234
235 2018-01-02  Jiewen Tan  <jiewen_tan@apple.com>
236
237         Add a WebAuthentication runtime feature flag
238         https://bugs.webkit.org/show_bug.cgi?id=181220
239         <rdar://problem/36055305>
240
241         Reviewed by Brent Fulgham.
242
243         Renames the CredentialManagement runtime feature flag into WebAuthentication.
244
245         * Shared/WebPreferences.yaml:
246         * UIProcess/API/C/WKPreferences.cpp:
247         (WKPreferencesSetWebAuthenticationEnabled):
248         (WKPreferencesGetWebAuthenticationEnabled):
249         (WKPreferencesSetCredentialManagementEnabled): Deleted.
250         (WKPreferencesGetCredentialManagementEnabled): Deleted.
251         * UIProcess/API/C/WKPreferencesRefPrivate.h:
252         * WebProcess/WebPage/WebPage.cpp:
253         (WebKit::WebPage::updatePreferences):
254
255 2018-01-02  Michael Catanzaro  <mcatanzaro@igalia.com>
256
257         REGRESSION(r226327): [GTK] Plugin process is broken
258         https://bugs.webkit.org/show_bug.cgi?id=181187
259
260         Unreviewed, fix PluginProcessMainUnix after r226327.
261
262         * PluginProcess/unix/PluginProcessMainUnix.cpp:
263
264 2018-01-02  Tim Horton  <timothy_horton@apple.com>
265
266         Fix the build on platforms where UICurrentUserInterfaceIdiomIsPad is defined to false
267         https://bugs.webkit.org/show_bug.cgi?id=181218
268
269         Reviewed by Alex Christensen.
270
271         * Platform/spi/ios/UIKitSPI.h:
272         (currentUserInterfaceIdiomIsPad):
273         * UIProcess/ios/SmartMagnificationController.mm:
274         (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
275         * UIProcess/ios/WKContentViewInteraction.mm:
276         (-[WKFormInputSession setAccessoryViewCustomButtonTitle:]):
277         (-[WKContentView _requiresKeyboardWhenFirstResponder]):
278         (-[WKContentView _displayFormNodeInputView]):
279         (-[WKContentView requiresAccessoryView]):
280         (-[WKContentView _updateAccessory]):
281         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
282         (-[WKAirPlayRoutePicker show:fromRect:]):
283         * UIProcess/ios/forms/WKFileUploadPanel.mm:
284         (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]):
285         (-[WKFileUploadPanel _presentMenuOptionForCurrentInterfaceIdiom:]):
286         * UIProcess/ios/forms/WKFormInputControl.mm:
287         (-[WKDateTimePicker initWithView:datePickerMode:]):
288         (-[WKFormInputControl initWithView:]):
289         * UIProcess/ios/forms/WKFormSelectControl.mm:
290         (-[WKFormSelectControl initWithView:]):
291         On platforms where UICurrentUserInterfaceIdiomIsPad is defined to false,
292         blocks that conditionally execute based on its value are unreachable.
293         This causes the compiler to complain. Hide it away inside an inline function
294         and make use of that everywhere we used to use the macro.
295
296 2018-01-02  Alex Christensen  <achristensen@webkit.org>
297
298         Remove SVN file accidentally added in r226160
299         https://bugs.webkit.org/show_bug.cgi?id=180934
300
301         * UIProcess/WebPageProxy.cpp.orig: Removed.
302
303 2018-01-02  Alex Christensen  <achristensen@webkit.org>
304
305         Use BlockPtrs and lambdas instead of new/delete to pass parameters to blocks in WebViewImpl::performDragOperation
306         https://bugs.webkit.org/show_bug.cgi?id=180795
307
308         Reviewed by Brent Fulgham.
309
310         * UIProcess/Cocoa/WebViewImpl.mm:
311         (WebKit::WebViewImpl::performDragOperation):
312
313 2018-01-02  Michael Catanzaro  <mcatanzaro@igalia.com>
314
315         [WPE][GTK] Implement the assignment of ProcessIdentifiers to child processes
316         https://bugs.webkit.org/show_bug.cgi?id=181187
317
318         Reviewed by Brady Eidson.
319
320         * Shared/ChildProcess.cpp: Make the ProcessIdentifier mandatory.
321         (WebKit::ChildProcess::initialize):
322         * Shared/unix/ChildProcessMain.cpp: Initialize ChildProcessInitializationParameters with the
323         ProcessIdentifier.
324         (WebKit::ChildProcessMainBase::parseCommandLine):
325         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp: Copy the ProcessIdentifier from
326         LaunchOptions into argv.
327         (WebKit::ProcessLauncher::launchProcess):
328         * WebProcess/wpe/WebProcessMainWPE.cpp: Expect the WPE socket ID later in the command line.
329
330 2018-01-02  Alex Christensen  <achristensen@webkit.org>
331
332         Use new WebsiteDataStore passed in through decidePolicyForNavigation SPI
333         https://bugs.webkit.org/show_bug.cgi?id=180897
334         <rdar://problem/35535328>
335
336         Reviewed by Brent Fulgham.
337
338         * Shared/WebsitePoliciesData.cpp:
339         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
340         * UIProcess/Cocoa/NavigationState.mm:
341         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
342         * UIProcess/WebPageProxy.cpp:
343         (WebKit::WebPageProxy::changeWebsiteDataStore):
344         * UIProcess/WebPageProxy.h:
345         * UIProcess/WebProcessPool.cpp:
346         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
347         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
348         (WebKit::WebProcessPool::pageAddedToProcess): Deleted.
349         (WebKit::WebProcessPool::pageRemovedFromProcess): Deleted.
350         * UIProcess/WebProcessPool.h:
351         * UIProcess/WebProcessProxy.cpp:
352         (WebKit::WebProcessProxy::addExistingWebPage):
353         (WebKit::WebProcessProxy::removeWebPage):
354         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
355         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
356
357 2018-01-02  Alex Christensen  <achristensen@webkit.org>
358
359         Only use CookieStorageShim when we aren't using NetworkSession
360         https://bugs.webkit.org/show_bug.cgi?id=180766
361
362         Reviewed by Brent Fulgham.
363
364         * Shared/mac/CookieStorageShim.h:
365         * Shared/mac/CookieStorageShim.mm:
366         * WebProcess/WebProcess.cpp:
367         (WebKit::WebProcess::initializeWebProcess):
368
369 2018-01-02  Alex Christensen  <achristensen@webkit.org>
370
371         Clean up context menu code
372         https://bugs.webkit.org/show_bug.cgi?id=181074
373
374         Reviewed by Brent Fulgham.
375
376         Use Ref instead of RefPtr where possible.
377         Use move semantics instead of copying from const references when possible.
378         Remove dead iOS code.  Reduce allocations.  Add stub for WPE.
379
380         * UIProcess/API/APIContextMenuClient.h:
381         (API::ContextMenuClient::getContextMenuFromProposedMenu):
382         (API::ContextMenuClient::getContextMenuFromProposedMenuAsync):
383         (API::ContextMenuClient::showContextMenu):
384         * UIProcess/API/C/WKPage.cpp:
385         (WKPageSetPageContextMenuClient):
386         * UIProcess/API/gtk/PageClientImpl.cpp:
387         (WebKit::PageClientImpl::createContextMenuProxy):
388         * UIProcess/API/gtk/PageClientImpl.h:
389         * UIProcess/PageClient.h:
390         * UIProcess/WebContextMenuListenerProxy.cpp:
391         (WebKit::WebContextMenuListenerProxy::useContextMenuItems):
392         * UIProcess/WebContextMenuProxy.cpp:
393         (WebKit::WebContextMenuProxy::WebContextMenuProxy):
394         * UIProcess/WebContextMenuProxy.h:
395         * UIProcess/WebPageProxy.cpp:
396         (WebKit::WebPageProxy::showContextMenu):
397         (WebKit::WebPageProxy::internalShowContextMenu): Deleted.
398         * UIProcess/WebPageProxy.h:
399         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
400         (WebKit::WebContextMenuProxyGtk::showContextMenuWithItems):
401         (WebKit::WebContextMenuProxyGtk::WebContextMenuProxyGtk):
402         * UIProcess/gtk/WebContextMenuProxyGtk.h:
403         (WebKit::WebContextMenuProxyGtk::create):
404         * UIProcess/ios/PageClientImplIOS.h:
405         * UIProcess/ios/PageClientImplIOS.mm:
406         (WebKit::PageClientImpl::createContextMenuProxy): Deleted.
407         * UIProcess/mac/PageClientImplMac.h:
408         * UIProcess/mac/PageClientImplMac.mm:
409         (WebKit::PageClientImpl::createContextMenuProxy):
410         * UIProcess/mac/WebContextMenuProxyMac.h:
411         (WebKit::WebContextMenuProxyMac::create):
412         * UIProcess/mac/WebContextMenuProxyMac.mm:
413         (WebKit::WebContextMenuProxyMac::WebContextMenuProxyMac):
414         (WebKit::WebContextMenuProxyMac::showContextMenuWithItems):
415         (WebKit::WebContextMenuProxyMac::showContextMenu):
416
417 == Rolled over to ChangeLog-2018-01-01 ==