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