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