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