[iOS] ViewServices started by StoreKitUIService may get suspended unexpectedly
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2017-08-24  Chris Dumez  <cdumez@apple.com>
2
3         [iOS] ViewServices started by StoreKitUIService may get suspended unexpectedly
4         https://bugs.webkit.org/show_bug.cgi?id=175922
5         <rdar://problem/34028921>
6
7         Reviewed by Tim Horton.
8
9         ViewServices started by StoreKitUIService may get suspended unexpectedly. This is
10         because StoreKitUIService is itself a ViewService and is therefore in the background.
11         To address the issue, treat StoreKitUIService as initially foreground in
12         ApplicationStateTracker so that its ViewServices do not get suspended. We don't
13         have good way to deal with ViewServices started by other ViewServices unfortunately.
14
15         * Platform/spi/ios/UIKitSPI.h:
16         * UIProcess/ApplicationStateTracker.mm:
17         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
18
19 2017-08-23  Youenn Fablet  <youenn@apple.com>
20
21         [Cache API] Unify WebCore and WebKit error handling
22         https://bugs.webkit.org/show_bug.cgi?id=175902
23
24         Reviewed by Alex Christensen.
25
26         Removing all callbacks and error definitions from WebKit
27         and reusing DOMCache ones instead.
28
29         * NetworkProcess/cache/CacheStorage.h: Removed.
30         * NetworkProcess/cache/CacheStorageEngine.cpp:
31         (WebKit::CacheStorage::Engine::caches const):
32         (WebKit::CacheStorage::Engine::queryCache):
33         * NetworkProcess/cache/CacheStorageEngine.h:
34         * NetworkProcess/cache/CacheStorageEngineCache.h:
35         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
36         (WebKit::CacheStorageEngineConnection::open):
37         (WebKit::CacheStorageEngineConnection::remove):
38         (WebKit::CacheStorageEngineConnection::putRecords):
39         * NetworkProcess/cache/CacheStorageEngineConnection.h:
40         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
41         * Shared/WebCoreArgumentCoders.cpp:
42         (IPC::ArgumentCoder<DOMCache::CacheInfo>::encode):
43         (IPC::ArgumentCoder<DOMCache::CacheInfo>::decode):
44         (IPC::ArgumentCoder<DOMCache::Record>::encode):
45         (IPC::ArgumentCoder<DOMCache::Record>::decode):
46         * Shared/WebCoreArgumentCoders.h:
47         * WebProcess/Cache/WebCacheStorageConnection.cpp:
48         (WebKit::WebCacheStorageConnection::doBatchPutOperation):
49         (WebKit::WebCacheStorageConnection::openCompleted):
50         (WebKit::WebCacheStorageConnection::removeCompleted):
51         (WebKit::WebCacheStorageConnection::updateCaches):
52         (WebKit::WebCacheStorageConnection::updateRecords):
53         (WebKit::WebCacheStorageConnection::deleteRecordsCompleted):
54         (WebKit::WebCacheStorageConnection::putRecordsCompleted):
55         * WebProcess/Cache/WebCacheStorageConnection.h:
56         * WebProcess/Cache/WebCacheStorageConnection.messages.in:
57
58 2017-08-23  Alex Christensen  <achristensen@webkit.org>
59
60         Clean up UIClients
61         https://bugs.webkit.org/show_bug.cgi?id=175906
62
63         Reviewed by Tim Horton.
64
65         There were some unnecessary checks to see if the client implements something,
66         when the default behavior is to do nothing if the client doesn't implement the callback.
67         Also, make some overrides finals and fix some spacing.
68
69         * UIProcess/API/APIUIClient.h:
70         (API::UIClient::didNotHandleKeyEvent):
71         (API::UIClient::implementsDidNotHandleKeyEvent const): Deleted.
72         (API::UIClient::implementsDidNotHandleWheelEvent const): Deleted.
73         * UIProcess/API/C/WKPage.cpp:
74         (WKPageSetPageUIClient):
75         * UIProcess/Cocoa/UIDelegate.h:
76         * UIProcess/WebPageProxy.cpp:
77         (WebKit::WebPageProxy::didReceiveEvent):
78
79 2017-08-23  Alex Christensen  <achristensen@webkit.org>
80
81         Add WKUIDelegatePrivate callbacks corresponding to WKPageUIClient's takeFocus, focus, and unfocus
82         https://bugs.webkit.org/show_bug.cgi?id=175896
83
84         Reviewed by Tim Horton.
85         
86         I also renamed _webViewShow to _showWebView based on feedback from https://bugs.webkit.org/show_bug.cgi?id=175797
87
88         Added an API test.
89
90         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
91         * UIProcess/Cocoa/UIDelegate.h:
92         * UIProcess/Cocoa/UIDelegate.mm:
93         (WebKit::UIDelegate::setDelegate):
94         (WebKit::toWKFocusDirection):
95         (WebKit::UIDelegate::UIClient::takeFocus):
96         (WebKit::UIDelegate::UIClient::focus):
97         (WebKit::UIDelegate::UIClient::unfocus):
98         (WebKit::UIDelegate::UIClient::showPage):
99
100 2017-08-23  Youenn Fablet  <youenn@apple.com>
101
102         [CacheAPI] Introduce a WebKit::CacheStorage namespace
103         https://bugs.webkit.org/show_bug.cgi?id=175885
104
105         Reviewed by Alex Christensen.
106
107         Introducing WebKit::CacheStorage namespace.
108         Splitting CacheStorageEngine.h in three files.
109         Updating client code accordingly.
110
111         * NetworkProcess/cache/CacheStorage.h: Added.
112         * NetworkProcess/cache/CacheStorageEngine.cpp:
113         (WebKit::CacheStorage::globalEngineMap):
114         (WebKit::CacheStorage::Engine::from):
115         (WebKit::CacheStorage::Engine::destroyEngine):
116         (WebKit::CacheStorage::Engine::defaultEngine):
117         (WebKit::CacheStorage::Engine::open):
118         (WebKit::CacheStorage::Engine::remove):
119         (WebKit::CacheStorage::Engine::retrieveCaches):
120         (WebKit::CacheStorage::Engine::retrieveRecords):
121         (WebKit::CacheStorage::Engine::putRecords):
122         (WebKit::CacheStorage::Engine::deleteMatchingRecords):
123         (WebKit::CacheStorage::Engine::writeCachesToDisk):
124         (WebKit::CacheStorage::Engine::readCachesFromDisk):
125         (WebKit::CacheStorage::Engine::readCache):
126         (WebKit::CacheStorage::Engine::writeCacheRecords):
127         (WebKit::CacheStorage::Engine::removeCacheRecords):
128         (WebKit::CacheStorage::Engine::cache):
129         (WebKit::CacheStorage::Engine::caches const):
130         (WebKit::CacheStorage::Engine::queryCache):
131         * NetworkProcess/cache/CacheStorageEngineCache.h: Added.
132         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
133         (WebKit::CacheStorageEngineConnection::open):
134         (WebKit::CacheStorageEngineConnection::remove):
135         (WebKit::CacheStorageEngineConnection::caches):
136         (WebKit::CacheStorageEngineConnection::records):
137         (WebKit::CacheStorageEngineConnection::deleteMatchingRecords):
138         (WebKit::CacheStorageEngineConnection::putRecords):
139         * WebKit.xcodeproj/project.pbxproj:
140         * WebProcess/Cache/WebCacheStorageConnection.cpp:
141         (WebKit::WebCacheStorageConnection::openCompleted):
142         (WebKit::WebCacheStorageConnection::removeCompleted):
143         (WebKit::WebCacheStorageConnection::updateCaches):
144         (WebKit::WebCacheStorageConnection::updateRecords):
145         (WebKit::WebCacheStorageConnection::deleteRecordsCompleted):
146         (WebKit::WebCacheStorageConnection::putRecordsCompleted):
147         * WebProcess/Cache/WebCacheStorageConnection.h:
148
149 2017-08-23  Youenn Fablet  <youenn@apple.com>
150
151         [Cache API] Enable persistent coder to encode FetchOptions
152         https://bugs.webkit.org/show_bug.cgi?id=175883
153
154         Reviewed by Alex Christensen.
155
156         Removing FetchOptions related ArgumentCoders specific code.
157
158         * Shared/WebCoreArgumentCoders.cpp:
159         * Shared/WebCoreArgumentCoders.h:
160
161 2017-08-23  Youenn Fablet  <youenn@apple.com>
162
163         CacheStorageEngine readCachesFromDisk callback should return the read Caches
164         https://bugs.webkit.org/show_bug.cgi?id=175882
165
166         Reviewed by Alex Christensen.
167
168         Callback of readCachesFromDisk takes now a Caches or error parameter.
169
170         * NetworkProcess/cache/CacheStorageEngine.cpp:
171         (WebKit::CacheStorageEngine::open):
172         (WebKit::CacheStorageEngine::retrieveCaches):
173         (WebKit::CacheStorageEngine::readCachesFromDisk):
174         * NetworkProcess/cache/CacheStorageEngine.h:
175
176 2017-08-23  Chris Dumez  <cdumez@apple.com>
177
178         Regression(r221059): NetworkDataTask::didReceiveResponse() should not use PolicyUse for HTTP/0.9
179         https://bugs.webkit.org/show_bug.cgi?id=175872
180
181         Reviewed by Daniel Bates.
182
183         r221059 was calling the ResponseCompletionHandler with {} which ended up being
184         PolicyUse. Since this is an error case and do not want to receive the data, it
185         makes more sense to use PolicyIgnore instead. There should not be a behavior
186         change on WebKit side though since we are cancelling the load right after
187         calling the completion handler anyway.
188
189         Tests under http/tests/security/http-0.9/ are still passing.
190
191         * NetworkProcess/NetworkDataTask.cpp:
192         (WebKit::NetworkDataTask::didReceiveResponse):
193
194 2017-08-22  Tim Horton  <timothy_horton@apple.com>
195
196         _WKThumbnailView should use the screen color space instead of sRGB
197         https://bugs.webkit.org/show_bug.cgi?id=175858
198         <rdar://problem/33925559>
199
200         Reviewed by Dean Jackson.
201
202         Currently, _WKThumbnailView uses software snapshotting via
203         WebPage's takeSnapshot and friends, which always use sRGB.
204         However, it is immediately presented in display space, which
205         causes an expensive color conversion, which could have been avoided
206         if the snapshot was instead originally taken in display space.
207
208         To solve this, add:
209
210         - a mechanism allowing ShareableBitmap to be constructed with a
211           configuration, which can include a color space as well as the
212           existing flags (flipping SupportsAlpha to be IsOpaque instead
213           because most callers want alpha)
214
215         - a WebImage constructor allowing callers to pass a ShareableBitmap
216           configuration through
217
218         - a bit in SnapshotOptions for callers to indicate that they
219           want to snapshot in the display's color space (repurposed
220           from the ExtendedColor bit)
221
222         And then make use of that bit in _WKThumbnailView.
223
224         * Shared/API/c/WKSharedAPICast.h:
225         (WebKit::snapshotOptionsFromImageOptions):
226         Remove this incorrect conversion (WKImageOptions doesn't include
227         kWKSnapshotOptionsExtendedColor).
228
229         (WebKit::toSnapshotOptions):
230         Plumb kWKSnapshotOptionsExtendedColor to WebKit::SnapshotOptions
231         as the "UseScreenColorSpace". Leave the SPI name intact because
232         it has clients, but the difference isn't so huge that it will be
233         a problem.
234
235         * Shared/ImageOptions.h:
236         (WebKit::snapshotOptionsToImageOptions):
237         Remove ImageOptionsExtendedColor, and rename
238         SnapshotOptionsExtendedColor to SnapshotOptionsUseScreenColorSpace.
239
240         * Shared/ShareableBitmap.cpp:
241         (WebKit::ShareableBitmap::Handle::Handle):
242         (WebKit::ShareableBitmap::Handle::encode const):
243         (WebKit::ShareableBitmap::Handle::decode):
244         (WebKit::ShareableBitmap::Handle::clear):
245         (WebKit::ShareableBitmap::Configuration::encode const):
246         (WebKit::ShareableBitmap::Configuration::decode):
247         (WebKit::ShareableBitmap::create):
248         (WebKit::ShareableBitmap::createShareable):
249         (WebKit::ShareableBitmap::createHandle const):
250         (WebKit::ShareableBitmap::ShareableBitmap):
251         (WebKit::ShareableBitmap::calculateBytesPerPixel):
252         (WebKit::calculateBytesPerPixel): Deleted.
253         * Shared/ShareableBitmap.h:
254         (WebKit::ShareableBitmap::numBytesForSize):
255         (WebKit::ShareableBitmap::sizeInBytes const):
256         * Shared/cg/ShareableBitmapCG.cpp:
257         (WebKit::colorSpace):
258         (WebKit::bitmapInfo):
259         (WebKit::ShareableBitmap::calculateBytesPerPixel):
260         (WebKit::ShareableBitmap::createGraphicsContext):
261         (WebKit::ShareableBitmap::createCGImage const):
262         Remove ShareableBitmap's flags parameter, and replace it with
263         a configuration parameter. Configuration is a struct that currently
264         encompasses the newly-flipped IsOpaque bit and (on Cocoa platforms)
265         a platform colorspace object. Compute bytesPerPixel dynamically
266         based on the colorspace and whether it uses extended colors or not.
267
268         * Shared/WebImage.cpp:
269         (WebKit::WebImage::create):
270         * Shared/WebImage.h:
271         Pass ShareableBitmap::Configuration through to the ShareableBitmap
272         constructor, if provided.
273
274         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
275         (-[_WKThumbnailView requestSnapshot]):
276         Make use of the new bit, and use the screen's color space.
277
278         * WebProcess/WebPage/WebPage.cpp:
279         (WebKit::snapshotOptionsToBitmapConfiguration):
280         (WebKit::WebPage::snapshotAtSize):
281         (WebKit::WebPage::snapshotNode):
282         If the snapshot option to use the display color space is set,
283         fill in the colorSpace field in the ShareableBitmap::Configuration
284         with the screen's color space.
285
286         (WebKit::WebPage::drawRectToImage):
287         * Shared/WebCoreArgumentCoders.cpp:
288         (IPC::encodeImage):
289         * Shared/ContextMenuContextData.cpp:
290         (WebKit::ContextMenuContextData::ContextMenuContextData):
291         * Shared/mac/RemoteLayerBackingStore.mm:
292         (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
293         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
294         (WebKit::InjectedBundleRangeHandle::renderedImage):
295         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
296         (WebKit::NetscapePlugin::snapshot):
297         * WebProcess/Plugins/PDF/PDFPlugin.mm:
298         (WebKit::PDFPlugin::snapshot):
299         * WebProcess/Plugins/PluginProxy.cpp:
300         (WebKit::PluginProxy::geometryDidChange):
301         (WebKit::PluginProxy::updateBackingStore):
302         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
303         (WebKit::convertImageToBitmap):
304         (WebKit::convertCGImageToBitmap):
305         * WebProcess/WebPage/WebFrame.cpp:
306         (WebKit::WebFrame::createSelectionSnapshot const):
307         * WebProcess/WebPage/ios/WebPageIOS.mm:
308         (WebKit::WebPage::getPositionInformation):
309         Adopt ShareableBitmap::Configuration. Since IsOpaque
310         defaults to false, all callers who previously constructed
311         ShareableBitmap with SupportsAlpha now don't have to do anything.
312
313 2017-08-20  Wenson Hsieh  <wenson_hsieh@apple.com>
314
315         [iOS WK2] WKWebView schedules nonstop layout after pressing cmb+b,i,u inside a contenteditable div
316         https://bugs.webkit.org/show_bug.cgi?id=175116
317         <rdar://problem/28279301>
318
319         Reviewed by Darin Adler and Ryosuke Niwa.
320
321         Refactors WebPage::editorState to only use the StyleProperties derived from EditingStyle, instead of inserting
322         and removing a temporary node to figure out the style. Also adds hooks to notify the UI delegate of EditorState
323         changes.
324
325         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
326         * UIProcess/API/Cocoa/WKWebView.mm:
327         (nsTextAlignment):
328         (dictionaryRepresentationForEditorState):
329         (-[WKWebView _didChangeEditorState]):
330
331         Alerts the private UI delegate of UI-side EditorState updates.
332
333         (-[WKWebView _web_editorStateDidChange]):
334         (-[WKWebView _executeEditCommand:argument:completion:]):
335         * UIProcess/API/Cocoa/WKWebViewInternal.h:
336         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
337         * UIProcess/API/mac/WKView.mm:
338         (-[WKView _web_editorStateDidChange]):
339         * UIProcess/Cocoa/WebViewImpl.h:
340         * UIProcess/Cocoa/WebViewImpl.mm:
341         (WebKit::WebViewImpl::selectionDidChange):
342         * UIProcess/WebPageProxy.cpp:
343         (WebKit::WebPageProxy::executeEditCommand):
344
345         Change executeEditCommand(name, callback) to executeEditCommand(name, argument, callback) and lift out of iOS
346         platform code and into WebPage.cpp.
347
348         * UIProcess/WebPageProxy.h:
349         * UIProcess/ios/WKContentViewInteraction.mm:
350         (-[WKContentView executeEditCommandWithCallback:]):
351         (-[WKContentView _selectionChanged]):
352         * UIProcess/ios/WebPageProxyIOS.mm:
353         (WebKit::WebPageProxy::executeEditCommand): Deleted.
354
355         Move the iOS-specific implementation of executeEditCommand that invokes a callback when the web process responds
356         out of WebPageProxyIOS, and into cross-platform WebPageProxy code. Additionally, add a parameter for the edit
357         command's argument.
358
359         * WebProcess/WebPage/WebPage.cpp:
360         (WebKit::WebPage::editorState const):
361
362         Use EditingStyle::styleAtSelectionStart instead of Editor::styleForSelectionStart when computing an EditorState.
363         Tweak bold, italic and underline to use EditingStyle TriStates.
364
365         (WebKit::WebPage::executeEditCommandWithCallback):
366         * WebProcess/WebPage/WebPage.h:
367         * WebProcess/WebPage/WebPage.messages.in:
368         * WebProcess/WebPage/ios/WebPageIOS.mm:
369         (WebKit::WebPage::executeEditCommandWithCallback): Deleted.
370
371 2017-08-22  Wenson Hsieh  <wenson_hsieh@apple.com>
372
373         [WK2] EditorState updates should be rolled into the layer update lifecycle when possible
374         https://bugs.webkit.org/show_bug.cgi?id=175370
375         <rdar://problem/33799806>
376
377         Reviewed by Ryosuke Niwa.
378
379         See per-method comments for more detail. WebPage::didChangeSelection now schedules EditorState updates to be sent
380         during the next layer tree transaction rather than sending them synchronously. To ensure that iOS and Mac continue
381         to behave correctly w.r.t. EditorState updates, we immediately dispatch EditorStates in the following cases:
382         - After the composition changes, is confirmed, or is canceled.
383         - After an edit command is executed.
384         - After ending user-triggered selection changes.
385
386         * Shared/mac/RemoteLayerTreeTransaction.h:
387         (WebKit::RemoteLayerTreeTransaction::hasEditorState const):
388         (WebKit::RemoteLayerTreeTransaction::editorState const):
389         (WebKit::RemoteLayerTreeTransaction::setEditorState):
390
391         Attaches an optional EditorState to the RemoteLayerTreeTransaction. This EditorState is computed and sent over
392         when setting up the transaction in WebPage, if something previously scheduled an EditorState update.
393
394         * Shared/mac/RemoteLayerTreeTransaction.mm:
395         (WebKit::RemoteLayerTreeTransaction::encode const):
396         (WebKit::RemoteLayerTreeTransaction::decode):
397
398         Add coder support for sending over a layer tree transaction's EditorState.
399
400         * UIProcess/API/Cocoa/WKViewPrivate.h:
401         * UIProcess/API/mac/WKView.mm:
402         (-[WKView _doAfterNextPresentationUpdate:]):
403
404         Add _doAfterNextPresentationUpdate to WKView (used in TestWebKitAPI -- refer to
405         WebKitAgnosticTest::waitForNextPresentationUpdate).
406
407         * UIProcess/DrawingAreaProxy.h:
408         (WebKit::DrawingAreaProxy::dispatchPresentationCallbacksAfterFlushingLayers):
409         * UIProcess/DrawingAreaProxy.messages.in:
410
411         Add a new IPC messages, DispatchPresentationCallbacksAfterFlushingLayers, to invoke in-flight presentation
412         callbacks in the UI process following a layer flush in the web process.
413
414         * UIProcess/WebPageProxy.h:
415         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
416         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
417         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
418         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
419         (WebKit::TiledCoreAnimationDrawingAreaProxy::~TiledCoreAnimationDrawingAreaProxy):
420         (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing):
421         (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchPresentationCallbacksAfterFlushingLayers):
422
423         Run all pending _doAfterNextPresentationUpdate callbacks.
424
425         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
426         (WebKit::WebEditorClient::didApplyStyle):
427         (WebKit::WebEditorClient::respondToChangedContents):
428         (WebKit::WebEditorClient::didEndUserTriggeredSelectionChanges):
429         (WebKit::WebEditorClient::didUpdateComposition):
430
431         Forward editor client calls to the WebPage.
432
433         (WebKit::WebEditorClient::didChangeSelectionAndUpdateLayout): Deleted.
434         * WebProcess/WebCoreSupport/WebEditorClient.h:
435         * WebProcess/WebPage/WebPage.cpp:
436         (WebKit::WebPage::editorState const):
437         (WebKit::WebPage::updateEditorStateAfterLayoutIfEditabilityChanged):
438         (WebKit::WebPage::willCommitLayerTree):
439         (WebKit::WebPage::didApplyStyle):
440
441         Allow style application to immediately trigger EditorState updates, if we're not currently ignoring selection
442         changes in the Editor.
443
444         (WebKit::WebPage::didChangeContents):
445
446         Allow applying top-level edit commands to immediately trigger EditorState updates, if we're not currently
447         ignoring selection changes in the Editor.
448
449         (WebKit::WebPage::didChangeSelection):
450         (WebKit::WebPage::didUpdateComposition):
451         (WebKit::WebPage::didEndUserTriggeredSelectionChanges):
452         (WebKit::WebPage::discardedComposition):
453         (WebKit::WebPage::canceledComposition):
454
455         When handling composition updates, always send an EditorState to the UI process. Unlike other cases, IME
456         requires immediate EditorState data, so we need to be explicit here in sending updates right away.
457
458         (WebKit::WebPage::sendEditorStateUpdate):
459         (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate):
460         (WebKit::WebPage::flushPendingEditorStateUpdate):
461
462         Helper methods to schedule an EditorState update to be sent upon the next layer tree update, or flush any
463         pending EditorState update that has been scheduled. The private, more aggressive variant of this is
464         sendEditorStateUpdate, which ignores whether or not there was already an EditorState update scheduled, and sends
465         one anyways (this still fulfills any EditorState update that was previously scheduled).
466
467         These helper methods are treated as no-ops when invoked while ignoring selection changes. This is to prevent
468         temporary selection state and editor commands during operations such as text indicator snapshotting from pushing
469         bogus information about transient editor states to the UI process.
470
471         (WebKit::WebPage::sendPostLayoutEditorStateIfNeeded): Deleted.
472         * WebProcess/WebPage/WebPage.h:
473         * WebProcess/WebPage/ios/WebPageIOS.mm:
474         (WebKit::WebPage::platformEditorState const):
475         (WebKit::WebPage::executeEditCommandWithCallback):
476         (WebKit::selectionIsInsideFixedPositionContainer):
477         (WebKit::WebPage::updateVisibleContentRects):
478
479         Fix a hack that was computing an EditorState to figure out whether the current selection starts or ends in a
480         fixed position container. Factors out relevant logic into a separate helper, and also schedules an EditorState
481         update instead of immediately computing it.
482
483         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
484         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
485         (WebKit::TiledCoreAnimationDrawingArea::addTransactionCallbackID):
486
487         Add support for registering and dispatching presentation callbacks that hook into the layer flush lifecycle,
488         using the tiled CA drawing area. These are used by Mac LayoutTests and API tests that need to wait until the
489         next flush before checking for state that depends on EditorState updates in the UI process.
490
491         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
492
493         Tell the WebPage to flush any pending EditorState updates.
494
495         * WebProcess/WebPage/mac/WebPageMac.mm:
496         (WebKit::WebPage::platformEditorState const):
497
498 2017-08-22  Brent Fulgham  <bfulgham@apple.com>
499
500         Relax keychain access to permit users to permanently allow client certificates
501         https://bugs.webkit.org/show_bug.cgi?id=175857
502         <rdar://problem/32293867>
503
504         Reviewed by Alex Christensen.
505
506         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
507         * WebProcess/com.apple.WebProcess.sb.in:
508
509 2017-08-22  Chris Dumez  <cdumez@apple.com>
510
511         Introduce a new CompletionHandler type and use it for NetworkDataTaskClient's completion handlers to help catch bugs
512         https://bugs.webkit.org/show_bug.cgi?id=175832
513
514         Reviewed by Alex Christensen.
515
516         Use new CompletionHandler type for NetworkDataTaskClient's completion handlers to help catch bugs.
517         It actually already found a bug in our HTTP 0.9 error handling which is fixed in this patch
518         as well.
519
520         * NetworkProcess/NetworkDataTask.cpp:
521         (WebKit::NetworkDataTask::didReceiveResponse):
522         * NetworkProcess/NetworkDataTask.h:
523         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
524         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
525         (WebKit::NetworkDataTaskCocoa::tryPasswordBasedAuthentication):
526         * Shared/Authentication/AuthenticationManager.cpp:
527         (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge):
528         * Shared/Authentication/AuthenticationManager.h:
529         * Shared/Authentication/mac/AuthenticationManager.mac.mm:
530         (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge):
531
532 2017-08-22  Alex Christensen  <achristensen@webkit.org>
533
534         Add UIDelegatePrivate SPI corresponding to WKPageUIClient.showPage
535         https://bugs.webkit.org/show_bug.cgi?id=175797
536         <rdar://problem/29270035>
537
538         Reviewed by Geoffrey Garen.
539
540         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
541         * UIProcess/Cocoa/UIDelegate.h:
542         * UIProcess/Cocoa/UIDelegate.mm:
543         (WebKit::UIDelegate::setDelegate):
544         (WebKit::UIDelegate::UIClient::showPage):
545         * WebProcess/WebPage/WebPage.cpp:
546         (WebKit::WebPage::registerURLSchemeHandler):
547         window.open, createWebViewWithConfiguration, and WKURLSchemeHandlers all used together
548         make it so that URLSchemeHandlers are added to WebPages that already have them.  The
549         assertions are no longer valid.
550
551 2017-08-22  Matt Lewis  <jlewis3@apple.com>
552
553         Unreviewed, rolling out r221026.
554
555         This caused a consistent API failure on iOS Simulator.
556
557         Reverted changeset:
558
559         "Add UIDelegatePrivate SPI corresponding to
560         WKPageUIClient.showPage"
561         https://bugs.webkit.org/show_bug.cgi?id=175797
562         http://trac.webkit.org/changeset/221026
563
564 2017-08-22  Ryan Haddad  <ryanhaddad@apple.com>
565
566         Unreviewed, rolling out r221027.
567
568         This change caused LayoutTests to exit early with assertion
569         failures.
570
571         Reverted changeset:
572
573         "Add sanity check for source origin in
574         WebLoaderStrategy::startPingLoad()"
575         https://bugs.webkit.org/show_bug.cgi?id=175827
576         http://trac.webkit.org/changeset/221027
577
578 2017-08-22  Chris Dumez  <cdumez@apple.com>
579
580         [WK2] Enable Beacon API by default
581         https://bugs.webkit.org/show_bug.cgi?id=175839
582
583         Reviewed by Youenn Fablet.
584
585         * Shared/WebPreferencesDefinitions.h:
586
587 2017-08-22  Tim Horton  <timothy_horton@apple.com>
588
589         REGRESSION (High Sierra): PDFPlugin won't render PostScript Files
590         https://bugs.webkit.org/show_bug.cgi?id=175840
591         <rdar://problem/33877923>
592
593         Reviewed by Brent Fulgham.
594
595         * WebProcess/com.apple.WebProcess.sb.in:
596         Add a sandbox exception for the PostScript conversion process.
597
598 2017-08-22  Chris Dumez  <cdumez@apple.com>
599
600         Clean up PingLoad::processContentExtensionRulesForLoad()
601         https://bugs.webkit.org/show_bug.cgi?id=175834
602
603         Reviewed by Alex Christensen.
604
605         * NetworkProcess/PingLoad.cpp:
606         (WebKit::PingLoad::willPerformHTTPRedirection):
607         (WebKit::PingLoad::processContentExtensionRulesForLoad):
608         * NetworkProcess/PingLoad.h:
609
610 2017-08-22  Alex Christensen  <achristensen@webkit.org>
611
612         Remove ChromeClient::scrollbarsModeDidChange
613         https://bugs.webkit.org/show_bug.cgi?id=175805
614
615         Reviewed by Daniel Bates.
616
617         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
618         (WebKit::WebChromeClient::scrollbarsModeDidChange const): Deleted.
619         * WebProcess/WebCoreSupport/WebChromeClient.h:
620
621 2017-08-22  Chris Dumez  <cdumez@apple.com>
622
623         Add sanity check for source origin in WebLoaderStrategy::startPingLoad()
624         https://bugs.webkit.org/show_bug.cgi?id=175827
625
626         Reviewed by Geoffrey Garen.
627
628         * WebProcess/Network/WebLoaderStrategy.cpp:
629         (WebKit::WebLoaderStrategy::startPingLoad):
630
631 2017-08-22  Alex Christensen  <achristensen@webkit.org>
632
633         Add UIDelegatePrivate SPI corresponding to WKPageUIClient.showPage
634         https://bugs.webkit.org/show_bug.cgi?id=175797
635         <rdar://problem/29270035>
636
637         Reviewed by Geoffrey Garen.
638
639         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
640         * UIProcess/Cocoa/UIDelegate.h:
641         * UIProcess/Cocoa/UIDelegate.mm:
642         (WebKit::UIDelegate::setDelegate):
643         (WebKit::UIDelegate::UIClient::showPage):
644         * WebProcess/WebPage/WebPage.cpp:
645         (WebKit::WebPage::registerURLSchemeHandler):
646         window.open, createWebViewWithConfiguration, and WKURLSchemeHandlers all used together
647         make it so that URLSchemeHandlers are added to WebPages that already have them.  The
648         assertions are no longer valid.
649
650 2017-08-22  Youenn Fablet  <youenn@apple.com>
651
652         [Cache API] Add support for overwriting responses with put on an existing record
653         https://bugs.webkit.org/show_bug.cgi?id=175825
654
655         Reviewed by Geoffrey Garen.
656
657         Add support for encoding/decoding the update counter.
658         Incrementing it when overwriting an existing response.
659         Storing the new body in addition to the new response.
660
661         * NetworkProcess/cache/CacheStorageEngine.cpp:
662         (WebKit::CacheStorageEngine::putRecords):
663         * Shared/WebCoreArgumentCoders.cpp:
664         (IPC::ArgumentCoder<CacheStorageConnection::Record>::encode):
665         (IPC::ArgumentCoder<CacheStorageConnection::Record>::decode):
666
667 2017-08-22  Alex Christensen  <achristensen@webkit.org>
668
669         Remove ChromeClient::hasOpenedPopup
670         https://bugs.webkit.org/show_bug.cgi?id=175804
671
672         Reviewed by Sam Weinig.
673
674         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
675         (WebKit::WebChromeClient::hasOpenedPopup const): Deleted.
676         * WebProcess/WebCoreSupport/WebChromeClient.h:
677
678 2017-08-22  Brent Fulgham  <bfulgham@apple.com> and Pranjal Jumde  <pjumde@apple.com>
679
680         Disable access to secure cookies if an HTTPS site loads mixed content
681         https://bugs.webkit.org/show_bug.cgi?id=157053
682         <rdar://problem/11290808>
683
684         Reviewed by Dan Bates.
685
686         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
687         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM): Pass new arguments needed by WebCore.
688         * NetworkProcess/NetworkConnectionToWebProcess.h:
689         * NetworkProcess/NetworkConnectionToWebProcess.messages.in: Updated the CookiesForDOM message with the new foundMixedContent
690         argument and the new didAccessSecureCookies reply.
691         * Shared/mac/CookieStorageShim.mm:
692         (WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL): Drive-by fix to use the right message.
693         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
694         (WebKit::WebPlatformStrategies::cookiesForDOM): Check and return whether secure cookies were accessed. Accept a new argument
695         indicating whether secure cookies should be included in the response.
696         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
697
698 2017-08-22  Zan Dobersek  <zdobersek@igalia.com>
699
700         [GTK][WPE] Rename StorageProcessMainGtk.cpp to StorageProcessMainGLib.cpp
701         https://bugs.webkit.org/show_bug.cgi?id=175814
702
703         Reviewed by Gyuyoung Kim.
704
705         Both GTK+ and WPE ports already compile the StorageProcessMainGtk.cpp
706         file, but it should be renamed to StorageProcessMainGLib and moved into
707         the StorageProcess/glib/ directory.
708
709         * PlatformGTK.cmake:
710         * PlatformWPE.cmake:
711         * StorageProcess/glib/StorageProcessMainGLib.cpp: Renamed from Source/WebKit/StorageProcess/gtk/StorageProcessMainGtk.cpp.
712
713 2017-08-21  Zan Dobersek  <zdobersek@igalia.com>
714
715         [WK] Add missing ENABLE(NETWORK_CACHE) build guards
716         https://bugs.webkit.org/show_bug.cgi?id=175769
717
718         Reviewed by Carlos Alberto Lopez Perez.
719
720         Given that the build guard exists, it should be possible to
721         compile the WebKit layer with the feature disabled. Missing
722         guards are added in order to achieve that.
723
724         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
725         * NetworkProcess/NetworkConnectionToWebProcess.h:
726         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
727         * NetworkProcess/NetworkProcess.h:
728         * NetworkProcess/NetworkResourceLoader.cpp:
729         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
730         * NetworkProcess/soup/NetworkProcessSoup.cpp:
731         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
732         (WebKit::NetworkProcess::clearDiskCache):
733         * UIProcess/soup/WebProcessPoolSoup.cpp:
734         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
735         * WebProcess/Network/WebLoaderStrategy.cpp:
736         (WebKit::WebLoaderStrategy::storeDerivedDataToCache):
737
738 2017-08-21  Chris Dumez  <cdumez@apple.com>
739
740         [Beacon] Content extensions should be able to intercept Beacon / Ping redirects
741         https://bugs.webkit.org/show_bug.cgi?id=175746
742         <rdar://problem/33946050>
743
744         Reviewed by Alex Christensen.
745
746         Update PingLoad to process content extension rules upon redirect. This allows content
747         extensions to block and upgrade to HTTPS beacon / ping loads.
748
749         Because ping loads can outlive the WebProcess, the content extensions rules are passed
750         to the NetworkProcess when starting the Ping load. The PingLoad can then consult those
751         rules upon redirect, on the NetworkProcess side.
752
753         * NetworkProcess/NetworkResourceLoadParameters.cpp:
754         (WebKit::NetworkResourceLoadParameters::encode const):
755         (WebKit::NetworkResourceLoadParameters::decode):
756         * NetworkProcess/NetworkResourceLoadParameters.h:
757         * NetworkProcess/PingLoad.cpp:
758         (WebKit::PingLoad::willPerformHTTPRedirection):
759         (WebKit::PingLoad::contentExtensionsBackend):
760         (WebKit::PingLoad::processContentExtensionRulesForLoad):
761         * NetworkProcess/PingLoad.h:
762         * WebProcess/Network/WebLoaderStrategy.cpp:
763         (WebKit::WebLoaderStrategy::startPingLoad):
764
765 2017-08-21  Adrian Perez de Castro  <aperez@igalia.com>
766
767         [WPE][GTK] Unused variables in UserMediaProcessManager.cpp
768         https://bugs.webkit.org/show_bug.cgi?id=175799
769
770         Reviewed by Alex Christensen.
771
772         The code which uses the "audioExtensionPath" and "videoExtensionPath" variables is guarded
773         with "#if ENABLE(SANDBOX_EXTENSIONS)”, so do the same for the variables themselves.
774
775         * UIProcess/UserMediaProcessManager.cpp: Add missing guards.
776
777 2017-08-21  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
778
779         [PAL] Move spi/mac directory into PAL
780         https://bugs.webkit.org/show_bug.cgi?id=175649
781
782         Reviewed by Myles C. Maxfield.
783
784         * Platform/mac/MenuUtilities.mm:
785         * Shared/mac/WebCoreArgumentCodersMac.mm:
786         * Shared/mac/WebEventFactory.mm:
787         * Shared/mac/WebHitTestResultData.mm:
788         * UIProcess/API/Cocoa/WKWebView.mm:
789         * UIProcess/Cocoa/WebViewImpl.mm:
790         * UIProcess/mac/ServicesController.mm:
791         * UIProcess/mac/TextCheckerMac.mm:
792         * UIProcess/mac/ViewGestureControllerMac.mm:
793         * UIProcess/mac/WKImmediateActionController.h:
794         * UIProcess/mac/WKImmediateActionController.mm:
795         * UIProcess/mac/WKSharingServicePickerDelegate.mm:
796         * UIProcess/mac/WKTextFinderClient.mm:
797         * UIProcess/mac/WebContextMenuProxyMac.mm:
798         * UIProcess/mac/WebPageProxyMac.mm:
799         * WebProcess/cocoa/WebProcessCocoa.mm:
800
801 2017-08-21  Brady Eidson  <beidson@apple.com>
802
803         Split the one SWServer::Connection into SWClientConnection and SWServer::Connection.
804         https://bugs.webkit.org/show_bug.cgi?id=175745
805
806         Reviewed by Andy Estes.
807
808         * CMakeLists.txt:
809         * DerivedSources.make:
810         * WebKit.xcodeproj/project.pbxproj:
811
812         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp: Renamed from Source/WebKit/WebProcess/Storage/WebSWServerConnection.cpp.
813         (WebKit::WebSWServerConnection::WebSWServerConnection):
814         (WebKit::WebSWServerConnection::~WebSWServerConnection):
815         (WebKit::WebSWServerConnection::disconnectedFromWebProcess):
816         (WebKit::WebSWServerConnection::rejectJobInClient):
817         * StorageProcess/ServiceWorker/WebSWServerConnection.h: Copied from Source/WebKit/WebProcess/Storage/WebSWServerConnection.h.
818         (WebKit::WebSWServerConnection::identifier const):
819         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in: Copied from Source/WebKit/WebProcess/Storage/WebSWServerConnection.messages.in.
820
821         * StorageProcess/StorageToWebProcessConnection.cpp:
822         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
823         (WebKit::StorageToWebProcessConnection::didClose):
824         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
825         (WebKit::StorageToWebProcessConnection::removeSWServerConnection):
826         * StorageProcess/StorageToWebProcessConnection.h:
827
828         * WebProcess/Storage/WebSWClientConnection.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp.
829         (WebKit::WebSWClientConnection::WebSWClientConnection):
830         (WebKit::WebSWClientConnection::~WebSWClientConnection):
831         (WebKit::WebSWClientConnection::scheduleJobInServer):
832         * WebProcess/Storage/WebSWClientConnection.h: Renamed from Source/WebKit/WebProcess/Storage/WebSWServerConnection.h.
833         (WebKit::WebSWClientConnection::identifier const):
834         * WebProcess/Storage/WebSWClientConnection.messages.in: Renamed from Source/WebKit/WebProcess/Storage/WebSWServerConnection.messages.in.
835
836         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
837         (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
838         * WebProcess/Storage/WebServiceWorkerProvider.h:
839
840         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
841         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
842         (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession):
843         * WebProcess/Storage/WebToStorageProcessConnection.h:
844
845 2017-08-21  Charlie Turner  <cturner@igalia.com>
846
847         MemoryCache::setCapacities assertion failure maxDeadBytes <= totalBytes
848         https://bugs.webkit.org/show_bug.cgi?id=175571
849
850         Reviewed by Antti Koivisto.
851
852         * Shared/CacheModel.cpp:
853         (WebKit::calculateMemoryCacheSizes): Ensure cacheTotalCapacity is
854         set to a reasonable value even in low-memory environments.
855
856 2017-08-20  Chris Dumez  <cdumez@apple.com>
857
858         Simplify calls to LoaderStrategy::startPingLoad()
859         https://bugs.webkit.org/show_bug.cgi?id=175756
860
861         Reviewed by Sam Weinig.
862
863         * WebProcess/Network/WebLoaderStrategy.cpp:
864         (WebKit::WebLoaderStrategy::startPingLoad):
865         * WebProcess/Network/WebLoaderStrategy.h:
866
867 2017-08-18  Chris Dumez  <cdumez@apple.com>
868
869         [Beacon] Improve error reporting
870         https://bugs.webkit.org/show_bug.cgi?id=175723
871
872         Reviewed by Darin Adler.
873
874         Have Ping loads such as beacons report errors via their completion handler.
875         The Beacon API is using this error to log a console message when beacon loads
876         fail, provided that the page is still alive.
877
878         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
879         (WebKit::NetworkConnectionToWebProcess::loadPing):
880         (WebKit::NetworkConnectionToWebProcess::didFinishPingLoad):
881         * NetworkProcess/NetworkConnectionToWebProcess.h:
882         * NetworkProcess/PingLoad.cpp:
883         (WebKit::PingLoad::~PingLoad):
884         (WebKit::PingLoad::didFinish):
885         (WebKit::PingLoad::willPerformHTTPRedirection):
886         (WebKit::PingLoad::didReceiveChallenge):
887         (WebKit::PingLoad::didReceiveResponseNetworkSession):
888         (WebKit::PingLoad::didCompleteWithError):
889         (WebKit::PingLoad::wasBlocked):
890         (WebKit::PingLoad::cannotShowURL):
891         (WebKit::PingLoad::timeoutTimerFired):
892         (WebKit::PingLoad::currentRequest const):
893         (WebKit::PingLoad::makeCrossOriginAccessRequestWithPreflight):
894         * NetworkProcess/PingLoad.h:
895         * WebProcess/Network/NetworkProcessConnection.cpp:
896         (WebKit::NetworkProcessConnection::didFinishPingLoad):
897         * WebProcess/Network/NetworkProcessConnection.h:
898         * WebProcess/Network/NetworkProcessConnection.messages.in:
899         * WebProcess/Network/WebLoaderStrategy.cpp:
900         (WebKit::WebLoaderStrategy::networkProcessCrashed):
901         (WebKit::WebLoaderStrategy::startPingLoad):
902         (WebKit::WebLoaderStrategy::didFinishPingLoad):
903         * WebProcess/Network/WebLoaderStrategy.h:
904
905 2017-08-18  Chris Dumez  <cdumez@apple.com>
906
907         REGRESSION (r220601): Crash when closing google doc after switching the order of tabs in safari
908         https://bugs.webkit.org/show_bug.cgi?id=175721
909         <rdar://problem/33928369>
910
911         Reviewed by Geoffrey Garen.
912
913         Make sure WebProcess::markAllLayersVolatile() does not call WTFMove() multiple times
914         on the same completion handler. Use a RefCounter to hold on to the completion handler
915         and make sure the handler gets called when the RefCounter's value becomes 0.
916
917         * WebProcess/WebProcess.cpp:
918         (WebKit::WebProcess::cancelPrepareToSuspend):
919         (WebKit::WebProcess::markAllLayersVolatile):
920         (WebKit::WebProcess::cancelMarkAllLayersVolatile):
921         * WebProcess/WebProcess.h:
922
923 2017-08-18  Youenn Fablet  <youenn@apple.com>
924
925         [Cache API] Add response body storage
926         https://bugs.webkit.org/show_bug.cgi?id=175658
927
928         Reviewed by Alex Christensen.
929
930         Added IPC serialization of Record response body.
931         Updated CacheStorageEngine implementation as Record has no longer a copy constructor.
932
933         * NetworkProcess/cache/CacheStorageEngine.cpp:
934         (WebKit::CacheStorageEngine::retrieveRecords):
935         (WebKit::CacheStorageEngine::deleteMatchingRecords):
936         * Shared/WebCoreArgumentCoders.cpp:
937         (IPC::encodeSharedBuffer):
938         (IPC::decodeSharedBuffer):
939         (IPC::ArgumentCoder<CacheStorageConnection::Record>::encode):
940         (IPC::ArgumentCoder<CacheStorageConnection::Record>::decode):
941
942 2017-08-18  Brady Eidson  <beidson@apple.com>
943
944         Bounce ServiceWorker jobs to the Storage Process.
945         https://bugs.webkit.org/show_bug.cgi?id=175650
946
947         Reviewed by Andy Estes.
948
949         * CMakeLists.txt:
950         * DerivedSources.make:
951         * WebKit.xcodeproj/project.pbxproj:
952
953         * Platform/Logging.h:
954
955         * StorageProcess/StorageToWebProcessConnection.cpp:
956         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
957         (WebKit::StorageToWebProcessConnection::didClose):
958         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
959         (WebKit::StorageToWebProcessConnection::removeSWServerConnection):
960         (WebKit::StorageToWebProcessConnection::establishIDBConnectionToServer):
961         * StorageProcess/StorageToWebProcessConnection.h:
962         * StorageProcess/StorageToWebProcessConnection.messages.in:
963
964         * WebProcess/Storage/WebSWServerConnection.cpp: Added.
965         (WebKit::WebSWServerConnection::WebSWServerConnection):
966         (WebKit::WebSWServerConnection::~WebSWServerConnection):
967         (WebKit::WebSWServerConnection::disconnectedFromWebProcess):
968         (WebKit::WebSWServerConnection::scheduleJob):
969         (WebKit::WebSWServerConnection::scheduleStorageJob):
970         * WebProcess/Storage/WebSWServerConnection.h: Copied from Source/WebCore/workers/service/ServiceWorkerJob.h.
971         (WebKit::WebSWServerConnection::create):
972         (WebKit::WebSWServerConnection::identifier const):
973         * WebProcess/Storage/WebSWServerConnection.messages.in: Copied from Source/WebKit/StorageProcess/StorageToWebProcessConnection.messages.in.
974
975         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
976         (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
977         (WebKit::WebServiceWorkerProvider::scheduleJob): Deleted.
978         * WebProcess/Storage/WebServiceWorkerProvider.h:
979
980         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
981         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
982         (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession):
983         * WebProcess/Storage/WebToStorageProcessConnection.h:
984
985 2017-08-18  Chris Dumez  <cdumez@apple.com>
986
987         [Beacon] Add support for quota limitation
988         https://bugs.webkit.org/show_bug.cgi?id=175443
989         <rdar://problem/33729002>
990
991         Reviewed by Youenn Fablet.
992
993         WebLoaderStrategy now generates an identifier for ping loads and keep
994         the completion handler in a local HashMap. Once the ping load is done,
995         the network process sends an IPC message back to the WebContent process
996         so that WebLoaderStrategy can look up the completion handler for the
997         ping load and call it.
998
999         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1000         (WebKit::NetworkConnectionToWebProcess::loadPing):
1001         (WebKit::NetworkConnectionToWebProcess::didFinishPingLoad):
1002         * NetworkProcess/NetworkConnectionToWebProcess.h:
1003         * NetworkProcess/PingLoad.cpp:
1004         (WebKit::PingLoad::PingLoad):
1005         (WebKit::PingLoad::~PingLoad):
1006         * NetworkProcess/PingLoad.h:
1007         * WebProcess/Network/NetworkProcessConnection.cpp:
1008         (WebKit::NetworkProcessConnection::didFinishPingLoad):
1009         * WebProcess/Network/NetworkProcessConnection.h:
1010         * WebProcess/Network/NetworkProcessConnection.messages.in:
1011         * WebProcess/Network/WebLoaderStrategy.cpp:
1012         (WebKit::generatePingLoadIdentifier):
1013         (WebKit::WebLoaderStrategy::startPingLoad):
1014         (WebKit::WebLoaderStrategy::didFinishPingLoad):
1015         * WebProcess/Network/WebLoaderStrategy.h:
1016
1017 2017-08-18  Youenn Fablet  <youenn@apple.com>
1018
1019         [Cache API] Add a WK2 implementation of CacheStorageConnection
1020         https://bugs.webkit.org/show_bug.cgi?id=175640
1021
1022         Reviewed by Alex Christensen & Chris Dumez.
1023
1024         Adding WebCacheStorageConnection as an implementation of CacheStorageConnection.
1025         Making WebCacheStorageProvider instantiates such class.
1026         One WebCacheStorageConnection is created for each session of a given WebProcess.
1027
1028         WebCacheStorageConnection is sending IPC calls to the network process.
1029         Main implementation of the cache API is done in the network process by CacheStorageEngineConnection and CacheStorageEngine.
1030         There is one WebCacheStorageConnection per session.
1031         WebCacheStorageConnection is passing the session ID for each call to the network process to ensure the right cache storage engine is used.
1032
1033         CacheStorageEngineConnection mirrors WebCacheStorageConnection on the network process.
1034         There is one CacheStorageEngine per session and CacheStorageEngineConnection will select the right CacheStorageEngine using the given session ID.
1035
1036         CacheStorageEngine is responsible of storing and matching cache API records.
1037         Current implementation only keeps in memory the cached objects.
1038
1039         CacheStorageEngine is keeping (for each different origin) caches and records as a Vector as the order of insertion is important as per spec.
1040         It also keeps a list of removed caches. These caches should remain functional until the last web page having access to these is gone.
1041         The mechanism to fully remove these caches is not implemented yet.
1042
1043         Adding IPC encodings for WTF::Expected, CacheQueryOptions, FetchOptions, CacheStorageConnection Record and CacheInfo.
1044
1045         * CMakeLists.txt:
1046         * DerivedSources.make:
1047         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1048         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1049         (WebKit::generateCacheStorageConnectionIdentifier):
1050         (WebKit::NetworkConnectionToWebProcess::createCacheStorageConnection):
1051         (WebKit::NetworkConnectionToWebProcess::closeCacheStorageConnection):
1052         * NetworkProcess/NetworkConnectionToWebProcess.h:
1053         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1054         * NetworkProcess/cache/CacheStorageEngine.cpp: Added.
1055         (WebKit::defaultCacheStorageEngine):
1056         (WebKit::globalEngineMap):
1057         (WebKit::CacheStorageEngine::from):
1058         (WebKit::CacheStorageEngine::destroyEngine):
1059         (WebKit::CacheStorageEngine::defaultEngine):
1060         (WebKit::CacheStorageEngine::open):
1061         (WebKit::CacheStorageEngine::remove):
1062         (WebKit::CacheStorageEngine::retrieveCaches):
1063         (WebKit::CacheStorageEngine::retrieveRecords):
1064         (WebKit::CacheStorageEngine::putRecords):
1065         (WebKit::CacheStorageEngine::deleteMatchingRecords):
1066         (WebKit::CacheStorageEngine::writeCachesToDisk):
1067         (WebKit::CacheStorageEngine::readCachesFromDisk):
1068         (WebKit::CacheStorageEngine::readCache):
1069         (WebKit::CacheStorageEngine::writeCacheRecords):
1070         (WebKit::CacheStorageEngine::removeCacheRecords):
1071         (WebKit::CacheStorageEngine::cache):
1072         (WebKit::CacheStorageEngine::caches const):
1073         (WebKit::CacheStorageEngine::records):
1074         (WebKit::CacheStorageEngine::queryCache):
1075         * NetworkProcess/cache/CacheStorageEngine.h: Added.
1076         * NetworkProcess/cache/CacheStorageEngineConnection.cpp: Added.
1077         (WebKit::CacheStorageEngineConnection::CacheStorageEngineConnection):
1078         (WebKit::CacheStorageEngineConnection::open):
1079         (WebKit::CacheStorageEngineConnection::remove):
1080         (WebKit::CacheStorageEngineConnection::caches):
1081         (WebKit::CacheStorageEngineConnection::records):
1082         (WebKit::CacheStorageEngineConnection::deleteMatchingRecords):
1083         (WebKit::CacheStorageEngineConnection::putRecords):
1084         * NetworkProcess/cache/CacheStorageEngineConnection.h: Added.
1085         (WebKit::CacheStorageEngineConnection::create):
1086         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in: Added.
1087         * Platform/IPC/ArgumentCoders.h:
1088         * Shared/WebCoreArgumentCoders.cpp:
1089         (IPC::ArgumentCoder<CacheQueryOptions>::encode):
1090         (IPC::ArgumentCoder<CacheQueryOptions>::decode):
1091         (IPC::ArgumentCoder<FetchOptions>::encode):
1092         (IPC::ArgumentCoder<FetchOptions>::decode):
1093         (IPC::ArgumentCoder<CacheStorageConnection::CacheInfo>::encode):
1094         (IPC::ArgumentCoder<CacheStorageConnection::CacheInfo>::decode):
1095         (IPC::ArgumentCoder<CacheStorageConnection::Record>::encode):
1096         (IPC::ArgumentCoder<CacheStorageConnection::Record>::decode):
1097         * Shared/WebCoreArgumentCoders.h:
1098         * WebKit.xcodeproj/project.pbxproj:
1099         * WebProcess/Cache/WebCacheStorageConnection.cpp: Added.
1100         (WebKit::WebCacheStorageConnection::WebCacheStorageConnection):
1101         (WebKit::WebCacheStorageConnection::~WebCacheStorageConnection):
1102         (WebKit::WebCacheStorageConnection::messageSenderConnection):
1103         (WebKit::WebCacheStorageConnection::doOpen):
1104         (WebKit::WebCacheStorageConnection::doRemove):
1105         (WebKit::WebCacheStorageConnection::doRetrieveCaches):
1106         (WebKit::WebCacheStorageConnection::doRetrieveRecords):
1107         (WebKit::WebCacheStorageConnection::doBatchDeleteOperation):
1108         (WebKit::WebCacheStorageConnection::doBatchPutOperation):
1109         (WebKit::WebCacheStorageConnection::openCompleted):
1110         (WebKit::WebCacheStorageConnection::removeCompleted):
1111         (WebKit::WebCacheStorageConnection::updateCaches):
1112         (WebKit::WebCacheStorageConnection::updateRecords):
1113         (WebKit::WebCacheStorageConnection::deleteRecordsCompleted):
1114         (WebKit::WebCacheStorageConnection::putRecordsCompleted):
1115         * WebProcess/Cache/WebCacheStorageConnection.h: Added.
1116         * WebProcess/Cache/WebCacheStorageConnection.messages.in: Added.
1117         * WebProcess/Cache/WebCacheStorageProvider.cpp: Copied from Source/WebKit/WebProcess/Cache/WebCacheStorageProvider.h.
1118         (WebKit::WebCacheStorageProvider::createCacheStorageConnection):
1119         * WebProcess/Cache/WebCacheStorageProvider.h:
1120         * WebProcess/Network/NetworkProcessConnection.cpp:
1121         (WebKit::NetworkProcessConnection::didReceiveMessage):
1122
1123 2017-08-18  Commit Queue  <commit-queue@webkit.org>
1124
1125         Unreviewed, rolling out r220854.
1126         https://bugs.webkit.org/show_bug.cgi?id=175716
1127
1128         I'm not sure we really need this (Requested by KaL on
1129         #webkit).
1130
1131         Reverted changeset:
1132
1133         "[GTK][WPE] Add NTLM authentication enabled API"
1134         https://bugs.webkit.org/show_bug.cgi?id=122952
1135         http://trac.webkit.org/changeset/220854
1136
1137 2017-08-15  Megan Gardner  <megan_gardner@apple.com>
1138
1139         Update to changeSelectionWithTouchAt:baseIsStart:withFlags:
1140         https://bugs.webkit.org/show_bug.cgi?id=175615
1141
1142         Update calls to use the flag versions, as they are used for passing state.
1143         Leave old calls, but set them up to be removed next cycle.
1144
1145         Reviewed by Tim Horton.
1146
1147         * Platform/spi/ios/UIKitSPI.h:
1148         * UIProcess/ios/WKContentViewInteraction.mm:
1149         (selectionChangedWithTouch):
1150         (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:]):
1151         (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:withFlags:]):
1152         (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]):
1153         (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:withFlags:]):
1154
1155 2017-08-17  Chris Dumez  <cdumez@apple.com>
1156
1157         Regression(r220817): We should only copy the original request headers for Ping loads
1158         https://bugs.webkit.org/show_bug.cgi?id=175679
1159
1160         Reviewed by Youenn Fablet.
1161
1162         For performance reason, we should only copy the original request headers for Ping loads
1163         (Beacon at the moment), not for all CachedResourceRequests.
1164
1165         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1166         (WebKit::NetworkConnectionToWebProcess::loadPing):
1167         * NetworkProcess/NetworkConnectionToWebProcess.h:
1168         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1169         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1170         (WebKit::NetworkResourceLoadParameters::encode const):
1171         (WebKit::NetworkResourceLoadParameters::decode):
1172         * NetworkProcess/NetworkResourceLoadParameters.h:
1173         * NetworkProcess/PingLoad.cpp:
1174         (WebKit::PingLoad::PingLoad):
1175         (WebKit::PingLoad::willPerformHTTPRedirection):
1176         (WebKit::PingLoad::makeCrossOriginAccessRequest):
1177         (WebKit::PingLoad::makeSimpleCrossOriginAccessRequest):
1178         (WebKit::PingLoad::originalRequestHeaders const): Deleted.
1179         * NetworkProcess/PingLoad.h:
1180         * WebProcess/Network/WebLoaderStrategy.cpp:
1181         (WebKit::WebLoaderStrategy::createPingHandle):
1182         * WebProcess/Network/WebLoaderStrategy.h:
1183
1184 2017-08-17  Don Olmstead  <don.olmstead@sony.com>
1185
1186         [PAL] Relocate SessionID to root
1187         https://bugs.webkit.org/show_bug.cgi?id=175684
1188
1189         Reviewed by Alex Christensen.
1190
1191         * NetworkProcess/Downloads/Download.h:
1192         * NetworkProcess/Downloads/DownloadManager.cpp:
1193         * NetworkProcess/NetworkCORSPreflightChecker.h:
1194         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1195         * NetworkProcess/NetworkLoad.cpp:
1196         * NetworkProcess/NetworkLoadParameters.h:
1197         * NetworkProcess/NetworkProcess.cpp:
1198         * NetworkProcess/NetworkProcess.h:
1199         * NetworkProcess/NetworkResourceLoadParameters.h:
1200         * NetworkProcess/NetworkSession.h:
1201         * NetworkProcess/NetworkSocketStream.h:
1202         * NetworkProcess/RemoteNetworkingContext.h:
1203         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1204         * Scripts/webkit/messages.py:
1205         (forward_declarations_and_headers.templates): Deleted.
1206         (class_template_headers.template): Deleted.
1207         * Shared/ChildProcess.cpp:
1208         * Shared/SessionTracker.h:
1209         * Shared/Storage/StorageProcessCreationParameters.h:
1210         * Shared/WebCoreArgumentCoders.cpp:
1211         * Shared/WebPageCreationParameters.h:
1212         * Shared/WebProcessCreationParameters.h:
1213         * Shared/WebsiteDataStoreParameters.h:
1214         * Shared/mac/CookieStorageShim.mm:
1215         * StorageProcess/IndexedDB/WebIDBConnectionToClient.h:
1216         * StorageProcess/StorageProcess.cpp:
1217         * StorageProcess/StorageProcess.h:
1218         * StorageProcess/StorageToWebProcessConnection.h:
1219         * UIProcess/API/APIPageConfiguration.h:
1220         * UIProcess/API/APIWebsiteDataStore.h:
1221         * UIProcess/API/glib/WebKitCookieManager.cpp:
1222         * UIProcess/Plugins/PlugInAutoStartProvider.h:
1223         * UIProcess/WebCookieManagerProxy.h:
1224         * UIProcess/WebProcessPool.cpp:
1225         * UIProcess/WebProcessPool.h:
1226         * UIProcess/WebProcessProxy.h:
1227         * UIProcess/WebsiteData/WebsiteDataStore.h:
1228         * WebProcess/Cookies/WebCookieManager.h:
1229         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
1230         * WebProcess/Databases/WebDatabaseProvider.cpp:
1231         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1232         * WebProcess/Network/NetworkProcessConnection.cpp:
1233         * WebProcess/Network/WebLoaderStrategy.cpp:
1234         * WebProcess/Network/WebSocketStream.cpp:
1235         * WebProcess/Network/WebSocketStream.h:
1236         * WebProcess/Storage/WebToStorageProcessConnection.h:
1237         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1238         * WebProcess/WebCoreSupport/WebPlugInClient.h:
1239         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
1240         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
1241         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h:
1242         * WebProcess/WebPage/WebPage.cpp:
1243         * WebProcess/WebProcess.h:
1244
1245 2017-08-17  Chris Dumez  <cdumez@apple.com>
1246
1247         REGRESSION (r220601): Crash under ProcessAssertion::markAsInvalidated()
1248         https://bugs.webkit.org/show_bug.cgi?id=175685
1249         <rdar://problem/33868623>
1250
1251         Reviewed by Sam Weinig.
1252
1253         After r220601, it is no longer safe to call a default-initialized WTF::Function.
1254
1255         * UIProcess/ios/ProcessAssertionIOS.mm:
1256         (WebKit::ProcessAssertion::markAsInvalidated):
1257
1258 2017-08-17  Andreas Kling  <akling@apple.com>
1259
1260         Disable CSS regions at compile time
1261         https://bugs.webkit.org/show_bug.cgi?id=175630
1262
1263         Reviewed by Antti Koivisto.
1264
1265         * Configurations/FeatureDefines.xcconfig:
1266
1267 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1268
1269         [iOS] Respect type fidelities when copying image elements to the pasteboard
1270         https://bugs.webkit.org/show_bug.cgi?id=175638
1271         <rdar://problem/26556043>
1272
1273         Reviewed by Ryosuke Niwa.
1274
1275         Currently, we treat the case when copying an image enclosed by a link by only writing a URL to the pasteboard.
1276         This patch tweaks logic in WebPage::performActionOnElement to write both an image and a link to the pasteboard
1277         if the hit-tested image element is enclosed by an anchor.
1278
1279         * Platform/spi/ios/UIKitSPI.h:
1280         * WebProcess/WebPage/ios/WebPageIOS.mm:
1281         (WebKit::containingLinkElement):
1282
1283         Tweak this helper to be more restrictive when finding an enclosing 'link' -- only return an element if isLink()
1284         is true, and it is an HTMLAnchorElement. Currently, the isLink() also matches HTMLLinkElements, but this isn't
1285         the intention here.
1286
1287         (WebKit::WebPage::performActionOnElement):
1288
1289 2017-08-17  Jacobo Aragunde Pérez  <jaragunde@igalia.com>
1290
1291         [WPE][GTK] Ensure proper casting of data in gvariants
1292         https://bugs.webkit.org/show_bug.cgi?id=175667
1293
1294         Reviewed by Michael Catanzaro.
1295
1296         g_variant_builder_add requires data to have the correct width for their types, using
1297         casting if necessary. Corrected a call where a single precision float was being put
1298         into a double precision parameter without a cast.
1299
1300         * UIProcess/API/glib/WebKitWebViewSessionState.cpp:
1301         (encodeFrameState):
1302
1303 2017-08-17  Don Olmstead  <don.olmstead@sony.com>
1304
1305         [PAL] Move SessionID into PAL
1306         https://bugs.webkit.org/show_bug.cgi?id=174192
1307
1308         Reviewed by Antti Koivisto.
1309
1310         * NetworkProcess/Downloads/Download.cpp:
1311         (WebKit::Download::Download):
1312         * NetworkProcess/Downloads/Download.h:
1313         (WebKit::Download::Download):
1314         * NetworkProcess/Downloads/DownloadManager.cpp:
1315         (WebKit::DownloadManager::startDownload):
1316         (WebKit::DownloadManager::resumeDownload):
1317         * NetworkProcess/Downloads/DownloadManager.h:
1318         (WebKit::DownloadManager::startDownload):
1319         * NetworkProcess/NetworkCORSPreflightChecker.h:
1320         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1321         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
1322         (WebKit::storageSession):
1323         (WebKit::NetworkConnectionToWebProcess::startDownload):
1324         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
1325         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
1326         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
1327         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
1328         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
1329         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
1330         (WebKit::NetworkConnectionToWebProcess::deleteCookie):
1331         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
1332         * NetworkProcess/NetworkConnectionToWebProcess.h:
1333         (WebKit::NetworkConnectionToWebProcess::startDownload):
1334         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1335         * NetworkProcess/NetworkLoad.cpp:
1336         * NetworkProcess/NetworkLoadParameters.h:
1337         * NetworkProcess/NetworkProcess.cpp:
1338         (WebKit::NetworkProcess::initializeNetworkProcess):
1339         (WebKit::NetworkProcess::destroySession):
1340         (WebKit::fetchDiskCacheEntries):
1341         (WebKit::NetworkProcess::fetchWebsiteData):
1342         (WebKit::NetworkProcess::deleteWebsiteData):
1343         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1344         (WebKit::NetworkProcess::downloadRequest):
1345         (WebKit::NetworkProcess::resumeDownload):
1346         * NetworkProcess/NetworkProcess.h:
1347         * NetworkProcess/NetworkProcess.messages.in:
1348         * NetworkProcess/NetworkResourceLoadParameters.h:
1349         * NetworkProcess/NetworkResourceLoader.h:
1350         * NetworkProcess/NetworkSession.cpp:
1351         (WebKit::NetworkSession::create):
1352         (WebKit::NetworkSession::defaultSession):
1353         (WebKit::NetworkSession::NetworkSession):
1354         * NetworkProcess/NetworkSession.h:
1355         (WebKit::NetworkSession::sessionID const):
1356         * NetworkProcess/NetworkSocketStream.cpp:
1357         (WebKit::NetworkSocketStream::create):
1358         (WebKit::NetworkSocketStream::NetworkSocketStream):
1359         * NetworkProcess/NetworkSocketStream.h:
1360         * NetworkProcess/RemoteNetworkingContext.h:
1361         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1362         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
1363         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1364         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1365         (WebKit::configurationForSessionID):
1366         (WebKit::NetworkSessionCocoa::create):
1367         (WebKit::NetworkSessionCocoa::defaultSession):
1368         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1369         * NetworkProcess/soup/NetworkSessionSoup.cpp:
1370         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
1371         * NetworkProcess/soup/NetworkSessionSoup.h:
1372         * Scripts/webkit/messages.py:
1373         (forward_declarations_and_headers.templates): Deleted.
1374         (class_template_headers.template): Deleted.
1375         * Shared/ChildProcess.cpp:
1376         (WebKit::ChildProcess::initialize):
1377         * Shared/SessionTracker.cpp:
1378         (WebKit::staticSessionMap):
1379         (WebKit::SessionTracker::networkSession):
1380         (WebKit::SessionTracker::setSession):
1381         (WebKit::SessionTracker::destroySession):
1382         * Shared/SessionTracker.h:
1383         * Shared/Storage/StorageProcessCreationParameters.h:
1384         * Shared/WebCoreArgumentCoders.cpp:
1385         * Shared/WebCoreArgumentCoders.h:
1386         * Shared/WebPageCreationParameters.h:
1387         * Shared/WebProcessCreationParameters.h:
1388         * Shared/WebsiteDataStoreParameters.h:
1389         * Shared/mac/CookieStorageShim.mm:
1390         (WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL):
1391         * StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp:
1392         (WebKit::WebIDBConnectionToClient::create):
1393         (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient):
1394         * StorageProcess/IndexedDB/WebIDBConnectionToClient.h:
1395         * StorageProcess/StorageProcess.cpp:
1396         (WebKit::StorageProcess::idbServer):
1397         (WebKit::StorageProcess::fetchWebsiteData):
1398         (WebKit::StorageProcess::deleteWebsiteData):
1399         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
1400         * StorageProcess/StorageProcess.h:
1401         * StorageProcess/StorageProcess.messages.in:
1402         * StorageProcess/StorageToWebProcessConnection.cpp:
1403         (WebKit::StorageToWebProcessConnection::establishIDBConnectionToServer):
1404         * StorageProcess/StorageToWebProcessConnection.h:
1405         * StorageProcess/StorageToWebProcessConnection.messages.in:
1406         * UIProcess/API/APIPageConfiguration.cpp:
1407         (API::PageConfiguration::setWebsiteDataStore):
1408         (API::PageConfiguration::sessionID):
1409         (API::PageConfiguration::setSessionID):
1410         * UIProcess/API/APIPageConfiguration.h:
1411         * UIProcess/API/APIWebsiteDataStore.cpp:
1412         (API::WebsiteDataStore::defaultDataStore):
1413         (API::WebsiteDataStore::createLegacy):
1414         (API::WebsiteDataStore::WebsiteDataStore):
1415         * UIProcess/API/APIWebsiteDataStore.h:
1416         * UIProcess/API/C/WKCookieManager.cpp:
1417         (WKCookieManagerGetHostnamesWithCookies):
1418         (WKCookieManagerDeleteCookiesForHostname):
1419         (WKCookieManagerDeleteAllCookies):
1420         (WKCookieManagerDeleteAllCookiesModifiedAfterDate):
1421         (WKCookieManagerSetHTTPCookieAcceptPolicy):
1422         (WKCookieManagerGetHTTPCookieAcceptPolicy):
1423         (WKCookieManagerStartObservingCookieChanges):
1424         (WKCookieManagerStopObservingCookieChanges):
1425         * UIProcess/API/Cocoa/WKProcessPool.mm:
1426         (-[WKProcessPool _setCookieAcceptPolicy:]):
1427         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1428         (-[WKWebsiteDataStore _initWithConfiguration:]):
1429         * UIProcess/API/glib/WebKitCookieManager.cpp:
1430         (webkit_cookie_manager_set_accept_policy):
1431         (webkit_cookie_manager_get_accept_policy):
1432         * UIProcess/Network/NetworkProcessProxy.cpp:
1433         (WebKit::NetworkProcessProxy::fetchWebsiteData):
1434         (WebKit::NetworkProcessProxy::deleteWebsiteData):
1435         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
1436         * UIProcess/Network/NetworkProcessProxy.h:
1437         * UIProcess/Plugins/PlugInAutoStartProvider.cpp:
1438         (WebKit::PlugInAutoStartProvider::PlugInAutoStartProvider):
1439         (WebKit::PlugInAutoStartProvider::addAutoStartOriginHash):
1440         (WebKit::PlugInAutoStartProvider::autoStartOriginsTableCopy const):
1441         (WebKit::PlugInAutoStartProvider::setAutoStartOriginsTableWithItemsPassingTest):
1442         (WebKit::PlugInAutoStartProvider::didReceiveUserInteraction):
1443         * UIProcess/Plugins/PlugInAutoStartProvider.h:
1444         * UIProcess/Storage/StorageProcessProxy.cpp:
1445         (WebKit::StorageProcessProxy::fetchWebsiteData):
1446         (WebKit::StorageProcessProxy::deleteWebsiteData):
1447         (WebKit::StorageProcessProxy::deleteWebsiteDataForOrigins):
1448         * UIProcess/Storage/StorageProcessProxy.h:
1449         * UIProcess/WebCookieManagerProxy.cpp:
1450         (WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
1451         (WebKit::WebCookieManagerProxy::deleteCookiesForHostname):
1452         (WebKit::WebCookieManagerProxy::deleteAllCookies):
1453         (WebKit::WebCookieManagerProxy::deleteCookie):
1454         (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
1455         (WebKit::WebCookieManagerProxy::setCookie):
1456         (WebKit::WebCookieManagerProxy::setCookies):
1457         (WebKit::WebCookieManagerProxy::getAllCookies):
1458         (WebKit::WebCookieManagerProxy::getCookies):
1459         (WebKit::WebCookieManagerProxy::startObservingCookieChanges):
1460         (WebKit::WebCookieManagerProxy::stopObservingCookieChanges):
1461         (WebKit::WebCookieManagerProxy::setCookieObserverCallback):
1462         (WebKit::WebCookieManagerProxy::registerObserver):
1463         (WebKit::WebCookieManagerProxy::unregisterObserver):
1464         (WebKit::WebCookieManagerProxy::cookiesDidChange):
1465         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
1466         (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
1467         * UIProcess/WebCookieManagerProxy.h:
1468         * UIProcess/WebCookieManagerProxy.messages.in:
1469         * UIProcess/WebPageProxy.h:
1470         (WebKit::WebPageProxy::sessionID const):
1471         * UIProcess/WebProcessPool.cpp:
1472         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
1473         (WebKit::WebProcessPool::createNewWebProcess):
1474         (WebKit::WebProcessPool::createWebPage):
1475         (WebKit::WebProcessPool::pageAddedToProcess):
1476         (WebKit::WebProcessPool::pageRemovedFromProcess):
1477         (WebKit::WebProcessPool::download):
1478         (WebKit::WebProcessPool::resumeDownload):
1479         (WebKit::WebProcessPool::addPlugInAutoStartOriginHash):
1480         (WebKit::WebProcessPool::plugInDidReceiveUserInteraction):
1481         * UIProcess/WebProcessPool.h:
1482         * UIProcess/WebProcessPool.messages.in:
1483         * UIProcess/WebProcessProxy.cpp:
1484         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
1485         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData):
1486         (WebKit::WebProcessProxy::fetchWebsiteData):
1487         (WebKit::WebProcessProxy::deleteWebsiteData):
1488         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
1489         * UIProcess/WebProcessProxy.h:
1490         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1491         (WebKit::WebsiteDataStore::createNonPersistent):
1492         (WebKit::WebsiteDataStore::create):
1493         (WebKit::WebsiteDataStore::WebsiteDataStore):
1494         (WebKit::WebsiteDataStore::~WebsiteDataStore):
1495         * UIProcess/WebsiteData/WebsiteDataStore.h:
1496         (WebKit::WebsiteDataStore::sessionID const):
1497         * WebProcess/Cookies/WebCookieManager.cpp:
1498         (WebKit::WebCookieManager::getHostnamesWithCookies):
1499         (WebKit::WebCookieManager::deleteCookiesForHostname):
1500         (WebKit::WebCookieManager::deleteAllCookies):
1501         (WebKit::WebCookieManager::deleteCookie):
1502         (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
1503         (WebKit::WebCookieManager::getAllCookies):
1504         (WebKit::WebCookieManager::getCookies):
1505         (WebKit::WebCookieManager::setCookie):
1506         (WebKit::WebCookieManager::setCookies):
1507         (WebKit::WebCookieManager::notifyCookiesDidChange):
1508         (WebKit::WebCookieManager::startObservingCookieChanges):
1509         (WebKit::WebCookieManager::stopObservingCookieChanges):
1510         * WebProcess/Cookies/WebCookieManager.h:
1511         * WebProcess/Cookies/WebCookieManager.messages.in:
1512         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1513         (WebKit::WebIDBConnectionToServer::create):
1514         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
1515         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
1516         * WebProcess/Databases/WebDatabaseProvider.cpp:
1517         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
1518         * WebProcess/Databases/WebDatabaseProvider.h:
1519         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1520         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
1521         * WebProcess/Network/NetworkProcessConnection.cpp:
1522         (WebKit::NetworkProcessConnection::didCacheResource):
1523         * WebProcess/Network/NetworkProcessConnection.h:
1524         * WebProcess/Network/NetworkProcessConnection.messages.in:
1525         * WebProcess/Network/WebLoaderStrategy.cpp:
1526         (WebKit::WebLoaderStrategy::scheduleLoad):
1527         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1528         (WebKit::WebLoaderStrategy::createPingHandle):
1529         * WebProcess/Network/WebSocketProvider.cpp:
1530         (WebKit::WebSocketProvider::createSocketStreamHandle):
1531         * WebProcess/Network/WebSocketProvider.h:
1532         * WebProcess/Network/WebSocketStream.cpp:
1533         (WebKit::WebSocketStream::create):
1534         (WebKit::WebSocketStream::WebSocketStream):
1535         * WebProcess/Network/WebSocketStream.h:
1536         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
1537         (WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession):
1538         * WebProcess/Storage/WebToStorageProcessConnection.h:
1539         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1540         (WebKit::WebFrameLoaderClient::convertMainResourceLoadToDownload):
1541         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1542         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1543         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
1544         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1545         * WebProcess/WebCoreSupport/WebPlugInClient.cpp:
1546         (WebKit::WebPlugInClient::didStartFromOrigin):
1547         * WebProcess/WebCoreSupport/WebPlugInClient.h:
1548         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
1549         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
1550         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
1551         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
1552         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
1553         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h:
1554         * WebProcess/WebPage/WebFrame.cpp:
1555         (WebKit::WebFrame::startDownload):
1556         (WebKit::WebFrame::convertMainResourceLoadToDownload):
1557         * WebProcess/WebPage/WebFrame.h:
1558         * WebProcess/WebPage/WebPage.cpp:
1559         (WebKit::WebPage::setSessionID):
1560         (WebKit::WebPage::updatePreferences):
1561         * WebProcess/WebPage/WebPage.h:
1562         (WebKit::WebPage::sessionID const):
1563         * WebProcess/WebProcess.cpp:
1564         (WebKit::m_webSQLiteDatabaseTracker):
1565         (WebKit::WebProcess::ensurePrivateBrowsingSession):
1566         (WebKit::WebProcess::destroySession):
1567         (WebKit::WebProcess::isPlugInAutoStartOriginHash):
1568         (WebKit::WebProcess::plugInDidStartFromOrigin):
1569         (WebKit::WebProcess::didAddPlugInAutoStartOriginHash):
1570         (WebKit::WebProcess::resetPlugInAutoStartOriginDefaultHashes):
1571         (WebKit::WebProcess::resetPlugInAutoStartOriginHashes):
1572         (WebKit::WebProcess::plugInDidReceiveUserInteraction):
1573         (WebKit::WebProcess::fetchWebsiteData):
1574         (WebKit::WebProcess::deleteWebsiteData):
1575         (WebKit::WebProcess::deleteWebsiteDataForOrigins):
1576         * WebProcess/WebProcess.h:
1577         * WebProcess/WebProcess.messages.in:
1578
1579 2017-08-17  Joseph Pecoraro  <pecoraro@apple.com>
1580
1581         Fix typo: setUpInectedBundleClient
1582         https://bugs.webkit.org/show_bug.cgi?id=175655
1583
1584         Reviewed by Andreas Kling.
1585
1586         * UIProcess/API/Cocoa/WKProcessGroup.mm:
1587         (setUpInjectedBundleClient):
1588         (-[WKProcessGroup initWithInjectedBundleURL:]):
1589
1590 2017-08-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1591
1592         [GTK][WPE] Add NTLM authentication enabled API
1593         https://bugs.webkit.org/show_bug.cgi?id=122952
1594
1595         Reviewed by Michael Catanzaro.
1596
1597         Add API to WebKitWebContext to enable/disable NTLM authentication.
1598
1599         * NetworkProcess/NetworkProcess.h:
1600         * NetworkProcess/NetworkProcess.messages.in:
1601         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1602         (WebKit::NetworkProcessCreationParameters::encode const):
1603         (WebKit::NetworkProcessCreationParameters::decode):
1604         * NetworkProcess/NetworkProcessCreationParameters.h:
1605         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1606         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
1607         (WebKit::NetworkProcess::setNTLMAuthenticationEnabled):
1608         * UIProcess/API/glib/WebKitWebContext.cpp:
1609         (webkit_web_context_get_ntlm_authentication_enabled):
1610         (webkit_web_context_set_ntlm_authentication_enabled):
1611         * UIProcess/API/gtk/WebKitWebContext.h:
1612         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1613         * UIProcess/API/wpe/WebKitWebContext.h:
1614         * UIProcess/WebProcessPool.h:
1615         * UIProcess/soup/WebProcessPoolSoup.cpp:
1616         (WebKit::WebProcessPool::setNTLMAuthenticationEnabled):
1617
1618 2017-08-16  Andy Estes  <aestes@apple.com>
1619
1620         [Apple Pay] Rename PaymentRequest to ApplePaySessionPaymentRequest
1621         https://bugs.webkit.org/show_bug.cgi?id=175648
1622
1623         Reviewed by Tim Horton.
1624
1625         * Scripts/webkit/messages.py:
1626         (headers_for_type):
1627         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1628         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::encode):
1629         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::decode):
1630         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::ContactFields>::encode):
1631         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::ContactFields>::decode):
1632         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::LineItem>::encode):
1633         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::LineItem>::decode):
1634         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::MerchantCapabilities>::encode):
1635         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::MerchantCapabilities>::decode):
1636         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::ShippingMethod>::encode):
1637         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::ShippingMethod>::decode):
1638         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::TotalAndLineItems>::encode):
1639         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::TotalAndLineItems>::decode):
1640         (IPC::ArgumentCoder<PaymentRequest>::encode): Deleted.
1641         (IPC::ArgumentCoder<PaymentRequest>::decode): Deleted.
1642         (IPC::ArgumentCoder<PaymentRequest::ContactFields>::encode): Deleted.
1643         (IPC::ArgumentCoder<PaymentRequest::ContactFields>::decode): Deleted.
1644         (IPC::ArgumentCoder<PaymentRequest::LineItem>::encode): Deleted.
1645         (IPC::ArgumentCoder<PaymentRequest::LineItem>::decode): Deleted.
1646         (IPC::ArgumentCoder<PaymentRequest::MerchantCapabilities>::encode): Deleted.
1647         (IPC::ArgumentCoder<PaymentRequest::MerchantCapabilities>::decode): Deleted.
1648         (IPC::ArgumentCoder<PaymentRequest::ShippingMethod>::encode): Deleted.
1649         (IPC::ArgumentCoder<PaymentRequest::ShippingMethod>::decode): Deleted.
1650         (IPC::ArgumentCoder<PaymentRequest::TotalAndLineItems>::encode): Deleted.
1651         (IPC::ArgumentCoder<PaymentRequest::TotalAndLineItems>::decode): Deleted.
1652         * Shared/WebCoreArgumentCoders.h:
1653         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
1654         (WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
1655         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingMethod):
1656         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
1657         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
1658         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
1659         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1660         (toShippingMethod):
1661         (WebKit::toPKContactFields):
1662         (WebKit::toPKAddressField):
1663         (WebKit::toPKPaymentSummaryItemType):
1664         (WebKit::toPKPaymentSummaryItem):
1665         (WebKit::toPKPaymentSummaryItems):
1666         (WebKit::toPKMerchantCapabilities):
1667         (WebKit::toPKShippingType):
1668         (WebKit::toPKShippingMethod):
1669         (WebKit::toPKPaymentRequest):
1670         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
1671         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
1672         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
1673         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
1674         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1675         (WebKit::WebPaymentCoordinator::showPaymentUI):
1676         (WebKit::WebPaymentCoordinator::didSelectShippingMethod):
1677         * WebProcess/ApplePay/WebPaymentCoordinator.h:
1678         * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
1679
1680 2017-08-16  Chris Dumez  <cdumez@apple.com>
1681
1682         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight
1683         https://bugs.webkit.org/show_bug.cgi?id=175628
1684         <rdar://problem/33919278>
1685
1686         Reviewed by Geoffrey Garen.
1687
1688         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight.
1689         To achieve this, the following changes were made:
1690         1. Revert r220779 which caused us to use a non CORS-safelisted Content-Type header for such payload
1691         2. Teach PingLoad how to deal with "simple" cross origin requests (i.e. Don't assume we need a CORS
1692            preflight merely because the fetch mode is set to "cors").
1693
1694         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
1695         (WebKit::NetworkCORSPreflightChecker::startPreflight):
1696         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1697         (WebKit::NetworkResourceLoadParameters::encode const):
1698         (WebKit::NetworkResourceLoadParameters::decode):
1699         * NetworkProcess/NetworkResourceLoadParameters.h:
1700         * NetworkProcess/PingLoad.cpp:
1701         (WebKit::PingLoad::PingLoad):
1702         (WebKit::PingLoad::loadRequest):
1703         (WebKit::PingLoad::originalRequestHeaders const):
1704         (WebKit::PingLoad::willPerformHTTPRedirection):
1705         (WebKit::PingLoad::isAllowedRedirect const):
1706         (WebKit::PingLoad::makeCrossOriginAccessRequest):
1707         (WebKit::PingLoad::makeSimpleCrossOriginAccessRequest):
1708         (WebKit::PingLoad::makeCrossOriginAccessRequestWithPreflight):
1709         (WebKit::PingLoad::preflightSuccess):
1710         * NetworkProcess/PingLoad.h:
1711         * WebProcess/Network/WebLoaderStrategy.cpp:
1712         (WebKit::WebLoaderStrategy::createPingHandle):
1713         * WebProcess/Network/WebLoaderStrategy.h:
1714
1715 2017-08-16  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
1716
1717         [PAL] Move spi/ios and spi/win directories into PAL
1718         https://bugs.webkit.org/show_bug.cgi?id=175171
1719
1720         Reviewed by Antti Koivisto.
1721
1722         * UIProcess/Cocoa/NavigationState.mm:
1723         * UIProcess/ios/WKActionSheetAssistant.h:
1724         * UIProcess/ios/WKActionSheetAssistant.mm:
1725         * UIProcess/ios/WKContentViewInteraction.mm:
1726         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
1727         * WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm:
1728         * WebProcess/cocoa/WebProcessCocoa.mm:
1729
1730 2017-08-16  Miguel Gomez  <magomez@igalia.com>
1731
1732         [GTK] Crash of WebProcess with on-demand AC
1733         https://bugs.webkit.org/show_bug.cgi?id=171161
1734
1735         Reviewed by Carlos Garcia Campos.
1736
1737         Set the viewOverlayRootLayer to the previous layerTreeHost if it exists. This avoids a
1738         crash when reusing the previous layerTreeHost, because it would keep a reference to an
1739         already destroyed viewOverlayRootLayer.
1740
1741         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1742         (WebKit::AcceleratedDrawingArea::attachViewOverlayGraphicsLayer):
1743
1744 2017-08-16  Zan Dobersek  <zdobersek@igalia.com>
1745
1746         [CoordGraphics] Simplify CoordinatedGraphicsScene state updates
1747         https://bugs.webkit.org/show_bug.cgi?id=175528
1748         <rdar://problem/33876795>
1749
1750         Reviewed by Carlos Garcia Campos.
1751
1752         Hold the information about state updates in ThreadedCompositor, in the
1753         m_attributes struct. This way we don't need to store the updates in
1754         functors and accumulate them in the CoordinatedGraphicsScene class, but
1755         instead just apply any pending state update or atlas removal before the
1756         scene is rendered.
1757
1758         This removes the need to update the CoordinatedGraphicsScene object from
1759         the main thread with data that ultimately has to be handled on the
1760         composition thread. Similarly, when updating CoordinatedGraphicsScene, we
1761         only need to synchronize on the m_attributes lock object once in order to
1762         retrieve the scene update information, instead of having each functor do
1763         that repeatedly.
1764
1765         Outside of CoordinatedGraphicsScene and ThreadedCompositor classes, the
1766         CompositingCoordinator class now passes the atlases-to-remove Vector by
1767         a const lvalue reference down to ThreadedCompositor, and then manually
1768         clears the Vector. Before the Vector was passed as an rvalue reference,
1769         depending on the ThreadedCompositor code to clear out the original Vector
1770         object by moving its resources into the functor object. This doesn't occur
1771         anymore because the Vector object is now appended to another Vector.
1772
1773         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1774         (WebKit::CoordinatedGraphicsScene::applyStateChanges):
1775         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
1776         (WebKit::CoordinatedGraphicsScene::detach):
1777         (WebKit::CoordinatedGraphicsScene::setActive):
1778         (WebKit::CoordinatedGraphicsScene::syncRemoteContent): Deleted.
1779         (WebKit::CoordinatedGraphicsScene::appendUpdate): Deleted.
1780         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1781         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1782         (WebKit::ThreadedCompositor::renderLayerTree):
1783         (WebKit::ThreadedCompositor::updateSceneState):
1784         (WebKit::ThreadedCompositor::releaseUpdateAtlases):
1785         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1786         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1787         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
1788         (WebKit::CompositingCoordinator::releaseAtlases):
1789         (WebKit::CompositingCoordinator::clearUpdateAtlases):
1790         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1791         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
1792         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
1793         (WebKit::ThreadedCoordinatedLayerTreeHost::releaseUpdateAtlases):
1794         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
1795
1796 2017-08-16  Andy Estes  <aestes@apple.com>
1797
1798         [Payment Request] Add an ENABLE flag and an experimental feature preference
1799         https://bugs.webkit.org/show_bug.cgi?id=175622
1800
1801         Reviewed by Tim Horton.
1802
1803         * Configurations/FeatureDefines.xcconfig:
1804         * Shared/WebPreferencesDefinitions.h:
1805         * UIProcess/API/C/WKPreferences.cpp:
1806         (WKPreferencesSetPaymentRequestEnabled):
1807         (WKPreferencesGetPaymentRequestEnabled):
1808         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1809         * WebProcess/WebPage/WebPage.cpp:
1810         (WebKit::WebPage::updatePreferences):
1811
1812 2017-08-15  Carlos Garcia Campos  <cgarcia@igalia.com>
1813
1814         [GTK][WPE] WebKitAutomationSession should set session client to nullptr on dispose
1815         https://bugs.webkit.org/show_bug.cgi?id=175564
1816
1817         Reviewed by Carlos Alberto Lopez Perez.
1818
1819         WebAutomationSession expects its client to be nullptr in the destructor.
1820
1821         * UIProcess/API/glib/WebKitAutomationSession.cpp:
1822         (webkitAutomationSessionDispose):
1823
1824 2017-08-15  Tim Horton  <timothy_horton@apple.com>
1825
1826         WKSnapshotConfiguration is missing from the WebKit umbrella header
1827         https://bugs.webkit.org/show_bug.cgi?id=175614
1828         <rdar://problem/33812691>
1829
1830         Reviewed by Dan Bernstein.
1831
1832         * Shared/API/Cocoa/WebKit.h:
1833         Add WKSnapshotConfiguration, which is a public header.
1834
1835 2017-08-15  Simon Fraser  <simon.fraser@apple.com>
1836
1837         Allow WebCore logging channels to be set from the UI process
1838         https://bugs.webkit.org/show_bug.cgi?id=175608
1839
1840         Reviewed by Tim Horton.
1841
1842         The UI process can now read the "WebCoreLogging" default, and pass it to the web process
1843         via WebProcessCreationParameters, where WebProcess::platformInitializeWebProcess() uses
1844         it to set up WebCore logging channels. Note that these will override channels read from
1845         the web process user defaults domain (but those are hard to set anyway).
1846
1847         * Shared/WebProcessCreationParameters.cpp:
1848         (WebKit::WebProcessCreationParameters::encode const):
1849         (WebKit::WebProcessCreationParameters::decode):
1850         * Shared/WebProcessCreationParameters.h:
1851         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1852         (WebKit::WebProcessPool::platformInitializeWebProcess):
1853         * WebProcess/cocoa/WebProcessCocoa.mm:
1854         (WebKit::WebProcess::platformInitializeWebProcess):
1855
1856 2017-08-15  Don Olmstead  <don.olmstead@sony.com>
1857
1858         [PAL] Move Sleep classes into PAL
1859         https://bugs.webkit.org/show_bug.cgi?id=175456
1860
1861         Reviewed by Ryosuke Niwa.
1862
1863         * UIProcess/mac/WKFullScreenWindowController.h:
1864         * UIProcess/mac/WKFullScreenWindowController.mm:
1865
1866 2017-08-15  Youenn Fablet  <youenn@apple.com>
1867
1868         [Cache API] Adding generic support for CacheStorage and Cache methods
1869         https://bugs.webkit.org/show_bug.cgi?id=175455
1870
1871         Reviewed by Chris Dumez.
1872
1873         * WebKit.xcodeproj/project.pbxproj:
1874         * WebProcess/Cache/WebCacheStorageProvider.h: Added.
1875         * WebProcess/WebPage/WebPage.cpp:
1876         (WebKit::m_cpuLimit):
1877         * WebProcess/WebProcess.cpp:
1878         (WebKit::WebProcess::WebProcess):
1879         * WebProcess/WebProcess.h:
1880         (WebKit::WebProcess::cacheStorageProvider):
1881
1882 2017-08-15  Michael Catanzaro  <mcatanzaro@igalia.com>
1883
1884         Unreviewed, rolling out r220700.
1885
1886         Broke debug bot
1887
1888         Reverted changeset:
1889
1890         "[CoordGraphics] Simplify CoordinatedGraphicsScene state
1891         updates"
1892         https://bugs.webkit.org/show_bug.cgi?id=175528
1893         http://trac.webkit.org/changeset/220700
1894
1895 2017-08-15  Carlos Garcia Campos  <cgarcia@igalia.com>
1896
1897         WebDriver: timeout when JavaScript alert is shown in onload handler
1898         https://bugs.webkit.org/show_bug.cgi?id=175315
1899         <rdar://problem/33788294>
1900
1901         Reviewed by Brian Burg.
1902
1903         When a JavaScript alert is shown in an onload handler, the alert prevents the load from finishing in case of
1904         normal page load strategy, so navigation commands or any other command for which we wait for navigation to
1905         complete end up timing out. There are two selenium tests covering this that are currently timing out:
1906         testShouldHandleAlertOnPageLoad and testShouldHandleAlertOnPageLoadUsingGet. The spec says that in case of page
1907         load timeout we should only fail with timeout error when there isn't an active alert dialog. If the next command
1908         expects an alert it will just work, otherwise it will fail with UnexpectedAlertOpen error when trying to handle
1909         user prompts.
1910
1911         9 Navigation.
1912         https://w3c.github.io/webdriver/webdriver-spec.html#dfn-wait-for-navigation-to-complete
1913
1914         * UIProcess/Automation/WebAutomationSession.cpp:
1915         (WebKit::WebAutomationSession::waitForNavigationToComplete): Do not wait for the timeout when the page is
1916         loading and there's an active alert in case of normal page load strategy.
1917         (WebKit::WebAutomationSession::respondToPendingPageNavigationCallbacksWithTimeout): Respond with timeout unless
1918         the page is showing a JavaScript dialog.
1919         (WebKit::WebAutomationSession::respondToPendingFrameNavigationCallbacksWithTimeout): Ditto.
1920         (WebKit::WebAutomationSession::loadTimerFired): Use respondToPendingPageNavigationCallbacksWithTimeout() and
1921         respondToPendingFrameNavigationCallbacksWithTimeout().
1922         (WebKit::WebAutomationSession::willShowJavaScriptDialog): The page is about to show a JavaScript dialog, so
1923         we wait until the next run loop iteration to give time for the client to show the dialog, then check if page is
1924         loading and the dialog is still present. If that's the case we finish all normal strategy pending navigations.
1925         * UIProcess/Automation/WebAutomationSession.h:
1926         * UIProcess/WebPageProxy.cpp:
1927         (WebKit::WebPageProxy::runJavaScriptAlert): If controlled by automation, notify the session.
1928         (WebKit::WebPageProxy::runJavaScriptConfirm): Ditto.
1929         (WebKit::WebPageProxy::runJavaScriptPrompt): Ditto.
1930         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): Ditto.
1931
1932 2017-08-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1933
1934         WebDriver: handle click events on option elements
1935         https://bugs.webkit.org/show_bug.cgi?id=174710
1936         <rdar://problem/33459305>
1937
1938         Reviewed by Brian Burg.
1939
1940         Add selectOptionElement method to automation to select an option element according to the WebDriver
1941         specification.
1942
1943         14.1 Element Click.
1944         https://w3c.github.io/webdriver/webdriver-spec.html#element-click
1945
1946         * UIProcess/Automation/Automation.json: Add selectOptionElement method and ElementNotSelectable error.
1947         * UIProcess/Automation/WebAutomationSession.cpp:
1948         (WebKit::WebAutomationSession::selectOptionElement):Send SelectOptionElement message to the web process.
1949         (WebKit::WebAutomationSession::didSelectOptionElement): Notify the driver.
1950         * UIProcess/Automation/WebAutomationSession.h:
1951         * UIProcess/Automation/WebAutomationSession.messages.in: Add DidSelectOptionElement message.
1952         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1953         (WebKit::elementContainer): Helper to get the container of an element according to the spec.
1954         (WebKit::WebAutomationSessionProxy::computeElementLayout): Use the container element to scroll the view and
1955         compute the in-view center point.
1956         (WebKit::WebAutomationSessionProxy::selectOptionElement): Use HTMLSelectElement::optionSelectedByUser().
1957         * WebProcess/Automation/WebAutomationSessionProxy.h:
1958         * WebProcess/Automation/WebAutomationSessionProxy.messages.in: Add SelectOptionElement message.
1959
1960 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
1961
1962         Remove Proximity Events and related code
1963         https://bugs.webkit.org/show_bug.cgi?id=175545
1964
1965         Reviewed by Daniel Bates.
1966
1967         No platform enables Proximity Events, so remove code inside ENABLE(PROXIMITY_EVENTS)
1968         and other related code.
1969
1970         * CMakeLists.txt:
1971         * Configurations/FeatureDefines.xcconfig:
1972         * WebProcess/WebCoreSupport/WebDeviceProximityClient.cpp: Removed.
1973         * WebProcess/WebCoreSupport/WebDeviceProximityClient.h: Removed.
1974         * WebProcess/WebPage/WebPage.cpp:
1975         (WebKit::m_cpuLimit):
1976
1977 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
1978
1979         Remove ENABLE(REQUEST_AUTOCOMPLETE) code, which was disabled everywhere
1980         https://bugs.webkit.org/show_bug.cgi?id=175504
1981
1982         Reviewed by Sam Weinig.
1983
1984         * Configurations/FeatureDefines.xcconfig:
1985         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1986         (WebKit::WebFrameLoaderClient::didRequestAutocomplete): Deleted.
1987         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1988
1989 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
1990
1991         Remove ENABLE_VIEW_MODE_CSS_MEDIA and related code
1992         https://bugs.webkit.org/show_bug.cgi?id=175557
1993
1994         Reviewed by Jon Lee.
1995
1996         No port cares about the ENABLE(VIEW_MODE_CSS_MEDIA) feature, so remove it.
1997
1998         * Configurations/FeatureDefines.xcconfig:
1999
2000 2017-08-14  Andy Estes  <aestes@apple.com>
2001
2002         [Apple Pay] Add support for phonetic contact names
2003         https://bugs.webkit.org/show_bug.cgi?id=175537
2004         <rdar://problem/32002644>
2005
2006         Reviewed by Tim Horton.
2007
2008         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: Soft-linked PKContactFieldPhoneticName.
2009         (WebKit::toPKContactFields): Added code to append PKContactFieldPhoneticName to result if
2010         contactFields.phoneticName is true.
2011         (WebKit::toNSError): Specified PKContactFieldPhoneticName as the contact field for
2012         PaymentError::ContactField::PhoneticName.
2013
2014 2017-08-14  Tim Horton  <timothy_horton@apple.com>
2015
2016         Only create directory and sandbox extension handle for storage directories if they are set
2017         https://bugs.webkit.org/show_bug.cgi?id=175522
2018
2019         Reviewed by Brady Eidson.
2020
2021         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2022         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
2023         If using a non-persistent WebsiteDataStore, all the storage directories
2024         are unset, but we still try to create them and make sandbox extensions
2025         for them. This has no effect except a ton of noisy logging, but that
2026         is reason enough to stop.
2027
2028         This is similar to r216053, but for more directories.
2029
2030 2017-08-14  Zan Dobersek  <zdobersek@igalia.com>
2031
2032         [CoordGraphics] Simplify CoordinatedGraphicsScene state updates
2033         https://bugs.webkit.org/show_bug.cgi?id=175528
2034
2035         Reviewed by Carlos Garcia Campos.
2036
2037         Hold the information about state updates in ThreadedCompositor, in the
2038         m_attributes struct. This way we don't need to store the updates in
2039         functors and accumulate them in the CoordinatedGraphicsScene class, but
2040         instead just apply any pending state update or atlas removal before the
2041         scene is rendered.
2042
2043         This removes the need to update the CoordinatedGraphicsScene object from
2044         the main thread with data that ultimately has to be handled on the
2045         composition thread. Similarly, when updating CoordinatedGraphicsScene, we
2046         only need to synchronize on the m_attributes lock object once in order to
2047         retrieve the scene update information, instead of having each functor do
2048         that repeatedly.
2049
2050         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2051         (WebKit::CoordinatedGraphicsScene::applyStateChanges):
2052         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
2053         (WebKit::CoordinatedGraphicsScene::detach):
2054         (WebKit::CoordinatedGraphicsScene::setActive):
2055         (WebKit::CoordinatedGraphicsScene::syncRemoteContent): Deleted.
2056         (WebKit::CoordinatedGraphicsScene::appendUpdate): Deleted.
2057         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
2058         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2059         (WebKit::ThreadedCompositor::renderLayerTree):
2060         (WebKit::ThreadedCompositor::updateSceneState):
2061         (WebKit::ThreadedCompositor::releaseUpdateAtlases):
2062         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2063
2064 2017-08-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2065
2066         [GTK][WPE] Avoid emitting WebKitFaviconDatabase::favicon-changed multiple times while setting an icon
2067         https://bugs.webkit.org/show_bug.cgi?id=175531
2068
2069         Reviewed by Michael Catanzaro.
2070
2071         When webkitFaviconDatabaseSetIconForPageURL() is called, both setIconURLForPageURL() and setIconDataForIconURL()
2072         might notify the client, which ends up emitting the WebKitFaviconDatabase::favicon-changed signal and calling
2073         webkitFaviconDatabaseSetIconURLForPageURL(). Both things are already done by
2074         webkitFaviconDatabaseSetIconForPageURL() itself, so we can just ignore the client notification while setting a
2075         new icon.
2076
2077         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
2078         (webkitFaviconDatabaseSetIconURLForPageURL): Return early if isSettingIcon is true.
2079         (webkitFaviconDatabaseSetIconForPageURL): Set isSettingIcon to true for the scope.
2080
2081 2017-08-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2082
2083         [GTK][WPE] Crash in IconDatabase::IconRecord::setImageData()
2084         https://bugs.webkit.org/show_bug.cgi?id=175527
2085
2086         Reviewed by Žan Doberšek.
2087
2088         The problem is that when setImageData() is called from IconDatabase::readFromDatabase() the shared buffer might
2089         be nullptr, because getImageDataForIconURLFromSQLDatabase() returns nullptr if the icon data is not in the database.
2090
2091         * UIProcess/API/glib/IconDatabase.cpp:
2092         (WebKit::IconDatabase::IconRecord::setImageData): Return early if passed in buffer is nullptr.
2093
2094 2017-08-14  Zan Dobersek  <zdobersek@igalia.com>
2095
2096         [ThreadedCompositor] Improve composition and update state handling
2097         https://bugs.webkit.org/show_bug.cgi?id=172448
2098
2099         Reviewed by Carlos Garcia Campos.
2100
2101         In the ThreadedCompositor and related classes, we now track composition
2102         and scene update states separately. This enables properly piping in the
2103         DisplayRefreshMonitor object, leveraging it for both display refresh
2104         notifications and signalling to the client that the scene update is
2105         completed.
2106
2107         In CompositingRunLoop, two separate states are now used, one for
2108         compositing and the other for scene update. Access to both should be done
2109         while the related Lock object is held. The pending update state is also
2110         tracked in order to schedule any required updates as soon as the current
2111         state update is completed.
2112
2113         In ThreadedCompositor, the information about client notification and
2114         update completion coordination is now also kept under a Lock object,
2115         moving away from atomics. DisplayRefreshMonitor can now utilize just
2116         two methods in order to either schedule an update or report that update
2117         as finished.
2118
2119         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2120         (WebKit::CompositingRunLoop::CompositingRunLoop):
2121         (WebKit::CompositingRunLoop::scheduleUpdate):
2122         (WebKit::CompositingRunLoop::stopUpdates):
2123         (WebKit::CompositingRunLoop::compositionCompleted):
2124         (WebKit::CompositingRunLoop::updateCompleted):
2125         (WebKit::CompositingRunLoop::updateTimerFired):
2126         (WebKit::CompositingRunLoop::isActive): Deleted.
2127         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
2128         (WebKit::CompositingRunLoop::stateLock):
2129         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2130         (WebKit::m_displayRefreshMonitor):
2131         (WebKit::ThreadedCompositor::sceneUpdateFinished):
2132         (WebKit::ThreadedCompositor::updateSceneState):
2133         (WebKit::ThreadedCompositor::requestDisplayRefreshMonitorUpdate):
2134         (WebKit::ThreadedCompositor::handleDisplayRefreshMonitorUpdate):
2135         (WebKit::ThreadedCompositor::renderNextFrameIfNeeded): Deleted.
2136         (WebKit::ThreadedCompositor::completeCoordinatedUpdateIfNeeded): Deleted.
2137         (WebKit::ThreadedCompositor::coordinateUpdateCompletionWithClient): Deleted.
2138         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2139         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
2140         (WebKit::ThreadedDisplayRefreshMonitor::requestRefreshCallback):
2141         (WebKit::ThreadedDisplayRefreshMonitor::displayRefreshCallback):
2142
2143 2017-08-13  Manuel Rego Casasnovas  <rego@igalia.com>
2144
2145         Composition underline color is always black
2146         https://bugs.webkit.org/show_bug.cgi?id=174675
2147
2148         Reviewed by Ryosuke Niwa.
2149
2150         This patch uses the current color of the text instead of black
2151         for the composition underline marker.
2152         This makes it visible in the case we have a black/dark background.
2153
2154         * UIProcess/Cocoa/WebViewImpl.mm:
2155         (WebKit::extractUnderlines): If NSUnderlineColorAttributeName
2156         is not present use text color for composition underline.
2157         (WebKit::WebViewImpl::setMarkedText): Use text color
2158         for composition underline in the plain text case.
2159         * UIProcess/gtk/InputMethodFilter.cpp:
2160         (WebKit::InputMethodFilter::handleKeyboardEventWithCompositionResults):
2161         Use text color for composition underline.
2162         (WebKit::InputMethodFilter::updatePreedit): Ditto.
2163         * WebProcess/WebPage/WebPage.cpp:
2164         (WebKit::WebPage::setCompositionForTesting): Ditto.
2165
2166 2017-08-13  Adrian Perez de Castro  <aperez@igalia.com>
2167
2168         [WPE] Implement WebCore::standardUserAgent()
2169         https://bugs.webkit.org/show_bug.cgi?id=175507
2170
2171         Reviewed by Carlos Alberto Lopez Perez.
2172
2173         Implement missing User-Agent handling for the WPE port by sharing the code with the GTK+ port.
2174
2175         * UIProcess/API/glib/WebKitSettings.cpp: Remove preprocessor conditionals for the WPE port.
2176         (webkit_settings_set_user_agent):
2177         (webkit_settings_set_user_agent_with_application_details):
2178         * UIProcess/wpe/WebPageProxyWPE.cpp:
2179         (WebKit::WebPageProxy::standardUserAgent): Remove hardcoded value and make use of WebCore::standardUserAgent().
2180
2181 2017-08-11  Ryosuke Niwa  <rniwa@webkit.org>
2182
2183         Replace DATA_TRANSFER_ITEMS by a runtime flag and add a stub implementation
2184         https://bugs.webkit.org/show_bug.cgi?id=175474
2185         <rdar://problem/33844628>
2186
2187         Reviewed by Wenson Hsieh.
2188
2189         Replaced the build flag by a runtime flag and disabled the feature by default.
2190
2191         * Configurations/FeatureDefines.xcconfig:
2192         * Shared/WebPreferencesDefinitions.h:
2193         * UIProcess/API/C/WKPreferences.cpp:
2194         (WKPreferencesSetDataTransferItemsEnabled): Added to be used by WebKitTestRunner.
2195         (WKPreferencesGetDataTransferItemsEnabled): Ditto.
2196         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2197         * WebProcess/WebPage/WebPage.cpp:
2198         (WebKit::WebPage::updatePreferences):
2199
2200 2017-08-10  Sam Weinig  <sam@webkit.org>
2201
2202         WTF::Function does not allow for reference / non-default constructible return types
2203         https://bugs.webkit.org/show_bug.cgi?id=175244
2204
2205         Reviewed by Chris Dumez.
2206
2207         * UIProcess/WebResourceLoadStatisticsStore.h:
2208         Update the default value for the updateCookiePartitioningForDomainsHandler parameter to be an 
2209         empty lambda, rather than default initialization, which leads to a null WTF::Function. This allows
2210         us to remove support for calling null WTF::Function. No change in behavior.
2211
2212 2017-08-11  Adrian Perez de Castro  <aperez@igalia.com>
2213
2214         [WPE] Build failure with Clang 4.0.1: no matching conversion for functional-style cast from 'pointer' (aka 'unsigned short *') to 'WTF::String'
2215         https://bugs.webkit.org/show_bug.cgi?id=175477
2216
2217         Reviewed by Žan Doberšek.
2218
2219         * Shared/wpe/WebEventFactory.cpp:
2220         (WebKit::singleCharacterStringForKeyEvent): Cast to UChar* to make
2221         compiler choose the correct WTF::String constructor.
2222
2223 2017-08-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2224
2225         [Soup] Cannot access HTTPS sites using a HTTP proxy that requires authentication
2226         https://bugs.webkit.org/show_bug.cgi?id=175378
2227
2228         Reviewed by Sergio Villar Senin.
2229
2230         In case of HTTPS resource with a proxy, libsoup uses a tunnel internally, that uses its own SoupMessage during
2231         the proxy authentication. We were ignoring authentication requests for other messages.
2232
2233         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2234         (WebKit::NetworkDataTaskSoup::authenticateCallback): Only return early if the message does't match and it's not
2235         HTTPS resource over a proxy.
2236         (WebKit::NetworkDataTaskSoup::authenticate): Use the soup message from the authentication challenge.
2237         (WebKit::NetworkDataTaskSoup::continueAuthenticate): Ditto.
2238
2239 2017-08-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2240
2241         [Soup] Do not spawn the network process to setup cookie persistent storage
2242         https://bugs.webkit.org/show_bug.cgi?id=175424
2243
2244         Reviewed by Sergio Villar Senin.
2245
2246         The persistent storage configuration is saved and passed to network process as creation parameters, so we don't
2247         need to spawn the network process to configure it, when it's created eventually it will use the configuration.
2248
2249         * UIProcess/soup/WebCookieManagerProxySoup.cpp:
2250         (WebKit::WebCookieManagerProxy::setCookiePersistentStorage): Use sendToNetworkingProcess() instead of
2251         endToNetworkingProcessRelaunchingIfNecessary().
2252
2253 2017-08-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2254
2255         [GTK][WPE] Assertion failure in TimerBase inside WebCore::IconRecord::setImageData
2256         https://bugs.webkit.org/show_bug.cgi?id=173866
2257         <rdar://problem/33122050>
2258
2259         Reviewed by Michael Catanzaro.
2260
2261         IconDatabase creates and destroys IconRecord objects in both database and main thread. If the IconRecord has a
2262         valid icon, its Image could be created in one thread and destroyed in another, something that is not expected to
2263         happen, because Image has a Timer member. Since we have all the data and we are decoding it right after creating
2264         the Image, we don't really need to keep the Image object around, we could simply take a reference of the encoded
2265         data and the decoded native image to be returned by synchronousIconForPageURL().
2266
2267         * UIProcess/API/glib/IconDatabase.cpp:
2268         (WebKit::IconDatabase::IconRecord::image): Return NativeImagePtr now.
2269         (WebKit::IconDatabase::IconRecord::setImageData): Create a BitmapImage to decode it and keep a reference to the
2270         encoded data and decoded native image.
2271         (WebKit::IconDatabase::IconRecord::snapshot const): Use m_imageData to get the encoded data.
2272         (WebKit::IconDatabase::synchronousIconForPageURL): Return the native image and whether the icon is known or not.
2273         (WebKit::IconDatabase::IconRecord::loadImageFromResource): Deleted.
2274         * UIProcess/API/glib/IconDatabase.h:
2275         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
2276         (getIconSurfaceSynchronously): Use new API.
2277
2278 2017-08-10  Dan Bernstein  <mitz@apple.com>
2279
2280         Restored svn:ignore values that went missing when the project got renamed.
2281
2282         * WebKit.xcodeproj: Added property svn:ignore.
2283
2284 2017-08-10  Brady Eidson  <beidson@apple.com>
2285
2286         Rename the source files for the WTF persistent coders.
2287         https://bugs.webkit.org/show_bug.cgi?id=175441
2288
2289         Reviewed by Tim Horton.
2290
2291         * NetworkProcess/cache/NetworkCacheCoders.h:
2292         * NetworkProcess/cache/NetworkCacheKey.cpp:
2293         * NetworkProcess/cache/NetworkCacheKey.h:
2294         * UIProcess/API/APIContentRuleListStore.cpp:
2295
2296 2017-08-10  John Wilander  <wilander@apple.com>
2297
2298         Resource Load Statistics: Increase grandfathering time to 7 days
2299         https://bugs.webkit.org/show_bug.cgi?id=175414
2300         <rdar://problem/33818046>
2301
2302         Reviewed by Brent Fulgham.
2303
2304         * UIProcess/WebResourceLoadStatisticsStore.h:
2305
2306 2017-08-10  John Wilander  <wilander@apple.com>
2307
2308         Resource Load Statistics: Add significant figures to telemetry calls
2309         https://bugs.webkit.org/show_bug.cgi?id=175442
2310         <rdar://problem/33834834>
2311
2312         Reviewed by Brent Fulgham.
2313
2314         With this change, logged values are allowed to have 3 significant figures
2315         as opposed to today's 0 which is wrong.
2316
2317         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
2318         (WebKit::submitTopList):
2319         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
2320
2321 2017-08-10  Mark Lam  <mark.lam@apple.com>
2322
2323         Apply the UNLIKELY macro to some unlikely things.
2324         https://bugs.webkit.org/show_bug.cgi?id=175440
2325         <rdar://problem/33834767>
2326
2327         Reviewed by Yusuke Suzuki.
2328
2329         * WebProcess/WebPage/WebPage.cpp:
2330         (WebKit::WebPage::getBytecodeProfile):
2331
2332 2017-08-10  Chris Dumez  <cdumez@apple.com>
2333
2334         Turn on support for Beacon API by default in STP
2335         https://bugs.webkit.org/show_bug.cgi?id=175445
2336         <rdar://problem/33836379>
2337
2338         Reviewed by Youenn Fablet.
2339
2340         * Shared/WebPreferencesDefinitions.h:
2341
2342 2017-08-10  Ross Kirsling  <ross.kirsling@sony.com>
2343
2344         Fix iOS simulator build after change "[WTF] Move TextStream into WTF"
2345         https://bugs.webkit.org/show_bug.cgi?id=175211
2346
2347         Reviewed by Myles C. Maxfield.
2348
2349         * UIProcess/API/Cocoa/WKWebView.mm:
2350         (-[WKWebView _scrollByContentOffset:]):
2351         (-[WKWebView _navigationGestureDidBegin]):
2352
2353 2017-08-10  Chris Dumez  <cdumez@apple.com>
2354
2355         [Beacon] Do connect-src CSP check on redirects as well
2356         https://bugs.webkit.org/show_bug.cgi?id=175410
2357         <rdar://problem/33815470>
2358
2359         Reviewed by Youenn Fablet.
2360
2361         Pass CSP Response headers to the NetworkProcess via NetworkResourceLoadParameters
2362         when doing a PingLoad. This allows PingLoad to do CSP checks (in particular
2363         connect-src ones) in case the ping load gets redirected. Those checks need to be
2364         done on the NetworkProcess side at this point because there is no guarantee the
2365         WebContent process is still around.
2366
2367         To do the CSP checks, PingLoad lazily reconstructs a ContentSecurityPolicy object
2368         from the CSP response headers.
2369
2370         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2371         (WebKit::NetworkResourceLoadParameters::encode const):
2372         (WebKit::NetworkResourceLoadParameters::decode):
2373         * NetworkProcess/NetworkResourceLoadParameters.h:
2374         * NetworkProcess/PingLoad.cpp:
2375         (WebKit::PingLoad::willPerformHTTPRedirection):
2376         (WebKit::PingLoad::contentSecurityPolicy):
2377         * NetworkProcess/PingLoad.h:
2378         * WebProcess/Network/WebLoaderStrategy.cpp:
2379         (WebKit::WebLoaderStrategy::createPingHandle):
2380         * WebProcess/Network/WebLoaderStrategy.h:
2381
2382 2017-08-10  Brian Burg  <bburg@apple.com>
2383
2384         WKPreferences should conform to NSCopying
2385         https://bugs.webkit.org/show_bug.cgi?id=175303
2386         <rdar://problem/33764939>
2387
2388         Reviewed by Dan Bernstein.
2389
2390         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2391         Add conformance in the private header, as there is not consensus that this
2392         needs to be API.
2393
2394         * UIProcess/API/Cocoa/WKPreferences.mm:
2395         (-[WKPreferences copyWithZone:]):
2396         Copy the wrapped WebPreferences instance and return its wrapper.
2397
2398 2017-08-10  Michael Catanzaro  <mcatanzaro@igalia.com>
2399
2400         REGRESSION(r220515) [GTK][CMake] Build with ENABLE_GEOLOCATION fails on Debian Jessie
2401         https://bugs.webkit.org/show_bug.cgi?id=175426
2402
2403         Reviewed by Carlos Alberto Lopez Perez.
2404
2405         * PlatformGTK.cmake:
2406
2407 2017-08-10  Brady Eidson  <beidson@apple.com>
2408
2409         Add ServiceWorkerJob.
2410         https://bugs.webkit.org/show_bug.cgi?id=175241
2411
2412         Reviewed by Tim Horton.
2413
2414         * CMakeLists.txt:
2415         * WebKit.xcodeproj/project.pbxproj:
2416
2417         * WebProcess/Storage/WebServiceWorkerProvider.cpp: Added.
2418         (WebKit::WebServiceWorkerProvider::singleton):
2419         (WebKit::WebServiceWorkerProvider::WebServiceWorkerProvider):
2420         (WebKit::WebServiceWorkerProvider::scheduleJob):
2421         * WebProcess/Storage/WebServiceWorkerProvider.h: Added.
2422
2423         * WebProcess/WebProcess.cpp:
2424         (WebKit::WebProcess::initializeWebProcess):
2425
2426 2017-08-10  Tim Horton  <timothy_horton@apple.com>
2427
2428         Remove some unused lambda captures so that WebKit builds with -Wunused-lambda-capture
2429         https://bugs.webkit.org/show_bug.cgi?id=175436
2430         <rdar://problem/33667497>
2431
2432         Reviewed by Simon Fraser.
2433
2434         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2435         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2436         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2437         (WebKit::WebsiteDataStore::topPrivatelyControlledDomainsWithWebsiteData):
2438
2439 2017-08-10  Michael Catanzaro  <mcatanzaro@igalia.com>
2440
2441         Remove ENABLE_GAMEPAD_DEPRECATED
2442         https://bugs.webkit.org/show_bug.cgi?id=175361
2443
2444         Reviewed by Carlos Garcia Campos.
2445
2446         * Configurations/FeatureDefines.xcconfig:
2447
2448 2017-08-10  Zan Dobersek  <zdobersek@igalia.com>
2449
2450         [GTK] Don't use --whole-archive linking flags for the WebKit2 target libraries
2451         https://bugs.webkit.org/show_bug.cgi?id=175416
2452
2453         Reviewed by Carlos Garcia Campos.
2454
2455         * PlatformGTK.cmake: Drop the ADD_WHOLE_ARCHIVE_TO_LIBRARIES instruction
2456         for the WebKit2 target. This unnecessarily bundles complete archive
2457         files both into the main .so library as well as single executables that
2458         are linked against the WebKit2 target.
2459
2460 2017-08-09  Chris Dumez  <cdumez@apple.com>
2461
2462         Disable Beacon API on WK1 DRT and WK2 when not using NETWORK_SESSION
2463         https://bugs.webkit.org/show_bug.cgi?id=175401
2464
2465         Reviewed by Brady Eidson.
2466
2467         * UIProcess/API/C/WKPreferences.cpp:
2468         (WKPreferencesSetBeaconAPIEnabled):
2469         (WKPreferencesGetBeaconAPIEnabled):
2470         * WebProcess/WebPage/WebPage.cpp:
2471         (WebKit::WebPage::updatePreferences):
2472         * config.h:
2473
2474 2017-08-09  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
2475
2476         [PAL] Move spi/cocoa and spi/cg directories into PAL
2477         https://bugs.webkit.org/show_bug.cgi?id=175175
2478
2479         Reviewed by Myles C. Maxfield.
2480
2481         * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
2482         * NetworkProcess/Downloads/mac/DownloadMac.mm:
2483         * Platform/cocoa/SharedMemoryCocoa.cpp:
2484         * Platform/mac/LayerHostingContext.mm:
2485         * Shared/Cocoa/DataDetectionResult.mm:
2486         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
2487         * Shared/cf/CookieStorageUtilsCF.mm:
2488         * Shared/ios/InteractionInformationAtPosition.mm:
2489         * Shared/mac/HangDetectionDisablerMac.mm:
2490         * Shared/mac/RemoteLayerBackingStore.mm:
2491         * Shared/mac/RemoteLayerTreePropertyApplier.mm:
2492         * UIProcess/API/Cocoa/WKWebView.mm:
2493         * UIProcess/API/mac/WKView.mm:
2494         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
2495         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2496         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
2497         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2498         * UIProcess/Cocoa/WebViewImpl.h:
2499         * UIProcess/Cocoa/WebViewImpl.mm:
2500         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2501         * UIProcess/ios/ViewGestureControllerIOS.mm:
2502         * UIProcess/ios/WKContentView.mm:
2503         * UIProcess/ios/WKContentViewInteraction.mm:
2504         * UIProcess/ios/WKPDFPageNumberIndicator.mm:
2505         * UIProcess/ios/WKScrollView.mm:
2506         * UIProcess/mac/RemoteLayerTreeHost.mm:
2507         * UIProcess/mac/ServicesController.mm:
2508         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2509         * UIProcess/mac/ViewGestureControllerMac.mm:
2510         * UIProcess/mac/ViewSnapshotStore.mm:
2511         * UIProcess/mac/WKViewLayoutStrategy.mm:
2512         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2513         * WebProcess/WebPage/WebPage.cpp:
2514         * WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm:
2515         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
2516         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2517         * WebProcess/cocoa/WebProcessCocoa.mm:
2518
2519 2017-08-09  John Wilander  <wilander@apple.com>
2520
2521         Resource Load Statistics: Increase grandfathering time to 3 days
2522         https://bugs.webkit.org/show_bug.cgi?id=175414
2523         <rdar://problem/33818046>
2524
2525         Reviewed by Brent Fulgham.
2526
2527         * UIProcess/WebResourceLoadStatisticsStore.h:
2528
2529 2017-08-09  Jeremy Jones  <jeremyj@apple.com>
2530
2531         Invalidate PlaybackSessionManager in same fashion as VideoFullscreenManager.
2532         https://bugs.webkit.org/show_bug.cgi?id=175399
2533         rdar://problem/33663344
2534
2535         Reviewed by Eric Carlson.
2536
2537         Invalidate PlaybackSessionManager when WebPage is destructed.
2538
2539         * WebProcess/WebPage/WebPage.cpp:
2540         (WebKit::WebPage::~WebPage):
2541         * WebProcess/cocoa/PlaybackSessionManager.h:
2542         * WebProcess/cocoa/PlaybackSessionManager.mm:
2543         (WebKit::PlaybackSessionManager::~PlaybackSessionManager):
2544         (WebKit::PlaybackSessionManager::invalidate):
2545
2546 2017-08-09  Don Olmstead  <don.olmstead@sony.com>
2547
2548         [WTF] Move TextStream into WTF
2549         https://bugs.webkit.org/show_bug.cgi?id=175211
2550
2551         Reviewed by Myles C. Maxfield.
2552
2553         * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
2554         * Shared/VisibleContentRectUpdateInfo.cpp:
2555         * Shared/VisibleContentRectUpdateInfo.h:
2556         * Shared/mac/RemoteLayerTreeTransaction.mm:
2557         * UIProcess/API/Cocoa/WKWebView.mm:
2558         * UIProcess/ios/WKContentView.mm:
2559         * UIProcess/ios/WKContentViewInteraction.h:
2560         * UIProcess/ios/WKContentViewInteraction.mm:
2561         (WebKit::operator<<):
2562         * UIProcess/ios/WebPageProxyIOS.mm:
2563         * WebProcess/WebPage/ios/WebPageIOS.mm:
2564         * WebProcess/WebPage/mac/PlatformCAAnimationRemote.h:
2565         * WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm:
2566
2567 2017-08-09  Andy Estes  <aestes@apple.com>
2568
2569         Part 3 of: Rename DatabaseProcess to StorageProcess
2570         https://bugs.webkit.org/show_bug.cgi?id=175034
2571
2572         Reviewed by Brady Eidson.
2573
2574         We tried renaming com.apple.WebKit.Databases to com.apple.WebKit.Storage in r219986, but
2575         this prevented trunk WebKit from running on iOS 11 devices. This is because launchd keeps a
2576         codesigned cache of XPC services, and refuses to launch services that aren't in the cache.
2577
2578         It's not possibe for us to rebuild the cache with the new service name (only Apple's
2579         production build system can do this), and disabling the cache or opting WebKit's XPC
2580         services out of the cache might have a negative impact on our performance testing.
2581
2582         For now we'll retain the name "com.apple.WebKit.Databases" on iOS 11 devices to work around
2583         this issue. If we find a way to allow the new service to run without impacting performance,
2584         we can revert this change.
2585
2586         We will rename the service to "com.apple.WebKit.Storage" on macOS and iOS Simulator, and in
2587         a follow-up patch we'll use the new service name on post-iOS 11 device builds.
2588
2589         * Configurations/BaseTarget.xcconfig: Defined WK_STORAGE_SERVICE_PRODUCT_NAME to be
2590         com.apple.WebKit.Databases by default, and overrode it to com.apple.WebKit.Storage on macOS
2591         and iOS Simulator.
2592         * Configurations/StorageService.xcconfig: Changed PRODUCT_NAME to $(WK_STORAGE_SERVICE_PRODUCT_NAME).
2593         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2594         (WebKit::serviceName): Changed to return "com.apple.WebKit.Storage" on macOS and
2595         iOS Simulator platforms.
2596         * WebKit.xcodeproj/project.pbxproj: Updated the "Copy XPC services for engineering builds"
2597         build phase to use WK_STORAGE_SERVICE_PRODUCT_NAME.
2598
2599 2017-08-09  Commit Queue  <commit-queue@webkit.org>
2600
2601         Unreviewed, rolling out r220466, r220477, and r220487.
2602         https://bugs.webkit.org/show_bug.cgi?id=175411
2603
2604         This change broke existing API tests and follow up fixes did
2605         not resolve all the issues. (Requested by ryanhaddad on
2606         #webkit).
2607
2608         Reverted changesets:
2609
2610         https://bugs.webkit.org/show_bug.cgi?id=175244
2611         http://trac.webkit.org/changeset/220466
2612
2613         "WTF::Function does not allow for reference / non-default
2614         constructible return types"
2615         https://bugs.webkit.org/show_bug.cgi?id=175244
2616         http://trac.webkit.org/changeset/220477
2617
2618         https://bugs.webkit.org/show_bug.cgi?id=175244
2619         http://trac.webkit.org/changeset/220487
2620
2621 2017-08-09  Chris Dumez  <cdumez@apple.com>
2622
2623         [Beacon][NetworkSession] Support CORS-preflighting on redirects
2624         https://bugs.webkit.org/show_bug.cgi?id=175386
2625         <rdar://problem/33801370>
2626
2627         Reviewed by Youenn Fablet.
2628
2629         Add support to Beacon for doing CORS-preflighting upon redirect to a different
2630         domain.
2631
2632         * NetworkProcess/NetworkCORSPreflightChecker.h:
2633         * NetworkProcess/PingLoad.cpp:
2634         (WebKit::PingLoad::PingLoad):
2635         (WebKit::PingLoad::~PingLoad):
2636         (WebKit::PingLoad::loadRequest):
2637         (WebKit::PingLoad::securityOrigin const):
2638         (WebKit::PingLoad::willPerformHTTPRedirection):
2639         (WebKit::PingLoad::didReceiveResponseNetworkSession):
2640         (WebKit::PingLoad::needsCORSPreflight const):
2641         (WebKit::PingLoad::doCORSPreflight):
2642         * NetworkProcess/PingLoad.h:
2643
2644 2017-08-09  Jeremy Jones  <jeremyj@apple.com>
2645
2646         Use MPAVRoutingController instead of deprecated versions.
2647         https://bugs.webkit.org/show_bug.cgi?id=175063
2648         rdar://problem/33301230
2649
2650         Reviewed by Tim Horton.
2651
2652         Remove dependence on deprecated classes MPAVRoutingSheet and MPAudioVideoRoutingPopoverController.
2653
2654         * UIProcess/ios/forms/WKAirPlayRoutePicker.h:
2655         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
2656         (-[WKAirPlayRoutePicker dealloc]):
2657         (-[WKAirPlayRoutePicker show:fromRect:]):
2658         (-[WKAirPlayRoutePicker popoverControllerDidDismissPopover:]): Deleted.
2659         (-[WKAirPlayRoutePicker _presentAirPlayPopoverAnimated:fromRect:]): Deleted.
2660         (-[WKAirPlayRoutePicker _windowWillRotate:]): Deleted.
2661         (-[WKAirPlayRoutePicker _windowDidRotate:]): Deleted.
2662         (-[WKAirPlayRoutePicker _dismissAirPlayRoutePickerIPad]): Deleted.
2663         (-[WKAirPlayRoutePicker showAirPlayPickerIPad:fromRect:]): Deleted.
2664         (-[WKAirPlayRoutePicker showAirPlayPickerIPhone:]): Deleted.
2665
2666 2017-08-09  Sam Weinig  <sam@webkit.org>
2667
2668         WTF::Function does not allow for reference / non-default constructible return types
2669         https://bugs.webkit.org/show_bug.cgi?id=175244
2670
2671         Reviewed by Chris Dumez.
2672
2673         * UIProcess/WebResourceLoadStatisticsStore.h:
2674         Update the default value for the updateCookiePartitioningForDomainsHandler parameter to be an 
2675         empty lambda, rather than default initialization, which leads to a null WTF::Function. This allows
2676         us to remove support for calling null WTF::Function. No change in behavior.
2677
2678 2017-08-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2679
2680         [iOS DnD] ENABLE_DRAG_SUPPORT should be turned off for iOS 10 and enabled by default
2681         https://bugs.webkit.org/show_bug.cgi?id=175392
2682         <rdar://problem/33783207>
2683
2684         Reviewed by Tim Horton and Megan Gardner.
2685
2686         Tweak FeatureDefines to enable drag and drop by default, and disable only on unsupported platforms (i.e. iOS 10).
2687
2688         * Configurations/FeatureDefines.xcconfig:
2689
2690 2017-08-09  Brady Eidson  <beidson@apple.com>
2691
2692         ServiceWorker experimental feature should not be on by default (definitely not ready).
2693         https://bugs.webkit.org/show_bug.cgi?id=175389
2694
2695         Rubberstamped by Andy Estes.
2696
2697         * Shared/WebPreferencesDefinitions.h: false, not DEFAULT_EXPERIMENTAL_FEATURES_ENABLED
2698
2699 2017-08-09  Ryan Haddad  <ryanhaddad@apple.com>
2700
2701         Unreviewed, rolling out r220457.
2702
2703         This change introduced API test failures.
2704
2705         Reverted changeset:
2706
2707         "WTF::Function does not allow for reference / non-default
2708         constructible return types"
2709         https://bugs.webkit.org/show_bug.cgi?id=175244
2710         http://trac.webkit.org/changeset/220457
2711
2712 2017-08-09  Daniel Bates  <dabates@apple.com>
2713
2714         REGRESSION (r219013): OAuth flows are broken when redirecting back to application after authentication
2715         https://bugs.webkit.org/show_bug.cgi?id=175247
2716         <rdar://problem/33679804>
2717
2718         Reviewed by Brady Eidson.
2719
2720         Add SPI WKNavigationAction._isRedirect to query whether the navigation was in response to receiving
2721         a redirect response. The majority of the WebKit change is plumbing this knowledge through to connect
2722         it with the SPI.
2723
2724         * Shared/NavigationActionData.cpp:
2725         (WebKit::NavigationActionData::encode const):
2726         (WebKit::NavigationActionData::decode):
2727         Encode and decode the boolean NavigationActionData::isRedirect.
2728         * Shared/NavigationActionData.h:
2729         * UIProcess/API/APINavigationAction.h:
2730         * UIProcess/API/Cocoa/WKNavigationAction.mm:
2731         (-[WKNavigationAction _isRedirect]): Added.
2732         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
2733         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2734         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Set NavigationActionData::isRedirect
2735         depending on whether the navigation is in response to receiving a redirect response.
2736         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2737
2738 2017-08-09  Sam Weinig  <sam@webkit.org>
2739
2740         WTF::Function does not allow for reference / non-default constructible return types
2741         https://bugs.webkit.org/show_bug.cgi?id=175244
2742
2743         Reviewed by Chris Dumez.
2744
2745         * UIProcess/WebResourceLoadStatisticsStore.h:
2746         Update the default value for the updateCookiePartitioningForDomainsHandler parameter to be an 
2747         empty lambda, rather than default initialization, which leads to a null WTF::Function. This allows
2748         us to remove support for calling null WTF::Function. No change in behavior.
2749
2750 2017-08-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2751
2752         Unreviewed, rolling out r220393.
2753
2754         This patch regresses the performance of WebPage::editorState.
2755
2756         Reverted changeset:
2757
2758         "[iOS WK2] WKWebView schedules nonstop layout after pressing
2759         cmb+b,i,u inside a contenteditable div"
2760         https://bugs.webkit.org/show_bug.cgi?id=175116
2761         http://trac.webkit.org/changeset/220393
2762
2763 2017-08-08  Chris Dumez  <cdumez@apple.com>
2764
2765         [Beacon] Add support for CORS-preflighting for WK2 / NETWORK_SESSION
2766         https://bugs.webkit.org/show_bug.cgi?id=175264
2767         <rdar://problem/33547793>
2768
2769         Reviewed by Youenn Fablet.
2770
2771         Implement CORS-preflighting for beacons with a payload that has a non
2772         safelisted MIME type, as per:
2773         - https://w3c.github.io/beacon/#privacy
2774         - https://www.w3.org/TR/beacon/#sec-processing-model
2775
2776         CORS-preflighting is completely handled on Network Process side because
2777         a beacon request can outlive its page and therefore its WebContent
2778         process. This requires us to pass a little more information to the
2779         Network process, in particular the source origin and the corsMode.
2780
2781         The current implementation does not currently deal with CORS preflights
2782         needed upon a redirect. This will be added in a follow-up.
2783
2784         * CMakeLists.txt:
2785         * NetworkProcess/NetworkCORSPreflightChecker.cpp: Added.
2786         (WebKit::NetworkCORSPreflightChecker::NetworkCORSPreflightChecker):
2787         (WebKit::NetworkCORSPreflightChecker::~NetworkCORSPreflightChecker):
2788         (WebKit::NetworkCORSPreflightChecker::startPreflight):
2789         (WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection):
2790         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
2791         (WebKit::NetworkCORSPreflightChecker::didReceiveResponseNetworkSession):
2792         (WebKit::NetworkCORSPreflightChecker::didReceiveData):
2793         (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
2794         (WebKit::NetworkCORSPreflightChecker::didSendData):
2795         (WebKit::NetworkCORSPreflightChecker::wasBlocked):
2796         (WebKit::NetworkCORSPreflightChecker::cannotShowURL):
2797         * NetworkProcess/NetworkCORSPreflightChecker.h: Added.
2798         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2799         (WebKit::NetworkConnectionToWebProcess::loadPing):
2800         * NetworkProcess/NetworkConnectionToWebProcess.h:
2801         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2802         (WebKit::NetworkResourceLoadParameters::encode const):
2803         (WebKit::NetworkResourceLoadParameters::decode):
2804         * NetworkProcess/NetworkResourceLoadParameters.h:
2805         * NetworkProcess/PingLoad.cpp: Added.
2806         (WebKit::PingLoad::PingLoad):
2807         (WebKit::PingLoad::~PingLoad):
2808         (WebKit::PingLoad::startNetworkLoad):
2809         (WebKit::PingLoad::willPerformHTTPRedirection):
2810         (WebKit::PingLoad::didReceiveChallenge):
2811         (WebKit::PingLoad::didReceiveResponseNetworkSession):
2812         (WebKit::PingLoad::didReceiveData):
2813         (WebKit::PingLoad::didCompleteWithError):
2814         (WebKit::PingLoad::didSendData):
2815         (WebKit::PingLoad::wasBlocked):
2816         (WebKit::PingLoad::cannotShowURL):
2817         (WebKit::PingLoad::timeoutTimerFired):
2818         (WebKit::PingLoad::needsCORSPreflight const):
2819         (WebKit::PingLoad::doCORSPreflight):
2820         * NetworkProcess/PingLoad.h:
2821         * WebKit.xcodeproj/project.pbxproj:
2822         * WebProcess/Network/WebLoaderStrategy.cpp:
2823         (WebKit::WebLoaderStrategy::createPingHandle):
2824         * WebProcess/Network/WebLoaderStrategy.h:
2825
2826 2017-08-08  Megan Gardner  <megan_gardner@apple.com>
2827
2828         Remove old and unused pointIsInAssistedNode definition
2829         https://bugs.webkit.org/show_bug.cgi?id=175335
2830
2831         Stage removal here to allow removal from UIKit.
2832         Replaced by textInteractionGesture:shouldBeginAtPoint:
2833
2834         Reviewed by Tim Horton.
2835
2836         * Platform/spi/ios/UIKitSPI.h:
2837         * UIProcess/ios/WKContentViewInteraction.mm:
2838         (-[WKContentView pointIsInAssistedNode:]): Deleted.
2839
2840 2017-08-08  Michael Catanzaro  <mcatanzaro@igalia.com>
2841
2842         Unreviewed, fix Ubuntu LTS build
2843         https://bugs.webkit.org/show_bug.cgi?id=174490
2844
2845         * UIProcess/glib/RemoteInspectorClient.cpp:
2846         (WebKit::RemoteInspectorClient::RemoteInspectorClient):
2847
2848 2017-08-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2849
2850         Unreviewed, fix the Mac debug build after r220418.
2851
2852         * UIProcess/Cocoa/WebViewImpl.mm:
2853         (WebKit::WebViewImpl::prepareForMoveToWindow):
2854
2855 2017-08-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2856
2857         [Mac WK2] WebViewImpl should hold a weak pointer to its WKWebView or WKView
2858         https://bugs.webkit.org/show_bug.cgi?id=175302
2859         <rdar://problem/33762116>
2860
2861         Reviewed by Tim Horton.
2862
2863         Refactor WebViewImpl's m_view from a raw pointer to a WeakObjCPtr to ensure that it is automatically cleared out
2864         when the WKWebView or WKView are destroyed, and also changes several places where we implicitly block capture
2865         the WebViewImpl to only capture a WeakPtr to the WebViewImpl. Most of the changes here are boilerplate
2866         adjustments for how m_view is now a weak pointer.
2867
2868         Test: WKWebViewMacEditingTests.DoNotCrashWhenInterpretingKeyEventWhileDeallocatingView.
2869
2870         * Shared/mac/WeakObjCPtr.h:
2871         (WebKit::WeakObjCPtr::operator ValueType * const):
2872         * UIProcess/Cocoa/WebViewImpl.h:
2873         * UIProcess/Cocoa/WebViewImpl.mm:
2874         (WebKit::WebViewImpl::updateTouchBar):
2875         (WebKit::WebViewImpl::updateMediaTouchBar):
2876         (WebKit::WebViewImpl::WebViewImpl):
2877         (WebKit::WebViewImpl::~WebViewImpl):
2878         (WebKit::WebViewImpl::window):
2879         (WebKit::WebViewImpl::resignFirstResponder):
2880         (WebKit::WebViewImpl::isFocused const):
2881         (WebKit::WebViewImpl::renewGState):
2882         (WebKit::WebViewImpl::setFrameAndScrollBy):
2883         (WebKit::WebViewImpl::updateWindowAndViewFrames):
2884         (WebKit::WebViewImpl::updateLayer):
2885         (WebKit::WebViewImpl::printOperationWithPrintInfo):
2886         (WebKit::WebViewImpl::updateContentInsetsIfAutomatic):
2887         (WebKit::WebViewImpl::setLayoutMode):
2888         (WebKit::WebViewImpl::intrinsicDeviceScaleFactor const):
2889         (WebKit::WebViewImpl::windowDidBecomeKey):
2890         (WebKit::WebViewImpl::windowDidResignKey):
2891         (WebKit::WebViewImpl::windowDidChangeScreen):
2892         (WebKit::WebViewImpl::mightBeginDragWhileInactive):
2893         (WebKit::WebViewImpl::acceptsFirstMouse):
2894         (WebKit::WebViewImpl::shouldDelayWindowOrderingForEvent):
2895         (WebKit::WebViewImpl::windowResizeMouseLocationIsInVisibleScrollerThumb):
2896         (WebKit::WebViewImpl::viewWillMoveToWindow):
2897         (WebKit::WebViewImpl::viewDidMoveToWindow):
2898         (WebKit::WebViewImpl::viewDidChangeBackingProperties):
2899         (WebKit::WebViewImpl::hitTest):
2900         (WebKit::WebViewImpl::postFakeMouseMovedEventForFlagsChangedEvent):
2901         (WebKit::WebViewImpl::colorSpace):
2902         (WebKit::WebViewImpl::prepareForMoveToWindow):
2903         (WebKit::WebViewImpl::notifyInputContextAboutDiscardedComposition):
2904         (WebKit::WebViewImpl::pressureChangeWithEvent):
2905         (WebKit::WebViewImpl::fullScreenWindowController):
2906         (WebKit::WebViewImpl::executeSavedCommandBySelector):
2907         (WebKit::WebViewImpl::validRequestorForSendAndReturnTypes):
2908         (WebKit::WebViewImpl::handleRequestedCandidates):
2909         (WebKit::WebViewImpl::preferencesDidChange):
2910         (WebKit::WebViewImpl::setTextIndicator):
2911         (WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly):
2912         (WebKit::WebViewImpl::accessibilityRegisterUIProcessTokens):
2913         (WebKit::WebViewImpl::sendToolTipMouseExited):
2914         (WebKit::WebViewImpl::sendToolTipMouseEntered):
2915         (WebKit::WebViewImpl::toolTipChanged):
2916         (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer):
2917         (WebKit::WebViewImpl::updateThumbnailViewLayer):
2918         (WebKit::WebViewImpl::setInspectorAttachmentView):
2919         (WebKit::WebViewImpl::inspectorAttachmentView):
2920         (WebKit::WebViewImpl::draggedImage):
2921         (WebKit::WebViewImpl::draggingEntered):
2922         (WebKit::WebViewImpl::draggingUpdated):
2923         (WebKit::WebViewImpl::draggingExited):
2924         (WebKit::WebViewImpl::performDragOperation):
2925         (WebKit::WebViewImpl::hitTestForDragTypes):
2926         (WebKit::WebViewImpl::startWindowDrag):
2927         (WebKit::WebViewImpl::dragImageForView):
2928         (WebKit::WebViewImpl::setPromisedDataForImage):
2929         (WebKit::WebViewImpl::setPromisedDataForAttachment):
2930         (WebKit::WebViewImpl::takeViewSnapshot):
2931         (WebKit::WebViewImpl::scrollWheel):
2932         (WebKit::WebViewImpl::magnifyWithEvent):
2933         (WebKit::WebViewImpl::rotateWithEvent):
2934         (WebKit::WebViewImpl::doneWithKeyEvent):
2935         (WebKit::WebViewImpl::interpretKeyEvent):
2936         (WebKit::WebViewImpl::firstRectForCharacterRange):
2937         (WebKit::WebViewImpl::characterIndexForPoint):
2938         (WebKit::WebViewImpl::performKeyEquivalent):
2939         (WebKit::WebViewImpl::keyUp):
2940         (WebKit::WebViewImpl::keyDown):
2941         (WebKit::WebViewImpl::mouseMoved):
2942         (WebKit::WebViewImpl::windowIsFrontWindowUnderMouse):
2943         (WebKit::WebViewImpl::userInterfaceLayoutDirection):
2944
2945 2017-08-08  Filip Pizlo  <fpizlo@apple.com>
2946
2947         Baseline JIT should do caging
2948         https://bugs.webkit.org/show_bug.cgi?id=175037
2949
2950         Reviewed by Mark Lam.
2951         
2952         Use a better API to disable disabling the primitive gigacage.
2953
2954         * WebProcess/WebProcess.cpp:
2955         (WebKit::m_webSQLiteDatabaseTracker):
2956         (WebKit::primitiveGigacageDisabled): Deleted.
2957
2958 2017-08-08  John Wilander  <wilander@apple.com>
2959
2960         Resource Load Statistics: Clear web processes' state on history removal
2961         https://bugs.webkit.org/show_bug.cgi?id=175271
2962         <rdar://problem/33756560>
2963
2964         Reviewed by Chris Dumez.
2965
2966         https://bugs.webkit.org/show_bug.cgi?id=175090 introduced state
2967         in the web process and that state needs to be cleared when the
2968         UI process' statistics are cleared as part of history removal.
2969
2970         * UIProcess/WebProcessPool.cpp:
2971         (WebKit::WebProcessPool::clearResourceLoadStatistics):
2972         * UIProcess/WebProcessPool.h:
2973         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2974         (WebKit::WebsiteDataStore::removeData):
2975         (WebKit::WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses):
2976         * UIProcess/WebsiteData/WebsiteDataStore.h:
2977         * WebProcess/WebProcess.cpp:
2978         (WebKit::WebProcess::clearResourceLoadStatistics):
2979         * WebProcess/WebProcess.h:
2980         * WebProcess/WebProcess.messages.in:
2981
2982 2017-08-08  Adrian Perez de Castro  <aperez@igalia.com>
2983
2984         [WPE] Implement WebsiteDataStore::defaultApplicationCacheDirectory() and friends
2985         https://bugs.webkit.org/show_bug.cgi?id=175322
2986
2987         Reviewed by Carlos Garcia Campos.
2988
2989         This makes WPE use the same implementation as the GTK+ port, with a preprocessor switch to choose the name of
2990         the base directory inside the user XDG cache directory.
2991
2992         * PlatformGTK.cmake: Add APIWebsiteDataStoreGLib.cpp to the build sources and remove APIWebsiteDataStoreGtk.cpp.
2993         * PlatformWPE.cmake: Add APIWebsiteDataStoreGLib.cpp to the built sources.
2994         * UIProcess/API/APIWebsiteDataStore.cpp: Remove now dead code.
2995         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp: Renamed from Source/WebKit/UIProcess/API/gtk/APIWebsiteDataStoreGtk.cpp.
2996         (API::WebsiteDataStore::defaultApplicationCacheDirectory):
2997         (API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
2998         (API::WebsiteDataStore::defaultLocalStorageDirectory):
2999         (API::WebsiteDataStore::defaultMediaKeysStorageDirectory):
3000         (API::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
3001         (API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
3002
3003 2017-08-08  Ryan Haddad  <ryanhaddad@apple.com>
3004
3005         Unreviewed, rolling out r220368.
3006
3007         This change caused WK1 tests to exit early with crashes.
3008
3009         Reverted changeset:
3010
3011         "Baseline JIT should do caging"
3012         https://bugs.webkit.org/show_bug.cgi?id=175037
3013         http://trac.webkit.org/changeset/220368
3014
3015 2017-08-08  Michael Catanzaro  <mcatanzaro@igalia.com>
3016
3017         [CMake] Properly test if compiler supports compiler flags
3018         https://bugs.webkit.org/show_bug.cgi?id=174490
3019
3020         Reviewed by Konstantin Tokarev.
3021
3022         * CMakeLists.txt:
3023         * PlatformGTK.cmake:
3024
3025 2017-08-07  Carlos Garcia Campos  <cgarcia@igalia.com>
3026
3027         Web Automation: setUserInputForCurrentJavaScriptPrompt should fail if current dialog is not a prompt
3028         https://bugs.webkit.org/show_bug.cgi?id=175261
3029
3030         Reviewed by Brian Burg.
3031
3032         According to the spec, send alert text command should fail if the current dialog is not a prompt. This patch
3033         adds JavaScriptDialogType enum to API::AutomationSessionClient and a new virtual method to ask the client about
3034         the type of the current dialog. WebAutomationSession::setUserInputForCurrentJavaScriptPrompt() uses the new
3035         client method to check the type of the current dialog and fail in case it's not a prompt. Cocoa needs an
3036         implementation, for now it always returns Prompt as the type to keep compatibility.
3037
3038         18.4 Send Alert Text.
3039         https://w3c.github.io/webdriver/webdriver-spec.html#send-alert-text
3040
3041         This fixes selenium test testSettingTheValueOfAnAlertThrows.
3042
3043         * UIProcess/API/APIAutomationSessionClient.h:
3044         (API::AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage):
3045         * UIProcess/API/glib/WebKitAutomationSession.cpp:
3046         * UIProcess/API/glib/WebKitWebView.cpp:
3047         (webkitWebViewGetCurrentScriptDialogType):
3048         * UIProcess/API/glib/WebKitWebViewPrivate.h:
3049         * UIProcess/Automation/Automation.json:
3050         * UIProcess/Automation/WebAutomationSession.cpp:
3051         (WebKit::WebAutomationSession::setUserInputForCurrentJavaScriptPrompt):
3052         * UIProcess/Cocoa/AutomationSessionClient.h:
3053         * UIProcess/Cocoa/AutomationSessionClient.mm:
3054         (WebKit::AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage):
3055
3056 2017-08-08  Wenson Hsieh  <wenson_hsieh@apple.com>
3057
3058         [iOS WK2] WKWebView schedules nonstop layout after pressing cmb+b,i,u inside a contenteditable div
3059         https://bugs.webkit.org/show_bug.cgi?id=175116
3060         <rdar://problem/28279301>
3061
3062         Reviewed by Darin Adler and Ryosuke Niwa.
3063
3064         Refactors WebPage::editorState to only use the StyleProperties derived from EditingStyle, instead of inserting
3065         and removing a temporary node to figure out the style. Also adds hooks to notify the UI delegate of EditorState
3066         changes.
3067
3068         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3069         * UIProcess/API/Cocoa/WKWebView.mm:
3070         (nsTextAlignment):
3071         (dictionaryRepresentationForEditorState):
3072         (-[WKWebView _didChangeEditorState]):
3073
3074         Alerts the private UI delegate of UI-side EditorState updates.
3075
3076         (-[WKWebView _web_editorStateDidChange]):
3077         (-[WKWebView _executeEditCommand:argument:completion:]):
3078         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3079         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3080         * UIProcess/API/mac/WKView.mm:
3081         (-[WKView _web_editorStateDidChange]):
3082         * UIProcess/Cocoa/WebViewImpl.h:
3083         * UIProcess/Cocoa/WebViewImpl.mm:
3084         (WebKit::WebViewImpl::selectionDidChange):
3085         * UIProcess/WebPageProxy.cpp:
3086         (WebKit::WebPageProxy::executeEditCommand):
3087
3088         Change executeEditCommand(name, callback) to executeEditCommand(name, argument, callback) and lift out of iOS
3089         platform code and into WebPage.cpp.
3090
3091         * UIProcess/WebPageProxy.h:
3092         * UIProcess/ios/WKContentViewInteraction.mm:
3093         (-[WKContentView executeEditCommandWithCallback:]):
3094         (-[WKContentView _selectionChanged]):
3095         * UIProcess/ios/WebPageProxyIOS.mm:
3096         (WebKit::WebPageProxy::executeEditCommand): Deleted.
3097
3098         Move the iOS-specific implementation of executeEditCommand that invokes a callback when the web process responds
3099         out of WebPageProxyIOS, and into cross-platform WebPageProxy code. Additionally, add a parameter for the edit
3100         command's argument.
3101
3102         * WebProcess/WebPage/WebPage.cpp:
3103         (WebKit::WebPage::editorState const):
3104
3105         Use EditingStyle::styleAtSelectionStart instead of Editor::styleForSelectionStart when computing an EditorState.
3106         Tweak bold, italic and underline to use EditingStyle TriStates.
3107
3108         (WebKit::shouldEnsureEditorStateUpdateAfterExecutingCommand):
3109         (WebKit::WebPage::executeEditCommandWithCallback):
3110         * WebProcess/WebPage/WebPage.h:
3111         * WebProcess/WebPage/WebPage.messages.in:
3112         * WebProcess/WebPage/ios/WebPageIOS.mm:
3113         (WebKit::WebPage::executeEditCommandWithCallback): Deleted.
3114
3115 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
3116
3117         [TexMap] Don't expose GraphicsContext3D object
3118         https://bugs.webkit.org/show_bug.cgi?id=175310
3119
3120         Reviewed by Carlos Garcia Campos.
3121
3122         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3123         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
3124         Stop using GraphicsContext3D directly and instead use the
3125         TextureMapper::clearColor() method to achieve the same result.
3126
3127 2017-08-07  Carlos Garcia Campos  <cgarcia@igalia.com>
3128
3129         [GTK] Implement JavaScript dialog methods of API::AutomationSessionClient
3130         https://bugs.webkit.org/show_bug.cgi?id=175259
3131
3132         Reviewed by Michael Catanzaro.
3133
3134         Move the default implementation of WebKitScriptDialog from WebKitWebView platform specific files to their own
3135         files. Implement all JavaScript dialog methods of API::AutomationSessionClient in WebKitAutomationSession. For
3136         now it only works when the user doesn't override WebKitWebView::script-dialog signal and default implementation
3137         is used.
3138
3139         * PlatformGTK.cmake: Add new files to compilation.
3140         * PlatformWPE.cmake: Ditto.
3141         * UIProcess/API/glib/WebKitAutomationSession.cpp:
3142         (webkitAutomationSessionCreate): Pass the WebKitWebContext to the constructor and keep a pointer to it in session.
3143         * UIProcess/API/glib/WebKitAutomationSessionPrivate.h:
3144         * UIProcess/API/glib/WebKitScriptDialogPrivate.h:
3145         * UIProcess/API/glib/WebKitWebContext.cpp:
3146         * UIProcess/API/glib/WebKitWebView.cpp:
3147         (webkitWebViewRunJavaScriptAlert): Set the currently script dialog for the scope of the function.
3148         (webkitWebViewRunJavaScriptConfirm): Ditto.
3149         (webkitWebViewRunJavaScriptPrompt): Ditto.
3150         (webkitWebViewRunJavaScriptBeforeUnloadConfirm): Ditto.
3151         (webkitWebViewIsShowingScriptDialog): Ask current dialog if there's one.
3152         (webkitWebViewGetCurrentScriptDialogMessage): Ditto.
3153         (webkitWebViewSetCurrentScriptDialogUserInput): Ditto.
3154         (webkitWebViewAcceptCurrentScriptDialog): Ditto.
3155         (webkitWebViewDismissCurrentScriptDialog): Ditto.
3156         * UIProcess/API/glib/WebKitWebViewPrivate.h:
3157         * UIProcess/API/gtk/WebKitScriptDialogGtk.cpp: Added.
3158         (webkitWebViewCreateJavaScriptDialog): Moved from WebKitWebViewGtk.cpp.
3159         (webkitScriptDialogRun): Run the dialog, this code is moved from WebKitWebViewGtk.cpp.
3160         (webkitScriptDialogIsRunning): Return true if the script dialog has a native dialog running.
3161         (webkitScriptDialogAccept): Send Ok or Close response to the native dialog depending on the dialog type.
3162         (webkitScriptDialogDismiss): Send Close response to the native dialog.
3163         (webkitScriptDialogSetUserInput): Set the given text on the prompt dialog entry.
3164         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
3165         (webkitWebViewScriptDialog): Simply call webkitScriptDialogRun() now.
3166         * UIProcess/API/wpe/WebKitScriptDialogWPE.cpp: Copied from Source/WebKit/UIProcess/API/glib/WebKitAutomationSessionPrivate.h.
3167         (webkitScriptDialogRun):
3168         (webkitScriptDialogIsRunning):
3169         (webkitScriptDialogAccept):
3170         (webkitScriptDialogDismiss):
3171         (webkitScriptDialogSetUserInput):
3172
3173 2017-08-07  Devin Rousso  <drousso@apple.com>
3174
3175         Web Inspector: Preview Canvas path when viewing a recording
3176         https://bugs.webkit.org/show_bug.cgi?id=174967
3177
3178         Reviewed by Brian Burg.
3179
3180         * Shared/WebPreferencesDefinitions.h:
3181         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3182         * UIProcess/API/C/WKPreferences.cpp:
3183         (WKPreferencesSetInspectorAdditionsEnabled):
3184         (WKPreferencesGetInspectorAdditionsEnabled):
3185         * WebProcess/WebPage/WebPage.cpp:
3186         (WebKit::WebPage::updatePreferences):
3187         Add plumbing for new InspectorAdditions runtime flag.
3188
3189         * WebProcess/WebPage/WebInspectorUI.cpp:
3190         (WebKit::WebInspectorUI::WebInspectorUI):
3191         Enable InspectorAdditions by default in the WebInspector page.
3192
3193 2017-08-07  Filip Pizlo  <fpizlo@apple.com>
3194
3195         Baseline JIT should do caging
3196         https://bugs.webkit.org/show_bug.cgi?id=175037
3197
3198         Reviewed by Mark Lam.
3199         
3200         Use a better API to disable disabling the primitive gigacage.
3201
3202         * WebProcess/WebProcess.cpp:
3203         (WebKit::m_webSQLiteDatabaseTracker):
3204         (WebKit::primitiveGigacageDisabled): Deleted.
3205
3206 2017-08-06  Filip Pizlo  <fpizlo@apple.com>
3207
3208         Primitive auxiliaries and JSValue auxiliaries should have separate gigacages
3209         https://bugs.webkit.org/show_bug.cgi?id=174919
3210
3211         Reviewed by Keith Miller.
3212         
3213         The disable callback is all about the primitive gigacage.
3214
3215         * WebProcess/WebProcess.cpp:
3216         (WebKit::primitiveGigacageDisabled):
3217         (WebKit::m_webSQLiteDatabaseTracker):
3218         (WebKit::gigacageDisabled): Deleted.
3219
3220 2017-08-07  Brian Burg  <bburg@apple.com>
3221
3222         Remove CANVAS_PATH compilation guard
3223         https://bugs.webkit.org/show_bug.cgi?id=175207
3224
3225         Reviewed by Sam Weinig.
3226
3227         * Configurations/FeatureDefines.xcconfig:
3228
3229 2017-08-07  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3230
3231         [WPE][CMake] Only pass pkg-config CFLAGS from (E)GL when not using libepoxy.
3232         https://bugs.webkit.org/show_bug.cgi?id=175125
3233
3234         Reviewed by Michael Catanzaro.
3235
3236         * CMakeLists.txt: When using libepoxy avoid passing the CFLAGS from (E)GL,
3237         and instead pass the libepoxy ones.
3238
3239 2017-08-07  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3240
3241         [GTK][WPE] CFLAGS from pkg-config for (E)GL are not passed to WebKit
3242         https://bugs.webkit.org/show_bug.cgi?id=175125
3243
3244         Unreviewed follow-up fix after r220326.
3245
3246         * CMakeLists.txt: Move the block appending to WebKit2_LIBRARIES
3247         below where the list itself is created.
3248
3249 2017-08-05  Carlos Garcia Campos  <cgarcia@igalia.com>
3250
3251         [GTK][WPE] Add API to provide browser information required by automation
3252         https://bugs.webkit.org/show_bug.cgi?id=175130
3253
3254         Reviewed by Michael Catanzaro.
3255
3256         When a new automation session is started, the web driver receives some required capabilities from the client,
3257         like browser name and version. The session should be rejected if those required capabilities don't match with
3258         the actual browser that is launched. We don't know that information in WebKit, so we need to add API so that
3259         users can provide it when a new session request is made. This patch adds boxed object WebKitApplicationInfo that
3260         can be used to set the application name and version. This object can be set to a WebKitAutomationSession when
3261         WebKitWebContext::automation-started signal is emitted.
3262
3263         * PlatformGTK.cmake:
3264         * PlatformWPE.cmake:
3265         * UIProcess/API/glib/WebKitApplicationInfo.cpp: Added.
3266         (webkit_application_info_new):
3267         (webkit_application_info_ref):
3268         (webkit_application_info_unref):
3269         (webkit_application_info_set_name):
3270         (webkit_application_info_get_name):
3271         (webkit_application_info_set_version):
3272         (webkit_application_info_get_version):
3273         * UIProcess/API/glib/WebKitAutomationSession.cpp:
3274         (webkitAutomationSessionDispose):
3275         (webkit_automation_session_class_init):
3276         (webkitAutomationSessionGetBrowserName):
3277         (webkitAutomationSessionGetBrowserVersion):
3278         (webkit_automation_session_set_application_info):
3279         (webkit_automation_session_get_application_info):
3280         * UIProcess/API/glib/WebKitAutomationSessionPrivate.h:
3281         * UIProcess/API/glib/WebKitWebContext.cpp:
3282         * UIProcess/API/gtk/WebKitApplicationInfo.h: Added.
3283         * UIProcess/API/gtk/WebKitAutomationSession.h:
3284         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
3285         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
3286         * UIProcess/API/gtk/webkit2.h:
3287         * UIProcess/API/wpe/WebKitApplicationInfo.h: Added.
3288         * UIProcess/API/wpe/WebKitAutomationSession.h:
3289         * UIProcess/API/wpe/webkit.h:
3290
3291 2017-08-06  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3292
3293         [GTK][WPE] CFLAGS from pkg-config for (E)GL are not passed to WebKit
3294         https://bugs.webkit.org/show_bug.cgi?id=175125
3295
3296         Reviewed by Michael Catanzaro.
3297
3298         Some platforms define cflags on the (E)GL pkg-config files that we
3299         need to pass to the build system when including the (E)GL headers.
3300         And we are already doing this when building WebCore (after r184954).
3301
3302         But now we need to do this also on WebKit (former WebKit2) because
3303         we include (E)GL headers (and make use of them) on the UIProcess.
3304
3305         * CMakeLists.txt:
3306
3307 2017-08-05  Carlos Garcia Campos  <cgarcia@igalia.com>
3308
3309         WebDriver: Implement page load strategy
3310         https://bugs.webkit.org/show_bug.cgi?id=175183
3311
3312         Reviewed by Brian Burg.
3313
3314         Split pending navigation maps into normal and eager, and use one or the other depending on the received page
3315         load strategy. We need to keep different maps for every page load strategy because every command could use a
3316         different strategy.
3317
3318         * UIProcess/Automation/WebAutomationSession.cpp:
3319         (WebKit::WebAutomationSession::waitForNavigationToComplete): Extract page load strategy from parameter and pass
3320         it to waitForNavigationToCompleteOnPage() and waitForNavigationToCompleteOnFrame().
3321         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage): Return early if page load strategy is
3322         none. Otherwise at the pening callback to the normal or eager map depeding on the page load straegy.
3323         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame): Ditto.
3324         (WebKit::respondToPendingNavigationCallbacksWithTimeout): Helper to send pening navigation callback in case of
3325         timeout failure.
3326         (WebKit::WebAutomationSession::loadTimerFired): Call finishPendingNavigationsWithTimeoutFailure() with all the maps.
3327         (WebKit::WebAutomationSession::navigateBrowsingContext): Extract page load strategy from parameter and pass it
3328         to waitForNavigationToCompleteOnPage().
3329         (WebKit::WebAutomationSession::goBackInBrowsingContext): Ditto.
3330         (WebKit::WebAutomationSession::goForwardInBrowsingContext): Ditto.
3331         (WebKit::WebAutomationSession::reloadBrowsingContext): Ditto.
3332         (WebKit::WebAutomationSession::navigationOccurredForFrame): Use the normal maps.
3333         (WebKit::WebAutomationSession::documentLoadedForFrame): Stop timeout timer and dispatch eager pending navigations.
3334         * UIProcess/Automation/WebAutomationSession.h:
3335         * UIProcess/WebPageProxy.cpp:
3336         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): Notify the automation session.
3337
3338 2017-08-05  Carlos Garcia Campos  <cgarcia@igalia.com>
3339
3340         WebDriver: use in-view center point for clicks instead of bounding box center point
3341         https://bugs.webkit.org/show_bug.cgi?id=174863
3342
3343         Reviewed by Simon Fraser.
3344
3345         Change computeElementLayout to also return the in-view center point and whether it's obscured by another
3346         element.
3347
3348         * UIProcess/Automation/Automation.json: Add optional inViewCenterPoint to the result and isObscured.
3349         * UIProcess/Automation/WebAutomationSession.cpp:
3350         (WebKit::WebAutomationSession::didComputeElementLayout): Handle inViewCenterPoint and isObscured.
3351         * UIProcess/Automation/WebAutomationSession.h:
3352         * UIProcess/Automation/WebAutomationSession.messages.in:
3353         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3354         (WebKit::elementInViewClientCenterPoint): Get the client in-view center point and whether it's obscured
3355         according to the spec.
3356         (WebKit::WebAutomationSessionProxy::computeElementLayout): Pass inViewCenterPoint and isObscured to
3357         DidComputeElementLayout message.
3358
3359 2017-08-05  Brian Burg  <bburg@apple.com>
3360
3361         Web Automation: files selected for upload should be matched against 'accept' attribute values case-insensitively
3362         https://bugs.webkit.org/show_bug.cgi?id=175191
3363         <rdar://problem/33725790>
3364
3365         Reviewed by Carlos Garcia Campos.
3366
3367         Values of the "accept" attribute are to be compared in a case-insensitive manner, per
3368         https://html.spec.whatwg.org/multipage/input.html#file-upload-state-(type=file)
3369
3370         Except for converting MIME types and extensions to lowercase, most of these changes
3371         were lost in a rebase prior to landing the patch.
3372
3373         * UIProcess/Automation/WebAutomationSession.cpp:
3374         (WebKit::fileCanBeAcceptedForUpload): Fix some issues:
3375         - Handle a file ending in a period.
3376         - Handle MIME type inference failing.
3377         - Convert extensions and MIMEs to lower case, per specification.
3378
3379         (WebKit::WebAutomationSession::handleRunOpenPanel):
3380         - Strip the leading period from file extensions.
3381         - These range converters crash unless the API::Array is retained by a local variable.
3382
3383 2017-08-04  Youenn Fablet  <youenn@apple.com>
3384
3385         [Cache API] Add Cache and CacheStorage IDL definitions
3386         https://bugs.webkit.org/show_bug.cgi?id=175201
3387
3388         Reviewed by Brady Eidson.
3389
3390         * Shared/WebPreferencesDefinitions.h:
3391         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3392         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3393         * WebProcess/WebPage/WebPage.cpp:
3394         (WebKit::WebPage::updatePreferences):
3395
3396 2017-08-04  Brian Burg  <bburg@apple.com>
3397
3398         Expose WKPreferences SPI for toggling mock capture devices prompt
3399         https://bugs.webkit.org/show_bug.cgi?id=175227
3400         <rdar://problem/33734528>
3401
3402         Reviewed by Youenn Fablet.
3403
3404         * UIProcess/API/Cocoa/WKPreferences.mm:
3405         (-[WKPreferences _mockCaptureDevicesPromptEnabled]):
3406         (-[WKPreferences _setMockCaptureDevicesPromptEnabled:]):
3407         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3408
3409 2017-08-04  Brian Burg  <bburg@apple.com>
3410
3411         Fix typo in WKPreferences _iceCandidateFiltertingEnabled property
3412         https://bugs.webkit.org/show_bug.cgi?id=175224
3413
3414         Reviewed by Tim Horton.
3415
3416         * UIProcess/API/Cocoa/WKPreferences.mm:
3417         (-[WKPreferences _iceCandidateFilteringEnabled]):
3418         (-[WKPreferences _iceCandidateFiltertingEnabled]): Deleted.
3419         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3420
3421 2017-08-04  Chris Dumez  <cdumez@apple.com>
3422
3423         [Beacon] Update sendBeacon to use the CachedResourceLoader
3424         https://bugs.webkit.org/show_bug.cgi?id=175192
3425         <rdar://problem/33725923>
3426
3427         Reviewed by Youenn Fablet.
3428
3429         Deal with new Beacon CachedResource type.
3430
3431         * WebProcess/Network/WebLoaderStrategy.cpp:
3432         (WebKit::maximumBufferingTime):
3433
3434 2017-08-04  John Wilander  <wilander@apple.com>
3435
3436         Resource Load Statistics: Report user interaction immediately, but only when needed
3437         https://bugs.webkit.org/show_bug.cgi?id=175090
3438         <rdar://problem/33685546>
3439
3440         Reviewed by Chris Dumez.
3441
3442         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
3443         (WKBundleClearResourceLoadStatistics):
3444             Test infrastructure. Ends up calling
3445             WebCore::ResourceLoadObserver::clearState().
3446         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
3447
3448 2017-08-04  Matt Lewis  <jlewis3@apple.com>
3449