Deny third-party cookie creation for prevalent resources without interaction
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2017-09-06  Brent Fulgham  <bfulgham@apple.com>
2
3         Deny third-party cookie creation for prevalent resources without interaction
4         https://bugs.webkit.org/show_bug.cgi?id=175232
5         <rdar://problem/33709386>
6
7         Reviewed by Alex Christensen.
8
9         Prior to Intelligent Tracking Prevention, WebKit would deny the ability to create a third party cookie if the user's
10         settings prohibited it. Due to the internal mechanics of cookie partitioning, we now accept the third party cookie,
11         but destroy it at some arbitrary moment which is difficult for websites to work with.
12         
13         This patch revises WebKit so that attempts to set third party cookies without user interaction fails immediately,
14         which is what sites are expecting from Safari.
15
16         * NetworkProcess/NetworkProcess.cpp:
17         (WebKit::NetworkProcess::updatePrevalentDomainsWithAndWithoutInteraction):
18         (WebKit::NetworkProcess::updateCookiePartitioningForTopPrivatelyOwnedDomains): Renamed to updatePrevalentDomainsWithAndWithoutInteraction.
19         * NetworkProcess/NetworkProcess.h:
20         * NetworkProcess/NetworkProcess.messages.in: Renamed the UpdateCookiePartitioningForTopPrivatelyOwnedDomains message
21         to UpdatePrevalentDomainsWithAndWithoutInteraction.
22         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
23         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Recognize cases where a network session should block cookies, and
24         use the stateless session so we fail immediately when attempting an invalid cookie set operation.
25         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
26         (WebKit::WKWebsiteDataStore::_resourceLoadStatisticsSetShouldPartitionCookies): Use new helper function to clear partitioning state.
27         * UIProcess/WebResourceLoadStatisticsStore.cpp:
28         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): Update for revised naming.
29         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning): Track domains with and without interaction so that we can recognize
30         domains that should be immediately blocked from setting cookies.
31         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains): Update for revised naming.
32         (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains): Added helper function for testing.
33         * UIProcess/WebResourceLoadStatisticsStore.h:
34         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
35         (WebKit::WebsiteDataStore::updatePrevalentDomainsWithAndWithoutInteraction): Update for revised naming.
36         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback): Ditto.
37         (WebKit::WebsiteDataStore::updateCookiePartitioningForTopPrivatelyOwnedDomains): Renamed to updatePrevalentDomainsWithAndWithoutInteraction.
38         * UIProcess/WebsiteData/WebsiteDataStore.h:
39
40 2017-09-06  Adrian Perez de Castro  <aperez@igalia.com>
41
42         [WPE][CMake] Fix path to the WebKitApplicationInfo.h header.
43
44         Unreviewed build fix.
45
46         This doesn't really make a difference for the build bots, but it makes
47         it possible to craft working release tarballs of WPE.
48
49         * PlatformWPE.cmake: Use the WPE version of WebKitApplicationInfo.h
50
51 2017-09-06  Frédéric Wang  <fwang@igalia.com>
52
53         Introduce ScrollingTreeScrollingNodeDelegateIOS to share code between overflow and frame scrolling
54         https://bugs.webkit.org/show_bug.cgi?id=174097
55
56         Reviewed by Darin Adler.
57
58         This patch introduces a new ScrollingTreeScrollingNodeDelegateIOS that can be used by
59         WKOverflowScrollViewDelegate to communicate to the scrolling tree and nodes. It can also be
60         used as a helper class by ScrollingTreeOverflowScrollingNodeIOS. For now, only the non-
61         overriden member functions of ScrollingTreeOverflowScrollingNodeIOS are moved to that new
62         class. In follow-up commits, WKOverflowScrollViewDelegate can become a generic
63         ScrollViewDelegate and more code can be moved into the ScrollingTreeScrollingNodeDelegateIOS
64         file. Frame scrolling nodes will then be able to share the same UI code as overflow:auto when
65         iOS frame scrolling is implemented (bug 149264).
66
67         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h: Move non-overriden member
68         functions and m_updatingFromStateNode into the delegate class. Also define a member to store
69         that delegate.
70         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm: Use the node delegate to
71         communicate to the scrolling tree and node.
72         (-[WKOverflowScrollViewDelegate initWithScrollingTreeNodeDelegate:]): Init with a delegate.
73         (-[WKOverflowScrollViewDelegate scrollViewDidScroll:]): Call the delegate function.
74         (-[WKOverflowScrollViewDelegate scrollViewWillBeginDragging:]): Ditto.
75         (-[WKOverflowScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
76         Use the delegate functions or pass by ScrollingTreeScrollingNodeDelegateIOS::scrollingNode().
77         (-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]): Use the delegate
78         functions.
79         (-[WKOverflowScrollViewDelegate scrollViewDidEndDecelerating:]): Ditto.
80         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::ScrollingTreeOverflowScrollingNodeIOS):
81         Init the delegate for this class.
82         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren): Use the delegate.
83         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::setScrollLayerPosition): Use the delegate
84         function.
85         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterDelegatedScroll): Ditto.
86         (-[WKOverflowScrollViewDelegate initWithScrollingTreeNode:]): Deleted. This is renamed
87         initWithScrollingTreeNodeDelegate and accepts a delegate.
88         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateChildNodesAfterScroll): Deleted. Moved
89         to ScrollingTreeScrollingNodeDelegateIOS.
90         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollWillStart): Ditto.
91         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollDidEnd): Ditto.
92         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollViewWillStartPanGesture): Ditto.
93         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollViewDidScroll): Ditto.
94         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::currentSnapPointIndicesDidChange): Ditto.
95         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: Added. New delegate class
96         for ScrollingTreeOverflowScrollingNodeIOS. The members used by WKOverflowScrollViewDelegate
97         are public and the others are private. ScrollingTreeOverflowScrollingNodeIOS is a friend of
98         ScrollingTreeScrollingNodeDelegateIOS so that it can access private members e.g.
99         updateChildNodesAfterScroll() or  m_updatingFromStateNode.
100         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: Added.
101         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::ScrollingTreeScrollingNodeDelegateIOS):
102         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::~ScrollingTreeScrollingNodeDelegateIOS):
103         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll): Code extracted
104         from ScrollingTreeOverflowScrollingNodeIOS.
105         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollWillStart): Ditto.
106         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollDidEnd): Ditto.
107         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewWillStartPanGesture): Ditto.
108         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll): Ditto.
109         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::currentSnapPointIndicesDidChange): Ditto.
110         * WebKit.xcodeproj/project.pbxproj: Add ScrollingTreeScrollingNodeDelegateIOS files to the
111         build system.
112
113 2017-09-05  Wenson Hsieh  <wenson_hsieh@apple.com>
114
115         [iOS WK2] Add plumbing for WKContentView to ask the web process for additional drag items
116         https://bugs.webkit.org/show_bug.cgi?id=176348
117         Work towards <rdar://problem/31144674>
118
119         Reviewed by Tim Horton.
120
121         Adds boilerplate plumbing to request additional items to an existing session. This implements some UI-side logic
122         in WKContentView to send an additional drag items request and handle a response from the web process. 
123         To start, WebPageProxy::requestAdditionalItemsForDragSession is invoked by -_dragInteraction:
124         itemsForAddingToSession:withTouchAtPoint:completion: in WKContentView, and the response from the web process is
125         handled in -[WKContentView _didHandleAdditionalDragItemsRequest:].
126
127         * UIProcess/API/Cocoa/WKWebView.mm:
128         (-[WKWebView _simulateItemsForAddingToSession:atLocation:completion:]):
129         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
130
131         Add SPI to simulate a request for additional drag items. See Tools/ChangeLog for more detail.
132
133         * UIProcess/PageClient.h:
134         * UIProcess/WebPageProxy.h:
135         * UIProcess/WebPageProxy.messages.in:
136
137         Add an IPC message handler for the additional drag items response from the web process.
138
139         * UIProcess/ios/DragDropInteractionState.h:
140         (WebKit::DragDropInteractionState::BlockPtr<void):
141         * UIProcess/ios/DragDropInteractionState.mm:
142         (WebKit::DragDropInteractionState::shouldRequestAdditionalItemForDragSession const):
143         (WebKit::DragDropInteractionState::dragSessionWillRequestAdditionalItem):
144
145         Invoke the new additional items completion handler when tearing down to avoid getting UIKit into a bad state.
146
147         (WebKit::DragDropInteractionState::dragAndDropSessionsDidEnd):
148         * UIProcess/ios/PageClientImplIOS.h:
149         * UIProcess/ios/PageClientImplIOS.mm:
150         (WebKit::PageClientImpl::didHandleAdditionalDragItemsRequest):
151         * UIProcess/ios/WKContentViewInteraction.h:
152         * UIProcess/ios/WKContentViewInteraction.mm:
153         (-[WKContentView _didHandleAdditionalDragItemsRequest:]):
154         (-[WKContentView _itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:]):
155
156         Factors common logic to convert a staged WebItemProviderRegistrationInfoList and DragSourceState into a list of
157         drag items, invoking the private UI delegate in the process. This is called both when starting a drag session,
158         and adding items to an existing drag session.
159
160         (-[WKContentView _dragInteraction:itemsForAddingToSession:withTouchAtPoint:completion:]):
161
162         Implements a (proposed) additional drag item delegate that serves as an asynchronous alternative to the API
163         variant, -_dragInteraction:itemsForAddingToSession:withTouchAtPoint:. See <rdar://problem/33146803> for more
164         information.
165
166         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
167
168         Refactored to use -_itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:.
169
170         (-[WKContentView _simulateItemsForAddingToSession:atLocation:completion:]):
171         * UIProcess/ios/WebPageProxyIOS.mm:
172         (WebKit::WebPageProxy::didHandleAdditionalDragItemsRequest):
173         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
174         * WebProcess/WebPage/WebPage.h:
175         * WebProcess/WebPage/WebPage.messages.in:
176
177         Add an IPC message handler for the additional drag items request from the UI process.
178
179         * WebProcess/WebPage/ios/WebPageIOS.mm:
180         (WebKit::WebPage::requestAdditionalItemsForDragSession):
181
182 2017-09-05  Alex Christensen  <achristensen@webkit.org>
183
184         Add WKUIDelegatePrivate equivalent of WKPageUIClient's mouseDidMoveOverElement
185         https://bugs.webkit.org/show_bug.cgi?id=176428
186         <rdar://problem/29270035>
187
188         Reviewed by Tim Horton.
189
190         Covered by a new API test.
191
192         * UIProcess/API/APIUIClient.h:
193         (API::UIClient::mouseDidMoveOverElement):
194         * UIProcess/API/C/WKPage.cpp:
195         (WKPageSetPageUIClient):
196         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
197         * UIProcess/Cocoa/UIDelegate.h:
198         * UIProcess/Cocoa/UIDelegate.mm:
199         (WebKit::UIDelegate::setDelegate):
200         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
201         (WebKit::UIDelegate::UIClient::createNewPageCommon):
202         (WebKit::UIDelegate::UIClient::runJavaScriptAlert):
203         (WebKit::UIDelegate::UIClient::runJavaScriptConfirm):
204         (WebKit::UIDelegate::UIClient::runJavaScriptPrompt):
205         (WebKit::UIDelegate::UIClient::runBeforeUnloadConfirmPanel):
206         (WebKit::UIDelegate::UIClient::takeFocus):
207         (WebKit::UIDelegate::UIClient::focus):
208         (WebKit::UIDelegate::UIClient::unfocus):
209         (WebKit::UIDelegate::UIClient::didExceedBackgroundResourceLimitWhileInForeground):
210         (WebKit::UIDelegate::UIClient::didNotHandleWheelEvent):
211         (WebKit::toNSEventModifierFlags):
212         (WebKit::UIDelegate::UIClient::mouseDidMoveOverElement):
213         (WebKit::UIDelegate::UIClient::toolbarsAreVisible):
214         (WebKit::UIDelegate::UIClient::didClickAutoFillButton):
215         (WebKit::UIDelegate::UIClient::handleAutoplayEvent):
216         (WebKit::requestUserMediaAuthorizationForDevices):
217         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
218         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
219         (WebKit::UIDelegate::UIClient::printFrame):
220         (WebKit::UIDelegate::UIClient::close):
221         (WebKit::UIDelegate::UIClient::fullscreenMayReturnToInline):
222         (WebKit::UIDelegate::UIClient::didEnterFullscreen):
223         (WebKit::UIDelegate::UIClient::didExitFullscreen):
224         (WebKit::UIDelegate::UIClient::requestPointerLock):
225         (WebKit::UIDelegate::UIClient::didLosePointerLock):
226         (WebKit::UIDelegate::UIClient::hasVideoInPictureInPictureDidChange):
227         * UIProcess/WebPageProxy.cpp:
228         (WebKit::WebPageProxy::mouseDidMoveOverElement):
229         * UIProcess/WebPageProxy.h:
230
231 2017-09-05  Brent Fulgham  <bfulgham@apple.com>
232
233         Relax keychain access to permit users to permanently allow client certificates
234         https://bugs.webkit.org/show_bug.cgi?id=175857
235         <rdar://problem/32293867>
236
237         Reviewed by Alex Christensen.
238
239         Further relax the write permissions on the user's Keychain directory to support local certificates.
240
241         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
242         * WebProcess/com.apple.WebProcess.sb.in:
243
244 2017-09-05  Youenn Fablet  <youenn@apple.com>
245
246         Cache Storage Engine should not mix different origin caches
247         https://bugs.webkit.org/show_bug.cgi?id=176394
248
249         Reviewed by Alex Christensen.
250
251         * NetworkProcess/cache/CacheStorageEngine.cpp:
252         (WebKit::CacheStorage::Engine::readCachesFromDisk): Initializing the salt before creating the Caches object
253         so that its persistency path is correctly computed.
254         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
255         (WebKit::CacheStorage::cachesRootPath): Setting origin as partition string.
256
257 2017-09-05  Brent Fulgham  <bfulgham@apple.com>
258
259         Use a single network storage session for stateless connections
260         https://bugs.webkit.org/show_bug.cgi?id=176386
261         <rdar://problem/34262148>
262
263         Reviewed by Alex Christensen.
264
265         Change the name of 'm_dataTaskMapWithoutCredentials' to 'm_dataTaskMapWithoutState'
266         to reflect that the data tasks do not involve credential or cookie storage. Ditto for
267         the change from 'm_sessionWIthoutCredentialStorage' to 'm_statelessSession'.
268
269         This update should not change behavior, unless some stateless sessions were depending
270         on cookies to be persistent (which would be a bug!)
271
272         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
273         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Update for new variable names.
274         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa): Ditto.
275         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
276         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
277         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Update the configuration to block
278         cookies as well.
279         (WebKit::NetworkSessionCocoa::invalidateAndCancel): Update for new names.
280         (WebKit::NetworkSessionCocoa::clearCredentials): Ditto.
281         (WebKit::NetworkSessionCocoa::dataTaskForIdentifier): Ditto.
282
283 2017-09-05  Yousuke Kimoto  <yousuke.kimoto@sony.com>
284
285         [WinCairo] Add Network Process files for wincairo webkit
286         https://bugs.webkit.org/show_bug.cgi?id=176069
287
288         Reviewed by Alex Christensen.
289
290         * NetworkProcess/Downloads/curl/DownloadCurl.cpp: Added.
291         (WebKit::Download::resume):
292         (WebKit::Download::platformDidFinish):
293         (WebKit::Download::startNetworkLoadWithHandle):
294         (WebKit::Download::startNetworkLoad):
295         (WebKit::Download::platformInvalidate):
296         * NetworkProcess/EntryPoint/win/NetworkProcessMain.cpp: Added.
297         (main):
298         * NetworkProcess/curl/NetworkProcessCurl.cpp: Added.
299         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
300         (WebKit::NetworkProcess::platformSetURLCacheSize):
301         (WebKit::NetworkProcess::allowSpecificHTTPSCertificateForHost):
302         (WebKit::NetworkProcess::clearCacheForAllOrigins):
303         (WebKit::NetworkProcess::clearDiskCache):
304         (WebKit::NetworkProcess::platformTerminate):
305         * NetworkProcess/curl/RemoteNetworkingContextCurl.cpp: Added.
306         (WebKit::RemoteNetworkingContext::~RemoteNetworkingContext):
307         (WebKit::RemoteNetworkingContext::isValid const):
308         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
309         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
310         (WebKit::RemoteNetworkingContext::storageSession const):
311         (WebKit::RemoteNetworkingContext::blockedError const):
312         * NetworkProcess/win/NetworkProcessMainWin.cpp: Added.
313         (WebKit::NetworkProcessMainWin):
314         * NetworkProcess/win/NetworkProcessMainWin.h: Added.
315         * NetworkProcess/win/SystemProxyWin.cpp: Added.
316         (WindowsSystemProxy::getSystemHttpProxy):
317         (WindowsSystemProxy::setCurlHttpProxy):
318         (WindowsSystemProxy::parseProxyString):
319         * NetworkProcess/win/SystemProxyWin.h: Added.
320         * PlatformWin.cmake:
321
322 2017-09-05  Youenn Fablet  <youenn@apple.com>
323
324         Allow retrieving Cache Storage records for a given URL only
325         https://bugs.webkit.org/show_bug.cgi?id=176202
326
327         Reviewed by Alex Christensen.
328
329         Update CacheStorageEngineCache to store records as a map URL -> Vector of Records.
330         This allows regular record retrieval to be faster.
331         Retrieval of all records is less efficient but this should happen less often.
332
333         * NetworkProcess/cache/CacheStorageEngine.cpp:
334         (WebKit::CacheStorage::Engine::retrieveRecords):
335         * NetworkProcess/cache/CacheStorageEngine.h:
336         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
337         (WebKit::CacheStorage::queryCache):
338         (WebKit::CacheStorage::Cache::retrieveRecords const):
339         (WebKit::CacheStorage::computeKeyURL):
340         (WebKit::CacheStorage::Cache::addNewURLRecord):
341         (WebKit::CacheStorage::Cache::recordsFromURL):
342         (WebKit::CacheStorage::Cache::recordsFromURL const):
343         (WebKit::CacheStorage::Cache::put):
344         (WebKit::CacheStorage::Cache::remove):
345         * NetworkProcess/cache/CacheStorageEngineCache.h:
346         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
347         (WebKit::CacheStorageEngineConnection::retrieveRecords):
348         * NetworkProcess/cache/CacheStorageEngineConnection.h:
349         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
350         * WebProcess/Cache/WebCacheStorageConnection.cpp:
351         (WebKit::WebCacheStorageConnection::doRetrieveRecords):
352         * WebProcess/Cache/WebCacheStorageConnection.h:
353
354 2017-09-05  Youenn Fablet  <youenn@apple.com>
355
356         WebKitTestRunner should set the cache storage directory path
357         https://bugs.webkit.org/show_bug.cgi?id=176373
358
359         Reviewed by Chris Dumez.
360
361         * UIProcess/API/C/WKContextConfigurationRef.cpp:
362         (WKContextConfigurationCopyCacheStorageDirectory):
363         (WKContextConfigurationSetCacheStorageDirectory):
364         * UIProcess/API/C/WKContextConfigurationRef.h:
365
366 2017-09-05  Alex Christensen  <achristensen@webkit.org>
367
368         Add WKUIDelegatePrivate equivalent of WKPageUIClient's unavailablePluginButtonClicked
369         https://bugs.webkit.org/show_bug.cgi?id=176274
370         <rdar://problem/29270035>
371
372         Reviewed by Darin Adler.
373
374         * UIProcess/API/APIUIClient.h:
375         (API::UIClient::unavailablePluginButtonClicked):
376         * UIProcess/API/C/WKPage.cpp:
377         (WKPageSetPageUIClient):
378         * UIProcess/API/Cocoa/WKPreferences.mm:
379         (-[WKPreferences _setPluginsEnabled:]):
380         (-[WKPreferences _pluginsEnabled]):
381         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
382         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
383         * UIProcess/Cocoa/UIDelegate.h:
384         * UIProcess/Cocoa/UIDelegate.mm:
385         (WebKit::UIDelegate::setDelegate):
386         (WebKit::toWKPluginUnavailabilityReason):
387         (WebKit::UIDelegate::UIClient::unavailablePluginButtonClicked):
388         * UIProcess/WebPageProxy.cpp:
389         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
390
391 2017-09-04  Alex Christensen  <achristensen@webkit.org>
392
393         Allow classes to have modern and legacy decoders to aid transition
394         https://bugs.webkit.org/show_bug.cgi?id=176186
395
396         Reviewed by Zan Dobersek.
397
398         To illustrate this, I made legacy and modern decoders to WTF::String and transitioned one String decoder.
399
400         * Platform/IPC/ArgumentCoder.h:
401         * Platform/IPC/ArgumentCoders.cpp:
402         (IPC::ArgumentCoder<String>::decode):
403         * Platform/IPC/ArgumentCoders.h:
404         * Platform/IPC/Decoder.h:
405         * Shared/WebPageCreationParameters.cpp:
406         (WebKit::WebPageCreationParameters::decode):
407
408 2017-09-05  Frederic Wang  <fwang@igalia.com>
409
410         Use TilesBacking for iframes when async frame scrolling is enabled
411         https://bugs.webkit.org/show_bug.cgi?id=173644
412
413         Reviewed by Simon Fraser.
414
415         This patch adds creation of TilesBacking for non-main frames when async frame scrolling is
416         enabled. RenderLayerBacking::m_isMainFrameLayerWithTiledBacking is also renamed to reflect
417         that tiled backing is not exclusive to the main frame. More adjustments might be needed for
418         non-main frames and will be handled in follow-up commits.
419
420         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
421         (WebKit::RemoteLayerTreeDrawingArea::shouldUseTiledBackingForFrameView): Also use tiled
422         backing when asyncFrameScrollingEnabled is true.
423         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
424         (WebKit::TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView): Ditto.
425
426 2017-09-05  Carlos Garcia Campos  <cgarcia@igalia.com>
427
428         [GTK] Rename PLUGIN_ARCHITECTURE(X11) as PLUGIN_ARCHITECTURE(UNIX)
429         https://bugs.webkit.org/show_bug.cgi?id=176330
430
431         Reviewed by Michael Catanzaro.
432
433         It's no longer X11 specific since it's also used in Wayland when the X11 target is enabled. It should be renamed
434         as UNIX and make it available when building the wayland target even if the X11 on is disabled.
435
436         * PlatformGTK.cmake:
437         * PlatformWPE.cmake:
438         * PluginProcess/unix/PluginProcessMainUnix.cpp:
439         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
440         (WebKit::NetscapePluginModule::tryLoad):
441         * Shared/Plugins/Netscape/NetscapePluginModule.h:
442         * Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp: Renamed from Source/WebKit/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp.
443         * UIProcess/Plugins/PluginProcessProxy.h:
444         * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
445         (WebKit::PluginInfoCache::getPluginInfo):
446         (WebKit::PluginInfoCache::updatePluginInfo):
447         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
448         (WebKit::PluginProcessProxy::scanPlugin):
449         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
450         (WebKit::NPN_InvalidateRect):
451         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
452         (WebKit::NetscapePlugin::initialize):
453         (WebKit::NetscapePlugin::destroy):
454         (WebKit::NetscapePlugin::geometryDidChange):
455         * WebProcess/Plugins/Netscape/NetscapePlugin.h:
456         * WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp:
457         * WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.h:
458         * config.h:
459
460 2017-09-05  Carlos Garcia Campos  <cgarcia@igalia.com>
461
462         [GTK] Wrong use of PLUGIN_ARCHITECTURE(X11) in several places
463         https://bugs.webkit.org/show_bug.cgi?id=176329
464
465         Reviewed by Michael Catanzaro.
466
467         We are using PLUGIN_ARCHITECTURE(X11) in several places where we should actually be using PLATFORM(X11). This is
468         confusing because PLUGIN_ARCHITECTURE(X11) is no longer specific to X11, it will be renamed as UNIX in a follow
469         up patch. Because of this we only support plugins in Wayland when building with both X11 and Wayland targets
470         enabled.
471
472         * PluginProcess/PluginControllerProxy.cpp:
473         * PluginProcess/PluginControllerProxy.h:
474         * PluginProcess/unix/PluginProcessMainUnix.cpp:
475         * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
476         (WebKit::NetscapePluginModule::determineQuirks):
477         * Shared/Plugins/PluginQuirks.h:
478         * UIProcess/WebPageProxy.h:
479         * UIProcess/WebPageProxy.messages.in:
480         * UIProcess/gtk/WebPageProxyGtk.cpp:
481         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
482         (WebKit::NPN_GetValue):
483         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
484         (WebKit::NetscapePlugin::shouldLoadSrcURL):
485         (WebKit::NetscapePlugin::initialize):
486         * WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp:
487         (WebKit::NetscapePlugin::platformHandleMouseEvent):
488         * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
489         * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h:
490         * WebProcess/Plugins/PluginController.h:
491         * WebProcess/Plugins/PluginProxy.cpp:
492         * WebProcess/Plugins/PluginProxy.h:
493         * WebProcess/Plugins/PluginProxy.messages.in:
494         * WebProcess/Plugins/PluginView.cpp:
495         * WebProcess/Plugins/PluginView.h:
496
497 2017-09-04  Wenson Hsieh  <wenson_hsieh@apple.com>
498
499         [iOS DnD] Refactor drag and drop logic in WKContentView in preparation for supporting multiple drag items in a drag session
500         https://bugs.webkit.org/show_bug.cgi?id=176264
501         <rdar://problem/31144674>
502
503         Reviewed by Darin Adler.
504
505         Move DataInteractionState from WKContentViewInteraction.h to DragDropInteractionState.h, and also rename it to
506         DragDropInteractionState. Additionally, refactor drag and drop state in the UI process to capture metadata about
507         the dragged element in a separate DragSourceState struct. This patch also moves drag and drop state transition
508         logic that doesn't involve WKContentView internals out of WKContentView, and into the implementation of
509         DragDropInteractionState.
510
511         To support multiple drag items per session, we also introduce a simple mechanism to trace a UIDragItem back to
512         the DragSourceState used to generate it. When generating a DragSourceState, we assign it a unique identifier,
513         which we also set as the privateLocalContext of all UIDragItems generated when beginning the drag (this
514         includes drag items returned by an internal client that uses one of the SPI hooks to augment drag items when
515         starting a drag). This is subsequently used in the implementation of lift and cancellation preview delegate
516         methods to supply the appropriate drag preview for each UIDragItem.
517
518         Lastly, fix a bug wherein the pageX and pageY of mouse drag events are inconsistent with other synthetic mouse
519         events, such as synthetic clicks. For synthetic clicks, the PlatformMouseEvent is initialized with the same
520         position and globalPosition. Whether this is really intended is unclear (see http://webkit.org/b/173855), but
521         it's a trivial change for now to keep mouse events on iOS consistent by tweaking the behavior during drag and
522         drop. See Tools/ChangeLog for some more information.
523
524         * Platform/spi/ios/UIKitSPI.h:
525
526         Add -[UIDragItem privateLocalContext].
527
528         * UIProcess/ios/DragDropInteractionState.h: Added.
529         (WebKit::DragDropInteractionState::stagedDragSource const):
530         (WebKit::DragDropInteractionState::dropSessionDidExit):
531         (WebKit::DragDropInteractionState::dropSessionWillPerformDrop):
532         (WebKit::DragDropInteractionState::adjustedPositionForDragEnd const):
533         (WebKit::DragDropInteractionState::didBeginDragging const):
534         (WebKit::DragDropInteractionState::isPerformingDrop const):
535         (WebKit::DragDropInteractionState::dragSession const):
536         (WebKit::DragDropInteractionState::dropSession const):
537
538         Wrap private drag/drop state member variables behind const getters, and move drag and drop logic that involves
539         only the DragDropInteractionState into helper methods on DragDropInteractionState.
540
541         (WebKit::DragDropInteractionState::BlockPtr<void):
542         * UIProcess/ios/DragDropInteractionState.mm: Added.
543         (WebKit::dragItemMatchingIdentifier):
544         (WebKit::createTargetedDragPreview):
545         (WebKit::uiImageForImage):
546
547         Move drag preview creation logic here, from WKContentViewInteraction.mm.
548
549         (WebKit::shouldUseTextIndicatorToCreatePreviewForDragAction):
550         (WebKit::DragDropInteractionState::activeDragSourceForItem const):
551         (WebKit::DragDropInteractionState::anyActiveDragSourceIs const):
552         (WebKit::DragDropInteractionState::prepareForDragSession):
553         (WebKit::DragDropInteractionState::dragSessionWillBegin):
554         (WebKit::DragDropInteractionState::previewForDragItem const):
555         (WebKit::DragDropInteractionState::dragSessionWillDelaySetDownAnimation):
556         (WebKit::DragDropInteractionState::dropSessionDidEnterOrUpdate):
557         (WebKit::DragDropInteractionState::stageDragItem):
558         (WebKit::DragDropInteractionState::hasStagedDragSource const):
559         (WebKit::DragDropInteractionState::clearStagedDragSource):
560         (WebKit::DragDropInteractionState::dragAndDropSessionsDidEnd):
561         (WebKit::DragDropInteractionState::updatePreviewsForActiveDragSources):
562         * UIProcess/ios/WKContentViewInteraction.h:
563
564         Move drag-and-drop-related state tied to the WKContentView here, from DataInteractionState (for instance, the
565         UIView for the drop caret, the WKContentView snapshot when dropping, and a flag use to keep track of hiding the
566         callout bar when dragging a text selection).
567
568         (): Deleted.
569         * UIProcess/ios/WKContentViewInteraction.mm:
570         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
571         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
572         (-[WKContentView _didChangeDragInteractionPolicy]):
573         (-[WKContentView setupDataInteractionDelegates]):
574         (-[WKContentView teardownDataInteractionDelegates]):
575         (-[WKContentView _startDrag:item:]):
576         (-[WKContentView _didHandleStartDataInteractionRequest:]):
577         (-[WKContentView computeClientAndGlobalPointsForDropSession:outClientPoint:outGlobalPoint:]):
578         (-[WKContentView cleanUpDragSourceSessionState]):
579         (-[WKContentView _didConcludeEditDataInteraction:]):
580         (-[WKContentView _didPerformDataInteractionControllerOperation:]):
581         (-[WKContentView _didChangeDataInteractionCaretRect:currentRect:]):
582         (-[WKContentView currentDragOrDropSession]):
583         (-[WKContentView _restoreCalloutBarIfNeeded]):
584         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
585         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
586         (-[WKContentView dragInteraction:previewForLiftingItem:session:]):
587         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
588         (-[WKContentView dragInteraction:sessionWillBegin:]):
589         (-[WKContentView dragInteraction:session:didEndWithOperation:]):
590         (-[WKContentView dragInteraction:previewForCancellingItem:withDefault:]):
591         (-[WKContentView _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:]):
592         (-[WKContentView dragInteraction:item:willAnimateCancelWithAnimator:]):
593         (-[WKContentView dropInteraction:sessionDidEnter:]):
594         (-[WKContentView dropInteraction:sessionDidUpdate:]):
595         (-[WKContentView dropInteraction:sessionDidExit:]):
596         (-[WKContentView dropInteraction:performDrop:]):
597         (-[WKContentView dropInteraction:sessionDidEnd:]):
598
599         Pull out logic that mutates drag and drop state into DragDropInteractionState. Adjust places that previously
600         accessed DataInteractionState's members directly with corresponding getters in DragDropInteractionState.
601
602         (-[WKContentView _simulateDataInteractionEntered:]):
603         (-[WKContentView _simulateDataInteractionUpdated:]):
604         (-[WKContentView _simulateDataInteractionEnded:]):
605         (-[WKContentView _simulateDataInteractionPerformOperation:]):
606         (-[WKContentView _simulateDataInteractionSessionDidEnd:]):
607         (-[WKContentView _simulateWillBeginDataInteractionWithSession:]):
608         (-[WKContentView _simulatedItemsForSession:]):
609         (-[WKContentView _simulatePrepareForDataInteractionSession:completion:]):
610
611         Rename _dataInteraction => _dragInteraction and _dataOperation => _dropInteraction.
612
613         (uiImageForImage): Deleted.
614         (shouldUseTextIndicatorToCreatePreviewForDragAction): Deleted.
615         (-[WKContentView dragPreviewForImage:frameInRootViewCoordinates:clippingRectsInFrameCoordinates:backgroundColor:]): Deleted.
616         (-[WKContentView dragPreviewForCurrentDataInteractionState]): Deleted.
617         (-[WKContentView _transitionDragPreviewToImageIfNecessary:]): Deleted.
618         * WebKit.xcodeproj/project.pbxproj:
619
620 2017-09-03  Carlos Garcia Campos  <cgarcia@igalia.com>
621
622         [Threaded Compositor] Deadlock in ThreadedDisplayRefreshMonitor
623         https://bugs.webkit.org/show_bug.cgi?id=176296
624
625         Reviewed by Žan Doberšek.
626
627         The main thread tries to schedule a display refresh monitor from RAF, requestDisplayRefreshMonitorUpdate() tries
628         to take the attributes lock to update coordinateUpdateCompletionWithClient. The compositing thread has finished
629         a frame and sceneUpdateFinished() takes the attributes lock to update clientRendersNextFrame and then asks the
630         display refresh monitor if it requires a new callback. ThreadedDisplayRefreshMonitor::requiresDisplayRefreshCallback()
631         takes its lock to check the state, and requestDisplayRefreshMonitorUpdate() was called by
632         ThreadedDisplayRefreshMonitor::requestRefreshCallback() with the display refresh monitor lock taken. So,
633         the compositing thread has the attributes lock and wants the display refresh monitor one, and main thread has the
634         display refresh monitor lock and wants the attributes one.
635
636         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
637         (WebKit::ThreadedDisplayRefreshMonitor::requestRefreshCallback): Release the mutex before calling
638         ThreadedCompositor::requestDisplayRefreshMonitorUpdate().
639
640 2017-09-03  Zan Dobersek  <zdobersek@igalia.com>
641
642         [GTK] Libgcrypt warning: missing initialization - please fix the application
643         https://bugs.webkit.org/show_bug.cgi?id=171230
644
645         Reviewed by Michael Catanzaro.
646
647         Replicate the libgcrypt initialization in the NetworkProcess entrypoint.
648         This is required due to libgcrypt being used through digest operations
649         originating from the certificate hash computation in SoupNetworkSession.
650
651         The initialization is moved to the PAL library, and the initialize()
652         function is now leveraged in both NetworkProcess and WebProcess entrypoints.
653
654         * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
655         (main):
656         * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
657         (main):
658
659 2017-09-03  Zan Dobersek  <zdobersek@igalia.com>
660
661         [WPE] Use the device scale factor value in WebPageCreationParameters
662         https://bugs.webkit.org/show_bug.cgi?id=175377
663
664         Reviewed by Michael Catanzaro.
665
666         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
667         (WebKit::AcceleratedDrawingArea::AcceleratedDrawingArea):
668         WebPageCreationParameters::deviceScaleFactor value should be used
669         to set the device scale factor on the given WebPage object. This
670         enables correctly leveraging the scale factor for the WPE port
671         which enters accelerated mode unconditionally and as such doesn't
672         wait for the backing store update that would provide that value
673         otherwise.
674
675 2017-09-03  Brent Fulgham  <bfulgham@apple.com>
676
677         [WK2][iOS] Remove unnecessary IOHIDEventServiceFastPathUserClient access
678         https://bugs.webkit.org/show_bug.cgi?id=175947
679         <rdar://problem/33353627>
680
681         Reviewed by Darin Adler.
682
683         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
684
685 2017-09-03  Dan Bernstein  <mitz@apple.com>
686
687         WKContentViewInteraction.mm includes redundant declaration of UIPreviewItemController's presentationSecondaryGestureRecognizer
688         https://bugs.webkit.org/show_bug.cgi?id=176322
689
690         Reviewed by Darin Adler.
691
692         * UIProcess/ios/WKContentViewInteraction.mm: Removed the declaration, which is already made in the
693           SDK or in UIKitSPI.h.
694
695 2017-09-03  Timothy Horton  <timothy_horton@apple.com>
696
697         Try to fix the iOS build
698
699         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
700         (-[WKRemoteView initWithFrame:contextID:]):
701
702 2017-09-03  Tim Horton  <timothy_horton@apple.com>
703
704         Fix some style issues in the Remote Layer Tree code
705         https://bugs.webkit.org/show_bug.cgi?id=176298
706
707         Reviewed by Dan Bernstein.
708
709         In bugs 176273 and 176297, the style bot noticed some existing style
710         issues in the UI-side compositing code. Fix them, because there aren't
711         many and they're straightforward.
712
713         * Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
714         * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h:
715         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
716         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.h:
717         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
718         * UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.h:
719         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
720         * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
721         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
722         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
723
724 2017-09-03  Yusuke Suzuki  <utatane.tea@gmail.com>
725
726         String#utf8() allocates new CString
727         https://bugs.webkit.org/show_bug.cgi?id=176302
728
729         Reviewed by Sam Weinig.
730
731         * NetworkProcess/webrtc/NetworkRTCSocket.cpp:
732         (WebKit::NetworkRTCSocket::sendTo):
733
734 2017-09-03  Tim Horton  <timothy_horton@apple.com>
735
736         Move shared part of the Remote Layer Tree code out of a Mac-specific directory
737         https://bugs.webkit.org/show_bug.cgi?id=176297
738
739         Reviewed by Dan Bernstein.
740
741         UI-side compositing works on all Cocoa platforms, so the code should
742         not live inside Mac/. Also merge the Scrolling directory in here,
743         since those files are very related.
744
745         * PlatformMac.cmake:
746         * Shared/RemoteLayerTree/RemoteLayerBackingStore.h: Renamed from Shared/mac/RemoteLayerBackingStore.h.
747         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: Renamed from Shared/mac/RemoteLayerBackingStore.mm.
748         * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h: Renamed from Shared/mac/RemoteLayerBackingStoreCollection.h.
749         * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm: Renamed from Shared/mac/RemoteLayerBackingStoreCollection.mm.
750         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h: Renamed from Shared/mac/RemoteLayerTreePropertyApplier.h.
751         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm: Renamed from Shared/mac/RemoteLayerTreePropertyApplier.mm.
752         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h: Renamed from Shared/mac/RemoteLayerTreeTransaction.h.
753         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm: Renamed from Shared/mac/RemoteLayerTreeTransaction.mm.
754         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: Renamed from Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp.
755         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.h: Renamed from Shared/Scrolling/RemoteScrollingCoordinatorTransaction.h.
756         * WebKit.xcodeproj/project.pbxproj:
757
758 2017-09-03  Sam Weinig  <sam@webkit.org>
759
760         Remove CanvasProxy
761         https://bugs.webkit.org/show_bug.cgi?id=176288
762
763         Reviewed by Yusuke Suzuki.
764
765         CanvasProxy does not appear to be in any current HTML spec
766         and was disabled and unimplemented in our tree. Time to 
767         get rid of it.
768
769         * Configurations/FeatureDefines.xcconfig:
770
771 2017-09-02  Andy Estes  <aestes@apple.com>
772
773         [CA] Upstream QuartzCore-related WebKitSystemInterface functions
774         https://bugs.webkit.org/show_bug.cgi?id=176270
775
776         Reviewed by Tim Horton.
777
778         * Platform/mac/LayerHostingContext.mm:
779         (WebKit::LayerHostingContext::createForPort):
780         (WebKit::LayerHostingContext::createForExternalHostingProcess):
781         * UIProcess/mac/PageClientImpl.mm:
782         (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
783         (WebKit::PageClientImpl::updateAcceleratedCompositingMode):
784         * UIProcess/mac/RemoteLayerTreeHost.mm:
785         (WebKit::RemoteLayerTreeHost::createLayer):
786         * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm:
787         (WebKit::makeRenderLayer):
788         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
789         (InitWebCoreSystemInterface):
790
791 2017-09-02  Tim Horton  <timothy_horton@apple.com>
792
793         Move UI Process part of the Remote Layer Tree code out of a Mac-specific directory
794         https://bugs.webkit.org/show_bug.cgi?id=176273
795
796         Reviewed by Dan Bernstein.
797
798         UI-side compositing works on all Cocoa platforms, so the code should
799         not live inside Mac/. Also merge the Scrolling directory in here,
800         since those files are very related.
801
802         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: Renamed from SourceebKit/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h.
803         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in: Renamed from UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.messages.in.
804         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: Renamed from UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm.
805         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h: Renamed from UIProcess/mac/RemoteLayerTreeHost.h.
806         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm: Renamed from UIProcess/mac/RemoteLayerTreeHost.mm.
807         * UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.h: Renamed from UIProcess/Cocoa/RemoteLayerTreeScrollingPerformanceData.h.
808         * UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.mm: Renamed from UIProcess/Cocoa/RemoteLayerTreeScrollingPerformanceData.mm.
809         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: Renamed from UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp.
810         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: Renamed from UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h.
811         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp: Renamed from UIProcess/Scrolling/RemoteScrollingTree.cpp.
812         * UIProcess/RemoteLayerTree/RemoteScrollingTree.h: Renamed from UIProcess/Scrolling/RemoteScrollingTree.h.
813         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm: Renamed from UIProcess/ios/RemoteLayerTreeHostIOS.mm.
814         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: Renamed from UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm.
815         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h: Renamed from UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h.
816         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm: Renamed from UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm.
817         * WebKit.xcodeproj/project.pbxproj:
818
819 2017-09-02  Joseph Pecoraro  <pecoraro@apple.com>
820
821         Web Automation: -[_WKAutomationSession init] leaks
822         https://bugs.webkit.org/show_bug.cgi?id=176268
823
824         Reviewed by Darin Adler.
825
826         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
827         (-[_WKAutomationSession init]):
828
829 2017-09-02  Tim Horton  <timothy_horton@apple.com>
830
831         Fix some style issues in the Web Process part of the Remote Layer Tree code
832         https://bugs.webkit.org/show_bug.cgi?id=176272
833
834         Reviewed by Dan Bernstein.
835
836         In bug 176271, the style bot noticed some existing style issues in the UI-side
837         compositing code. Fix them, because there aren't many and they're straightforward.
838
839         * WebProcess/WebPage/Cocoa/RemoteLayerTree/GraphicsLayerCARemote.cpp:
840         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCAAnimationRemote.h:
841         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCAAnimationRemote.mm:
842         (WebKit::PlatformCAAnimationRemote::setValues):
843         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCALayerRemote.cpp:
844         (WebKit::PlatformCALayerRemote::appendSublayer):
845         (WebKit::PlatformCALayerRemote::insertSublayer):
846         (WebKit::PlatformCALayerRemote::replaceSublayer):
847         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCALayerRemote.h:
848         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
849         (WebKit::PlatformCALayerRemoteCustom::clone const):
850         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.h:
851         * WebProcess/WebPage/Cocoa/RemoteLayerTree/RemoteLayerTreeContext.h:
852         * WebProcess/WebPage/Cocoa/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
853         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
854         * WebProcess/WebPage/Cocoa/RemoteLayerTree/RemoteScrollingCoordinator.h:
855         * WebProcess/WebPage/Cocoa/RemoteLayerTree/RemoteScrollingCoordinator.mm:
856
857 2017-09-02  Tim Horton  <timothy_horton@apple.com>
858
859         Move Web Process part of the Remote Layer Tree code out of a Mac-specific directory
860         https://bugs.webkit.org/show_bug.cgi?id=176271
861
862         Rubber-stamped by Dan Bernstein.
863
864         UI-side compositing works on all Cocoa platforms, so the code should
865         not live inside Mac/. Also merge the Scrolling directory in here,
866         since those files are very related.
867
868         * WebKit.xcodeproj/project.pbxproj:
869         * DerivedSources.make:
870         * PlatformMac.cmake:
871         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp: Renamed from WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp.
872         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h: Renamed from WebProcess/WebPage/mac/GraphicsLayerCARemote.h.
873         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h: Renamed from WebProcess/WebPage/mac/PlatformCAAnimationRemote.h.
874         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: Renamed from WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm.
875         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemote.cpp.
876         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemote.h.
877         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.h: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h.
878         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm.
879         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.cpp: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp.
880         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.h: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h.
881         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h: Renamed from WebProcess/WebPage/mac/RemoteLayerTreeContext.h.
882         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: Renamed from WebProcess/WebPage/mac/RemoteLayerTreeContext.mm.
883         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h: Renamed from WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.h.
884         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm: Renamed from WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.mm.
885         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: Renamed from WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h.
886         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: Renamed from WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm.
887         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h: Renamed from WebProcess/Scrolling/RemoteScrollingCoordinator.h.
888         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.messages.in: Renamed from WebProcess/Scrolling/RemoteScrollingCoordinator.messages.in.
889         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: Renamed from WebProcess/Scrolling/RemoteScrollingCoordinator.mm.
890
891 2017-09-02  Carlos Garcia Campos  <cgarcia@igalia.com>
892
893         [GTK][Wayland] Use fast malloc to allocate backing store cairo surfaces data
894         https://bugs.webkit.org/show_bug.cgi?id=176226
895
896         Reviewed by Michael Catanzaro.
897
898         Do not create the cairo surface for BackingStoreBackendCairoImpl. When not using X11 we are going to use an
899         image surface anyway, so we don't really need to use the create similar. This way we only need to pass the size
900         and device scale factor to BackingStoreBackendCairoImpl that will create the image surface using fast malloc to
901         allocate the data.
902
903         * UIProcess/cairo/BackingStoreCairo.cpp:
904         (WebKit::BackingStore::createBackend):
905
906 2017-09-02  Carlos Garcia Campos  <cgarcia@igalia.com>
907
908         [GTK][Wayland] Opening FedoraProject's pastebin chews CPU
909         https://bugs.webkit.org/show_bug.cgi?id=175942
910
911         Reviewed by Žan Doberšek.
912
913         This regressed when we introduced the display refresh monitor. The monitor schedules updates immediately,
914         because we removed the option to not do frame sync in X11 to let swapBuffers do the throttling, but that's
915         not happening in Wayland because the nested compositor is dispatching frame callbacks on surface commit.
916         We need to ensure that frame callbacks are dispatched on every monitor refresh, because swapBuffers waits for
917         frame callbacks to be queued on display.
918
919         * UIProcess/gtk/WaylandCompositor.cpp:
920         (WebKit::WaylandCompositor::Surface::~Surface): Destroy pending frame callbacks too.
921         (WebKit::WaylandCompositor::Surface::setWebPage): Add a tick callback to the web view widget to flush all
922         committed frame callbacks on every frame update.
923         (WebKit::WaylandCompositor::Surface::requestFrame): Add the callbacks to m_pendingFrameCallbackList.
924         (WebKit::WaylandCompositor::Surface::flushFrameCallbacks): Dispatch all committed frame callabcks.
925         (WebKit::WaylandCompositor::Surface::flushPendingFrameCallbacks): Dispatch all pending frame callbacks.
926         (WebKit::WaylandCompositor::Surface::commit): Do not dispatch frame callbacks here, move them to the list of
927         committed frame callbacks that will be dispatched on the next frame clock update.
928         * UIProcess/gtk/WaylandCompositor.h:
929         (WebKit::WaylandCompositor::Surface::setWebPage): Moved to the cpp.
930         * WebProcess/WebPage/gtk/AcceleratedSurfaceWayland.cpp:
931         (WebKit::AcceleratedSurfaceWayland::AcceleratedSurfaceWayland): Move surface initialization and destruction to
932         the compositing thread.
933         (WebKit::AcceleratedSurfaceWayland::initialize):
934         (WebKit::AcceleratedSurfaceWayland::finalize):
935         (WebKit::AcceleratedSurfaceWayland::~AcceleratedSurfaceWayland): Deleted.
936         * WebProcess/WebPage/gtk/AcceleratedSurfaceWayland.h:
937
938 2017-09-01  Youenn Fablet  <youenn@apple.com>
939
940         Do not Reject CacheStorage promises when updating the persistent filesystem data fails
941         https://bugs.webkit.org/show_bug.cgi?id=176241
942
943         Reviewed by Alex Christensen.
944
945         Open/Remove caches may succeed in the memory representation but the write-to-disk operation may fail.
946         In that case, the callback does not return an error but a value containing the cache identifier.
947         The value will also contain a boolean flag set to true to notify the client that persistent storage failed this time.
948
949         * NetworkProcess/cache/CacheStorageEngine.cpp:
950         (WebKit::CacheStorage::Engine::open):
951         (WebKit::CacheStorage::Engine::remove):
952         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
953         (WebKit::CacheStorage::Caches::open):
954         (WebKit::CacheStorage::Caches::remove):
955         * NetworkProcess/cache/CacheStorageEngineCaches.h:
956
957 2017-09-01  Alex Christensen  <achristensen@webkit.org>
958
959         Add WKUIDelegatePrivate equivalent of WKPageUIClient's toolbarsAreVisible
960         https://bugs.webkit.org/show_bug.cgi?id=176246
961         <rdar://problem/29270035>
962
963         Reviewed by Tim Horton.
964
965         * UIProcess/API/APIUIClient.h:
966         (API::UIClient::toolbarsAreVisible):
967         * UIProcess/API/C/WKPage.cpp:
968         (WKPageSetPageUIClient):
969         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
970         * UIProcess/Cocoa/UIDelegate.h:
971         * UIProcess/Cocoa/UIDelegate.mm:
972         (WebKit::UIDelegate::setDelegate):
973         (WebKit::UIDelegate::UIClient::toolbarsAreVisible):
974         * UIProcess/WebPageProxy.cpp:
975         (WebKit::WebPageProxy::getToolbarsAreVisible):
976         * UIProcess/WebPageProxy.h:
977         * UIProcess/WebPageProxy.messages.in:
978
979 2017-09-01  Alex Christensen  <achristensen@webkit.org>
980
981         Make PageClientImplCocoa a proper superclass of PageClientImpls for Mac and iOS
982         https://bugs.webkit.org/show_bug.cgi?id=176239
983
984         Reviewed by Tim Horton.
985
986         * UIProcess/Cocoa/PageClientImplCocoa.h: Added.
987         (WebKit::PageClientImplCocoa::PageClientImplCocoa):
988         * UIProcess/Cocoa/PageClientImplCocoa.mm:
989         (WebKit::PageClientImplCocoa::isPlayingAudioWillChange):
990         (WebKit::PageClientImplCocoa::isPlayingAudioDidChange):
991         (WebKit::PageClientImpl::isPlayingAudioWillChange): Deleted.
992         (WebKit::PageClientImpl::isPlayingAudioDidChange): Deleted.
993         * UIProcess/Cocoa/WebViewImpl.mm:
994         * UIProcess/ios/PageClientImplIOS.h:
995         * UIProcess/ios/PageClientImplIOS.mm:
996         (WebKit::PageClientImpl::PageClientImpl):
997         * UIProcess/mac/PageClientImpl.h: Removed.
998         * UIProcess/mac/PageClientImpl.mm: Removed.
999         * UIProcess/mac/PageClientImplMac.h: Copied from Source/WebKit/UIProcess/mac/PageClientImpl.h.
1000         * UIProcess/mac/PageClientImplMac.mm: Copied from Source/WebKit/UIProcess/mac/PageClientImpl.mm.
1001         (WebKit::PageClientImpl::PageClientImpl):
1002         * UIProcess/mac/WebContextMenuProxyMac.mm:
1003         * UIProcess/mac/WebPageProxyMac.mm:
1004         * UIProcess/mac/WebPopupMenuProxyMac.mm:
1005         * WebKit.xcodeproj/project.pbxproj:
1006
1007 2017-09-01  Alex Christensen  <achristensen@webkit.org>
1008
1009         Replace WKUIDelegatePrivate's isPlayingMediaDidChange with KVO _isPlayingAudio on WKWebView
1010         https://bugs.webkit.org/show_bug.cgi?id=176212
1011
1012         Reviewed by Tim Horton.
1013
1014         Dan suggested this in bug 176203, I think it's a good idea,
1015         and I'll need to add more KVO properties soon anyways so I'd better learn how.
1016         Determining if audio playing changed is important for Safari, so WKPageUIClient's
1017         isPlayingAudioDidChange was correctly named but incorrectly fired if either audio
1018         or video playing changed and had you check if audio was playing, possibly too often.
1019
1020         * UIProcess/API/APIUIClient.h:
1021         (API::UIClient::isPlayingMediaDidChange):
1022         * UIProcess/API/C/WKPage.cpp:
1023         (WKPageSetPageUIClient):
1024         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1025         * UIProcess/API/Cocoa/WKWebView.mm:
1026         (-[WKWebView _isPlayingAudio]):
1027         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1028         * UIProcess/API/glib/WebKitUIClient.cpp:
1029         * UIProcess/Cocoa/UIDelegate.h:
1030         * UIProcess/Cocoa/UIDelegate.mm:
1031         (WebKit::UIDelegate::setDelegate):
1032         (WebKit::UIDelegate::UIClient::isPlayingMediaDidChange): Deleted.
1033         * UIProcess/Cocoa/WebViewImpl.h:
1034         * UIProcess/Cocoa/WebViewImpl.mm:
1035         (WebKit::WebViewImpl::isPlayingAudioWillChange):
1036         (WebKit::WebViewImpl::isPlayingAudioDidChange):
1037         * UIProcess/PageClient.h:
1038         * UIProcess/WebPageProxy.cpp:
1039         (WebKit::WebPageProxy::isPlayingMediaDidChange):
1040         * UIProcess/mac/PageClientImpl.h:
1041         * UIProcess/mac/PageClientImpl.mm:
1042         (WebKit::PageClientImpl::isPlayingAudioDidChange):
1043         (WebKit::PageClientImpl::isPlayingAudioWillChange):
1044
1045 2017-09-01  Alex Christensen  <achristensen@webkit.org>
1046
1047         Disable ObjC WebGL policy SPI on iOS
1048         https://bugs.webkit.org/show_bug.cgi?id=176233
1049
1050         Reviewed by Tim Horton.
1051         
1052         In r221465 I uploaded new SPI that is only needed on Mac with a beautiful test that only works on Mac.
1053         Since it fails on iOS and is not needed on iOS, let's just disable it on iOS.
1054
1055         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1056         * UIProcess/Cocoa/NavigationState.h:
1057         * UIProcess/Cocoa/NavigationState.mm:
1058         (WebKit::NavigationState::setNavigationDelegate):
1059
1060 2017-09-01  Andy Estes  <aestes@apple.com>
1061
1062         [CG] Upstream CoreGraphics-related WebKitSystemInterface functions
1063         https://bugs.webkit.org/show_bug.cgi?id=176200
1064
1065         Reviewed by Tim Horton.
1066
1067         * PluginProcess/mac/PluginProcessMac.mm:
1068         (WebKit::PluginProcess::platformInitializeProcess):
1069         * UIProcess/mac/WindowServerConnection.h:
1070         * UIProcess/mac/WindowServerConnection.mm:
1071         (WebKit::registerOcclusionNotificationHandler):
1072         (WebKit::WindowServerConnection::WindowServerConnection):
1073         (WebKit::WindowServerConnection::applicationWindowModificationsStarted): Deleted.
1074         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
1075         (InitWebCoreSystemInterface):
1076
1077 2017-09-01  Per Arne Vollan  <pvollan@apple.com>
1078
1079         [Win] Compile error, 'Cache' is not declared.
1080         https://bugs.webkit.org/show_bug.cgi?id=176062
1081
1082         Reviewed by Youenn Fablet.
1083
1084         Rename DOMCache to DOMCacheEngine.
1085
1086         * NetworkProcess/cache/CacheStorageEngine.cpp:
1087         (WebKit::CacheStorage::Engine::queryCache):
1088         (WebKit::CacheStorage::Engine::writeFile):
1089         * NetworkProcess/cache/CacheStorageEngine.h:
1090         * NetworkProcess/cache/CacheStorageEngineCache.h:
1091         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1092         (WebKit::CacheStorage::Caches::initialize):
1093         * NetworkProcess/cache/CacheStorageEngineCaches.h:
1094         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
1095         * NetworkProcess/cache/CacheStorageEngineConnection.h:
1096         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
1097         * Shared/WebCoreArgumentCoders.cpp:
1098         (IPC::ArgumentCoder<DOMCacheEngine::CacheInfo>::encode):
1099         (IPC::ArgumentCoder<DOMCacheEngine::CacheInfo>::decode):
1100         (IPC::ArgumentCoder<DOMCacheEngine::Record>::encode):
1101         (IPC::ArgumentCoder<DOMCacheEngine::Record>::decode):
1102         (IPC::ArgumentCoder<DOMCache::CacheInfo>::encode): Deleted.
1103         (IPC::ArgumentCoder<DOMCache::CacheInfo>::decode): Deleted.
1104         (IPC::ArgumentCoder<DOMCache::Record>::encode): Deleted.
1105         (IPC::ArgumentCoder<DOMCache::Record>::decode): Deleted.
1106         * Shared/WebCoreArgumentCoders.h:
1107         * WebProcess/Cache/WebCacheStorageConnection.cpp:
1108         * WebProcess/Cache/WebCacheStorageConnection.h:
1109         * WebProcess/Cache/WebCacheStorageConnection.messages.in:
1110
1111 2017-08-31  Andy Estes  <aestes@apple.com>
1112
1113         [Mac] Upstream AppKit-related WebKitSystemInterface functions
1114         https://bugs.webkit.org/show_bug.cgi?id=176175
1115
1116         Reviewed by Brady Eidson.
1117
1118         * PluginProcess/mac/PluginProcessMac.mm:
1119         (WebKit::initializeCocoaOverrides):
1120         * Shared/mac/WebEventFactory.mm:
1121         (WebKit::WebEventFactory::createWebWheelEvent):
1122         (WebKit::WebEventFactory::createWebKeyboardEvent):
1123         * UIProcess/mac/WKTextInputWindowController.mm:
1124         (-[WKTextInputPanel init]):
1125         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
1126         (InitWebCoreSystemInterface):
1127
1128 2017-08-31  Alex Christensen  <achristensen@webkit.org>
1129
1130         Add WKUIDelegatePrivate equivalent of WKPageUIClient's isPlayingAudioDidChange
1131         https://bugs.webkit.org/show_bug.cgi?id=176203
1132         <rdar://problem/29270035>
1133
1134         Reviewed by Tim Horton.
1135
1136         * UIProcess/API/APIUIClient.h:
1137         (API::UIClient::isPlayingMediaDidChange):
1138         (API::UIClient::isPlayingAudioDidChange): Deleted.
1139         * UIProcess/API/C/WKPage.cpp:
1140         (WKPageSetPageUIClient):
1141         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1142         * UIProcess/Cocoa/UIDelegate.h:
1143         * UIProcess/Cocoa/UIDelegate.mm:
1144         (WebKit::UIDelegate::setDelegate):
1145         (WebKit::UIDelegate::UIClient::isPlayingMediaDidChange):
1146         * UIProcess/WebPageProxy.cpp:
1147         (WebKit::WebPageProxy::isPlayingMediaDidChange):
1148
1149 2017-08-31  Alex Christensen  <achristensen@webkit.org>
1150
1151         Add ObjC SPI corresponding to WKPageLoaderClient's webGLLoadPolicy and resolveWebGLLoadPolicy
1152         https://bugs.webkit.org/show_bug.cgi?id=175779
1153         <rdar://problem/22367975>
1154
1155         Reviewed by Tim Horton.
1156
1157         * UIProcess/API/APINavigationClient.h:
1158         (API::NavigationClient::webGLLoadPolicy const):
1159         (API::NavigationClient::resolveWebGLLoadPolicy const):
1160         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1161         * UIProcess/Cocoa/NavigationState.h:
1162         * UIProcess/Cocoa/NavigationState.mm:
1163         (WebKit::NavigationState::setNavigationDelegate):
1164         (WebKit::toWebCoreWebGLLoadPolicy):
1165         (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const):
1166         (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const):
1167         * UIProcess/WebPageProxy.cpp:
1168         (WebKit::WebPageProxy::webGLPolicyForURL):
1169         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
1170         * UIProcess/WebPageProxy.h:
1171         * UIProcess/WebPageProxy.messages.in:
1172         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1173         (WebKit::WebFrameLoaderClient::webGLPolicyForURL const):
1174         (WebKit::WebFrameLoaderClient::resolveWebGLPolicyForURL const):
1175         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1176         * WebProcess/WebPage/WebPage.cpp:
1177         (WebKit::WebPage::webGLPolicyForURL):
1178         (WebKit::WebPage::resolveWebGLPolicyForURL):
1179         * WebProcess/WebPage/WebPage.h:
1180         * WebProcess/WebPage/ios/WebPageIOS.mm:
1181         (WebKit::WebPage::webGLPolicyForURL):
1182         (WebKit::WebPage::resolveWebGLPolicyForURL):
1183         * WebProcess/WebPage/mac/WebPageMac.mm:
1184         (WebKit::WebPage::webGLPolicyForURL):
1185         (WebKit::WebPage::resolveWebGLPolicyForURL):
1186
1187 2017-08-31  Brady Eidson  <beidson@apple.com>
1188
1189         Add (entirely incorrect) fetching of ServiceWorker scripts.
1190         https://bugs.webkit.org/show_bug.cgi?id=176179
1191
1192         Reviewed by Andy Estes.
1193
1194         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1195         (WebKit::WebSWServerConnection::startScriptFetchInClient):
1196         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1197         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1198
1199         * WebProcess/Storage/WebSWClientConnection.cpp:
1200         (WebKit::WebSWClientConnection::finishFetchingScriptInServer):
1201         * WebProcess/Storage/WebSWClientConnection.h:
1202         * WebProcess/Storage/WebSWClientConnection.messages.in:
1203
1204 2017-08-31  Megan Gardner  <megan_gardner@apple.com>
1205
1206         Fix error in protocol revving
1207         https://bugs.webkit.org/show_bug.cgi?id=176191
1208
1209         Protocol definition was mastered out of later iOS submissions, causing them to not build.
1210
1211         Reviewed by Tim Horton.
1212
1213         * UIProcess/ios/WKContentViewInteraction.mm:
1214         (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:]):
1215
1216 2017-08-31  Youenn Fablet  <youenn@apple.com>
1217
1218         Update CacheStorage caches only if it is updated
1219         https://bugs.webkit.org/show_bug.cgi?id=176135
1220
1221         Reviewed by Alex Christensen.
1222
1223         For each change to CacheStorageEngineCaches list of cache, CacheStorageEngineCaches increments a counter.
1224         When sending the list of caches, CacheStorageEngineCaches will compare its counter with the one provided.
1225         If they sare the same, CacheStorageEngineCaches will return nothing.
1226         Otherwise it returns the whole list of caches.
1227
1228         * NetworkProcess/cache/CacheStorageEngine.cpp:
1229         (WebKit::CacheStorage::Engine::retrieveCaches):
1230         * NetworkProcess/cache/CacheStorageEngine.h:
1231         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1232         (WebKit::CacheStorage::Caches::initialize):
1233         (WebKit::CacheStorage::Caches::open):
1234         (WebKit::CacheStorage::Caches::remove):
1235         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
1236         (WebKit::CacheStorage::Caches::cacheInfos const):
1237         * NetworkProcess/cache/CacheStorageEngineCaches.h:
1238         (WebKit::CacheStorage::Caches::updateCounter const):
1239         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
1240         (WebKit::CacheStorageEngineConnection::caches):
1241         * NetworkProcess/cache/CacheStorageEngineConnection.h:
1242         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
1243         * WebProcess/Cache/WebCacheStorageConnection.cpp:
1244         (WebKit::WebCacheStorageConnection::doRetrieveCaches):
1245         * WebProcess/Cache/WebCacheStorageConnection.h:
1246
1247 2017-08-31  Youenn Fablet  <youenn@apple.com>
1248
1249         Introduce CacheStorageEngineCache to handle cache records
1250         https://bugs.webkit.org/show_bug.cgi?id=176137
1251
1252         Reviewed by Alex Christensen.
1253
1254         CacheStorageEngineCache is the equivalent of WebCore Cache.
1255         It contains a list of records that it needs to manage (add, update, remove).
1256         Moving the logic of this management from CacheStorageEngine to this new class so as to ease future development.
1257
1258         * CMakeLists.txt:
1259         * NetworkProcess/cache/CacheStorageEngine.cpp:
1260         (WebKit::CacheStorage::Engine::open):
1261         (WebKit::CacheStorage::Engine::remove):
1262         (WebKit::CacheStorage::Engine::retrieveRecords):
1263         (WebKit::CacheStorage::Engine::putRecords):
1264         (WebKit::CacheStorage::Engine::deleteMatchingRecords):
1265         (WebKit::CacheStorage::Engine::cache):
1266         (WebKit::CacheStorage::Engine::writeCacheRecords): Deleted.
1267         (WebKit::CacheStorage::Engine::removeCacheRecords): Deleted.
1268         (WebKit::CacheStorage::Engine::queryCache): Deleted.
1269         * NetworkProcess/cache/CacheStorageEngine.h:
1270         * NetworkProcess/cache/CacheStorageEngineCache.cpp: Added.
1271         * NetworkProcess/cache/CacheStorageEngineCache.h:
1272         (WebKit::CacheStorage::Cache::identifier const):
1273         (WebKit::CacheStorage::Cache::name const):
1274         (WebKit::CacheStorage::Cache::info const):
1275         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1276         (WebKit::CacheStorage::Caches::find):
1277         (WebKit::CacheStorage::Caches::open):
1278         (WebKit::CacheStorage::Caches::remove):
1279         (WebKit::CacheStorage::encodeCacheNames):
1280         (WebKit::CacheStorage::Caches::readCachesFromDisk):
1281         (WebKit::CacheStorage::Caches::cacheInfos const):
1282         * WebKit.xcodeproj/project.pbxproj:
1283
1284 2017-08-31  David Quesada  <david_quesada@apple.com>
1285
1286         WKNavigationDelegatePrivate client redirect SPI needs to be able to detect redirects scheduled before the document finishes loading
1287         https://bugs.webkit.org/show_bug.cgi?id=176128
1288         rdar://problem/34068476
1289
1290         Reviewed by Brady Eidson.
1291
1292         _webView:didPerformClientRedirect: isn't useful for delegates that want to know about client redirects
1293         started before the document is finished loading. This is because the method would be called after the
1294         navigation scheduler's timer fires and the navigation for the redirect has begun. Since this happens in
1295         a later iteration of the run loop, the document has already finished loading. Address this by replacing
1296         the method with two that give the navigation delegate more information about when client redirects are
1297         scheduled and canceled.
1298
1299         * UIProcess/API/APINavigationClient.h:
1300         (API::NavigationClient::willPerformClientRedirect):
1301         (API::NavigationClient::didCancelClientRedirect):
1302         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1303         * UIProcess/Cocoa/NavigationState.h:
1304         * UIProcess/Cocoa/NavigationState.mm:
1305         (WebKit::NavigationState::setNavigationDelegate):
1306         (WebKit::NavigationState::NavigationClient::willPerformClientRedirect):
1307         (WebKit::NavigationState::NavigationClient::didCancelClientRedirect):
1308         * UIProcess/WebPageProxy.cpp:
1309         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
1310         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
1311         * UIProcess/WebPageProxy.h:
1312         * UIProcess/WebPageProxy.messages.in:
1313         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1314         (WebKit::WebFrameLoaderClient::dispatchDidCancelClientRedirect):
1315         (WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect):
1316         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1317
1318 2017-08-30  Megan Gardner  <megan_gardner@apple.com>
1319
1320         Remove IsBlockSelection flag
1321         https://bugs.webkit.org/show_bug.cgi?id=176141
1322
1323         Reviewed by Dean Jackson.
1324
1325         Block selection is disabled. Removed code associated with this flag to allow removal of the
1326         flag in UIKit.
1327         
1328         No tests for a removed feature.
1329
1330         * Platform/spi/ios/UIKitSPI.h:
1331         * Shared/ios/GestureTypes.h:
1332         * UIProcess/ios/WKContentViewInteraction.mm:
1333         (toUIWKSelectionFlags):
1334         * WebProcess/WebPage/ios/WebPageIOS.mm:
1335         (WebKit::WebPage::rangeForWebSelectionAtPosition):
1336         (WebKit::WebPage::selectWithGesture):
1337         (WebKit::WebPage::contractedRangeFromHandle):
1338         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle):
1339         (WebKit::WebPage::updateBlockSelectionWithTouch):
1340         (WebKit::WebPage::updateSelectionWithTouches):
1341
1342 2017-08-30  Alex Christensen  <achristensen@webkit.org>
1343
1344         Add WKUIDelegatePrivate equivalent of WKPageUIClient's didClickAutoFillButton
1345         https://bugs.webkit.org/show_bug.cgi?id=176139
1346         <rdar://problem/29270035>
1347
1348         Reviewed by Tim Horton.
1349
1350         Covered by a cool new API test!
1351
1352         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1353         * UIProcess/Cocoa/UIDelegate.h:
1354         * UIProcess/Cocoa/UIDelegate.mm:
1355         (WebKit::UIDelegate::setDelegate):
1356         (WebKit::UIDelegate::UIClient::didClickAutoFillButton):
1357
1358 2017-08-31  Chris Dumez  <cdumez@apple.com>
1359
1360         Use WTF::crossThreadCopy() in more places
1361         https://bugs.webkit.org/show_bug.cgi?id=176169
1362
1363         Reviewed by Andreas Kling.
1364
1365         Use WTF::crossThreadCopy() in more places to make code more concise.
1366
1367         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1368         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
1369         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
1370         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains):
1371         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
1372         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
1373         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1374         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
1375
1376 2017-08-31  Youenn Fablet  <youenn@apple.com>
1377
1378         Take into account removed caches in Caches::remove assertion
1379         https://bugs.webkit.org/show_bug.cgi?id=176164
1380
1381         Reviewed by Alex Christensen.
1382
1383         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1384         (WebKit::CacheStorage::Caches::remove):
1385
1386 2017-08-31  Youenn Fablet  <youenn@apple.com>
1387
1388         Do not create a salt if the CacheStorage engine should not persist
1389         https://bugs.webkit.org/show_bug.cgi?id=176138
1390
1391         Reviewed by Alex Christensen.
1392
1393         * NetworkProcess/cache/CacheStorageEngine.cpp:
1394         (WebKit::CacheStorage::Engine::~Engine): Ensuring that Caches will not try using the engine if it goes away.
1395         (WebKit::CacheStorage::Engine::initialize): Removing making a salt if engine data is not persistent.
1396         * NetworkProcess/cache/CacheStorageEngine.h: Check persistency according the root path. If it is null, caches should not try to do persistency.
1397         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1398         (WebKit::CacheStorage::cachesRootPath):
1399         (WebKit::CacheStorage::Caches::initialize):
1400         (WebKit::CacheStorage::Caches::detach):
1401         (WebKit::CacheStorage::Caches::readCachesFromDisk):
1402         (WebKit::CacheStorage::Caches::writeCachesToDisk):
1403         * NetworkProcess/cache/CacheStorageEngineCaches.h:
1404         (WebKit::CacheStorage::Caches::shouldPersist const):
1405         * NetworkProcess/cache/NetworkCacheData.cpp: Making makeSalt private again.
1406         (WebKit::NetworkCache::makeSalt):
1407         * NetworkProcess/cache/NetworkCacheData.h:
1408
1409
1410 2017-08-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1411
1412         [GTK] Several InputMethodFilter tests are failing and crashing
1413         https://bugs.webkit.org/show_bug.cgi?id=176158
1414
1415         Reviewed by Carlos Alberto Lopez Perez.
1416
1417         * UIProcess/gtk/InputMethodFilter.cpp:
1418         (WebKit::InputMethodFilter::confirmCurrentComposition): Return early in testing mode because the page is not available.
1419         (WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting): Use hexadecimal numbers for
1420         logging key codes.
1421
1422 2017-08-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1423
1424         [GTK][Wayland] Crash when gdk_keymap_get_entries_for_keyval returns TRUE but n_keys=0
1425         https://bugs.webkit.org/show_bug.cgi?id=176154
1426
1427         Reviewed by Carlos Alberto Lopez Perez.
1428
1429         In Wayland gdk_keymap_get_entries_for_keyval() can return TRUE with n_keys=0. We have several places in WebKit
1430         where we just check the return value of gdk_keymap_get_entries_for_keyval() and then use the returned array to
1431         get the first position assuming it has at least one item. This has always worked in X11 because the GDK X11
1432         backend does the right thing, but it's crashing in Wayland now. It should be fixed in GTK+ but in the meantime
1433         it's easy to workaround by also checking n_keys > 0.
1434
1435         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
1436         (WebKit::doKeyStrokeEvent):
1437
1438 2017-08-30  Dan Bernstein  <mitz@apple.com>
1439
1440         [iOS] REGRESSION (r218144) -[WKContentView targetForAction:withSender:] returns the content view for actions implemented only by the WKWebView, causing a crash
1441         https://bugs.webkit.org/show_bug.cgi?id=176077
1442         <rdar://problem/34145200>
1443
1444         Reviewed by Sam Weinig.
1445
1446         Test: TestWebKitAPI/Tests/WebKitCocoa/WKContentViewTargetForAction.mm
1447
1448         * UIProcess/API/Cocoa/WKWebView.mm:
1449         (-[WKWebView targetForAction:withSender:]): Override and forward WKContentView actions to
1450           -[WKContentView targetForActionForWebView:withSender:].
1451         * UIProcess/ios/WKContentViewInteraction.h: Declare -targetForActionForWebView:withSender:.
1452         * UIProcess/ios/WKContentViewInteraction.mm:
1453         (-[WKContentView targetForAction:withSender:]): Forward to the WKWebView.
1454         (-[WKContentView targetForActionForWebView:withSender:]): Call super’s
1455           -targetForAction:withSender:.
1456
1457 2017-08-30  Brent Fulgham  <bfulgham@apple.com>
1458
1459         Fix whitespace and formatting
1460         https://bugs.webkit.org/show_bug.cgi?id=176134
1461
1462         Reviewed by Sam Weinig.
1463
1464         Bring the file formatting into compliance with WebKit Coding Style.
1465
1466         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
1467         (-[_WKWebsiteDataStoreConfiguration _webStorageDirectory]):
1468         (-[_WKWebsiteDataStoreConfiguration _setWebStorageDirectory:]):
1469         (-[_WKWebsiteDataStoreConfiguration _indexedDBDatabaseDirectory]):
1470         (-[_WKWebsiteDataStoreConfiguration _setIndexedDBDatabaseDirectory:]):
1471         (-[_WKWebsiteDataStoreConfiguration _webSQLDatabaseDirectory]):
1472         (-[_WKWebsiteDataStoreConfiguration _setWebSQLDatabaseDirectory:]):
1473         (-[_WKWebsiteDataStoreConfiguration _cookieStorageFile]):
1474         (-[_WKWebsiteDataStoreConfiguration _setCookieStorageFile:]):
1475         (-[_WKWebsiteDataStoreConfiguration _resourceLoadStatisticsDirectory]):
1476         (-[_WKWebsiteDataStoreConfiguration _setResourceLoadStatisticsDirectory:]):
1477
1478 2017-08-30  Youenn Fablet  <youenn@apple.com>
1479
1480         Remove the list of removed caches from CacheStorageEngine
1481         https://bugs.webkit.org/show_bug.cgi?id=176136
1482
1483         Reviewed by Alex Christensen.
1484
1485
1486         This list is no longer useful as CacheStorageEngineCaches handles its own removed caches.
1487
1488         * NetworkProcess/cache/CacheStorageEngine.cpp:
1489         (WebKit::CacheStorage::Engine::remove):
1490         (WebKit::CacheStorage::Engine::cache):
1491         * NetworkProcess/cache/CacheStorageEngine.h:
1492
1493 2017-08-30  Tim Horton  <timothy_horton@apple.com>
1494
1495         REGRESSION (r221068): Graphics corruption when dragging images on iOS
1496         https://bugs.webkit.org/show_bug.cgi?id=176132
1497         <rdar://problem/34142983>
1498
1499         Reviewed by Dean Jackson.
1500
1501         * Shared/mac/ColorSpaceData.mm:
1502         (WebKit::ColorSpaceData::encode):
1503         Color space encoding was entirely disabled on iOS, so after r221068,
1504         ShareableBitmap would make different decisions about image format
1505         on both sides of the wire.
1506
1507         Enable color space encoding on iOS (decoding is already implemented)
1508         by moving some ifdefs around.
1509
1510 2017-08-30  Youenn Fablet  <youenn@apple.com>
1511
1512         [Cache API] Support cache names persistency
1513         https://bugs.webkit.org/show_bug.cgi?id=175995
1514
1515         Reviewed by Alex Christensen.
1516
1517         Adding disk read/write capacities to CacheStorage engine.
1518         This is used to store per-origin cache names in a file.
1519         Making Engine a thread safe refcounted object so that it does read/write in a background thread.
1520
1521         Introducing CacheStorage::Caches as the object managing the list of Cache objects for a given origin.
1522         Caches will be responsible to do all the read/write operations for all of its caches.
1523         It will be responsible for quota limitation as well.
1524
1525         Moving part of the logic from CacheStorage::Engine into CacheStorage::Caches.
1526
1527         CacheStorage::Engine is initialized asynchronously as it first creates a salt which is used
1528         to obfuscate the names of the various files stored on disk.
1529
1530         In the same spirit, CacheStorage::Caches is initialized asynchronously as it needs to read from the disk the list of cache names.
1531         Once read, the names will be stored in memory.
1532         Added the possibility to clear this in-memory representation. This will be useful for testing.
1533         This might also be useful to save memory when there is no more use of CacheStorage by web pages.
1534
1535         Introducing a new cacheStorageSubdirectoryName parameter for WebsiteDataStore so as to segment the different per session CacheStorageEngine
1536         in direct sub folders of the main cacheStorageDirectory folder.
1537
1538         * CMakeLists.txt:
1539         * NetworkProcess/cache/CacheStorageEngine.cpp:
1540         (WebKit::CacheStorage::Engine::open):
1541         (WebKit::CacheStorage::Engine::remove):
1542         (WebKit::CacheStorage::Engine::retrieveCaches):
1543         (WebKit::CacheStorage::Engine::retrieveRecords):
1544         (WebKit::CacheStorage::Engine::initialize):
1545         (WebKit::CacheStorage::Engine::readCachesFromDisk):
1546         (WebKit::CacheStorage::Engine::cache):
1547         (WebKit::CacheStorage::Engine::writeFile): Making use of default parameter to directly return to the main loop.
1548         (WebKit::CacheStorage::Engine::readFile): Ditto.
1549         (WebKit::CacheStorage::Engine::clearMemoryRepresentation):
1550         * NetworkProcess/cache/CacheStorageEngine.h:
1551         (WebKit::CacheStorage::Engine::rootPath const):
1552         (WebKit::CacheStorage::Engine::salt const):
1553         (WebKit::CacheStorage::Engine::nextCacheIdentifier):
1554         * NetworkProcess/cache/CacheStorageEngineCaches.cpp: Added.
1555         (WebKit::CacheStorage::cachesRootPath):
1556         (WebKit::CacheStorage::cachesListFilename):
1557         (WebKit::CacheStorage::Caches::Caches):
1558         (WebKit::CacheStorage::Caches::initialize):
1559         (WebKit::CacheStorage::Caches::find):
1560         (WebKit::CacheStorage::Caches::open):
1561         (WebKit::CacheStorage::Caches::remove):
1562         (WebKit::CacheStorage::encodeCacheNames):
1563         (WebKit::CacheStorage::decodeCachesNames):
1564         (WebKit::CacheStorage::Caches::readCachesFromDisk):
1565         (WebKit::CacheStorage::Caches::writeCachesToDisk):
1566         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
1567         (WebKit::CacheStorage::Caches::cacheInfos const):
1568         * NetworkProcess/cache/CacheStorageEngineCaches.h: Added.
1569         (WebKit::CacheStorage::Caches::create):
1570         (WebKit::CacheStorage::Caches::isInitialized const):
1571         (WebKit::CacheStorage::Caches::detach):
1572         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
1573         (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation):
1574         * NetworkProcess/cache/CacheStorageEngineConnection.h:
1575         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
1576         * NetworkProcess/cache/NetworkCacheData.cpp:
1577         (WebKit::NetworkCache::makeSalt):
1578         * NetworkProcess/cache/NetworkCacheData.h:
1579         * UIProcess/WebsiteData/WebsiteDataStore.h:
1580         * WebKit.xcodeproj/project.pbxproj:
1581         * WebProcess/Cache/WebCacheStorageConnection.cpp:
1582         (WebKit::WebCacheStorageConnection::clearMemoryRepresentation):
1583         * WebProcess/Cache/WebCacheStorageConnection.h:
1584
1585 2017-08-30  Brady Eidson  <beidson@apple.com>
1586
1587         Add "Identified" base class to replace a whole bunch of custom identifier generators.
1588         https://bugs.webkit.org/show_bug.cgi?id=176120
1589
1590         Reviewed by Alex Christensen.
1591
1592         * UIProcess/API/APIUserScript.cpp:
1593         (API::UserScript::UserScript):
1594         (API::generateIdentifier): Deleted.
1595         * UIProcess/API/APIUserScript.h:
1596
1597         * UIProcess/API/APIUserStyleSheet.cpp:
1598         (API::UserStyleSheet::UserStyleSheet):
1599         (API::generateIdentifier): Deleted.
1600         * UIProcess/API/APIUserStyleSheet.h:
1601
1602         * UIProcess/UserContent/WebScriptMessageHandler.cpp:
1603         (WebKit::WebScriptMessageHandler::WebScriptMessageHandler):
1604         (WebKit::generateIdentifier): Deleted.
1605         * UIProcess/UserContent/WebScriptMessageHandler.h:
1606         (WebKit::WebScriptMessageHandler::identifier const): Deleted.
1607
1608         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
1609         (WebKit::WebUserContentControllerProxy::WebUserContentControllerProxy):
1610         (WebKit::WebUserContentControllerProxy::~WebUserContentControllerProxy):
1611         (WebKit::WebUserContentControllerProxy::addProcess):
1612         (WebKit::WebUserContentControllerProxy::removeProcess):
1613         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
1614         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
1615         (WebKit::WebUserContentControllerProxy::addUserScript):
1616         (WebKit::WebUserContentControllerProxy::removeUserScript):
1617         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
1618         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
1619         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
1620         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
1621         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
1622         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
1623         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
1624         (WebKit::WebUserContentControllerProxy::addContentRuleList):
1625         (WebKit::WebUserContentControllerProxy::removeContentRuleList):
1626         (WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
1627         (WebKit::generateIdentifier): Deleted.
1628         * UIProcess/UserContent/WebUserContentControllerProxy.h:
1629         (WebKit::WebUserContentControllerProxy::identifier const): Deleted.
1630
1631         * UIProcess/VisitedLinkStore.cpp:
1632         (WebKit::VisitedLinkStore::~VisitedLinkStore):
1633         (WebKit::VisitedLinkStore::VisitedLinkStore):
1634         (WebKit::VisitedLinkStore::addProcess):
1635         (WebKit::VisitedLinkStore::removeProcess):
1636         (WebKit::VisitedLinkStore::removeAll):
1637         (WebKit::VisitedLinkStore::pendingVisitedLinksTimerFired):
1638         (WebKit::VisitedLinkStore::sendTable):
1639         (WebKit::generateIdentifier): Deleted.
1640         * UIProcess/VisitedLinkStore.h:
1641
1642         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1643         (WebKit::WebsiteDataStore::WebsiteDataStore):
1644         (WebKit::generateIdentifier): Deleted.
1645         * UIProcess/WebsiteData/WebsiteDataStore.h:
1646         (WebKit::WebsiteDataStore::identifier const): Deleted.
1647
1648         * WebProcess/Network/WebSocketStream.cpp:
1649         (WebKit::WebSocketStream::WebSocketStream):
1650         (WebKit::WebSocketStream::~WebSocketStream):
1651         (WebKit::WebSocketStream::messageSenderDestinationID):
1652         * WebProcess/Network/WebSocketStream.h:
1653
1654 2017-08-30  Brady Eidson  <beidson@apple.com>
1655
1656         Implement all of "Register" right up until where the script is fetched.
1657         https://bugs.webkit.org/show_bug.cgi?id=176082
1658
1659         Reviewed by Andy Estes.
1660
1661         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1662         (WebKit::WebSWServerConnection::resolveJobInClient):
1663         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1664         * WebProcess/Storage/WebSWClientConnection.messages.in:
1665
1666 2017-08-30  Andy Estes  <aestes@apple.com>
1667
1668         [Mac] Upstream Accessibility-related WebKitSystemInterface functions
1669         https://bugs.webkit.org/show_bug.cgi?id=176093
1670
1671         Reviewed by Eric Carlson.
1672
1673         * UIProcess/Cocoa/WebViewImpl.h:
1674         * UIProcess/Cocoa/WebViewImpl.mm:
1675         (WebKit::WebViewImpl::setAccessibilityWebProcessToken):
1676         (WebKit::WebViewImpl::updateRemoteAccessibilityRegistration):
1677         (WebKit::WebViewImpl::accessibilityRegisterUIProcessTokens):
1678         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
1679         (InitWebCoreSystemInterface):
1680         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1681         * WebProcess/WebPage/mac/WebPageMac.mm:
1682         (WebKit::WebPage::platformInitialize):
1683         (WebKit::WebPage::registerUIProcessAccessibilityTokens):
1684
1685 2017-08-30  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1686
1687         [WPE] Enable MEMORY_SAMPLER
1688         https://bugs.webkit.org/show_bug.cgi?id=176099
1689
1690         Reviewed by Michael Catanzaro.
1691
1692         Enable it at runtime if the environment variable WEBKIT_SAMPLE_MEMORY is set.
1693
1694         * UIProcess/API/wpe/WPEView.cpp:
1695         (WKWPE::m_compositingManagerProxy):
1696
1697 2017-08-30  Andy Estes  <aestes@apple.com>
1698
1699         [Mac] Upstream Carbon-related WebKitSystemInterface functions
1700         https://bugs.webkit.org/show_bug.cgi?id=176087
1701
1702         Reviewed by Alex Christensen.
1703
1704         * PluginProcess/mac/PluginProcessMac.mm:
1705         (WebKit::cgWindowID):
1706         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
1707         (WebKit::scriptCodeFromCurrentKeyboardInputSource):
1708         (WebKit::NetscapePlugin::sendComplexTextInput):
1709
1710 2017-08-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1711
1712         Unreviewed. Try to fix layout test timing out after r221344.
1713
1714         There seems to be an infinite loop in the web process when WebPage::platformEditorState is called with non
1715         content editable result.
1716
1717         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1718         (WebKit::WebPage::platformEditorState const):
1719
1720 2017-08-29  Carlos Garcia Campos  <cgarcia@igalia.com>
1721
1722         REGRESSION(r221064): [GTK] Editor not correctly working after r221064
1723         https://bugs.webkit.org/show_bug.cgi?id=176052
1724
1725         Reviewed by Michael Catanzaro.
1726
1727         Since r221064 we are not always notified about typing attributes when editor state changes. didChangeSelection
1728         no longer includes the typing attributes in EditorStateChange message, it's scheduled to be sent after the
1729         compositing layer have been flushed, but that part is not implemented for GTK+ port.
1730
1731         Fixes test /webkit2/WebKitWebView/editor-state/typing-attributes.
1732
1733         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1734         (WebKit::AcceleratedDrawingArea::updateBackingStoreState): Call WebPage::flushPendingEditorStateUpdate() after
1735         the layout.
1736         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
1737         (WebKit::CoordinatedLayerTreeHost::layerFlushTimerFired): Call WebPage::flushPendingEditorStateUpdate() after
1738         the display sync.
1739         * WebProcess/WebPage/DrawingAreaImpl.cpp:
1740         (WebKit::DrawingAreaImpl::display): Call WebPage::flushPendingEditorStateUpdate() after the layout.
1741         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1742         (WebKit::WebPage::platformEditorState const): Also return early, setting isMissingPostLayoutData to true, when
1743         there's no frame view, the view needs a layout or the result is not for editable content.
1744
1745 2017-08-29  Brent Fulgham  <bfulgham@apple.com>
1746
1747         ResourceLoadStatistics logic does not understand custom WebsiteData stores
1748         https://bugs.webkit.org/show_bug.cgi?id=176037
1749         <rdar://problem/33338238>
1750
1751         Reviewed by Alex Christensen.
1752
1753         The NetworkProcess::updateCookiePartitioningForTopPrivatelyOwnedDomains always notifies the default website
1754         data store about observations it has made. This should be revised so that WebKit clients that register
1755         custom data stores through the WKWebsiteDataStores API can be assured that observations made in one session
1756         do not manipulate data from another session.
1757
1758         * NetworkProcess/NetworkProcess.cpp:
1759         (WebKit::NetworkProcess::updateCookiePartitioningForTopPrivatelyOwnedDomains): Use the passed sessionID to locate
1760         the correct NetworkStorageSession to notify about the new partitioning data.
1761         * NetworkProcess/NetworkProcess.h:
1762         * NetworkProcess/NetworkProcess.messages.in: Accept new argument.
1763         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1764         (WebKit::WebsiteDataStore::updateCookiePartitioningForTopPrivatelyOwnedDomains): Include the WebsiteDataStore's
1765         session ID in the message to update cookie partition data.
1766
1767 2017-08-29  Alex Christensen  <achristensen@webkit.org>
1768
1769         Automatically determine if a class has a modern decoder
1770         https://bugs.webkit.org/show_bug.cgi?id=176084
1771
1772         Reviewed by Sam Weinig.
1773
1774         Instead of determining if ModernDecoder is defined in the class,
1775         just check the signature of the decode member function.
1776
1777         * Platform/IPC/ArgumentCoder.h:
1778         (): Deleted.
1779         * Shared/WebPageCreationParameters.h:
1780         * Shared/WebPageGroupData.h:
1781         * Shared/WebsitePolicies.h:
1782
1783 2017-08-29  Alex Christensen  <achristensen@webkit.org>
1784
1785         Begin transition to modern IPC decoding
1786         https://bugs.webkit.org/show_bug.cgi?id=176043
1787
1788         Reviewed by JF Bastien.
1789
1790         Right now, if a class is decoded from IPC we must have a default constructor.
1791         This prevents us from having Ref or C++ references in such types, which is cluttering up our code.
1792         This is because IPC::decode makes a default-constructed object, fills it, and returns a bool indicating success.
1793         Making IPC::decode instead return a std::optional makes it so we do not need to call an empty constructor.
1794         This could also enable us to add IPC::Decoder::operator>> and other fun things!
1795         I also modernized two arbitrary classes, WebsitePolicies and WebPageGroupData with more to come.
1796         There's no good way to update the actual generated IPC code until each class has been transitioned.
1797
1798         * Platform/IPC/ArgumentCoder.h:
1799         (IPC::ArgumentCoder::decode):
1800         * Platform/IPC/Decoder.h:
1801         (IPC::Decoder::decode):
1802         * Shared/WebPageCreationParameters.cpp:
1803         (WebKit::WebPageCreationParameters::decode):
1804         * Shared/WebPageCreationParameters.h:
1805         * Shared/WebPageGroupData.cpp:
1806         (WebKit::WebPageGroupData::decode):
1807         * Shared/WebPageGroupData.h:
1808         * Shared/WebsitePolicies.h:
1809         (WebKit::WebsitePolicies::decode):
1810
1811 2017-08-29  Youenn Fablet  <youenn@apple.com>
1812
1813         Setting the cache storage engine root path according the session WebsiteDataStore
1814         https://bugs.webkit.org/show_bug.cgi?id=176055
1815
1816         Reviewed by Alex Christensen.
1817
1818         Adding disk read/write capacities to CacheStorage engine.
1819         This is used to store per-origin cache names in a file.
1820         Making Engine a thread safe refcounted object so that it does read/write in a background thread.
1821
1822         Setting the root path of the engine to the directory set for the session in use according the WebsiteDataStore.
1823         For each WebsiteDataStore, a path and a sandbox extension is passed to the network process if persistency of the cache storage is wanted.
1824         Ephemeral sessions will set the path of the engine to null so that no read/write access is performed.
1825
1826         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1827         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
1828         * NetworkProcess/NetworkProcess.cpp:
1829         (WebKit::NetworkProcess::initializeNetworkProcess):
1830         (WebKit::NetworkProcess::cacheStorageDirectory const):
1831         * NetworkProcess/NetworkProcess.h:
1832         * NetworkProcess/cache/CacheStorageEngine.cpp:
1833         (WebKit::CacheStorage::Engine::from):
1834         (WebKit::CacheStorage::Engine::defaultEngine):
1835         (WebKit::CacheStorage::Engine::Engine):
1836         (WebKit::CacheStorage::Engine::writeFile):
1837         * NetworkProcess/cache/CacheStorageEngine.h:
1838         (WebKit::CacheStorage::Engine::create):
1839         (WebKit::CacheStorage::Engine::shouldPersist const):
1840         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1841         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1842         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1843         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
1844         * Shared/WebsiteDataStoreParameters.cpp:
1845         (WebKit::WebsiteDataStoreParameters::encode const):
1846         (WebKit::WebsiteDataStoreParameters::decode):
1847         * Shared/WebsiteDataStoreParameters.h:
1848         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1849         (WebKit::WebsiteDataStore::parameters):
1850
1851 2017-08-29  Chris Dumez  <cdumez@apple.com>
1852
1853         Add initial support for dataTransferItem.webkitGetAsEntry()
1854         https://bugs.webkit.org/show_bug.cgi?id=176038
1855         <rdar://problem/34121095>
1856
1857         Reviewed by Wenson Hsieh.
1858
1859         Make dataTransfer.items an experimental feature so that it can be easily
1860         turned on from the Develop menu, for testing convenience.
1861
1862         * Shared/WebPreferencesDefinitions.h:
1863
1864 2017-08-29  Andy Estes  <aestes@apple.com>
1865
1866         [Mac] Upstream WKSetMetadataURL() from WebKitSystemInterface
1867         https://bugs.webkit.org/show_bug.cgi?id=176046
1868
1869         Reviewed by Alex Christensen.
1870
1871         * UIProcess/mac/WebPageProxyMac.mm:
1872         (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplicationRaw):
1873         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
1874         (InitWebCoreSystemInterface):
1875
1876 2017-08-28  Andy Estes  <aestes@apple.com>
1877
1878         [Cocoa] Upstream WKGetWebDefaultCFStringEncoding()
1879         https://bugs.webkit.org/show_bug.cgi?id=176039
1880
1881         Reviewed by Alex Christensen.
1882
1883         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
1884         (InitWebCoreSystemInterface):
1885
1886 2017-08-28  Megan Gardner  <megan_gardner@apple.com>
1887
1888         Fix incorrect enum in atBoundaryOfGranularity call
1889         https://bugs.webkit.org/show_bug.cgi?id=176004
1890
1891         Reviewed by Wenson Hsieh and Enrica Casucci
1892
1893         Enum that was being used was incorrect, as that case in not covered in called function.
1894         Resulted in a no-op. Should now have correct behavior around line boundaries.
1895         
1896         Not possible to add tests for selections with velocity. Will attempt to add this behavior later.
1897
1898         * WebProcess/WebPage/ios/WebPageIOS.mm:
1899         (WebKit::rangeAtWordBoundaryForPosition):
1900
1901 2017-08-28  Stephan Szabo  <stephan.szabo@sony.com>
1902
1903         [WinCairo] Add PlatformWin cmake for Webkit
1904         https://bugs.webkit.org/show_bug.cgi?id=176027
1905
1906         Reviewed by Brent Fulgham.
1907
1908         * PlatformWin.cmake: Added.
1909
1910 2017-08-28  Andy Estes  <aestes@apple.com>
1911
1912         [Cocoa] Upstream CFNetwork-related WebKitSystemInterface functions
1913         https://bugs.webkit.org/show_bug.cgi?id=176032
1914
1915         Reviewed by Alex Christensen.
1916
1917         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1918         (WebKit::privateBrowsingSession):
1919         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
1920         (InitWebCoreSystemInterface):
1921         * WebProcess/WebPage/mac/WebPageMac.mm:
1922         (WebKit::WebPage::platformHasLocalDataForURL):
1923         (WebKit::cachedResponseForURL):
1924
1925 2017-08-28  Brent Fulgham  <bfulgham@apple.com>
1926
1927         Disable access to secure cookies if an HTTPS site loads mixed content (Part 2: Header Requests)
1928         https://bugs.webkit.org/show_bug.cgi?id=175992
1929         <rdar://problem/34086613>
1930
1931         Reviewed by Daniel Bates.
1932
1933         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1934         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM): Use a better label than 'result'.
1935         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue): Modify to accept a flag
1936         indicating if secure cookies should be included, and return a pair containing the resulting
1937         cookie string and a boolean indicating if secure cookies were accessed.
1938         * NetworkProcess/NetworkConnectionToWebProcess.h:
1939         * NetworkProcess/NetworkConnectionToWebProcess.messages.in: Ditto.
1940         * Shared/mac/CookieStorageShim.mm:
1941         (WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL): Ditto.
1942         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1943         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue): Ditto.
1944         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1945
1946 2017-08-28  Alex Christensen  <achristensen@webkit.org>
1947
1948         Add WKUIDelegatePrivate equivalent of WKPageUIClient's didExceedBackgroundResourceLimitWhileInForeground
1949         https://bugs.webkit.org/show_bug.cgi?id=176028
1950         <rdar://problem/29270035>
1951
1952         Reviewed by Andy Estes.
1953
1954         An API test for this did not succeed with either the memory or CPU limit calls,
1955         possibly because the app must be in the foreground for this call to be made.
1956
1957         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1958         * UIProcess/Cocoa/UIDelegate.h:
1959         * UIProcess/Cocoa/UIDelegate.mm:
1960         (WebKit::UIDelegate::setDelegate):
1961         (WebKit::toWKResourceLimit):
1962         (WebKit::UIDelegate::UIClient::didExceedBackgroundResourceLimitWhileInForeground):
1963
1964 2017-08-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1965
1966         WebDriver: implement screen capture commands
1967         https://bugs.webkit.org/show_bug.cgi?id=174615
1968
1969         Reviewed by Brian Burg.
1970
1971         Extend takeScreenshot command to optionally take a screenshot of an element. When no element is provided, the
1972         screenshot is taken from the page visible area.
1973
1974         * PlatformGTK.cmake: Add WebAutomationSessionCairo.cpp to compilation.
1975         * PlatformWPE.cmake: Ditto.
1976         * UIProcess/Automation/Automation.json: Add ScreenshotError and several optional parameters to takeScreenshot.
1977         * UIProcess/Automation/WebAutomationSession.cpp:
1978         (WebKit::WebAutomationSession::takeScreenshot): Receive optional frame, node and scrollIntoView that are
1979         checked and passed to the web process.
1980         * UIProcess/Automation/WebAutomationSession.h:
1981         * UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp: Added.
1982         (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData): Cairo implementation.
1983         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
1984         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1985         (WebKit::snapshotRectForScreenshot): Helper to get the rectangle to be used for a screenshot.
1986         (WebKit::WebAutomationSessionProxy::takeScreenshot): If a node handle is provided take the snapshot using the
1987         element rectangle, otherwise use the page visible content rectangle.
1988         * WebProcess/Automation/WebAutomationSessionProxy.h:
1989         * WebProcess/Automation/WebAutomationSessionProxy.messages.in: Update TakeSnapshot message.
1990
1991 2017-08-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1992
1993         Automation: takeScreenshot should use the visible content rect not the document rect
1994         https://bugs.webkit.org/show_bug.cgi?id=175665
1995
1996         Reviewed by Brian Burg.
1997
1998         According to the spec, we should get the toplevel browsing context document rectangle and take a screenshot of
1999         it using the current viewport width and height. We are currently using the document size.
2000
2001         19. Screen Capture.
2002         https://w3c.github.io/webdriver/webdriver-spec.html#dfn-draw-a-bounding-box-from-the-framebuffer
2003
2004         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2005         (WebKit::WebAutomationSessionProxy::takeScreenshot): Use FrameView::visibleContentRect().
2006
2007 2017-08-28  Carlos Garcia Campos  <cgarcia@igalia.com>
2008
2009         [GTK][WPE] ASSERTION FAILED: !isOpen() in WebKit::IconDatabase::~IconDatabase()
2010         https://bugs.webkit.org/show_bug.cgi?id=175719
2011
2012         Reviewed by Michael Catanzaro.
2013
2014         This is happening always when running /webkit2/WebKitFaviconDatabase/favicon-database-test in debug builds. The
2015         last step we do is removing all icons, then the test finishes, which destroys the WebKitFaviconDatabase object
2016         that closes the icon database on dispose. The problem is that removing all icons schedules a main thread
2017         notification and IconDatabase is not considered closed until all main thread callbacks have been dispatched. This
2018         is never going to happen in the test, because the main loop is no longer running at that point. I don't think
2019         it's worth it to consider the database open while main thread callbacks are pending, they are just notifications
2020         and the client is no longer insterested on them afer closing the database. I think it's bettter and simpler to
2021         simply cancel the pending callbacks on database close. That ensures that isOpen() after close() is always
2022         false. This patch adds a helper private class to schedule notifications to the main thread that can be cancelled
2023         on database close. It also removes the didClose() notification because it was unused and because it's pointless
2024         now that we know the database is closed after close().
2025
2026         * UIProcess/API/glib/IconDatabase.cpp:
2027         (WebKit::IconDatabase::open): Mark the main thread notifier as active.
2028         (WebKit::IconDatabase::close): Mark the main thread notifier as not active.
2029         (WebKit::IconDatabase::IconDatabase): Remove m_mainThreadCallbackCount initialization.
2030         (WebKit::IconDatabase::isOpen const): Do what isOpenBesidesMainThreadCallbacks() used to do.
2031         (WebKit::IconDatabase::removeAllIconsOnThread): Remove the notification because it's currently unused.
2032         (WebKit::IconDatabase::dispatchDidImportIconURLForPageURLOnMainThread): Use MainThreadNotifier.
2033         (WebKit::IconDatabase::dispatchDidImportIconDataForPageURLOnMainThread): Ditto.
2034         (WebKit::IconDatabase::dispatchDidFinishURLImportOnMainThread): Ditto.
2035         (WebKit::IconDatabase::isOpenBesidesMainThreadCallbacks const): Deleted.
2036         (WebKit::IconDatabase::checkClosedAfterMainThreadCallback): Deleted.
2037         (WebKit::IconDatabase::dispatchDidRemoveAllIconsOnMainThread): Deleted.
2038         * UIProcess/API/glib/IconDatabase.h:
2039         (WebKit::IconDatabaseClient::didChangeIconForPageURL):
2040         (WebKit::IconDatabaseClient::didFinishURLImport):
2041         (WebKit::IconDatabase::MainThreadNotifier::MainThreadNotifier):
2042         (WebKit::IconDatabase::MainThreadNotifier::setActive):
2043         (WebKit::IconDatabase::MainThreadNotifier::notify):
2044         (WebKit::IconDatabase::MainThreadNotifier::stop):
2045         (WebKit::IconDatabase::MainThreadNotifier::timerFired):
2046         (WebKit::IconDatabaseClient::didRemoveAllIcons): Deleted.
2047         (WebKit::IconDatabaseClient::didClose): Deleted.
2048
2049 2017-08-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2050
2051         Picking an emoji via the emoji dialog (Ctrl+Cmd+Space) fires inconsistent beforeinput events.
2052         https://bugs.webkit.org/show_bug.cgi?id=170955
2053         <rdar://problem/31697653>
2054
2055         Reviewed by Ryosuke Niwa.
2056
2057         Currently, we insert text with TextEventInputAutocompletion as the text event input type if any text range to
2058         replace was specified by the platform. Instead, limit this only to when the text replacement range is not empty.
2059         This more closely matches the intention of the spec, which states that the "insertReplacementText" inputType
2060         should be used when "[replacing] existing text by means of a spell checker, auto-correct or similar".
2061
2062         * WebProcess/WebPage/WebPage.cpp:
2063         (WebKit::WebPage::insertTextAsync):
2064
2065 2017-08-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2066
2067         [iOS WK2] Web process crashes after changing selection to the end of the document when speaking a selection
2068         https://bugs.webkit.org/show_bug.cgi?id=176011
2069         <rdar://problem/32614095>
2070
2071         Reviewed by Ryosuke Niwa.
2072
2073         Adds an SPI hook to test accessibility codepaths when speaking selected content. This patch does some minor
2074         refactoring by introducing _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:, which takes
2075         and invokes a completion handler block. The existing _accessibilityRetrieveRectsAtSelectionOffset:withText:
2076         method simply turns around and calls the former variant with `nil` as a completion handler.
2077
2078         * UIProcess/API/Cocoa/WKWebView.mm:
2079         (-[WKWebView _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:]):
2080         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2081         * UIProcess/ios/WKContentViewInteraction.h:
2082         * UIProcess/ios/WKContentViewInteraction.mm:
2083         (-[WKContentView _accessibilityRetrieveRectsAtSelectionOffset:withText:]):
2084         (-[WKContentView _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:]):
2085         * WebProcess/WebPage/ios/WebPageIOS.mm:
2086         (WebKit::visiblePositionForPositionWithOffset): Deleted.
2087
2088 2017-08-25  Alex Christensen  <achristensen@webkit.org>
2089
2090         Add WKUIDelegatePrivate equivalent of WKPageUIClient's saveDataToFileInDownloadsFolder
2091         https://bugs.webkit.org/show_bug.cgi?id=176000
2092         <rdar://problem/29270035>
2093
2094         Reviewed by Andy Estes.
2095         
2096         Covered by a new API test.
2097
2098         * Shared/Cocoa/WKNSData.h:
2099         (wrapper): Deleted.
2100         * UIProcess/API/APIUIClient.h:
2101         (API::UIClient::saveDataToFileInDownloadsFolder):
2102         * UIProcess/API/C/WKPage.cpp:
2103         (WKPageSetPageUIClient):
2104         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2105         * UIProcess/Cocoa/UIDelegate.h:
2106         * UIProcess/Cocoa/UIDelegate.mm:
2107         (WebKit::UIDelegate::setDelegate):
2108         (WebKit::UIDelegate::UIClient::saveDataToFileInDownloadsFolder):
2109         * UIProcess/WebPageProxy.cpp:
2110         (WebKit::WebPageProxy::saveDataToFileInDownloadsFolder):
2111         (WebKit::WebPageProxy::savePDFToFileInDownloadsFolder):
2112         * UIProcess/WebPageProxy.h:
2113         * UIProcess/WebPageProxy.messages.in:
2114         * WebProcess/WebPage/WebFrame.cpp:
2115         (WebKit::WebFrame::url const):
2116         * WebProcess/WebPage/WebFrame.h:
2117         * WebProcess/WebPage/WebPage.cpp:
2118         (WebKit::WebPage::savePDFToFileInDownloadsFolder):
2119         * WebProcess/WebPage/WebPage.h:
2120
2121 2017-08-25  David Kilzer  <ddkilzer@apple.com>
2122
2123         Fix -Wunused-lambda-capture warnings in WebKit with new clang compiler
2124         <https://webkit.org/b/175911>
2125         <rdar://problem/33667497>
2126
2127         Reviewed by Alex Christensen.
2128
2129         * NetworkProcess/cache/CacheStorageEngine.cpp:
2130         (WebKit::CacheStorage::Engine::retrieveCaches): Remove unused
2131         lambda capture for 'this'.
2132         (WebKit::CacheStorage::Engine::putRecords): Remove unused
2133         lambda capture for 'cacheIdentifier'.
2134         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
2135         (WebKit::CacheStorageEngineConnection::records): Ditto.
2136
2137 2017-08-25  Brian Burg  <bburg@apple.com>
2138
2139         Web Automation: add capabilities to control ICE candidate filtering and insecure media capture
2140         https://bugs.webkit.org/show_bug.cgi?id=175563
2141         <rdar://problem/33734492>
2142
2143         Reviewed by Joseph Pecoraro.
2144
2145         * UIProcess/Cocoa/AutomationClient.mm:
2146         (WebKit::AutomationClient::requestAutomationSessionWithCapabilities):
2147         Translate new capabilities to _WKAutomationSessionConfiguration properties.
2148
2149 2017-08-24  Brian Burg  <bburg@apple.com>
2150
2151         Web Automation: use automation session configurations to propagate per-session settings
2152         https://bugs.webkit.org/show_bug.cgi?id=175562
2153         <rdar://problem/30853362>
2154
2155         Reviewed by Joseph Pecoraro.
2156
2157         Some WebDriver capabilities need WebKit support in order to be implemented correctly.
2158         There is currently no easy way to forward WebDriver capability keys and values to WebKit
2159         at session creation time. This is unfortunate, as it would be best to implement many of
2160         them via existing mechanisms (i.e., WKPreferences properties) that need to be set up
2161         before any windows are opened in the session.
2162
2163         This patch adds WebKit-side plumbing to forward named capabilities from a remote
2164         WebDriver client to the _WKAutomationSession and its delegate in WebKit2 UIProcess.
2165         These capabilities are exposed via API in ways that abstract away details of how the
2166         capabilities are represented in RWI wire protocol messages.
2167
2168         In the Cocoa API, these capabilities are exposed via a session configuration object
2169         that's similar to WKWebView's WKWebViewConfiguration. A session's configuration is copied
2170         and used at initialization and cannot be modified after the session is created.
2171         Code in the Cocoa subclass of API::AutomationClient translates between RWI protocol
2172         capability names and property values on the _WKAutomationSessionConfiguration it
2173         uses to request a new session.
2174
2175         Later patches will hook up the two properties present in the configuration in this patch.
2176         Most of this patch is just generic plumbing without doing any capability-specific work.
2177
2178         * UIProcess/API/Cocoa/_WKAutomationDelegate.h:
2179         * UIProcess/API/Cocoa/_WKAutomationSession.h:
2180         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
2181         (-[_WKAutomationSession init]):
2182         (-[_WKAutomationSession initWithConfiguration:]):
2183         (-[_WKAutomationSession configuration]):
2184         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKAutomationDelegate.h.
2185         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.mm: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSession.h.
2186         (-[_WKAutomationSessionConfiguration init]):
2187         (-[_WKAutomationSessionConfiguration description]):
2188         * UIProcess/Cocoa/AutomationClient.h:
2189         * UIProcess/Cocoa/AutomationClient.mm:
2190         (WebKit::AutomationClient::AutomationClient):
2191         (WebKit::AutomationClient::requestAutomationSession):
2192         (WebKit::AutomationClient::requestAutomationSessionWithCapabilities):
2193         * WebKit.xcodeproj/project.pbxproj:
2194
2195 2017-08-25  Brady Eidson  <beidson@apple.com>
2196
2197         Introduce ServerWorkerRegistration task queues.
2198         https://bugs.webkit.org/show_bug.cgi?id=175851
2199
2200         Reviewed by Andy Estes.
2201
2202         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2203         (WebKit::WebSWServerConnection::WebSWServerConnection):
2204         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2205         (WebKit::WebSWServerConnection::identifier const): Deleted.
2206
2207         * WebProcess/Storage/WebSWClientConnection.h:
2208         (WebKit::WebSWClientConnection::identifier const): Deleted.
2209
2210 2017-08-25  Youenn Fablet  <youenn@apple.com>
2211
2212         [Cache API] UIProcess should provide the directory path where to store Cache Storage data
2213         https://bugs.webkit.org/show_bug.cgi?id=175884
2214         <rdar://problem/34072441>
2215
2216         Unreviewed.
2217
2218         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2219         (API::ProcessPoolConfiguration::ProcessPoolConfiguration): Fixing typo.
2220
2221 2017-08-25  Jonathan Bedard  <jbedard@apple.com>
2222
2223         Fix build breakage with Public iOS 11 SDK
2224         https://bugs.webkit.org/show_bug.cgi?id=175960
2225         <rdar://problem/34069264>
2226
2227         Reviewed by Wenson Hsieh.
2228
2229         * Platform/spi/ios/UIKitSPI.h: Add UIURLDragPreviewView declaration.
2230
2231 2017-08-24  Chris Dumez  <cdumez@apple.com>
2232
2233         [Directory Upload] Add basic support for input.webkitdirectory
2234         https://bugs.webkit.org/show_bug.cgi?id=175950
2235         <rdar://problem/33951915>
2236
2237         Reviewed by Geoffrey Garen.
2238
2239         Add private API to toggle Directory Upload support.
2240
2241         Add new member to WKOpenPanelParameters to communicate to the
2242         client that the file picker should allow selecting directories.
2243
2244         * Shared/WebCoreArgumentCoders.cpp:
2245         (IPC::ArgumentCoder<FileChooserSettings>::encode):
2246         (IPC::ArgumentCoder<FileChooserSettings>::decode):
2247         * Shared/WebPreferencesDefinitions.h:
2248         * UIProcess/API/APIOpenPanelParameters.h:
2249         (API::OpenPanelParameters::allowDirectories const):
2250         * UIProcess/API/C/WKOpenPanelParametersRef.cpp:
2251         (WKOpenPanelParametersGetAllowsDirectories):
2252         * UIProcess/API/C/WKOpenPanelParametersRef.h:
2253         * UIProcess/API/C/WKPreferences.cpp:
2254         (WKPreferencesSetDirectoryUploadEnabled):
2255         (WKPreferencesGetDirectoryUploadEnabled):
2256         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2257         * UIProcess/API/Cocoa/WKOpenPanelParameters.h:
2258         * UIProcess/API/Cocoa/WKOpenPanelParameters.mm:
2259         (-[WKOpenPanelParameters allowsDirectories]):
2260         * WebProcess/WebPage/WebPage.cpp:
2261         (WebKit::WebPage::updatePreferences):
2262
2263 2017-08-24  Youenn Fablet  <youenn@apple.com>
2264
2265         [Cache API] UIProcess should provide the directory path where to store Cache Storage data
2266         https://bugs.webkit.org/show_bug.cgi?id=175884
2267
2268         Reviewed by Brady Eidson.
2269
2270         Adding API to set the cache storage directory path.
2271         Updating IPC to pass this parameter with its sandbox extension to NetworkProcess at creation time.
2272
2273         * NetworkProcess/NetworkProcess.h:
2274         (WebKit::NetworkProcess::cacheStorageDirectory const):
2275         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2276         (WebKit::NetworkProcessCreationParameters::encode const):
2277         (WebKit::NetworkProcessCreationParameters::decode):
2278         * NetworkProcess/NetworkProcessCreationParameters.h:
2279         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2280         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2281         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2282         (API::ProcessPoolConfiguration::createWithLegacyOptions):
2283         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
2284         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
2285         (API::ProcessPoolConfiguration::copy):
2286         * UIProcess/API/APIProcessPoolConfiguration.h:
2287         * UIProcess/API/APIWebsiteDataStore.h:
2288         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
2289         (API::WebsiteDataStore::defaultCacheStorageDirectory):
2290         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2291         (WebKit::WebProcessPool::legacyPlatformDefaultCacheStorageDirectory):
2292         * UIProcess/WebProcessPool.cpp:
2293         (WebKit::legacyWebsiteDataStoreConfiguration):
2294         (WebKit::WebProcessPool::ensureNetworkProcess):
2295         * UIProcess/WebProcessPool.h:
2296         * UIProcess/WebsiteData/WebsiteDataStore.h:
2297
2298 2017-08-24  Alex Christensen  <achristensen@webkit.org>
2299
2300         Add WKUIDelegatePrivate equivalent of WKPageUIClient's handleAutoplayEvent
2301         https://bugs.webkit.org/show_bug.cgi?id=175965
2302         <rdar://problem/29270035>
2303
2304         Reviewed by Tim Horton.
2305
2306         Covered by updating API tests to use UIDelegate instead of _pageForTesting and WKPageUIClient.
2307
2308         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2309         * UIProcess/Cocoa/UIDelegate.h:
2310         * UIProcess/Cocoa/UIDelegate.mm:
2311         (WebKit::UIDelegate::setDelegate):
2312         (WebKit::toWKFocusDirection):
2313         (WebKit::toWKAutoplayEventFlags):
2314         (WebKit::toWKAutoplayEvent):
2315         (WebKit::UIDelegate::UIClient::handleAutoplayEvent):
2316
2317 2017-08-24  Brady Eidson  <beidson@apple.com>
2318
2319         Remove duplicate WebCore::URL encoder/decoder
2320         https://bugs.webkit.org/show_bug.cgi?id=175952
2321
2322         Reviewed by Chris Dumez.
2323
2324         Don't need the WebCoreArgumentCoder in WebKit since the URL class defines its own coders.
2325
2326         * Shared/WebCoreArgumentCoders.cpp:
2327         (IPC::ArgumentCoder<URL>::encode): Deleted.
2328         (IPC::ArgumentCoder<URL>::decode): Deleted.
2329         * Shared/WebCoreArgumentCoders.h:
2330
2331 2017-08-24  Alex Christensen  <achristensen@webkit.org>
2332
2333         Add WKUIDelegatePrivate callback corresponding to PageUIClient's didNotHandleWheelEvent
2334         https://bugs.webkit.org/show_bug.cgi?id=175957
2335         <rdar://problem/29270035>
2336
2337         Reviewed by Geoffrey Garen.
2338
2339         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2340         * UIProcess/Cocoa/UIDelegate.h:
2341         * UIProcess/Cocoa/UIDelegate.mm:
2342         (WebKit::UIDelegate::setDelegate):
2343         (WebKit::UIDelegate::UIClient::didNotHandleWheelEvent):
2344
2345 2017-08-24  Tim Horton  <timothy_horton@apple.com>
2346
2347         Overflow scroll views are inset to avoid safe areas even if the parent view is not
2348         https://bugs.webkit.org/show_bug.cgi?id=175949
2349         <rdar://problem/34063057>
2350
2351         Reviewed by Beth Dakin.
2352
2353         * UIProcess/ios/RemoteLayerTreeHostIOS.mm:
2354         (WebKit::RemoteLayerTreeHost::createLayer):
2355         Disable automatic content inset adjustment to avoid safe areas on
2356         all of WKWebView's child UIScrollViews.
2357
2358 2017-08-24  Tim Horton  <timothy_horton@apple.com>
2359
2360         Layout size override changes during in-flight animated resize are dropped on the floor forever
2361         https://bugs.webkit.org/show_bug.cgi?id=175916
2362         <rdar://problem/33887295>
2363
2364         Reviewed by Beth Dakin.
2365
2366         Layout size override changes that come in during an animated resize
2367         are currently stored, but not sent in a separate message, because
2368         they're sent as part of the resize. However, if a layout size override
2369         change happens after the animated resize message was already sent, but
2370         before the animated resize is ended, that change will be stored, but
2371         not sent in the animated resize message (because it's too late), and
2372         then subsequent calls with the same size will early-return, because
2373         we're testing against the stored size, not the size we last actually
2374         sent to the Web Content process.
2375
2376         Instead, store the last-sent size, so that subsequent layout size override
2377         changes with the same size won't bail, and if it differs from the active
2378         state after the animated resize completes, send an out-of-band update.
2379
2380         All of the above also applies to device orientation, which follows
2381         exactly the same pattern.
2382
2383         * UIProcess/API/Cocoa/WKWebView.mm:
2384         (-[WKWebView _initializeWithConfiguration:]):
2385         (-[WKWebView _dispatchSetMinimumLayoutSize:]):
2386         (-[WKWebView _dispatchSetMaximumUnobscuredSize:]):
2387         (-[WKWebView _dispatchSetDeviceOrientation:]):
2388         (-[WKWebView _frameOrBoundsChanged]):
2389         (-[WKWebView _windowDidRotate:]):
2390         (-[WKWebView _didRelaunchProcess]):
2391         (-[WKWebView _setMinimumLayoutSizeOverride:]):
2392         (-[WKWebView _setInterfaceOrientationOverride:]):
2393         (-[WKWebView _setMaximumUnobscuredSizeOverride:]):
2394         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
2395
2396 2017-08-24  Tim Horton  <timothy_horton@apple.com>
2397
2398         _WKThumbnailView snapshots have to be copied by CA on first commit due to bad row alignment
2399         https://bugs.webkit.org/show_bug.cgi?id=175898
2400         <rdar://problem/34029673>
2401
2402         Reviewed by Sam Weinig.
2403
2404         In order to avoid copying, CGImages used as layer contents need to have certain
2405         alignment requirements fulfilled. Align the row stride to the desired value.
2406
2407         * Shared/ShareableBitmap.cpp:
2408         (WebKit::ShareableBitmap::create):
2409         (WebKit::ShareableBitmap::createShareable):
2410         (WebKit::ShareableBitmap::numBytesForSize):
2411         (WebKit::ShareableBitmap::calculateBytesPerPixel): Deleted.
2412         * Shared/ShareableBitmap.h:
2413         (WebKit::ShareableBitmap::sizeInBytes const):
2414         (WebKit::ShareableBitmap::numBytesForSize): Deleted.
2415         Merge the interfaces of numBytesPerSize and sizeInBytes between the platforms.
2416         numBytesForSize now makes use of the new calculateBytesPerRow, which is
2417         implemented by each platform ShareableBitmap implementation to do the
2418         requisite alignment for that platform.
2419
2420         * Shared/cairo/ShareableBitmapCairo.cpp:
2421         (WebKit::ShareableBitmap::calculateBytesPerRow):
2422         (WebKit::ShareableBitmap::calculateBytesPerPixel):
2423         (WebKit::createSurfaceFromData):
2424         (WebKit::ShareableBitmap::numBytesForSize): Deleted.
2425         Implement calculateBytesPerRow (which used to be hidden inside of numBytesForSize)
2426         and get rid of the now-duplicative numBytesForSize.
2427
2428         * Shared/cg/ShareableBitmapCG.cpp:
2429         (WebKit::ShareableBitmap::calculateBytesPerRow):
2430         (WebKit::ShareableBitmap::createGraphicsContext):
2431         (WebKit::ShareableBitmap::createCGImage const):
2432         Implement calculateBytesPerRow and make use of it when providing a row stride
2433         to CoreGraphics.
2434
2435 2017-08-24  Chris Dumez  <cdumez@apple.com>
2436
2437         [iOS] ViewServices started by StoreKitUIService may get suspended unexpectedly
2438         https://bugs.webkit.org/show_bug.cgi?id=175922
2439         <rdar://problem/34028921>
2440
2441         Reviewed by Tim Horton.
2442
2443         ViewServices started by StoreKitUIService may get suspended unexpectedly. This is
2444         because StoreKitUIService is itself a ViewService and is therefore in the background.
2445         To address the issue, treat StoreKitUIService as initially foreground in
2446         ApplicationStateTracker so that its ViewServices do not get suspended. We don't
2447         have good way to deal with ViewServices started by other ViewServices unfortunately.
2448
2449         * Platform/spi/ios/UIKitSPI.h:
2450         * UIProcess/ApplicationStateTracker.mm:
2451         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
2452
2453 2017-08-23  Youenn Fablet  <youenn@apple.com>
2454
2455         [Cache API] Unify WebCore and WebKit error handling
2456         https://bugs.webkit.org/show_bug.cgi?id=175902
2457
2458         Reviewed by Alex Christensen.
2459
2460         Removing all callbacks and error definitions from WebKit
2461         and reusing DOMCache ones instead.
2462
2463         * NetworkProcess/cache/CacheStorage.h: Removed.
2464         * NetworkProcess/cache/CacheStorageEngine.cpp:
2465         (WebKit::CacheStorage::Engine::caches const):
2466         (WebKit::CacheStorage::Engine::queryCache):
2467         * NetworkProcess/cache/CacheStorageEngine.h:
2468         * NetworkProcess/cache/CacheStorageEngineCache.h:
2469         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
2470         (WebKit::CacheStorageEngineConnection::open):
2471         (WebKit::CacheStorageEngineConnection::remove):
2472         (WebKit::CacheStorageEngineConnection::putRecords):
2473         * NetworkProcess/cache/CacheStorageEngineConnection.h:
2474         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
2475         * Shared/WebCoreArgumentCoders.cpp:
2476         (IPC::ArgumentCoder<DOMCache::CacheInfo>::encode):
2477         (IPC::ArgumentCoder<DOMCache::CacheInfo>::decode):
2478         (IPC::ArgumentCoder<DOMCache::Record>::encode):
2479         (IPC::ArgumentCoder<DOMCache::Record>::decode):
2480         * Shared/WebCoreArgumentCoders.h:
2481         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2482         (WebKit::WebCacheStorageConnection::doBatchPutOperation):
2483         (WebKit::WebCacheStorageConnection::openCompleted):
2484         (WebKit::WebCacheStorageConnection::removeCompleted):
2485         (WebKit::WebCacheStorageConnection::updateCaches):
2486         (WebKit::WebCacheStorageConnection::updateRecords):
2487         (WebKit::WebCacheStorageConnection::deleteRecordsCompleted):
2488         (WebKit::WebCacheStorageConnection::putRecordsCompleted):
2489         * WebProcess/Cache/WebCacheStorageConnection.h:
2490         * WebProcess/Cache/WebCacheStorageConnection.messages.in:
2491
2492 2017-08-23  Alex Christensen  <achristensen@webkit.org>
2493
2494         Clean up UIClients
2495         https://bugs.webkit.org/show_bug.cgi?id=175906
2496
2497         Reviewed by Tim Horton.
2498
2499         There were some unnecessary checks to see if the client implements something,
2500         when the default behavior is to do nothing if the client doesn't implement the callback.
2501         Also, make some overrides finals and fix some spacing.
2502
2503         * UIProcess/API/APIUIClient.h:
2504         (API::UIClient::didNotHandleKeyEvent):
2505         (API::UIClient::implementsDidNotHandleKeyEvent const): Deleted.
2506         (API::UIClient::implementsDidNotHandleWheelEvent const): Deleted.
2507         * UIProcess/API/C/WKPage.cpp:
2508         (WKPageSetPageUIClient):
2509         * UIProcess/Cocoa/UIDelegate.h:
2510         * UIProcess/WebPageProxy.cpp:
2511         (WebKit::WebPageProxy::didReceiveEvent):
2512
2513 2017-08-23  Alex Christensen  <achristensen@webkit.org>
2514
2515         Add WKUIDelegatePrivate callbacks corresponding to WKPageUIClient's takeFocus, focus, and unfocus
2516         https://bugs.webkit.org/show_bug.cgi?id=175896
2517
2518         Reviewed by Tim Horton.
2519         
2520         I also renamed _webViewShow to _showWebView based on feedback from https://bugs.webkit.org/show_bug.cgi?id=175797
2521
2522         Added an API test.
2523
2524         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2525         * UIProcess/Cocoa/UIDelegate.h:
2526         * UIProcess/Cocoa/UIDelegate.mm:
2527         (WebKit::UIDelegate::setDelegate):
2528         (WebKit::toWKFocusDirection):
2529         (WebKit::UIDelegate::UIClient::takeFocus):
2530         (WebKit::UIDelegate::UIClient::focus):
2531         (WebKit::UIDelegate::UIClient::unfocus):
2532         (WebKit::UIDelegate::UIClient::showPage):
2533
2534 2017-08-23  Youenn Fablet  <youenn@apple.com>
2535
2536         [CacheAPI] Introduce a WebKit::CacheStorage namespace
2537         https://bugs.webkit.org/show_bug.cgi?id=175885
2538
2539         Reviewed by Alex Christensen.
2540
2541         Introducing WebKit::CacheStorage namespace.
2542         Splitting CacheStorageEngine.h in three files.
2543         Updating client code accordingly.
2544
2545         * NetworkProcess/cache/CacheStorage.h: Added.
2546         * NetworkProcess/cache/CacheStorageEngine.cpp:
2547         (WebKit::CacheStorage::globalEngineMap):
2548         (WebKit::CacheStorage::Engine::from):
2549         (WebKit::CacheStorage::Engine::destroyEngine):
2550         (WebKit::CacheStorage::Engine::defaultEngine):
2551         (WebKit::CacheStorage::Engine::open):
2552         (WebKit::CacheStorage::Engine::remove):
2553         (WebKit::CacheStorage::Engine::retrieveCaches):
2554         (WebKit::CacheStorage::Engine::retrieveRecords):
2555         (WebKit::CacheStorage::Engine::putRecords):
2556         (WebKit::CacheStorage::Engine::deleteMatchingRecords):
2557         (WebKit::CacheStorage::Engine::writeCachesToDisk):
2558         (WebKit::CacheStorage::Engine::readCachesFromDisk):
2559         (WebKit::CacheStorage::Engine::readCache):
2560         (WebKit::CacheStorage::Engine::writeCacheRecords):
2561         (WebKit::CacheStorage::Engine::removeCacheRecords):
2562         (WebKit::CacheStorage::Engine::cache):
2563         (WebKit::CacheStorage::Engine::caches const):
2564         (WebKit::CacheStorage::Engine::queryCache):
2565         * NetworkProcess/cache/CacheStorageEngineCache.h: Added.
2566         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
2567         (WebKit::CacheStorageEngineConnection::open):
2568         (WebKit::CacheStorageEngineConnection::remove):
2569         (WebKit::CacheStorageEngineConnection::caches):
2570         (WebKit::CacheStorageEngineConnection::records):
2571         (WebKit::CacheStorageEngineConnection::deleteMatchingRecords):
2572         (WebKit::CacheStorageEngineConnection::putRecords):
2573         * WebKit.xcodeproj/project.pbxproj:
2574         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2575         (WebKit::WebCacheStorageConnection::openCompleted):
2576         (WebKit::WebCacheStorageConnection::removeCompleted):
2577         (WebKit::WebCacheStorageConnection::updateCaches):
2578         (WebKit::WebCacheStorageConnection::updateRecords):
2579         (WebKit::WebCacheStorageConnection::deleteRecordsCompleted):
2580         (WebKit::WebCacheStorageConnection::putRecordsCompleted):
2581         * WebProcess/Cache/WebCacheStorageConnection.h:
2582
2583 2017-08-23  Youenn Fablet  <youenn@apple.com>
2584
2585         [Cache API] Enable persistent coder to encode FetchOptions
2586         https://bugs.webkit.org/show_bug.cgi?id=175883
2587
2588         Reviewed by Alex Christensen.
2589
2590         Removing FetchOptions related ArgumentCoders specific code.
2591
2592         * Shared/WebCoreArgumentCoders.cpp:
2593         * Shared/WebCoreArgumentCoders.h:
2594
2595 2017-08-23  Youenn Fablet  <youenn@apple.com>
2596
2597         CacheStorageEngine readCachesFromDisk callback should return the read Caches
2598         https://bugs.webkit.org/show_bug.cgi?id=175882
2599
2600         Reviewed by Alex Christensen.
2601
2602         Callback of readCachesFromDisk takes now a Caches or error parameter.
2603
2604         * NetworkProcess/cache/CacheStorageEngine.cpp:
2605         (WebKit::CacheStorageEngine::open):
2606         (WebKit::CacheStorageEngine::retrieveCaches):
2607         (WebKit::CacheStorageEngine::readCachesFromDisk):
2608         * NetworkProcess/cache/CacheStorageEngine.h:
2609
2610 2017-08-23  Chris Dumez  <cdumez@apple.com>
2611
2612         Regression(r221059): NetworkDataTask::didReceiveResponse() should not use PolicyUse for HTTP/0.9
2613         https://bugs.webkit.org/show_bug.cgi?id=175872
2614
2615         Reviewed by Daniel Bates.
2616
2617         r221059 was calling the ResponseCompletionHandler with {} which ended up being
2618         PolicyUse. Since this is an error case and do not want to receive the data, it
2619         makes more sense to use PolicyIgnore instead. There should not be a behavior
2620         change on WebKit side though since we are cancelling the load right after
2621         calling the completion handler anyway.
2622
2623         Tests under http/tests/security/http-0.9/ are still passing.
2624
2625         * NetworkProcess/NetworkDataTask.cpp:
2626         (WebKit::NetworkDataTask::didReceiveResponse):
2627
2628 2017-08-22  Tim Horton  <timothy_horton@apple.com>
2629
2630         _WKThumbnailView should use the screen color space instead of sRGB
2631         https://bugs.webkit.org/show_bug.cgi?id=175858
2632         <rdar://problem/33925559>
2633
2634         Reviewed by Dean Jackson.
2635
2636         Currently, _WKThumbnailView uses software snapshotting via
2637         WebPage's takeSnapshot and friends, which always use sRGB.
2638         However, it is immediately presented in display space, which
2639         causes an expensive color conversion, which could have been avoided
2640         if the snapshot was instead originally taken in display space.
2641
2642         To solve this, add:
2643
2644         - a mechanism allowing ShareableBitmap to be constructed with a
2645           configuration, which can include a color space as well as the
2646           existing flags (flipping SupportsAlpha to be IsOpaque instead
2647           because most callers want alpha)
2648
2649         - a WebImage constructor allowing callers to pass a ShareableBitmap
2650           configuration through
2651
2652         - a bit in SnapshotOptions for callers to indicate that they
2653           want to snapshot in the display's color space (repurposed
2654           from the ExtendedColor bit)
2655
2656         And then make use of that bit in _WKThumbnailView.
2657
2658         * Shared/API/c/WKSharedAPICast.h:
2659         (WebKit::snapshotOptionsFromImageOptions):
2660         Remove this incorrect conversion (WKImageOptions doesn't include
2661         kWKSnapshotOptionsExtendedColor).
2662
2663         (WebKit::toSnapshotOptions):
2664         Plumb kWKSnapshotOptionsExtendedColor to WebKit::SnapshotOptions
2665         as the "UseScreenColorSpace". Leave the SPI name intact because
2666         it has clients, but the difference isn't so huge that it will be
2667         a problem.
2668
2669         * Shared/ImageOptions.h:
2670         (WebKit::snapshotOptionsToImageOptions):
2671         Remove ImageOptionsExtendedColor, and rename
2672         SnapshotOptionsExtendedColor to SnapshotOptionsUseScreenColorSpace.
2673
2674         * Shared/ShareableBitmap.cpp:
2675         (WebKit::ShareableBitmap::Handle::Handle):
2676         (WebKit::ShareableBitmap::Handle::encode const):
2677         (WebKit::ShareableBitmap::Handle::decode):
2678         (WebKit::ShareableBitmap::Handle::clear):
2679         (WebKit::ShareableBitmap::Configuration::encode const):
2680         (WebKit::ShareableBitmap::Configuration::decode):
2681         (WebKit::ShareableBitmap::create):
2682         (WebKit::ShareableBitmap::createShareable):
2683         (WebKit::ShareableBitmap::createHandle const):
2684         (WebKit::ShareableBitmap::ShareableBitmap):
2685         (WebKit::ShareableBitmap::calculateBytesPerPixel):
2686         (WebKit::calculateBytesPerPixel): Deleted.
2687         * Shared/ShareableBitmap.h:
2688         (WebKit::ShareableBitmap::numBytesForSize):
2689         (WebKit::ShareableBitmap::sizeInBytes const):
2690         * Shared/cg/ShareableBitmapCG.cpp:
2691         (WebKit::colorSpace):
2692         (WebKit::bitmapInfo):
2693         (WebKit::ShareableBitmap::calculateBytesPerPixel):
2694         (WebKit::ShareableBitmap::createGraphicsContext):
2695         (WebKit::ShareableBitmap::createCGImage const):
2696         Remove ShareableBitmap's flags parameter, and replace it with
2697         a configuration parameter. Configuration is a struct that currently
2698         encompasses the newly-flipped IsOpaque bit and (on Cocoa platforms)
2699         a platform colorspace object. Compute bytesPerPixel dynamically
2700         based on the colorspace and whether it uses extended colors or not.
2701
2702         * Shared/WebImage.cpp:
2703         (WebKit::WebImage::create):
2704         * Shared/WebImage.h:
2705         Pass ShareableBitmap::Configuration through to the ShareableBitmap
2706         constructor, if provided.
2707
2708         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
2709         (-[_WKThumbnailView requestSnapshot]):
2710         Make use of the new bit, and use the screen's color space.
2711
2712         * WebProcess/WebPage/WebPage.cpp:
2713         (WebKit::snapshotOptionsToBitmapConfiguration):
2714         (WebKit::WebPage::snapshotAtSize):
2715         (WebKit::WebPage::snapshotNode):
2716         If the snapshot option to use the display color space is set,
2717         fill in the colorSpace field in the ShareableBitmap::Configuration
2718         with the screen's color space.
2719
2720         (WebKit::WebPage::drawRectToImage):
2721         * Shared/WebCoreArgumentCoders.cpp:
2722         (IPC::encodeImage):
2723         * Shared/ContextMenuContextData.cpp:
2724         (WebKit::ContextMenuContextData::ContextMenuContextData):
2725         * Shared/mac/RemoteLayerBackingStore.mm:
2726         (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
2727         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
2728         (WebKit::InjectedBundleRangeHandle::renderedImage):
2729         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
2730         (WebKit::NetscapePlugin::snapshot):
2731         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2732         (WebKit::PDFPlugin::snapshot):
2733         * WebProcess/Plugins/PluginProxy.cpp:
2734         (WebKit::PluginProxy::geometryDidChange):
2735         (WebKit::PluginProxy::updateBackingStore):
2736         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
2737         (WebKit::convertImageToBitmap):
2738         (WebKit::convertCGImageToBitmap):
2739         * WebProcess/WebPage/WebFrame.cpp:
2740         (WebKit::WebFrame::createSelectionSnapshot const):
2741         * WebProcess/WebPage/ios/WebPageIOS.mm:
2742         (WebKit::WebPage::getPositionInformation):
2743         Adopt ShareableBitmap::Configuration. Since IsOpaque
2744         defaults to false, all callers who previously constructed
2745         ShareableBitmap with SupportsAlpha now don't have to do anything.
2746
2747 2017-08-20  Wenson Hsieh  <wenson_hsieh@apple.com>
2748
2749         [iOS WK2] WKWebView schedules nonstop layout after pressing cmb+b,i,u inside a contenteditable div
2750         https://bugs.webkit.org/show_bug.cgi?id=175116
2751         <rdar://problem/28279301>
2752
2753         Reviewed by Darin Adler and Ryosuke Niwa.
2754
2755         Refactors WebPage::editorState to only use the StyleProperties derived from EditingStyle, instead of inserting
2756         and removing a temporary node to figure out the style. Also adds hooks to notify the UI delegate of EditorState
2757         changes.
2758
2759         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2760         * UIProcess/API/Cocoa/WKWebView.mm:
2761         (nsTextAlignment):
2762         (dictionaryRepresentationForEditorState):
2763         (-[WKWebView _didChangeEditorState]):
2764
2765         Alerts the private UI delegate of UI-side EditorState updates.
2766
2767         (-[WKWebView _web_editorStateDidChange]):
2768         (-[WKWebView _executeEditCommand:argument:completion:]):
2769         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2770         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2771         * UIProcess/API/mac/WKView.mm:
2772         (-[WKView _web_editorStateDidChange]):
2773         * UIProcess/Cocoa/WebViewImpl.h:
2774         * UIProcess/Cocoa/WebViewImpl.mm:
2775         (WebKit::WebViewImpl::selectionDidChange):
2776         * UIProcess/WebPageProxy.cpp:
2777         (WebKit::WebPageProxy::executeEditCommand):
2778
2779         Change executeEditCommand(name, callback) to executeEditCommand(name, argument, callback) and lift out of iOS
2780         platform code and into WebPage.cpp.
2781
2782         * UIProcess/WebPageProxy.h:
2783         * UIProcess/ios/WKContentViewInteraction.mm:
2784         (-[WKContentView executeEditCommandWithCallback:]):
2785         (-[WKContentView _selectionChanged]):
2786         * UIProcess/ios/WebPageProxyIOS.mm:
2787         (WebKit::WebPageProxy::executeEditCommand): Deleted.
2788
2789         Move the iOS-specific implementation of executeEditCommand that invokes a callback when the web process responds
2790         out of WebPageProxyIOS, and into cross-platform WebPageProxy code. Additionally, add a parameter for the edit
2791         command's argument.
2792
2793         * WebProcess/WebPage/WebPage.cpp:
2794         (WebKit::WebPage::editorState const):
2795
2796         Use EditingStyle::styleAtSelectionStart instead of Editor::styleForSelectionStart when computing an EditorState.
2797         Tweak bold, italic and underline to use EditingStyle TriStates.
2798
2799         (WebKit::WebPage::executeEditCommandWithCallback):
2800         * WebProcess/WebPage/WebPage.h:
2801         * WebProcess/WebPage/WebPage.messages.in:
2802         * WebProcess/WebPage/ios/WebPageIOS.mm:
2803         (WebKit::WebPage::executeEditCommandWithCallback): Deleted.
2804
2805 2017-08-22  Wenson Hsieh  <wenson_hsieh@apple.com>
2806
2807         [WK2] EditorState updates should be rolled into the layer update lifecycle when possible
2808         https://bugs.webkit.org/show_bug.cgi?id=175370
2809         <rdar://problem/33799806>
2810
2811         Reviewed by Ryosuke Niwa.
2812
2813         See per-method comments for more detail. WebPage::didChangeSelection now schedules EditorState updates to be sent
2814         during the next layer tree transaction rather than sending them synchronously. To ensure that iOS and Mac continue
2815         to behave correctly w.r.t. EditorState updates, we immediately dispatch EditorStates in the following cases:
2816         - After the composition changes, is confirmed, or is canceled.
2817         - After an edit command is executed.
2818         - After ending user-triggered selection changes.
2819
2820         * Shared/mac/RemoteLayerTreeTransaction.h:
2821         (WebKit::RemoteLayerTreeTransaction::hasEditorState const):
2822         (WebKit::RemoteLayerTreeTransaction::editorState const):
2823         (WebKit::RemoteLayerTreeTransaction::setEditorState):
2824
2825         Attaches an optional EditorState to the RemoteLayerTreeTransaction. This EditorState is computed and sent over
2826         when setting up the transaction in WebPage, if something previously scheduled an EditorState update.
2827
2828         * Shared/mac/RemoteLayerTreeTransaction.mm:
2829         (WebKit::RemoteLayerTreeTransaction::encode const):
2830         (WebKit::RemoteLayerTreeTransaction::decode):
2831
2832         Add coder support for sending over a layer tree transaction's EditorState.
2833
2834         * UIProcess/API/Cocoa/WKViewPrivate.h:
2835         * UIProcess/API/mac/WKView.mm:
2836         (-[WKView _doAfterNextPresentationUpdate:]):
2837
2838         Add _doAfterNextPresentationUpdate to WKView (used in TestWebKitAPI -- refer to
2839         WebKitAgnosticTest::waitForNextPresentationUpdate).
2840
2841         * UIProcess/DrawingAreaProxy.h:
2842         (WebKit::DrawingAreaProxy::dispatchPresentationCallbacksAfterFlushingLayers):
2843         * UIProcess/DrawingAreaProxy.messages.in:
2844
2845         Add a new IPC messages, DispatchPresentationCallbacksAfterFlushingLayers, to invoke in-flight presentation
2846         callbacks in the UI process following a layer flush in the web process.
2847
2848         * UIProcess/WebPageProxy.h:
2849         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
2850         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2851         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
2852         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2853         (WebKit::TiledCoreAnimationDrawingAreaProxy::~TiledCoreAnimationDrawingAreaProxy):
2854         (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing):
2855         (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchPresentationCallbacksAfterFlushingLayers):
2856
2857         Run all pending _doAfterNextPresentationUpdate callbacks.
2858
2859         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
2860         (WebKit::WebEditorClient::didApplyStyle):
2861         (WebKit::WebEditorClient::respondToChangedContents):
2862         (WebKit::WebEditorClient::didEndUserTriggeredSelectionChanges):
2863         (WebKit::WebEditorClient::didUpdateComposition):
2864
2865         Forward editor client calls to the WebPage.
2866
2867         (WebKit::WebEditorClient::didChangeSelectionAndUpdateLayout): Deleted.
2868         * WebProcess/WebCoreSupport/WebEditorClient.h:
2869         * WebProcess/WebPage/WebPage.cpp:
2870         (WebKit::WebPage::editorState const):
2871         (WebKit::WebPage::updateEditorStateAfterLayoutIfEditabilityChanged):
2872         (WebKit::WebPage::willCommitLayerTree):
2873         (WebKit::WebPage::didApplyStyle):
2874
2875         Allow style application to immediately trigger EditorState updates, if we're not currently ignoring selection
2876         changes in the Editor.
2877
2878         (WebKit::WebPage::didChangeContents):
2879
2880         Allow applying top-level edit commands to immediately trigger EditorState updates, if we're not currently
2881         ignoring selection changes in the Editor.
2882
2883         (WebKit::WebPage::didChangeSelection):
2884         (WebKit::WebPage::didUpdateComposition):
2885         (WebKit::WebPage::didEndUserTriggeredSelectionChanges):
2886         (WebKit::WebPage::discardedComposition):
2887         (WebKit::WebPage::canceledComposition):
2888
2889         When handling composition updates, always send an EditorState to the UI process. Unlike other cases, IME
2890         requires immediate EditorState data, so we need to be explicit here in sending updates right away.
2891
2892         (WebKit::WebPage::sendEditorStateUpdate):
2893         (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate):
2894         (WebKit::WebPage::flushPendingEditorStateUpdate):
2895
2896         Helper methods to schedule an EditorState update to be sent upon the next layer tree update, or flush any
2897         pending EditorState update that has been scheduled. The private, more aggressive variant of this is
2898         sendEditorStateUpdate, which ignores whether or not there was already an EditorState update scheduled, and sends
2899         one anyways (this still fulfills any EditorState update that was previously scheduled).
2900
2901         These helper methods are treated as no-ops when invoked while ignoring selection changes. This is to prevent
2902         temporary selection state and editor commands during operations such as text indicator snapshotting from pushing
2903         bogus information about transient editor states to the UI process.
2904
2905         (WebKit::WebPage::sendPostLayoutEditorStateIfNeeded): Deleted.
2906         * WebProcess/WebPage/WebPage.h:
2907         * WebProcess/WebPage/ios/WebPageIOS.mm:
2908         (WebKit::WebPage::platformEditorState const):
2909         (WebKit::WebPage::executeEditCommandWithCallback):
2910         (WebKit::selectionIsInsideFixedPositionContainer):
2911         (WebKit::WebPage::updateVisibleContentRects):
2912
2913         Fix a hack that was computing an EditorState to figure out whether the current selection starts or ends in a
2914         fixed position container. Factors out relevant logic into a separate helper, and also schedules an EditorState
2915         update instead of immediately computing it.
2916
2917         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2918         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2919         (WebKit::TiledCoreAnimationDrawingArea::addTransactionCallbackID):
2920
2921         Add support for registering and dispatching presentation callbacks that hook into the layer flush lifecycle,
2922         using the tiled CA drawing area. These are used by Mac LayoutTests and API tests that need to wait until the
2923         next flush before checking for state that depends on EditorState updates in the UI process.
2924
2925         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
2926
2927         Tell the WebPage to flush any pending EditorState updates.
2928
2929         * WebProcess/WebPage/mac/WebPageMac.mm:
2930         (WebKit::WebPage::platformEditorState const):
2931
2932 2017-08-22  Brent Fulgham  <bfulgham@apple.com>
2933
2934         Relax keychain access to permit users to permanently allow client certificates
2935         https://bugs.webkit.org/show_bug.cgi?id=175857
2936         <rdar://problem/32293867>
2937
2938         Reviewed by Alex Christensen.
2939
2940         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2941         * WebProcess/com.apple.WebProcess.sb.in:
2942
2943 2017-08-22  Chris Dumez  <cdumez@apple.com>
2944
2945         Introduce a new CompletionHandler type and use it for NetworkDataTaskClient's completion handlers to help catch bugs
2946         https://bugs.webkit.org/show_bug.cgi?id=175832
2947
2948         Reviewed by Alex Christensen.
2949
2950         Use new CompletionHandler type for NetworkDataTaskClient's completion handlers to help catch bugs.
2951         It actually already found a bug in our HTTP 0.9 error handling which is fixed in this patch
2952         as well.
2953
2954         * NetworkProcess/NetworkDataTask.cpp:
2955         (WebKit::NetworkDataTask::didReceiveResponse):
2956         * NetworkProcess/NetworkDataTask.h:
2957         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2958         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2959         (WebKit::NetworkDataTaskCocoa::tryPasswordBasedAuthentication):
2960         * Shared/Authentication/AuthenticationManager.cpp:
2961         (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge):
2962         * Shared/Authentication/AuthenticationManager.h:
2963         * Shared/Authentication/mac/AuthenticationManager.mac.mm:
2964         (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge):
2965
2966 2017-08-22  Alex Christensen  <achristensen@webkit.org>
2967
2968         Add UIDelegatePrivate SPI corresponding to WKPageUIClient.showPage
2969         https://bugs.webkit.org/show_bug.cgi?id=175797
2970         <rdar://problem/29270035>
2971
2972         Reviewed by Geoffrey Garen.
2973
2974         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2975         * UIProcess/Cocoa/UIDelegate.h:
2976         * UIProcess/Cocoa/UIDelegate.mm:
2977         (WebKit::UIDelegate::setDelegate):
2978         (WebKit::UIDelegate::UIClient::showPage):
2979         * WebProcess/WebPage/WebPage.cpp:
2980         (WebKit::WebPage::registerURLSchemeHandler):
2981         window.open, createWebViewWithConfiguration, and WKURLSchemeHandlers all used together
2982         make it so that URLSchemeHandlers are added to WebPages that already have them.  The
2983         assertions are no longer valid.
2984
2985 2017-08-22  Matt Lewis  <jlewis3@apple.com>
2986
2987         Unreviewed, rolling out r221026.
2988
2989         This caused a consistent API failure on iOS Simulator.
2990
2991         Reverted changeset:
2992
2993         "Add UIDelegatePrivate SPI corresponding to
2994         WKPageUIClient.showPage"
2995         https://bugs.webkit.org/show_bug.cgi?id=175797
2996         http://trac.webkit.org/changeset/221026
2997
2998 2017-08-22  Ryan Haddad  <ryanhaddad@apple.com>
2999
3000         Unreviewed, rolling out r221027.
3001
3002         This change caused LayoutTests to exit early with assertion
3003         failures.
3004
3005         Reverted changeset:
3006
3007         "Add sanity check for source origin in
3008         WebLoaderStrategy::startPingLoad()"
3009         https://bugs.webkit.org/show_bug.cgi?id=175827
3010         http://trac.webkit.org/changeset/221027
3011
3012 2017-08-22  Chris Dumez  <cdumez@apple.com>
3013
3014         [WK2] Enable Beacon API by default
3015         https://bugs.webkit.org/show_bug.cgi?id=175839
3016
3017         Reviewed by Youenn Fablet.
3018
3019         * Shared/WebPreferencesDefinitions.h:
3020
3021 2017-08-22  Tim Horton  <timothy_horton@apple.com>
3022
3023         REGRESSION (High Sierra): PDFPlugin won't render PostScript Files
3024         https://bugs.webkit.org/show_bug.cgi?id=175840
3025         <rdar://problem/33877923>
3026
3027         Reviewed by Brent Fulgham.
3028
3029         * WebProcess/com.apple.WebProcess.sb.in:
3030         Add a sandbox exception for the PostScript conversion process.
3031
3032 2017-08-22  Chris Dumez  <cdumez@apple.com>
3033
3034         Clean up PingLoad::processContentExtensionRulesForLoad()
3035         https://bugs.webkit.org/show_bug.cgi?id=175834
3036
3037         Reviewed by Alex Christensen.
3038
3039         * NetworkProcess/PingLoad.cpp:
3040         (WebKit::PingLoad::willPerformHTTPRedirection):
3041         (WebKit::PingLoad::processContentExtensionRulesForLoad):
3042         * NetworkProcess/PingLoad.h:
3043
3044 2017-08-22  Alex Christensen  <achristensen@webkit.org>
3045
3046         Remove ChromeClient::scrollbarsModeDidChange
3047         https://bugs.webkit.org/show_bug.cgi?id=175805
3048
3049         Reviewed by Daniel Bates.
3050
3051         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3052         (WebKit::WebChromeClient::scrollbarsModeDidChange const): Deleted.
3053         * WebProcess/WebCoreSupport/WebChromeClient.h:
3054
3055 2017-08-22  Chris Dumez  <cdumez@apple.com>
3056
3057         Add sanity check for source origin in WebLoaderStrategy::startPingLoad()
3058         https://bugs.webkit.org/show_bug.cgi?id=175827
3059
3060         Reviewed by Geoffrey Garen.
3061
3062         * WebProcess/Network/WebLoaderStrategy.cpp:
3063         (WebKit::WebLoaderStrategy::startPingLoad):
3064
3065 2017-08-22  Alex Christensen  <achristensen@webkit.org>
3066
3067         Add UIDelegatePrivate SPI corresponding to WKPageUIClient.showPage
3068         https://bugs.webkit.org/show_bug.cgi?id=175797
3069         <rdar://problem/29270035>
3070
3071         Reviewed by Geoffrey Garen.
3072
3073         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3074         * UIProcess/Cocoa/UIDelegate.h:
3075         * UIProcess/Cocoa/UIDelegate.mm:
3076         (WebKit::UIDelegate::setDelegate):
3077         (WebKit::UIDelegate::UIClient::showPage):
3078         * WebProcess/WebPage/WebPage.cpp:
3079         (WebKit::WebPage::registerURLSchemeHandler):
3080         window.open, createWebViewWithConfiguration, and WKURLSchemeHandlers all used together
3081         make it so that URLSchemeHandlers are added to WebPages that already have them.  The
3082         assertions are no longer valid.
3083
3084 2017-08-22  Youenn Fablet  <youenn@apple.com>
3085
3086         [Cache API] Add support for overwriting responses with put on an existing record
3087         https://bugs.webkit.org/show_bug.cgi?id=175825
3088
3089         Reviewed by Geoffrey Garen.
3090
3091         Add support for encoding/decoding the update counter.
3092         Incrementing it when overwriting an existing response.
3093         Storing the new body in addition to the new response.
3094
3095         * NetworkProcess/cache/CacheStorageEngine.cpp:
3096         (WebKit::CacheStorageEngine::putRecords):
3097         * Shared/WebCoreArgumentCoders.cpp:
3098         (IPC::ArgumentCoder<CacheStorageConnection::Record>::encode):
3099         (IPC::ArgumentCoder<CacheStorageConnection::Record>::decode):
3100
3101 2017-08-22  Alex Christensen  <achristensen@webkit.org>
3102
3103         Remove ChromeClient::hasOpenedPopup
3104         https://bugs.webkit.org/show_bug.cgi?id=175804
3105
3106         Reviewed by Sam Weinig.
3107
3108         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3109         (WebKit::WebChromeClient::hasOpenedPopup const): Deleted.
3110         * WebProcess/WebCoreSupport/WebChromeClient.h:
3111
3112 2017-08-22  Brent Fulgham  <bfulgham@apple.com> and Pranjal Jumde  <pjumde@apple.com>
3113
3114         Disable access to secure cookies if an HTTPS site loads mixed content
3115         https://bugs.webkit.org/show_bug.cgi?id=157053
3116         <rdar://problem/11290808>
3117
3118         Reviewed by Dan Bates.
3119
3120         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3121         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM): Pass new arguments needed by WebCore.
3122         * NetworkProcess/NetworkConnectionToWebProcess.h:
3123         * NetworkProcess/NetworkConnectionToWebProcess.messages.in: Updated the CookiesForDOM message with the new foundMixedContent
3124         argument and the new didAccessSecureCookies reply.
3125         * Shared/mac/CookieStorageShim.mm:
3126         (WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL): Drive-by fix to use the right message.
3127         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3128         (WebKit::WebPlatformStrategies::cookiesForDOM): Check and return whether secure cookies were accessed. Accept a new argument
3129         indicating whether secure cookies should be included in the response.
3130         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
3131
3132 2017-08-22  Zan Dobersek  <zdobersek@igalia.com>
3133
3134         [GTK][WPE] Rename StorageProcessMainGtk.cpp to StorageProcessMainGLib.cpp
3135         https://bugs.webkit.org/show_bug.cgi?id=175814
3136
3137         Reviewed by Gyuyoung Kim.
3138
3139         Both GTK+ and WPE ports already compile the StorageProcessMainGtk.cpp
3140         file, but it should be renamed to StorageProcessMainGLib and moved into
3141         the StorageProcess/glib/ directory.
3142
3143         * PlatformGTK.cmake:
3144         * PlatformWPE.cmake:
3145         * StorageProcess/glib/StorageProcessMainGLib.cpp: Renamed from Source/WebKit/StorageProcess/gtk/StorageProcessMainGtk.cpp.
3146
3147 2017-08-21  Zan Dobersek  <zdobersek@igalia.com>
3148
3149         [WK] Add missing ENABLE(NETWORK_CACHE) build guards
3150         https://bugs.webkit.org/show_bug.cgi?id=175769
3151
3152         Reviewed by Carlos Alberto Lopez Perez.
3153
3154         Given that the build guard exists, it should be possible to
3155         compile the WebKit layer with the feature disabled. Missing
3156         guards are added in order to achieve that.
3157
3158         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3159         * NetworkProcess/NetworkConnectionToWebProcess.h:
3160         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3161         * NetworkProcess/NetworkProcess.h:
3162         * NetworkProcess/NetworkResourceLoader.cpp:
3163         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
3164         * NetworkProcess/soup/NetworkProcessSoup.cpp:
3165         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
3166         (WebKit::NetworkProcess::clearDiskCache):
3167         * UIProcess/soup/WebProcessPoolSoup.cpp:
3168         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3169         * WebProcess/Network/WebLoaderStrategy.cpp:
3170         (WebKit::WebLoaderStrategy::storeDerivedDataToCache):
3171
3172 2017-08-21  Chris Dumez  <cdumez@apple.com>
3173
3174         [Beacon] Content extensions should be able to intercept Beacon / Ping redirects
3175         https://bugs.webkit.org/show_bug.cgi?id=175746
3176         <rdar://problem/33946050>
3177
3178         Reviewed by Alex Christensen.
3179
3180         Update PingLoad to process content extension rules upon redirect. This allows content
3181         extensions to block and upgrade to HTTPS beacon / ping loads.
3182
3183         Because ping loads can outlive the WebProcess, the content extensions rules are passed
3184         to the NetworkProcess when starting the Ping load. The PingLoad can then consult those
3185         rules upon redirect, on the NetworkProcess side.
3186
3187         * NetworkProcess/NetworkResourceLoadParameters.cpp:
3188         (WebKit::NetworkResourceLoadParameters::encode const):
3189         (WebKit::NetworkResourceLoadParameters::decode):
3190         * NetworkProcess/NetworkResourceLoadParameters.h:
3191         * NetworkProcess/PingLoad.cpp:
3192         (WebKit::PingLoad::willPerformHTTPRedirection):
3193         (WebKit::PingLoad::contentExtensionsBackend):
3194         (WebKit::PingLoad::processContentExtensionRulesForLoad):
3195         * NetworkProcess/PingLoad.h:
3196         * WebProcess/Network/WebLoaderStrategy.cpp:
3197         (WebKit::WebLoaderStrategy::startPingLoad):
3198
3199 2017-08-21  Adrian Perez de Castro  <aperez@igalia.com>
3200
3201         [WPE][GTK] Unused variables in UserMediaProcessManager.cpp
3202         https://bugs.webkit.org/show_bug.cgi?id=175799
3203
3204         Reviewed by Alex Christensen.
3205
3206         The code which uses the "audioExtensionPath" and "videoExtensionPath" variables is guarded
3207         with "#if ENABLE(SANDBOX_EXTENSIONS)”, so do the same for the variables themselves.
3208
3209         * UIProcess/UserMediaProcessManager.cpp: Add missing guards.
3210
3211 2017-08-21  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
3212
3213         [PAL] Move spi/mac directory into PAL
3214         https://bugs.webkit.org/show_bug.cgi?id=175649
3215
3216         Reviewed by Myles C. Maxfield.
3217
3218         * Platform/mac/MenuUtilities.mm:
3219         * Shared/mac/WebCoreArgumentCodersMac.mm:
3220         * Shared/mac/WebEventFactory.mm:
3221         * Shared/mac/WebHitTestResultData.mm:
3222         * UIProcess/API/Cocoa/WKWebView.mm:
3223         * UIProcess/Cocoa/WebViewImpl.mm:
3224         * UIProcess/mac/ServicesController.mm:
3225         * UIProcess/mac/TextCheckerMac.mm:
3226         * UIProcess/mac/ViewGestureControllerMac.mm:
3227         * UIProcess/mac/WKImmediateActionController.h:
3228         * UIProcess/mac/WKImmediateActionController.mm:
3229         * UIProcess/mac/WKSharingServicePickerDelegate.mm:
3230         * UIProcess/mac/WKTextFinderClient.mm:
3231         * UIProcess/mac/WebContextMenuProxyMac.mm:
3232         * UIProcess/mac/WebPageProxyMac.mm:
3233         * WebProcess/cocoa/WebProcessCocoa.mm:
3234
3235 2017-08-21  Brady Eidson  <beidson@apple.com>
3236
3237         Split the one SWServer::Connection into SWClientConnection and SWServer::Connection.
3238         https://bugs.webkit.org/show_bug.cgi?id=175745
3239
3240         Reviewed by Andy Estes.
3241
3242         * CMakeLists.txt:
3243         * DerivedSources.make:
3244         * WebKit.xcodeproj/project.pbxproj:
3245
3246         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp: Renamed from Source/WebKit/WebProcess/Storage/WebSWServerConnection.cpp.
3247         (WebKit::WebSWServerConnection::WebSWServerConnection):
3248         (WebKit::WebSWServerConnection::~WebSWServerConnection):
3249         (WebKit::WebSWServerConnection::disconnectedFromWebProcess):
3250         (WebKit::WebSWServerConnection::rejectJobInClient):
3251         * StorageProcess/ServiceWorker/WebSWServerConnection.h: Copied from Source/WebKit/WebProcess/Storage/WebSWServerConnection.h.
3252         (WebKit::WebSWServerConnection::identifier const):
3253         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in: Copied from Source/WebKit/WebProcess/Storage/WebSWServerConnection.messages.in.
3254
3255         * StorageProcess/StorageToWebProcessConnection.cpp:
3256         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
3257         (WebKit::StorageToWebProcessConnection::didClose):
3258         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
3259         (WebKit::StorageToWebProcessConnection::removeSWServerConnection):
3260         * StorageProcess/StorageToWebProcessConnection.h:
3261
3262         * WebProcess/Storage/WebSWClientConnection.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp.
3263         (WebKit::WebSWClientConnection::WebSWClientConnection):
3264         (WebKit::WebSWClientConnection::~WebSWClientConnection):
3265         (WebKit::WebSWClientConnection::scheduleJobInServer):
3266         * WebProcess/Storage/WebSWClientConnection.h: Renamed from Source/WebKit/WebProcess/Storage/WebSWServerConnection.h.
3267         (WebKit::WebSWClientConnection::identifier const):
3268         * WebProcess/Storage/WebSWClientConnection.messages.in: Renamed from Source/WebKit/WebProcess/Storage/WebSWServerConnection.messages.in.
3269
3270         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
3271         (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
3272         * WebProcess/Storage/WebServiceWorkerProvider.h:
3273
3274         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
3275         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
3276         (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession):
3277         * WebProcess/Storage/WebToStorageProcessConnection.h:
3278
3279 2017-08-21  Charlie Turner  <cturner@igalia.com>
3280
3281         MemoryCache::setCapacities assertion failure maxDeadBytes <= totalBytes
3282         https://bugs.webkit.org/show_bug.cgi?id=175571
3283
3284         Reviewed by Antti Koivisto.
3285
3286         * Shared/CacheModel.cpp:
3287         (WebKit::calculateMemoryCacheSizes): Ensure cacheTotalCapacity is
3288         set to a reasonable value even in low-memory environments.
3289
3290 2017-08-20  Chris Dumez  <cdumez@apple.com>
3291
3292         Simplify calls to LoaderStrategy::startPingLoad()
3293         https://bugs.webkit.org/show_bug.cgi?id=175756
3294
3295         Reviewed by Sam Weinig.
3296
3297         * WebProcess/Network/WebLoaderStrategy.cpp:
3298         (WebKit::WebLoaderStrategy::startPingLoad):
3299         * WebProcess/Network/WebLoaderStrategy.h:
3300
3301 2017-08-18  Chris Dumez  <cdumez@apple.com>
3302
3303         [Beacon] Improve error reporting
3304         https://bugs.webkit.org/show_bug.cgi?id=175723
3305
3306         Reviewed by Darin Adler.
3307
3308         Have Ping loads such as beacons report errors via their completion handler.
3309         The Beacon API is using this error to log a console message when beacon loads
3310         fail, provided that the page is still alive.
3311
3312         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3313         (WebKit::NetworkConnectionToWebProcess::loadPing):
3314         (WebKit::NetworkConnectionToWebProcess::didFinishPingLoad):
3315         * NetworkProcess/NetworkConnectionToWebProcess.h:
3316         * NetworkProcess/PingLoad.cpp:
3317         (WebKit::PingLoad::~PingLoad):
3318         (WebKit::PingLoad::didFinish):
3319         (WebKit::PingLoad::willPerformHTTPRedirection):
3320         (WebKit::PingLoad::didReceiveChallenge):
3321         (WebKit::PingLoad::didReceiveResponseNetworkSession):
3322         (WebKit::PingLoad::didCompleteWithError):
3323         (WebKit::PingLoad::wasBlocked):
3324         (WebKit::PingLoad::cannotShowURL):
3325         (WebKit::PingLoad::timeoutTimerFired):
3326         (WebKit::PingLoad::currentRequest const):
3327         (WebKit::PingLoad::makeCrossOriginAccessRequestWithPreflight):
3328         * NetworkProcess/PingLoad.h:
3329         * WebProcess/Network/NetworkProcessConnection.cpp:
3330         (WebKit::NetworkProcessConnection::didFinishPingLoad):
3331         * WebProcess/Network/NetworkProcessConnection.h:
3332         * WebProcess/Network/NetworkProcessConnection.messages.in:
3333         * WebProcess/Network/WebLoaderStrategy.cpp:
3334         (WebKit::WebLoaderStrategy::networkProcessCrashed):
3335         (WebKit::WebLoaderStrategy::startPingLoad):
3336         (WebKit::WebLoaderStrategy::didFinishPingLoad):
3337         * WebProcess/Network/WebLoaderStrategy.h:
3338
3339 2017-08-18  Chris Dumez  <cdumez@apple.com>
3340
3341         REGRESSION (r220601): Crash when closing google doc after switching the order of tabs in safari
3342         https://bugs.webkit.org/show_bug.cgi?id=175721
3343         <rdar://problem/33928369>
3344
3345         Reviewed by Geoffrey Garen.
3346
3347         Make sure WebProcess::markAllLayersVolatile() does not call WTFMove() multiple times
3348         on the same completion handler. Use a RefCounter to hold on to the completion handler
3349         and make sure the handler gets called when the RefCounter's value becomes 0.
3350
3351         * WebProcess/WebProcess.cpp:
3352         (WebKit::WebProcess::cancelPrepareToSuspend):
3353         (WebKit::WebProcess::markAllLayersVolatile):
3354         (WebKit::WebProcess::cancelMarkAllLayersVolatile):
3355         * WebProcess/WebProcess.h:
3356
3357 2017-08-18  Youenn Fablet  <youenn@apple.com>
3358
3359         [Cache API] Add response body storage
3360         https://bugs.webkit.org/show_bug.cgi?id=175658
3361
3362         Reviewed by Alex Christensen.
3363
3364         Added IPC serialization of Record response body.
3365         Updated CacheStorageEngine implementation as Record has no longer a copy constructor.
3366
3367         * NetworkProcess/cache/CacheStorageEngine.cpp:
3368         (WebKit::CacheStorageEngine::retrieveRecords):
3369         (WebKit::CacheStorageEngine::deleteMatchingRecords):
3370         * Shared/WebCoreArgumentCoders.cpp:
3371         (IPC::encodeSharedBuffer):
3372         (IPC::decodeSharedBuffer):
3373         (IPC::ArgumentCoder<CacheStorageConnection::Record>::encode):
3374         (IPC::ArgumentCoder<CacheStorageConnection::Record>::decode):
3375
3376 2017-08-18  Brady Eidson  <beidson@apple.com>
3377
3378         Bounce ServiceWorker jobs to the Storage Process.
3379         https://bugs.webkit.org/show_bug.cgi?id=175650
3380
3381         Reviewed by Andy Estes.
3382
3383         * CMakeLists.txt:
3384         * DerivedSources.make:
3385         * WebKit.xcodeproj/project.pbxproj:
3386
3387         * Platform/Logging.h:
3388
3389         * StorageProcess/StorageToWebProcessConnection.cpp:
3390         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
3391         (WebKit::StorageToWebProcessConnection::didClose):
3392         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
3393         (WebKit::StorageToWebProcessConnection::removeSWServerConnection):
3394         (WebKit::StorageToWebProcessConnection::establishIDBConnectionToServer):
3395         * StorageProcess/StorageToWebProcessConnection.h:
3396         * StorageProcess/StorageToWebProcessConnection.messages.in:
3397
3398         * WebProcess/Storage/WebSWServerConnection.cpp: Added.
3399         (WebKit::WebSWServerConnection::WebSWServerConnection):
3400         (WebKit::WebSWServerConnection::~WebSWServerConnection):
3401         (WebKit::WebSWServerConnection::disconnectedFromWebProcess):
3402         (WebKit::WebSWServerConnection::scheduleJob):
3403         (WebKit::WebSWServerConnection::scheduleStorageJob):
3404         * WebProcess/Storage/WebSWServerConnection.h: Copied from Source/WebCore/workers/service/ServiceWorkerJob.h.
3405         (WebKit::WebSWServerConnection::create):
3406         (WebKit::WebSWServerConnection::identifier const):
3407         * WebProcess/Storage/WebSWServerCo