d17109102477040f8f4ba13698e9226e561f1932
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-07-20  Chris Dumez  <cdumez@apple.com>
2
3         Micro-optimize HashMap & String IPC decoding
4         https://bugs.webkit.org/show_bug.cgi?id=199967
5
6         Reviewed by Geoffrey Garen.
7
8         The legacy HashMap decoder (returning a boolean) was failing to WTFMove()
9         the key & value when calling HashMap::add(). The modern decoder (returning
10         an Optional) was properly using WTFMove(). Rewrite the legacy HashMap decoder
11         to call the modern one to reduce code duplication and to get this optimization.
12
13         Also, encode HashMap::size() as a uint32_t instead of a uint64_t since
14         HashMap::size() returns an 'unsigned int' type. Finally, update the modern
15         decoder to WTFMove(hashMap) when returning. Because the function returns an
16         Optional<HashMap> and not a HashMap, I do not believe we get return value
17         optimization (RVO).
18
19         Do similar changes to String IPC coders.
20
21         * Platform/IPC/ArgumentCoders.cpp:
22         (IPC::decodeStringText):
23         (IPC::ArgumentCoder<String>::decode):
24         * Platform/IPC/ArgumentCoders.h:
25
26 2019-07-20  Alexander Mikhaylenko  <exalm7659@gmail.com>
27
28         REGRESSION(r246033/r246496): [GTK] Kinetic scrolling doesn't work
29         https://bugs.webkit.org/show_bug.cgi?id=199322
30
31         Reviewed by Michael Catanzaro.
32
33         Check ENABLE(KINETIC_SCROLLING) instead of ENABLE(ASYNC_SCROLLING) when setting wheel event phase and momentum phase.
34
35         * Shared/WebEventConversion.cpp:
36         (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
37
38 2019-07-20  Zalan Bujtas  <zalan@apple.com>
39
40         [Text autosizing] Do not nuke the style on dynamicViewportSizeUpdate
41         https://bugs.webkit.org/show_bug.cgi?id=199718
42         <rdar://problem/53344961>
43
44         Reviewed by Simon Fraser.
45
46         * WebProcess/WebPage/WebPage.cpp:
47         (WebKit::m_textAutoSizingAdjustmentTimer):
48         (WebKit::WebPage::close):
49         (WebKit::WebPage::didCommitLoad):
50         (WebKit::WebPage::textAutoSizingAdjustmentTimerFired):
51         (WebKit::m_shrinkToFitContentTimer): Deleted.
52         * WebProcess/WebPage/WebPage.h:
53         * WebProcess/WebPage/ios/WebPageIOS.mm:
54         (WebKit::WebPage::dynamicViewportSizeUpdate):
55         (WebKit::WebPage::resetIdempotentTextAutosizingIfNeeded):
56         (WebKit::WebPage::resetTextAutosizing):
57         (WebKit::WebPage::viewportConfigurationChanged):
58
59 2019-07-19  Youenn Fablet  <youenn@apple.com>
60
61         Remote WebInspector should enable mock capture devices in UIProcess if doing it in WebProcess
62         https://bugs.webkit.org/show_bug.cgi?id=199924
63         <rdar://problem/50552067>
64
65         Reviewed by Devin Rousso.
66
67         Add IPC plumbery to pass inspector override value for mock capture devices.
68         Add an override in UserMediaPermissionRequestManagerProxy so that the value stays in sync with web inspector.
69         The override will be removed when web inspector goes away.
70
71         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
72         (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs const):
73         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
74         (WebKit::UserMediaPermissionRequestManagerProxy::setMockCaptureDevicesEnabledOverride):
75         * UIProcess/WebInspectorProxy.cpp:
76         (WebKit::WebInspectorProxy::setMockCaptureDevicesEnabled):
77         * UIProcess/WebInspectorProxy.h:
78         * UIProcess/WebInspectorProxy.messages.in:
79         * UIProcess/WebPageProxy.cpp:
80         (WebKit::WebPageProxy::setMockCaptureDevicesEnabledOverride):
81         * UIProcess/WebPageProxy.h:
82         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
83         (WebKit::WebInspectorClient::setMockCaptureDevicesEnabled):
84         * WebProcess/WebCoreSupport/WebInspectorClient.h:
85         * WebProcess/WebPage/WebInspector.cpp:
86         (WebKit::WebInspector::setMockCaptureDevicesEnabled):
87         * WebProcess/WebPage/WebInspector.h:
88
89 2019-07-19  Tim Horton  <timothy_horton@apple.com>
90
91         Web Content process gets stuck suspended after navigating away from a system preview
92         https://bugs.webkit.org/show_bug.cgi?id=199965
93         <rdar://problem/53109004>
94
95         Reviewed by Dean Jackson.
96
97         * UIProcess/API/Cocoa/WKWebView.mm:
98         (-[WKWebView _isBackground]):
99         * UIProcess/ios/WKSystemPreviewView.h:
100         * UIProcess/ios/WKSystemPreviewView.mm:
101         (-[WKSystemPreviewView web_initWithFrame:webView:mimeType:]):
102         (-[WKSystemPreviewView web_isBackground]):
103         Apply the fix from r193481 to WKSystemPreviewView as well, having it
104         become a WKApplicationStateTrackingView and plumbing that through
105         to our is-background machinery.
106
107         We really, really should instead have WKWebView itself be the application
108         state tracking view, but that is a bigger change (and has some implications
109         for full-screen video and whatnot).
110
111 2019-07-19  Dean Jackson  <dino@apple.com>
112
113         Provide correct names for UIContextMenuInteraction API replacements
114         https://bugs.webkit.org/show_bug.cgi?id=199966
115
116         Reviewed by Tim Horton.
117
118         We had some old incorrect names for replacements to SPI. While
119         here, I reordered and expanded the documentation for the new API.
120
121         * UIProcess/API/Cocoa/WKUIDelegate.h:
122         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
123
124 2019-07-19  Daniel Bates  <dabates@apple.com>
125
126         [iOS] REGRESSION (r241734): Autocorrection highlight should hide when field becomes defocused
127         https://bugs.webkit.org/show_bug.cgi?id=199807
128         <rdar://problem/52760259>
129
130         Reviewed by Wenson Hsieh.
131
132         Sometimes the correction highlight may not hide when defocusing an editable field.
133         This occurs only when a person pressed a key in a non-editable element beforehand.
134         We need to reset some state to force a re-computation of whether a keyboard is still
135         needed whenever an element is defocused (blurred in web paralance).
136
137         Following r241734 both editable and non-editable key events are handled using the same
138         code path. This is accomplished by having WKContentView's -_requiresKeyboardWhenFirstResponder
139         return YES to tell UIKit it needs a keyboard even when there is no editable element focused.
140         As a result UIKit retains all the keyboard state, including keeping the correction highlight
141         visible. Prior to r241734 WKContentView's -_requiresKeyboardWhenFirstResponder would not return
142         YES when a non-editable element was focused and hence UIKit would tear down the keyboard
143         and its state, including the correction highlight. In r245154, we made keyboard instantiate
144         for a focused non-editable element lazy as a performance optimization. Although r245154
145         kept the r241734 behavior (just made it lazy) it re-wrote the code in such a way that we
146         can utilize it as a hook to fix this bug. In particular, we now clear the bit about a
147         seen keydown in a non-editable element whenever we are defocusing an editable element
148         before we reload the input views, as part of hiding the keyboard. On the reload, UIKit
149         will call -_requiresKeyboardWhenFirstResponder, WebKit will respond with NO now that
150         a non-editable element is focused and hence UIKit will do what it did pre r241734: tear
151         down the keyboard.
152
153         * UIProcess/ios/WKContentViewInteraction.mm:
154         (-[WKContentView _didCommitLoadForMainFrame]): Clear the bit about a seen keydown here
155         so that we don't keep the keyboard around on a new page commit. This includes the case
156         when the same page is reloaded. There is not much advantage to keeping the keyboard
157         around across reloads and not doing so will reduce our memory footprint. 
158         (-[WKContentView _elementDidBlur]): Clear the same bit as well when defocusing an
159         editable element. This will cause UIKit to tear down the keyboard on reload removing
160         the correction highlight.
161
162 2019-07-19  Dean Jackson  <dino@apple.com>
163
164         Add a menu item to toggle between showing and hiding link previews
165         https://bugs.webkit.org/show_bug.cgi?id=199940
166         <rdar://problem/53032288>
167
168         Reviewed by Beth Dakin.
169
170         Add a new _WKElementAction that toggles the display of link previews
171         in context menus, and add it to the default set of actions we provide
172         for links.
173
174         When a UIAction is created from this new _WKElementAction type,
175         it can be identified by WKElementActionTypeToggleShowLinkPreviewsIdentifier.
176         This allows us to check a UIMenu provided by a delegate to make sure
177         that they have provided the toggle menu item. If they haven't, we add it
178         back.
179
180         The preference for showing links is moved from kCFPreferencesAnyApplication
181         to standard user defaults, so that it can be set no matter what the
182         hosting application is.
183
184         * UIProcess/API/Cocoa/_WKElementAction.h: New action type.
185         * UIProcess/API/Cocoa/_WKElementAction.mm: 
186         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
187         (+[_WKElementAction imageForElementActionType:]): Use eye.fill for now.
188         I'll need to check with HI to see if there is a more appropriate glyph.
189         (elementActionTypeToUIActionIdentifier):
190         (uiActionIdentifierToElementActionType):
191
192         * UIProcess/ios/WKActionSheetAssistant.mm: Add the toggle action to
193         the default set.
194         (-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
195
196         * UIProcess/ios/WKContentViewInteraction.mm:
197         (-[WKContentView _registerPreview]): No need to listen for CFPreferences
198         notifications any more.
199         (-[WKContentView _unregisterPreview]):
200         (menuWithShowLinkPreviewAction): New method that adds the UIAction
201         for toggling previews to a UIMenu if necessary.
202         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
203         (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]):
204         (-[WKContentView _showLinkPreviewsPreferenceChanged:]): Deleted.
205         (titleForMenu): Deleted. URL text previews will be provided separately.
206
207 2019-07-19  Wenson Hsieh  <wenson_hsieh@apple.com>
208
209         [iOS] Entering 2FA code on idmsa.apple.com causes unexpected scrolling
210         https://bugs.webkit.org/show_bug.cgi?id=199949
211         <rdar://problem/49944428>
212
213         Reviewed by Tim Horton and Megan Gardner.
214
215         Since at least iOS 11, -[UIScrollView _adjustForAutomaticKeyboardInfo:animated:lastAdjustment:] adjusts the
216         scroll view's content offset to account for updated keyboard bottom insets. In WebKit, we call this method
217         whenever keyboard geometry changes (based on system notifications, such as UIKeyboardWillHideNotification).
218
219         When switching between focused form fields, we hide the keyboard for the previous focused element prior to
220         showing the keyboard for the newly focused element. This means that we will actually dismiss the keyboard in the
221         process of changing the focused element, which posts keyboard geometry notifications, which causes us to scroll
222         WKScrollView.
223
224         On iOS 12, this would be immediately followed by re-presenting the keyboard for the new focused element, which
225         causes us to adjust the scroll view back to its original position right away; this means that the scrolling that
226         happens as a result of adjusting for the keyboard insets after dismissal doesn't result in any visible change.
227
228         However, on iOS 13, after r239441 and r244546, we now defer scrolling and zooming to reveal the focused element
229         until later; this means the scrolling that happens as a result of initially dismissing the keyboard now causes a
230         consistent jump in the scroll view's scroll position (whereas on iOS 12, this only happens rarely, and the jump
231         is also less noticeable).
232
233         To mitigate this, we detect the case where we're moving focus from one element to another; if we're about to
234         show a keyboard for the newly focused element, then we should avoid scrolling as a result of the impending
235         "keyboard will hide" notification.
236
237         Test: fast/forms/ios/no-scrolling-when-moving-focus-between-adjacent-fields.html
238
239         * UIProcess/API/Cocoa/WKWebView.mm:
240         (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
241         (-[WKWebView _keyboardWillHide:]):
242         * UIProcess/ios/WKContentViewInteraction.h:
243         * UIProcess/ios/WKContentViewInteraction.mm:
244         (shouldShowKeyboardForElement):
245
246         Add a helper to determine whether we're focusing an element which presents a "keyboard" (i.e. a UIKit input
247         view, as opposed to modal select pickers, modal date pickers, or fields with inputmode="none", for which we
248         don't show an input view).
249
250         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
251         (-[WKContentView shouldIgnoreKeyboardWillHideNotification]):
252
253 2019-07-18  Alex Christensen  <achristensen@webkit.org>
254
255         Fix warning when importing WebKit in Swift
256         https://bugs.webkit.org/show_bug.cgi?id=199914
257         <rdar://problem/52854930>
258
259         Reviewed by Wenson Hsieh.
260
261         * UIProcess/API/Cocoa/NSAttributedString.h:
262         Declare NSAttributedString and update a swift name.
263         This fix was proposed by Argyrios Kyrtzidis.
264
265 2019-07-18  Alex Christensen  <achristensen@webkit.org>
266
267         Add and test _WKWebsiteDataStoreConfiguration.deviceIdHashSaltsStorageDirectory SPI
268         https://bugs.webkit.org/show_bug.cgi?id=199923
269
270         Reviewed by Youenn Fablet.
271
272         This is a step towards us getting rid of WebsiteDataStore::legacyDefaultDataStoreConfiguration
273
274         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
275         (-[WKWebsiteDataStore _initWithConfiguration:]):
276         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
277         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
278         (-[_WKWebsiteDataStoreConfiguration deviceIdHashSaltsStorageDirectory]):
279         (-[_WKWebsiteDataStoreConfiguration setDeviceIdHashSaltsStorageDirectory:]):
280
281 2019-07-18  Alex Christensen  <achristensen@webkit.org>
282
283         Move NetworkCache ownership from NetworkProcess to NetworkSession
284         https://bugs.webkit.org/show_bug.cgi?id=199817
285
286         Reviewed by Geoff Garen.
287
288         I also added SPI to set the path of the NetworkCache with an API test.
289         If this new SPI is not used, it falls back to getting the cache location from the NetworkProcess to maintain compatibility.
290         We still get options, cache size, and cache model from the NetworkProcess.  Those should be migrated with new SPI later.
291         Clearing the cache and other operations now iterate the NetworkSessions instead of assuming there is only one cache.
292
293         * NetworkProcess/NetworkProcess.cpp:
294         (WebKit::NetworkProcess::fetchWebsiteData):
295         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
296         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
297         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
298         (WebKit::NetworkProcess::setCacheModel):
299         * NetworkProcess/NetworkProcess.h:
300         (WebKit::NetworkProcess::diskCacheDirectory const):
301         (WebKit::NetworkProcess::cacheOptions const):
302         (WebKit::NetworkProcess::cache): Deleted.
303         * NetworkProcess/NetworkResourceLoader.cpp:
304         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
305         * NetworkProcess/NetworkSession.cpp:
306         (WebKit::NetworkSession::NetworkSession):
307         * NetworkProcess/NetworkSession.h:
308         (WebKit::NetworkSession::cache):
309         * NetworkProcess/NetworkSessionCreationParameters.cpp:
310         (WebKit::NetworkSessionCreationParameters::encode const):
311         (WebKit::NetworkSessionCreationParameters::decode):
312         * NetworkProcess/NetworkSessionCreationParameters.h:
313         * NetworkProcess/cache/NetworkCache.cpp:
314         (WebKit::NetworkCache::Cache::open):
315         (WebKit::NetworkCache::Cache::Cache):
316         * NetworkProcess/cache/NetworkCache.h:
317         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
318         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
319         (WebKit::NetworkProcess::clearDiskCache):
320         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
321         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
322         * NetworkProcess/curl/NetworkSessionCurl.cpp:
323         (WebKit::NetworkSessionCurl::NetworkSessionCurl):
324         * NetworkProcess/soup/NetworkSessionSoup.cpp:
325         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
326         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
327         (-[WKWebsiteDataStore _initWithConfiguration:]):
328         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
329         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
330         (-[_WKWebsiteDataStoreConfiguration networkCacheDirectory]):
331         (-[_WKWebsiteDataStoreConfiguration setNetworkCacheDirectory:]):
332         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
333         (WebKit::WebsiteDataStore::parameters):
334         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
335         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
336         * UIProcess/WebsiteData/WebsiteDataStore.h:
337         (WebKit::WebsiteDataStore::resolvedNetworkCacheDirectory const):
338
339 2019-07-18  Chris Dumez  <cdumez@apple.com>
340
341         Regression(r247486) Multiple Layout Tests in http/tests/cache/* are crashing on iOS Debug WK2
342         https://bugs.webkit.org/show_bug.cgi?id=199892
343         <rdar://problem/53230217>
344
345         Reviewed by Geoffrey Garen.
346
347         The StorageManager was unregistering itself as a WorkQueueMessageReceiver on a given IPC
348         connection too early. As a result, we would sometimes receive a 'StorageManager:DestroyStorageMap'
349         IPC in NetworkConnectionToWebProcess::didReceiveMessage() with nobody to process it, which would
350         trigger an assertion. To address the issue, we stop unregistering the StorageManager as a
351         WorkQueueMessageReceiver inside removeAllowedSessionStorageNamespaceConnection(). Instead, we
352         let the logic inside processDidCloseConnection() take care of it once the connection closes.
353
354         * NetworkProcess/WebStorage/StorageManager.cpp:
355         (WebKit::StorageManager::removeAllowedSessionStorageNamespaceConnection):
356         (WebKit::StorageManager::processDidCloseConnection):
357         * NetworkProcess/WebStorage/StorageManager.h:
358
359 2019-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
360
361         [GTK] Crash in webkitWebViewBaseRenderHostFileDescriptor
362         https://bugs.webkit.org/show_bug.cgi?id=199402
363
364         Reviewed by Michael Catanzaro.
365
366         There are two problems here:
367
368          - We need to ensure that the checks we do in HardwareAccelerationManager to disable AC mode are the same
369            as the ones done in AcceleratedBackingStore create() methods. This is not the case for WPE renderer.
370          - Some of the places where accelerateBackingStore is used, can be called even if AC mode is disabled, so we
371            need to null-check there before using the backing store.
372
373         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
374         (webkitWebViewBaseDraw): Add an assert to ensure accelerateBackingStore is not nullptr here.
375         (webkitWebViewBaseEnterAcceleratedCompositingMode): Ditto.
376         (webkitWebViewBaseUpdateAcceleratedCompositingMode): Ditto.
377         (webkitWebViewBaseExitAcceleratedCompositingMode): Ditto.
378         (webkitWebViewBaseMakeGLContextCurrent): Ditto.
379         (webkitWebViewBaseDidRelaunchWebProcess): Null-check accelerateBackingStore before using it.
380         (webkitWebViewBasePageClosed): Ditto.
381         (webkitWebViewBaseRenderHostFileDescriptor): Ditto.
382         * UIProcess/gtk/AcceleratedBackingStore.cpp:
383         (WebKit::AcceleratedBackingStore::checkRequirements): Call AcceleratedBackingStoreWayland::checkRequirements()
384         or AcceleratedBackingStoreX11::checkRequirements() depending on the current display.
385         (WebKit::AcceleratedBackingStore::create): Return early if AC mode is disabled in HardwareAccelerationManager.
386         * UIProcess/gtk/AcceleratedBackingStore.h:
387         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
388         (WebKit::AcceleratedBackingStoreWayland::checkRequirements): Check requirements for hardware acceleration in Wayland.
389         (WebKit::AcceleratedBackingStoreWayland::create): Assert that requirements are present.
390         * UIProcess/gtk/AcceleratedBackingStoreWayland.h:
391         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
392         (WebKit::AcceleratedBackingStoreX11::checkRequirements): Check requirements for hardware acceleration in X11.
393         (WebKit::AcceleratedBackingStoreX11::create): Assert that requirements are present.
394         * UIProcess/gtk/AcceleratedBackingStoreX11.h:
395         * UIProcess/gtk/HardwareAccelerationManager.cpp:
396         (WebKit::HardwareAccelerationManager::HardwareAccelerationManager): Use
397         AcceleratedBackingStore::checkRequirements() to decide whether to disable AC mode.
398
399 2019-07-17  Megan Gardner  <megan_gardner@apple.com>
400
401         Early Out of positionInfomation check if possible
402         https://bugs.webkit.org/show_bug.cgi?id=199885
403         <rdar://problem/53229413>
404
405         This is an early-out check that happens after most of the work is done.
406         Move it to happen before we make all these calls, if in the end, we will not use the information.
407
408         Reviewed by Tim Horton.
409
410         * UIProcess/ios/WKContentViewInteraction.mm:
411         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
412
413 2019-07-17  Chris Dumez  <cdumez@apple.com>
414
415         Unreviewed, add debug logging to help diagnose flaky crashes on the bots.
416
417         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
418         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
419
420 2019-07-17  Tim Horton  <timothy_horton@apple.com>
421
422         [macCatalyst] Unable to interact with YouTube video while it's playing
423         https://bugs.webkit.org/show_bug.cgi?id=199893
424         <rdar://problem/51871151>
425
426         Reviewed by Simon Fraser.
427
428         * Platform/spi/ios/UIKitSPI.h:
429         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
430         (-[WKRemoteView initWithFrame:contextID:]):
431         (-[WKUIRemoteView initWithFrame:pid:contextID:]):
432         Disable remote context hit-testing for WKUIRemoteView just like we
433         already do for WKRemoteView.
434
435 2019-07-17  Chris Dumez  <cdumez@apple.com>
436
437         Prewarm local storage in the NetworkProcess to reduce WebContent process hangs
438         https://bugs.webkit.org/show_bug.cgi?id=199879
439         <rdar://problem/53217757>
440
441         Reviewed by Ryosuke Niwa.
442
443         * NetworkProcess/WebStorage/StorageManager.cpp:
444         (WebKit::StorageManager::prewarm):
445         (WebKit::StorageManager::getValues):
446         * NetworkProcess/WebStorage/StorageManager.h:
447         * NetworkProcess/WebStorage/StorageManager.messages.in:
448         * WebProcess/WebStorage/StorageAreaImpl.cpp:
449         (WebKit::StorageAreaImpl::prewarm):
450         * WebProcess/WebStorage/StorageAreaImpl.h:
451         * WebProcess/WebStorage/StorageAreaMap.cpp:
452         (WebKit::StorageAreaMap::loadValuesIfNeeded):
453         (WebKit::StorageAreaMap::prewarm):
454         * WebProcess/WebStorage/StorageAreaMap.h:
455
456 2019-07-19  Simon Fraser  <simon.fraser@apple.com>
457
458         [iOS WK2] Allow scrolling interaction on frames and oveflow scroll even when the main frame is rubber-banding
459         https://bugs.webkit.org/show_bug.cgi?id=199963
460         rdar://problem/52897797
461
462         Reviewed by Tim Horton.
463
464         Adopt UIKit SPI to allow for scrolling of inner UIScrollViews when the outer one is still rubber-banding.
465
466         * Platform/spi/ios/UIKitSPI.h:
467         * UIProcess/API/Cocoa/WKWebView.mm:
468         (-[WKWebView _initializeWithConfiguration:]):
469         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
470         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
471
472 2019-07-17  Megan Gardner  <megan_gardner@apple.com>
473
474         Set WordIsNearTap flag, was not being set at all before
475         https://bugs.webkit.org/show_bug.cgi?id=199880
476
477         Reviewed by Wenson Hsieh.
478
479         * WebProcess/WebPage/ios/WebPageIOS.mm:
480         (WebKit::WebPage::selectWithGesture):
481
482 2019-07-17  Jiewen Tan  <jiewen_tan@apple.com>
483
484         Provide a NSURL cateogry to tell AppSSO Kerberos URLs
485         https://bugs.webkit.org/show_bug.cgi?id=199887
486         <rdar://problem/52323161>
487
488         Reviewed by Brent Fulgham.
489
490         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.h:
491         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.mm:
492         (+[NSURL _web_willPerformSOKerberosAuthorizationWithURL:]):
493
494 2019-07-17  Antoine Quint  <graouts@apple.com>
495
496         Disable Pointer Events prior to watchOS 6
497         https://bugs.webkit.org/show_bug.cgi?id=199890
498         <rdar://problem/53206113>
499
500         Reviewed by Dean Jackson.
501
502         * Configurations/FeatureDefines.xcconfig:
503
504 2019-07-17  Daniel Bates  <dabates@apple.com>
505
506         Typing into a cell in a Google Sheet lags behind by one character
507         https://bugs.webkit.org/show_bug.cgi?id=199587
508         <rdar://problem/51616845>
509
510         Reviewed by Brent Fulgham.
511
512         Remove all timers from the holding tank on text insertion or deletion (represented as an
513         editing command). Timers that were in the holding tank never stopped ticking and will now
514         be able to execute their action.
515
516         * WebProcess/WebPage/WebPage.cpp:
517         (WebKit::WebPage::executeEditingCommand):
518         (WebKit::WebPage::insertTextAsync):
519         (WebKit::WebPage::setCompositionAsync):
520         (WebKit::WebPage::confirmCompositionAsync):
521         Call platformWillPerformEditingCommand().
522
523         * WebProcess/WebPage/WebPage.h:
524         (WebKit::WebPage::platformWillPerformEditingCommand): Added.
525         * WebProcess/WebPage/ios/WebPageIOS.mm:
526         (WebKit::WebPage::platformWillPerformEditingCommand): Remove all the timers from the holding
527         tank if we have a holding tank.
528
529 2019-07-17  Darin Adler  <darin@apple.com>
530
531         No need for isURLAllowed function in Frame
532         https://bugs.webkit.org/show_bug.cgi?id=120266
533
534         Reviewed by Alex Christensen.
535
536         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
537         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
538         Use is<HTMLFrameElementBase> instead of isFrameElementBase.
539
540 2019-07-17  Alex Christensen  <achristensen@webkit.org>
541
542         Add a runtime-disabled dialog element skeleton
543         https://bugs.webkit.org/show_bug.cgi?id=199839
544
545         Reviewed by Ryosuke Niwa.
546
547         * Shared/WebPreferences.yaml:
548         * UIProcess/API/C/WKPreferences.cpp:
549         (WKPreferencesSetDialogElementEnabled):
550         (WKPreferencesGetDialogElementEnabled):
551         * UIProcess/API/C/WKPreferencesRefPrivate.h:
552         Add SPI to enable the dialog element for tests.
553
554 2019-07-17  Ryosuke Niwa  <rniwa@webkit.org>
555
556         [iOS] Option + Up or Down Arrow key doesn’t move cursor past paragraph boundaries in WebKit2
557         https://bugs.webkit.org/show_bug.cgi?id=199851
558
559         Reviewed by Wenson Hsieh.
560
561         The bug was caused by the difference in the way AppKit and UIKit responds to Option + Up / Down.
562
563         On macOS, AppKit sends moveForward before sending moveToStartOfParagraph and moveBackward
564         before sending moveToEndOfParagraph. As a result, when Option + Down is pressed when we are at
565         the end of a line, we would first move to the beginning of the next line (i.e. after the line break)
566         before moving or extending selection with the paragraph boundary granurality.
567
568         On iOS, UIKit only calls _moveToStartOfParagraph without moving forward by a character. As a result,
569         moving forward by the paragraph boundary granurality immediately stops when we're starting at the
570         end of a line when Option + Down is pressed. Option + Up case is similar.
571
572         Fix the bug on iOS by emulating what happens on macOS. Namely, move the selection forward or backward
573         by the character granurality before moving by the paragraph boundary granurality.
574
575         * UIProcess/ios/WKContentViewInteraction.mm:
576         (-[WKContentView _moveToStartOfParagraph:withHistory:]):
577         (-[WKContentView _moveToEndOfParagraph:withHistory:]):
578
579 2019-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
580
581         Unreviewed. Fix GTK and WPE debug build after r247508
582
583         * UIProcess/API/glib/WebKitWebResource.cpp:
584         (webkitWebResourceCreate): Remove invalid assert.
585
586 2019-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
587
588         [WPE][GTK] UI process crash due to NULL dereference in webkitWebViewResourceLoadStarted()
589         https://bugs.webkit.org/show_bug.cgi?id=199621
590
591         Reviewed by Michael Catanzaro.
592
593         Null-check frame received in injected bundle message to ensure the frame hasn't been destroyed.
594
595         * UIProcess/API/glib/WebKitInjectedBundleClient.cpp:
596         * UIProcess/API/glib/WebKitWebResource.cpp:
597         (webkitWebResourceCreate): Receive a reference to the frame instead of a pointer.
598         * UIProcess/API/glib/WebKitWebResourcePrivate.h:
599         * UIProcess/API/glib/WebKitWebView.cpp:
600         (webkitWebViewResourceLoadStarted): Ditto.
601         * UIProcess/API/glib/WebKitWebViewPrivate.h:
602
603 2019-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
604
605         [GTK][WPE] Do not assert when receiving invalid data in injected bundle messages
606         https://bugs.webkit.org/show_bug.cgi?id=199830
607
608         Reviewed by Michael Catanzaro.
609
610         Just silently ignore them to avoid UI process crashes.
611
612         * UIProcess/API/glib/WebKitInjectedBundleClient.cpp:
613
614 2019-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
615
616         [GTK] No web view updates after swapping web process if AC mode is forced
617         https://bugs.webkit.org/show_bug.cgi?id=199826
618
619         Reviewed by Michael Catanzaro.
620
621         This is because when AC mode is forced the provisional page creates a drawing area that is always in AC
622         mode. When swapping processes, the current drawing area is destroyed (which exists AC mode) and the provisional
623         one is set. From that point the web process is in AC mode but the UI process isn't. We need to update the
624         compositing mode when swapping processes.
625
626         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
627         (webkitWebViewBaseDidExitWebProcess):
628         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h:
629
630 2019-07-16  Antoine Quint  <graouts@apple.com>
631
632         REGRESSION: fast/events/watchos/double-tap-to-zoom* tests crashing in com.apple.WebKit: -[WKContentView(WKInteraction) _singleTapDidReset:]
633         https://bugs.webkit.org/show_bug.cgi?id=199840
634         <rdar://problem/52856531>
635
636         Reviewed by Wenson Hsieh.
637
638         We need to ensure the NSNumber used for -[WKSyntheticTapGestureRecognizer lastActiveTouchIdentifier] is retained. This innocent change required
639         the use of RetainPtr<>, which required the move to an Objective-C++ file, which lead to a change in the order files are unified, which lead to
640         build errors, which leads to a much bigger patch than just the source change necessary to fix the crash.
641
642         * SourcesCocoa.txt:
643         * UIProcess/ios/WKSyntheticTapGestureRecognizer.mm: Renamed from Source/WebKit/UIProcess/ios/WKSyntheticTapGestureRecognizer.m.
644         * UIProcess/ios/forms/WKFormPeripheralBase.h:
645         * UIProcess/ios/forms/WKFormPeripheralBase.mm:
646         * WebKit.xcodeproj/project.pbxproj:
647
648 2019-07-16  Brent Fulgham  <bfulgham@apple.com>
649
650         Update WebContent Process sandbox based on user seed data
651         https://bugs.webkit.org/show_bug.cgi?id=199799
652         <rdar://problem/52903477>
653
654         Reviewed by Alexey Proskuryakov.
655
656         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
657
658 2019-07-16  Andy Estes  <aestes@apple.com>
659
660         [macCatalyst] Do not include WebKitLegacy.h in WebKit.h
661         https://bugs.webkit.org/show_bug.cgi?id=199833
662         <rdar://problem/53036744>
663
664         Reviewed by Tim Horton.
665
666         * Shared/API/Cocoa/WebKit.h:
667
668 2019-07-16  Frederic Wang  <fwang@igalia.com>
669
670         Fix build warning because of missing super_class initializer
671         https://bugs.webkit.org/show_bug.cgi?id=199825
672
673         Reviewed by Jonathan Bedard.
674
675         * UIProcess/ios/WKContentView.mm:
676         (keyCommandsPlaceholderHackForEvernote):
677
678 2019-07-16  Tim Horton  <timothy_horton@apple.com>
679
680         NSTextFinder holes don't scroll with the page
681         https://bugs.webkit.org/show_bug.cgi?id=199815
682         <rdar://problem/52280514>
683
684         Reviewed by Simon Fraser.
685
686         * UIProcess/API/Cocoa/WKWebView.mm:
687         (-[WKWebView _usePlatformFindUI]):
688         (-[WKWebView _setUsePlatformFindUI:]):
689         (-[WKWebView _ensureTextFinderClient]):
690         Add a bit so that clients can choose whether they want our find UI,
691         which respects scrolling, or the system find UI, which works when
692         doing multi-document searches. Right now you can't have both.
693
694         (-[WKWebView scrollFindMatchToVisible:]):
695         Implement and plumb scrollFindMatchToVisible.
696
697         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
698         * UIProcess/WebPageProxy.cpp:
699         (WebKit::WebPageProxy::indicateFindMatch):
700         * UIProcess/WebPageProxy.h:
701         * WebProcess/WebPage/WebPage.cpp:
702         (WebKit::WebPage::indicateFindMatch):
703         * WebProcess/WebPage/WebPage.h:
704         * WebProcess/WebPage/WebPage.messages.in:
705         Plumb indicateFindMatch to FindController.
706
707         * UIProcess/mac/WKTextFinderClient.h:
708         * UIProcess/mac/WKTextFinderClient.mm:
709         (-[WKTextFinderClient initWithPage:view:usePlatformFindUI:]):
710         Store whether or not we are using the platform find UI.
711
712         (-[WKTextFinderClient findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:]):
713         If using WebKit find UI, turn on our UI in the options passed to findString[Matches].
714
715         (-[WKTextFinderClient scrollFindMatchToVisible:]):
716         If using WebKit find UI, when the platform tells us to reveal a find match, indicate it.
717
718         (-[WKTextFinderClient didFindStringMatchesWithRects:didWrapAround:]):
719         If using WebKit find UI, lie to the platform and return no rects so that it doesn't paint a yellow rectangle.
720
721         (-[WKTextFinderClient getImageForMatchResult:completionHandler:]):
722         If using WebKit find UI, lie to the platform and return no image so that it doesn't paint a yellow rectangle.
723
724         (-[WKTextFinderClient initWithPage:view:]): Deleted.
725
726         * WebProcess/WebPage/FindController.cpp:
727         (WebKit::FindController::updateFindUIAfterPageScroll):
728         Make it possible to use our find UI with 'findStringMatches'; since the platform
729         find infrastrucutre depends on knowing about all matches up front, we need
730         to use 'findStringMatches' instead of 'findString', but we had never combined
731         that with our UI. Don't throw away the other matches when we indicate one, and
732         don't send DidFindString in the case we are coming from 'findStringMatches'.
733         This all needs a bit of cleanup in the future.
734
735         (WebKit::FindController::findString):
736         Tell updateFindUIAfterPageScroll that we are 'findString' so that it uses its normal behavior.
737
738         (WebKit::FindController::findStringMatches):
739         Tell updateFindUIAfterPageScroll that we are 'findStringMatches' so that it uses the adjusted behavior.
740
741         (WebKit::FindController::indicateFindMatch):
742         Add 'indicateFindMatch', which both selects the match and moves the indicator there.
743
744         * WebProcess/WebPage/FindController.h:
745
746 2019-07-16  Chris Dumez  <cdumez@apple.com>
747
748         Speed up StorageManager::getValues()
749         https://bugs.webkit.org/show_bug.cgi?id=199812
750
751         Reviewed by Alex Christensen.
752
753         Made the following performance improvements:
754         - Made StorageManager a WorkQueueMessageReceiver again (like it was before it
755           got moved from the UIProcess to the Network process). This avoids a lot of
756           thread hopping (IPC thread -> Main thread -> StorageManagerThread -> Main Thread)
757           and a lot of isolatedCopying of the strings.
758         - Move values around when possible to avoid copying.
759         - Add fast path to StorageMap::importItems() for when the StorageMap is
760           empty when importing (15ms -> 2.5ms).
761
762         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
763         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
764         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage):
765         * NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
766         (WebKit::LocalStorageDatabase::importItems):
767         * NetworkProcess/WebStorage/StorageManager.cpp:
768         (WebKit::StorageManager::addAllowedSessionStorageNamespaceConnection):
769         (WebKit::StorageManager::removeAllowedSessionStorageNamespaceConnection):
770         (WebKit::StorageManager::processDidCloseConnection):
771         (WebKit::StorageManager::createLocalStorageMap):
772         (WebKit::StorageManager::createTransientLocalStorageMap):
773         (WebKit::StorageManager::createSessionStorageMap):
774         (WebKit::StorageManager::destroyStorageMap):
775         (WebKit::StorageManager::getValues):
776         (WebKit::StorageManager::setItem):
777         (WebKit::StorageManager::setItems):
778         (WebKit::StorageManager::removeItem):
779         (WebKit::StorageManager::clear):
780         * NetworkProcess/WebStorage/StorageManager.h:
781
782         * Platform/IPC/Connection.cpp:
783         (IPC::Connection::addWorkQueueMessageReceiver):
784         (IPC::Connection::removeWorkQueueMessageReceiver):
785         (IPC::Connection::processIncomingMessage):
786         (IPC::Connection::dispatchMessage):
787         (IPC::Connection::dispatchMessageToWorkQueueReceiver):
788         * Platform/IPC/Connection.h:
789         * WebProcess/WebStorage/StorageAreaMap.cpp:
790         (WebKit::StorageAreaMap::loadValuesIfNeeded):
791         Messages to WorkQueueMessageReceivers are normally dispatched from the IPC WorkQueue. However, there is a race if
792         a client (here StorageManager) adds itself as a WorkQueueMessageReceiver as a result of receiving an IPC message
793         on the main thread (here NetworkConnectionToWebProcess::WebPageWasAdded).
794         The message might have already been dispatched from the IPC WorkQueue to the main thread by the time the
795         client registers itself as a WorkQueueMessageReceiver. To address this, we check again for messages receivers
796         once the message arrives on the main thread.
797
798 2019-07-16  Zalan Bujtas  <zalan@apple.com>
799
800         [ContentChangeObserver] Cancel ongoing content observation when tap is failed/cancelled
801         https://bugs.webkit.org/show_bug.cgi?id=199828
802         <rdar://problem/53152696>
803
804         Reviewed by Wenson Hsieh.
805
806         * WebProcess/WebPage/ios/WebPageIOS.mm:
807         (WebKit::WebPage::commitPotentialTapFailed):
808         (WebKit::WebPage::cancelPotentialTap):
809
810 2019-07-15  Alex Christensen  <achristensen@webkit.org>
811
812         Remove redundant WebsiteDataStoreConfiguration member
813         https://bugs.webkit.org/show_bug.cgi?id=199820
814
815         Reviewed by Geoffrey Garen.
816
817         m_webStorageDirectory was only used for _WKWebsiteDataStoreConfiguration._webStorageDirectory's backing,
818         which was copied over to m_localStorageDirectory of a new object in WKWebsiteDataStore's _initWithConfiguration.
819         This is a baby step towards cleaning up this mess with no behavior change.  I see no reason to rename the SPI.
820
821         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
822         (-[_WKWebsiteDataStoreConfiguration _webStorageDirectory]):
823         (-[_WKWebsiteDataStoreConfiguration _setWebStorageDirectory:]):
824         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
825         (WebKit::WebsiteDataStoreConfiguration::copy):
826         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
827         (WebKit::WebsiteDataStoreConfiguration::webStorageDirectory const): Deleted.
828         (WebKit::WebsiteDataStoreConfiguration::setWebStorageDirectory): Deleted.
829
830 2019-07-15  Fujii Hironori  <Hironori.Fujii@sony.com>
831
832         Make WKURLSchemeTask thread safe
833         https://bugs.webkit.org/show_bug.cgi?id=199764
834
835         Unreviewed build fix for WinCairo port.
836
837         Source\WebKit\UIProcess\socket\RemoteInspectorProtocolHandler.cpp(82): error C2039: 'request': is not a member of 'WebKit::WebURLSchemeTask'
838
839         * UIProcess/WebURLSchemeTask.h:
840         (WebKit::WebURLSchemeTask::request const): Restored WebURLSchemeTask::request with a threading assertion.
841
842 2019-07-15  Ryan Haddad  <ryanhaddad@apple.com>
843
844         Unreviewed, rolling out r247444.
845
846         Caused two scrolling tests to fail on iOS Simulator
847
848         Reverted changeset:
849
850         "Typing into a cell in a Google Sheet lags behind by one
851         character"
852         https://bugs.webkit.org/show_bug.cgi?id=199587
853         https://trac.webkit.org/changeset/247444
854
855 2019-07-15  Zalan Bujtas  <zalan@apple.com>
856
857         outlook.live.com has odd viewport with edge gap
858         https://bugs.webkit.org/show_bug.cgi?id=199822
859         <rdar://problem/53029072>
860
861         Reviewed by Wenson Hsieh.
862
863         * WebProcess/WebPage/WebPage.h:
864         * WebProcess/WebPage/ios/WebPageIOS.mm:
865         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
866         (WebKit::WebPage::dynamicViewportSizeUpdate):
867         (WebKit::WebPage::resetViewportDefaultConfiguration):
868         (WebKit::WebPage::immediatelyShrinkToFitContent):
869         (WebKit::WebPage::viewLayoutSizeAdjustedForQuirks): Deleted.
870
871 2019-07-11  Myles C. Maxfield  <mmaxfield@apple.com>
872
873         New York font erroneously gets synthetic bold
874         https://bugs.webkit.org/show_bug.cgi?id=199653
875         <rdar://problem/51692592>
876
877         Reviewed by Simon Fraser.
878
879         Add the SPI to enable the new fonts.
880
881         * Shared/WebPreferences.yaml:
882         * UIProcess/API/C/WKPreferences.cpp:
883         (WKPreferencesSetShouldAllowDesignSystemUIFonts):
884         (WKPreferencesGetShouldAllowDesignSystemUIFonts):
885         * UIProcess/API/C/WKPreferencesRefPrivate.h:
886         * UIProcess/API/Cocoa/WKPreferences.mm:
887         (-[WKPreferences _shouldAllowDesignSystemUIFonts]):
888         (-[WKPreferences _setShouldAllowDesignSystemUIFonts:]):
889         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
890
891 2019-07-15  Brady Eidson  <beidson@apple.com>
892
893         Make WKURLSchemeTask thread safe.
894         <rdar://problem/50471863> and https://bugs.webkit.org/show_bug.cgi?id=199764
895
896         Reviewed by Alex Christensen.
897
898         Punt most of the WKURLSchemeTask operations back to the main thread.
899         Make accessing the NSURLRequest be thread safe with lock protection.
900
901         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
902         (getExceptionTypeFromMainRunLoop):
903         (-[WKURLSchemeTaskImpl dealloc]):
904         (-[WKURLSchemeTaskImpl request]):
905         (-[WKURLSchemeTaskImpl _requestOnlyIfCached]):
906         (-[WKURLSchemeTaskImpl didReceiveResponse:]):
907         (-[WKURLSchemeTaskImpl didReceiveData:]):
908         (-[WKURLSchemeTaskImpl didFinish]):
909         (-[WKURLSchemeTaskImpl didFailWithError:]):
910         (-[WKURLSchemeTaskImpl _didPerformRedirection:newRequest:]):
911
912         * UIProcess/WebURLSchemeTask.cpp:
913         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
914         (WebKit::WebURLSchemeTask::~WebURLSchemeTask):
915         (WebKit::WebURLSchemeTask::didPerformRedirection):
916         (WebKit::WebURLSchemeTask::didReceiveResponse):
917         (WebKit::WebURLSchemeTask::didReceiveData):
918         (WebKit::WebURLSchemeTask::didComplete):
919         (WebKit::WebURLSchemeTask::pageDestroyed):
920         (WebKit::WebURLSchemeTask::stop):
921         (WebKit::WebURLSchemeTask::nsRequest const):
922
923         * UIProcess/WebURLSchemeTask.h:
924         (WebKit::WebURLSchemeTask::identifier const):
925         (WebKit::WebURLSchemeTask::pageID const):
926         (WebKit::WebURLSchemeTask::process):
927         (WebKit::WebURLSchemeTask::process const): Deleted.
928         (WebKit::WebURLSchemeTask::request const): Deleted.
929
930 2019-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
931
932         Followup to r247439
933         https://bugs.webkit.org/show_bug.cgi?id=199788
934         <rdar://problem/52142570>
935
936         Reviewed by Tim Horton.
937
938         As it turns out, sending modern async completion-handler based IPC messages while processing incoming sync
939         messages results in a debug assertion. Instead of migrating FontAtSelection to the new async IPC mechanism,
940         restore the older CallbackID-based async IPC.
941
942         * UIProcess/WebPageProxy.h:
943         * UIProcess/WebPageProxy.messages.in:
944         * UIProcess/mac/WebPageProxyMac.mm:
945         (WebKit::WebPageProxy::fontAtSelection):
946         (WebKit::WebPageProxy::fontAtSelectionCallback):
947         * WebProcess/WebPage/WebPage.h:
948         * WebProcess/WebPage/WebPage.messages.in:
949         * WebProcess/WebPage/mac/WebPageMac.mm:
950         (WebKit::WebPage::fontAtSelection):
951
952 2019-07-15  Dean Jackson  <dino@apple.com>
953
954         [WebGL] Remove software rendering and simplify context creation on macOS
955         https://bugs.webkit.org/show_bug.cgi?id=199789
956
957         Reviewed by Sam Weinig.
958
959         Remove force software WebGL setting.
960
961         * Shared/WebPreferences.yaml:
962         * UIProcess/API/C/WKPreferences.cpp:
963         (WKPreferencesSetForceSoftwareWebGLRendering): Deleted.
964         (WKPreferencesGetForceSoftwareWebGLRendering): Deleted.
965         * UIProcess/API/C/WKPreferencesRefPrivate.h:
966
967 2019-07-15  Daniel Bates  <dabates@apple.com>
968
969         Typing into a cell in a Google Sheet lags behind by one character
970         https://bugs.webkit.org/show_bug.cgi?id=199587
971         <rdar://problem/51616845>
972
973         Reviewed by Brent Fulgham.
974
975         Remove all timers from the holding tank on text insertion or deletion (represented as an
976         editing command). Timers that were in the holding tank never stopped ticking and will now
977         be able to execute their action.
978
979         * WebProcess/WebPage/WebPage.cpp:
980         (WebKit::WebPage::executeEditingCommand):
981         (WebKit::WebPage::insertTextAsync):
982         (WebKit::WebPage::setCompositionAsync):
983         (WebKit::WebPage::confirmCompositionAsync):
984         Call platformWillPerformEditingCommand().
985
986         * WebProcess/WebPage/WebPage.h:
987         (WebKit::WebPage::platformWillPerformEditingCommand): Added.
988         * WebProcess/WebPage/ios/WebPageIOS.mm:
989         (WebKit::WebPage::platformWillPerformEditingCommand): Remove all the timers from the holding
990         tank if we have a holding tank.
991
992 2019-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
993
994         [macOS 10.15] Cannot unbold selected text when the system font is used
995         https://bugs.webkit.org/show_bug.cgi?id=199788
996         <rdar://problem/52142570>
997
998         Reviewed by Tim Horton.
999
1000         In macOS 10.15, +[NSFont fontWithName:size:] no longer recognizes system fonts (of name
1001         ".SFNS-*") and returns nil instead. However, our existing implementation of
1002         WebPageProxy::fontAtSelection works by grabbing the font name in the web process, and
1003         sending it over to the UI process, where it is mapped to an NSFont. As a result, this always
1004         results in a nil font in macOS 10.15, which causes us to never update NSFontManager's
1005         selected font. In turn, this means that once selected text is bolded, it can't be unbolded
1006         via NSFontManager, since NSFontManager thinks that the text is still not bold.
1007
1008         To fix this, we simply encode and send a platform FontInfo instead of sending the font name.
1009         This allows the UI process to reconstruct NSFonts from font attribute dictionaries instead,
1010         and update the font manager.
1011
1012         * UIProcess/Cocoa/WebViewImpl.mm:
1013         (WebKit::WebViewImpl::updateFontManagerIfNeeded):
1014         * UIProcess/WebPageProxy.h:
1015         * UIProcess/WebPageProxy.messages.in:
1016         * UIProcess/mac/WebPageProxyMac.mm:
1017         (WebKit::WebPageProxy::fontAtSelection):
1018
1019         Refactor this to send a FontInfo (containing a font attribute dictionary) instead of a font
1020         name.
1021
1022         (WebKit::WebPageProxy::fontAtSelectionCallback): Deleted.
1023         * WebProcess/WebPage/WebPage.h:
1024         * WebProcess/WebPage/WebPage.messages.in:
1025
1026         Change FontAtSelection to use sendWithAsyncReply instead of sending a callback ID. This also
1027         allows us to remove FontAtSelectionCallback.
1028
1029         * WebProcess/WebPage/mac/WebPageMac.mm:
1030         (WebKit::WebPage::fontAtSelection):
1031
1032 2019-07-15  Jiewen Tan  <jiewen_tan@apple.com>
1033
1034         [iOS] SOAuthorizationSession should tell AppSSO whether the UIClient is capable of showing the extension UI
1035         https://bugs.webkit.org/show_bug.cgi?id=199790
1036         <rdar://problem/52790112>
1037
1038         Reviewed by Brent Fulgham.
1039
1040         On iOS, WebKit relies on a SPI -[WKUIDelegatePrivate _presentingViewControllerForWebView:] to present the
1041         extension UI. However, third party clients often don't implement this SPI. Therefore, WebKit will not be
1042         able to present the extension UI for them.
1043
1044         To be able to show the extension UI for third party WebKit clients, WebKit should unset SOAuthorization.enableEmbeddedAuthorizationViewController
1045         whenever clients don't implement the above SPI such that AppSSO could show the UI in their UI process.
1046
1047         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
1048         (WebKit::SOAuthorizationSession::start):
1049
1050 2019-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
1051
1052         REGRESSION: Chase app crashes immediately after authentication
1053         https://bugs.webkit.org/show_bug.cgi?id=199798
1054         <rdar://problem/53106179>
1055
1056         Reviewed by Alex Christensen.
1057
1058         After r247411, we sometimes try to consult `_page` from WKWebView, before WKWebView's `_page` has been set. This
1059         happens under a check for -[WKWebView _isEditable], from within -[WKContentView setupInteraction], which happens
1060         if the host app is not linked on the iOS 12 SDK or earlier. To mitigate this, simply add a null check in
1061         -_isEditable.
1062
1063         There's currently no great way to test this, since we don't have a mechanism for simulating linked-on checks.
1064
1065         * UIProcess/API/Cocoa/WKWebView.mm:
1066         (-[WKWebView _isEditable]):
1067
1068 2019-07-13  Andres Gonzalez  <andresg_22@apple.com>
1069
1070         Add accessibility support to WKDataListSuggestionsView.
1071         https://bugs.webkit.org/show_bug.cgi?id=199772
1072         <rdar://problem/47095851>
1073
1074         Reviewed by Chris Fleizach.
1075
1076         Added accessibility announcement notifications to show, dismiss and selection change for the datalist suggestions view.
1077         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
1078         (-[WKDataListSuggestionsView notifyAccessibilityClients:]):
1079         (-[WKDataListSuggestionsView moveSelectionByDirection:]):
1080         (-[WKDataListSuggestionsView invalidate]):
1081         (-[WKDataListSuggestionsView showSuggestionsDropdown:]):
1082
1083 2019-07-13  Zalan Bujtas  <zalan@apple.com>
1084
1085         Cannot bring up custom media controls at all on v.youku.com
1086         https://bugs.webkit.org/show_bug.cgi?id=199699
1087         <rdar://problem/51835327>
1088
1089         Reviewed by Simon Fraser.
1090
1091         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
1092         (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
1093         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1094         (WebKit::WebPage::performDictionaryLookupAtLocation):
1095         * WebProcess/WebPage/WebFrame.cpp:
1096         (WebKit::WebFrame::hitTest const):
1097         * WebProcess/WebPage/WebPage.cpp:
1098         (WebKit::handleContextMenuEvent):
1099         (WebKit::WebPage::characterIndexForPointAsync):
1100         * WebProcess/WebPage/ios/WebPageIOS.mm:
1101         (WebKit::WebPage::handleStylusSingleTapAtPoint):
1102         (WebKit::textInteractionPositionInformation):
1103         * WebProcess/WebPage/mac/WebPageMac.mm:
1104         (WebKit::WebPage::shouldDelayWindowOrderingEvent):
1105         (WebKit::WebPage::acceptsFirstMouse):
1106         (WebKit::WebPage::performImmediateActionHitTestAtLocation):
1107
1108 2019-07-12  Andy Estes  <aestes@apple.com>
1109
1110         [Cocoa] -loadFileURL:allowingReadAccessToURL: should fully resolve file URLs
1111         https://bugs.webkit.org/show_bug.cgi?id=199768
1112         <rdar://problem/52002206>
1113
1114         Reviewed by Geoffrey Garen.
1115
1116         -loadFileURL:allowingReadAccessToURL: used -_web_originalDataAsWTFString from WKNSURLExtras
1117         to convert the file and read access NSURLs to strings, which under the hood calls
1118         CFURLGetBytes(). CFURLGetBytes() gets the URL's string without considering the base URL, so
1119         if the client creates a URL like this:
1120
1121             NSURL *url = [NSURL fileURLWithPath:@"tmpfile.txt" relativeToURL:[NSURL fileURLWithPath:@"/tmp"]]
1122
1123         ... then -_web_originalDataAsWTFString will merely return the string "tmpfile.txt". When
1124         that is later converted back to a URL in WebPageProxy::loadFile(), we lose track of the base
1125         component and refuse to load something that no longer looks like a file: URL.
1126
1127         Fixed this by fully resolving the URLs passed to -loadFileURL:allowingReadAccessToURL: when
1128         converting to strings by using -[NSURL absoluteString] instead of -_web_originalDataAsWTFString.
1129
1130         * Shared/Cocoa/WKNSURLExtras.mm:
1131         (-[NSURL _web_originalDataAsWTFString]):
1132         * UIProcess/API/Cocoa/WKWebView.mm:
1133         (-[WKWebView loadFileURL:allowingReadAccessToURL:]):
1134
1135 2019-07-12  Megan Gardner  <megan_gardner@apple.com>
1136
1137         Turn off two finger gestures for editable non-scaled content
1138         https://bugs.webkit.org/show_bug.cgi?id=199739
1139         <rdar://problem/52107190>
1140
1141         Reviewed by Tim Horton.
1142
1143         This gesture is blocking a selection gesture. Turn it off as it is not
1144         even being used in editable content.
1145
1146         * UIProcess/ios/WKContentViewInteraction.mm:
1147         (-[WKContentView setupInteraction]):
1148         (-[WKContentView _didChangeWebViewEditability]):
1149
1150 2019-07-12  Jiewen Tan  <jiewen_tan@apple.com>
1151
1152         SOAuthorizationSession::presentViewController should check WebPageProxy::isClosed()
1153         https://bugs.webkit.org/show_bug.cgi?id=199755
1154         <rdar://problem/52323585>
1155
1156         Reviewed by Chris Dumez.
1157
1158         WebPageProxy::pageClient() is not guaranteed to be non null all the time. Therefore, we should check
1159         WebPageProxy::isClosed() before using it.
1160
1161         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
1162         (WebKit::SOAuthorizationSession::presentViewController):
1163
1164 2019-07-12  Chris Dumez  <cdumez@apple.com>
1165
1166         Regression(macOS Catalina): Cannot quick look html documents in Mail
1167         https://bugs.webkit.org/show_bug.cgi?id=199754
1168         <rdar://problem/51304961>
1169
1170         Reviewed by Geoff Garen.
1171
1172         If the client asks us to load a file URL but does not provide a resource path, WebKit
1173         would fallback to issuing a sandbox extension for /. This no longer works on mac OS
1174         Catalina and it would thus fail to load the file.
1175
1176         To address the issue, if the attempt to create a sandbox extension for / fails, we now
1177         fall back to issuing one for the file's baseURL (path of containing folder).
1178
1179         * UIProcess/WebPageProxy.cpp:
1180         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
1181
1182 2019-07-12  Michael Catanzaro  <mcatanzaro@igalia.com>
1183
1184         WebBackForwardListItem::setPageState should receive pageState by rvalue reference
1185         https://bugs.webkit.org/show_bug.cgi?id=199535
1186
1187         Reviewed by Alex Christensen
1188
1189         Coverity is complaining here about copying PageState by value in the parameter list. It's
1190         sort of a false positive, in that the PageState really does need to be copied here, so this
1191         is the best we can do. But pass by value and then WTFMove() is a pretty strange way to write
1192         it. Passing by rvalue reference would be better. This makes the copy more clear.
1193
1194         * Shared/WebBackForwardListItem.h:
1195         (WebKit::WebBackForwardListItem::setPageState):
1196         * UIProcess/WebProcessProxy.cpp:
1197         (WebKit::WebProcessProxy::updateBackForwardItem):
1198
1199 2019-07-12  Youenn Fablet  <youenn@apple.com>
1200
1201         Add release logging for quota checks
1202         https://bugs.webkit.org/show_bug.cgi?id=199697
1203
1204         Reviewed by Alex Christensen.
1205
1206         Log requests made to the page and the result from the application.
1207
1208         * Platform/Logging.h:
1209         * UIProcess/WebPageProxy.cpp:
1210         (WebKit::WebPageProxy::requestStorageSpace):
1211
1212 2019-07-12  Youenn Fablet  <youenn@apple.com>
1213
1214         Remove unneeded variable in LocalStorageNamespace::getOrCreateStorageArea
1215         https://bugs.webkit.org/show_bug.cgi?id=199477
1216
1217         Reviewed by Alex Christensen.
1218
1219         * NetworkProcess/WebStorage/StorageManager.cpp:
1220         (WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea):
1221
1222 2019-07-12  Pawel Stanek  <p.stanek@metrological.com>
1223
1224         Connection::waitForSyncReply() uses wall time clock for timeout
1225         https://bugs.webkit.org/show_bug.cgi?id=198712
1226         Due to a nature of the system time (it might not be set, jump, be off
1227         by a lot) it is better to use monotonically increasing time which is
1228         exactly what's used in a similar place i.e. Connection::waitForMessage()
1229         
1230         Reviewed by Alex Christensen.
1231
1232         * Platform/IPC/Connection.cpp:
1233         (IPC::Connection::waitForSyncReply):
1234
1235 2019-07-12  Timothy Hatcher  <timothy@apple.com>
1236
1237         Drop DarkModeCSSEnabled as an experimental feature and always enable it.
1238         https://bugs.webkit.org/show_bug.cgi?id=199725
1239         rdar://problem/52970972
1240
1241         Reviewed by Megan Gardner.
1242
1243         * Shared/WebPreferences.yaml: Removed DarkModeCSSEnabled.
1244
1245 2019-07-11  Myles C. Maxfield  <mmaxfield@apple.com>
1246
1247         New York font erroneously gets synthetic bold
1248         https://bugs.webkit.org/show_bug.cgi?id=199653
1249         <rdar://problem/51692592>
1250
1251         Reviewed by Simon Fraser.
1252
1253         Add the SPI to enable the new fonts.
1254
1255         * Shared/WebPreferences.yaml:
1256         * UIProcess/API/C/WKPreferences.cpp:
1257         (WKPreferencesSetShouldAllowDesignSystemUIFonts):
1258         (WKPreferencesGetShouldAllowDesignSystemUIFonts):
1259         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1260         * UIProcess/API/Cocoa/WKPreferences.mm:
1261         (-[WKPreferences _shouldAllowDesignSystemUIFonts]):
1262         (-[WKPreferences _setShouldAllowDesignSystemUIFonts:]):
1263         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1264
1265 2019-07-11  Chris Dumez  <cdumez@apple.com>
1266
1267         ASSERTION FAILED: RunLoop::isMain() under IPC::Connection::sendWithAsyncReply()
1268         https://bugs.webkit.org/show_bug.cgi?id=199734
1269         <rdar://problem/52977439>
1270
1271         Reviewed by Geoffrey Garen.
1272
1273         It appears WKProcessTaskStateObserverDelegate's taskStateDidChange handler can get called
1274         on a background thread so we need to make sure we go back to the main thread before we
1275         go into WebKit and do IPC.
1276
1277         * Shared/Cocoa/ProcessTaskStateObserver.mm:
1278         (-[WKProcessTaskStateObserverDelegate process:taskStateDidChange:]):
1279
1280 2019-07-11  Sihui Liu  <sihui_liu@apple.com>
1281
1282         StorageArea should not be destructed on the main thread
1283         https://bugs.webkit.org/show_bug.cgi?id=199713
1284         <rdar://problem/52911900>
1285
1286         Reviewed by Alex Christensen.
1287
1288         After r246079, LocalStorageNameSpace could be destructed on the main thread and it may hold the last reference 
1289         to StorageArea. Then we saw the crashes that StorageArea was wrongly destructed on the main thread.
1290
1291         * NetworkProcess/NetworkSession.cpp:
1292         (WebKit::NetworkSession::~NetworkSession):
1293         * NetworkProcess/WebStorage/StorageManager.cpp:
1294         (WebKit::StorageManager::waitUntilTasksFinished):
1295         (WebKit::StorageManager::waitUntilWritesFinished): Deleted.
1296         * NetworkProcess/WebStorage/StorageManager.h:
1297
1298 2019-07-11  Tim Horton  <timothy_horton@apple.com>
1299
1300         Null deref of Range under WebPage::startAutoscrollAtPosition
1301         https://bugs.webkit.org/show_bug.cgi?id=199724
1302         <rdar://problem/41127089>
1303
1304         Reviewed by Dean Jackson.
1305
1306         * WebProcess/WebPage/ios/WebPageIOS.mm:
1307         (WebKit::WebPage::startAutoscrollAtPosition):
1308         Refactor this function to be early-return-y, and add one more
1309         early return if the Range is null.
1310
1311 2019-07-11  Pablo Saavedra  <psaavedra@igalia.com>
1312
1313         [WPE][GTK] Build failure with ENABLE_ACCESSIBILITY=OFF
1314         https://bugs.webkit.org/show_bug.cgi?id=199625
1315
1316         Added ENABLE(ACCESSIBILITY) and replaced HAVE(ACCESSIBILITY)
1317         with ENABLE(ACCESSIBILITY) in the code.
1318
1319         Additionally, the TestRunner code generator now honors the
1320         Conditional IDL format.
1321
1322         Reviewed by Konstantin Tokarev.
1323
1324         * UIProcess/API/glib/WebKitWebViewAccessible.cpp:
1325         * UIProcess/API/glib/WebKitWebViewAccessible.h:
1326         * UIProcess/API/wpe/PageClientImpl.cpp:
1327         * UIProcess/API/wpe/PageClientImpl.h:
1328         * UIProcess/API/wpe/WPEView.cpp:
1329         (WKWPE::m_backend):
1330         (WKWPE::View::~View):
1331         * UIProcess/API/wpe/WPEView.h:
1332         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1333         (WKAccessibilityRootObject):
1334         (WKAccessibilityFocusedObject):
1335         (WKAccessibilityEnableEnhancedAccessibility):
1336         (WKAccessibilityEnhancedAccessibilityEnabled):
1337         * WebProcess/WebPage/WebPage.cpp:
1338         * WebProcess/WebPage/WebPage.h:
1339         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
1340         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h:
1341         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1342         (WebKit::WebPage::platformInitialize):
1343         * WebProcess/WebPage/wpe/WebPageWPE.cpp:
1344         (WebKit::WebPage::platformInitialize):
1345         * WebProcess/wpe/WebProcessMainWPE.cpp:
1346
1347 2019-07-11  Commit Queue  <commit-queue@webkit.org>
1348
1349         Unreviewed, rolling out r247314.
1350         https://bugs.webkit.org/show_bug.cgi?id=199721
1351
1352         Caused performance regression. (Requested by deanj on
1353         #webkit).
1354
1355         Reverted changeset:
1356
1357         "Disable speculative loading if cache is not to be used for
1358         the load"
1359         https://bugs.webkit.org/show_bug.cgi?id=199644
1360         https://trac.webkit.org/changeset/247314
1361
1362 2019-07-11  Dean Jackson  <dino@apple.com>
1363
1364         CrashTracer: Regression : MobileSafari at UIKit: -[CALayerAccessibility__UIKit__QuartzCore setBounds:]
1365         https://bugs.webkit.org/show_bug.cgi?id=199720
1366         <rdar://problem/51470469>
1367
1368         Reviewed by Tim Horton.
1369
1370         Speculative fix after confirming that this crash can occur when
1371         a zero width/height view is used for a UITargetedPreview. We
1372         already guarded against this in the default flow, but not in
1373         the fallback path where we take a view snapshot.
1374
1375         * UIProcess/ios/WKContentViewInteraction.mm:
1376         (createFallbackTargetedPreview): Return early if rectangles are empty.
1377
1378 2019-07-11  Alex Christensen  <achristensen@webkit.org>
1379
1380         Use mobile UA on jsfiddle.net
1381         https://bugs.webkit.org/show_bug.cgi?id=199687
1382         <rdar://problem/50839844>
1383
1384         Reviewed by Maciej Stachowiak.
1385
1386         Text selection does not work on iPads using desktop UA.
1387         This isn't the best solution, but it's certainly *a* solution.
1388
1389         * UIProcess/ios/WebPageProxyIOS.mm:
1390         (WebKit::desktopClassBrowsingRecommendedForRequest):
1391
1392 2019-07-11  Simon Fraser  <simon.fraser@apple.com>
1393
1394         [iOS WK2] Can't place caret or select in content that overflows a contenteditable element
1395         https://bugs.webkit.org/show_bug.cgi?id=199741
1396         rdar://problem/50545233
1397
1398         Reviewed by Wenson Hsieh.
1399
1400         Various code paths for editing used renderer->absoluteBoundingBoxRect(), which is the border
1401         box of the element (or a set of line boxes for inline elements) converted to absolute
1402         coordinates. This excludes overflow content, but contenteditable needs to be able to
1403         place the caret in overflow content, and allow selection rects to be in the overflow area
1404         (if the element has visible overflow).
1405
1406         Try to clean this up by adding some static helpers on WebPage for accessing the relevant
1407         rects, and use them in code call from visiblePositionInFocusedNodeForPoint(), and
1408         code that is input to selectionClipRect.
1409
1410         This changes selectionClipRect to use the padding box (excluding borders), which is a progression.
1411
1412         * WebProcess/WebPage/WebPage.h:
1413         * WebProcess/WebPage/ios/WebPageIOS.mm:
1414         (WebKit::WebPage::platformEditorState const):
1415         (WebKit::elementBoundsInFrame):
1416         (WebKit::constrainPoint):
1417         (WebKit::WebPage::rootViewBoundsForElement):
1418         (WebKit::WebPage::absoluteInteractionBoundsForElement):
1419         (WebKit::WebPage::rootViewInteractionBoundsForElement):
1420         (WebKit::WebPage::dispatchSyntheticMouseEventsForSelectionGesture):
1421         (WebKit::WebPage::getFocusedElementInformation):
1422         (WebKit::innerFrameQuad): Deleted.
1423         (WebKit::elementRectInRootViewCoordinates): Deleted.
1424
1425 2019-07-11  Jonathan Bedard  <jbedard@apple.com>
1426
1427         [iOS 13] Enable WebKit build
1428         https://bugs.webkit.org/show_bug.cgi?id=199481
1429         <rdar://problem/52619048>
1430
1431         Reviewed by Tim Horton.
1432
1433         * Platform/spi/ios/UIKitSPI.h: Add UITextEffectsWindow.sharedTextEffectsWindowForWindowScene SPI.
1434         * UIProcess/ios/WKContentViewInteraction.mm:
1435         (-[WKContentView showGlobalMenuControllerInRect:]): setTargetRect, setMenuVisible marked depreciated in iOS 13.
1436         (-[WKContentView hideGlobalMenuController]): Ditto.
1437
1438 2019-07-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1439
1440         MobileSafari may crash under -[UIKeyboardTaskExecutionContext transferExecutionToMainThreadWithTask:]
1441         https://bugs.webkit.org/show_bug.cgi?id=199701
1442         <rdar://problem/52590170>
1443
1444         Reviewed by Tim Horton.
1445
1446         Mitigates a crash wherein we end up calling the completion handler of
1447         -requestAutocorrectionContextWithCompletionHandler: within a nested call
1448         to -requestAutocorrectionContextWithCompletionHandler:. In this particular
1449         case, a sync `window.open` from the web process to the UI process happens
1450         while the UI process is already handling a sync autocorrection context
1451         request. This causes the UI process to try and immediately dispatch the
1452         incoming sync message to avoid deadlock. However, Safari's logic to create
1453         and set up a new web view when opening a new window makes the new view the
1454         first responder, which then prompts UIKit logic to request an autocorrection
1455         context for the new web view.
1456
1457         To avoid the issue for now, simply use -resignFirstResponder as a cue to invoke
1458         pending autocorrection context handlers in the original web view before UIKit
1459         tries to request autocorrection context in the newly created view.
1460
1461         I attempted to write a test for this, but realized that we only end up hitting
1462         the debug assertion pointed out in <https://webkit.org/b/199680>; we should be
1463         able to write a test for this in the future, if we teach Connection to handle
1464         multiple outgoing sync messages.
1465
1466         For the time being, I've attached a manual test case to the bug.
1467
1468         * UIProcess/ios/WKContentViewInteraction.mm:
1469         (-[WKContentView resignFirstResponderForWebView]):
1470         (-[WKContentView _cancelPendingAutocorrectionContextHandler]):
1471
1472         Add a new helper to signify that a pending autocorrection context handler should be cancelled (invoked
1473         immediately with empty data). Use this in a few places where we currently explicitly pass
1474         -[WKAutocorrectionContext emptyAutocorrectionContext].
1475
1476         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
1477
1478 2019-07-10  Simon Fraser  <simon.fraser@apple.com>
1479
1480         [iOS WK2] With modal overlay and body overflow:hidden, can't access all the content
1481         https://bugs.webkit.org/show_bug.cgi?id=199693
1482         rdar://problem/51930364
1483
1484         Reviewed by Tim Horton.
1485
1486         A page with overflow:hidden on the root needs to be scrollable if:
1487         * it's zoomed
1488         * the visual viewport is smaller than the layout viewport (including visible keyboard)
1489         * scrolling is required to hide MobileSafari's squishy bars
1490
1491         This patch does the last two, plumbing a "visual viewport is smaller than layout viewport"
1492         bit up from WebCore via the scrolling tree (that way, when it changes we automatically trigger
1493         a commit), and checking for squished bars in WKWebView.
1494
1495         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1496         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
1497         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
1498         * UIProcess/API/Cocoa/WKWebView.mm:
1499         (-[WKWebView _didCommitLayerTree:]):
1500         (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:maximumUnobscuredSizeOverride:]):
1501         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1502         (WebKit::RemoteScrollingCoordinatorProxy::hasScrollableMainFrame const):
1503         * UIProcess/WebPageProxy.h:
1504         (WebKit::WebPageProxy::maximumUnobscuredSize const):
1505         * WebProcess/WebPage/ios/WebPageIOS.mm:
1506         (WebKit::WebPage::dynamicViewportSizeUpdate):
1507         (WebKit::WebPage::updateVisibleContentRects):
1508
1509 2019-07-10  Tim Horton  <timothy_horton@apple.com>
1510
1511         Long pressing on attachments will crash the WebContent process
1512         https://bugs.webkit.org/show_bug.cgi?id=199696
1513         <rdar://problem/52920241>
1514
1515         Reviewed by Dean Jackson.
1516
1517         * WebProcess/WebPage/ios/WebPageIOS.mm:
1518         (WebKit::linkIndicatorPositionInformation):
1519         (WebKit::elementPositionInformation):
1520         (WebKit::selectionPositionInformation):
1521         (WebKit::WebPage::positionInformation):
1522         Instead of one-off creating a node snapshot for <attachment>, just
1523         use TextIndicator. This way, we get an estimated background color,
1524         paint at the right resolution, etc.
1525
1526         Also, hitNode was often null where we were previously calling
1527         shareableBitmapSnapshotForNode, because it depends on the element
1528         having click event handlers. selectionPositionInformation() re-hit-tests
1529         more permissively to find the <attachment>, so moving this code
1530         inside that function ensures that we don't try to snapshot a null node.
1531
1532 2019-07-10  Dean Jackson  <dino@apple.com>
1533
1534         Safari’s context menu actions are missing options
1535         https://bugs.webkit.org/show_bug.cgi?id=199694
1536         <rdar://problem/52726822>
1537
1538         Reviewed by Tim Horton.
1539
1540         One of the most embarrassing errors I've ever made. I was returning
1541         early when something existed, instead of when it didn't exist.
1542         (*cough* tests *cough*)
1543
1544         * UIProcess/ios/WKContentViewInteraction.mm:
1545
1546 2019-07-10  Jon Lee  <jonlee@apple.com>
1547
1548         Opt trello.com to mobile UA
1549         https://bugs.webkit.org/show_bug.cgi?id=199686
1550         rdar://problem/51708119
1551
1552         Reviewed by Wenson Hsieh.
1553
1554         * UIProcess/ios/WebPageProxyIOS.mm:
1555         (WebKit::desktopClassBrowsingRecommendedForRequest): Currently the desktop version
1556         of the site prevents users from tapping cards to edit them. Opt trello into the mobile
1557         UA for now.
1558
1559 2019-07-10  Daniel Bates  <dabates@apple.com>
1560
1561         [iOS] Selection handles "Lollipops" can become gray and stay gray
1562         https://bugs.webkit.org/show_bug.cgi?id=198852
1563         <rdar://problem/51736130>
1564
1565         Reviewed by Wenson Hsieh.
1566
1567         Tell the text interaction assistant to update the selection UI when the tint color changes.
1568         We do this by way of deactivating and activating selection.
1569
1570         * UIProcess/ios/WKContentViewInteraction.mm:
1571         (-[WKContentView tintColorDidChange]):
1572
1573 2019-07-10  Dean Jackson  <dino@apple.com>
1574
1575         Share or Copy image from context menu does not share the correct data
1576         https://bugs.webkit.org/show_bug.cgi?id=199681
1577         <rdar://problem/50538771>
1578
1579         Reviewed by Tim Horton.
1580
1581         The UIContextMenuInteraction calls didEndInteraction before executing the
1582         actions of a selected menu item. This means we were assuming the interaction
1583         had finished before performing the action triggered in the interaction, ending
1584         up in the state where we had forgotten which element we were working with.
1585
1586         Rather than ask for UIKit to change, I'm just starting the interaction again
1587         as the action is run. Thankfully we already had the location of the interaction.
1588         There is a small risk that the page has changed in the meantime, but I'm not
1589         sure what to do about that.
1590
1591         While here, I moved a method only used by us into _WKElementActionInternal,
1592         and changed the location stored by _WKActivatedElementInfo from a CGPoint
1593         to an WebCore::IntPoint (since it doesn't escape WebKit).
1594
1595         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm: Use a WebCore::IntPoint rather than a CGPoint.
1596         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:]):
1597         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:userInfo:]):
1598         (-[_WKActivatedElementInfo _interactionLocation]):
1599         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
1600
1601         * UIProcess/API/Cocoa/_WKElementAction.h: Move uiActionForElementInfo to Internal.
1602         * UIProcess/API/Cocoa/_WKElementActionInternal.h:
1603
1604         * UIProcess/API/Cocoa/_WKElementAction.mm: When executing the handlers, restart the interaction
1605         using the location in _WKActivatedElementInfo.
1606         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
1607
1608         * UIProcess/ios/WKContentViewInteraction.mm: Explicitly start and stop interactions at
1609         the appropriate points in the UIContextMenu flow. This isn't really needed since we're
1610         doing it in the handlers, but it will be correct if the UIKit delegate order changes.
1611         (-[WKContentView continueContextMenuInteraction:]):
1612         (-[WKContentView contextMenuInteractionDidEnd:]):
1613
1614 2019-07-10  Chris Dumez  <cdumez@apple.com>
1615
1616         Crash under IPC::Connection::waitForMessage()
1617         https://bugs.webkit.org/show_bug.cgi?id=199680
1618         <rdar://problem/52500561>
1619
1620         Reviewed by Tim Horton.
1621
1622         IPC::Connection::waitForMessage() is crashing due to a null defererence of
1623         m_waitingForMessage. Since m_waitingForMessage is only ever set to null in
1624         waitForMessage(), this seems to imply we've re-entered waitForMessage().
1625         This is in theory possible since the loop inside waitForMessage() calls
1626         SyncMessageState::singleton().dispatchMessages() on every iteration to
1627         process incoming synchronous IPC messages. In theory, one of these sync
1628         IPC messages could run code which ends up calling waitForAndDispatchImmediately()
1629         (and thus waitForMessage()).
1630
1631         We had a debug assertion to try and catch re-entrancy with a comment stating
1632         "We don't support having multiple clients waiting for messages." but we
1633         would not see those in release and we would crash with a null dereference
1634         instead.
1635
1636         To address the crashes in release, return early in case of re-entrancy
1637         (we would still hit an assertion in debug).
1638
1639         * Platform/IPC/Connection.cpp:
1640         (IPC::Connection::Connection):
1641         (IPC::Connection::waitForMessage):
1642         * Platform/IPC/Connection.h:
1643
1644 2019-07-10  Tim Horton  <timothy_horton@apple.com>
1645
1646         Context menus are not presented for WKWebViews that don't have UIDelegates
1647         https://bugs.webkit.org/show_bug.cgi?id=199678
1648
1649         Reviewed by Dean Jackson.
1650
1651         * UIProcess/ios/WKContentViewInteraction.mm:
1652         (-[WKContentView continueContextMenuInteraction:]):
1653         Remove this unnecessary early-return if we don't have a UIDelegate.
1654         We have a default behavior that we totally want to happen.
1655         Also, rename completion() to continueWithContextMenuConfiguration()
1656         to reduce confusion between completion() and completionBlock() in
1657         this method.
1658
1659 2019-07-10  Commit Queue  <commit-queue@webkit.org>
1660
1661         Unreviewed, rolling out r247223.
1662         https://bugs.webkit.org/show_bug.cgi?id=199679
1663
1664         Caused perf regression. (Requested by deanj on #webkit).
1665
1666         Reverted changeset:
1667
1668         "[iPadOS] Viewport pops while loading sohu.com, xinhuanet.com,
1669         and various other websites"
1670         https://bugs.webkit.org/show_bug.cgi?id=199575
1671         https://trac.webkit.org/changeset/247223
1672
1673 2019-07-10  Youenn Fablet  <youenn@apple.com>
1674
1675         Disable speculative loading if cache is not to be used for the load
1676         https://bugs.webkit.org/show_bug.cgi?id=199644
1677
1678         Reviewed by Chris Dumez.
1679
1680         When the page is reloaded, loads are instructed to not use the cache.
1681         It is therefore unneeded to do speculative revalidation.
1682         Allow speculative revalidation if the cache policy is either the default HTTP policy or
1683         if policy is to refresh all cache data.
1684         Covered by added test.
1685
1686         * NetworkProcess/cache/NetworkCache.cpp:
1687         (WebKit::NetworkCache::cachePolicyValidForSpeculativeRevalidation):
1688         (WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):
1689
1690 2019-07-10  Alex Christensen  <achristensen@webkit.org>
1691
1692         Fix build after Foundation changes UIEdgeInsets definition
1693         https://bugs.webkit.org/show_bug.cgi?id=199660
1694         <rdar://problem/52390453>
1695
1696         Reviewed by Tim Horton.
1697
1698         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1699         * UIProcess/Cocoa/WKWebViewContentProvider.h:
1700
1701 2019-07-10  Antti Koivisto  <antti@apple.com>
1702
1703         Remove TouchActionData
1704         https://bugs.webkit.org/show_bug.cgi?id=199668
1705
1706         Reviewed by Simon Fraser.
1707
1708         * Shared/WebCoreArgumentCoders.cpp:
1709         (IPC::ArgumentCoder<EventTrackingRegions>::encode):
1710         (IPC::ArgumentCoder<EventTrackingRegions>::decode):
1711         (IPC::ArgumentCoder<TouchActionData>::encode): Deleted.
1712         (IPC::ArgumentCoder<TouchActionData>::decode): Deleted.
1713
1714 2019-07-09  Michael Catanzaro  <mcatanzaro@igalia.com>
1715
1716         [WPE][GTK] GUniqueOutPtr::release should return a raw pointer
1717         https://bugs.webkit.org/show_bug.cgi?id=199579
1718
1719         Reviewed by Carlos Garcia Campos.
1720
1721         * NetworkProcess/glib/WebKitCachedResolver.cpp:
1722         (webkitCachedResolverLookupByNameAsync):
1723         (webkitCachedResolverLookupByNameWithFlagsAsync):
1724         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
1725         (processPendingIconsForPageURL):
1726         (webkit_favicon_database_get_favicon):
1727         * UIProcess/API/glib/WebKitUserContentFilterStore.cpp:
1728         (webkit_user_content_filter_store_save_from_file):
1729
1730 2019-07-09  Tim Horton  <timothy_horton@apple.com>
1731
1732         Fixed elements appear in the middle of full page screenshots taken when scrolled
1733         https://bugs.webkit.org/show_bug.cgi?id=199649
1734         <rdar://problem/52476226>
1735
1736         Reviewed by Simon Fraser.
1737
1738         * WebProcess/WebPage/ios/WebPageIOS.mm:
1739         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
1740         Temporarily expand the layout viewport to the size of the snapshotting page,
1741         so that fixed elements sit against the bounds of the page instead of
1742         wherever you're currently scrolled to.
1743
1744 2019-07-09  Simon Fraser  <simon.fraser@apple.com>
1745
1746         [iOS WK2] Use Optional<> for two data members of WKWebView
1747         https://bugs.webkit.org/show_bug.cgi?id=199637
1748
1749         Reviewed by Tim Horton.
1750
1751         Use Optional<CGSize> to replace _overridesViewLayoutSize/_viewLayoutSizeOverride
1752         and _overridesMaximumUnobscuredSize/_maximumUnobscuredSizeOverride.
1753
1754         No behavior change.
1755
1756         * UIProcess/API/Cocoa/WKWebView.mm:
1757         (-[WKWebView activeViewLayoutSize:]):
1758         (-[WKWebView _frameOrBoundsChanged]):
1759         (activeMaximumUnobscuredSize):
1760         (-[WKWebView _minimumLayoutSizeOverride]):
1761         (-[WKWebView _setViewLayoutSizeOverride:]):
1762         (-[WKWebView _maximumUnobscuredSizeOverride]):
1763         (-[WKWebView _setMaximumUnobscuredSizeOverride:]):
1764         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
1765         (-[WKWebView _clearOverrideLayoutParameters]):
1766
1767 2019-07-09  Chris Dumez  <cdumez@apple.com>
1768
1769         Fix integer type encoding / decoding in WKRemoteObjectCoder
1770         https://bugs.webkit.org/show_bug.cgi?id=199643
1771         <rdar://problem/52732342>
1772
1773         Reviewed by Anders Carlsson.
1774
1775         As per [1], q / Q match to long long / unsigned long long, not long / unsigned long.
1776
1777         [1] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html#//apple_ref/doc/uid/TP40008048-CH100
1778
1779         * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
1780         (encodeInvocationArguments):
1781         (decodeInvocationArguments):
1782
1783 2019-07-09  Chris Dumez  <cdumez@apple.com>
1784
1785         Cleanup uses of NetworkProcess::m_sessionByConnection
1786         https://bugs.webkit.org/show_bug.cgi?id=199586
1787
1788         Reviewed by Alex Christensen.
1789
1790         Avoid double HashMap lookups and call add() instead of ensure() when appropriate.
1791
1792         * NetworkProcess/NetworkProcess.cpp:
1793         (WebKit::NetworkProcess::networkSessionByConnection const):
1794         (WebKit::NetworkProcess::webPageWasAdded):
1795         (WebKit::NetworkProcess::webProcessWasDisconnected):
1796
1797 2019-07-09  Saagar Jha  <saagarjha@apple.com>
1798
1799         WKObject's minimum object alignment needs to be larger
1800         https://bugs.webkit.org/show_bug.cgi?id=199523
1801
1802         Reviewed by Alex Christensen.
1803
1804         WKObject's wrapped objects are currently constructed at addresses aligned to 8-byte boundaries, but some
1805         classes have more stringent requirements. By querying std::aligned_storage for the alignment of an object
1806         larger than anything we can construct, we should be able to satisfy alignment for any of WebKit's types.
1807
1808         * Shared/Cocoa/APIObject.mm: Use std::aligned_storage in conjunction with alignof to determine
1809         minimumObjectAlignment, instead of hardcoding 8.
1810
1811 2019-07-09  Megan Gardner  <megan_gardner@apple.com>
1812
1813         Don't strip out spaces for personalized Autocorrections
1814         https://bugs.webkit.org/show_bug.cgi?id=199476
1815         <rdar://problem/50782015>
1816
1817         Reviewed by Dean Jackson.
1818
1819         When inserting 'autocorrections' that are really predictive
1820         text suggestions based on personal data, we would remove the space
1821         before the suggestion, resulting in incorrect input.
1822         To fix, do not remove a space when the autocorrected text and the text it is 
1823         replacing do not have any length.
1824
1825         * WebProcess/WebPage/ios/WebPageIOS.mm:
1826         (WebKit::WebPage::applyAutocorrectionInternal):
1827
1828 2019-07-09  Truitt Savell  <tsavell@apple.com>
1829
1830         Unreviewed, rolling out r247230.
1831
1832         Caused storage/domstorage/localstorage/private-browsing-
1833         affects-storage.html to crash with an assertion.
1834
1835         Reverted changeset:
1836
1837         "Cleanup uses of NetworkProcess::m_sessionByConnection"
1838         https://bugs.webkit.org/show_bug.cgi?id=199586
1839         https://trac.webkit.org/changeset/247230
1840
1841 2019-07-09  Youenn Fablet  <youenn@apple.com>
1842
1843         XHR CORS requests logged twice in the server
1844         https://bugs.webkit.org/show_bug.cgi?id=199492
1845         <rdar://problem/52757558>
1846
1847         Reviewed by Chris Dumez.
1848
1849         Disable speculative loading for XHR and fetch.
1850         These speculative requests might have specific headers that are no longer relevant
1851         when reloading the page. This might then confuse servers.
1852
1853         * NetworkProcess/cache/NetworkCache.cpp:
1854         (WebKit::NetworkCache::makeStoreDecision):
1855         (WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):
1856         (WebKit::NetworkCache::Cache::retrieve):
1857
1858 2019-07-09  Chris Dumez  <cdumez@apple.com>
1859
1860         Fix validation of method signature in decodeInvocation()
1861         https://bugs.webkit.org/show_bug.cgi?id=199629
1862         <rdar://problem/52731659>
1863
1864         Reviewed by Dan Bernstein.
1865
1866         The decoder was mistakenly assigning remoteMethodSignature to localMethodSignature
1867         before comparing remoteMethodSignature and localMethodSignature, thus making the
1868         check useless.
1869
1870         * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
1871         (decodeInvocation):
1872
1873 2019-07-09  Youenn Fablet  <youenn@apple.com>
1874
1875         Revert conditional WebPageProxy check to grant universal file read sandbox upon correct sandbox creation
1876         https://bugs.webkit.org/show_bug.cgi?id=199622
1877         <rdar://problem/52357508>
1878
1879         Reviewed by Alex Christensen.
1880
1881         On iOS, the sandbox extension to '/' will usually fail, thus the universal file read sandbox is not granted.
1882         This makes WebPageProxy cancel some file:// loads to the application own container.
1883         As a short term fix, go back to previous behavior.
1884         Covered by testing broken app identified in rdar://problem/52357508.
1885
1886         * UIProcess/WebPageProxy.cpp:
1887         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
1888
1889 2019-07-09  Sihui Liu  <sihui_liu@apple.com>
1890
1891         Only allow fetching and removing session credentials from WebsiteDataStore
1892         https://bugs.webkit.org/show_bug.cgi?id=199385
1893         <rdar://problem/52622080>
1894
1895         Reviewed by Alex Christensen.
1896
1897         Stop sending an extra message to network process for fetching or removing persistent credentials.
1898
1899         Also introduce a new SPI for clearing persistent credentials created in test.
1900
1901         * NetworkProcess/NetworkProcess.cpp:
1902         (WebKit::NetworkProcess::clearPermanentCredentialsForProtectionSpace):
1903         (WebKit::NetworkProcess::fetchWebsiteData):
1904         (WebKit::NetworkProcess::deleteWebsiteData):
1905         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1906         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
1907         (WebKit::NetworkProcess::originsWithPersistentCredentials): Deleted.
1908         (WebKit::NetworkProcess::removeCredentialsWithOrigins): Deleted.
1909         * NetworkProcess/NetworkProcess.h:
1910         * NetworkProcess/NetworkProcess.messages.in:
1911         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1912         (WebKit::NetworkProcess::originsWithPersistentCredentials): Deleted.
1913         (WebKit::NetworkProcess::removeCredentialsWithOrigins): Deleted.
1914         * UIProcess/API/Cocoa/WKProcessPool.mm:
1915         (-[WKProcessPool _clearPermanentCredentialsForProtectionSpace:completionHandler:]):
1916         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1917         * UIProcess/WebProcessPool.cpp:
1918         (WebKit::WebProcessPool::clearPermanentCredentialsForProtectionSpace):
1919         * UIProcess/WebProcessPool.h:
1920         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1921         (WebKit::WebsiteDataStore::fetchDataAndApply):
1922         (WebKit::computeWebProcessAccessTypeForDataRemoval):
1923         (WebKit::WebsiteDataStore::removeData):
1924
1925 2019-07-09  Antoine Quint  <graouts@apple.com>
1926
1927         [Pointer Events] Scroll indicators should not show for scrollable content with touch-action: none
1928         https://bugs.webkit.org/show_bug.cgi?id=199618
1929
1930         Reviewed by Simon Fraser.
1931
1932         Even though we correctly didn't scroll when "touch-action: none" was specified on an element, we would only apply
1933         scrolling constraints after the panning gesture was recognized and the backing UIScrollView would show its scroll
1934         indicators. While this is correct when only "pan-x" or "pan-y" is specified, we should not show the scroll indicators
1935         at all for "touch-action: none" since no scrolling should happen.
1936
1937         To do this, we add a new method to the WKTouchActionGestureRecognizerDelegate protocol to indicate whether a given
1938         gesture recognizer may pan content in the WKWebView. If the gesture recognizer is the top-level scroll view or one
1939         created within the page to back "overflow: scroll" content or an iframe, we correctly make that gesture recognizer
1940         fail to recognize if neither "pan-x" nor "pan-y" is specified for this touch identifier.
1941
1942         * UIProcess/ios/WKContentViewInteraction.mm:
1943         (-[WKContentView gestureRecognizerMayPanWebView:]):
1944         * UIProcess/ios/WKTouchActionGestureRecognizer.h:
1945         * UIProcess/ios/WKTouchActionGestureRecognizer.mm:
1946         (-[WKTouchActionGestureRecognizer canPreventGestureRecognizer:]):
1947
1948 2019-07-09  Chris Dumez  <cdumez@apple.com>
1949
1950         Validate reply block signature in [WKRemoteObjectRegistry _invokeMethod]
1951         https://bugs.webkit.org/show_bug.cgi?id=199584
1952         <rdar://problem/46268249>
1953
1954         Reviewed by Geoffrey Garen.
1955
1956         Validate reply block signature in [WKRemoteObjectRegistry _invokeMethod] for robustness.
1957
1958         * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
1959         (validateReplyBlockSignature):
1960         (-[_WKRemoteObjectRegistry _invokeMethod:]):
1961
1962 2019-07-09  Alex Christensen  <achristensen@webkit.org>
1963
1964         UserData::decode should return false when decoding an unrecognized type
1965         https://bugs.webkit.org/show_bug.cgi?id=199598
1966         <rdar://52735138>
1967
1968         Reviewed by Ryosuke Niwa.
1969
1970         * Shared/UserData.cpp:
1971         (WebKit::UserData::decode):
1972
1973 2019-07-08  Chris Dumez  <cdumez@apple.com>
1974
1975         Speculative fix for crashes under LocalStorageDatabaseTracker::databasePath()
1976         https://bugs.webkit.org/show_bug.cgi?id=199599
1977         <rdar://problem/31169686>
1978
1979         Reviewed by Ryosuke Niwa.
1980
1981         Speculative fix for crashes under LocalStorageDatabaseTracker::databasePath():
1982         - Add new localStorageDirectory() getter to LocalStorageDatabaseTracker which
1983           calls isolatedCopy() on m_localStorageDirectory before returning it.
1984           Use it everywhere instead of m_localStorageDirectory since it is not safe
1985           to use the same String from various threads like it was done.
1986         - Move localStorageDirectory when constructing the LocalStorageDatabaseTracker
1987           instead of copying it.
1988         - Make sure that LocalStorageDatabaseTracker and StorageManager are both
1989           constructed and destroyed on the main thread.
1990
1991         * NetworkProcess/NetworkSession.cpp:
1992         (WebKit::NetworkSession::NetworkSession):
1993         * NetworkProcess/NetworkSession.h:
1994         * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
1995         (WebKit::LocalStorageDatabaseTracker::create):
1996         (WebKit::LocalStorageDatabaseTracker::LocalStorageDatabaseTracker):
1997         (WebKit::LocalStorageDatabaseTracker::localStorageDirectory const):
1998         (WebKit::LocalStorageDatabaseTracker::~LocalStorageDatabaseTracker):
1999         (WebKit::LocalStorageDatabaseTracker::deleteAllDatabases):
2000         (WebKit::LocalStorageDatabaseTracker::origins const):
2001         (WebKit::LocalStorageDatabaseTracker::databasePath const):
2002         * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.h:
2003         * NetworkProcess/WebStorage/StorageManager.cpp:
2004         (WebKit::StorageManager::create):
2005         (WebKit::StorageManager::StorageManager):
2006         (WebKit::StorageManager::~StorageManager):
2007         * NetworkProcess/WebStorage/StorageManager.h:
2008         * NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm:
2009         (WebKit::LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup const):
2010         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2011         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2012         * NetworkProcess/curl/NetworkSessionCurl.cpp:
2013         (WebKit::NetworkSessionCurl::NetworkSessionCurl):
2014         * NetworkProcess/soup/NetworkSessionSoup.cpp:
2015         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
2016
2017 2019-07-08  Chris Dumez  <cdumez@apple.com>
2018
2019         Use WeakHashSet for WebUserContentControllerProxy::m_processes
2020         https://bugs.webkit.org/show_bug.cgi?id=199591
2021         <rdar://problem/52798721>
2022
2023         Reviewed by Youenn Fablet.
2024
2025         Use WeakHashSet for WebUserContentControllerProxy::m_processses for safety. In theory, a WebProcessProxy could
2026         stay in the map if we failed to call WebProcessProxy::shutDown() before destroying it.
2027
2028         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2029         (WebKit::WebUserContentControllerProxy::~WebUserContentControllerProxy):
2030         (WebKit::WebUserContentControllerProxy::addProcess):
2031         (WebKit::WebUserContentControllerProxy::removeProcess):
2032         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
2033         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
2034         (WebKit::WebUserContentControllerProxy::addUserScript):
2035         (WebKit::WebUserContentControllerProxy::removeUserScript):
2036         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
2037         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
2038         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
2039         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
2040         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
2041         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
2042         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
2043         (WebKit::WebUserContentControllerProxy::addContentRuleList):
2044         (WebKit::WebUserContentControllerProxy::removeContentRuleList):
2045         (WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
2046         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2047         (WebKit::WebUserContentControllerProxy::addNetworkProcess):
2048         (WebKit::WebUserContentControllerProxy::removeNetworkProcess):
2049
2050 2019-07-08  Daniel Bates  <dabates@apple.com>
2051
2052         [iOS] Support select all in non-editable element
2053         https://bugs.webkit.org/show_bug.cgi?id=199257
2054         <rdar://problem/52553667>
2055
2056         Reviewed by Wenson Hsieh.
2057
2058         Unless we are populating the callout bar always advertise that WebKit can perform Select All
2059         when building with USE(UIKIT_KEYBOARD_ADDITIONS). This way you can press Command + A to select
2060         all text even in a non-editable element just like you can on Mac.
2061
2062         * UIProcess/ios/WKContentViewInteraction.mm:
2063         (-[WKContentView canPerformActionForWebView:withSender:]):
2064
2065 2019-07-08  Chris Dumez  <cdumez@apple.com>
2066
2067         Cleanup uses of NetworkProcess::m_sessionByConnection
2068         https://bugs.webkit.org/show_bug.cgi?id=199586
2069
2070         Reviewed by Alex Christensen.
2071
2072         Avoid double HashMap lookups and call add() instead of ensure() when appropriate.
2073
2074         * NetworkProcess/NetworkProcess.cpp:
2075         (WebKit::NetworkProcess::networkSessionByConnection const):
2076         (WebKit::NetworkProcess::webPageWasAdded):
2077         (WebKit::NetworkProcess::webProcessWasDisconnected):
2078
2079 2019-07-08  Tim Horton  <timothy_horton@apple.com>
2080
2081         WKWebView fails to render when another view uses CoreImage filters
2082         https://bugs.webkit.org/show_bug.cgi?id=199488
2083         <rdar://problem/52695825>
2084
2085         Reviewed by Dean Jackson.
2086
2087         * UIProcess/WebPageProxy.cpp:
2088         (WebKit::WebPageProxy::layerHostingModeDidChange):
2089         Update m_layerHostingMode when it changes, even if we can't message
2090         the Web Content process. This ensures that the next time we launch
2091         a Web Content process, WebPageCreationParameters will have the correct
2092         layer hosting mode, and is the usual pattern for such things.
2093
2094 2019-07-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2095
2096         [iPadOS] Viewport pops while loading sohu.com, xinhuanet.com, and various other websites
2097         https://bugs.webkit.org/show_bug.cgi?id=199575
2098         <rdar://problem/51842220>
2099
2100         Reviewed by Simon Fraser.
2101
2102         Currently, the shrink-to-fit-content heuristic added to scale desktop sites fit within the viewport on iPadOS
2103         only runs during two intervals: after document load, and after page load. On very script-heavy websites, this
2104         may cause a visible jump, as rendering may commence well before the document is finished parsing.
2105
2106         To mitigate this, we move the first opportunity for the shrink-to-fit heuristic from after document, to right
2107         after the page transition has completed (before we unfreeze the layer tree).
2108
2109         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2110         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
2111         * WebProcess/WebPage/WebPage.cpp:
2112         (WebKit::WebPage::didCompletePageTransition):
2113         (WebKit::WebPage::didFinishDocumentLoad): Deleted.
2114
2115         Remove this didFinishDocumentLoad hook, which was only used to schedule the shrink-to-fit timer.
2116
2117         * WebProcess/WebPage/WebPage.h:
2118         * WebProcess/WebPage/ios/WebPageIOS.mm:
2119         (WebKit::WebPage::immediatelyShrinkToFitContent):
2120
2121         m_mainFrame might be null after page transition completes, so we need to ensure immediatelyShrinkToFitContent is
2122         robust in this scenario.
2123
2124 2019-07-08  Chris Dumez  <cdumez@apple.com>
2125
2126         Add threading assertion to WTF::CompletionHandler
2127         https://bugs.webkit.org/show_bug.cgi?id=199516
2128
2129         Reviewed by Alex Christensen.
2130
2131         Update some MessagePort-related code to use WTF::Function instead of WTF::CompletionHandler
2132         since the callback is always called on the main thread, even when it was created on a
2133         worker thread. Ideally, this code would be refactored so that the callback gets called on
2134         the worker thread directly.
2135
2136         * UIProcess/UIMessagePortChannelProvider.cpp:
2137         (WebKit::UIMessagePortChannelProvider::checkRemotePortForActivity):
2138         * UIProcess/UIMessagePortChannelProvider.h:
2139         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.cpp:
2140         (WebKit::WebMessagePortChannelProvider::checkRemotePortForActivity):
2141         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.h:
2142
2143 2019-07-08  Antoine Quint  <graouts@apple.com>
2144
2145         [Pointer Events] "touch-action: none" does not prevent double-tap-to-zoom
2146         https://bugs.webkit.org/show_bug.cgi?id=199571
2147         <rdar://problem/51715002>
2148
2149         Reviewed by Wenson Hsieh.
2150
2151         We add a new WKTouchActionGestureRecognizerDelegate method to check whether a gesture recognizer may lead to
2152         zooming the page as a result of double-tapping, which can be caused by two different gesture recognizers
2153         managed by WKContentViewInteraction. If that delegate method returns true and we have "touch-action: none"
2154         set for this touch, we cause those gesture recognizers to fail and prevent double-tap-to-zoom behavior.
2155
2156         * UIProcess/ios/WKContentViewInteraction.mm:
2157         (-[WKContentView gestureRecognizerMayDoubleTapToZoomWebView:]):
2158         * UIProcess/ios/WKTouchActionGestureRecognizer.h:
2159         * UIProcess/ios/WKTouchActionGestureRecognizer.mm:
2160         (-[WKTouchActionGestureRecognizer canPreventGestureRecognizer:]):
2161
2162 2019-07-08  Per Arne Vollan  <pvollan@apple.com>
2163
2164         [iOS] WebContent processes should not globally allow mach lookup to the AX server.
2165         https://bugs.webkit.org/show_bug.cgi?id=199386
2166         <rdar://problem/52487468>
2167
2168         Reviewed by Chris Fleizach.
2169
2170         Instead, a mach extension for this service should be issued to the WebContent process. This has already been implemented.
2171
2172         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2173
2174 2019-07-08  Claudio Saavedra  <csaavedra@igalia.com>
2175
2176         REGRESSION(r246671): [WPE][GTK] Crash in NetworkProcess since the DNS cache landed
2177         https://bugs.webkit.org/show_bug.cgi?id=199572
2178
2179         Reviewed by Michael Catanzaro.
2180
2181         The GError coming from the wrapped resolver shouldn't be freed,
2182         but passed onto the caller.
2183
2184         * NetworkProcess/glib/WebKitCachedResolver.cpp:
2185         (webkitCachedResolverLookupByNameAsync):
2186         (webkitCachedResolverLookupByNameWithFlagsAsync):
2187
2188 2019-07-07  Antoine Quint  <graouts@apple.com>
2189
2190         [Pointer Events] touch-action should affect the behavior of pinch-to-zoom to show tabs in Safari
2191         https://bugs.webkit.org/show_bug.cgi?id=199560
2192         <rdar://problem/52742265>
2193
2194         Reviewed by Dean Jackson.
2195
2196         There are other UIPinchGestureRecognizer objects that may lead to pinch-to-zoom behavior, for instance pinching
2197         out to show open tabs in Safari on iOS. We add a new WKUIDelegatePrivate method that will allow Safari to indicate
2198         that a UIPinchGestureRecognizer considered for prevention would lead to pinch-to-zoom behavior.
2199
2200         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2201         * UIProcess/ios/WKContentViewInteraction.mm:
2202         (-[WKContentView gestureRecognizerMayPinchToZoomWebView:]):
2203
2204 2019-07-08  Antoine Quint  <graouts@apple.com>
2205
2206         [Pointer Events] Enable only on the most recent version of the supported iOS family
2207         https://bugs.webkit.org/show_bug.cgi?id=199562
2208         <rdar://problem/52766511>
2209
2210         Reviewed by Dean Jackson.
2211
2212         * Configurations/FeatureDefines.xcconfig:
2213         * UIProcess/ios/WKContentViewInteraction.mm:
2214         (-[WKContentView cancelPointersForGestureRecognizer:]):
2215         (-[WKContentView activeTouchIdentifierForGestureRecognizer:]):
2216         (-[WKContentView touchActionActiveTouches]):
2217         * UIProcess/ios/WKSyntheticTapGestureRecognizer.m:
2218         (-[WKSyntheticTapGestureRecognizer touchesEnded:withEvent:]):
2219         * UIProcess/ios/WKTouchActionGestureRecognizer.h:
2220         * UIProcess/ios/WKTouchActionGestureRecognizer.mm:
2221         (-[WKTouchActionGestureRecognizer canPreventGestureRecognizer:]):
2222
2223 2019-07-08  Michael Catanzaro  <mcatanzaro@igalia.com>
2224
2225         [GTK] ViewGestureController constructor leaves m_direction uninitialized
2226         https://bugs.webkit.org/show_bug.cgi?id=199532
2227
2228         Reviewed by Carlos Garcia Campos.
2229
2230         This is harmless because it should never be read until after it's initialized, but still not
2231         robust. Fix it by assuming Back as the default value until the first swipe begins.
2232
2233         * UIProcess/ViewGestureController.h:
2234
2235 2019-07-07  Zalan Bujtas  <zalan@apple.com>
2236
2237         [ContentChangeObserver] Difficult to control videos on iqiyi.com as the actions are mouse hover
2238         https://bugs.webkit.org/show_bug.cgi?id=199542
2239         <rdar://problem/51886813>
2240
2241         Reviewed by Simon Fraser.
2242
2243         * WebProcess/WebPage/ios/WebPageIOS.mm:
2244         (WebKit::WebPage::handleSyntheticClick):
2245
2246 2019-07-06  Antoine Quint  <graouts@apple.com>
2247
2248         [Pointer Events] Use a gesture recognizer to prevent pinch-to-zoom behavior
2249         https://bugs.webkit.org/show_bug.cgi?id=199543
2250
2251         Reviewed by Dean Jackson.
2252
2253         We used to set the "enabled" property on the main UIScrollView's UIPinchGestureRecognizer to disable pinch-to-zoom
2254         behavior based on the "touch-action" CSS property. This was sub-optimal since this gesture recognizer can be publicly
2255         accessible by third-party developers, but also because it set state instead of a run-time solution.
2256
2257         We now introduce a new WKTouchActionGestureRecognizer dedicated to preventing clearly identified gesture recognizers
2258         from being recognized to disable some built-in behavior. As a new touch starts, we record the computed touch-action
2259         property for the given touch identifier on the WKTouchActionGestureRecognizer, then WKTouchActionGestureRecognizer
2260         determines, by implementing -[canPreventGestureRecognizer:], whether the possibly-prevented gesture recognizer
2261         is known to lead to a pinch-to-zoom behavior and whether it contains a touch that should prevent it.
2262
2263         To support the WKTouchActionGestureRecognizer, WKContentViewInteraction implements the new WKTouchActionGestureRecognizerDelegate
2264         protocol to indicate whether the possibly-prevented gesture recognizer is the main UIScrollView's UIPinchGestureRecognizer.
2265
2266         No new test since this changes the implementation of existing behavior.
2267
2268         * SourcesCocoa.txt:
2269         * UIProcess/ios/WKContentViewInteraction.h:
2270         * UIProcess/ios/WKContentViewInteraction.mm:
2271         (-[WKContentView setupInteraction]):
2272         (-[WKContentView cleanupInteraction]):
2273         (-[WKContentView _removeDefaultGestureRecognizers]):
2274         (-[WKContentView _addDefaultGestureRecognizers]):
2275         (-[WKContentView _handleTouchActionsForTouchEvent:]):
2276         (-[WKContentView gestureRecognizerMayPinchToZoomWebView:]):
2277         (-[WKContentView touchActionActiveTouches]):
2278         * UIProcess/ios/WKTouchActionGestureRecognizer.h: Added.
2279         * UIProcess/ios/WKTouchActionGestureRecognizer.mm: Added.
2280         (-[WKTouchActionGestureRecognizer initWithTouchActionDelegate:]):
2281         (-[WKTouchActionGestureRecognizer setTouchActions:forTouchIdentifier:]):
2282         (-[WKTouchActionGestureRecognizer clearTouchActionsForTouchIdentifier:]):
2283         (-[WKTouchActionGestureRecognizer touchesBegan:withEvent:]):
2284         (-[WKTouchActionGestureRecognizer touchesMoved:withEvent:]):
2285         (-[WKTouchActionGestureRecognizer touchesEnded:withEvent:]):
2286         (-[WKTouchActionGestureRecognizer touchesCancelled:withEvent:]):
2287         (-[WKTouchActionGestureRecognizer _updateState]):
2288         (-[WKTouchActionGestureRecognizer canBePreventedByGestureRecognizer:]):
2289         (-[WKTouchActionGestureRecognizer canPreventGestureRecognizer:]):
2290         * WebKit.xcodeproj/project.pbxproj:
2291
2292 2019-07-06  Chris Fleizach  <cfleizach@apple.com>
2293
2294         AX: CrashTracer: com.apple.WebKit.WebContent at WebKit: WebKit::WebSpeechSynthesisClient::speak
2295         https://bugs.webkit.org/show_bug.cgi?id=199435
2296
2297         Reviewed by Ryosuke Niwa.
2298
2299         Ensure we don't access null observers in speech callbacks.
2300
2301         * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp:
2302         (WebKit::WebSpeechSynthesisClient::voiceList):
2303         (WebKit::WebSpeechSynthesisClient::speak):
2304         (WebKit::WebSpeechSynthesisClient::pause):
2305         (WebKit::WebSpeechSynthesisClient::resume):
2306         * WebProcess/WebPage/WebPage.cpp:
2307         (WebKit::WebPage::speakingErrorOccurred):
2308         (WebKit::WebPage::boundaryEventOccurred):
2309         (WebKit::WebPage::voicesDidChange):
2310
2311 2019-07-05  Chris Dumez  <cdumez@apple.com>
2312
2313         Fix thread safety bug in WebResourceLoadStatisticsTelemetry::calculateAndSubmit()
2314         https://bugs.webkit.org/show_bug.cgi?id=199536
2315
2316         Reviewed by Youenn Fablet.
2317
2318         The resourceLoadStatisticsStore is an object that is created / used / destroyed on the background
2319         queue. It is therefore not safe to create a WeakPtr for it and use that WeakPtr on the main thread.
2320
2321         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
2322         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
2323
2324 2019-07-05  Michael Catanzaro  <mcatanzaro@igalia.com>
2325
2326         Unreviewed, fix -Wswitch warning
2327
2328         We don't support HTTPCookieAcceptPolicy::ExclusivelyFromMainDocumentDomain.
2329
2330         Fun fact, soup's OnlyFromMainDocumentDomain functions the same as Apple's
2331         ExclusivelyFromMainDocumentDomain. These should be renamed....
2332
2333         * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp:
2334         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
2335
2336 2019-07-05  Dean Jackson  <dino@apple.com>
2337
2338         [iOS] Context Menu - Add to Reading List does nothing
2339         https://bugs.webkit.org/show_bug.cgi?id=199504
2340         <rdar://problem/52554137>
2341
2342         Reviewed by Anders Carlsson.
2343
2344         We were holding weak references to the _WKElementAction in
2345         the handler provided to UIAction. By the time the handler was
2346         called, the object had been deallocated.
2347
2348         * UIProcess/API/Cocoa/_WKElementAction.mm:
2349         (-[_WKElementAction uiActionForElementInfo:]): Use strong references in handler.
2350
2351 2019-07-05  Ryosuke Niwa  <rniwa@webkit.org>
2352
2353         [iOS] Crash in WebKit::WebPage::positionInformation via Range::startPosition
2354         https://bugs.webkit.org/show_bug.cgi?id=199503
2355
2356         Reviewed by Wenson Hsieh.
2357
2358         The crash was caused because focusedElementPositionInformation asssumes Editor::compositionRange is not null
2359         whenever Editor::hasComposition returns true, which is not necessary the case when Editor::m_compositionNode
2360         contains no text (data is of length 0).
2361
2362         Fixed the crash by adding an early return for when Editor::compositionRange returns nullptr.
2363
2364         * WebProcess/WebPage/ios/WebPageIOS.mm:
2365         (WebKit::focusedElementPositionInformation):
2366
2367 2019-07-05  Zalan Bujtas  <zalan@apple.com>
2368
2369         [ContentChangeObserver] REGRESSION (r247015): facebook photo/video upload button is unresponsive to user interaction.
2370         https://bugs.webkit.org/show_bug.cgi?id=199502
2371         <rdar://problem/52547473>
2372
2373         Reviewed by Simon Fraser.
2374
2375         Apparently it's a common practice to put transparent elements over visible click targets (button like divs) and use the invisible
2376         elements to catch the user input (e.g. Facebook's Photo/Video button).
2377         This patch modifies the original "do not trigger click on invisible targets" heuristic to a more restrictive "do not trigger
2378         click if the click target was previously hidden and became visible through touch start".
2379         If this still breaks some use cases, we could turn it into YouTube quirk.       
2380
2381         * WebProcess/WebPage/ios/WebPageIOS.mm:
2382         (WebKit::WebPage::handleSyntheticClick):
2383
2384 2019-07-05  Ryan Haddad  <ryanhaddad@apple.com>
2385
2386         Unreviewed, rolling out r247123.
2387
2388         Caused TestWebKitAPI.Challenge.BasicProposedCredential to
2389         fail.
2390
2391         Reverted changeset:
2392
2393         "Only allow fetching and removing session credentials from
2394         WebsiteDataStore"
2395         https://bugs.webkit.org/show_bug.cgi?id=199385
2396         https://trac.webkit.org/changeset/247123
2397
2398 2019-07-05  Wenson Hsieh  <wenson_hsieh@apple.com>
2399
2400         Click events on outer page are not being dispatched correctly after touch-zooming within an iframe
2401         https://bugs.webkit.org/show_bug.cgi?id=185001
2402         <rdar://problem/40569615>
2403
2404         Reviewed by Simon Fraser.
2405
2406         Mitigations introduced in r227759 prevent a touch inside a document of origin A to result in a click event being
2407         dispatched on an element inside a document of origin B. It accomplishes this by keeping track of the security
2408         origin of the last touch via m_potentialTapSecurityOrigin on WebPage. However, there exists a corner case in
2409         which m_potentialTapSecurityOrigin, set after touching a document in a subframe, may persist even after the user
2410         has finished interacting, causing taps in subsequent documents to not result in synthetic click events due to
2411         mismatched potential tap origins.
2412
2413         This may happen if the first user gesture happens inside an element in a subframe with touch event handlers, but
2414         no click event handler (and the touch is additionally not over some clickable element). In this case,
2415         m_potentialTapNode is set to null in WebPage::potentialTapAtPosition, and when we consult it in
2416         WebPage::commitPotentialTap, we just end up calling commitPotentialTapFailed(); and return early. This means
2417         that m_potentialTapNode, m_potentialTapLocation, and (importantly) m_potentialTapSecurityOrigin are not reset.
2418         This causes subsequent taps in the top-level document to never dispatch click events, if the security origin
2419         does not match with that of the subframe.
2420
2421         To fix this, we add a new async IPC message from the UI process to the web process to ensure that our current
2422         security origin is reset before attempting to handle a tap.
2423
2424         Test: http/tests/events/touch/ios/click-after-handling-touch-in-cross-origin-frame.https.html
2425
2426         * UIProcess/WebPageProxy.cpp:
2427         (WebKit::WebPageProxy::resetPotentialTapSecurityOrigin):
2428
2429         Reset any stale potential tap security origin if needed.
2430
2431         * UIProcess/WebPageProxy.h:
2432         * UIProcess/ios/WKContentViewInteraction.mm:
2433         (-[WKContentView _webTouchEventsRecognized:]):
2434
2435         Send the new IPC message when starting a touch.
2436
2437         * WebProcess/WebPage/WebPage.cpp:
2438         (WebKit::WebPage::resetPotentialTapSecurityOrigin):
2439         * WebProcess/WebPage/WebPage.h:
2440         * WebProcess/WebPage/WebPage.messages.in:
2441
2442 2019-07-05  Wenson Hsieh  <wenson_hsieh@apple.com>
2443
2444         Touching media controls sometimes shows software keyboard
2445         https://bugs.webkit.org/show_bug.cgi?id=199490
2446         <rdar://problem/52076270>
2447
2448         Reviewed by Eric Carlson.
2449
2450         In r243044, we added a compatibility hack for Google Slides (and other G-suite properties) to allow the on-
2451         screen keyboard to show up after a prevented touch event in the case where an element was already focused, even
2452         if the touch event handler doesn't explicitly refocus the element. However, this means that if a regular text
2453         field (or other form control) has been programmatically focused, then interacting with any other element that
2454         prevents default on touchstart will cause us to show the keyboard for that focused element.
2455
2456         To mitigate this, only fall down this refocusing codepath in the case where the focused element is a hidden
2457         editable element (in the style of many Google productivity web apps). For non-hidden editable elements that are
2458         already focused, this refocusing logic is not necessary, since the user should be able to interact with the
2459         control to show the keyboard anyways; for hidden editable areas, this compatibility hack is actually needed,
2460         since there is typically no other way for a user to focus these elements and show an on-screen keyboard.
2461
2462         Tests:  fast/events/touch/ios/show-keyboard-after-preventing-touchstart.html
2463                 fast/events/touch/ios/do-not-show-keyboard-after-preventing-touchstart.html
2464
2465         * WebProcess/WebPage/WebPage.cpp:
2466         (WebKit::WebPage::dispatchTouchEvent):
2467         * WebProcess/WebPage/WebPage.h:
2468         * WebProcess/WebPage/ios/WebPageIOS.mm:
2469         (WebKit::WebPage::isTransparentOrFullyClipped const):
2470
2471         Renamed from enclosingLayerIsTransparentOrFullyClipped, and pulled out into a private helper method.
2472
2473         (WebKit::WebPage::platformEditorState const):
2474         (WebKit::WebPage::requestEvasionRectsAboveSelection):
2475         (WebKit::WebPage::getFocusedElementInformation):
2476         (WebKit::enclosingLayerIsTransparentOrFullyClipped): Deleted.
2477
2478 2019-07-04  Chris Dumez  <cdumez@apple.com>
2479
2480         Simplify logic that handles registering WebProcessProxy objects with their WebsiteDataStore
2481         https://bugs.webkit.org/show_bug.cgi?id=199412
2482         <rdar://problem/51899751>
2483
2484         Reviewed by Ryosuke Niwa.
2485
2486         Simplify logic that handles registering WebProcessProxy objects with their WebsiteDataStore to make
2487         it more maintainable and less error-prone (avoid bugs like <rdar://problem/51899751>).
2488
2489         The following changes were made:
2490         1. The WebProcess now registers / unregisters itself directly with its WebsiteDataStore when needed,
2491            instead of having the WebPageProxy/ProvisionalPageProxy be in charge of calling the right
2492            WebProcessLifetimeTracker / WebProcessLifetimeObserver abstractions.
2493         2. The WebProcessLifetimeTracker / WebProcessLifetimeObserver abstractions were dropped. The
2494            WebsiteDataStore was the only observer.
2495         3. The WebProcessProxy is now registered with its WebsiteDataStore as soon as it has a page (provisional
2496            or not) instead of waiting until the process has finished launching. This simplifies the logic a
2497            lot and waiting until the process has launched is not needed by the WebsiteDataStore.
2498            
2499
2500         * Sources.txt:
2501         * UIProcess/ProvisionalPageProxy.cpp:
2502         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
2503         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
2504         * UIProcess/ProvisionalPageProxy.h:
2505         * UIProcess/WebPageProxy.cpp:
2506         (WebKit::m_resetRecentCrashCountTimer):
2507         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2508         (WebKit::WebPageProxy::close):
2509         (WebKit::WebPageProxy::processDidTerminate):
2510         * UIProcess/WebPageProxy.h:
2511         * UIProcess/WebProcessCache.cpp:
2512         (WebKit::WebProcessCache::CachedProcess::CachedProcess):
2513         * UIProcess/WebProcessLifetimeObserver.cpp: Removed.
2514         * UIProcess/WebProcessLifetimeObserver.h: Removed.
2515         * UIProcess/WebProcessLifetimeTracker.cpp: Removed.
2516         * UIProcess/WebProcessLifetimeTracker.h: Removed.
2517         * UIProcess/WebProcessProxy.cpp:
2518         (WebKit::WebProcessProxy::setWebsiteDataStore):
2519         (WebKit::WebProcessProxy::updateRegistrationWithDataStore):
2520         (WebKit::WebProcessProxy::addProvisionalPageProxy):
2521         (WebKit::WebProcessProxy::removeProvisionalPageProxy):
2522         (WebKit::WebProcessProxy::connectionWillOpen):
2523         (WebKit::WebProcessProxy::processWillShutDown):
2524         (WebKit::WebProcessProxy::addExistingWebPage):
2525         (WebKit::WebProcessProxy::removeWebPage):
2526         * UIProcess/WebProcessProxy.h:
2527         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2528         (WebKit::WebsiteDataStore::registerProcess):
2529         (WebKit::WebsiteDataStore::unregisterProcess):
2530
2531         (WebKit::WebsiteDataStore::processPoolForCookieStorageOperations):
2532         Drop change that was added in r246097 to work around the fact that WebProcessProxy objects
2533         were only registering themselves with their data store after their process had finished
2534         launching.
2535
2536         (WebKit::WebsiteDataStore::fetchDataAndApply):
2537         (WebKit::WebsiteDataStore::removeData):
2538         (WebKit::WebsiteDataStore::processPools const):
2539         * UIProcess/WebsiteData/WebsiteDataStore.h:
2540         (WebKit::WebsiteDataStore::processes const):
2541         * WebKit.xcodeproj/project.pbxproj:
2542
2543 2019-07-04  Zalan Bujtas  <zalan@apple.com>
2544
2545         [ContentChangeObserver] Limit mouseOut dispatching after synthetic click to YouTube.com
2546         https://bugs.webkit.org/show_bug.cgi?id=199497
2547         <rdar://problem/52361019>
2548
2549         Reviewed by Wenson Hsieh.
2550
2551         * WebProcess/WebPage/ios/WebPageIOS.mm:
2552         (WebKit::WebPage::completeSyntheticClick):
2553
2554 2019-07-03  Ryosuke Niwa  <rniwa@webkit.org>
2555
2556         Crash in WebDragClient::startDrag because GraphicsContext is nullptr
2557         https://bugs.webkit.org/show_bug.cgi?id=199491
2558
2559         Reviewed by Wenson Hsieh.
2560
2561         Added a nullptr check.
2562
2563         Unfortunately no new tests since we don't have a reproducible test case.
2564
2565         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
2566         (WebKit::convertImageToBitmap):
2567
2568 2019-07-03  Tim Horton  <timothy_horton@apple.com>
2569
2570         Data Detectors are not working for context menus in clients that use the legacy preview API
2571         https://bugs.webkit.org/show_bug.cgi?id=199486
2572         <rdar://problem/52117322>
2573
2574         Reviewed by Dean Jackson.
2575
2576         * UIProcess/ios/WKContentViewInteraction.mm:
2577         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
2578         The Data Detectors code in the legacy preview path is guarded by a
2579         #define that did not survive upstreaming. Remove it.
2580
2581 2019-07-03  Chris Dumez  <cdumez@apple.com>
2582
2583         StorageManager::suspend() sometimes fails to call its completion handler
2584         https://bugs.webkit.org/show_bug.cgi?id=199482
2585
2586         Reviewed by Youenn Fablet.
2587
2588         Make sure the completion handler gets called in the early return cases.
2589
2590         * NetworkProcess/WebStorage/StorageManager.cpp:
2591         (WebKit::StorageManager::suspend):
2592
2593 2019-07-03  Youenn Fablet  <youenn@apple.com>
2594
2595         Make CacheStorage::Engine directory listing operations in a background thread
2596         https://bugs.webkit.org/show_bug.cgi?id=199470
2597
2598         Reviewed by Chris Dumez.
2599
2600         Use the io work queue to get the list of directories.
2601         Then go back to main thread and trigger clear/fetch operation as currently done.
2602
2603         * NetworkProcess/cache/CacheStorageEngine.cpp:
2604         (WebKit::CacheStorage::ReadOriginsTaskCounter::create):
2605         (WebKit::CacheStorage::ReadOriginsTaskCounter::ReadOriginsTaskCounter):
2606         (WebKit::CacheStorage::Engine::getDirectories):
2607         (WebKit::CacheStorage::Engine::fetchEntries):
2608         (WebKit::CacheStorage::Engine::fetchDirectoryEntries):
2609         (WebKit::CacheStorage::Engine::clearCachesForOriginFromDisk):
2610         (WebKit::CacheStorage::Engine::clearCachesForOriginFromDirectories):
2611         * NetworkProcess/cache/CacheStorageEngine.h:
2612
2613 2019-07-03  Sihui Liu  <sihui_liu@apple.com>
2614
2615         Only allow fetching and removing session credentials from WebsiteDataStore
2616         https://bugs.webkit.org/show_bug.cgi?id=199385
2617
2618         Reviewed by Alex Christensen.
2619
2620         Stop sending an extra message to network process for fetching or removing persistent credentials.
2621
2622         * NetworkProcess/NetworkProcess.cpp:
2623         (WebKit::NetworkProcess::fetchWebsiteData):
2624         (WebKit::NetworkProcess::deleteWebsiteData):
2625         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2626         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
2627         (WebKit::NetworkProcess::originsWithPersistentCredentials): Deleted.
2628         (WebKit::NetworkProcess::removeCredentialsWithOrigins): Deleted.
2629         * NetworkProcess/NetworkProcess.h:
2630         * NetworkProcess/NetworkProcess.messages.in:
2631         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2632         (WebKit::NetworkProcess::originsWithPersistentCredentials): Deleted.
2633         (WebKit::NetworkProcess::removeCredentialsWithOrigins): Deleted.
2634         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2635         (WebKit::WebsiteDataStore::fetchDataAndApply):
2636         (WebKit::computeWebProcessAccessTypeForDataRemoval):
2637         (WebKit::WebsiteDataStore::removeData):
2638
2639 2019-07-03  Tim Horton  <timothy_horton@apple.com>
2640
2641         UI process exception when dragging an <attachment> with no content type
2642         https://bugs.webkit.org/show_bug.cgi?id=199480
2643         <rdar://problem/44351353>
2644
2645         Reviewed by Wenson Hsieh.
2646
2647         * UIProcess/API/Cocoa/APIAttachmentCocoa.mm:
2648         (API::Attachment::mimeType const):
2649         (API::Attachment::utiType const):
2650         * UIProcess/Cocoa/WebViewImpl.mm:
2651         (WebKit::WebViewImpl::startDrag):
2652         Make null or empty contentType fail the drag, instead of crashing.
2653
2654 2019-07-03  Chris Dumez  <cdumez@apple.com>
2655
2656         Clarify threading model for WebResourceLoadStatisticsStore::dumpResourceLoadStatistics()
2657         https://bugs.webkit.org/show_bug.cgi?id=199468
2658
2659         Reviewed by Youenn Fablet.
2660
2661         Our convention is that the WebResourceLoadStatisticsStore is always created, used and
2662         destroyed on the main thread, while the ResourceLoadStatisticsStore is always created,
2663         used and destroyed on the background queue.
2664
2665         r245517 broke this convention by introducing a tryDumpResourceLoadStatistics() method
2666         to WebResourceLoadStatisticsStore which gets called on the background queue. This patch
2667         fixes this since this has been a huge source of thread-safety bugs in the past.
2668
2669         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2670         (WebKit::ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics):
2671         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
2672         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2673         (WebKit::ResourceLoadStatisticsMemoryStore::dumpResourceLoadStatistics):
2674         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
2675         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
2676         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
2677         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
2678         (WebKit::ResourceLoadStatisticsStore::dataRecordsBeingRemoved const):
2679         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2680         (WebKit::WebResourceLoadStatisticsStore::dumpResourceLoadStatistics):
2681         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2682
2683 2019-07-03  Jonathan Bedard  <jbedard@apple.com>
2684
2685         [Catalina] Enable WebKit build
2686         https://bugs.webkit.org/show_bug.cgi?id=199209
2687
2688         Reviewed by Darin Adler.
2689
2690         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.h: AppSSO is SPI.
2691         * WebKit2Prefix.h: SecTask.h declares SecTaskGetCodeSignStatus(...) unavailable
2692         on Mac, exclude this header.
2693
2694 2019-07-03  Daniel Bates  <dabates@apple.com>
2695
2696         REGRESSION (r246817): fast/events/ios/key-events-comprehensive/key-events-{control, control-shift}.html are failing
2697         https://bugs.webkit.org/show_bug.cgi?id=199465
2698         <rdar://problem/52613496>
2699
2700         Reviewed by Wenson Hsieh.
2701
2702         Don't advertise that WebKit can perform cursor movements when there isn't some kind of selection.
2703
2704         * UIProcess/ios/WKContentViewInteraction.mm:
2705         (-[WKContentView canPerformAction:withSender:]):
2706
2707 2019-07-03  Chris Dumez  <cdumez@apple.com>
2708
2709         Fix a couple of thread safety issues in ResourceLoadStatisticsStore
2710         https://bugs.webkit.org/show_bug.cgi?id=199463
2711
2712         Reviewed by Alex Christensen.
2713
2714         The ResourceLoadStatisticsStore object is constructed / used / destroyed on a background queue.
2715         It is therefore not safe to use a WeakPtr to the ResourceLoadStatisticsStore on the main thread.
2716
2717         The safe pattern is to have the ResourceLoadStatisticsStore capture a Ref<> of its m_store before
2718         dispatching to the main thread and use this store on the main thread instead of weakThis->m_store.
2719         ResourceLoadStatisticsStore's m_store is constructed / used / destroyed on the main thread.
2720
2721         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
2722         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
2723         (WebKit::ResourceLoadStatisticsStore::processStatisticsAndDataRecords):
2724
2725 2019-07-03  Youenn Fablet  <youenn@apple.com>
2726
2727         Isolate CacheStorage::Engine path when hopping to a background thread
2728         https://bugs.webkit.org/show_bug.cgi?id=199461
2729
2730         Reviewed by Chris Dumez.
2731
2732         * NetworkProcess/cache/CacheStorageEngine.cpp:
2733         (WebKit::CacheStorage::Engine::initialize):
2734
2735 2019-07-03  Jer Noble  <jer.noble@apple.com>
2736
2737         Unreviewed, rolling out r246053.
2738
2739         This changeset caused media playback to break when the hosting app was backgrounded.
2740
2741         * UIProcess/ApplicationStateTracker.mm:
2742         * UIProcess/ios/ProcessAssertionIOS.mm:
2743         (-[WKProcessAssertionBackgroundTaskManager init]):
2744         (-[WKProcessAssertionBackgroundTaskManager _scheduleReleaseTask]):
2745         (-[WKProcessAssertionBackgroundTaskManager _cancelPendingReleaseTask]):
2746         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
2747         (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]):
2748
2749 2019-07-03  Alex Christensen  <achristensen@webkit.org>
2750
2751         Use smarter pointers in WKDownloadProgress
2752         https://bugs.webkit.org/show_bug.cgi?id=199456
2753         <rdar://problem/51392926>
2754
2755         Reviewed by Chris Dumez.
2756
2757         There's still a problem related to our use of raw pointers.  Let's just not use raw pointers.
2758
2759         * NetworkProcess/Downloads/Download.h:
2760         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
2761         (WebKit::Download::publishProgress):
2762         * NetworkProcess/Downloads/cocoa/WKDownloadProgress.h:
2763         * NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm:
2764         (-[WKDownloadProgress performCancel]):
2765         (-[WKDownloadProgress initWithDownloadTask:download:URL:sandboxExtension:]):
2766         (-[WKDownloadProgress progressCancelled]): Deleted.
2767
2768 2019-07-03  Sam Weinig  <weinig@apple.com>
2769
2770         Adopt simple structured bindings in more places
2771         https://bugs.webkit.org/show_bug.cgi?id=199247
2772
2773         Reviewed by Alex Christensen.
2774
2775         Replaces simple uses of std::tie() with structured bindings. Does not touch
2776         uses of std::tie() that are not initial declarations, use std::ignore or in
2777         case where the binding is captured by a lambda, as structured bindings don't
2778         work for those cases yet.
2779
2780         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2781         (WebKit::NetworkCache::printSpeculativeLoadingDiagnosticMessageCounts):
2782         * NetworkProcess/cache/PrefetchCache.cpp:
2783         (WebKit::PrefetchCache::clearExpiredEntries):
2784         * Platform/IPC/MessageReceiverMap.cpp:
2785         (IPC::MessageReceiverMap::removeMessageReceiver):
2786         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
2787         (WebKit::PlaybackSessionManagerProxy::invalidate):
2788         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2789         (WebKit::VideoFullscreenManagerProxy::invalidate):
2790         (WebKit::VideoFullscreenManagerProxy::requestHideAndExitFullscreen):
2791         (WebKit::VideoFullscreenManagerProxy::hasMode const):
2792         (WebKit::VideoFullscreenManagerProxy::mayAutomaticallyShowVideoPictureInPicture const):
2793         (WebKit::VideoFullscreenManagerProxy::isPlayingVideoInEnhancedFullscreen const):
2794         (WebKit::VideoFullscreenManagerProxy::applicationDidBecomeActive):
2795         (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
2796         (WebKit::VideoFullscreenManagerProxy::didCleanupFullscreen):
2797         * UIProcess/ios/SmartMagnificationController.mm:
2798         (WebKit::SmartMagnificationController::zoomFactorForTargetRect):
2799         (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
2800         (WebKit::SmartMagnificationController::magnify):
2801         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2802         (WebKit:: const):
2803         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
2804         (WebKit::WebPage::performDictionaryLookupAtLocation):
2805         (WebKit::WebPage::performDictionaryLookupForSelection):
2806         * WebProcess/cocoa/PlaybackSessionManager.mm:
2807         (WebKit::PlaybackSessionManager::~PlaybackSessionManager):
2808         (WebKit::PlaybackSessionManager::removeContext):
2809         * WebProcess/cocoa/VideoFullscreenManager.mm:
2810         (WebKit::VideoFullscreenManager::~VideoFullscreenManager):
2811         (WebKit::VideoFullscreenManager::removeContext):
2812         (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement):
2813         (WebKit::VideoFullscreenManager::requestVideoContentLayer):
2814         (WebKit::VideoFullscreenManager::didSetupFullscreen):
2815         (WebKit::VideoFullscreenManager::willExitFullscreen):
2816         (WebKit::VideoFullscreenManager::didEnterFullscreen):
2817         (WebKit::VideoFullscreenManager::didCleanupFullscreen):
2818         (WebKit::VideoFullscreenManager::setVideoLayerFrameFenced):
2819
2820 2019-07-03  Zalan Bujtas  <zalan@apple.com>
2821
2822         [ContentChangeObserver] REGRESSION (r244356): Drop down menus collapse without user input - Ebay.com
2823         https://bugs.webkit.org/show_bug.cgi?id=199457
2824         <rdar://problem/52386563>
2825
2826         Reviewed by Simon Fraser.
2827
2828         There's a fixed, 32ms window for observing content changes after the tap is committed. r244356 introduced the fast-click behavior on form elements by omitting this fixed window and
2829         dispatch the synthetic click on the target node.
2830         This patch preserves the fast-click behavior, but now we stay at hover if the mouseMove event triggers a synchronous actionable visiblity change (as opposed to always proceed with click).
2831
2832         * WebProcess/WebPage/ios/WebPageIOS.mm:
2833         (WebKit::WebPage::handleSyntheticClick):
2834
2835 2019-07-03  Patrick Griffis  <pgriffis@igalia.com>
2836
2837         [GTK][WPE] Remove Flatpak sandbox
2838         https://bugs.webkit.org/show_bug.cgi?id=199416
2839
2840         Reviewed by Michael Catanzaro.
2841
2842         The flatpak-spawn based sandbox was only a proof of concept and
2843         lacks flexibility for our needs so we ended up using it with very
2844         permissive permissions and it still imposed limitations that our main
2845         bubblewrap sandbox didn't have.
2846
2847         So in order to get as many applications using the sandbox as possible we
2848         will just remove this for now and focus on bubblewrap. At some point
2849         it may be possible to improve flatpak-spawn to fit our needs.
2850
2851         * SourcesGTK.txt:
2852         * SourcesWPE.txt:
2853         * UIProcess/Launcher/glib/FlatpakLauncher.cpp: Removed.
2854         * UIProcess/Launcher/glib/FlatpakLauncher.h: Removed.
2855         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2856         (WebKit::ProcessLauncher::launchProcess):
2857
2858 2019-07-03  Ryan Haddad  <ryanhaddad@apple.com>
2859
2860         Unreviewed, rolling out r246616.
2861
2862         Caused http/tests/inspector/network/har/har-page.html to fail
2863         on Catalina.
2864
2865         Reverted changeset:
2866
2867         "Web Inspector: Network: replace CFNetwork SPI with new API
2868         where able"
2869         https://bugs.webkit.org/show_bug.cgi?id=198762
2870         https://trac.webkit.org/changeset/246616
2871
2872 2019-07-03  Chris Dumez  <cdumez@apple.com>
2873
2874         Crash under WTF::RefCounted<WebKit::TaskCounter>::deref()
2875         https://bugs.webkit.org/show_bug.cgi?id=199453
2876         <rdar://problem/51991477>
2877
2878         Reviewed by Youenn Fablet.
2879
2880         The crash was caused by StorageManager::suspend() getting called on the main thread but calling
2881         its completion handler on a background queue. The completion handler was capturing a TaskCounter
2882         object which is RefCounted (not ThreadSafeRefCounted).
2883
2884         Address the issue by making sure StorageManager::suspend() calls its completion handler on the
2885         main thread. Also get rid of TaskCounter and use a WTF::CallbackAggregator instead.
2886
2887         * NetworkProcess/NetworkProcess.cpp:
2888         (WebKit::NetworkProcess::actualPrepareToSuspend):
2889         (WebKit::TaskCounter::TaskCounter): Deleted.
2890         (WebKit::TaskCounter::~TaskCounter): Deleted.
2891         * NetworkProcess/WebStorage/StorageManager.cpp:
2892         (WebKit::StorageManager::suspend):
2893
2894 2019-07-03  Youenn Fablet  <youenn@apple.com>
2895
2896         Make sure to cross-thread copy in StorageManager when hopping back to the main thread
2897         https://bugs.webkit.org/show_bug.cgi?id=199423
2898
2899         Reviewed by Chris Dumez.
2900
2901         Make sure to isolate copy some strings that may not be isolated in case of ephemeral sessions.
2902         Small refactoring to use crossThreadCopy instead of doing vector copy ourselves.
2903
2904         * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.h:
2905         (WebKit::LocalStorageDatabaseTracker::OriginDetails::isolatedCopy const):
2906         * NetworkProcess/WebStorage/StorageManager.cpp:
2907         (WebKit::StorageManager::deleteSessionStorageEntriesForOrigins):
2908         (WebKit::StorageManager::getLocalStorageOrigins):
2909         (WebKit::StorageManager::getLocalStorageOriginDetails):
2910         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
2911
2912 2019-07-02  Joonghun Park  <jh718.park@samsung.com>
2913
2914         Unreviewed. Fix build break introduced in r247058.
2915
2916         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
2917
2918 2019-07-02  Youenn Fablet  <youenn@apple.com>
2919
2920         StorageManager does not need to be a WorkQueueMessageReceiver anymore
2921         https://bugs.webkit.org/show_bug.cgi?id=199421
2922
2923         Reviewed by Chris Dumez.
2924
2925         * NetworkProcess/WebStorage/StorageManager.h:
2926
2927 2019-07-02  Chris Dumez  <cdumez@apple.com>
2928
2929         ThreadSafeRefCounted<DestructionThread::Main> is not safe to use in the UIProcess
2930         https://bugs.webkit.org/show_bug.cgi?id=199420
2931         <rdar://problem/52289717>
2932
2933         Reviewed by Ryosuke Niwa.
2934
2935         Update IPC::Connection and DeviceIdHashSaltStorage to use DestructionThread::MainRunLoop
2936         instead of DestructionThread::Main, since both classes are used in the UIProcess.
2937
2938         Using DestructionThread::Main is not safe in the UIProcess because its implementation relies
2939         on isMainThread() / callOnMainThread(). Those get confused about which thread is the main
2940         thread when an application uses both WK1 and WK2.
2941
2942         * Platform/IPC/Connection.h:
2943         * UIProcess/DeviceIdHashSaltStorage.h:
2944
2945 2019-07-02  Patrick Griffis  <pgriffis@igalia.com>
2946
2947         [GTK][WPE] Explicitly blacklist problematic directories for sandbox
2948         https://bugs.webkit.org/show_bug.cgi?id=199367
2949
2950         Reviewed by Michael Catanzaro.
2951
2952         There are some directories that simply do not make sense to bind into the sandbox
2953         and will only cause issues such as `/proc` so lets just block them.
2954
2955         * UIProcess/API/glib/WebKitWebContext.cpp:
2956         (path_is_not_blacklisted):
2957         (webkit_web_context_add_path_to_sandbox):
2958
2959 2019-07-02  Tim Horton  <timothy_horton@apple.com>
2960
2961         REGRESSION (r243240): Unable to swipe back in Safari
2962         https://bugs.webkit.org/show_bug.cgi?id=199394
2963         <rdar://problem/51137447>
2964
2965         Reviewed by Wenson Hsieh.
2966
2967         * UIProcess/API/Cocoa/WKWebView.mm:
2968         (-[WKWebView _processDidExit]):
2969         r243240 started nilling out the ViewGestureController, but we don't actually
2970         expect that; the only time WKWebView's ViewGestureController goes away
2971         is if the client turns off the gestures... and so nothing ever puts it back.
2972         Instead, just always disconnect, don't nil it out.
2973
2974 2019-07-02  Chris Dumez  <cdumez@apple.com>
2975
2976         Protect NetworkProcess::m_networkSessions against corruption
2977         https://bugs.webkit.org/show_bug.cgi?id=199418
2978         <rdar://problem/50614019>
2979
2980         Reviewed by Youenn Fablet.
2981
2982         I believe the most likely reason for the crash at <rdar://problem/50614019> is that NetworkProcess::m_networkSessions
2983         is getting corrupted and is returning us a bad pointer.
2984
2985         To harden our code, I added debug assertions to make sure that this HashMap is only used on the main thread and
2986         to make sure that the sessionID used as key is always valid. I have also added if checks to avoid crashing in
2987         release whenever possible.
2988
2989         Note that we came to a similar conclusion for NetworkProcess::m_swServers when investigating rdar://problem/51859081,
2990         so the two radars are potentially related. Both HashMaps are owned by the NetworkProcess and use a SessionID
2991         as key.
2992
2993         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2994         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
2995         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
2996         (WebKit::NetworkConnectionToWebProcess::logUserInteraction):
2997         (WebKit::NetworkConnectionToWebProcess::logWebSocketLoading):
2998         (WebKit::NetworkConnectionToWebProcess::logSubresourceLoading):
2999         (WebKit::NetworkConnectionToWebProcess::logSubresourceRedirect):
3000         (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
3001         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
3002         (WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
3003         * NetworkProcess/NetworkProcess.cpp:
3004         (WebKit::NetworkProcess::networkSession const):
3005         (WebKit::NetworkProcess::setSession):
3006         (WebKit::NetworkProcess::destroySession):
3007         (WebKit::NetworkProcess::addKeptAliveLoad):
3008         (WebKit::NetworkProcess::removeKeptAliveLoad):
3009         (WebKit::NetworkProcess::webProcessWasDisconnected):
3010         * NetworkProcess/NetworkProcess.h:
3011         * NetworkProcess/NetworkResourceLoader.cpp:
3012         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
3013         (WebKit::NetworkResourceLoader::didFinishWithRedirectResponse):
3014         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
3015         (WebKit::NetworkResourceLoader::shouldLogCookieInformation):
3016         * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm:
3017         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorBoundInterfaceIdentifier):
3018         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType):
3019         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationBundleIdentifier):
3020         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationSecondaryIdentifier):
3021
3022 2019-07-02  Chris Dumez  <cdumez@apple.com>
3023
3024         VisitedLinkStore does not need to subclass WebProcessLifetimeObserver
3025         https://bugs.webkit.org/show_bug.cgi?id=199407
3026
3027         Reviewed by Sam Weinig.
3028
3029         VisitedLinkStore does not need to subclass WebProcessLifetimeObserver, it overrides
3030         only 2 of WebProcessLifetimeObserver's functions and the implementation of those
3031         overrides is empty. It also does not use WebProcessLifetimeObserver::processes()
3032         since the VisitedLinkStore maintains its own list of processes.
3033
3034         * UIProcess/API/mac/WKView.mm:
3035         * UIProcess/Automation/WebAutomationSession.cpp:
3036         * UIProcess/VisitedLinkStore.cpp:
3037         * UIProcess/VisitedLinkStore.h:
3038         * UIProcess/WebPageProxy.cpp:
3039         (WebKit::m_resetRecentCrashCountTimer):
3040         * UIProcess/WebProcessPool.h:
3041         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3042
3043 2019-07-02  Chris Dumez  <cdumez@apple.com>
3044
3045         Null dereference under StorageManager::destroySessionStorageNamespace()
3046         https://bugs.webkit.org/show_bug.cgi?id=199388
3047         <rdar://problem/52030641>
3048
3049         Reviewed by Youenn Fablet.
3050
3051         * NetworkProcess/WebStorage/StorageManager.cpp:
3052         (WebKit::StorageManager::createSessionStorageNamespace):
3053         Call HashMap::ensure() instead of contains() + set() to avoid double hash lookup.
3054
3055         (WebKit::StorageManager::destroySessionStorageNamespace):
3056         Add null check to address top crasher, similarly to what was done in r246552.
3057         I am keeping the debug assertion since this is not supposed to happen.
3058
3059 2019-07-02  Daniel Bates  <dabates@apple.com>
3060
3061         [iOS] Cannot tab cycle through credit card fields on antonsvpatisserie.com checkout page
3062         https://bugs.webkit.org/show_bug.cgi?id=196053
3063         <rdar://problem/49093034>
3064
3065         Reviewed by Wenson Hsieh.
3066
3067         Allow iframes to be keyboard focusable when pressing the Tab key on the keyboard. This
3068         also allow the that the focus controller to search their content document for other
3069         editable elements. This makes iOS match the behavior on Mac.
3070
3071         Although iframes can be focused by pressing the Tab key we maintain the current UI
3072         restriction on iOS of not allowing iframes themselves to be focusable via the next and
3073         previous accessory bar buttons. We do this because it's unclear what value supporting
3074         such focusing brings, but it's clear that doing so makes tab cycling more confusing
3075         since the default focus appearance for an iframe is indistinguishable from its non-
3076         focused appearance.
3077
3078         * WebProcess/WebPage/ios/WebPageIOS.mm:
3079         (WebKit::isAssistableElement): Do not consider an iframe as assistable.
3080
3081 2019-07-02  Alexander Mikhaylenko  <exalm7659@gmail.com>
3082
3083         [GTK] Support cancelling touchscreen back/forward gesture
3084         https://bugs.webkit.org/show_bug.cgi?id=199401
3085
3086         Reviewed by Michael Catanzaro.
3087
3088         It should be possible to cancel the gesture when performing it on
3089         touchscreen, for example, by moving pen too far from the screen.
3090         Handle this case properly.
3091
3092         Only DragGesture in GestureController needs to handle this,
3093         SwipeGesture simply won't emit the relevant event in this case.
3094
3095         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3096         * UIProcess/ViewGestureController.h:
3097         * UIProcess/gtk/GestureController.cpp:
3098         (WebKit::GestureController::DragGesture::cancelDrag):
3099         (WebKit::GestureController::DragGesture::cancel):
3100         (WebKit::GestureController::DragGesture::DragGesture):
3101         * UIProcess/gtk/GestureController.h:
3102         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
3103         (WebKit::ViewGestureController::platformTeardown):
3104         (WebKit::ViewGestureController::cancelSwipe):
3105
3106 2019-07-02  Devin Rousso  <drousso@apple.com>
3107
3108         Web Inspector: Debug: "Reset Web Inspector" should also clear the saved window size and attachment side
3109         https://bugs.webkit.org/show_bug.cgi?id=198956
3110
3111         Reviewed by Matt Baker.
3112
3113         * UIProcess/WebPreferences.h:
3114         * UIProcess/WebPreferences.cpp:
3115         (WebKit::WebPreferences::deleteKey): Added.
3116         * UIProcess/gtk/WebPreferencesGtk.cpp:
3117         (WebKit::WebPreferences::platformDeleteKey): Added.
3118         * UIProcess/mac/WebPreferencesMac.mm:
3119         (WebKit::WebPreferences::platformDeleteKey): Added.
3120         * UIProcess/wpe/WebPreferencesWPE.cpp:
3121         (WebKit::WebPreferences::platformDeleteKey): Added.
3122         * UIProcess/win/WebPreferencesWin.cpp:
3123         (WebKit::WebPreferences::platformDeleteKey): Added.
3124         * Shared/WebPreferencesStore.h:
3125         * Shared/WebPreferencesStore.cpp:
3126         (WebKit::WebPreferencesStore::deleteKey): Added.
3127
3128         * UIProcess/WebInspectorProxy.messages.in:
3129         * UIProcess/WebInspectorProxy.h:
3130         * UIProcess/WebInspectorProxy.cpp:
3131         (WebKit::WebInspectorProxy::resetWindowState): Added.
3132         (WebKit::WebInspectorProxy::platformResetWindowState): Added.
3133         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
3134         (WebKit::WebInspectorProxy::platformResetWindowState): Added.
3135         * UIProcess/mac/WebInspectorProxyMac.mm:
3136         (WebKit::WebInspectorProxy::platformResetWindowState): Added.
3137         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
3138         (WebKit::WebInspectorProxy::platformResetWindowState): Added.
3139         * UIProcess/win/WebInspectorProxyWin.cpp:
3140         (WebKit::WebInspectorProxy::platformResetWindowState): Added.
3141         * WebProcess/WebPage/WebInspectorUI.h:
3142         * WebProcess/WebPage/WebInspectorUI.cpp:
3143         (WebKit::WebInspectorUI::resetWindowState): Added.
3144
3145         * UIProcess/RemoteWebInspectorProxy.messages.in:
3146         * UIProcess/RemoteWebInspectorProxy.h:
3147         * UIProcess/RemoteWebInspectorProxy.cpp:
3148         (WebKit::RemoteWebInspectorProxy::resetWindowState): Added.
3149         (WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
3150         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
3151         (WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
3152         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
3153         (WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
3154         * UIProcess/win/RemoteWebInspectorProxyWin.cpp:
3155         (WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
3156         * WebProcess/WebPage/RemoteWebInspectorUI.h:
3157         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
3158         (WebKit::RemoteWebInspectorUI::resetWindowState): Added.
3159
3160 2019-07-01  Chris Dumez  <cdumez@apple.com>
3161
3162         Remove virtual functions on WebProcessLifetimeObserver that are unused after r245540
3163         https://bugs.webkit.org/show_bug.cgi?id=199383
3164
3165         Reviewed by Alex Christensen.
3166
3167         * UIProcess/WebProcessLifetimeObserver.h:
3168         (WebKit::WebProcessLifetimeObserver::webProcessDidCloseConnection):
3169         * UIProcess/WebProcessLifetimeTracker.cpp:
3170         (WebKit::WebProcessLifetimeTracker::addObserver):
3171         (WebKit::WebProcessLifetimeTracker::pageWasInvalidated):
3172
3173 2019-07-01  Chris Dumez  <cdumez@apple.com>
3174
3175         StorageManager::SessionStorageNamespace::allowedConnections() should not copy the HashSet
3176         https://bugs.webkit.org/show_bug.cgi?id=199379
3177
3178         Reviewed by Alex Christensen.
3179
3180         This was pretty inefficient.
3181
3182         * NetworkProcess/WebStorage/StorageManager.cpp:
3183         (WebKit::StorageManager::SessionStorageNamespace::allowedConnections const):
3184
3185 2019-07-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3186
3187         [iOS] REGRESSION (r246757): Unable to select non-editable text in subframes
3188         https://bugs.webkit.org/show_bug.cgi?id=199366
3189         <rdar://problem/52460509>
3190
3191         Reviewed by Tim Horton.
3192
3193         r246757 removed logic in selectionPositionInformation responsible for setting the focused frame when handling a
3194         position information request. As the FIXME formerly in InteractionInformationRequest.h alluded to, text
3195         selection gestures on iOS were dependent on this behavior when selecting text in subframes, since text selection
3196         helpers in WebPageIOS.mm assume that the focused frame already contains the selection being set.
3197
3198         Rather than calling setFocusedFrame when requesting position information, we can fix this by making
3199         WebPage::selectWithGesture and WebPage::selectTextWithGranularityAtPoint both set the focused frame if needed
3200         before extending or moving text selections.
3201
3202         Covered by layout tests that began to fail after r246757:
3203         - editing/selection/ios/selection-handles-in-iframe.html
3204         - editing/selection/ios/selection-handle-clamping-in-iframe.html
3205
3206         * WebProcess/WebPage/WebPage.h:
3207         * WebProcess/WebPage/ios/WebPageIOS.mm:
3208         (WebKit::WebPage::selectWithGesture):
3209
3210         Only call the new helper method, setFocusedFrameBeforeSelectingTextAtLocation, at the start of the gesture.
3211
3212         (WebKit::WebPage::setFocusedFrameBeforeSelectingTextAtLocation):
3213         (WebKit::WebPage::selectTextWithGranularityAtPoint):
3214
3215 2019-07-01  Alex Christensen  <achristensen@webkit.org>
3216
3217         Add new decidePolicyForNavigationAction SPI with preferences and userInfo
3218         https://bugs.webkit.org/show_bug.cgi?id=199371
3219         <rdar://problem/52352905>
3220
3221         Reviewed by Tim Horton.
3222
3223         Also deprecate some older SPI so we may someday clean up this mess.
3224
3225         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
3226         * UIProcess/Cocoa/NavigationState.h:
3227         * UIProcess/Cocoa/NavigationState.mm:
3228         (WebKit::NavigationState::setNavigationDelegate):
3229         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3230         (WebKit::NavigationState::NavigationClient::shouldBypassContentModeSafeguards const):
3231
3232 2019-07-01  Alex Christensen  <achristensen@webkit.org>
3233
3234         Deprecate but still call _webView:showCustomSheetForElement: after transition to UIContextMenuInteraction
3235         https://bugs.webkit.org/show_bug.cgi?id=199296
3236         <rdar://problem/51041960>
3237
3238         Reviewed by Darin Adler.
3239
3240         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3241         * UIProcess/ios/WKContentViewInteraction.mm:
3242         (-[WKContentView _showAttachmentSheet]):
3243         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
3244         (-[WKContentView continueContextMenuInteraction:]):
3245
3246 2019-07-01  Alex Christensen  <achristensen@webkit.org>
3247
3248         Add main thread assertions in sendWithAsyncReply code
3249         https://bugs.webkit.org/show_bug.cgi?id=199324
3250
3251         Reviewed by Sam Weinig.
3252
3253         sendWithAsyncReply can only be used on the main thread because
3254         the CompletionHandler will be called on the main thread, and if it's
3255         called from a background thread, then HashMap corruption will likely happen.
3256         Add assertions to alert developers that they should only call sendWithAsyncReply
3257         from the main thread.
3258
3259         This is responding to good feedback from r237294
3260
3261         * Platform/IPC/Connection.cpp:
3262         (IPC::asyncReplyHandlerMap):
3263         (IPC::nextAsyncReplyHandlerID):
3264         (IPC::addAsyncReplyHandler):
3265         (IPC::clearAsyncReplyHandlers):
3266         (IPC::CompletionHandler<void):
3267
3268 2019-07-01  Eric Carlson  <eric.carlson@apple.com>
3269
3270         [iOS] Exiting from fullscreen scrolls to top of page
3271         https://bugs.webkit.org/show_bug.cgi?id=199338
3272         <rdar://problem/51273017>
3273
3274         Reviewed by Jer Noble.
3275
3276         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3277         (-[WKFullScreenWindowController _completedExitFullScreen]): Restore scroll position.
3278         Hide window after restoring scroll position.
3279         (-[WKFullScreenWindowController _exitFullscreenImmediately]): Drive-by fix: remove code
3280         already also done in _completedExitFullScreen.
3281
3282 2019-07-01  Zalan Bujtas  <zalan@apple.com>
3283
3284         Tapping on the bottom part of youtube video behaves as if controls were visible
3285         https://bugs.webkit.org/show_bug.cgi?id=199349
3286         <rdar://problem/51955744>
3287
3288         Reviewed by Simon Fraser.
3289
3290         * WebProcess/WebPage/WebPage.cpp:
3291         (WebKit::handleTouchEvent):
3292         * WebProcess/WebPage/WebPage.h:
3293         * WebProcess/WebPage/ios/WebPageIOS.mm:
3294         (WebKit::WebPage::handleSyntheticClick):
3295         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
3296         (WebKit::WebPage::completeSyntheticClick):
3297         (WebKit::WebPage::potentialTapAtPosition):
3298
3299 2019-07-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3300
3301         iOS: REGRESSION(async scroll): Caret doesn't scroll when scrolling textarea
3302         https://bugs.webkit.org/show_bug.cgi?id=198217
3303         <rdar://problem/51097296>
3304
3305         Reviewed by Simon Fraser.
3306
3307         In iOS 12, when scrolling a text selection in an fast-scrolling container, editor state updates are scheduled
3308         under AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll after the end of the scrolling gesture,
3309         when the scrolling layer action is ScrollingLayerPositionAction::Set. This is no longer the case in iOS 13,
3310         because we now bail in ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling after scroll deceleration
3311         finishes since the scroll position didn't end up changing. Additionally, we no longer use
3312         ScrollingLayerPositionAction::Set in the case where scrolling finished decelerating, since
3313         ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll no longer uses to value of inUserInteraction to
3314         determine whether to Set or Sync scrolling layer positions.
3315
3316         To restore iOS 12 behavior, ensure that we send a scrolling tree update using ScrollingLayerPositionAction::Set
3317         after scrolling ends.
3318
3319         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
3320         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll):
3321
3322 2019-07-01  Per Arne Vollan  <pvollan@apple.com>
3323
3324         Perform less work when a pre-warmed WebProcess is suspended or resumed.
3325         https://bugs.webkit.org/show_bug.cgi?id=199195
3326
3327         Reviewed by Darin Adler.
3328
3329         Return early from WebProcess::actualPrepareToSuspend and WebProcess::processDidResume
3330         if this is a pre-warmed process. This is a confirmed improvement in page load time.
3331
3332         * WebProcess/WebProcess.cpp:
3333         (WebKit::WebProcess::actualPrepareToSuspend):
3334         (WebKit::WebProcess::cancelPrepareToSuspend):
3335         (WebKit::WebProcess::processDidResume):
3336
3337 2019-07-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3338
3339         WebSockets: add support for sending blob messages when using web sockets platform APIs
3340         https://bugs.webkit.org/show_bug.cgi?id=199189
3341
3342         Reviewed by Youenn Fablet.
3343
3344         Add helper private class BlobLoader that uses FileReaderLoader to load the blobs. Since blob loads are
3345         asynchronous, the messages are queued using another helper internal class PendingMessage.
3346
3347         * WebProcess/Network/WebSocketChannel.cpp:
3348         (WebKit::WebSocketChannel::increaseBufferedAmount): Increase the buffered amount checking we don't overlofw.
3349         (WebKit::WebSocketChannel::decreaseBufferedAmount): Decrease the buffered amount.
3350         (WebKit::WebSocketChannel::sendMessage): Helper class to send message to the network process and decrease the
3351         buffered amount when done.
3352         (WebKit::WebSocketChannel::send): Queue the message in pending queue if there are pending messages in the queue
3353         for text and binary messages. For blobs, always queue the message unless it's an empty blob that we can handle
3354         as empty binary data directly.
3355         (WebKit::PendingMessage::PendingMessage): Helper class to queue message requests.
3356         (WebKit::PendingMessage::type const): Type of message: Text, Binary, Blob.
3357         (WebKit::PendingMessage::textMessage const): The text message.
3358         (WebKit::PendingMessage::binaryData const): The binary data.
3359         (WebKit::PendingMessage::blobLoader const): The blob loader.
3360         (WebKit::WebSocketChannel::fail): Notify the client about the error to ensure onclose is emitted.
3361         (WebKit::WebSocketChannel::disconnect): Clear the pending messages queue.
3362         * WebProcess/Network/WebSocketChannel.h:
3363
3364 2019-07-01  Miguel Gomez  <magomez@igalia.com>
3365
3366         [WPE][GTK] Content disappearing when using CSS transforms
3367         https://bugs.webkit.org/show_bug.cgi?id=181757
3368
3369         Reviewed by Žan Doberšek.
3370
3371         Set the appropriate AnimatedBackingStoreClient to the TextureMapperLayers when required.
3372
3373         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3374         (WebKit::CoordinatedGraphicsScene::updateSceneState):
3375
3376 2019-06-30  Antti Koivisto  <antti@apple.com>
3377
3378         Use separate variables for moving and stationary scrolling relationships in RemoteLayerTreeNode
3379         https://bugs.webkit.org/show_bug.cgi?id=199348
3380
3381         Reviewed by Darin Adler.
3382
3383         A layer can have only one acting scroll parent. Not using a vector for that case makes the code clearer.
3384
3385         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
3386         (WebKit::RemoteLayerTreeNode::actingScrollContainerID const):
3387         (WebKit::RemoteLayerTreeNode::stationaryScrollContainerIDs const):
3388
3389         Separate fields for the acting container and stationary containers.
3390
3391         (WebKit::RemoteLayerTreeNode::setActingScrollContainerID):
3392         (WebKit::RemoteLayerTreeNode::setStationaryScrollContainerIDs):
3393         (WebKit::RemoteLayerTreeNode::relatedScrollContainerIDs const): Deleted.
3394         (WebKit::RemoteLayerTreeNode::relatedScrollContainerPositioningBehavior const): Deleted.
3395         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
3396         (WebKit::RemoteLayerTreeNode::setRelatedScrollContainerBehaviorAndIDs): Deleted.
3397         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
3398         (WebKit::isScrolledBy):
3399         (WebKit::findActingScrollParent):
3400         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
3401         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
3402
3403 2019-06-30  Fujii Hironori  <Hironori.Fujii@sony.com>
3404
3405         [Win] Multiline mode of tooltip control does word-wrapping very slowly
3406         https://bugs.webkit.org/show_bug.cgi?id=198989
3407
3408         Reviewed by Ross Kirsling.
3409
3410         * UIProcess/win/WebView.cpp:
3411         (WebKit::truncatedString): Added.
3412         (WebKit::WebView::setToolTip): Use truncatedString.
3413
3414 2019-06-30  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3415
3416         Pass WebProcess information to platformInitializeWebProcess().
3417         https://bugs.webkit.org/show_bug.cgi?id=199345
3418
3419         Reviewed by Darin Adler.
3420
3421         Add const reference to WebProcessProxy for first argument of
3422         WebProcessPool::platformInitializeWebProcess().
3423
3424         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3425         (WebKit::WebProcessPool::platformInitializeWebProcess):
3426         * UIProcess/WebProcessPool.cpp:
3427         (WebKit::WebProcessPool::initializeNewWebProcess):
3428         * UIProcess/WebProcessPool.h:
3429         * UIProcess/glib/WebProcessPoolGLib.cpp:
3430         (WebKit::WebProcessPool::platformInitializeWebProcess):
3431         * UIProcess/win/WebProcessPoolWin.cpp:
3432         (WebKit::WebProcessPool::platformInitializeWebProcess):
3433
3434 2019-06-28  Brent Fulgham  <bfulgham@apple.com>
3435
3436         Revise WebContent sandbox based on seed feedback
3437         https://bugs.webkit.org/show_bug.cgi?id=199339
3438         <rdar://problem/49609201>
3439
3440         Reviewed by Alexey Proskuryakov.
3441
3442         Unblock syscall needed by CoreText.
3443
3444         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3445         * WebProcess/com.apple.WebProcess.sb.in:
3446
3447 2019-06-28  Tim Horton  <timothy_horton@apple.com>
3448
3449         iOS WebKit2 find-in-page indicator doesn't move with 'overflow: scroll'
3450         https://bugs.webkit.org/show_bug.cgi?id=175032
3451         <rdar://problem/29346482>
3452
3453         Reviewed by Wenson Hsieh.
3454
3455         * WebProcess/WebPage/FindController.cpp:
3456         (WebKit::FindController::drawRect):
3457         (WebKit::FindController::didScrollAffectingFindIndicatorPosition):
3458         Adopt the macOS code that notices that the find highlight doesn't match
3459         its original position, but instead of hiding the highlight like we do on macOS,
3460         update it. We do this asynchronously to avoid mutating the layer tree
3461         in the middle of painting, which is not /truly/ unsafe, but definitely
3462         non-ideal and causes fun flashes.
3463
3464         * WebProcess/WebPage/FindController.h:
3465         * WebProcess/WebPage/ios/FindControllerIOS.mm:
3466         (WebKit::FindController::updateFindIndicator):
3467         Store m_findIndicatorRect when updating the indicator, just like we do on macOS.
3468
3469 2019-06-28  Ryan Haddad  <ryanhaddad@apple.com>
3470
3471         Unreviewed build fix attempt after r246928.
3472
3473         * UIProcess/API/Cocoa/WKWebView.mm:
3474         (-[WKWebView _closeAllMediaPresentations]):
3475
3476 2019-06-28  Youenn Fablet  <youenn@apple.com>
3477
3478         Protect NetworkProcess::m_swServers from bad session IDs
3479         https://bugs.webkit.org/show_bug.cgi?id=199298
3480         <rdar://problem/51859081>
3481
3482         Reviewed by Chris Dumez.
3483
3484         Protect NetworkProcess from receiving bad session IDs in service worker code path by checking for session ID validity whenever interacting with the map.
3485         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.
3486         For bad session IDs, this will in that case trigger timing out of service worker operations.
3487
3488         For get/clear data, exit early in case of bad session ID.
3489
3490         Made some refactoring to remove swOriginStoreForSession method.
3491         In the one call site where it is used, the store should already be created so we reuse existingSWOriginStoreForSession.
3492
3493         Added a bunch of additional ASSERTs.
3494
3495         * NetworkProcess/NetworkProcess.cpp:
3496         (WebKit::NetworkProcess::destroySession):
3497         (WebKit::NetworkProcess::fetchWebsiteData):
3498         (WebKit::NetworkProcess::deleteWebsiteData):
3499         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
3500         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
3501         (WebKit::NetworkProcess::actualPrepareToSuspend):
3502         (WebKit::NetworkProcess::swServerForSession):
3503         (WebKit::NetworkProcess::existingSWOriginStoreForSession const):
3504         (WebKit::NetworkProcess::registerSWServerConnection):
3505         * NetworkProcess/NetworkProcess.h:
3506         * WebProcess/Network/NetworkProcessConnection.cpp:
3507         (WebKit::NetworkProcessConnection::initializeSWClientConnection):
3508         * WebProcess/Storage/WebSWClientConnection.cpp:
3509         (WebKit::WebSWClientConnection::WebSWClientConnection):
3510         (WebKit::WebSWClientConnection::initializeConnectionIfNeeded):
3511         (WebKit::WebSWClientConnection::ensureConnectionAndSend):
3512
3513 2019-06-28  Timothy Hatcher  <timothy@apple.com>
3514
3515         Rename effectiveAppearanceIsInactive and useInactiveAppearance to better match UIUserInterfaceLevel.
3516         https://bugs.webkit.org/show_bug.cgi?id=199336
3517         rdar://problem/52348938
3518
3519         Reviewed by Tim Horton.
3520
3521         * Shared/WebPageCreationParameters.cpp:
3522         (WebKit::WebPageCreationParameters::encode const):
3523         (WebKit::WebPageCreationParameters::decode):
3524         * Shared/WebPageCreationParameters.h:
3525         * UIProcess/API/Cocoa/WKWebView.mm:
3526         (-[WKWebView _effectiveUserInterfaceLevelIsElevated]):
3527         (-[WKWebView _effectiveAppearanceIsInactive]): Deleted.
3528         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3529         * UIProcess/Cocoa/WebViewImpl.h:
3530         * UIProcess/Cocoa/WebViewImpl.mm:
3531         (WebKit::WebViewImpl::effectiveUserInterfaceLevelIsElevated):
3532         (WebKit::WebViewImpl::effectiveAppearanceIsInactive): Deleted.
3533         * UIProcess/PageClient.h:
3534         (WebKit::PageClient::effectiveUserInterfaceLevelIsElevated const):
3535         (WebKit::PageClient::effectiveAppearanceIsInactive const): Deleted.
3536         * UIProcess/WebPageProxy.cpp:
3537         (WebKit::WebPageProxy::creationParameters):
3538         (WebKit::WebPageProxy::useElevatedUserInterfaceLevel const):
3539         (WebKit::WebPageProxy::effectiveAppearanceDidChange):
3540         (WebKit::WebPageProxy::useInactiveAppearance const): Deleted.
3541         * UIProcess/WebPageProxy.h:
3542         * UIProcess/ios/PageClientImplIOS.h:
3543         * UIProcess/ios/PageClientImplIOS.mm:
3544         (WebKit::PageClientImpl::effectiveUserInterfaceLevelIsElevated const):
3545         (WebKit::PageClientImpl::effectiveAppearanceIsInactive const): Deleted.
3546         * UIProcess/mac/PageClientImplMac.h:
3547         * UIProcess/mac/PageClientImplMac.mm:
3548         (WebKit::PageClientImpl::effectiveUserInterfaceLevelIsElevated const):
3549         (WebKit::PageClientImpl::effectiveAppearanceIsInactive const): Deleted.
3550         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3551         (WKBundlePageSetUseDarkAppearance):
3552         * WebProcess/WebPage/WebPage.cpp:
3553         (WebKit::m_shrinkToFitContentTimer):
3554         (WebKit::WebPage::effectiveAppearanceDidChange):
3555         * WebProcess/WebPage/WebPage.h:
3556         * WebProcess/WebPage/WebPage.messages.in:
3557
3558 2019-06-28  Jer Noble  <jer.noble@apple.com>
3559
3560         Unreviewed maccatalyst build fix; add ENABLE(FULLSCREEN) checks around calls to fullScreenManager().
3561
3562         * UIProcess/API/Cocoa/WKWebView.mm:
3563         (-[WKWebView _closeAllMediaPresentations]):
3564
3565 2019-06-28  Tim Horton  <timothy_horton@apple.com>
3566
3567         macCatalyst: Selected range sometimes wrong after autocorrection
3568         https://bugs.webkit.org/show_bug.cgi?id=199299
3569         <rdar://problem/49717224>
3570
3571         Reviewed by Wenson Hsieh.
3572
3573         * UIProcess/Cocoa/TextCheckingController.h:
3574         * UIProcess/Cocoa/TextCheckingController.mm:
3575         (WebKit::TextCheckingController::replaceRelativeToSelection):
3576         * UIProcess/ios/WKContentViewInteraction.mm:
3577         (-[WKContentView replaceSelectionOffset:length:withAnnotatedString:relativeReplacementRange:]):
3578         Plumb the whole relative replacement range through to the Web Content process.
3579
3580         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h:
3581         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.messages.in:
3582         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
3583         (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection):
3584         Only replace the text of the substring that changed (the replacement range),
3585         and fix up the selection offset math (it was really just wrong before).
3586
3587 2019-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
3588
3589         Need a way for SPI clients to know when to avoid resizing to accommodate for the input view bounds
3590         https://bugs.webkit.org/show_bug.cgi?id=199331
3591         <rdar://problem/52116170>
3592
3593         Reviewed by Tim Horton.
3594
3595         Expose new SPI, such that clients may check whether to avoid resizing the web view when changing input view
3596         bounds. In particular, resizing the web view in this case causes toolbar menus in Microsoft Word online to
3597         dismiss immediately after opening them, due to resize events fired as a result of the input view dismissing.
3598
3599         * Shared/FocusedElementInformation.cpp:
3600         (WebKit::FocusedElementInformation::encode const):
3601         (WebKit::FocusedElementInformation::decode):
3602         * Shared/FocusedElementInformation.h:
3603
3604         Add a new flag to FocusedElementInformation to indicate whether we should avoid resizing the web view when an
3605         input view is presented.
3606
3607         * UIProcess/API/Cocoa/WKWebView.mm:
3608         (-[WKWebView _shouldAvoidResizingWhenInputViewBoundsChange]):
3609         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3610         * UIProcess/ios/WKContentViewInteraction.h:
3611         * UIProcess/ios/WKContentViewInteraction.mm:
3612         (-[WKContentView _elementDidBlur]):
3613
3614         Reset the value of the flag.
3615
3616         (-[WKContentView _shouldAvoidResizingWhenInputViewBoundsChange]):
3617         * WebProcess/WebPage/ios/WebPageIOS.mm:
3618         (WebKit::WebPage::getFocusedElementInformation):
3619
3620 2019-06-28  Jer Noble  <jer.noble@apple.com>
3621
3622         Add new -[WKWebView _closeAllMediaPresentations] SPI
3623         https://bugs.webkit.org/show_bug.cgi?id=199294
3624         <rdar://problem/51965958>
3625
3626         Reviewed by Alex Christensen.
3627
3628         Add a new SPI that will close all out-of-window media presentations, including
3629         picture-in-picture, video fullscreen, and element fullscreen.
3630
3631         Drive-by fixes:
3632
3633         + -[WKApplicationStateTrackingView didMoveToWindow] incorrectly assumes that a WKWebView will
3634           never be moved frome one window to another, and asserts.
3635
3636         + -[WKFullScreenWindowController close] doesn't fire the correct 'webkitfullscreenchange' event
3637           when called in the middle of animating into fullscreen.
3638
3639         * UIProcess/API/Cocoa/WKWebView.mm:
3640         (-[WKWebView _closeAllMediaPresentations]):
3641         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3642         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
3643         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
3644         (WebKit::VideoFullscreenManagerProxy::forEachSession):
3645         * UIProcess/ios/WKApplicationStateTrackingView.mm:
3646         (-[WKApplicationStateTrackingView didMoveToWindow]):
3647         * UIProcess/mac/WKFullScreenWindowController.h:
3648         * UIProcess/mac/WKFullScreenWindowController.mm:
3649         (-[WKFullScreenWindowController exitFullScreenImmediately]):
3650         (-[WKFullScreenWindowController close]):
3651
3652 2019-06-28  Antti Koivisto  <antti@apple.com>
3653
3654         [iOS Scrolling] Propagate scrolls to non-nested UIScrollViews
3655         https://bugs.webkit.org/show_bug.cgi?id=199222
3656
3657         Reviewed by Simon Fraser.
3658
3659         We may generate scrolling hierarchies where the scrolling ancestor of a layer is not
3660         an ancestor in the layer tree. We  handle this in most situations but there is still
3661         a problem where a scroller fails to propage scroll to the ancestor when it reaches
3662         the edge.
3663
3664         This patch hooks up a new SPI that allows us to tell UIKit about non-ancestor scrolling
3665         relations and solve this problem.
3666
3667         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
3668         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
3669         (WebKit::findActingScrollParent):
3670         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
3671         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
3672         (-[WKScrollingNodeScrollViewDelegate _actingParentScrollViewForScrollView:]):
3673
3674         Hook into UIKit SPI.
3675
3676         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::findActingScrollParent):
3677
3678 2019-06-28  Konstantin Tokarev  <annulen@yandex.ru>
3679
3680         Remove traces of ENABLE_ICONDATABASE remaining after its removal in 219733
3681         https://bugs.webkit.org/show_bug.cgi?id=199317
3682
3683         Reviewed by Michael Catanzaro.
3684
3685         While IconDatabase and all code using it was removed,
3686         ENABLE_ICONDATABASE still exists as build option and C++ macro.
3687
3688         * Configurations/FeatureDefines.xcconfig:
3689         * PlatformGTK.cmake: Remove reference to unused urlIcon.png file.
3690
3691 2019-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
3692
3693         -[WKContentView _selectionClipRects] returns a bogus value in -reloadInputViews when focusing an element
3694         https://bugs.webkit.org/show_bug.cgi?id=199310
3695         <rdar://problem/52292137>
3696
3697         Reviewed by Megan Gardner.
3698
3699         When reloading input views under -_elementDidFocus:, -_selectionClipRect returns the value of the previously
3700         focused element; this is because _selectionClipRect depends on EditorState's post layout data, which is only
3701         guaranteed to arrive during the next remote layer tree commit after the element is focused.
3702
3703         However, some clients need to inspect this value under the call to -reloadInputViews when an element is focused;
3704         to make this work, simply check whether we are currently waiting for post-layout EditorState data to arrive
3705         following element focus; if so, return the FocusedElementInformation's elementRect, which represents the initial
3706         state of the focused element. Otherwise, use the EditorState's post layout data, which is guaranteed to be more
3707         up-to-date than the FocusedElementInformation's element rect.
3708
3709         Test: KeyboardInputTests.SelectionClipRectsWhenPresentingInputView
3710
3711         * UIProcess/WebPageProxy.h:
3712         (WebKit::WebPageProxy::waitingForPostLayoutEditorStateUpdateAfterFocusingElement const):
3713         * UIProcess/ios/WKContentViewInteraction.mm:
3714         (-[WKContentView _selectionClipRect]):
3715
3716 2019-06-28  Carlos Garcia Campos  <cgarcia@igalia.com>
3717
3718         [SOUP] WebSockets: runtime critical warning when closing the connection in some cases
3719         https://bugs.webkit.org/show_bug.cgi?id=199265
3720
3721         Reviewed by Michael Catanzaro.
3722
3723         Ensure the connection is still open before calling soup_websocket_connection_close().
3724
3725         * NetworkProcess/soup/WebSocketTaskSoup.cpp:
3726         (WebKit::WebSocketTask::close):
3727
3728 2019-06-27  Zan Dobersek  <zdobersek@igalia.com>
3729
3730         Unreviewed WPE build fix.
3731
3732         * SourcesWPE.txt: Add WebSocketTaskSoup.cpp to the build.
3733
3734 2019-06-27  Dean Jackson  <dino@apple.com>
3735
3736         Provide overrides for UIKit's suggested actions in UIContextMenuInteraction
3737         https://bugs.webkit.org/show_bug.cgi?id=199301
3738         <rdar://problem/52297380>
3739
3740         Reviewed by Tim Horton.
3741
3742         We were previously wrapping the actionMenuProvider with our own block
3743         in order to ensure the correct suggestedActions were passed to the provider.
3744         UIKit added API for us to override the actions separately.
3745
3746         Unfortunately we can't quite yet get rid of our access into the
3747         UIContextMenuConfiguration, because we still need to override the preview
3748         handler in the case where the user does not want link previews.
3749
3750         * Platform/spi/ios/UIKitSPI.h:
3751         * UIProcess/ios/WKContentViewInteraction.h:
3752         * UIProcess/ios/WKContentViewInteraction.mm:
3753         (-[WKContentView continueContextMenuInteraction:]):
3754         (-[WKContentView _contextMenuInteraction:overrideSuggestedActionsForConfiguration:]):
3755         Implement the new delegate SPI to provide our own actions.
3756
3757 2019-06-27  Daniel Bates  <dabates@apple.com>
3758
3759         [iOS] Select all with existing range selection replaces range instead of selecting all text
3760         https://bugs.webkit.org/show_bug.cgi?id=197950
3761         <rdar://problem/50245131>
3762
3763         Reviewed by Wenson Hsieh.
3764
3765         Following <rdar://problem/47333786>, UIKit now asks WebKit whether it can handle Command + A as
3766         "select all" instead of just demanding that we handle it. So, WebKit needs to be able to correctly
3767         tell UIKit in advance whether it can handle it. Currenlty WebKit tells UIKit it cannot handle a
3768         "select all" whenever there is an existing range selection. So, UIKit does not tell WebKit to
3769         perform the "select all". Moreover, since UIKit has no other means to handle this key command
3770         itself it tells WebKit the key command was not handled. So, WebKit tells the keyboard to insert
3771         the "a". Instead, WebKit should tell UIKit it can handle a "select all" even when this is an
3772         existing range selection. However we need to keep the current logic just for when UIKit is
3773         asking us with respect to populating the callout menu to not regress platform behavior.
3774
3775         * UIProcess/ios/WKContentViewInteraction.mm:
3776         (-[WKContentView canPerformActionForWebView:withSender:]): Do what we do now if we are called
3777         when populating the callout menu and action is Select All. Otherwise, return YES for the Select All
3778         action if we have a non-empty selection.
3779
3780 2019-06-27  Andy Estes  <aestes@apple.com>
3781
3782         [iOS] Stop using cached UITargetedPreviews from previous interactions when starting a new context menu interaction
3783         https://bugs.webkit.org/show_bug.cgi?id=199285
3784         <rdar://problem/52074916>
3785
3786         Reviewed by Tim Horton.
3787
3788         WKContentView was caching the UITargetedPreview created in
3789         -contextMenuInteraction:previewForHighlightingMenuWithConfiguration: for later reuse by
3790         -contextMenuInteraction:previewForDismissingMenuWithConfiguration:. The cached value was
3791         then cleared in -contextMenuInteractionDidEnd:.
3792
3793         This was wrong, because -contextMenuInteractionDidEnd: can be called before
3794         -contextMenuInteraction:previewForDismissingMenuWithConfiguration:, so we would clear the
3795         cache then create and cache a new UITargetedPreview during dismissal. Then when a new
3796         context menu interaction started, we'd reuse the targeted preview created for the previous
3797         dismissal (which has the wrong geometry).
3798
3799         Stop assuming an ordering between
3800         -contextMenuInteraction:previewForDismissingMenuWithConfiguration: and
3801         -contextMenuInteractionDidEnd:. Instead, always create and cache a new UITargetedPreview in
3802         -contextMenuInteraction:previewForHighlightingMenuWithConfiguration:, then reuse it and
3803         clear the cache in -contextMenuInteraction:previewForDismissingMenuWithConfiguration:.
3804
3805         * UIProcess/ios/WKContentViewInteraction.mm:
3806         (-[WKContentView _createTargetedPreviewIfPossible]):
3807         (-[WKContentView contextMenuInteraction:previewForDismissingMenuWithConfiguration:]):
3808         (-[WKContentView contextMenuInteractionDidEnd:]):
3809
3810 2019-06-27  Sihui Liu  <sihui_liu@apple.com>
3811
3812         Regression(r246526): StorageManager thread hangs
3813         https://bugs.webkit.org/show_bug.cgi?id=199278
3814         <rdar://problem/52202948>
3815
3816         Reviewed by Geoffrey Garen.
3817
3818         r246526 adds a lock m_localStorageNamespacesMutex to protect m_localStorageNamespaces, because 
3819         m_localStorageNamespaces is destroyed at main thread while accesses to m_localStorageNamespaces happen in the 
3820         background thread.
3821         After r246526, getOrCreateLocalStorageNamespace acquires lock m_localStorageNamespacesMutex when 
3822         m_localStorageNamespacesMutex is already acquired in cloneSessionStorageNamespace, so the StorageManager thread
3823         hangs.
3824         To solve this issue, we can remove the lock in getOrCreateLocalStorageNamespace, or we can remove the 
3825         m_localStorageNamespacesMutex. waitUntilWritesFinished() before ~StorageManager() already guarantees nothing 
3826         will be running in the background thread, so it is unlikely we the access to m_localStorageNamespaces in the 
3827         background thread would collide with the destruction of m_localStorageNamespaces. Also, we don't need 
3828         didDestroyStorageArea as LocalStorageNamespace can hold the last reference of StorageArea after r245881.
3829
3830         * NetworkProcess/WebStorage/StorageManager.cpp:
3831         (WebKit::StorageManager::StorageArea::StorageArea):
3832         (WebKit::StorageManager::StorageArea::~StorageArea):
3833         (WebKit::StorageManager::LocalStorageNamespace::LocalStorageNamespace):
3834         (WebKit::StorageManager::cloneSessionStorageNamespace):
3835         (WebKit::StorageManager::getLocalStorageOrigins):
3836         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
3837         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
3838         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
3839         (WebKit::StorageManager::getOrCreateLocalStorageNamespace):
3840         (WebKit::StorageManager::LocalStorageNamespace::didDestroyStorageArea): Deleted.
3841         * NetworkProcess/WebStorage/StorageManager.h:
3842
3843 2019-06-27  Carlos Garcia Campos  <cgarcia@igalia.com>
3844
3845         WebSockets: avoid data copies when queuing tasks in WebSocketChannel
3846         https://bugs.webkit.org/show_bug.cgi?id=199262
3847
3848         Reviewed by Alex Christensen.
3849
3850         For IPC message handler arguments we can receive rvalue references instead of const references.
3851
3852         * WebProcess/Network/WebSocketChannel.cpp:
3853         (WebKit::WebSocketChannel::didConnect):
3854         (WebKit::WebSocketChannel::didReceiveText):
3855         (WebKit::WebSocketChannel::didReceiveBinaryData):
3856         (WebKit::WebSocketChannel::didClose):
3857         (WebKit::WebSocketChannel::didReceiveMessageError):
3858         * WebProcess/Network/WebSocketChannel.h:
3859
3860 2019-06-27  Youenn Fablet  <youenn@apple.com>
3861
3862         Fix build after revision 246877
3863         https://bugs.webkit.org/show_bug.cgi?id=199276
3864
3865         Unreviewed.
3866
3867         Pass protocol parameter to NetworkSocketChannel.
3868
3869         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3870         (-[WKNetworkSessionDelegate URLSession:webSocketTask:didOpenWithProtocol:]):
3871         * NetworkProcess/cocoa/WebSocketTaskCocoa.h:
3872         * NetworkProcess/cocoa/WebSocketTaskCocoa.mm:
3873         (WebKit::WebSocketTask::didConnect):
3874
3875 2019-06-27  Beth Dakin  <bdakin@apple.com>
3876
3877         Upstream use of MACCATALYST
3878         https://bugs.webkit.org/show_bug.cgi?id=199245
3879         rdar://problem/51687723
3880
3881         Reviewed by Tim Horton.
3882
3883         * Configurations/Base.xcconfig:
3884         * Configurations/FeatureDefines.xcconfig:
3885         * Configurations/Network-iOSMac.entitlements: Removed.
3886         * Configurations/Network-macCatalyst.entitlements: Copied from Source/WebKit/Configurations/Network-iOSMac.entitlements.
3887         * Configurations/NetworkService.xcconfig:
3888         * Configurations/SDKVariant.xcconfig:
3889         * Configurations/WebContent-iOSMac.entitlements: Removed.
3890         * Configurations/WebContent-macCatalyst.entitlements: Copied from Source/WebKit/Configurations/WebContent-iOSMac.entitlements.
3891         * Configurations/WebContentService.xcconfig:
3892         * Configurations/WebKit.xcconfig:
3893         * NetworkProcess/ios/NetworkProcessIOS.mm:
3894         * NetworkProcess/mac/NetworkProcessMac.mm:
3895         (WebKit::NetworkProcess::initializeProcess):
3896         (WebKit::NetworkProcess::initializeProcessName):
3897         * Platform/mac/LayerHostingContext.mm:
3898         (WebKit::LayerHostingContext::createForExternalHostingProcess):
3899         * Platform/spi/ios/ManagedConfigurationSPI.h:
3900         * Platform/spi/ios/UIKitSPI.h:
3901         * Shared/WebPreferencesDefaultValues.cpp:
3902         (WebKit::defaultCustomPasteboardDataEnabled):
3903         * Shared/ios/AuxiliaryProcessIOS.mm:
3904         (WebKit::AuxiliaryProcess::initializeSandbox):
3905         * Shared/ios/InteractionInformationAtPosition.h:
3906         * Shared/ios/InteractionInformationAtPosition.mm:
3907         (WebKit::InteractionInformationAtPosition::encode const):
3908         (WebKit::InteractionInformationAtPosition::decode):
3909         * Shared/mac/AuxiliaryProcessMac.mm:
3910         (WebKit::enableSandboxStyleFileQuarantine):
3911         * Shared/mac/CodeSigning.mm:
3912         * UIProcess/API/Cocoa/WKWebView.mm:
3913         (-[WKWebView _webViewPrintFormatter]):
3914         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3915         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3916         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
3917         (WebKit::RemoteLayerTreeHost::updateLayerTree):
3918         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
3919         (-[WKRemoteView initWithFrame:contextID:]):
3920         * UIProcess/_WKWebViewPrintFormatter.mm:
3921         * UIProcess/_WKWebViewPrintFormatterInternal.h:
3922         * UIProcess/ios/WKActionSheetAssistant.mm:
3923         (-[WKActionSheetAssistant _elementActionForDDAction:]):
3924         * UIProcess/ios/WKContentView.mm:
3925         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
3926         * UIProcess/ios/WKContentViewInteraction.h:
3927         * UIProcess/ios/WKContentViewInteraction.mm:
3928         (-[WKContentView setupInteraction]):
3929         (-[WKContentView cleanupInteraction]):
3930         (-[WKContentView _removeDefaultGestureRecognizers]):
3931         (-[WKContentView _addDefaultGestureRecognizers]):
3932         (-[WKContentView _showTapHighlight]):
3933         (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]):
3934         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
3935         (-[WKContentView canPerformActionForWebView:withSender:]):
3936         (-[WKContentView _defineForWebView:]):
3937         (-[WKContentView setSelectedTextRange:]):
3938         (-[WKContentView closestPositionToPoint:]):
3939         (-[WKContentView _showShareSheet:inRect:completionHandler:]):
3940         * UIProcess/ios/WebPageProxyIOS.mm:
3941         (WebKit::desktopClassBrowsingSupported):
3942         (WebKit::desktopClassBrowsingRecommended):
3943         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3944         (-[WKFileUploadPanel _showDocumentPickerMenu]):
3945         * WebKit.xcodeproj/project.pbxproj:
3946         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
3947         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
3948         (WebKit::WebPage::dictionaryPopupInfoForRange):
3949         * WebProcess/WebPage/ios/WebPageIOS.mm:
3950         (WebKit::WebPage::platformEditorState const):
3951         (WebKit::WebPage::selectWithGesture):
3952         (WebKit::selectionPositionInformation):
3953         * WebProcess/cocoa/WebProcessCocoa.mm:
3954         (WebKit::WebProcess::initializeSandbox):
3955         * WebProcess/com.apple.WebProcess.sb.in:
3956
3957 2019-06-27  Saam Barati  <sbarati@apple.com>
3958
3959         Make WEBGPU enabled only on Mojave and later.
3960
3961         Rubber-stamped by Myles C. Maxfield.
3962
3963         * Configurations/FeatureDefines.xcconfig:
3964
3965 2019-06-27  Adrian Perez de Castro  <aperez@igalia.com>
3966
3967         [GTK][WPE] Fix build non-unified builds after r246856
3968         https://bugs.webkit.org/show_bug.cgi?id=199263
3969
3970         Reviewed by Michael Catanzaro.
3971
3972         * UIProcess/API/C/WKMessageListener.cpp: Added missing inclusion of WKAPICast.h and usage of WebKit namespace.
3973
3974 2019-06-27  Carlos Garcia Campos  <cgarcia@igalia.com>
3975
3976         [SOUP] WebSockets: handle TLS certificate and errors
3977         https://bugs.webkit.org/show_bug.cgi?id=199223
3978
3979         Reviewed by Michael Catanzaro.
3980
3981         Connect to accept-certificate signal on the WebSocket message connection to decide what to do in case of TLS errors.
3982
3983         * NetworkProcess/soup/NetworkSessionSoup.cpp:
3984         (WebKit::webSocketAcceptCertificateCallback):
3985         (WebKit::webSocketMessageNetworkEventCallback):
3986         (WebKit::NetworkSessionSoup::createWebSocketTask):
3987
3988 2019-06-27  Carlos Garcia Campos  <cgarcia@igalia.com>
3989
3990         [SOUP] Use libsoup WebSockets API
3991         https://bugs.webkit.org/show_bug.cgi?id=199151
3992
3993         Reviewed by Michael Catanzaro.
3994
3995         Use the new WebSockets code path that depends on platform specific WebSockets implementation using the libsoup
3996         API. This is an initial implementation manually tested using the layout tests, which most of them fail due to
3997         missing console messages, missing features in the new code path or differences in the platform
3998         implementation. It will be disabled by default until it's feature complete compared to the internal WebKit
3999         implementation.
4000
4001         * NetworkProcess/NetworkSocketChannel.cpp:
4002         (WebKit::NetworkSocketChannel::NetworkSocketChannel): Null check m_socket before using it, because
4003         createWebSocketTask() can return nullptr;
4004         (WebKit::NetworkSocketChannel::didConnect): Receive the protocol accepted by the server.
4005         (WebKit::NetworkSocketChannel::didReceiveMessageError): Something failed in the server side.
4006         * NetworkProcess/NetworkSocketChannel.h:
4007         * NetworkProcess/WebSocketTask.h:
4008         * NetworkProcess/soup/NetworkSessionSoup.cpp: