6e9aad613fe67c6e8d47ef7d0226e516ef8e6c71
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-07-03  Chris Dumez  <cdumez@apple.com>
2
3         Crash under WTF::RefCounted<WebKit::TaskCounter>::deref()
4         https://bugs.webkit.org/show_bug.cgi?id=199453
5         <rdar://problem/51991477>
6
7         Reviewed by Youenn Fablet.
8
9         The crash was caused by StorageManager::suspend() getting called on the main thread but calling
10         its completion handler on a background queue. The completion handler was capturing a TaskCounter
11         object which is RefCounted (not ThreadSafeRefCounted).
12
13         Address the issue by making sure StorageManager::suspend() calls its completion handler on the
14         main thread. Also get rid of TaskCounter and use a WTF::CallbackAggregator instead.
15
16         * NetworkProcess/NetworkProcess.cpp:
17         (WebKit::NetworkProcess::actualPrepareToSuspend):
18         (WebKit::TaskCounter::TaskCounter): Deleted.
19         (WebKit::TaskCounter::~TaskCounter): Deleted.
20         * NetworkProcess/WebStorage/StorageManager.cpp:
21         (WebKit::StorageManager::suspend):
22
23 2019-07-03  Youenn Fablet  <youenn@apple.com>
24
25         Make sure to cross-thread copy in StorageManager when hopping back to the main thread
26         https://bugs.webkit.org/show_bug.cgi?id=199423
27
28         Reviewed by Chris Dumez.
29
30         Make sure to isolate copy some strings that may not be isolated in case of ephemeral sessions.
31         Small refactoring to use crossThreadCopy instead of doing vector copy ourselves.
32
33         * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.h:
34         (WebKit::LocalStorageDatabaseTracker::OriginDetails::isolatedCopy const):
35         * NetworkProcess/WebStorage/StorageManager.cpp:
36         (WebKit::StorageManager::deleteSessionStorageEntriesForOrigins):
37         (WebKit::StorageManager::getLocalStorageOrigins):
38         (WebKit::StorageManager::getLocalStorageOriginDetails):
39         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
40
41 2019-07-02  Joonghun Park  <jh718.park@samsung.com>
42
43         Unreviewed. Fix build break introduced in r247058.
44
45         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
46
47 2019-07-02  Youenn Fablet  <youenn@apple.com>
48
49         StorageManager does not need to be a WorkQueueMessageReceiver anymore
50         https://bugs.webkit.org/show_bug.cgi?id=199421
51
52         Reviewed by Chris Dumez.
53
54         * NetworkProcess/WebStorage/StorageManager.h:
55
56 2019-07-02  Chris Dumez  <cdumez@apple.com>
57
58         ThreadSafeRefCounted<DestructionThread::Main> is not safe to use in the UIProcess
59         https://bugs.webkit.org/show_bug.cgi?id=199420
60         <rdar://problem/52289717>
61
62         Reviewed by Ryosuke Niwa.
63
64         Update IPC::Connection and DeviceIdHashSaltStorage to use DestructionThread::MainRunLoop
65         instead of DestructionThread::Main, since both classes are used in the UIProcess.
66
67         Using DestructionThread::Main is not safe in the UIProcess because its implementation relies
68         on isMainThread() / callOnMainThread(). Those get confused about which thread is the main
69         thread when an application uses both WK1 and WK2.
70
71         * Platform/IPC/Connection.h:
72         * UIProcess/DeviceIdHashSaltStorage.h:
73
74 2019-07-02  Patrick Griffis  <pgriffis@igalia.com>
75
76         [GTK][WPE] Explicitly blacklist problematic directories for sandbox
77         https://bugs.webkit.org/show_bug.cgi?id=199367
78
79         Reviewed by Michael Catanzaro.
80
81         There are some directories that simply do not make sense to bind into the sandbox
82         and will only cause issues such as `/proc` so lets just block them.
83
84         * UIProcess/API/glib/WebKitWebContext.cpp:
85         (path_is_not_blacklisted):
86         (webkit_web_context_add_path_to_sandbox):
87
88 2019-07-02  Tim Horton  <timothy_horton@apple.com>
89
90         REGRESSION (r243240): Unable to swipe back in Safari
91         https://bugs.webkit.org/show_bug.cgi?id=199394
92         <rdar://problem/51137447>
93
94         Reviewed by Wenson Hsieh.
95
96         * UIProcess/API/Cocoa/WKWebView.mm:
97         (-[WKWebView _processDidExit]):
98         r243240 started nilling out the ViewGestureController, but we don't actually
99         expect that; the only time WKWebView's ViewGestureController goes away
100         is if the client turns off the gestures... and so nothing ever puts it back.
101         Instead, just always disconnect, don't nil it out.
102
103 2019-07-02  Chris Dumez  <cdumez@apple.com>
104
105         Protect NetworkProcess::m_networkSessions against corruption
106         https://bugs.webkit.org/show_bug.cgi?id=199418
107         <rdar://problem/50614019>
108
109         Reviewed by Youenn Fablet.
110
111         I believe the most likely reason for the crash at <rdar://problem/50614019> is that NetworkProcess::m_networkSessions
112         is getting corrupted and is returning us a bad pointer.
113
114         To harden our code, I added debug assertions to make sure that this HashMap is only used on the main thread and
115         to make sure that the sessionID used as key is always valid. I have also added if checks to avoid crashing in
116         release whenever possible.
117
118         Note that we came to a similar conclusion for NetworkProcess::m_swServers when investigating rdar://problem/51859081,
119         so the two radars are potentially related. Both HashMaps are owned by the NetworkProcess and use a SessionID
120         as key.
121
122         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
123         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
124         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
125         (WebKit::NetworkConnectionToWebProcess::logUserInteraction):
126         (WebKit::NetworkConnectionToWebProcess::logWebSocketLoading):
127         (WebKit::NetworkConnectionToWebProcess::logSubresourceLoading):
128         (WebKit::NetworkConnectionToWebProcess::logSubresourceRedirect):
129         (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
130         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
131         (WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
132         * NetworkProcess/NetworkProcess.cpp:
133         (WebKit::NetworkProcess::networkSession const):
134         (WebKit::NetworkProcess::setSession):
135         (WebKit::NetworkProcess::destroySession):
136         (WebKit::NetworkProcess::addKeptAliveLoad):
137         (WebKit::NetworkProcess::removeKeptAliveLoad):
138         (WebKit::NetworkProcess::webProcessWasDisconnected):
139         * NetworkProcess/NetworkProcess.h:
140         * NetworkProcess/NetworkResourceLoader.cpp:
141         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
142         (WebKit::NetworkResourceLoader::didFinishWithRedirectResponse):
143         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
144         (WebKit::NetworkResourceLoader::shouldLogCookieInformation):
145         * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm:
146         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorBoundInterfaceIdentifier):
147         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType):
148         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationBundleIdentifier):
149         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationSecondaryIdentifier):
150
151 2019-07-02  Chris Dumez  <cdumez@apple.com>
152
153         VisitedLinkStore does not need to subclass WebProcessLifetimeObserver
154         https://bugs.webkit.org/show_bug.cgi?id=199407
155
156         Reviewed by Sam Weinig.
157
158         VisitedLinkStore does not need to subclass WebProcessLifetimeObserver, it overrides
159         only 2 of WebProcessLifetimeObserver's functions and the implementation of those
160         overrides is empty. It also does not use WebProcessLifetimeObserver::processes()
161         since the VisitedLinkStore maintains its own list of processes.
162
163         * UIProcess/API/mac/WKView.mm:
164         * UIProcess/Automation/WebAutomationSession.cpp:
165         * UIProcess/VisitedLinkStore.cpp:
166         * UIProcess/VisitedLinkStore.h:
167         * UIProcess/WebPageProxy.cpp:
168         (WebKit::m_resetRecentCrashCountTimer):
169         * UIProcess/WebProcessPool.h:
170         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
171
172 2019-07-02  Chris Dumez  <cdumez@apple.com>
173
174         Null dereference under StorageManager::destroySessionStorageNamespace()
175         https://bugs.webkit.org/show_bug.cgi?id=199388
176         <rdar://problem/52030641>
177
178         Reviewed by Youenn Fablet.
179
180         * NetworkProcess/WebStorage/StorageManager.cpp:
181         (WebKit::StorageManager::createSessionStorageNamespace):
182         Call HashMap::ensure() instead of contains() + set() to avoid double hash lookup.
183
184         (WebKit::StorageManager::destroySessionStorageNamespace):
185         Add null check to address top crasher, similarly to what was done in r246552.
186         I am keeping the debug assertion since this is not supposed to happen.
187
188 2019-07-02  Daniel Bates  <dabates@apple.com>
189
190         [iOS] Cannot tab cycle through credit card fields on antonsvpatisserie.com checkout page
191         https://bugs.webkit.org/show_bug.cgi?id=196053
192         <rdar://problem/49093034>
193
194         Reviewed by Wenson Hsieh.
195
196         Allow iframes to be keyboard focusable when pressing the Tab key on the keyboard. This
197         also allow the that the focus controller to search their content document for other
198         editable elements. This makes iOS match the behavior on Mac.
199
200         Although iframes can be focused by pressing the Tab key we maintain the current UI
201         restriction on iOS of not allowing iframes themselves to be focusable via the next and
202         previous accessory bar buttons. We do this because it's unclear what value supporting
203         such focusing brings, but it's clear that doing so makes tab cycling more confusing
204         since the default focus appearance for an iframe is indistinguishable from its non-
205         focused appearance.
206
207         * WebProcess/WebPage/ios/WebPageIOS.mm:
208         (WebKit::isAssistableElement): Do not consider an iframe as assistable.
209
210 2019-07-02  Alexander Mikhaylenko  <exalm7659@gmail.com>
211
212         [GTK] Support cancelling touchscreen back/forward gesture
213         https://bugs.webkit.org/show_bug.cgi?id=199401
214
215         Reviewed by Michael Catanzaro.
216
217         It should be possible to cancel the gesture when performing it on
218         touchscreen, for example, by moving pen too far from the screen.
219         Handle this case properly.
220
221         Only DragGesture in GestureController needs to handle this,
222         SwipeGesture simply won't emit the relevant event in this case.
223
224         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
225         * UIProcess/ViewGestureController.h:
226         * UIProcess/gtk/GestureController.cpp:
227         (WebKit::GestureController::DragGesture::cancelDrag):
228         (WebKit::GestureController::DragGesture::cancel):
229         (WebKit::GestureController::DragGesture::DragGesture):
230         * UIProcess/gtk/GestureController.h:
231         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
232         (WebKit::ViewGestureController::platformTeardown):
233         (WebKit::ViewGestureController::cancelSwipe):
234
235 2019-07-02  Devin Rousso  <drousso@apple.com>
236
237         Web Inspector: Debug: "Reset Web Inspector" should also clear the saved window size and attachment side
238         https://bugs.webkit.org/show_bug.cgi?id=198956
239
240         Reviewed by Matt Baker.
241
242         * UIProcess/WebPreferences.h:
243         * UIProcess/WebPreferences.cpp:
244         (WebKit::WebPreferences::deleteKey): Added.
245         * UIProcess/gtk/WebPreferencesGtk.cpp:
246         (WebKit::WebPreferences::platformDeleteKey): Added.
247         * UIProcess/mac/WebPreferencesMac.mm:
248         (WebKit::WebPreferences::platformDeleteKey): Added.
249         * UIProcess/wpe/WebPreferencesWPE.cpp:
250         (WebKit::WebPreferences::platformDeleteKey): Added.
251         * UIProcess/win/WebPreferencesWin.cpp:
252         (WebKit::WebPreferences::platformDeleteKey): Added.
253         * Shared/WebPreferencesStore.h:
254         * Shared/WebPreferencesStore.cpp:
255         (WebKit::WebPreferencesStore::deleteKey): Added.
256
257         * UIProcess/WebInspectorProxy.messages.in:
258         * UIProcess/WebInspectorProxy.h:
259         * UIProcess/WebInspectorProxy.cpp:
260         (WebKit::WebInspectorProxy::resetWindowState): Added.
261         (WebKit::WebInspectorProxy::platformResetWindowState): Added.
262         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
263         (WebKit::WebInspectorProxy::platformResetWindowState): Added.
264         * UIProcess/mac/WebInspectorProxyMac.mm:
265         (WebKit::WebInspectorProxy::platformResetWindowState): Added.
266         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
267         (WebKit::WebInspectorProxy::platformResetWindowState): Added.
268         * UIProcess/win/WebInspectorProxyWin.cpp:
269         (WebKit::WebInspectorProxy::platformResetWindowState): Added.
270         * WebProcess/WebPage/WebInspectorUI.h:
271         * WebProcess/WebPage/WebInspectorUI.cpp:
272         (WebKit::WebInspectorUI::resetWindowState): Added.
273
274         * UIProcess/RemoteWebInspectorProxy.messages.in:
275         * UIProcess/RemoteWebInspectorProxy.h:
276         * UIProcess/RemoteWebInspectorProxy.cpp:
277         (WebKit::RemoteWebInspectorProxy::resetWindowState): Added.
278         (WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
279         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
280         (WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
281         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
282         (WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
283         * UIProcess/win/RemoteWebInspectorProxyWin.cpp:
284         (WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
285         * WebProcess/WebPage/RemoteWebInspectorUI.h:
286         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
287         (WebKit::RemoteWebInspectorUI::resetWindowState): Added.
288
289 2019-07-01  Chris Dumez  <cdumez@apple.com>
290
291         Remove virtual functions on WebProcessLifetimeObserver that are unused after r245540
292         https://bugs.webkit.org/show_bug.cgi?id=199383
293
294         Reviewed by Alex Christensen.
295
296         * UIProcess/WebProcessLifetimeObserver.h:
297         (WebKit::WebProcessLifetimeObserver::webProcessDidCloseConnection):
298         * UIProcess/WebProcessLifetimeTracker.cpp:
299         (WebKit::WebProcessLifetimeTracker::addObserver):
300         (WebKit::WebProcessLifetimeTracker::pageWasInvalidated):
301
302 2019-07-01  Chris Dumez  <cdumez@apple.com>
303
304         StorageManager::SessionStorageNamespace::allowedConnections() should not copy the HashSet
305         https://bugs.webkit.org/show_bug.cgi?id=199379
306
307         Reviewed by Alex Christensen.
308
309         This was pretty inefficient.
310
311         * NetworkProcess/WebStorage/StorageManager.cpp:
312         (WebKit::StorageManager::SessionStorageNamespace::allowedConnections const):
313
314 2019-07-01  Wenson Hsieh  <wenson_hsieh@apple.com>
315
316         [iOS] REGRESSION (r246757): Unable to select non-editable text in subframes
317         https://bugs.webkit.org/show_bug.cgi?id=199366
318         <rdar://problem/52460509>
319
320         Reviewed by Tim Horton.
321
322         r246757 removed logic in selectionPositionInformation responsible for setting the focused frame when handling a
323         position information request. As the FIXME formerly in InteractionInformationRequest.h alluded to, text
324         selection gestures on iOS were dependent on this behavior when selecting text in subframes, since text selection
325         helpers in WebPageIOS.mm assume that the focused frame already contains the selection being set.
326
327         Rather than calling setFocusedFrame when requesting position information, we can fix this by making
328         WebPage::selectWithGesture and WebPage::selectTextWithGranularityAtPoint both set the focused frame if needed
329         before extending or moving text selections.
330
331         Covered by layout tests that began to fail after r246757:
332         - editing/selection/ios/selection-handles-in-iframe.html
333         - editing/selection/ios/selection-handle-clamping-in-iframe.html
334
335         * WebProcess/WebPage/WebPage.h:
336         * WebProcess/WebPage/ios/WebPageIOS.mm:
337         (WebKit::WebPage::selectWithGesture):
338
339         Only call the new helper method, setFocusedFrameBeforeSelectingTextAtLocation, at the start of the gesture.
340
341         (WebKit::WebPage::setFocusedFrameBeforeSelectingTextAtLocation):
342         (WebKit::WebPage::selectTextWithGranularityAtPoint):
343
344 2019-07-01  Alex Christensen  <achristensen@webkit.org>
345
346         Add new decidePolicyForNavigationAction SPI with preferences and userInfo
347         https://bugs.webkit.org/show_bug.cgi?id=199371
348         <rdar://problem/52352905>
349
350         Reviewed by Tim Horton.
351
352         Also deprecate some older SPI so we may someday clean up this mess.
353
354         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
355         * UIProcess/Cocoa/NavigationState.h:
356         * UIProcess/Cocoa/NavigationState.mm:
357         (WebKit::NavigationState::setNavigationDelegate):
358         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
359         (WebKit::NavigationState::NavigationClient::shouldBypassContentModeSafeguards const):
360
361 2019-07-01  Alex Christensen  <achristensen@webkit.org>
362
363         Deprecate but still call _webView:showCustomSheetForElement: after transition to UIContextMenuInteraction
364         https://bugs.webkit.org/show_bug.cgi?id=199296
365         <rdar://problem/51041960>
366
367         Reviewed by Darin Adler.
368
369         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
370         * UIProcess/ios/WKContentViewInteraction.mm:
371         (-[WKContentView _showAttachmentSheet]):
372         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
373         (-[WKContentView continueContextMenuInteraction:]):
374
375 2019-07-01  Alex Christensen  <achristensen@webkit.org>
376
377         Add main thread assertions in sendWithAsyncReply code
378         https://bugs.webkit.org/show_bug.cgi?id=199324
379
380         Reviewed by Sam Weinig.
381
382         sendWithAsyncReply can only be used on the main thread because
383         the CompletionHandler will be called on the main thread, and if it's
384         called from a background thread, then HashMap corruption will likely happen.
385         Add assertions to alert developers that they should only call sendWithAsyncReply
386         from the main thread.
387
388         This is responding to good feedback from r237294
389
390         * Platform/IPC/Connection.cpp:
391         (IPC::asyncReplyHandlerMap):
392         (IPC::nextAsyncReplyHandlerID):
393         (IPC::addAsyncReplyHandler):
394         (IPC::clearAsyncReplyHandlers):
395         (IPC::CompletionHandler<void):
396
397 2019-07-01  Eric Carlson  <eric.carlson@apple.com>
398
399         [iOS] Exiting from fullscreen scrolls to top of page
400         https://bugs.webkit.org/show_bug.cgi?id=199338
401         <rdar://problem/51273017>
402
403         Reviewed by Jer Noble.
404
405         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
406         (-[WKFullScreenWindowController _completedExitFullScreen]): Restore scroll position.
407         Hide window after restoring scroll position.
408         (-[WKFullScreenWindowController _exitFullscreenImmediately]): Drive-by fix: remove code
409         already also done in _completedExitFullScreen.
410
411 2019-07-01  Zalan Bujtas  <zalan@apple.com>
412
413         Tapping on the bottom part of youtube video behaves as if controls were visible
414         https://bugs.webkit.org/show_bug.cgi?id=199349
415         <rdar://problem/51955744>
416
417         Reviewed by Simon Fraser.
418
419         * WebProcess/WebPage/WebPage.cpp:
420         (WebKit::handleTouchEvent):
421         * WebProcess/WebPage/WebPage.h:
422         * WebProcess/WebPage/ios/WebPageIOS.mm:
423         (WebKit::WebPage::handleSyntheticClick):
424         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
425         (WebKit::WebPage::completeSyntheticClick):
426         (WebKit::WebPage::potentialTapAtPosition):
427
428 2019-07-01  Wenson Hsieh  <wenson_hsieh@apple.com>
429
430         iOS: REGRESSION(async scroll): Caret doesn't scroll when scrolling textarea
431         https://bugs.webkit.org/show_bug.cgi?id=198217
432         <rdar://problem/51097296>
433
434         Reviewed by Simon Fraser.
435
436         In iOS 12, when scrolling a text selection in an fast-scrolling container, editor state updates are scheduled
437         under AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll after the end of the scrolling gesture,
438         when the scrolling layer action is ScrollingLayerPositionAction::Set. This is no longer the case in iOS 13,
439         because we now bail in ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling after scroll deceleration
440         finishes since the scroll position didn't end up changing. Additionally, we no longer use
441         ScrollingLayerPositionAction::Set in the case where scrolling finished decelerating, since
442         ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll no longer uses to value of inUserInteraction to
443         determine whether to Set or Sync scrolling layer positions.
444
445         To restore iOS 12 behavior, ensure that we send a scrolling tree update using ScrollingLayerPositionAction::Set
446         after scrolling ends.
447
448         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
449         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll):
450
451 2019-07-01  Per Arne Vollan  <pvollan@apple.com>
452
453         Perform less work when a pre-warmed WebProcess is suspended or resumed.
454         https://bugs.webkit.org/show_bug.cgi?id=199195
455
456         Reviewed by Darin Adler.
457
458         Return early from WebProcess::actualPrepareToSuspend and WebProcess::processDidResume
459         if this is a pre-warmed process. This is a confirmed improvement in page load time.
460
461         * WebProcess/WebProcess.cpp:
462         (WebKit::WebProcess::actualPrepareToSuspend):
463         (WebKit::WebProcess::cancelPrepareToSuspend):
464         (WebKit::WebProcess::processDidResume):
465
466 2019-07-01  Carlos Garcia Campos  <cgarcia@igalia.com>
467
468         WebSockets: add support for sending blob messages when using web sockets platform APIs
469         https://bugs.webkit.org/show_bug.cgi?id=199189
470
471         Reviewed by Youenn Fablet.
472
473         Add helper private class BlobLoader that uses FileReaderLoader to load the blobs. Since blob loads are
474         asynchronous, the messages are queued using another helper internal class PendingMessage.
475
476         * WebProcess/Network/WebSocketChannel.cpp:
477         (WebKit::WebSocketChannel::increaseBufferedAmount): Increase the buffered amount checking we don't overlofw.
478         (WebKit::WebSocketChannel::decreaseBufferedAmount): Decrease the buffered amount.
479         (WebKit::WebSocketChannel::sendMessage): Helper class to send message to the network process and decrease the
480         buffered amount when done.
481         (WebKit::WebSocketChannel::send): Queue the message in pending queue if there are pending messages in the queue
482         for text and binary messages. For blobs, always queue the message unless it's an empty blob that we can handle
483         as empty binary data directly.
484         (WebKit::PendingMessage::PendingMessage): Helper class to queue message requests.
485         (WebKit::PendingMessage::type const): Type of message: Text, Binary, Blob.
486         (WebKit::PendingMessage::textMessage const): The text message.
487         (WebKit::PendingMessage::binaryData const): The binary data.
488         (WebKit::PendingMessage::blobLoader const): The blob loader.
489         (WebKit::WebSocketChannel::fail): Notify the client about the error to ensure onclose is emitted.
490         (WebKit::WebSocketChannel::disconnect): Clear the pending messages queue.
491         * WebProcess/Network/WebSocketChannel.h:
492
493 2019-07-01  Miguel Gomez  <magomez@igalia.com>
494
495         [WPE][GTK] Content disappearing when using CSS transforms
496         https://bugs.webkit.org/show_bug.cgi?id=181757
497
498         Reviewed by Žan Doberšek.
499
500         Set the appropriate AnimatedBackingStoreClient to the TextureMapperLayers when required.
501
502         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
503         (WebKit::CoordinatedGraphicsScene::updateSceneState):
504
505 2019-06-30  Antti Koivisto  <antti@apple.com>
506
507         Use separate variables for moving and stationary scrolling relationships in RemoteLayerTreeNode
508         https://bugs.webkit.org/show_bug.cgi?id=199348
509
510         Reviewed by Darin Adler.
511
512         A layer can have only one acting scroll parent. Not using a vector for that case makes the code clearer.
513
514         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
515         (WebKit::RemoteLayerTreeNode::actingScrollContainerID const):
516         (WebKit::RemoteLayerTreeNode::stationaryScrollContainerIDs const):
517
518         Separate fields for the acting container and stationary containers.
519
520         (WebKit::RemoteLayerTreeNode::setActingScrollContainerID):
521         (WebKit::RemoteLayerTreeNode::setStationaryScrollContainerIDs):
522         (WebKit::RemoteLayerTreeNode::relatedScrollContainerIDs const): Deleted.
523         (WebKit::RemoteLayerTreeNode::relatedScrollContainerPositioningBehavior const): Deleted.
524         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
525         (WebKit::RemoteLayerTreeNode::setRelatedScrollContainerBehaviorAndIDs): Deleted.
526         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
527         (WebKit::isScrolledBy):
528         (WebKit::findActingScrollParent):
529         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
530         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
531
532 2019-06-30  Fujii Hironori  <Hironori.Fujii@sony.com>
533
534         [Win] Multiline mode of tooltip control does word-wrapping very slowly
535         https://bugs.webkit.org/show_bug.cgi?id=198989
536
537         Reviewed by Ross Kirsling.
538
539         * UIProcess/win/WebView.cpp:
540         (WebKit::truncatedString): Added.
541         (WebKit::WebView::setToolTip): Use truncatedString.
542
543 2019-06-30  Basuke Suzuki  <Basuke.Suzuki@sony.com>
544
545         Pass WebProcess information to platformInitializeWebProcess().
546         https://bugs.webkit.org/show_bug.cgi?id=199345
547
548         Reviewed by Darin Adler.
549
550         Add const reference to WebProcessProxy for first argument of
551         WebProcessPool::platformInitializeWebProcess().
552
553         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
554         (WebKit::WebProcessPool::platformInitializeWebProcess):
555         * UIProcess/WebProcessPool.cpp:
556         (WebKit::WebProcessPool::initializeNewWebProcess):
557         * UIProcess/WebProcessPool.h:
558         * UIProcess/glib/WebProcessPoolGLib.cpp:
559         (WebKit::WebProcessPool::platformInitializeWebProcess):
560         * UIProcess/win/WebProcessPoolWin.cpp:
561         (WebKit::WebProcessPool::platformInitializeWebProcess):
562
563 2019-06-28  Brent Fulgham  <bfulgham@apple.com>
564
565         Revise WebContent sandbox based on seed feedback
566         https://bugs.webkit.org/show_bug.cgi?id=199339
567         <rdar://problem/49609201>
568
569         Reviewed by Alexey Proskuryakov.
570
571         Unblock syscall needed by CoreText.
572
573         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
574         * WebProcess/com.apple.WebProcess.sb.in:
575
576 2019-06-28  Tim Horton  <timothy_horton@apple.com>
577
578         iOS WebKit2 find-in-page indicator doesn't move with 'overflow: scroll'
579         https://bugs.webkit.org/show_bug.cgi?id=175032
580         <rdar://problem/29346482>
581
582         Reviewed by Wenson Hsieh.
583
584         * WebProcess/WebPage/FindController.cpp:
585         (WebKit::FindController::drawRect):
586         (WebKit::FindController::didScrollAffectingFindIndicatorPosition):
587         Adopt the macOS code that notices that the find highlight doesn't match
588         its original position, but instead of hiding the highlight like we do on macOS,
589         update it. We do this asynchronously to avoid mutating the layer tree
590         in the middle of painting, which is not /truly/ unsafe, but definitely
591         non-ideal and causes fun flashes.
592
593         * WebProcess/WebPage/FindController.h:
594         * WebProcess/WebPage/ios/FindControllerIOS.mm:
595         (WebKit::FindController::updateFindIndicator):
596         Store m_findIndicatorRect when updating the indicator, just like we do on macOS.
597
598 2019-06-28  Ryan Haddad  <ryanhaddad@apple.com>
599
600         Unreviewed build fix attempt after r246928.
601
602         * UIProcess/API/Cocoa/WKWebView.mm:
603         (-[WKWebView _closeAllMediaPresentations]):
604
605 2019-06-28  Youenn Fablet  <youenn@apple.com>
606
607         Protect NetworkProcess::m_swServers from bad session IDs
608         https://bugs.webkit.org/show_bug.cgi?id=199298
609         <rdar://problem/51859081>
610
611         Reviewed by Chris Dumez.
612
613         Protect NetworkProcess from receiving bad session IDs in service worker code path by checking for session ID validity whenever interacting with the map.
614         One of the check is done in WebProcess in which case, if the session ID is bad, the SW connection to NetworkProcess will not be made.
615         For bad session IDs, this will in that case trigger timing out of service worker operations.
616
617         For get/clear data, exit early in case of bad session ID.
618
619         Made some refactoring to remove swOriginStoreForSession method.
620         In the one call site where it is used, the store should already be created so we reuse existingSWOriginStoreForSession.
621
622         Added a bunch of additional ASSERTs.
623
624         * NetworkProcess/NetworkProcess.cpp:
625         (WebKit::NetworkProcess::destroySession):
626         (WebKit::NetworkProcess::fetchWebsiteData):
627         (WebKit::NetworkProcess::deleteWebsiteData):
628         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
629         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
630         (WebKit::NetworkProcess::actualPrepareToSuspend):
631         (WebKit::NetworkProcess::swServerForSession):
632         (WebKit::NetworkProcess::existingSWOriginStoreForSession const):
633         (WebKit::NetworkProcess::registerSWServerConnection):
634         * NetworkProcess/NetworkProcess.h:
635         * WebProcess/Network/NetworkProcessConnection.cpp:
636         (WebKit::NetworkProcessConnection::initializeSWClientConnection):
637         * WebProcess/Storage/WebSWClientConnection.cpp:
638         (WebKit::WebSWClientConnection::WebSWClientConnection):
639         (WebKit::WebSWClientConnection::initializeConnectionIfNeeded):
640         (WebKit::WebSWClientConnection::ensureConnectionAndSend):
641
642 2019-06-28  Timothy Hatcher  <timothy@apple.com>
643
644         Rename effectiveAppearanceIsInactive and useInactiveAppearance to better match UIUserInterfaceLevel.
645         https://bugs.webkit.org/show_bug.cgi?id=199336
646         rdar://problem/52348938
647
648         Reviewed by Tim Horton.
649
650         * Shared/WebPageCreationParameters.cpp:
651         (WebKit::WebPageCreationParameters::encode const):
652         (WebKit::WebPageCreationParameters::decode):
653         * Shared/WebPageCreationParameters.h:
654         * UIProcess/API/Cocoa/WKWebView.mm:
655         (-[WKWebView _effectiveUserInterfaceLevelIsElevated]):
656         (-[WKWebView _effectiveAppearanceIsInactive]): Deleted.
657         * UIProcess/API/Cocoa/WKWebViewInternal.h:
658         * UIProcess/Cocoa/WebViewImpl.h:
659         * UIProcess/Cocoa/WebViewImpl.mm:
660         (WebKit::WebViewImpl::effectiveUserInterfaceLevelIsElevated):
661         (WebKit::WebViewImpl::effectiveAppearanceIsInactive): Deleted.
662         * UIProcess/PageClient.h:
663         (WebKit::PageClient::effectiveUserInterfaceLevelIsElevated const):
664         (WebKit::PageClient::effectiveAppearanceIsInactive const): Deleted.
665         * UIProcess/WebPageProxy.cpp:
666         (WebKit::WebPageProxy::creationParameters):
667         (WebKit::WebPageProxy::useElevatedUserInterfaceLevel const):
668         (WebKit::WebPageProxy::effectiveAppearanceDidChange):
669         (WebKit::WebPageProxy::useInactiveAppearance const): Deleted.
670         * UIProcess/WebPageProxy.h:
671         * UIProcess/ios/PageClientImplIOS.h:
672         * UIProcess/ios/PageClientImplIOS.mm:
673         (WebKit::PageClientImpl::effectiveUserInterfaceLevelIsElevated const):
674         (WebKit::PageClientImpl::effectiveAppearanceIsInactive const): Deleted.
675         * UIProcess/mac/PageClientImplMac.h:
676         * UIProcess/mac/PageClientImplMac.mm:
677         (WebKit::PageClientImpl::effectiveUserInterfaceLevelIsElevated const):
678         (WebKit::PageClientImpl::effectiveAppearanceIsInactive const): Deleted.
679         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
680         (WKBundlePageSetUseDarkAppearance):
681         * WebProcess/WebPage/WebPage.cpp:
682         (WebKit::m_shrinkToFitContentTimer):
683         (WebKit::WebPage::effectiveAppearanceDidChange):
684         * WebProcess/WebPage/WebPage.h:
685         * WebProcess/WebPage/WebPage.messages.in:
686
687 2019-06-28  Jer Noble  <jer.noble@apple.com>
688
689         Unreviewed maccatalyst build fix; add ENABLE(FULLSCREEN) checks around calls to fullScreenManager().
690
691         * UIProcess/API/Cocoa/WKWebView.mm:
692         (-[WKWebView _closeAllMediaPresentations]):
693
694 2019-06-28  Tim Horton  <timothy_horton@apple.com>
695
696         macCatalyst: Selected range sometimes wrong after autocorrection
697         https://bugs.webkit.org/show_bug.cgi?id=199299
698         <rdar://problem/49717224>
699
700         Reviewed by Wenson Hsieh.
701
702         * UIProcess/Cocoa/TextCheckingController.h:
703         * UIProcess/Cocoa/TextCheckingController.mm:
704         (WebKit::TextCheckingController::replaceRelativeToSelection):
705         * UIProcess/ios/WKContentViewInteraction.mm:
706         (-[WKContentView replaceSelectionOffset:length:withAnnotatedString:relativeReplacementRange:]):
707         Plumb the whole relative replacement range through to the Web Content process.
708
709         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h:
710         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.messages.in:
711         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
712         (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection):
713         Only replace the text of the substring that changed (the replacement range),
714         and fix up the selection offset math (it was really just wrong before).
715
716 2019-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
717
718         Need a way for SPI clients to know when to avoid resizing to accommodate for the input view bounds
719         https://bugs.webkit.org/show_bug.cgi?id=199331
720         <rdar://problem/52116170>
721
722         Reviewed by Tim Horton.
723
724         Expose new SPI, such that clients may check whether to avoid resizing the web view when changing input view
725         bounds. In particular, resizing the web view in this case causes toolbar menus in Microsoft Word online to
726         dismiss immediately after opening them, due to resize events fired as a result of the input view dismissing.
727
728         * Shared/FocusedElementInformation.cpp:
729         (WebKit::FocusedElementInformation::encode const):
730         (WebKit::FocusedElementInformation::decode):
731         * Shared/FocusedElementInformation.h:
732
733         Add a new flag to FocusedElementInformation to indicate whether we should avoid resizing the web view when an
734         input view is presented.
735
736         * UIProcess/API/Cocoa/WKWebView.mm:
737         (-[WKWebView _shouldAvoidResizingWhenInputViewBoundsChange]):
738         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
739         * UIProcess/ios/WKContentViewInteraction.h:
740         * UIProcess/ios/WKContentViewInteraction.mm:
741         (-[WKContentView _elementDidBlur]):
742
743         Reset the value of the flag.
744
745         (-[WKContentView _shouldAvoidResizingWhenInputViewBoundsChange]):
746         * WebProcess/WebPage/ios/WebPageIOS.mm:
747         (WebKit::WebPage::getFocusedElementInformation):
748
749 2019-06-28  Jer Noble  <jer.noble@apple.com>
750
751         Add new -[WKWebView _closeAllMediaPresentations] SPI
752         https://bugs.webkit.org/show_bug.cgi?id=199294
753         <rdar://problem/51965958>
754
755         Reviewed by Alex Christensen.
756
757         Add a new SPI that will close all out-of-window media presentations, including
758         picture-in-picture, video fullscreen, and element fullscreen.
759
760         Drive-by fixes:
761
762         + -[WKApplicationStateTrackingView didMoveToWindow] incorrectly assumes that a WKWebView will
763           never be moved frome one window to another, and asserts.
764
765         + -[WKFullScreenWindowController close] doesn't fire the correct 'webkitfullscreenchange' event
766           when called in the middle of animating into fullscreen.
767
768         * UIProcess/API/Cocoa/WKWebView.mm:
769         (-[WKWebView _closeAllMediaPresentations]):
770         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
771         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
772         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
773         (WebKit::VideoFullscreenManagerProxy::forEachSession):
774         * UIProcess/ios/WKApplicationStateTrackingView.mm:
775         (-[WKApplicationStateTrackingView didMoveToWindow]):
776         * UIProcess/mac/WKFullScreenWindowController.h:
777         * UIProcess/mac/WKFullScreenWindowController.mm:
778         (-[WKFullScreenWindowController exitFullScreenImmediately]):
779         (-[WKFullScreenWindowController close]):
780
781 2019-06-28  Antti Koivisto  <antti@apple.com>
782
783         [iOS Scrolling] Propagate scrolls to non-nested UIScrollViews
784         https://bugs.webkit.org/show_bug.cgi?id=199222
785
786         Reviewed by Simon Fraser.
787
788         We may generate scrolling hierarchies where the scrolling ancestor of a layer is not
789         an ancestor in the layer tree. We  handle this in most situations but there is still
790         a problem where a scroller fails to propage scroll to the ancestor when it reaches
791         the edge.
792
793         This patch hooks up a new SPI that allows us to tell UIKit about non-ancestor scrolling
794         relations and solve this problem.
795
796         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
797         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
798         (WebKit::findActingScrollParent):
799         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
800         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
801         (-[WKScrollingNodeScrollViewDelegate _actingParentScrollViewForScrollView:]):
802
803         Hook into UIKit SPI.
804
805         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::findActingScrollParent):
806
807 2019-06-28  Konstantin Tokarev  <annulen@yandex.ru>
808
809         Remove traces of ENABLE_ICONDATABASE remaining after its removal in 219733
810         https://bugs.webkit.org/show_bug.cgi?id=199317
811
812         Reviewed by Michael Catanzaro.
813
814         While IconDatabase and all code using it was removed,
815         ENABLE_ICONDATABASE still exists as build option and C++ macro.
816
817         * Configurations/FeatureDefines.xcconfig:
818         * PlatformGTK.cmake: Remove reference to unused urlIcon.png file.
819
820 2019-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
821
822         -[WKContentView _selectionClipRects] returns a bogus value in -reloadInputViews when focusing an element
823         https://bugs.webkit.org/show_bug.cgi?id=199310
824         <rdar://problem/52292137>
825
826         Reviewed by Megan Gardner.
827
828         When reloading input views under -_elementDidFocus:, -_selectionClipRect returns the value of the previously
829         focused element; this is because _selectionClipRect depends on EditorState's post layout data, which is only
830         guaranteed to arrive during the next remote layer tree commit after the element is focused.
831
832         However, some clients need to inspect this value under the call to -reloadInputViews when an element is focused;
833         to make this work, simply check whether we are currently waiting for post-layout EditorState data to arrive
834         following element focus; if so, return the FocusedElementInformation's elementRect, which represents the initial
835         state of the focused element. Otherwise, use the EditorState's post layout data, which is guaranteed to be more
836         up-to-date than the FocusedElementInformation's element rect.
837
838         Test: KeyboardInputTests.SelectionClipRectsWhenPresentingInputView
839
840         * UIProcess/WebPageProxy.h:
841         (WebKit::WebPageProxy::waitingForPostLayoutEditorStateUpdateAfterFocusingElement const):
842         * UIProcess/ios/WKContentViewInteraction.mm:
843         (-[WKContentView _selectionClipRect]):
844
845 2019-06-28  Carlos Garcia Campos  <cgarcia@igalia.com>
846
847         [SOUP] WebSockets: runtime critical warning when closing the connection in some cases
848         https://bugs.webkit.org/show_bug.cgi?id=199265
849
850         Reviewed by Michael Catanzaro.
851
852         Ensure the connection is still open before calling soup_websocket_connection_close().
853
854         * NetworkProcess/soup/WebSocketTaskSoup.cpp:
855         (WebKit::WebSocketTask::close):
856
857 2019-06-27  Zan Dobersek  <zdobersek@igalia.com>
858
859         Unreviewed WPE build fix.
860
861         * SourcesWPE.txt: Add WebSocketTaskSoup.cpp to the build.
862
863 2019-06-27  Dean Jackson  <dino@apple.com>
864
865         Provide overrides for UIKit's suggested actions in UIContextMenuInteraction
866         https://bugs.webkit.org/show_bug.cgi?id=199301
867         <rdar://problem/52297380>
868
869         Reviewed by Tim Horton.
870
871         We were previously wrapping the actionMenuProvider with our own block
872         in order to ensure the correct suggestedActions were passed to the provider.
873         UIKit added API for us to override the actions separately.
874
875         Unfortunately we can't quite yet get rid of our access into the
876         UIContextMenuConfiguration, because we still need to override the preview
877         handler in the case where the user does not want link previews.
878
879         * Platform/spi/ios/UIKitSPI.h:
880         * UIProcess/ios/WKContentViewInteraction.h:
881         * UIProcess/ios/WKContentViewInteraction.mm:
882         (-[WKContentView continueContextMenuInteraction:]):
883         (-[WKContentView _contextMenuInteraction:overrideSuggestedActionsForConfiguration:]):
884         Implement the new delegate SPI to provide our own actions.
885
886 2019-06-27  Daniel Bates  <dabates@apple.com>
887
888         [iOS] Select all with existing range selection replaces range instead of selecting all text
889         https://bugs.webkit.org/show_bug.cgi?id=197950
890         <rdar://problem/50245131>
891
892         Reviewed by Wenson Hsieh.
893
894         Following <rdar://problem/47333786>, UIKit now asks WebKit whether it can handle Command + A as
895         "select all" instead of just demanding that we handle it. So, WebKit needs to be able to correctly
896         tell UIKit in advance whether it can handle it. Currenlty WebKit tells UIKit it cannot handle a
897         "select all" whenever there is an existing range selection. So, UIKit does not tell WebKit to
898         perform the "select all". Moreover, since UIKit has no other means to handle this key command
899         itself it tells WebKit the key command was not handled. So, WebKit tells the keyboard to insert
900         the "a". Instead, WebKit should tell UIKit it can handle a "select all" even when this is an
901         existing range selection. However we need to keep the current logic just for when UIKit is
902         asking us with respect to populating the callout menu to not regress platform behavior.
903
904         * UIProcess/ios/WKContentViewInteraction.mm:
905         (-[WKContentView canPerformActionForWebView:withSender:]): Do what we do now if we are called
906         when populating the callout menu and action is Select All. Otherwise, return YES for the Select All
907         action if we have a non-empty selection.
908
909 2019-06-27  Andy Estes  <aestes@apple.com>
910
911         [iOS] Stop using cached UITargetedPreviews from previous interactions when starting a new context menu interaction
912         https://bugs.webkit.org/show_bug.cgi?id=199285
913         <rdar://problem/52074916>
914
915         Reviewed by Tim Horton.
916
917         WKContentView was caching the UITargetedPreview created in
918         -contextMenuInteraction:previewForHighlightingMenuWithConfiguration: for later reuse by
919         -contextMenuInteraction:previewForDismissingMenuWithConfiguration:. The cached value was
920         then cleared in -contextMenuInteractionDidEnd:.
921
922         This was wrong, because -contextMenuInteractionDidEnd: can be called before
923         -contextMenuInteraction:previewForDismissingMenuWithConfiguration:, so we would clear the
924         cache then create and cache a new UITargetedPreview during dismissal. Then when a new
925         context menu interaction started, we'd reuse the targeted preview created for the previous
926         dismissal (which has the wrong geometry).
927
928         Stop assuming an ordering between
929         -contextMenuInteraction:previewForDismissingMenuWithConfiguration: and
930         -contextMenuInteractionDidEnd:. Instead, always create and cache a new UITargetedPreview in
931         -contextMenuInteraction:previewForHighlightingMenuWithConfiguration:, then reuse it and
932         clear the cache in -contextMenuInteraction:previewForDismissingMenuWithConfiguration:.
933
934         * UIProcess/ios/WKContentViewInteraction.mm:
935         (-[WKContentView _createTargetedPreviewIfPossible]):
936         (-[WKContentView contextMenuInteraction:previewForDismissingMenuWithConfiguration:]):
937         (-[WKContentView contextMenuInteractionDidEnd:]):
938
939 2019-06-27  Sihui Liu  <sihui_liu@apple.com>
940
941         Regression(r246526): StorageManager thread hangs
942         https://bugs.webkit.org/show_bug.cgi?id=199278
943         <rdar://problem/52202948>
944
945         Reviewed by Geoffrey Garen.
946
947         r246526 adds a lock m_localStorageNamespacesMutex to protect m_localStorageNamespaces, because 
948         m_localStorageNamespaces is destroyed at main thread while accesses to m_localStorageNamespaces happen in the 
949         background thread.
950         After r246526, getOrCreateLocalStorageNamespace acquires lock m_localStorageNamespacesMutex when 
951         m_localStorageNamespacesMutex is already acquired in cloneSessionStorageNamespace, so the StorageManager thread
952         hangs.
953         To solve this issue, we can remove the lock in getOrCreateLocalStorageNamespace, or we can remove the 
954         m_localStorageNamespacesMutex. waitUntilWritesFinished() before ~StorageManager() already guarantees nothing 
955         will be running in the background thread, so it is unlikely we the access to m_localStorageNamespaces in the 
956         background thread would collide with the destruction of m_localStorageNamespaces. Also, we don't need 
957         didDestroyStorageArea as LocalStorageNamespace can hold the last reference of StorageArea after r245881.
958
959         * NetworkProcess/WebStorage/StorageManager.cpp:
960         (WebKit::StorageManager::StorageArea::StorageArea):
961         (WebKit::StorageManager::StorageArea::~StorageArea):
962         (WebKit::StorageManager::LocalStorageNamespace::LocalStorageNamespace):
963         (WebKit::StorageManager::cloneSessionStorageNamespace):
964         (WebKit::StorageManager::getLocalStorageOrigins):
965         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
966         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
967         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
968         (WebKit::StorageManager::getOrCreateLocalStorageNamespace):
969         (WebKit::StorageManager::LocalStorageNamespace::didDestroyStorageArea): Deleted.
970         * NetworkProcess/WebStorage/StorageManager.h:
971
972 2019-06-27  Carlos Garcia Campos  <cgarcia@igalia.com>
973
974         WebSockets: avoid data copies when queuing tasks in WebSocketChannel
975         https://bugs.webkit.org/show_bug.cgi?id=199262
976
977         Reviewed by Alex Christensen.
978
979         For IPC message handler arguments we can receive rvalue references instead of const references.
980
981         * WebProcess/Network/WebSocketChannel.cpp:
982         (WebKit::WebSocketChannel::didConnect):
983         (WebKit::WebSocketChannel::didReceiveText):
984         (WebKit::WebSocketChannel::didReceiveBinaryData):
985         (WebKit::WebSocketChannel::didClose):
986         (WebKit::WebSocketChannel::didReceiveMessageError):
987         * WebProcess/Network/WebSocketChannel.h:
988
989 2019-06-27  Youenn Fablet  <youenn@apple.com>
990
991         Fix build after revision 246877
992         https://bugs.webkit.org/show_bug.cgi?id=199276
993
994         Unreviewed.
995
996         Pass protocol parameter to NetworkSocketChannel.
997
998         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
999         (-[WKNetworkSessionDelegate URLSession:webSocketTask:didOpenWithProtocol:]):
1000         * NetworkProcess/cocoa/WebSocketTaskCocoa.h:
1001         * NetworkProcess/cocoa/WebSocketTaskCocoa.mm:
1002         (WebKit::WebSocketTask::didConnect):
1003
1004 2019-06-27  Beth Dakin  <bdakin@apple.com>
1005
1006         Upstream use of MACCATALYST
1007         https://bugs.webkit.org/show_bug.cgi?id=199245
1008         rdar://problem/51687723
1009
1010         Reviewed by Tim Horton.
1011
1012         * Configurations/Base.xcconfig:
1013         * Configurations/FeatureDefines.xcconfig:
1014         * Configurations/Network-iOSMac.entitlements: Removed.
1015         * Configurations/Network-macCatalyst.entitlements: Copied from Source/WebKit/Configurations/Network-iOSMac.entitlements.
1016         * Configurations/NetworkService.xcconfig:
1017         * Configurations/SDKVariant.xcconfig:
1018         * Configurations/WebContent-iOSMac.entitlements: Removed.
1019         * Configurations/WebContent-macCatalyst.entitlements: Copied from Source/WebKit/Configurations/WebContent-iOSMac.entitlements.
1020         * Configurations/WebContentService.xcconfig:
1021         * Configurations/WebKit.xcconfig:
1022         * NetworkProcess/ios/NetworkProcessIOS.mm:
1023         * NetworkProcess/mac/NetworkProcessMac.mm:
1024         (WebKit::NetworkProcess::initializeProcess):
1025         (WebKit::NetworkProcess::initializeProcessName):
1026         * Platform/mac/LayerHostingContext.mm:
1027         (WebKit::LayerHostingContext::createForExternalHostingProcess):
1028         * Platform/spi/ios/ManagedConfigurationSPI.h:
1029         * Platform/spi/ios/UIKitSPI.h:
1030         * Shared/WebPreferencesDefaultValues.cpp:
1031         (WebKit::defaultCustomPasteboardDataEnabled):
1032         * Shared/ios/AuxiliaryProcessIOS.mm:
1033         (WebKit::AuxiliaryProcess::initializeSandbox):
1034         * Shared/ios/InteractionInformationAtPosition.h:
1035         * Shared/ios/InteractionInformationAtPosition.mm:
1036         (WebKit::InteractionInformationAtPosition::encode const):
1037         (WebKit::InteractionInformationAtPosition::decode):
1038         * Shared/mac/AuxiliaryProcessMac.mm:
1039         (WebKit::enableSandboxStyleFileQuarantine):
1040         * Shared/mac/CodeSigning.mm:
1041         * UIProcess/API/Cocoa/WKWebView.mm:
1042         (-[WKWebView _webViewPrintFormatter]):
1043         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1044         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1045         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1046         (WebKit::RemoteLayerTreeHost::updateLayerTree):
1047         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1048         (-[WKRemoteView initWithFrame:contextID:]):
1049         * UIProcess/_WKWebViewPrintFormatter.mm:
1050         * UIProcess/_WKWebViewPrintFormatterInternal.h:
1051         * UIProcess/ios/WKActionSheetAssistant.mm:
1052         (-[WKActionSheetAssistant _elementActionForDDAction:]):
1053         * UIProcess/ios/WKContentView.mm:
1054         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
1055         * UIProcess/ios/WKContentViewInteraction.h:
1056         * UIProcess/ios/WKContentViewInteraction.mm:
1057         (-[WKContentView setupInteraction]):
1058         (-[WKContentView cleanupInteraction]):
1059         (-[WKContentView _removeDefaultGestureRecognizers]):
1060         (-[WKContentView _addDefaultGestureRecognizers]):
1061         (-[WKContentView _showTapHighlight]):
1062         (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]):
1063         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1064         (-[WKContentView canPerformActionForWebView:withSender:]):
1065         (-[WKContentView _defineForWebView:]):
1066         (-[WKContentView setSelectedTextRange:]):
1067         (-[WKContentView closestPositionToPoint:]):
1068         (-[WKContentView _showShareSheet:inRect:completionHandler:]):
1069         * UIProcess/ios/WebPageProxyIOS.mm:
1070         (WebKit::desktopClassBrowsingSupported):
1071         (WebKit::desktopClassBrowsingRecommended):
1072         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1073         (-[WKFileUploadPanel _showDocumentPickerMenu]):
1074         * WebKit.xcodeproj/project.pbxproj:
1075         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
1076         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1077         (WebKit::WebPage::dictionaryPopupInfoForRange):
1078         * WebProcess/WebPage/ios/WebPageIOS.mm:
1079         (WebKit::WebPage::platformEditorState const):
1080         (WebKit::WebPage::selectWithGesture):
1081         (WebKit::selectionPositionInformation):
1082         * WebProcess/cocoa/WebProcessCocoa.mm:
1083         (WebKit::WebProcess::initializeSandbox):
1084         * WebProcess/com.apple.WebProcess.sb.in:
1085
1086 2019-06-27  Saam Barati  <sbarati@apple.com>
1087
1088         Make WEBGPU enabled only on Mojave and later.
1089
1090         Rubber-stamped by Myles C. Maxfield.
1091
1092         * Configurations/FeatureDefines.xcconfig:
1093
1094 2019-06-27  Adrian Perez de Castro  <aperez@igalia.com>
1095
1096         [GTK][WPE] Fix build non-unified builds after r246856
1097         https://bugs.webkit.org/show_bug.cgi?id=199263
1098
1099         Reviewed by Michael Catanzaro.
1100
1101         * UIProcess/API/C/WKMessageListener.cpp: Added missing inclusion of WKAPICast.h and usage of WebKit namespace.
1102
1103 2019-06-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1104
1105         [SOUP] WebSockets: handle TLS certificate and errors
1106         https://bugs.webkit.org/show_bug.cgi?id=199223
1107
1108         Reviewed by Michael Catanzaro.
1109
1110         Connect to accept-certificate signal on the WebSocket message connection to decide what to do in case of TLS errors.
1111
1112         * NetworkProcess/soup/NetworkSessionSoup.cpp:
1113         (WebKit::webSocketAcceptCertificateCallback):
1114         (WebKit::webSocketMessageNetworkEventCallback):
1115         (WebKit::NetworkSessionSoup::createWebSocketTask):
1116
1117 2019-06-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1118
1119         [SOUP] Use libsoup WebSockets API
1120         https://bugs.webkit.org/show_bug.cgi?id=199151
1121
1122         Reviewed by Michael Catanzaro.
1123
1124         Use the new WebSockets code path that depends on platform specific WebSockets implementation using the libsoup
1125         API. This is an initial implementation manually tested using the layout tests, which most of them fail due to
1126         missing console messages, missing features in the new code path or differences in the platform
1127         implementation. It will be disabled by default until it's feature complete compared to the internal WebKit
1128         implementation.
1129
1130         * NetworkProcess/NetworkSocketChannel.cpp:
1131         (WebKit::NetworkSocketChannel::NetworkSocketChannel): Null check m_socket before using it, because
1132         createWebSocketTask() can return nullptr;
1133         (WebKit::NetworkSocketChannel::didConnect): Receive the protocol accepted by the server.
1134         (WebKit::NetworkSocketChannel::didReceiveMessageError): Something failed in the server side.
1135         * NetworkProcess/NetworkSocketChannel.h:
1136         * NetworkProcess/WebSocketTask.h:
1137         * NetworkProcess/soup/NetworkSessionSoup.cpp:
1138         (WebKit::NetworkSessionSoup::createWebSocketTask): Create a WebSocketTask.
1139         * NetworkProcess/soup/NetworkSessionSoup.h:
1140         * NetworkProcess/soup/WebSocketTaskSoup.cpp: Added.
1141         (WebKit::WebSocketTask::WebSocketTask):
1142         (WebKit::WebSocketTask::~WebSocketTask):
1143         (WebKit::WebSocketTask::didConnect):
1144         (WebKit::WebSocketTask::didReceiveMessageCallback):
1145         (WebKit::WebSocketTask::didReceiveErrorCallback):
1146         (WebKit::WebSocketTask::didFail):
1147         (WebKit::WebSocketTask::didCloseCallback):
1148         (WebKit::WebSocketTask::didClose):
1149         (WebKit::WebSocketTask::sendString):
1150         (WebKit::WebSocketTask::sendData):
1151         (WebKit::WebSocketTask::close):
1152         (WebKit::WebSocketTask::cancel):
1153         (WebKit::WebSocketTask::resume):
1154         * NetworkProcess/soup/WebSocketTaskSoup.h: Copied from Source/WebKit/NetworkProcess/WebSocketTask.h.
1155         * SourcesGTK.txt:
1156         * WebProcess/Network/WebSocketChannel.cpp:
1157         (WebKit::WebSocketChannel::subprotocol): Return the protocol accepted by the server.
1158         (WebKit::WebSocketChannel::didConnect): Set the protocol accepted by the server.
1159         (WebKit::WebSocketChannel::didReceiveMessageError): It's now an IPC message handler and receives the reason as parameter.
1160         (WebKit::WebSocketChannel::networkProcessCrashed): Pass empty reason.
1161         * WebProcess/Network/WebSocketChannel.h:
1162         * WebProcess/Network/WebSocketChannel.messages.in:
1163
1164 2019-06-21  Konstantin Tokarev  <annulen@yandex.ru>
1165
1166         [cmake] Switch to built-in handling of C++ standard instead of hardcoding -std=c++17
1167         https://bugs.webkit.org/show_bug.cgi?id=199108
1168
1169         Reviewed by Don Olmstead.
1170
1171         Rationale:
1172
1173         1. It provides an abstraction over exact flags of particular compilers -
1174            we just specify required version of C++ standard
1175         2. External libraries (like Qt used in WPEQt) may require particular C++
1176            standard or even particular C++ features to be availabe (e.g. Qt
1177            requires INTERFACE_COMPILE_FEATURES cxx_decltype, which causes cmake
1178            to add -std=gnu++11 unless proper CXX_STANDARD is defined)
1179
1180         * PlatformWPE.cmake: Use project-level default for CXX_STANDARD
1181         property.
1182
1183 2019-06-26  Jiewen Tan  <jiewen_tan@apple.com>
1184
1185         SubFrameSOAuthorizationSession should preserve the referrer header when fall back to web path
1186         https://bugs.webkit.org/show_bug.cgi?id=199232
1187         <rdar://problem/51718328>
1188
1189         Reviewed by Youenn Fablet.
1190
1191         The fall back to web path mechanism in SubFrameSOAuthorizationSession doesn't actually resume
1192         the previous navigation. Instead it starts a new one. The current implementation doesn't carry
1193         any information from the previous navigation. It is problematic when it comes to http referrer
1194         as the server might use that to determine what kind of responses to send back. Therefore, we
1195         add that information now.
1196
1197         To accomplish the above, the patch teaches WebFrameProxy::loadURL to carry referrer information
1198         when it is available. Then SubFrameSOAuthorizationSession can reuses the referrer from the
1199         original request.
1200
1201         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm:
1202         (WebKit::SubFrameSOAuthorizationSession::fallBackToWebPathInternal):
1203         * UIProcess/WebFrameProxy.cpp:
1204         (WebKit::WebFrameProxy::loadURL):
1205         * UIProcess/WebFrameProxy.h:
1206         * WebProcess/WebPage/WebPage.cpp:
1207         (WebKit::WebPage::loadURLInFrame):
1208         * WebProcess/WebPage/WebPage.h:
1209         * WebProcess/WebPage/WebPage.messages.in:
1210
1211 2019-06-26  Fujii Hironori  <Hironori.Fujii@sony.com>
1212
1213         testRunner.setAlwaysAcceptCookies should wait for cookie accept policy to be set
1214         https://bugs.webkit.org/show_bug.cgi?id=199230
1215         <rdar://problem/52217933>
1216
1217         Unreviewed build fix for WinCairo WK2 since r246856.
1218
1219         * PlatformWin.cmake: Added WKMessageListener.h to WebKit_PUBLIC_FRAMEWORK_HEADERS.
1220
1221 2019-06-26  Dean Jackson  <dino@apple.com>
1222
1223         Add type to UIImage symbol mapping for _WKElementAction
1224         https://bugs.webkit.org/show_bug.cgi?id=199255
1225
1226         Reviewed by Sam Weinig.
1227
1228         Moving some code in from WebKitAdditions now
1229         that the API is public.
1230
1231         * UIProcess/API/Cocoa/_WKElementAction.mm:
1232         (+[_WKElementAction imageForElementActionType:]):
1233         (elementActionTypeToUIActionIdentifier):
1234         (uiActionIdentifierToElementActionType):
1235
1236 2019-06-26  Dean Jackson  <dino@apple.com>
1237
1238         Expose UIAction identifiers for _WKElementActions
1239         https://bugs.webkit.org/show_bug.cgi?id=199246
1240         <rdar://problem/52218950>
1241
1242         Reviewed by Tim Horton.
1243
1244         In order for clients to create a contextual menu, they are given
1245         a set of suggested UIActions, created from _WKElementActions.
1246         By associating identifiers (strings) with the UIActions, clients
1247         can inspect the suggestions and make a decision on whether or
1248         not to include them in the final menu.
1249
1250         * UIProcess/API/Cocoa/_WKElementAction.h: Typedef UIActionIdentifier,
1251         add a method to create a UIAction from an _WKElementAction, and a
1252         helper to map between identifiers and types.
1253
1254         * UIProcess/API/Cocoa/_WKElementAction.mm:
1255         (elementActionTypeToUIActionIdentifier): Helper to convert between the two types.
1256         (uiActionIdentifierToElementActionType): The inverse of above.
1257         (+[_WKElementAction elementActionTypeForUIActionIdentifier:]): A client given
1258         a UIAction object can use this helper method to see what _WKElementActionType it
1259         corresponds to.
1260         (-[_WKElementAction uiActionForElementInfo:]): Used by WKContentViewInteraction to
1261         create a UIAction from this _WKElementAction.
1262
1263         * UIProcess/ios/WKContentViewInteraction.mm:
1264         (uiActionForLegacyPreviewAction): Renamed to make it clear this is a legacy approach.
1265         (menuFromLegacyPreviewOrDefaultActions): Split these functions to separate the legacy
1266         and non-legacy approach.
1267         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
1268         (-[WKContentView continueContextMenuInteraction:]):
1269         (uiActionForPreviewAction): Deleted.
1270         (menuFromPreviewOrDefaults): Deleted.
1271
1272 2019-06-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1273
1274         [iPadOS] Fix another crash in -[UIPreviewTarget initWithContainer:center:transform:] when generating a fallback targeted preview
1275         https://bugs.webkit.org/show_bug.cgi?id=199243
1276         <rdar://problem/51554509>
1277
1278         Reviewed by Tim Horton.
1279
1280         Additionally make createFallbackTargetedPreview robust in the case where the content view is unparented, and
1281         rename _ensureTargetedPreview to _createTargetedPreviewIfPossible, to reflect the fact that it may now return
1282         nil.
1283
1284         * UIProcess/ios/WKContentViewInteraction.mm:
1285         (createTargetedPreview):
1286         (createFallbackTargetedPreview):
1287         (-[WKContentView _createTargetedPreviewIfPossible]):
1288         (-[WKContentView contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
1289         (-[WKContentView contextMenuInteraction:previewForDismissingMenuWithConfiguration:]):
1290         (-[WKContentView _ensureTargetedPreview]): Deleted.
1291
1292 2019-06-26  Alex Christensen  <achristensen@webkit.org>
1293
1294         testRunner.setAlwaysAcceptCookies should wait for cookie accept policy to be set
1295         https://bugs.webkit.org/show_bug.cgi?id=199230
1296         <rdar://51757107>
1297
1298         Reviewed by Andy Estes.
1299
1300         This patch adds an optional callback to WKCookieManagerSetHTTPCookieAcceptPolicy which is luckily only used for testing.
1301         It also adds listener-based asynchronous versions of didReceiveSynchronousMessageFromInjectedBundle.
1302         WebKitTestRunner uses these new abilities to wait for the cookie accept policy to be set in the network process while the web process is hung.
1303         This removes the race condition that was causing some flakiness in tests that use testRunner.setAlwaysAcceptCookies
1304
1305         * Shared/API/APIObject.h:
1306         * Shared/API/c/WKBase.h:
1307         * Sources.txt:
1308         * UIProcess/API/APIInjectedBundleClient.h:
1309         (API::InjectedBundleClient::didReceiveSynchronousMessageFromInjectedBundle):
1310         * UIProcess/API/APIMessageListener.h: Copied from Source/WebKit/UIProcess/API/APIInjectedBundleClient.h.
1311         (API::MessageListener::create):
1312         (API::MessageListener::sendReply):
1313         (API::MessageListener::MessageListener):
1314         * UIProcess/API/C/WKAPICast.h:
1315         * UIProcess/API/C/WKContextInjectedBundleClient.h:
1316         * UIProcess/API/C/WKCookieManager.cpp:
1317         (WKCookieManagerSetHTTPCookieAcceptPolicy):
1318         * UIProcess/API/C/WKCookieManager.h:
1319         * UIProcess/API/C/WKMessageListener.cpp: Copied from Source/WebKit/UIProcess/API/APIInjectedBundleClient.h.
1320         (WKMessageListenerGetTypeID):
1321         (WKMessageListenerSendReply):
1322         * UIProcess/API/C/WKMessageListener.h: Copied from Source/WebKit/UIProcess/API/APIInjectedBundleClient.h.
1323         * UIProcess/API/C/WKPageInjectedBundleClient.h:
1324         * UIProcess/WebContextInjectedBundleClient.cpp:
1325         (WebKit::WebContextInjectedBundleClient::didReceiveSynchronousMessageFromInjectedBundle):
1326         * UIProcess/WebContextInjectedBundleClient.h:
1327         * UIProcess/WebPageInjectedBundleClient.cpp:
1328         (WebKit::WebPageInjectedBundleClient::didReceiveSynchronousMessageFromInjectedBundle):
1329         * UIProcess/WebPageInjectedBundleClient.h:
1330         * UIProcess/WebPageProxy.cpp:
1331         (WebKit::WebPageProxy::handleSynchronousMessage):
1332         * UIProcess/WebPageProxy.h:
1333         (WebKit::WebPageProxy::injectedBundleClient): Deleted.
1334         * UIProcess/WebProcessPool.cpp:
1335         (WebKit::WebProcessPool::handleSynchronousMessage):
1336         * WebKit.xcodeproj/project.pbxproj:
1337
1338 2019-06-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1339
1340         [iPadOS] eddm.usps.com scrolls horizontally due to explicit width set in viewport meta tag
1341         https://bugs.webkit.org/show_bug.cgi?id=199219
1342         <rdar://problem/50425765>
1343
1344         Reviewed by Tim Horton.
1345
1346         Currently, the heuristic to determine whether the page should be shrunk to fit the content width after loading
1347         works by checking whether the page's content is wider than the layout width we've provided for the page.
1348         However, in the case where an explicit width larger than the true view width is specified by the page's meta
1349         viewport, we'll end up believing that the page's content is not wider than the layout width, which is dictated
1350         by the fixed meta viewport width. Instead, we can shrink the page down in this scenario by comparing the content
1351         width against the scaled size of the view when computing the amount of horizontal overflow.
1352
1353         Test: fast/viewport/ios/shrink-to-fit-content-large-constant-width.html
1354
1355         * WebProcess/WebPage/ios/WebPageIOS.mm:
1356         (WebKit::WebPage::immediatelyShrinkToFitContent):
1357
1358 2019-06-26  Zalan Bujtas  <zalan@apple.com>
1359
1360         [ContentChangeObserver] Dispatch synthetic mouse event asynchronously in completePendingSyntheticClickForContentChangeObserver
1361         https://bugs.webkit.org/show_bug.cgi?id=199220
1362         <rdar://problem/51787961>
1363
1364         Reviewed by Simon Fraser.
1365
1366         WebPage::completePendingSyntheticClickForContentChangeObserver should not dispatch mouse events synchronously.
1367         Mouse events, through style updates could destroy the element that initiated this change.
1368         WebPage::handleSyntheticClick() already implements this pattern.
1369
1370         * WebProcess/WebPage/ios/WebPageIOS.mm:
1371         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
1372
1373 2019-06-25  Jiewen Tan  <jiewen_tan@apple.com>
1374
1375         Implement a new SPI to inform clients about AppSSO
1376         https://bugs.webkit.org/show_bug.cgi?id=199085
1377         <rdar://problem/50028246>
1378
1379         Reviewed by Geoffrey Garen.
1380
1381         This patch implements a new SPI to inform clients about incoming AppSSO interceptions during
1382         navigations. Therefore, clients can make an informed decision about whether this is the right
1383         moment to do the interception as interceptions often show native UI. Also, the SPI is designed
1384         to pass along a human readable name for the extension such that clients can do whatever they
1385         want to inform users about what's going on.
1386
1387         Here is the new SPI:
1388         - (void)_webView:(WKWebView *)webView decidePolicyForSOAuthorizationLoadWithCurrentPolicy:(_WKSOAuthorizationLoadPolicy)policy forExtension:(NSString *)extension completionHandler:(void (^)(_WKSOAuthorizationLoadPolicy policy))completionHandler;
1389
1390         * UIProcess/API/APINavigationClient.h:
1391         (API::NavigationClient::decidePolicyForSOAuthorizationLoad):
1392         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1393         * UIProcess/Cocoa/NavigationState.h:
1394         * UIProcess/Cocoa/NavigationState.mm:
1395         (WebKit::NavigationState::setNavigationDelegate):
1396         (WebKit::soAuthorizationLoadPolicy):
1397         (WebKit::wkSOAuthorizationLoadPolicy):
1398         (WebKit::NavigationState::NavigationClient::decidePolicyForSOAuthorizationLoad):
1399         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationLoadPolicy.h: Added.
1400         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
1401         (WebKit::SOAuthorizationSession::start):
1402         * UIProcess/WebPageProxy.cpp:
1403         (WebKit::WebPageProxy::decidePolicyForSOAuthorizationLoad):
1404         * UIProcess/WebPageProxy.h:
1405         * WebKit.xcodeproj/project.pbxproj:
1406
1407 2019-06-25  Simon Fraser  <simon.fraser@apple.com>
1408
1409         [iOS WK2 Debug] scrollingcoordinator/scrolling-tree/scroller-with-negative-z-child.html asserts
1410         https://bugs.webkit.org/show_bug.cgi?id=199218
1411
1412         Reviewed by Zalan Bujtas.
1413
1414         Followup to r246766; don't assert in the UI process if a ScrollingTreeOverflowScrollProxyNode
1415         doesn't have a related overflow node; this is currently expected behavior with negative z-order
1416         children of a scroller.
1417
1418         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1419         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
1420
1421 2019-06-25  Daniel Bates  <dabates@apple.com>
1422
1423         Non-editable text selections should be modifiable with hardware keyboard
1424         https://bugs.webkit.org/show_bug.cgi?id=199204
1425         <rdar://problem/51651496>
1426
1427         Reviewed by Wenson Hsieh.
1428
1429         UIKit changes are need for this to work, including <rdar://problem/48322899>.
1430         Note that without these changes, -canPerformAction is never called for _move*
1431         selectors.
1432
1433         * UIProcess/ios/WKContentViewInteraction.mm:
1434         (-[WKContentView canPerformAction:withSender:]):
1435
1436 2019-06-25  Daniel Bates  <dabates@apple.com>
1437
1438         [iOS] Should not process key events in non-editable elements using IME
1439         https://bugs.webkit.org/show_bug.cgi?id=199122
1440         <rdar://problem/52006654>
1441
1442         Reviewed by Brent Fulgham.
1443
1444         Use the non-Input Method code path (the one we use for US keyboard input) for all key events
1445         targeting a non-editable element. Such key events will never require Input Method support
1446         (i.e. show candidate suggestions). Moreover, this behavior matches the behavior on Mac.
1447
1448         * UIProcess/ios/WKContentViewInteraction.mm:
1449         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
1450
1451 2019-06-25  Alex Christensen  <achristensen@webkit.org>
1452
1453         Make HTTPCookieAcceptPolicy an enum class
1454         https://bugs.webkit.org/show_bug.cgi?id=199081
1455
1456         Reviewed by Michael Catanzaro.
1457
1458         Doing so reveals some interesting bugs in the C API that are also fixed:
1459         WKPreferencesGetIncrementalRenderingSuppressionTimeout was using its toAPI function to convert a double to a double because HTTPCookieAcceptPolicy used to be an unsigned integer.
1460         toAPI(WebCore::MouseButton) was also using the toAPI(HTTPCookieAcceptPolicy) because HTTPCookieAcceptPolicy used to be an unsigned integer.
1461         Yikes!  Type safety is our friend.
1462
1463         * NetworkProcess/Cookies/WebCookieManager.messages.in:
1464         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
1465         (WebKit::toCFHTTPCookieStorageAcceptPolicy):
1466         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
1467         (WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy):
1468         * Shared/API/c/WKSharedAPICast.h:
1469         (WebKit::toAPI):
1470         * Shared/HTTPCookieAcceptPolicy.h:
1471         (): Deleted.
1472         * UIProcess/API/C/WKAPICast.h:
1473         (WebKit::toHTTPCookieAcceptPolicy):
1474         (WebKit::toAPI):
1475         * UIProcess/API/C/WKPreferences.cpp:
1476         (WKPreferencesGetIncrementalRenderingSuppressionTimeout):
1477         * UIProcess/API/Cocoa/WKProcessPool.mm:
1478         (toHTTPCookieAcceptPolicy):
1479         * UIProcess/WebCookieManagerProxy.cpp:
1480         (WebKit::WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy):
1481         * UIProcess/WebCookieManagerProxy.h:
1482         * UIProcess/WebCookieManagerProxy.messages.in:
1483
1484 2019-06-25  Tim Horton  <timothy_horton@apple.com>
1485
1486         Wrong title for Data Detectors tap action menu
1487         https://bugs.webkit.org/show_bug.cgi?id=199198
1488         <rdar://problem/51957842>
1489
1490         Reviewed by Wenson Hsieh.
1491
1492         * UIProcess/ios/WKActionSheetAssistant.mm:
1493         (-[WKActionSheetAssistant showDataDetectorsSheet]):
1494         Always pass the results array through to DataDetectors; they need it
1495         to figure out the title too!
1496
1497 2019-06-25  Wenson Hsieh  <wenson_hsieh@apple.com>
1498
1499         [iOS] Occasional crash under -[UIPreviewTarget initWithContainer:center:transform:] when generating a drag preview
1500         https://bugs.webkit.org/show_bug.cgi?id=199192
1501         <rdar://problem/51554509>
1502
1503         Reviewed by Tim Horton.
1504
1505         Tweak our preview generation code (for both the context menu and dragging) to be robust in the case where the
1506         content view's unscaled view is nil; this may happen in the case after the web content process is terminated
1507         and -cleanupInteraction is called, but before -setupInteraction is subsequently called.
1508
1509         Additionally, make our logic for creating targeted previews robust in the case where the view is removed from
1510         the view hierarchy right before the platform asks for a targeted preview.
1511
1512         Test:   DragAndDropTests.WebProcessTerminationDuringDrag
1513                 DragAndDropTests.WebViewRemovedFromViewHierarchyDuringDrag
1514
1515         * UIProcess/ios/WKContentViewInteraction.mm:
1516         (-[WKContentView containerViewForTargetedPreviews]):
1517         (-[WKContentView _deliverDelayedDropPreviewIfPossible:]):
1518         (-[WKContentView dragInteraction:previewForLiftingItem:session:]):
1519         (-[WKContentView _ensureTargetedPreview]):
1520
1521 2019-06-25  Youenn Fablet  <youenn@apple.com>
1522
1523         Close sockets with too high file descriptor
1524         https://bugs.webkit.org/show_bug.cgi?id=199116
1525
1526         Reviewed by Eric Carlson.
1527
1528         Log the case of failing to open a socket.
1529
1530         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
1531         (WebKit::NetworkRTCProvider::createSocket):
1532
1533 2019-06-25  Tim Horton  <timothy_horton@apple.com>
1534
1535         When Caps Lock is enabled on the Smart Keyboard, can't scroll with space or arrow keys
1536         https://bugs.webkit.org/show_bug.cgi?id=199187
1537         <rdar://problem/51521709>
1538
1539         Reviewed by Anders Carlsson.
1540
1541         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
1542         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
1543         When deciding whether a key event should start a scroll, ignore all
1544         modifiers other than the ones we actually care about (including Caps Lock).
1545
1546 2019-06-25  Michael Catanzaro  <mcatanzaro@igalia.com>
1547
1548         Fully rename WebKitGTK+ -> WebKitGTK everywhere
1549         https://bugs.webkit.org/show_bug.cgi?id=199159
1550
1551         Reviewed by Carlos Garcia Campos.
1552
1553         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
1554
1555 2019-06-24  Brady Eidson  <beidson@apple.com>
1556
1557         Null deref in WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad.
1558         <rdar://problem/51535942> and https://bugs.webkit.org/show_bug.cgi?id=199123
1559
1560         Reviewed by Andy Estes.
1561
1562         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1563         (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): Properly detect this null DocumentLoader
1564           and try to learn more about the state of things.
1565
1566 2019-06-24  Chris Dumez  <cdumez@apple.com>
1567
1568         Pages using Google's anti-flicker optimization may take ~5 seconds to do initial paint
1569         https://bugs.webkit.org/show_bug.cgi?id=199173
1570         <rdar://problem/45968770>
1571
1572         Reviewed by Geoffrey Garen.
1573
1574         Add experimental feature for the quirk.
1575
1576         * Shared/WebPreferences.yaml:
1577
1578 2019-06-24  John Wilander  <wilander@apple.com>
1579
1580         Remove IsITPFirstPartyWebsiteDataRemovalEnabled as runtime check
1581         https://bugs.webkit.org/show_bug.cgi?id=199164
1582         <rdar://problem/52061147>
1583
1584         Reviewed by Brent Fulgham.
1585
1586         We've had this toggle as a safety thing since mid-March. No need for it any longer.
1587
1588         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1589         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor const):
1590         * NetworkProcess/NetworkProcess.cpp:
1591         (WebKit::NetworkProcess::initializeNetworkProcess):
1592         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1593         (WebKit::NetworkProcessCreationParameters::encode const):
1594         (WebKit::NetworkProcessCreationParameters::decode):
1595         * NetworkProcess/NetworkProcessCreationParameters.h:
1596         * Shared/WebPreferences.yaml:
1597         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1598         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1599
1600 2019-06-24  Daniel Bates  <dabates@apple.com>
1601
1602         m_focusedElement != &element in WebPage::elementDidBlur() sometimes
1603         https://bugs.webkit.org/show_bug.cgi?id=198928
1604         <rdar://problem/51814327>
1605
1606         Reviewed by Brent Fulgham.
1607
1608         This can happen when the focused editable element is inside a nested frame and a person
1609         taps outside that frame. For reasons that seem lost to time, WebKit2 on iOS would mutate
1610         the focused frame whenever computing selection positioning information (say, for a tap).
1611         This "quirk" was added in r163476, but that code has go through multiple iterations and
1612         is no longer comparable to the current code. Yet, the original mutation of the focused
1613         frame remained. As a result the UI process and Web process go out of sync with respect
1614         to what each thinks is the focused element and this visually manifest itself in at least
1615         two ways:
1616
1617             1. A non-sensical DOM focus event would be dispatched at the frame tapped, but
1618             we would keep the focused element focused.
1619
1620             2. Because we would keep the focused element focused in (1), even though its frame
1621             is not focused, the keyboard would be active (software keyboard on screen or candidate bar
1622             on screen if a hardware keyboard is attached), but appear unresponsive: any keys pressed
1623             would not cause text to be typed into the editable field.
1624
1625         Because of (1) it was possible for m_focusedElement != &element in WebPage::elementDidBlur().
1626         When this happens the UI process would never receive an ElementDidBlur message and hence would
1627         not clear out the focused element state and hide the keyboard.
1628
1629         We neither do this frame focus mutation in Legacy WebKit on iOS nor Mac. Let's remove this quirk.
1630         If it turns out that it causes a compatibility issue then we will be in a better position to
1631         understand its purpose and consider bringing this quirk back, if needed.
1632
1633         * Shared/ios/InteractionInformationRequest.cpp:
1634         (WebKit::InteractionInformationRequest::encode const):
1635         (WebKit::InteractionInformationRequest::decode):
1636         (WebKit::InteractionInformationRequest::isValidForRequest):
1637         (WebKit::InteractionInformationRequest::isApproximatelyValidForRequest):
1638         * Shared/ios/InteractionInformationRequest.h:
1639         * UIProcess/API/Cocoa/WKWebView.mm:
1640         (-[WKWebView _requestActivatedElementAtPosition:completionBlock:]):
1641         * UIProcess/ios/WKContentViewInteraction.mm:
1642         (-[WKContentView _webTouchEventsRecognized:]):
1643         Remove the readOnly field.
1644
1645         * WebProcess/WebPage/ios/WebPageIOS.mm:
1646         (WebKit::selectionPositionInformation): Remove code to mutate the focused frame.
1647
1648 2019-06-24  Per Arne Vollan  <pvollan@apple.com>
1649
1650         [Cocoa] Avoid creating a PlatformMediaSessionManager when the WebProcess is suspended or resumed
1651         https://bugs.webkit.org/show_bug.cgi?id=199160
1652
1653         Reviewed by Brent Fulgham.
1654
1655         When the WebProcess suspends or resumes, the PlatformMediaSessionManager is notified about this.
1656         Avoid creating a new PlatformMediaSessionManager if it does not already exist.
1657
1658         * WebProcess/WebProcess.cpp:
1659         (WebKit::WebProcess::actualPrepareToSuspend):
1660         (WebKit::WebProcess::cancelPrepareToSuspend):
1661         (WebKit::WebProcess::processDidResume):
1662
1663 2019-06-24  Adrian Perez de Castro  <aperez@igalia.com>
1664
1665         [WPE][GTK] Fixes for compilation with unified builds disabled
1666         https://bugs.webkit.org/show_bug.cgi?id=199155
1667
1668         Reviewed by Michael Catanzaro.
1669
1670         * NetworkProcess/glib/DNSCache.cpp: Add missing inclusion of wtf/glib/RunLoopSourcePriority.h
1671         * NetworkProcess/glib/DNSCache.h: Add missing forward declaration for GInetAddress
1672
1673 2019-06-24  Alexander Mikhaylenko  <exalm7659@gmail.com>
1674
1675         [GTK] Navigation gesture should use dark fallback bg color on dark themes
1676         https://bugs.webkit.org/show_bug.cgi?id=199104
1677
1678         Reviewed by Michael Catanzaro.
1679
1680         Use theme_base_color instead of white background for swipe gesture fallback if no snapshot is found and
1681         the page did not specify a color. This allows it to use dark colors for dark themes. If the color was
1682         not found, still fall back to white.
1683
1684         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
1685         (WebKit::ViewGestureController::beginSwipeGesture):
1686
1687 2019-06-23  Dan Bernstein  <mitz@apple.com>
1688
1689         Platform font class gets needlessly initialized in the Networking process
1690         https://bugs.webkit.org/show_bug.cgi?id=199140
1691
1692         Reviewed by Tim Horton.
1693
1694         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: Revert a change that was made in
1695           r246702, which is not needed anymore.
1696         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Ditto.
1697
1698         * Shared/Cocoa/ArgumentCodersCocoa.mm:
1699         (IPC::platformColorClass): Added getter that uses NSClassFromString, thereby avoiding
1700           initializing the class.
1701         (IPC::platformFontClass): Ditto.
1702         (IPC::typeFromObject): Changed to use the above getters instead of +class.
1703
1704 2019-06-23  Simon Fraser  <simon.fraser@apple.com>
1705
1706         [Async overflow scroll] Clipped composited layers inside overflow scroll jitter and get incorrectly clipped
1707         https://bugs.webkit.org/show_bug.cgi?id=199133
1708         rdar://problem/43614439
1709
1710         Reviewed by Antti Koivisto.
1711         
1712         LayoutConstraints -> AbsolutePositionConstraints rename.
1713
1714         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1715         (ArgumentCoder<ScrollingStatePositionedNode>::decode):
1716         * Shared/WebCoreArgumentCoders.cpp:
1717         (IPC::ArgumentCoder<AbsolutePositionConstraints>::encode):
1718         (IPC::ArgumentCoder<AbsolutePositionConstraints>::decode):
1719         (IPC::ArgumentCoder<LayoutConstraints>::encode): Deleted.
1720         (IPC::ArgumentCoder<LayoutConstraints>::decode): Deleted.
1721         * Shared/WebCoreArgumentCoders.h:
1722         * Shared/WebRenderLayer.cpp:
1723         (WebKit::WebRenderLayer::WebRenderLayer):
1724         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1725         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations): ScrollingTreeOverflowScrollProxyNode
1726         have overflow scroll relations now too.
1727
1728 2019-06-23  Simon Fraser  <simon.fraser@apple.com>
1729
1730         Add OverflowScrollProxyNodes to the scrolling tree
1731         https://bugs.webkit.org/show_bug.cgi?id=199132
1732
1733         Reviewed by Antti Koivisto.
1734
1735         Add ScrollingStateOverflowScrollProxyNode and ScrollingTreeOverflowScrollProxyNode. These
1736         nodes represent clip and scroll position for an overflow:scroll in the containing block chain,
1737         but not the paint ancestor chain of a layer. They will be used to correctly manipulate clip
1738         rects for composited layers in non-stacking-context scrollers, and in a future patch will
1739         replace the functionality of "Moves" positioned nodes.
1740
1741         An OverflowScrollProxyNode has the ScrollingNodeID of the scrolling node that it relates to,
1742         and we use the existing "related overflow nodes" to create the back references in the scrolling tree.
1743
1744         These nodes are not instantiated yet; a future patch will hook them up.
1745
1746         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1747         (ArgumentCoder<ScrollingStateOverflowScrollProxyNode>::encode):
1748         (ArgumentCoder<ScrollingStateOverflowScrollProxyNode>::decode):
1749         (WebKit::encodeNodeAndDescendants):
1750         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
1751         (WebKit::dump):
1752         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1753         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1754         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
1755         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
1756         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1757         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1758         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1759         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers):
1760
1761 2019-06-21  Jiewen Tan  <jiewen_tan@apple.com>
1762
1763         Unreviewed, a build fix after r246701
1764
1765         * Shared/LoadParameters.h:
1766         Add a default value for shouldOpenExternalURLsPolicy.
1767
1768 2019-06-21  Brent Fulgham  <bfulgham@apple.com>
1769
1770         Adjust sandboxes based on seed feedback
1771         https://bugs.webkit.org/show_bug.cgi?id=199119
1772         <rdar://problem/50164879>
1773
1774         Reviewed by Geoffrey Garen.
1775
1776         Update our sandboxes to address test failures and bugs encountered during initial iOS 13 and
1777         macOS Catalina testing.
1778
1779         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
1780         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1781         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1782         * WebProcess/com.apple.WebProcess.sb.in:
1783
1784 2019-06-21  Jiewen Tan  <jiewen_tan@apple.com>
1785
1786         WebPageProxy::loadData should accept ShouldOpenExternalURLsPolicy
1787         https://bugs.webkit.org/show_bug.cgi?id=199114
1788         <rdar://problem/51671674>
1789
1790         Reviewed by Youenn Fablet.
1791
1792         This patch teaches WebPageProxy::loadData to accept ShouldOpenExternalURLsPolicy policy,
1793         and then utilize it in RedirectSOAuthorizationSession. Therefore, the response loaded after
1794         successful interceptions will be able to propagate the same policy from the last navigation
1795         as it were continuous loading.
1796
1797         Besides the above, this patch also fixes some minor issues.
1798
1799         * Shared/LoadParameters.h:
1800         * UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm:
1801         (WebKit::NavigationSOAuthorizationSession::shouldStartInternal):
1802         (WebKit::NavigationSOAuthorizationSession::webViewDidMoveToWindow):
1803         * UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.h:
1804         * UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm:
1805         (WebKit::PopUpSOAuthorizationSession::completeInternal):
1806         * UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.h:
1807         * UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm:
1808         (WebKit::shouldOpenExternalURLsPolicy):
1809         (WebKit::RedirectSOAuthorizationSession::completeInternal):
1810         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.h:
1811         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
1812         (WebKit::SOAuthorizationSession::complete):
1813         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h:
1814         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm:
1815         (WebKit::SubFrameSOAuthorizationSession::fallBackToWebPathInternal):
1816         (WebKit::SubFrameSOAuthorizationSession::completeInternal):
1817         (WebKit::SubFrameSOAuthorizationSession::loadDataToFrame):
1818         (WebKit::SubFrameSOAuthorizationSession::postDidCancelMessageToParent):
1819         * UIProcess/WebPageProxy.cpp:
1820         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
1821         (WebKit::WebPageProxy::loadFile):
1822         (WebKit::WebPageProxy::loadData):
1823         (WebKit::WebPageProxy::loadDataWithNavigationShared):
1824         * UIProcess/WebPageProxy.h:
1825         * WebProcess/WebPage/WebPage.cpp:
1826         (WebKit::WebPage::loadDataImpl):
1827         (WebKit::WebPage::loadData):
1828         * WebProcess/WebPage/WebPage.h:
1829
1830 2019-06-21  Tim Horton  <timothy_horton@apple.com>
1831
1832         WebKit context menu highlights include extra padding
1833         https://bugs.webkit.org/show_bug.cgi?id=199080
1834         <rdar://problem/51140126>
1835
1836         Reviewed by Dean Jackson.
1837
1838         * Shared/ios/InteractionInformationRequest.cpp:
1839         (WebKit::InteractionInformationRequest::encode const):
1840         (WebKit::InteractionInformationRequest::decode):
1841         (WebKit::InteractionInformationRequest::isValidForRequest):
1842         (WebKit::InteractionInformationRequest::isApproximatelyValidForRequest):
1843         * Shared/ios/InteractionInformationRequest.h:
1844         * UIProcess/ios/WKContentViewInteraction.mm:
1845         (-[WKContentView gestureRecognizerShouldBegin:]):
1846         (-[WKContentView positionInformationForActionSheetAssistant:]):
1847         (-[WKContentView updatePositionInformationForActionSheetAssistant:]):
1848         (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]):
1849         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
1850         * WebProcess/WebPage/ios/WebPageIOS.mm:
1851         (WebKit::linkIndicatorPositionInformation):
1852         Disable the margin going forward, but leave it if we're using the legacy
1853         API, because there is no way to add margin at the platform level with
1854         the legacy API.
1855
1856         In the future we should always have no margin in our indicator, and just
1857         apply it in whatever consumes the indicator, so that there is no
1858         disagreement between clients about the size of the margin.
1859
1860 2019-06-21  Youenn Fablet  <youenn@apple.com>
1861
1862         WebPageProxy should use the right path for sandbox extension
1863         https://bugs.webkit.org/show_bug.cgi?id=198902
1864         <rdar://problem/50772810>
1865
1866         Reviewed by Geoffrey Garen.
1867
1868         Store the sandbox path, if any, in UIProcess for each page in its PageLoadState.
1869         This allows proper sandbox handling for reload after crash and process swap cases.
1870         Store the sandbox path, if any, in the b/w list so that the sandbox path can be properly computed
1871         during b/f navigation works.
1872
1873         Add SPI for test purposes to check what is the current sandbox path.
1874
1875         * Shared/WebBackForwardListItem.h:
1876         (WebKit::WebBackForwardListItem::resourceDirectoryURL const):
1877         (WebKit::WebBackForwardListItem::setResourceDirectoryURL):
1878         * UIProcess/API/Cocoa/WKWebView.mm:
1879         (-[WKWebView _resourceDirectoryURL]):
1880         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1881         * UIProcess/PageLoadState.cpp:
1882         (WebKit::PageLoadState::resourceDirectoryURL const):
1883         (WebKit::PageLoadState::setPendingAPIRequestURL):
1884         * UIProcess/PageLoadState.h:
1885         (WebKit::PageLoadState::setPendingAPIRequestURL):
1886         * UIProcess/WebPageProxy.cpp:
1887         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
1888         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
1889         (WebKit::WebPageProxy::loadFile):
1890         (WebKit::WebPageProxy::reload):
1891         (WebKit::WebPageProxy::backForwardAddItem):
1892         (WebKit::WebPageProxy::backForwardGoToItemShared):
1893         (WebKit::WebPageProxy::currentResourceDirectoryURL const):
1894         * UIProcess/WebPageProxy.h:
1895
1896 2019-06-21  Antoine Quint  <graouts@apple.com>
1897
1898         [iOS] Compatibility mouse events aren't prevented by calling preventDefault() on pointerdown
1899         https://bugs.webkit.org/show_bug.cgi?id=198124
1900         <rdar://problem/50410863>
1901
1902         Reviewed by Dean Jackson.
1903
1904         Ensure we wait until completion of a tap before removing the pointer ID and the preventDefault() state along with it.
1905
1906         * UIProcess/ios/WKContentViewInteraction.h:
1907         * UIProcess/ios/WKContentViewInteraction.mm:
1908         (-[WKContentView _singleTapDidReset:]):
1909         (-[WKContentView _commitPotentialTapFailed]):
1910         (-[WKContentView _didCompleteSyntheticClick]):
1911         (-[WKContentView _singleTapRecognized:]):
1912
1913 2019-06-21  Keith Rollin  <krollin@apple.com>
1914
1915         Address reference to UIColor.groupTableViewBackgroundColor in WKPasswordView.mm
1916         https://bugs.webkit.org/show_bug.cgi?id=199111
1917         <rdar://problem/51992107>
1918
1919         Reviewed by Timothy Hatcher.
1920
1921         WKPasswordView.mm is used on iOS-family devices. However, it doesn't
1922         build on tvOS or watchOS when "treat deprecation warnings as errors"
1923         is enabled. This build failure is due to a reference to
1924         UIColor.groupTableViewBackgroundColor in a branch of non-dark-mode
1925         code. Address this by surrounding the reference with
1926         ALLOW_DEPRECATED_DECLARATIONS_* macros.
1927
1928         Attempting to address the build failure by unconditionally enabling
1929         the dark-mode code works for tvOS, but fails for watchOS due to lack
1930         of dark-mode support on that platform.
1931
1932         * UIProcess/ios/WKPasswordView.mm:
1933         (-[WKPasswordView showInScrollView:]):
1934
1935 2019-06-21  Michael Catanzaro  <mcatanzaro@igalia.com>
1936
1937         [WPE][GTK] Bump minimum versions of GLib, GTK, libsoup, ATK, GStreamer, and Cairo
1938         https://bugs.webkit.org/show_bug.cgi?id=199094
1939
1940         Reviewed by Carlos Garcia Campos.
1941
1942         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1943         (WebKit::NetworkDataTaskSoup::createRequest):
1944         (WebKit::NetworkDataTaskSoup::writeDownloadCallback):
1945         (WebKit::NetworkDataTaskSoup::writeDownload):
1946         (WebKit::NetworkDataTaskSoup::startingCallback):
1947         (WebKit::NetworkDataTaskSoup::requestStartedCallback): Deleted.
1948         * Shared/gtk/WebEventFactory.cpp:
1949         (WebKit::buttonForEvent):
1950         (WebKit::WebEventFactory::createWebMouseEvent):
1951         (WebKit::WebEventFactory::createWebWheelEvent):
1952         (WebKit::WebEventFactory::createWebKeyboardEvent):
1953         (WebKit::WebEventFactory::createWebTouchEvent):
1954         * UIProcess/API/gtk/PageClientImpl.cpp:
1955         (WebKit::PageClientImpl::doneWithTouchEvent):
1956         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1957         (ClickCounter::currentClickCountForGdkButtonEvent):
1958         (webkitWebViewBaseRealize):
1959         (webkitWebViewBaseHandleMouseEvent):
1960         (webkitWebViewBaseGetTouchPointsForEvent):
1961         (webkitWebViewBaseTouchEvent):
1962         (webkitWebViewBaseGestureController):
1963         (webkitWebViewBaseEvent):
1964         (deviceScaleFactorChanged):
1965         (webkitWebViewBaseCreateWebPage):
1966         (webkitWebViewBaseTakeViewSnapshot):
1967         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
1968         * UIProcess/API/gtk/WebKitWebViewDialog.cpp:
1969         (webkitWebViewDialogDraw):
1970         (webkitWebViewDialogConstructed):
1971         (webkit_web_view_dialog_class_init):
1972         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
1973         (fileChooserDialogResponseCallback):
1974         (webkitWebViewRunFileChooser):
1975         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
1976         (WebKit::doMouseEvent):
1977         (WebKit::doMotionEvent):
1978         (WebKit::doKeyStrokeEvent):
1979         * UIProcess/WebPageProxy.h:
1980         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
1981         (WebKit::AcceleratedBackingStoreWayland::~AcceleratedBackingStoreWayland):
1982         (WebKit::AcceleratedBackingStoreWayland::tryEnsureGLContext):
1983         (WebKit::AcceleratedBackingStoreWayland::makeContextCurrent):
1984         (WebKit::AcceleratedBackingStoreWayland::paint):
1985         * UIProcess/gtk/AcceleratedBackingStoreWayland.h:
1986         * UIProcess/gtk/DragAndDropHandler.cpp:
1987         (WebKit::DragAndDropHandler::startDrag):
1988         (WebKit::DragAndDropHandler::fillDragData):
1989         (WebKit::DragAndDropHandler::finishDrag):
1990         * UIProcess/gtk/DragAndDropHandler.h:
1991         * UIProcess/gtk/GestureController.cpp:
1992         (WebKit::GestureController::handleEvent):
1993         * UIProcess/gtk/GestureController.h:
1994         * UIProcess/gtk/InputMethodFilter.cpp:
1995         (WebKit::InputMethodFilter::filterKeyEvent):
1996         (WebKit::InputMethodFilter::logHandleKeyboardEventForTesting):
1997         (WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting):
1998         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
1999         (WebKit::isEventStop):
2000         (WebKit::createScrollEvent):
2001         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
2002         (WebKit::WebContextMenuProxyGtk::append):
2003         (WebKit::WebContextMenuProxyGtk::WebContextMenuProxyGtk):
2004         (WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk):
2005         * UIProcess/gtk/WebKitInspectorWindow.cpp:
2006         (webkit_inspector_window_init):
2007         (webkitInspectorWindowSetSubtitle):
2008         * UIProcess/gtk/WebPageProxyGtk.cpp:
2009         (WebKit::WebPageProxy::getCenterForZoomGesture):
2010         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
2011         (WebKit::WebPopupMenuProxyGtk::showPopupMenu):
2012         (WebKit::WebPopupMenuProxyGtk::hidePopupMenu):
2013         * WebProcess/WebPage/WebPage.h:
2014         * WebProcess/WebPage/WebPage.messages.in:
2015         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2016         (WebKit::WebPage::getCenterForZoomGesture):
2017
2018 2019-06-20  Patrick Griffis  <pgriffis@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
2019
2020         [GTK][WPE] Implement a basic DNS cache
2021         https://bugs.webkit.org/show_bug.cgi?id=196094
2022
2023         Reviewed by Michael Catanzaro.
2024
2025         This adds a simple cache to all DNS operations in the network process.
2026
2027         * NetworkProcess/glib/DNSCache.cpp: Added.
2028         (WebKit::DNSCache::DNSCache):
2029         (WebKit::DNSCache::mapForType):
2030         (WebKit::DNSCache::lookup):
2031         (WebKit::DNSCache::update):
2032         (WebKit::DNSCache::removeExpiredResponsesInMap):
2033         (WebKit::DNSCache::pruneResponsesInMap):
2034         (WebKit::DNSCache::removeExpiredResponsesFired):
2035         (WebKit::DNSCache::clear):
2036         * NetworkProcess/glib/DNSCache.h: Added.
2037         * NetworkProcess/glib/WebKitCachedResolver.cpp: Added.
2038         (addressListVectorToGList):
2039         (addressListGListToVector):
2040         (webkitCachedResolverLookupByName):
2041         (webkitCachedResolverLookupByNameAsync):
2042         (webkitCachedResolverLookupByNameFinish):
2043         (dnsCacheType):
2044         (webkitCachedResolverLookupByNameWithFlags):
2045         (webkitCachedResolverLookupByNameWithFlagsAsync):
2046         (webkitCachedResolverLookupByNameWithFlagsFinish):
2047         (webkitCachedResolverLookupByAddress):
2048         (webkitCachedResolverLookupByAddressAsync):
2049         (webkitCachedResolverLookupByAddressFinish):
2050         (webkitCachedResolverLookupRecords):
2051         (webkitCachedResolverLookupRecordsAsync):
2052         (webkitCachedResolverLookupRecordsFinish):
2053         (webkitCachedResolverReload):
2054         (webkit_cached_resolver_class_init):
2055         (webkitCachedResolverNew):
2056         * NetworkProcess/glib/WebKitCachedResolver.h: Added.
2057         * NetworkProcess/soup/NetworkProcessSoup.cpp:
2058         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
2059         * PlatformGTK.cmake:
2060         * PlatformWPE.cmake:
2061         * SourcesGTK.txt:
2062         * SourcesWPE.txt:
2063
2064 2019-06-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2065
2066         [GTK] Stop pretending WebCore::Widget can have a platform widget
2067         https://bugs.webkit.org/show_bug.cgi?id=199066
2068
2069         Reviewed by Michael Catanzaro.
2070
2071         Rename PlatformWidget as PlatformViewWidget to avoid conflict with PlatformWidget defined in WebCore.
2072
2073         * UIProcess/WebPageProxy.h:
2074         * UIProcess/win/WebPageProxyWin.cpp:
2075         (WebKit::WebPageProxy::viewWidget):
2076
2077 2019-06-20  Megan Gardner  <megan_gardner@apple.com>
2078
2079         Remove change that was causing hangs
2080         https://bugs.webkit.org/show_bug.cgi?id=199055
2081         <rdar://problem/51820516>
2082
2083         Reviewed by Darin Adler.
2084
2085         This fix can sometimes cause deadlocks in the UIProcess.
2086         We have a different fix that will go into UIKit <rdar://problem/51927701>.
2087
2088         * UIProcess/ios/WKContentViewInteraction.mm:
2089         (-[WKContentView _selectionChanged]):
2090
2091 2019-06-20  Daniel Bates  <dabates@apple.com>
2092
2093         [iOS] Evernote crashes when creating a note
2094         https://bugs.webkit.org/show_bug.cgi?id=199083
2095         <rdar://problem/51759247>
2096
2097         Reviewed by Brent Fulgham.
2098
2099         Add a hack just for Evernote linked before iOS 13 that dynamically adds a placeholder -[WKContentView keyCommands]
2100         method (it just calls super). Evernote swizzles the IPI -[WKContentView keyCommands], but this
2101         method may not always be present in the WebKit binary following r240514. So, Evernote may end
2102         up swizzling -[UIResponder keyCommands], but their implementation doesn't account for this
2103         scenario and they end up crashing because they call an unrecognized selector.
2104
2105         * UIProcess/Cocoa/VersionChecks.h: Add version check.
2106         * UIProcess/ios/WKContentView.mm:
2107         (keyCommandsPlaceholderHackForEvernote): Added.
2108         (-[WKContentView _commonInitializationWithProcessPool:configuration:]): Install the hack.
2109
2110 2019-06-20  Brady Eidson  <beidson@apple.com>
2111
2112         WebURLSchemeHandlerProxy::loadSynchronously crash with sync request.
2113         <rdar://problem/51862206> and https://bugs.webkit.org/show_bug.cgi?id=199063
2114
2115         Reviewed by Geoffrey Garen.
2116
2117         Don't use a DataReference for the sync reply type.
2118
2119         * UIProcess/WebPageProxy.messages.in:
2120         * UIProcess/WebURLSchemeHandler.h:
2121
2122         * UIProcess/WebURLSchemeTask.cpp:
2123         (WebKit::WebURLSchemeTask::didComplete):
2124         * UIProcess/WebURLSchemeTask.h:
2125
2126         * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
2127         (WebKit::WebURLSchemeHandlerProxy::loadSynchronously):
2128
2129 2019-06-20  Alex Christensen  <achristensen@webkit.org>
2130
2131         Add unit test for UIContextMenuConfiguration API
2132         https://bugs.webkit.org/show_bug.cgi?id=199043
2133
2134         Reviewed by Wenson Hsieh.
2135
2136         * UIProcess/API/APIPageConfiguration.cpp:
2137         (API::PageConfiguration::copy const):
2138         * UIProcess/API/APIPageConfiguration.h:
2139         (API::PageConfiguration::clickInteractionDriverForTesting const):
2140         (API::PageConfiguration::setClickInteractionDriverForTesting):
2141         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2142         (-[WKWebViewConfiguration _setClickInteractionDriverForTesting:]):
2143         (-[WKWebViewConfiguration _clickInteractionDriverForTesting]):
2144         * UIProcess/ios/WKContentViewInteraction.mm:
2145         (-[WKContentView _registerPreview]):
2146
2147 2019-06-20  Alexander Mikhaylenko  <exalm7659@gmail.com>
2148
2149         [GTK] Enable navigation swipe layout tests
2150         https://bugs.webkit.org/show_bug.cgi?id=198995
2151
2152         Reviewed by Michael Catanzaro.
2153
2154         Implement API for enabling and controlling swipes from WebKitTestRunner.
2155
2156         Implement beginSimulatedSwipeInDirectionForTesting() and completeSimulatedSwipeInDirectionForTesting()
2157         in ViewGestureController for controlling the test swipes. Add functions in WebKitWebViewBase for calling
2158         them.
2159
2160         Simulate the gesture by generating two scroll events: one to begin the gesture and one to complete it.
2161
2162         Since there's no reliable way to set source device type of the generated events to touchpad, don't check
2163         source device type for simulated swipes.
2164
2165         * UIProcess/API/C/gtk/WKView.cpp:
2166         (WKViewSetEnableBackForwardNavigationGesture): Added.
2167         (WKViewBeginBackSwipeForTesting): Added.
2168         (WKViewCompleteBackSwipeForTesting): Added.
2169         * UIProcess/API/C/gtk/WKViewPrivate.h:
2170         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2171         (webkitWebViewBaseBeginBackSwipeForTesting): Added.
2172         (webkitWebViewBaseCompleteBackSwipeForTesting): Added.
2173         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
2174         * UIProcess/ViewGestureController.h:
2175         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
2176         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe):
2177         Skip source device type check for simulated swipes. Also, remove an incorrect FIXME.
2178         (WebKit::createScrollEvent): Added.
2179         (WebKit::ViewGestureController::beginSimulatedSwipeInDirectionForTesting): Implemented.
2180         (WebKit::ViewGestureController::completeSimulatedSwipeInDirectionForTesting): Implemented.
2181
2182 2019-06-20  Charlie Turner  <cturner@igalia.com>
2183
2184         [GTK] Make startup pause available in DEVELOPER_MODE rather than DEBUG.
2185         https://bugs.webkit.org/show_bug.cgi?id=199069
2186
2187         Reviewed by Michael Catanzaro.
2188
2189         * WebProcess/gtk/WebProcessMainGtk.cpp: Allow developers to pause
2190         the web process in DEVELOPER_MODE rather than only DEBUG, matching
2191         the WPE behaviour and also the purpose of DEVELOPER_MODE.
2192
2193 2019-06-20  Alexander Mikhaylenko  <exalm7659@gmail.com>
2194
2195         [GTK] The Previous/Next gesture should handle RTL
2196         https://bugs.webkit.org/show_bug.cgi?id=198707
2197
2198         Reviewed by Michael Catanzaro.
2199
2200         The gesture uses PageClientImpl::userInterfaceLayoutDirection() to determine the text
2201         direction. Implement that method, then adjust drawing so that the pages move from/to
2202         the left instead of right side for RTL locales.
2203
2204         * UIProcess/API/gtk/PageClientImpl.cpp:
2205         (WebKit::): Implemented.
2206         * UIProcess/API/gtk/PageClientImpl.h:
2207         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
2208         (WebKit::ViewGestureController::draw):
2209
2210 2019-06-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2211
2212         [GTK] Remove support for GTK2 plugins
2213         https://bugs.webkit.org/show_bug.cgi?id=199065
2214
2215         Reviewed by Sergio Villar Senin.
2216
2217         * PlatformGTK.cmake:
2218         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
2219         (WebKit::moduleMixesGtkSymbols):
2220         * Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp:
2221         (WebKit::NetscapePluginModule::getPluginInfo):
2222         * Shared/Plugins/PluginModuleInfo.h:
2223         * Shared/gtk/WebEventFactory.cpp:
2224         (WebKit::isGdkKeyCodeFromKeyPad):
2225         (WebKit::buttonForEvent):
2226         (WebKit::WebEventFactory::createWebMouseEvent):
2227         (WebKit::WebEventFactory::createWebWheelEvent):
2228         (WebKit::WebEventFactory::createWebKeyboardEvent):
2229         (WebKit::WebEventFactory::createWebTouchEvent):
2230         * SourcesGTK.txt:
2231         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2232         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2233         (WebKit::ProcessLauncher::launchProcess):
2234         * UIProcess/Plugins/PluginProcessProxy.h:
2235         * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
2236         (WebKit::PluginInfoCache::getPluginInfo):
2237         (WebKit::PluginInfoCache::updatePluginInfo):
2238         * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:
2239         (WebKit::PluginInfoStore::getPluginInfo):
2240         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
2241         (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes):
2242         (WebKit::PluginProcessProxy::scanPlugin):
2243         * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
2244
2245 2019-06-19  Dean Jackson  <dino@apple.com>
2246
2247         No menu pop-up when long pressing on a link in Firefox app
2248         https://bugs.webkit.org/show_bug.cgi?id=199045
2249         <rdar://problem/51422407>
2250
2251         Reviewed by Tim Horton.
2252
2253         Add a version check for linking on-or-after iOS 13. When
2254         that isn't true, we don't use UIContextMenuInteraction
2255         and instead fall back on the legacy UIPreviewItem API.
2256
2257         * UIProcess/Cocoa/VersionChecks.h: Add FirstThatHasUIContextMenuInteraction.
2258         * UIProcess/ios/WKContentViewInteraction.h: 
2259         * UIProcess/ios/WKContentViewInteraction.mm:
2260         (-[WKContentView _shouldUseContextMenus]): New method to decide if we should
2261         use context menus or preview items.
2262         (-[WKContentView setupInteraction]): Make the decision at runtime rather than
2263         compile time.
2264         (-[WKContentView _contentsOfUserInterfaceItem:]): Ditto.
2265         (-[WKContentView _registerPreview]): Ditto.
2266         (-[WKContentView _unregisterPreview]): Ditto.
2267
2268 2019-06-19  Andy Estes  <aestes@apple.com>
2269
2270         [iOS] Fall back to taking a UIView snapshohot for UITargetedPreviews if InteractionInformationAtPosition does not have an image
2271         https://bugs.webkit.org/show_bug.cgi?id=199038
2272         <rdar://problem/50555810>
2273
2274         Reviewed by Tim Horton.
2275
2276         In -contextMenuInteraction:previewForHighlightingMenuWithConfiguration: and friend, we
2277         should always return a non-nil UITargetedPreview. When we do return nil, UIKit uses the web
2278         view itself as the snapshot view, creating an unsightly animation.
2279
2280         For cases where we fail to create a UITargetedPreview from the information in
2281         InteractionInformationAtPosition, this patch falls back to creating a UITargetedPreview with
2282         a snapshot view obtained from
2283         -[UIView resizableSnapshotViewFromRect:afterScreenUpdates:withCapInsets:].
2284
2285         Also renamed -targetedPreview to -_ensureTargetedPreview and cached the UITargetedPreview
2286         for reuse in -contextMenuInteraction:previewForDismissingMenuWithConfiguration:.
2287
2288         * UIProcess/ios/WKContentViewInteraction.h:
2289         * UIProcess/ios/WKContentViewInteraction.mm:
2290         (createFallbackTargetedPreview):
2291         (-[WKContentView _ensureTargetedPreview]):
2292         (-[WKContentView contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
2293         (-[WKContentView contextMenuInteraction:previewForDismissingMenuWithConfiguration:]):
2294         (-[WKContentView contextMenuInteractionDidEnd:]):
2295         (-[WKContentView _targetedPreview]): Renamed to _ensureTargetedPreview.
2296
2297 2019-06-19  Devin Rousso  <drousso@apple.com>
2298
2299         Web Inspector: Network: replace CFNetwork SPI with new API where able
2300         https://bugs.webkit.org/show_bug.cgi?id=198762
2301
2302         Reviewed by Timothy Hatcher.
2303
2304         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2305         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
2306
2307 2019-06-19  Alex Christensen  <achristensen@webkit.org>
2308
2309         DownloadMonitor::measuredThroughputRate should approach zero with no throughput
2310         https://bugs.webkit.org/show_bug.cgi?id=198981
2311         <rdar://problem/51456914>
2312
2313         Reviewed by Geoffrey Garen.
2314
2315         When the timer fires to approximate the download rate, add a new timestamp with 0 bytes received since the last time we received bytes.
2316         Then, if there's only one timestamp, assume the throughput rate is 0 instead of infinite.
2317         This will prevent false positives estimating large download rates based on old data when the throughput drops to 0.
2318
2319         * NetworkProcess/Downloads/DownloadMonitor.cpp:
2320         (WebKit::DownloadMonitor::measuredThroughputRate const):
2321         (WebKit::DownloadMonitor::timerFired):
2322
2323 2019-06-19  Sihui Liu  <sihui_liu@apple.com>
2324
2325         Remove unused originsWithCredentials from WebsiteData
2326         https://bugs.webkit.org/show_bug.cgi?id=199020
2327
2328         Reviewed by Geoffrey Garen.
2329
2330         * Shared/WebsiteData/WebsiteData.cpp:
2331         (WebKit::WebsiteData::encode const):
2332         (WebKit::WebsiteData::decode):
2333         * Shared/WebsiteData/WebsiteData.h:
2334
2335 2019-06-19  Sihui Liu  <sihui_liu@apple.com>
2336
2337         Crash at com.apple.WebKit: WebKit::WebsiteDataStore::processPools const
2338         https://bugs.webkit.org/show_bug.cgi?id=198935
2339         <rdar://problem/51549308>
2340
2341         Reviewed by Geoffrey Garen.
2342
2343         When WebProcessProxy is in WebProcessCache or is pre-warmed, it does not hold a strong reference of 
2344         WebProcessPool. In this case, we should not store the raw pointer of WebProcessPool and perform websiteDataStore
2345         operations with it.
2346         This patch should fix the crash at dereferencing null pointer of WebProcessPool in 
2347         WebsiteDataStore::processPools, but it is unclear why websiteDataStore comes to observe cached or prewarmed web 
2348         process that should not have web page. The release log may help us find the cause.
2349
2350         * UIProcess/WebProcessProxy.cpp:
2351         (WebKit::WebProcessProxy::processPoolIfExists const):
2352         * UIProcess/WebProcessProxy.h:
2353         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2354         (WebKit::WebsiteDataStore::processPools const):
2355
2356 2019-06-19  Alex Christensen  <achristensen@webkit.org>
2357
2358         Add a unit test for client certificate authentication
2359         https://bugs.webkit.org/show_bug.cgi?id=197800
2360
2361         Reviewed by Youenn Fablet.
2362
2363         * Shared/cf/ArgumentCodersCF.cpp:
2364         Move SPI declarations to SecuritySPI.h.
2365
2366 2019-06-19  Alex Christensen  <achristensen@webkit.org>
2367
2368         Update preview API deprecation message.
2369         https://bugs.webkit.org/show_bug.cgi?id=198974
2370
2371         * UIProcess/API/Cocoa/WKUIDelegate.h:
2372
2373 2019-06-19  Adrian Perez de Castro  <aperez@igalia.com>
2374
2375         [GTK] Fix compilation errors for the GTK2 plugin process
2376         https://bugs.webkit.org/show_bug.cgi?id=199000
2377
2378         Reviewed by Michael Catanzaro.
2379
2380         * Shared/gtk/WebEventFactory.cpp: Use the GdkEvent union fields
2381         when directly accessing event struct fields.
2382         (WebKit::buttonForEvent):
2383         (WebKit::WebEventFactory::createWebMouseEvent):
2384         (WebKit::WebEventFactory::createWebKeyboardEvent):
2385
2386 2019-06-19  Adrian Perez de Castro  <aperez@igalia.com>
2387
2388         [WPE][GTK] Fix build with unified sources disabled
2389         https://bugs.webkit.org/show_bug.cgi?id=198752
2390
2391         Reviewed by Michael Catanzaro.
2392
2393         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
2394         (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker): Qualify SQLiteDatabase
2395         with its namespace.
2396         * UIProcess/WebFrameProxy.h: Replace forward declaration of WebPageProxy with inclusion
2397         of WebPageProxy.h to avoid build error due to usage of undefined class. Moved DataCallback
2398         definition from WebPageProxy.h to avoid code using the type before its declaration.
2399         * UIProcess/WebPageProxy.h: Remove definition of DataCallback.
2400         * UIProcess/wpe/WebInspectorProxyWPE.cpp: Add missing forward declaration of
2401         WebCore::FloatRect.
2402         (WebKit::WebInspectorProxy::platformSetSheetRect): Qualify FloatRect with its namespace.
2403         * WebProcess/Automation/WebAutomationSessionProxy.cpp: Qualify all occurrences of
2404         PageIdentifier with its namespace.
2405         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
2406         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
2407         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
2408         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
2409         (WebKit::WebAutomationSessionProxy::resolveParentFrame):
2410         (WebKit::WebAutomationSessionProxy::focusFrame):
2411         (WebKit::WebAutomationSessionProxy::computeElementLayout):
2412         (WebKit::WebAutomationSessionProxy::selectOptionElement):
2413         (WebKit::WebAutomationSessionProxy::takeScreenshot):
2414         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
2415         (WebKit::WebAutomationSessionProxy::deleteCookie):
2416         * WebProcess/Cache/WebCacheStorageConnection.cpp: Ditto.
2417         (WebKit::WebCacheStorageConnection::open):
2418         (WebKit::WebCacheStorageConnection::remove):
2419         (WebKit::WebCacheStorageConnection::retrieveCaches):
2420         (WebKit::WebCacheStorageConnection::retrieveRecords):
2421         (WebKit::WebCacheStorageConnection::batchDeleteOperation):
2422         (WebKit::WebCacheStorageConnection::batchPutOperation):
2423         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp: Add missing inclusion of WebPage.h
2424         * WebProcess/WebPage/gtk/WebPageGtk.cpp: Add missing inclusion of gtk/gtk.h
2425         * WebProcess/WebPage/wpe/WebPageWPE.cpp: Add missing inclusion of WebPageProxy.h
2426
2427 2019-06-19  Alexander Mikhaylenko  <exalm7659@gmail.com>
2428
2429         [GTK] Page blinks after navigation swipe if it triggered PSON
2430         https://bugs.webkit.org/show_bug.cgi?id=198996
2431
2432         Reviewed by Michael Catanzaro.
2433
2434         Disconnect and then reconnect ViewGestureController during process swap
2435         instead of destroying and re-creating it.
2436
2437         * UIProcess/API/gtk/PageClientImpl.cpp:
2438         (WebKit::PageClientImpl::PageClientImpl::processWillSwap): Added.
2439         (WebKit::PageClientImpl::PageClientImpl::processDidExit): Implemented.
2440         * UIProcess/API/gtk/PageClientImpl.h:
2441         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2442         (webkitWebViewBaseWillSwapWebProcess): Added.
2443         Disconnect ViewGestureController if it exists.
2444         (webkitWebViewBaseDidExitWebProcess): Added.
2445         Destroy ViewGestureController.
2446         (webkitWebViewBaseDidRelaunchWebProcess):
2447         Reconnect the ViewGestureController if it exists.
2448         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
2449
2450 2019-06-19  Takashi Komori  <Takashi.Komori@sony.com>
2451
2452         [Curl] CurlRequestScheduler doesn't terminate worker thread in a certain situation.
2453         https://bugs.webkit.org/show_bug.cgi?id=198993
2454
2455         Cancel CurlRequest before invalidation to remove tasks from CurlRequestScheduler certainly in ~NetworkDataTaskCurl.
2456
2457         Reviewed by Fujii Hironori.
2458
2459         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2460         (WebKit::NetworkDataTaskCurl::~NetworkDataTaskCurl):
2461
2462 2019-06-19  Zan Dobersek  <zdobersek@igalia.com>
2463
2464         [Nicosia] Invalidate SceneIntegration in LayerTreeHost::invalidate()
2465         https://bugs.webkit.org/show_bug.cgi?id=198992
2466
2467         Reviewed by Carlos Garcia Campos.
2468
2469         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
2470         (WebKit::LayerTreeHost::invalidate): Invalidate the
2471         Nicosia::SceneIntegration object. This should properly disassociate
2472         the now-invalited LayerTreeHost (a SceneIntegration client) from the
2473         SceneIntegration object that can still be shared with platform layers
2474         originating from this LayerTreeHost.
2475
2476 2019-06-18  Dean Jackson  <dino@apple.com>
2477
2478         UIContextMenuInteraction implementation for WKContentView
2479         https://bugs.webkit.org/show_bug.cgi?id=198986
2480         <rdar://problem/51875189>
2481
2482         Reviewed by Andy Estes.
2483
2484         Implement UIContextMenuInteraction and its delegate as a
2485         replacement for UIPreviewItemController in iOS 13.
2486
2487         In order to preserve existing behaviour as much as possible,
2488         we check for the implementation of new WebKit API to configure
2489         the menu. If that is not present, we attempt to convert
2490         the results of the existing WebKit WKPreviewAction delegates
2491         into something that works with UIContextMenus.
2492
2493         * UIProcess/ios/WKContentViewInteraction.h:
2494         * UIProcess/ios/WKContentViewInteraction.mm:
2495         (-[WKContentView setupInteraction]):
2496         (-[WKContentView _contentsOfUserInterfaceItem:]):
2497         (-[WKContentView _registerPreview]):
2498         (-[WKContentView _unregisterPreview]):
2499         (-[WKContentView _showLinkPreviewsPreferenceChanged:]):
2500         (needsDeprecatedPreviewAPI):
2501         (uiActionForPreviewAction):
2502         (menuFromPreviewOrDefaults):
2503         (titleForMenu):
2504         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
2505         (-[WKContentView contextMenuInteraction:configurationForMenuAtLocation:]):
2506         (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]):
2507         (-[WKContentView continueContextMenuInteraction:]):
2508         (uiImageForImage):
2509         (createTargetedPreview):
2510         (-[WKContentView _targetedPreview]):
2511         (-[WKContentView contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
2512         (-[WKContentView contextMenuInteractionWillPresent:]):
2513         (-[WKContentView contextMenuInteraction:previewForDismissingMenuWithConfiguration:]):
2514         (-[WKContentView contextMenuInteraction:willCommitWithAnimator:]):
2515         (-[WKContentView contextMenuInteractionDidEnd:]):
2516         (-[WKContentView shouldUsePreviewForLongPress]): Deleted.
2517
2518 2019-06-18  Ryan Haddad  <ryanhaddad@apple.com>
2519
2520         Unreviewed, rolling out r246575.
2521
2522         Breaks internal builds.
2523
2524         Reverted changeset:
2525
2526         "Update WebKit API to separately retrieve actions and use
2527         context menus"
2528         https://bugs.webkit.org/show_bug.cgi?id=198974
2529         https://trac.webkit.org/changeset/246575
2530
2531 2019-06-18  Alex Christensen  <achristensen@webkit.org>
2532
2533         Update WebKit API to separately retrieve actions and use context menus
2534         https://bugs.webkit.org/show_bug.cgi?id=198974
2535         <rdar://problem/50735687>
2536
2537         Reviewed by Tim Horton.
2538
2539         Update API and SPI, and add infrastructure for asynchronously requesting interaction information.
2540
2541         * UIProcess/API/Cocoa/WKUIDelegate.h:
2542         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2543
2544 2019-06-18  Daniel Bates  <dabates@apple.com>
2545
2546         REGRESSION (r240757): Cannot dismiss the keyboard on http://apple.com/apple-tv-plus
2547         https://bugs.webkit.org/show_bug.cgi?id=198922
2548         <rdar://problem/50300056>
2549
2550         Reviewed by Wenson Hsieh.
2551
2552         Actually dismiss the keyboard as intended in r240757. Do not wait for the round-trip
2553         to the WebProcess to run through the -elementDidBlur steps in the UIProcess and hide
2554         the keyboard when a person explicitly dismisses the keyboard via the Done button (iPhone)
2555         or hide keyboard button (iPad).
2556
2557         Note that r240757 revealed another bug in this code, <https://bugs.webkit.org/show_bug.cgi?id=198928>.
2558         I am unclear of the implications of that bug, but it is clear for this bug that it
2559         never makes sense to round-trip to the WebProcess when the keyboard is dismissed by
2560         a user gesture.
2561
2562         * UIProcess/ios/WKContentViewInteraction.mm:
2563         (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]): Invoke -_elementDidBlur
2564         to blur the element in the UIProcess and hide the keyboard.
2565         (-[WKContentView _elementDidBlur]): Prevent duplicate invocations of -didEndFormControlInteraction
2566         and setIsShowingInputViewForFocusedElement messages by only doing these actions when
2567         editablity changes. This covers the case where -_elementDidBlur may be invoked a second
2568         time (the reply in the round-trip). In that case we don't need to do these actions.
2569
2570 2019-06-18  Alex Christensen  <achristensen@webkit.org>
2571
2572         NetworkSession::networkStorageSession can return null
2573         https://bugs.webkit.org/show_bug.cgi?id=198947
2574         <rdar://problem/51394449>
2575
2576         Reviewed by Youenn Fablet.
2577
2578         We are seeing evidence of crashes from the map owning NetworkSessions and the map owning NetworkStorageSessions becoming out of sync
2579         because NetworkSession is refcounted but NetworkStorageSession is not.  I started the complete fix in https://bugs.webkit.org/show_bug.cgi?id=194926
2580         but for now let's add less risky null checks to prevent fallout.
2581
2582         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
2583         (WebKit::ResourceLoadStatisticsStore::updateClientSideCookiesAgeCap):
2584         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2585         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccessForFrame):
2586         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
2587         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
2588         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
2589         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
2590         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
2591         (WebKit::WebResourceLoadStatisticsStore::removePrevalentDomains):
2592         * NetworkProcess/NetworkProcess.cpp:
2593         (WebKit::NetworkProcess::initializeNetworkProcess):
2594         * NetworkProcess/NetworkSession.cpp:
2595         (WebKit::NetworkSession::networkStorageSession const):
2596         * NetworkProcess/NetworkSession.h:
2597         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2598         (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy):
2599         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2600         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2601         (WebKit::NetworkDataTaskCocoa::tryPasswordBasedAuthentication):
2602
2603 2019-06-18  Brady Eidson  <beidson@apple.com>
2604
2605         Handle NSProgress calling our cancellation handler on background threads (and calling it more than once).
2606         <rdar://problem/51392926> and https://bugs.webkit.org/show_bug.cgi?id=198945
2607
2608         Reviewed by Alex Christensen.
2609
2610         If you have a download in progress and quickly tap the button to cancel it multiple times, then:
2611             - NSProgress calls our cancellation handler on a non-main thread, which we can't handle.
2612             - They do it more than once, which is also bad.
2613             - They might even do it multiple times concurrently (on different background dispatch queues)
2614         
2615         Let's work around these.
2616
2617         * NetworkProcess/Downloads/Download.cpp:
2618         (WebKit::Download::cancel): Double check we're on the main thread, and handle being called twice.
2619
2620         * NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm:
2621         (-[WKDownloadProgress performCancel]): Actually cancel the WebKit::Download if we still have one.
2622         (-[WKDownloadProgress progressCancelled]): Called when NSProgress calls the cancellation handler, no matter
2623           which thread it does it on. By leveraging std::call_once we handle multiple calls as well as being called
2624           concurrently from different threads. call_once punts the *actual* cancel operation off to the main thread.
2625         (-[WKDownloadProgress initWithDownloadTask:download:URL:sandboxExtension:]): The cancellation handler is
2626           now simply calling 'progressCancelled' on self, assuming the weak pointer for self is still valid.
2627
2628 2019-06-18  Daniel Bates  <dabates@apple.com>
2629
2630         [iOS] Pressing key while holding Command should not insert character
2631         https://bugs.webkit.org/show_bug.cgi?id=198925
2632         <rdar://problem/51778811>
2633
2634         Reviewed by Brent Fulgham.
2635
2636         Do not insert a character for an unhandled key command that has a Command modifier.
2637         For example, pressing Command + Shift + v, which is an unhandled key command (at the
2638         time of writing) should not insert v. This matches iOS and Mac platform conventions.
2639
2640         * UIProcess/ios/WKContentViewInteraction.mm:
2641         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
2642
2643 2019-06-18  John Wilander  <wilander@apple.com>
2644
2645         Change log channel name from ResourceLoadStatisticsDebug to ITPDebug and remove unnecessary #if !RELEASE_LOG_DISABLED
2646         https://bugs.webkit.org/show_bug.cgi?id=198970
2647         <rdar://problem/51855836>
2648
2649         Reviewed by Brent Fulgham.
2650
2651         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2652         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
2653         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
2654         (WebKit::ResourceLoadStatisticsDatabaseStore::ensurePrevalentResourcesForDebugMode):
2655         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking):
2656         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2657         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
2658         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
2659         (WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode):
2660         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
2661         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
2662         (WebKit::domainsToString):
2663         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
2664         (WebKit::ResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
2665         (WebKit::ResourceLoadStatisticsStore::debugLogDomainsInBatches):
2666         * Platform/Logging.h:
2667
2668 2019-06-18  Youenn Fablet  <youenn@apple.com>
2669
2670         StorageManager::removeAllowedSessionStorageNamespaceConnection should make sure its storageNamespaceID is valid
2671         https://bugs.webkit.org/show_bug.cgi?id=198966
2672         rdar://problem/51352080
2673
2674         Reviewed by Alex Christensen.
2675
2676         Make sure the namespace ID is a key of the map before using the value.
2677         The namespace ID is coming straight from IPC so should not be trusted.
2678         Also, namespace IDs are added/removed based on web pages being created/deleted.
2679         Namespace IDs are supposed to be scoped by session IDs.
2680         Using page IDs for namespace IDs works as long as the page does not change of session ID during its lifetime, which is not guaranteed.
2681
2682         * NetworkProcess/WebStorage/StorageManager.cpp:
2683         (WebKit::StorageManager::removeAllowedSessionStorageNamespaceConnection):
2684
2685 2019-06-18  David Quesada  <david_quesada@apple.com>
2686
2687         Network process crash in SandboxExtension::consume() via Download::publishProgress
2688         https://bugs.webkit.org/show_bug.cgi?id=198968
2689         rdar://problem/51732997
2690
2691         Reviewed by Alex Christensen.
2692
2693         Add an early return if the network process fails to resolve a sandbox extension handle for publishing
2694         progress on a download. Creating the NSProgress doesn't do much since the progress reporting service
2695         won't honor the attempt to publish progress on a URL the process does not have access to, and nothing
2696         else in the Network process makes any use of the progress.
2697
2698         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
2699         (WebKit::Download::publishProgress):
2700
2701 2019-06-18  Adrian Perez de Castro  <aperez@igalia.com>
2702
2703         Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.25.1 release
2704
2705         * wpe/NEWS: Add release notes for 2.25.1
2706
2707 2019-06-18  Tim Horton  <timothy_horton@apple.com>
2708
2709         Expose DataDetectors context generation on WKContentViewInteraction
2710         https://bugs.webkit.org/show_bug.cgi?id=198950
2711         <rdar://problem/51116021>
2712
2713         Reviewed by Andy Estes.
2714
2715         * UIProcess/ios/WKActionSheetAssistant.h:
2716         * UIProcess/ios/WKActionSheetAssistant.mm:
2717         (-[WKActionSheetAssistant currentPositionInformation]):
2718         (-[WKActionSheetAssistant showDataDetectorsSheet]):
2719         * UIProcess/ios/WKContentViewInteraction.h:
2720         * UIProcess/ios/WKContentViewInteraction.mm:
2721         (-[WKContentView dataDetectionContextForPositionInformation:]):
2722         (-[WKContentView dataDetectionContextForActionSheetAssistant:]):
2723         For use by other clients, add -dataDetectionContextForPositionInformation:
2724         and make -dataDetectionContextForActionSheetAssistant: use it.
2725         Also, pull the code to augment the context with surrounding text out of
2726         from WKActionSheetAssistant.
2727
2728 2019-06-18  Adrian Perez de Castro  <aperez@igalia.com>
2729
2730         [WPE] Fix building the documentation
2731
2732         Unreviewed.
2733
2734         * UIProcess/API/wpe/docs/wpe-docs.sgml: Fix typo "2.62" -> "2.26"
2735
2736 2019-06-18  Truitt Savell  <tsavell@apple.com>
2737
2738         Unreviewed, rolling out r246531.
2739
2740         Broke internal builds.
2741
2742         Reverted changeset:
2743
2744         "Expose DataDetectors context generation on
2745         WKContentViewInteraction"
2746         https://bugs.webkit.org/show_bug.cgi?id=198950
2747         https://trac.webkit.org/changeset/246531
2748
2749 2019-06-18  Simon Fraser  <simon.fraser@apple.com>
2750
2751         Convert macOS to scroll by changing layer boundsOrigin
2752         https://bugs.webkit.org/show_bug.cgi?id=198917
2753
2754         Reviewed by Antti Koivisto.
2755
2756         Remove unreached and confusing code.
2757
2758         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
2759         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::repositionScrollingLayers):
2760
2761 2019-06-18  Dean Jackson  <dino@apple.com>
2762
2763         Attachment elements are missing context menu previews
2764         https://bugs.webkit.org/show_bug.cgi?id=198946
2765
2766         Reviewed by Tim Horton.
2767
2768         When requesting position information on an <attachment> element,
2769         we were not providing a snapshot image.
2770
2771         * WebProcess/WebPage/WebPage.h: New common method to take a snapshot.
2772         * WebProcess/WebPage/ios/WebPageIOS.mm:
2773         (WebKit::WebPage::shareableBitmapSnapshotForNode): New helper.
2774         (WebKit::WebPage::positionInformation): If the element is an attachment,
2775         then ask for a snapshot.
2776
2777 2019-06-17  Tim Horton  <timothy_horton@apple.com>
2778
2779         Expose DataDetectors context generation on WKContentViewInteraction
2780         https://bugs.webkit.org/show_bug.cgi?id=198950
2781         <rdar://problem/51116021>
2782
2783         Reviewed by Andy Estes.
2784
2785         * UIProcess/ios/WKActionSheetAssistant.h:
2786         * UIProcess/ios/WKActionSheetAssistant.mm:
2787         (-[WKActionSheetAssistant currentPositionInformation]):
2788         (-[WKActionSheetAssistant showDataDetectorsSheet]):
2789         * UIProcess/ios/WKContentViewInteraction.h:
2790         * UIProcess/ios/WKContentViewInteraction.mm:
2791         (-[WKContentView dataDetectionContextForPositionInformation:]):
2792         (-[WKContentView dataDetectionContextForActionSheetAssistant:]):
2793         For use by other clients, add -dataDetectionContextForPositionInformation:
2794         and make -dataDetectionContextForActionSheetAssistant: use it.
2795         Also, pull the code to augment the context with surrounding text out of
2796         from WKActionSheetAssistant.
2797
2798 2019-06-17  Sihui Liu  <sihui_liu@apple.com>
2799
2800         -[WKWebsiteDataStore removeDataOfTypes:modifiedSince:completionHandler:] doesn't delete _WKWebsiteDataTypeCredentials
2801         https://bugs.webkit.org/show_bug.cgi?id=198854
2802         <rdar://problem/51386058>
2803
2804         Reviewed by Geoffrey Garen.
2805
2806         Clear persistent credentials in deleteWebsiteData of network process.
2807
2808         Also, merge originsWithPersistentCredentials and removeCredentialsWithOrigins into fetchWebsiteData and
2809         deleteWebsiteData, and move credentials handling to WebCore.
2810
2811         * NetworkProcess/NetworkProcess.cpp:
2812         (WebKit::NetworkProcess::fetchWebsiteData):
2813         (WebKit::NetworkProcess::deleteWebsiteData):
2814         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2815         (WebKit::NetworkProcess::originsWithPersistentCredentials): Deleted.
2816         (WebKit::NetworkProcess::removeCredentialsWithOrigins): Deleted.
2817         * NetworkProcess/NetworkProcess.h:
2818         * NetworkProcess/NetworkProcess.messages.in:
2819         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2820         (WebKit::NetworkProcess::originsWithPersistentCredentials): Deleted.
2821         (WebKit::NetworkProcess::removeCredentialsWithOrigins): Deleted.
2822         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2823         (WebKit::WebsiteDataStore::fetchDataAndApply):
2824         (WebKit::computeWebProcessAccessTypeForDataRemoval):
2825         (WebKit::WebsiteDataStore::removeData):
2826
2827 2019-06-17  Tim Horton  <timothy_horton@apple.com>
2828
2829         Fix the build with case-sensitive includes
2830         <rdar://problem/51828273>
2831
2832         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
2833         FileSystem, not Filesystem.
2834
2835 2019-06-17  Jiewen Tan  <jiewen_tan@apple.com>
2836
2837         Unreviewed, build fix after r246514
2838
2839         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.h:
2840         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.mm:
2841         (+[NSURL _web_canPerformAuthorizationWithURL:]):
2842         Expose the above method as a SPI for Safari.
2843         * WebKit.xcodeproj/project.pbxproj:
2844
2845 2019-06-17  Alex Christensen  <achristensen@webkit.org>
2846
2847         Protect StorageManager::m_localStorageNamespaces with a Lock
2848         https://bugs.webkit.org/show_bug.cgi?id=198939
2849         <rdar://problem/51784225>
2850
2851         Reviewed by Geoff Garen.
2852
2853         StorageManager::LocalStorageNamespace::didDestroyStorageArea is called from StorageArea::~StorageArea which is called on the main thread.
2854         All other access of m_localStorageNamespaces is from the non-main thread.  Sometimes this causes hash table corruption, so wait for a mutex
2855         before accessing this member variable.
2856
2857         * NetworkProcess/WebStorage/StorageManager.cpp:
2858         (WebKit::StorageManager::LocalStorageNamespace::didDestroyStorageArea):
2859         (WebKit::StorageManager::cloneSessionStorageNamespace):
2860         (WebKit::StorageManager::getLocalStorageOrigins):
2861         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
2862         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
2863         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
2864         (WebKit::StorageManager::getOrCreateLocalStorageNamespace):
2865         * NetworkProcess/WebStorage/StorageManager.h:
2866
2867 2019-06-17  Alex Christensen  <achristensen@webkit.org>
2868
2869         Add null check in WebFrameLoaderClient::assignIdentifierToInitialRequest
2870         https://bugs.webkit.org/show_bug.cgi?id=198926
2871         <rdar://problem/50079713>
2872
2873         Reviewed by Brady Eidson.
2874
2875         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2876         (WebKit::WebFrameLoaderClient::assignIdentifierToInitialRequest):
2877         WebKitLegacy's version already checks null for the corresponding call.
2878
2879 2019-06-17  Alex Christensen  <achristensen@webkit.org>
2880
2881         Fix internal build after r246514
2882         https://bugs.webkit.org/show_bug.cgi?id=198874
2883
2884         * UIProcess/API/APINavigationAction.h:
2885         A problematic reference to APINavigationActionAdditions.h was left.
2886         Its contents had been sprinkled into the correct places, though.
2887
2888 2019-06-17  Jiewen Tan  <jiewen_tan@apple.com>
2889
2890         Move SOAuthorization from WebKitAdditions to WebKit
2891         https://bugs.webkit.org/show_bug.cgi?id=198874
2892         <rdar://problem/47573431>
2893
2894         Reviewed by Brent Fulgham.
2895
2896         This patch basically moves everything from existing WebKitAdditions to WebKit.
2897         It also replaces the LoadOptimizer nonsense with the actual SOAuthorization API.
2898
2899         * Configurations/WebKit.xcconfig:
2900         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2901         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2902         * PluginProcess/mac/PluginProcessMac.mm:
2903         (WebKit::PluginProcess::platformInitializePluginProcess):
2904         * SourcesCocoa.txt:
2905         * UIProcess/API/APINavigationAction.h:
2906         * UIProcess/Cocoa/NavigationState.mm:
2907         (WebKit::trySOAuthorization):
2908         (WebKit::tryInterceptNavigation):
2909         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2910         (WebKit::tryOptimizingLoad): Deleted.
2911         * UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.h: Added.
2912         (WebKit::NavigationSOAuthorizationSession::callback):
2913         * UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
2914         (WebKit::NavigationSOAuthorizationSession::NavigationSOAuthorizationSession):
2915         (WebKit::NavigationSOAuthorizationSession::~NavigationSOAuthorizationSession):
2916         (WebKit::NavigationSOAuthorizationSession::shouldStartInternal):
2917         (WebKit::NavigationSOAuthorizationSession::webViewDidMoveToWindow):
2918         * UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.h: Added.
2919         * UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm: Added.
2920         (-[WKSOSecretDelegate initWithSession:]):
2921         (-[WKSOSecretDelegate webViewDidClose:]):
2922         (-[WKSOSecretDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
2923         (-[WKSOSecretDelegate webView:didFinishNavigation:]):
2924         (WebKit::PopUpSOAuthorizationSession::PopUpSOAuthorizationSession):
2925         (WebKit::PopUpSOAuthorizationSession::~PopUpSOAuthorizationSession):
2926         (WebKit::PopUpSOAuthorizationSession::shouldStartInternal):
2927         (WebKit::PopUpSOAuthorizationSession::fallBackToWebPathInternal):
2928         (WebKit::PopUpSOAuthorizationSession::abortInternal):
2929         (WebKit::PopUpSOAuthorizationSession::completeInternal):
2930         (WebKit::PopUpSOAuthorizationSession::close):
2931         (WebKit::PopUpSOAuthorizationSession::initSecretWebView):
2932         * UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.h: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
2933         * UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm: Added.
2934         (WebKit::RedirectSOAuthorizationSession::RedirectSOAuthorizationSession):
2935         (WebKit::RedirectSOAuthorizationSession::fallBackToWebPathInternal):
2936         (WebKit::RedirectSOAuthorizationSession::abortInternal):
2937         (WebKit::RedirectSOAuthorizationSession::completeInternal):
2938         (WebKit::RedirectSOAuthorizationSession::beforeStart):
2939         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationCoordinator.h: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
2940         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationCoordinator.mm: Added.
2941         (WebKit::SOAuthorizationCoordinator::SOAuthorizationCoordinator):
2942         (WebKit::SOAuthorizationCoordinator::canAuthorize const):
2943         (WebKit::SOAuthorizationCoordinator::tryAuthorize):
2944         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.h: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
2945         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.mm: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
2946         (+[NSURL _web_canPerformAuthorizationWithURL:]):
2947         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.h: Added.
2948         (WebKit::SOAuthorizationSession::page const):
2949         (WebKit::SOAuthorizationSession::state const):
2950         (WebKit::SOAuthorizationSession::setState):
2951         (WebKit::SOAuthorizationSession::navigationAction):
2952         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm: Added.
2953         (WebKit::SOAuthorizationSession::SOAuthorizationSession):
2954         (WebKit::SOAuthorizationSession::~SOAuthorizationSession):
2955         (WebKit::SOAuthorizationSession::releaseNavigationAction):
2956         (WebKit::SOAuthorizationSession::becomeCompleted):
2957         (WebKit::SOAuthorizationSession::shouldStart):
2958         (WebKit::SOAuthorizationSession::start):
2959         (WebKit::SOAuthorizationSession::fallBackToWebPath):
2960         (WebKit::SOAuthorizationSession::abort):
2961         (WebKit::SOAuthorizationSession::complete):
2962         (WebKit::SOAuthorizationSession::presentViewController):
2963         (WebKit::SOAuthorizationSession::dismissViewController):
2964         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
2965         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm: Added.
2966         (WebKit::SubFrameSOAuthorizationSession::SubFrameSOAuthorizationSession):
2967         (WebKit::SubFrameSOAuthorizationSession::fallBackToWebPathInternal):
2968         (WebKit::SubFrameSOAuthorizationSession::abortInternal):
2969         (WebKit::SubFrameSOAuthorizationSession::completeInternal):
2970         (WebKit::SubFrameSOAuthorizationSession::beforeStart):
2971         (WebKit::SubFrameSOAuthorizationSession::loadDataToFrame):
2972         (WebKit::SubFrameSOAuthorizationSession::postDidCancelMessageToParent):
2973         * UIProcess/Cocoa/SOAuthorization/WKSOAuthorizationDelegate.h: Renamed from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
2974         * UIProcess/Cocoa/SOAuthorization/WKSOAuthorizationDelegate.mm: Added.
2975         (-[WKSOAuthorizationDelegate authorization:presentViewController:withCompletion:]):
2976         (-[WKSOAuthorizationDelegate authorizationDidNotHandle:]):
2977         (-[WKSOAuthorizationDelegate authorizationDidCancel:]):
2978         (-[WKSOAuthorizationDelegate authorizationDidComplete:]):
2979         (-[WKSOAuthorizationDelegate authorization:didCompleteWithHTTPAuthorizationHeaders:]):
2980         (-[WKSOAuthorizationDelegate authorization:didCompleteWithHTTPResponse:httpBody:]):
2981         (-[WKSOAuthorizationDelegate authorization:didCompleteWithError:]):
2982         (-[WKSOAuthorizationDelegate setSession:]):
2983         * UIProcess/WebPageProxy.cpp:
2984         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2985         (WebKit::trySOAuthorization):
2986         (WebKit::WebPageProxy::createNewPage):
2987         (WebKit::tryOptimizingLoad): Deleted.
2988         * UIProcess/WebPageProxy.h:
2989         (WebKit::WebPageProxy::setShouldSuppressSOAuthorizationInAllNavigationPolicyDecision):
2990         (WebKit::WebPageProxy::setShouldSuppressSOAuthorizationInNextNavigationPolicyDecision):
2991         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2992         (WebKit::WebsiteDataStore::WebsiteDataStore):
2993         * UIProcess/WebsiteData/WebsiteDataStore.h:
2994         (WebKit::WebsiteDataStore::soAuthorizationCoordinator):
2995         * WebKit.xcodeproj/project.pbxproj:
2996         * WebProcess/cocoa/WebProcessCocoa.mm:
2997         (WebKit::WebProcess::platformInitializeProcess):
2998
2999 2019-06-17  Tim Horton  <timothy_horton@apple.com>
3000
3001         Fix the build.
3002
3003         * UIProcess/Gamepad/ios/UIGamepadProviderIOS.mm:
3004         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
3005         * UIProcess/_WKTouchEventGenerator.mm:
3006         (-[_WKTouchEventGenerator _sendHIDEvent:]):
3007         (-[_WKTouchEventGenerator _sendMarkerHIDEventWithCompletionBlock:]):
3008
3009 2019-06-17  Dan Bernstein  <mitz@apple.com>
3010
3011         REGRESSION (r242686): Paths in XPC services’ LC_DYLD_ENVIRONMENT are incorrect in built products directory
3012         https://bugs.webkit.org/show_bug.cgi?id=198904
3013
3014         Reviewed by Alex Christensen.
3015
3016         After r242686, in local builds, the XPC service executables run from their location at the
3017         top of the built products directory, rather than inside the framework.
3018
3019         * Configurations/BaseXPCService.xcconfig: Updated the load commands that set
3020           DYLD_FRAMEWORK_PATH and DYLD_LIBRARY_PATH for the new location in the built products
3021           directory. Also removed WK_XPC_SERVICE_INSERT_LIBRARIES_DIR that had been unused.
3022
3023         * WebKit.xcodeproj/project.pbxproj: Made the creation of symbolic links inside the
3024           framework’s XPCServices directory predicated on whether this is an install build, rather
3025           than on the build configuration, for consistency with the condition used in the .xcconfig.
3026
3027 2019-06-17  Brent Fulgham  <bfulgham@apple.com>
3028
3029         Ensure ITP state is relayed to Network Process on restart
3030         https://bugs.webkit.org/show_bug.cgi?id=198797
3031         <rdar://problem/51646944>
3032
3033         Reviewed by Youenn Fablet.
3034
3035         Now that the ITP state is maintained in the Network Process, we have to make sure that we update
3036         that process with current ITP state if the Network Process crashes and is relaunched. This wasn't a
3037         problem in earlier releases because we tracked all ITP state in the UIProcess.
3038
3039         This patch does the following:
3040         1. Add a new method to WKWebsiteDataStore to allow us to trigger statistics processing, which has the
3041            side effect of syncing ITP state persistently so that it will be available after bouncing the process.
3042         2. Adds a new test that sets a tracking domain, bounces the process, and confirms the state is still
3043            consistent.
3044
3045         Tested by TestWebKitAPI.
3046
3047         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
3048         (WebKit::ResourceLoadStatisticsStore::processStatisticsAndDataRecords):
3049         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3050         (-[WKWebsiteDataStore _clearPrevalentDomain:completionHandler:]):
3051         (-[WKWebsiteDataStore _processStatisticsAndDataRecords:]):
3052         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3053         * UIProcess/WebProcessPool.cpp:
3054         (WebKit::WebProcessPool::ensureNetworkProcess):
3055         (WebKit::WebProcessPool::setResourceLoadStatisticsEnabled):
3056         * UIProcess/WebProcessPool.h:
3057         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3058         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
3059
3060 2019-06-17  Ludovico de Nittis  <ludovico.denittis@collabora.com>
3061
3062         [GTK] Stop accessing GdkEvent fields when possible
3063         https://bugs.webkit.org/show_bug.cgi?id=198829
3064
3065         Reviewed by Michael Catanzaro.
3066
3067         Direct access to GdkEvent structs is no longer possible in GTK 4.
3068
3069         * Shared/gtk/WebEventFactory.cpp:
3070         (WebKit::buttonForEvent):
3071         (WebKit::WebEventFactory::createWebMouseEvent):
3072         (WebKit::WebEventFactory::createWebWheelEvent):
3073         (WebKit::WebEventFactory::createWebKeyboardEvent):
3074         (WebKit::WebEventFactory::createWebTouchEvent):
3075         * UIProcess/API/gtk/WebKitEmojiChooser.cpp:
3076         * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp:
3077         (webkitScriptDialogImplKeyPressEvent):
3078         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3079         (ClickCounter::currentClickCountForGdkButtonEvent):
3080         (webkitWebViewBaseKeyPressEvent):
3081         (webkitWebViewBaseHandleMouseEvent):
3082         (webkitWebViewBaseCrossingNotifyEvent):
3083         (webkitWebViewBaseGetTouchPointsForEvent):
3084         (webkitWebViewBaseTouchEvent):
3085         (webkitWebViewBaseEvent):
3086         * UIProcess/gtk/GestureController.cpp:
3087         (WebKit::GestureController::handleEvent):
3088         * UIProcess/gtk/InputMethodFilter.cpp:
3089         (WebKit::InputMethodFilter::filterKeyEvent):
3090         (WebKit::InputMethodFilter::logHandleKeyboardEventForTesting):
3091         (WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting):
3092         * UIProcess/gtk/KeyBindingTranslator.cpp:
3093         (WebKit::KeyBindingTranslator::commandsForKeyEvent):
3094         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
3095         (WebKit::isEventStop):
3096         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe):
3097         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventGetScrollingDeltas):
3098         (WebKit::ViewGestureController::SwipeProgressTracker::handleEvent):
3099         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
3100         (WebKit::WebPopupMenuProxyGtk::treeViewButtonReleaseEventCallback):
3101         (WebKit::WebPopupMenuProxyGtk::keyPressEventCallback):
3102
3103 2019-06-17  Carlos Garcia Campos  <cgarcia@igalia.com>
3104
3105         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.25.2 release
3106
3107         * gtk/NEWS: Add release notes for 2.25.2.
3108
3109 2019-06-17  Carlos Garcia Campos  <cgarcia@igalia.com>
3110
3111         Unreviewed, rolling out r246467.
3112
3113         It broke scrolling with mouse wheel
3114
3115         Reverted changeset:
3116
3117         "[GTK] Stop accessing GdkEvent fields when possible"
3118         https://bugs.webkit.org/show_bug.cgi?id=198829
3119         https://trac.webkit.org/changeset/246467
3120
3121 2019-06-16  Darin Adler  <darin@apple.com>
3122
3123         Rename AtomicString to AtomString
3124         https://bugs.webkit.org/show_bug.cgi?id=195276
3125
3126         Reviewed by Michael Catanzaro.
3127
3128         * many files: Let do-webcore-rename do the renaming.
3129
3130 2019-06-16  Simon Fraser  <simon.fraser@apple.com>
3131
3132         Implement ScrollableArea::scrollOffset()
3133         https://bugs.webkit.org/show_bug.cgi?id=198895
3134
3135         Reviewed by Antti Koivisto.
3136
3137         * UIProcess/win/WebPopupMenuProxyWin.cpp:
3138         (WebKit::PopupMenuWin::scrollPosition const):
3139         (WebKit::WebPopupMenuProxyWin::onKeyDown): Just use m_scrollOffset.
3140         (WebKit::WebPopupMenuProxyWin::scrollSize const): Deleted.
3141         * UIProcess/win/WebPopupMenuProxyWin.h: Remove the one-axis scrollOffset()
3142         * WebProcess/Plugins/PDF/PDFPlugin.h:
3143         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3144         (WebKit::PDFPlugin::scrollSize const): Deleted.
3145         (WebKit::PDFPlugin::scrollOffset const): Deleted.
3146         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
3147         (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect):
3148
3149 2019-06-15  Youenn Fablet  <youenn@apple.com>
3150
3151         WebProcessPool::clearWebProcessHasUploads cannot assume its given processIdentifier is valid
3152         https://bugs.webkit.org/show_bug.cgi?id=198865
3153
3154         Unreviewed.
3155
3156         * UIProcess/WebProcessPool.cpp:
3157         (WebKit::WebProcessPool::clearWebProcessHasUploads):
3158         Remove wrong debug assertion in case of WebProcessProxy destruction.
3159
3160 2019-06-15  Ludovico de Nittis  <ludovico.denittis@collabora.com>
3161
3162         [GTK] Stop accessing GdkEvent fields when possible
3163         https://bugs.webkit.org/show_bug.cgi?id=198829
3164
3165         Reviewed by Michael Catanzaro.
3166
3167         Direct access to GdkEvent structs is no longer possible in GTK 4.
3168
3169         * Shared/gtk/WebEventFactory.cpp:
3170         (WebKit::buttonForEvent):
3171         (WebKit::WebEventFactory::createWebMouseEvent):
3172         (WebKit::WebEventFactory::createWebWheelEvent):
3173         (WebKit::WebEventFactory::createWebKeyboardEvent):
3174         (WebKit::WebEventFactory::createWebTouchEvent):
3175         * UIProcess/API/gtk/WebKitEmojiChooser.cpp:
3176         * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp:
3177         (webkitScriptDialogImplKeyPressEvent):
3178         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3179         (ClickCounter::currentClickCountForGdkButtonEvent):
3180         (webkitWebViewBaseKeyPressEvent):
3181         (webkitWebViewBaseHandleMouseEvent):
3182         (webkitWebViewBaseCrossingNotifyEvent):
3183         (webkitWebViewBaseGetTouchPointsForEvent):
3184         (webkitWebViewBaseTouchEvent):
3185         (webkitWebViewBaseEvent):
3186         * UIProcess/gtk/GestureController.cpp:
3187         (WebKit::GestureController::handleEvent):
3188         * UIProcess/gtk/InputMethodFilter.cpp:
3189         (WebKit::InputMethodFilter::filterKeyEvent):
3190         (WebKit::InputMethodFilter::logHandleKeyboardEventForTesting):
3191         (WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting):
3192         * UIProcess/gtk/KeyBindingTranslator.cpp:
3193         (WebKit::KeyBindingTranslator::commandsForKeyEvent):
3194         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
3195         (WebKit::isEventStop):
3196         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe):
3197         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventGetScrollingDeltas):
3198         (WebKit::ViewGestureController::SwipeProgressTracker::handleEvent):
3199         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
3200         (WebKit::WebPopupMenuProxyGtk::treeViewButtonReleaseEventCallback):
3201         (WebKit::WebPopupMenuProxyGtk::keyPressEventCallback):
3202
3203 2019-06-15  Rob Buis  <rbuis@igalia.com>
3204
3205         Store prefetch redirects in the prefetch cache
3206         https://bugs.webkit.org/show_bug.cgi?id=197371
3207
3208         Reviewed by Youenn Fablet.
3209
3210         Store prefetch redirects in the prefetch cache and use them when
3211         navigating.
3212
3213         * NetworkProcess/NetworkResourceLoader.cpp:
3214         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
3215         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
3216         (WebKit::NetworkResourceLoader::didFinishWithRedirectResponse):
3217         * NetworkProcess/NetworkResourceLoader.h:
3218         * NetworkProcess/cache/PrefetchCache.cpp:
3219         (WebKit::PrefetchCache::Entry::Entry):
3220         (WebKit::PrefetchCache::storeRedirect):
3221         * NetworkProcess/cache/PrefetchCache.h:
3222
3223 2019-06-14  Devin Rousso  <drousso@apple.com>
3224
3225         waitForNavigationToComplete may be called before WebPageProxy knows it's loading
3226         https://bugs.webkit.org/show_bug.cgi?id=198741
3227         <rdar://problem/31164316>
3228
3229         Reviewed by Joseph Pecoraro.
3230
3231         There's a potential race in `WebAutomationSession::waitForNavigationToCompleteOnPage` when
3232         querying for the `WebPageProxy`'s loading state (via `PageLoadingState::isLoading`), in that
3233         a pending load may be committed _after_ the `WebAutomationSession` checks it's value. This
3234         makes the automation session think that it isn't loading, so it will continue running
3235         commands, which can lead to a JavaScript error ("Callback was not called before the unload
3236         event") as any injected scripts will be cleared by the impending navigation, leaving the
3237         script evaluation callbacks "dangling".
3238
3239         Expose more information from `PageLoadState` about whether it thinks there _may_ be a
3240         navigation currently happening, which the `WebAutomationSession` can use to delay commands.
3241
3242         In the best case, no navigations are "missed".
3243
3244         In the worst case, the automation session will wait `pageLoadTimeout` before continuing.
3245
3246         * UIProcess/Automation/WebAutomationSession.cpp:
3247         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage):
3248
3249         * UIProcess/PageLoadState.h:
3250         * UIProcess/PageLoadState.cpp:
3251         (WebKit::PageLoadState::hasUncommittedLoad const): Added.
3252
3253 2019-06-14  Youenn Fablet  <youenn@apple.com>
3254
3255         WebProcessPool::clearWebProcessHasUploads cannot assume its given processIdentifier is valid
3256         https://bugs.webkit.org/show_bug.cgi?id=198865
3257         <rdar://problem/51618878>
3258
3259         Reviewed by Brady Eidson.
3260
3261         NetworkProcess currently instructs UIProcess whether a given WebProcess is doing upload.
3262         There is no guarantee though that the WebProcessProxy is still there when the IPC is arriving at UIProcess.
3263         Instead, let WebProcess handles its upload state and notify WebProcessPool about its state.
3264         Make sure WebProcessProxy unregisters itself in case of crash.
3265         In case of NetworkProcess crash, WebProcesses will see all their uploads fail
3266         and will notify automatically UIProcess to update their state.
3267
3268         Since the processID given to WebProcessPool is coming from IPC, we cannot not trust it.
3269         Add early return in case of not finding a WebProcessProxy for WebProcessPool clear/set methods.
3270
3271         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3272         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
3273         * NetworkProcess/NetworkConnectionToWebProcess.h:
3274         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3275         * NetworkProcess/NetworkResourceLoadMap.cpp:
3276         (WebKit::NetworkResourceLoadMap::add):
3277         (WebKit::NetworkResourceLoadMap::take):
3278         * NetworkProcess/NetworkResourceLoadMap.h:
3279         * UIProcess/WebProcessPool.cpp:
3280         (WebKit::WebProcessPool::setWebProcessHasUploads):
3281         (WebKit::WebProcessPool::clearWebProcessHasUploads):
3282         * UIProcess/WebProcessProxy.cpp:
3283         (WebKit::WebProcessProxy::~WebProcessProxy):
3284         * WebProcess/Network/WebLoaderStrategy.cpp:
3285         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3286         (WebKit::WebLoaderStrategy::remove):
3287         (WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
3288         * WebProcess/Network/WebLoaderStrategy.h:
3289         * WebProcess/WebProcess.cpp:
3290         (WebKit::WebProcess::ensureNetworkProcessConnection):
3291
3292 2019-06-14  Youenn Fablet  <youenn@apple.com>
3293
3294         WebResourceLoadStatisticsStore should not use its network session if invalidated
3295         https://bugs.webkit.org/show_bug.cgi?id=198814
3296
3297         Reviewed by Geoffrey Garen.
3298
3299         Tell WebResourceLoadStatisticsStore that its network session is invalidated.
3300         WebResourceLoadStatisticsStore will then clear its reference to the network session.
3301
3302         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3303         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
3304         Added for test purposes to trigger further cookie processing.
3305         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3306         (WebKit::WebResourceLoadStatisticsStore::invalidateAndCancel):
3307         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3308         * NetworkProcess/NetworkSession.cpp:
3309         (WebKit::NetworkSession::invalidateAndCancel):
3310
3311 2019-06-14  Joseph Pecoraro  <pecoraro@apple.com>
3312
3313         [Cocoa] NSFileWrapper associated with _WKAttachment
3314         https://bugs.webkit.org/show_bug.cgi?id=198871
3315         <rdar://problem/51760625>
3316
3317         Reviewed by Wenson Hsieh.
3318
3319         * UIProcess/API/Cocoa/_WKAttachment.mm:
3320         (-[_WKAttachment dealloc]):
3321         Ensure we destruct the API::Object associated with this so RetainPtrs can release.
3322
3323 2019-06-14  Tim Horton  <timothy_horton@apple.com>
3324
3325         WebKit's NSAttributedString.h is not included in the WebKit.h umbrella header
3326         https://bugs.webkit.org/show_bug.cgi?id=198869
3327         <rdar://problem/51754437>
3328
3329         Reviewed by Timothy Hatcher.
3330
3331         * Shared/API/Cocoa/WebKit.h:
3332         Make the new API available to modularized clients and folks who just import WebKit.h
3333
3334 2019-06-14  Jiewen Tan  <jiewen_tan@apple.com>
3335
3336         Disable AppSSO for web processes and plugin processes
3337         https://bugs.webkit.org/show_bug.cgi?id=198843
3338         <rdar://problem/51642920>
3339
3340         Reviewed by Sam Weinig.
3341
3342         This patch moves the disabling of AppSSO from AuxiliaryProcess to PluginProcess
3343         and WebProcess such that NetworkingProcess will not be affected.
3344
3345         * PluginProcess/mac/PluginProcessMac.mm:
3346         (WebKit::PluginProcess::platformInitializePluginProcess):
3347         * Shared/ios/AuxiliaryProcessIOS.mm:
3348         (WebKit::AuxiliaryProcess::platformInitialize):
3349         * Shared/mac/AuxiliaryProcessMac.mm:
3350         (WebKit::AuxiliaryProcess::platformInitialize):
3351         * WebProcess/cocoa/WebProcessCocoa.mm:
3352         (WebKit::WebProcess::platformInitializeProcess):
3353
3354 2019-06-14  Megan Gardner  <megan_gardner@apple.com>
3355
3356         Move Synthetic Editing Commands to behind an experimental feature flag
3357         https://bugs.webkit.org/show_bug.cgi?id=198842
3358         <rdar://problem/50594700>
3359
3360         Reviewed by Simon Fraser.
3361
3362         Add a feature flag to gate synthetic editing commands.
3363
3364         * Shared/WebPreferences.yaml:
3365         * WebProcess/WebPage/ios/WebPageIOS.mm:
3366         (WebKit::WebPage::getFocusedElementInformation):
3367
3368 2019-06-13  Megan Gardner  <megan_gardner@apple.com>
3369
3370         Fix selection hang in Mail
3371         https://bugs.webkit.org/show_bug.cgi?id=198845
3372         <rdar://problem/51388180>
3373
3374         Reviewed by Tim Horton.
3375
3376         SelectionDidChange requires a selectionWillChange in order to keep things in line.
3377
3378         * UIProcess/ios/WKContentViewInteraction.mm:
3379         (-[WKContentView _selectionChanged]):
3380
3381 2019-06-13  Tim Horton  <timothy_horton@apple.com>
3382
3383         No content shows up for WKWebView while locked even with _canShowWhileLocked is YES
3384         https://bugs.webkit.org/show_bug.cgi?id=198819
3385         <rdar://problem/51636240>
3386
3387         Reviewed by Simon Fraser.
3388
3389         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3390         (WebKit::WebPageProxy::didCreateContextForVisibilityPropagation):
3391         * UIProcess/WebPageProxy.h:
3392         (WebKit::WebPageProxy::contextIDForVisibilityPropagation const):
3393         * UIProcess/WebPageProxy.messages.in:
3394         * UIProcess/WebProcessProxy.h:
3395         (WebKit::WebProcessProxy::contextIDForVisibilityPropagation): Deleted.
3396         * UIProcess/WebProcessProxy.messages.in:
3397         * UIProcess/ios/WKContentView.mm:
3398         (-[WKContentView _setupVisibilityPropagationView]):
3399         * UIProcess/ios/WebPageProxyIOS.mm:
3400         (WebKit::WebPageProxy::didCreateContextForVisibilityPropagation): Deleted.
3401         * UIProcess/ios/WebProcessProxyIOS.mm:
3402         (WebKit::WebProcessProxy::didCreateContextForVisibilityPropagation): Deleted.
3403         * WebProcess/WebPage/WebPage.cpp:
3404         (WebKit::m_shrinkToFitContentTimer):
3405         * WebProcess/WebPage/WebPage.h:
3406         * WebProcess/WebProcess.h:
3407         * WebProcess/cocoa/WebProcessCocoa.mm:
3408         (WebKit::WebProcess::platformInitializeWebProcess):
3409         Move the creation of the visibility propagation context to WebPage instead of WebProcess,
3410         because canShowWhileLocked is per-page, not per-process.
3411
3412         Also, pass canShowWhileLocked into the context creation function for the visibility
3413         propagation context, not just RemoteLayerTree contexts.
3414
3415 2019-06-13  Antoine Quint  <graouts@apple.com>
3416
3417         "display: contents" Content click does not trigger
3418         https://bugs.webkit.org/show_bug.cgi?id=198559
3419         <rdar://problem/51488524>
3420
3421         Reviewed by Antti Koivisto.
3422
3423         * WebProcess/WebPage/ios/WebPageIOS.mm:
3424         (WebKit::WebPage::commitPotentialTap):
3425
3426 2019-06-13  Takashi Komori  <Takashi.Komori@sony.com>
3427
3428         [curl] Remove member objects of CurlRequest not to share by different threads.
3429         https://bugs.webkit.org/show_bug.cgi?id=198747
3430
3431         Reviewed by Fujii Hironori.
3432
3433         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3434         (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
3435         (WebKit::NetworkDataTaskCurl::curlDidComplete):
3436         (WebKit::NetworkDataTaskCurl::curlDidFailWithError):
3437         * NetworkProcess/curl/NetworkDataTaskCurl.h:
3438
3439 2019-06-13  Zan Dobersek  <zdobersek@igalia.com>
3440
3441         [Nicosia] Add SceneIntegration
3442         https://bugs.webkit.org/show_bug.cgi?id=198791
3443
3444         Reviewed by Carlos Garcia Campos.
3445
3446         Have the LayerTreeHost own the SceneIntegration object that's to be
3447         associated with layers used inside the LayerTreeHost's scene. The
3448         class now also inherits the SceneIntegration::Client interface, with the
3449         requestUpdate() method scheduling a scene update in ThreadedCompositor.
3450
3451         CompositingCoordinator now retrieves the SceneIntegration object from
3452         the LayerTreeHost instance and manages association to that object for
3453         layers under the coordinator's control.
3454
3455         ThreadedCompositor class gets a new public updateScene() method that
3456         schedules an update, enabling the SceneIntegration class to invoke
3457         scene updates.
3458
3459         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3460         (WebKit::ThreadedCompositor::updateScene):
3461         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
3462         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3463         (WebKit::CompositingCoordinator::createGraphicsLayer):
3464         (WebKit::CompositingCoordinator::detachLayer):
3465         (WebKit::CompositingCoordinator::attachLayer):
3466         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
3467         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
3468         (WebKit::LayerTreeHost::LayerTreeHost):
3469         (WebKit::LayerTreeHost::sceneIntegration):
3470         (WebKit::LayerTreeHost::requestUpdate):
3471         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
3472
3473 2019-06-13  Ludovico de Nittis  <ludovico.denittis@collabora.com>
3474
3475         [GTK] gdk_display_get_device_manager and gdk_screen_get_width/height are deprecated
3476         https://bugs.webkit.org/show_bug.cgi?id=198822
3477
3478         Reviewed by Carlos Garcia Campos.
3479
3480         GdkSeat and GdkRectangle should be used, respectively.
3481
3482         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
3483         (WebKit::doMouseEvent):
3484         (WebKit::doMotionEvent):
3485         (WebKit::doKeyStrokeEvent):
3486
3487 2019-06-12  Antoine Quint  <graouts@apple.com>
3488
3489         Show the web page URL when sharing an AR model
3490         https://bugs.webkit.org/show_bug.cgi?id=198812
3491         <rdar://problem/48689498>
3492
3493         Reviewed by Dean Jackson.
3494
3495         * UIProcess/Cocoa/DownloadClient.mm:
3496         (WebKit::DownloadClient::didStart):
3497         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
3498         (-[_WKPreviewControllerDataSource initWithMIMEType:originatingPageURL:]):
3499         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
3500         (WebKit::SystemPreviewController::start):
3501         (-[_WKPreviewControllerDataSource initWithMIMEType:]): Deleted.
3502         * UIProcess/SystemPreviewController.h:
3503
3504 2019-06-12  Antti Koivisto  <antti@apple.com>
3505
3506         Try to fix iOS build.
3507
3508         * NetworkProcess/Downloads/DownloadMap.cpp:
3509
3510 2019-06-12  Youenn Fablet  <youenn@apple.com>
3511
3512         Use NSURLSession for WebSocket
3513         https://bugs.webkit.org/show_bug.cgi?id=198568
3514
3515         Reviewed by Geoffrey Garen.
3516
3517         Implement socket channel provider on WebProcess level by sending IPC to NetworkProcess.
3518         On NetworkProcess side, use NSURLSession API to implement the WebSocket functionality. 
3519         This is a partial implementation:
3520         - inspector integration is not working.
3521         - some error cases are not well handled or are not producing the same error messages.
3522         - some features are not implemented (extensions, subprotocols, handshake authentication challenge, cookie handling...).
3523
3524         * CMakeLists.txt:
3525         * DerivedSources-input.xcfilelist:
3526         * DerivedSources-output.xcfilelist:
3527         * DerivedSources.make:
3528         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3529         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
3530         (WebKit::NetworkConnectionToWebProcess::createSocketChannel):
3531         (WebKit::NetworkConnectionToWebProcess::removeSocketChannel):
3532         * NetworkProcess/NetworkConnectionToWebProcess.h:
3533         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3534         * NetworkProcess/NetworkSession.cpp:
3535         (WebKit::NetworkSession::createWebSocketTask):
3536         * NetworkProcess/NetworkSession.h:
3537         (WebKit::NetworkSession::removeWebSocketTask):
3538         (WebKit::NetworkSession::addWebSocketTask):
3539         * NetworkProcess/NetworkSocketChannel.cpp: Added.
3540         (WebKit::NetworkSocketChannel::create):
3541         (WebKit::NetworkSocketChannel::NetworkSocketChannel):
3542         (WebKit::NetworkSocketChannel::~NetworkSocketChannel):
3543         (WebKit::NetworkSocketChannel::sendString):
3544         (WebKit::NetworkSocketChannel::sendData):
3545         (WebKit::NetworkSocketChannel::finishClosingIfPossible):
3546         (WebKit::NetworkSocketChannel::close):
3547         (WebKit::NetworkSocketChannel::didConnect):
3548         (WebKit::NetworkSocketChannel::didReceiveText):
3549         (WebKit::NetworkSocketChannel::didReceiveBinaryData):
3550         (WebKit::NetworkSocketChannel::didClose):
3551         (WebKit::NetworkSocketChannel::messageSenderConnection const):
3552         * NetworkProcess/NetworkSocketChannel.h: Added.
3553         * NetworkProcess/NetworkSocketChannel.messages.in: Added.
3554         * NetworkProcess/NetworkSocketStream.messages.in:
3555         * NetworkProcess/WebSocketTask.h: Added.
3556         (WebKit::WebSocketTask::sendString):
3557         (WebKit::WebSocketTask::sendData):
3558         (WebKit::WebSocketTask::close):
3559         (WebKit::WebSocketTask::cancel):
3560         (WebKit::WebSocketTask::resume):
3561         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
3562         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3563         (-[WKNetworkSessionDelegate existingWebSocketTask:]):
3564         (-[WKNetworkSessionDelegate URLSession:webSocketTask:didOpenWithProtocol:]):
3565         (-[WKNetworkSessionDelegate URLSession:webSocketTask:didCloseWithCode:reason:]):
3566         (WebKit::NetworkSessionCocoa::continueDidReceiveChallenge):
3567         (WebKit::NetworkSessionCocoa::createWebSocketTask):
3568         (WebKit::NetworkSessionCocoa::addWebSocketTask):
3569         (WebKit::NetworkSessionCocoa::removeWebSocketTask):
3570         (WebKit::NetworkSessionCocoa::webSocketDataTaskForIdentifier):
3571         * NetworkProcess/cocoa/WebSocketTaskCocoa.h: Added.
3572         * NetworkProcess/cocoa/WebSocketTaskCocoa.mm: Added.
3573         (WebKit::WebSocketTask::WebSocketTask):
3574         (WebKit::WebSocketTask::~WebSocketTask):
3575         (WebKit::WebSocketTask::readNextMessage):
3576         (WebKit::WebSocketTask::cancel):
3577         (WebKit::WebSocketTask::resume):
3578         (WebKit::WebSocketTask::didConnect):
3579         (WebKit::WebSocketTask::didClose):
3580         (WebKit::WebSocketTask::sendString):
3581         (WebKit::WebSocketTask::sendData):
3582         (WebKit::WebSocketTask::close):
3583         (WebKit::WebSocketTask::identifier const):
3584         * Shared/WebPreferences.yaml:
3585         * WebKit.xcodeproj/project.pbxproj:
3586         * WebProcess/Network/NetworkProcessConnection.cpp:
3587         (WebKit::NetworkProcessConnection::didReceiveMessage):
3588         * WebProcess/Network/WebSocketChannel.cpp: Added.
3589         (WebKit::WebSocketChannel::create):
3590         (WebKit::WebSocketChannel::WebSocketChannel):
3591         (WebKit::WebSocketChannel::~WebSocketChannel):
3592         (WebKit::WebSocketChannel::messageSenderConnection const):
3593         (WebKit::WebSocketChannel::messageSenderDestinationID const):
3594         (WebKit::WebSocketChannel::subprotocol):
3595         (WebKit::WebSocketChannel::extensions):
3596         (WebKit::WebSocketChannel::connect):
3597         (WebKit::WebSocketChannel::send):
3598         (WebKit::WebSocketChannel::bufferedAmount const):
3599         (WebKit::WebSocketChannel::close):
3600         (WebKit::WebSocketChannel::fail):
3601         (WebKit::WebSocketChannel::disconnect):
3602         (WebKit::WebSocketChannel::didConnect):
3603         (WebKit::WebSocketChannel::didReceiveText):
3604         (WebKit::WebSocketChannel::didReceiveBinaryData):
3605         (WebKit::WebSocketChannel::didClose):
3606         (WebKit::WebSocketChannel::didFail):
3607         (WebKit::WebSocketChannel::networkProcessCrashed):
3608         * WebProcess/Network/WebSocketChannel.h: Added.
3609         * WebProcess/Network/WebSocketChannel.messages.in: Added.
3610         * WebProcess/Network/WebSocketChannelManager.cpp: Added.
3611         (WebKit::WebSocketChannelManager::createWebSocketChannel):
3612         (WebKit::WebSocketChannelManager::networkProcessCrashed):
3613         (WebKit::WebSocketChannelManager::didReceiveMessage):
3614         * WebProcess/Network/WebSocketChannelManager.h: Added.
3615         * WebProcess/Network/WebSocketProvider.cpp:
3616         (WebKit::WebSocketProvider::createWebSocketChannel):
3617         * WebProcess/Network/WebSocketProvider.h:
3618         * WebProcess/Network/WebSocketStream.cpp:
3619         * WebProcess/Network/WebSocketStream.messages.in:
3620         * WebProcess/WebProcess.cpp:
3621         (WebKit::WebProcess::networkProcessConnectionClosed):
3622         * WebProcess/WebProcess.h:
3623         (WebKit::WebProcess::webSocketChannelManager):
3624
3625 2019-06-12  Sihui Liu  <sihui_liu@apple.com>
3626
3627         Add assertions to help debug crash at WebKit::HistoryEntryDataEncoder::operator<<
3628         https://bugs.webkit.org/show_bug.cgi?id=198766
3629
3630         Reviewed by Geoffrey Garen.
3631
3632         * Shared/SessionState.h:
3633         (WebKit::FrameState::~FrameState):
3634         * UIProcess/API/C/WKPage.cpp:
3635         (WKPageCopySessionState):
3636         * UIProcess/mac/LegacySessionStateCoding.cpp:
3637         (WebKit::HistoryEntryDataEncoder::encodeFixedLengthData):
3638         (WebKit::encodeFrameStateNode):
3639
3640 2019-06-12  Ludovico de Nittis  <ludovico.denittis@collabora.com>
3641
3642         [GTK] GTK_STOCK_* types have been deprecated since GTK 3.10
3643         https://bugs.webkit.org/show_bug.cgi?id=198787
3644
3645         Reviewed by Michael Catanzaro.
3646
3647         We completely remove the gtkStockIDFromContextMenuAction function in order to get rid of the stock items.
3648         This function was used only in "createActionIfNeeded" where now we pass a nullptr as a stock_id variable.
3649
3650         * Shared/glib/WebContextMenuItemGlib.cpp:
3651         (WebKit::gtkStockIDFromContextMenuAction):
3652
3653 2019-06-12  Brent Fulgham  <bfulgham@apple.com>
3654
3655         Unreviewed fix after rr246360.
3656
3657         The current code accidentally calls the completion handler twice.
3658
3659         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3660         (-[WKWebsiteDataStore _setPrevalentDomain:completionHandler:]):
3661
3662 2019-06-12  Jiewen Tan  <jiewen_tan@apple.com>
3663
3664         REGRESSION (r245043) [Mac WK2 Debug] ASSERTION FAILED: m_services.isEmpty() && transports.size() <= maxTransportNumber seen with two http/wpt/webauthn/public-key-credential-* tests
3665         https://bugs.webkit.org/show_bug.cgi?id=197917
3666         <rdar://problem/51524958>
3667
3668         Reviewed by Brent Fulgham.
3669
3670         This is a race condition that when a new request comes in the middle between the previous one finishes and the clearStateAsync is queued in the main thread.
3671         Therefore, when the new request starts discovery, it will still see previous request's state.
3672
3673         To fix this issue, clearState() will be called unconditionally for every request. And a guard is added to clearState() to prevent double clearance.
3674
3675         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
3676         (WebKit::AuthenticatorManager::makeCredential):
3677         (WebKit::AuthenticatorManager::getAssertion):
3678         (WebKit::AuthenticatorManager::clearState):
3679
3680 2019-06-12  Brent Fulgham  <bfulgham@apple.com>
3681
3682         Add mechanism and test case to check if ITP is active
3683         https://bugs.webkit.org/show_bug.cgi?id=198694
3684         <rdar://problem/51557704>
3685
3686         Reviewed by Youenn Fablet.
3687
3688         Add a new private SPI call on the WebsiteDataStore object that allows test code
3689         to mark a domain as prevalent, and check the prevalance of a resource. This
3690         is then used to build a test to confirm ITP is active and working.
3691
3692         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3693         (-[WKWebsiteDataStore _setPrevalentDomain:completionHandler:]):
3694         (-[WKWebsiteDataStore _getIsPrevalentDomain:completionHandler:]):
3695         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3696
3697 2019-06-12  Wenson Hsieh  <wenson_hsieh@apple.com>
3698
3699         Many layout tests are failing on iPad simulator due to unexpected viewport dimensions
3700         https://bugs.webkit.org/show_bug.cgi?id=198789
3701         <rdar://problem/51595519>
3702
3703         Reviewed by Simon Fraser.
3704
3705         Prevent the shrink-to-fit-content timer from activating on layout tests that use the testing viewport
3706         configuration.
3707
3708         * WebProcess/WebPage/ios/WebPageIOS.mm:
3709         (WebKit::WebPage::immediatelyShrinkToFitContent):
3710
3711 2019-06-12  Michael Catanzaro  <mcatanzaro@igalia.com>
3712
3713         [WPE][GTK] Deprecate WebSQL APIs
3714         https://bugs.webkit.org/show_bug.cgi?id=195011
3715
3716         Reviewed by Carlos Garcia Campos.
3717
3718         * UIProcess/API/glib/WebKitSettings.cpp:
3719         (webkit_settings_class_init):
3720         * UIProcess/API/glib/WebKitWebContext.cpp:
3721         (webkitWebContextConstructed):
3722         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
3723         (webkitWebsiteDataManagerGetProperty):
3724         (webkit_website_data_manager_class_init):
3725         * UIProcess/API/gtk/WebKitWebsiteData.h:
3726         * UIProcess/API/gtk/WebKitWebsiteDataManager.h:
3727         * UIProcess/API/wpe/WebKitWebsiteData.h:
3728         * UIProcess/API/wpe/WebKitWebsiteDataManager.h:
3729
3730 2019-06-12  Michael Catanzaro  <mcatanzaro@igalia.com>
3731
3732         [WPE][GTK] Enable hyperlink auditing
3733         https://bugs.webkit.org/show_bug.cgi?id=197845
3734
3735         Reviewed by Carlos Garcia Campos.
3736
3737         * UIProcess/API/glib/WebKitSettings.cpp:
3738         (webkit_settings_class_init):
3739
3740 2019-06-12  Ludovico de Nittis  <ludovico.denittis@collabora.com>
3741
3742         [GTK] gtk_misc_set_alignment is deprecated since GTK 3.14
3743         https://bugs.webkit.org/show_bug.cgi?id=198785
3744
3745         Reviewed by Carlos Garcia Campos.
3746
3747         Replace the deprecated gtk_misc_set_alignment with halign and valign.
3748
3749         * UIProcess/API/gtk/WebKitAuthenticationDialog.cpp:
3750         (createLabelWithLineWrap):
3751
3752 2019-06-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3753
3754         [iOS] Idempotent text autosizing needs to react properly to viewport changes
3755         https://bugs.webkit.org/show_bug.cgi?id=198736
3756         <rdar://problem/50591911>
3757
3758         Reviewed by Zalan Bujtas.
3759
3760         If idempotent text autosizing is enabled, respond to viewport initial scale changes by forcing a style recalc,
3761         since the amount by which idempotent text autosizing boosts font sizes depends on the Page's initial scale.
3762
3763         * WebProcess/WebPage/WebPage.h:
3764         * WebProcess/WebPage/ios/WebPageIOS.mm:
3765         (WebKit::WebPage::resetIdempotentTextAutosizingIfNeeded):
3766         (WebKit::WebPage::viewportConfigurationChanged):
3767
3768 2019-06-11  Zalan Bujtas  <zalan@apple.com>
3769
3770         LayoutTests/fast/events/touch/ios/double-tap-for-double-click* test cases are failing
3771         https://bugs.webkit.org/show_bug.cgi?id=198764
3772         <rdar://problem/51035459>
3773
3774         Reviewed by Wenson Hsieh.
3775
3776         This patch replaces the existing, _doubleTapGestureRecognizerForDoubleClick based double click handling with a WebProcess based implementation using
3777         the potentialTapAtPosition/commitPotentialTap infrastructure.
3778
3779         * Shared/WebPageCreationParameters.cpp:
3780         (WebKit::WebPageCreationParameters::encode const):
3781         (WebKit::WebPageCreationParameters::decode):
3782         * Shared/WebPageCreationParameters.h:
3783         * UIProcess/PageClient.h:
3784         * UIProcess/WebPageProxy.cpp:
3785         (WebKit::WebPageProxy::creationParameters):
3786         * UIProcess/WebPageProxy.h:
3787         * UIProcess/ios/PageClientImplIOS.h:
3788         * UIProcess/ios/PageClientImplIOS.mm:
3789         (WebKit::PageClientImpl::doubleTapForDoubleClickDelay):
3790         (WebKit::PageClientImpl::doubleTapForDoubleClickRadius):
3791         * UIProcess/ios/WKContentViewInteraction.h:
3792         * UIProcess/ios/WKContentViewInteraction.mm:
3793         (-[WKContentView _ensureNonBlockingDoubleTapGestureRecognizer]):
3794         (-[WKContentView setupInteraction]):
3795         (-[WKContentView cleanupInteraction]):
3796         (-[WKContentView _removeDefaultGestureRecognizers]):
3797         (-[WKContentView _addDefaultGestureRecognizers]):
3798         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
3799         (-[WKContentView gestureRecognizerShouldBegin:]):
3800         (-[WKContentView _didStartProvisionalLoadForMainFrame]):
3801         (-[WKContentView _doubleTapForDoubleClickDelay]):
3802         (-[WKContentView _doubleTapForDoubleClickRadius]):
3803         (-[WKContentView _doubleTapRecognizedForDoubleClick:]): Deleted.
3804         * UIProcess/ios/WebPageProxyIOS.mm:
3805         (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint): Deleted.
3806         * WebProcess/WebPage/WebPage.cpp:
3807         * WebProcess/WebPage/WebPage.h:
3808         * WebProcess/WebPage/WebPage.messages.in:
3809         * WebProcess/WebPage/ios/WebPageIOS.mm:
3810         (WebKit::WebPage::handlePotentialDoubleTapForDoubleClickAtPoint):
3811         (WebKit::WebPage::commitPotentialTap):
3812         (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint): Deleted.
3813
3814 2019-06-11  Andy Estes  <aestes@apple.com>
3815
3816         [Apple Pay] ASSERTION FAILED: m_state == State::Activating under WebPaymentCoordinatorProxy::showPaymentUI
3817         https://bugs.webkit.org/show_bug.cgi?id=198776
3818         <rdar://problem/49123795>
3819
3820         Reviewed by Brian Weinstein.
3821
3822         It's possible that an active session is aborted before the completion handler passed to
3823         platformShowPaymentUI() has executed. When that happens, m_state will be Idle even though we
3824         assert that it is Activating. Fix this by returning early in the platformShowPaymentUI()
3825         completion handler when m_state is Idle.
3826
3827         It's not possible to write a layout test for this because MockPaymentCoordinator handles
3828         showing payment UI directly in the web process, so this code is not executed in layout
3829         tests. The assertion can be reproduced manually by loading
3830         https://w3c-test.org/payment-request/payment-is-showing.https.html and clicking the button.
3831
3832         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
3833         (WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
3834
3835 2019-06-11  Patrick Griffis  <pgriffis@igalia.com>
3836
3837         [GTK] Fix a11y support in bubblewrap sandbox
3838         https://bugs.webkit.org/show_bug.cgi?id=198777
3839
3840         Reviewed by Michael Catanzaro.
3841
3842         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
3843         (WebKit::bindA11y):
3844
3845 2019-06-11  Timothy Hatcher  <timothy@apple.com>
3846
3847         Flash when tapping compose button after switching to/from dark mode without restarting Mail.
3848         https://bugs.webkit.org/show_bug.cgi?id=198769
3849         rdar://problem/51370037
3850
3851         Reviewed by Tim Horton.
3852
3853         Accessing a dynamic color outside a normal UIView choke point without setting
3854         UITraitCollection.currentTraitCollection first can cause undefined results.
3855         Use LocalCurrentTraitCollection inside scrollViewBackgroundColor when accessing
3856         the dynamic system UIColors. Also use systemBackgroundColor instead of white.
3857
3858         * UIProcess/API/Cocoa/WKWebView.mm:
3859         (scrollViewBackgroundColor):
3860
3861 2019-06-11  Megan Gardner  <megan_gardner@apple.com>
3862
3863         Integrate scrollbar gestures for iOS
3864         https://bugs.webkit.org/show_bug.cgi?id=198767
3865
3866         Reviewed by Tim Horton.
3867
3868         * UIProcess/ios/WKContentViewInteraction.mm:
3869         (_WKGestureRecognizerIsBuiltInScrollViewGestureRecognizer):
3870         (-[WKContentView gestureRecognizer:canPreventGestureRecognizer:]):
3871
3872 2019-06-11  Timothy Hatcher  <timothy@apple.com>
3873
3874         Scrollbar can show as white on white in dark mode on iOS.
3875         https://bugs.webkit.org/show_bug.cgi?id=198772
3876         rdar://problem/51516743
3877
3878         Reviewed by Tim Horton.
3879
3880         * UIProcess/API/Cocoa/WKWebView.mm:
3881         (-[WKWebView _updateScrollViewBackground]): Use UIScrollViewIndicatorStyleBlack instead
3882         of UIScrollViewIndicatorStyleDefault to prevent getting a white scrollbar in dark mode.
3883
3884 2019-06-11  Michael Catanzaro  <mcatanzaro@igalia.com>
3885
3886         Unreviewed build warning fixes
3887
3888         Silence -Wunused-variable warning
3889
3890         * UIProcess/WebProcessPool.cpp:
3891         (WebKit::WebProcessPool::clearWebProcessIsPlayingAudibleMedia):
3892
3893 2019-06-11  Simon Fraser  <simon.fraser@apple.com>
3894
3895         Fix non-internal builds after r246327.
3896
3897         * Platform/spi/ios/UIKitSPI.h:
3898
3899 2019-06-10  Simon Fraser  <simon.fraser@apple.com>
3900
3901         Add logging for UI-side compositing hit-testing
3902         https://bugs.webkit.org/show_bug.cgi?id=198739
3903
3904         Reviewed by Antti Koivisto.
3905
3906         Make it easier to debug UI-side compositing hit-testing issues with a UIHitTesting log
3907         channel, which logs information about the UIView hierarchy, which views are found by
3908         hit-testing, and what touch-actions apply.
3909
3910         This log channel can be set by passing the argument '-WebKit2Logging "UIHitTesting"' when
3911         launching a debug iOS MobileSafari instance.
3912
3913         * Platform/Logging.h:
3914         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
3915         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
3916         * UIProcess/ios/WKContentViewInteraction.mm:
3917         (-[WKContentView hitTest:withEvent:]):
3918         (-[WKContentView _handleTouchActionsForTouchEvent:]):
3919
3920 2019-06-11  Antti Koivisto  <antti@apple.com>
3921
3922         REGRESSION (iOS): Can't scroll litter-robot.com checkout form's dropdown menus
3923         https://bugs.webkit.org/show_bug.cgi?id=198753
3924         <rdar://problem/51355686>
3925
3926         Reviewed by Simon Fraser.
3927
3928         If an element with 'overflow:scroll' also had 'visibility:hidden' or 'pointer-events:none' it would
3929         capture touches and prevent scrolling of any overlapped scrollers.
3930
3931         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
3932         (WebKit::collectDescendantViewsAtPoint):
3933
3934         Filter out views with 'isUserInteractionEnabled == NO' (set for hidden and pointer-events:none layers).
3935         This prevents it being considered as the first view hit when determining scrolling relationships.
3936
3937         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
3938
3939         No need to skip here anymore.
3940
3941 2019-06-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3942
3943         Quotes are always inserted as smart quotes on stackblitz.com, causing compilation errors
3944         https://bugs.webkit.org/show_bug.cgi?id=198735
3945         <rdar://problem/51557159>
3946
3947         Reviewed by Megan Gardner.
3948
3949         Add a flag in FocusedElementInformation to indicate whether spellchecking is allowed in the focused element.
3950         If spellchecking is not allowed, then disable smart quotes and dashes, which matches behavior on macOS.
3951
3952         * Shared/FocusedElementInformation.cpp:
3953         (WebKit::FocusedElementInformation::encode const):
3954         (WebKit::FocusedElementInformation::decode):
3955         * Shared/FocusedElementInformation.h:
3956         * UIProcess/ios/WKContentViewInteraction.mm:
3957         (-[WKContentView textInputTraits]):
3958         * WebProcess/WebPage/ios/WebPageIOS.mm:
3959         (WebKit::WebPage::getFocusedElementInformation):
3960
3961 2019-06-11  Carlos Garcia Campos  <cgarcia@igalia.com>
3962
3963         [GTK] Remove option REDIRECTED_XCOMPOSITE_WINDOW
3964         https://bugs.webkit.org/show_bug.cgi?id=198748
3965
3966         Reviewed by Žan Doberšek.
3967
3968         It's unused and untested, we kept that code path only because the redirected window caused performance issues in
3969         some drivers in embedded devices. Nowadays there are much better solutions for those cases like using WPE port
3970         or GTK port under wayland instead of X11.
3971
3972         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3973         (WebKit::ThreadedCompositor::create): Remove the ShouldDoFrameSync parameter since it always receives Yes.
3974         (WebKit::ThreadedCompositor::ThreadedCompositor): Ditto.
3975         (WebKit::ThreadedCompositor::createGLContext): Remove the code to handle the case of ShouldDoFrameSync being No,
3976         since it's always Yes.
3977         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing): Deleted.
3978         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
3979         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3980         (webkitWebViewBaseRealize): Remove the code for !USE(REDIRECTED_XCOMPOSITE_WINDOW).
3981         (webkitWebViewBaseUnrealize): Ditto.
3982         (webkitWebViewBaseDraw): acceleratedBackingStore member can't be nullptr now.
3983         (webkitWebViewBaseEnterAcceleratedCompositingMode): Ditto.
3984         (webkitWebViewBaseUpdateAcceleratedCompositingMode): Ditto.
3985         (webkitWebViewBaseExitAcceleratedCompositingMode): Ditto.
3986         (webkitWebViewBaseMakeGLContextCurrent): Ditto.
3987         (webkitWebViewBaseDidRelaunchWebProcess): Remove the code for !USE(REDIRECTED_XCOMPOSITE_WINDOW).
3988         (webkitWebViewBasePageClosed): Ditto.
3989         (webkitWebViewBaseRenderHostFileDescriptor): acceleratedBackingStore member can't be nullptr now.
3990         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
3991         (WebKit::DrawingAreaProxyCoordinatedGraphics::didUpdateBackingStoreState): Remove the code for !USE(REDIRECTED_XCOMPOSITE_WINDOW).
3992         (WebKit::DrawingAreaProxyCoordinatedGraphics::setNativeSurfaceHandleForCompositing): Deleted.
3993         (WebKit::DrawingAreaProxyCoordinatedGraphics::destroyNativeSurfaceHandleForCompositing): Deleted.
3994         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h:
3995         * UIProcess/gtk/AcceleratedBackingStore.cpp:
3996         (WebKit::AcceleratedBackingStore::create): Add an assert to ensure we create an AcceleratedBackingStore.
3997         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
3998         * UIProcess/gtk/AcceleratedBackingStoreX11.h:
3999         * UIProcess/gtk/HardwareAccelerationManager.cpp:
4000         (WebKit::HardwareAccelerationManager::HardwareAccelerationManager): Remove the code for !USE(REDIRECTED_XCOMPOSITE_WINDOW).
4001         * WebProcess/WebPage/AcceleratedSurface.cpp:
4002         (WebKit::AcceleratedSurface::create): Add an assert to ensure we create an AcceleratedSurface.
4003         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
4004         (WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode): Remove the code for !USE(REDIRECTED_XCOMPOSITE_WINDOW).
4005         (WebKit::DrawingAreaCoordinatedGraphics::setNativeSurfaceHandleForCompositing): Deleted.
4006         (WebKit::DrawingAreaCoordinatedGraphics::destroyNativeSurfaceHandleForCompositing): Deleted.
4007         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h:
4008         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
4009         (WebKit::LayerTreeHost::LayerTreeHost): m_surface can't be nullptr now.
4010         (WebKit::LayerTreeHost::sizeDidChange): Ditto.
4011         (WebKit::LayerTreeHost::deviceOrPageScaleFactorChanged): Ditto.
4012         (WebKit::LayerTreeHost::nativeSurfaceHandleForCompositing): Ditto.
4