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