b7640d7cbc827757253cb345bb71b5af29d72951
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-08-06  Jer Noble  <jer.noble@apple.com>
2
3         Add test for behavior introduced in r248174
4         https://bugs.webkit.org/show_bug.cgi?id=200446
5
6         Reviewed by Eric Carlson.
7
8         Add a new helper struct, FullscreenTouchSecheuristicParameters, and static getter,
9         iosParameters(), to allow the settings used by WKFullScreenViewController to be tested
10         in TestWebKitAPI. Make both of the Secheuristic classes privately exported as well.
11
12         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.cpp:
13         (WebKit::FullscreenTouchSecheuristic::scoreOfNextTouch):
14         (WebKit::FullscreenTouchSecheuristic::reset):
15         (WebKit::FullscreenTouchSecheuristic::distanceScore):
16         (WebKit::FullscreenTouchSecheuristic::attenuationFactor):
17         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.h:
18         (WebKit::FullscreenTouchSecheuristic::setParameters):
19         (WebKit::FullscreenTouchSecheuristic::requiredScore const):
20         (WebKit::FullscreenTouchSecheuristic::setRampUpSpeed):
21         (WebKit::FullscreenTouchSecheuristic::setRampDownSpeed):
22         (WebKit::FullscreenTouchSecheuristic::setXWeight):
23         (WebKit::FullscreenTouchSecheuristic::setYWeight):
24         (WebKit::FullscreenTouchSecheuristic::setGamma):
25         (WebKit::FullscreenTouchSecheuristic::setGammaCutoff):
26         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristicParameters.cpp: Copied from Source/WebKit/UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.h.
27         (WebKit::FullscreenTouchSecheuristicParameters::iosParameters):
28         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristicParameters.h: Copied from Source/WebKit/UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.h.
29         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
30         (-[WKFullScreenViewController initWithWebView:]):
31         (-[WKFullScreenViewController _touchDetected:]):
32         * WebKit.xcodeproj/project.pbxproj:
33
34 2019-08-06  Claudio Saavedra  <csaavedra@igalia.com>
35
36         [GLIB] Fix documentation typo
37
38         Unreviewed.
39
40         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
41
42 2019-08-05  Fujii Hironori  <Hironori.Fujii@sony.com>
43
44         [Win][MiniBrowser][WK2] Unhandled key events should be bubbled up to the parent window
45         https://bugs.webkit.org/show_bug.cgi?id=200464
46
47         Reviewed by Ross Kirsling.
48
49         * UIProcess/API/C/WKNativeEvent.h: Define WKNativeEventPtr for WIN32.
50
51 2019-08-05  Youenn Fablet  <youenn@apple.com>
52
53         Support RTCRtpSender.dtmf
54         https://bugs.webkit.org/show_bug.cgi?id=200431
55
56         Reviewed by Eric Carlson.
57
58         * Shared/WebPreferences.yaml:
59
60 2019-08-05  Simon Fraser  <simon.fraser@apple.com>
61
62         iOS 13: Overflow:hidden on body prevents PDF scroll
63         https://bugs.webkit.org/show_bug.cgi?id=200435
64         rdar://problem/53942888
65
66         Reviewed by Tim Horton.
67
68         When we navigate from an overflow:hidden HTML page to a custom view (like PDF), we need
69         to make sure that the scroll view is scrollable.
70
71         * UIProcess/API/Cocoa/WKWebView.mm:
72         (-[WKWebView _setHasCustomContentView:loadedMIMEType:]):
73
74 2019-08-05  John Wilander  <wilander@apple.com>
75
76         Resource Load Statistics: Re-introduce latch mode for subresource cookie blocking
77         https://bugs.webkit.org/show_bug.cgi?id=200395
78         <rdar://problem/53869611>
79
80         Reviewed by Darin Adler.
81
82         Back when we had a relaxation of cookie blocking 24 hours after first-party user
83         interaction, we made sure cookie blocking could be turned on and off in subresource
84         redirect chains. The 24 hour window is now long gone. This patch simplifies the
85         cookie blocking so that once a subresource request is denied cookies, any
86         subsequent redirect of that request will also be denied cookies, regardless of the
87         classification status of the domains involved. I call it latch mode.
88
89         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
90         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
91         (WebKit::NetworkDataTaskCocoa::blockCookies):
92         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
93         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
94         (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy): Deleted.
95
96 2019-08-05  Youenn Fablet  <youenn@apple.com>
97
98         Disable speculative loading if cache is not to be used for the load
99         https://bugs.webkit.org/show_bug.cgi?id=199644
100
101         Reviewed by Alex Christensen.
102
103         When the page is reloaded, loads are instructed to not use the cache.
104         It is therefore unneeded to do speculative revalidation.
105         Allow speculative revalidation if the cache policy is either the default HTTP policy or
106         if policy is to refresh all cache data.
107         Covered by added test.
108
109         * NetworkProcess/cache/NetworkCache.cpp:
110         (WebKit::NetworkCache::cachePolicyValidForSpeculativeRevalidation):
111         (WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):
112
113 2019-08-04  Konstantin Tokarev  <annulen@yandex.ru>
114
115         Remove unused lambda capture in MemoryPressureMonitor
116         https://bugs.webkit.org/show_bug.cgi?id=200420
117
118         Reviewed by Darin Adler.
119
120         * UIProcess/linux/MemoryPressureMonitor.cpp:
121         (WebKit::MemoryPressureMonitor::start):
122
123 2019-08-03  Konstantin Tokarev  <annulen@yandex.ru>
124
125         Fix compilation with disabled WebGL
126         https://bugs.webkit.org/show_bug.cgi?id=200421
127
128         Reviewed by Wenson Hsieh.
129
130         After r247452 webGLStateTracker is guarded with #if ENABLE(WEBGL)
131
132         * WebProcess/WebPage/WebPage.cpp:
133         (WebKit::m_textAutoSizingAdjustmentTimer):
134
135 2019-08-02  Keith Rollin  <krollin@apple.com>
136
137         Consistently use Obj-C boolean literals
138         https://bugs.webkit.org/show_bug.cgi?id=200405
139         <rdar://problem/53880043>
140
141         Reviewed by Simon Fraser, Joseph Pecoraro.
142
143         There are places where we use equivalent but different expressions for
144         Obj-C boolean objects. For example, we use both [NSNumber
145         numberWithBool:YES] and @YES. There are places where both are used in
146         the same function, such as -[WebPreferences initialize]. The boolean
147         literal is in greater use and is more succinct, so standardize on
148         that. Also, change @(YES/NO) to @YES/NO.
149
150         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
151         (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
152         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
153         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
154         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
155         (WebKit::LocalConnection::getAttestation const):
156
157 2019-08-02  Sihui Liu  <sihui_liu@apple.com>
158
159         API tests using permanent credentials should clear credentials left by previous tests
160         https://bugs.webkit.org/show_bug.cgi?id=199729
161
162         Reviewed by Alex Christensen.
163
164         Permanent password credentials currently are shared across processes, so we don't need to clear them from 
165         network process.
166
167         * NetworkProcess/NetworkProcess.cpp:
168         (WebKit::NetworkProcess::clearPermanentCredentialsForProtectionSpace): Deleted.
169         * NetworkProcess/NetworkProcess.h:
170         * NetworkProcess/NetworkProcess.messages.in:
171         * UIProcess/API/Cocoa/WKProcessPool.mm:
172         (-[WKProcessPool _clearPermanentCredentialsForProtectionSpace:]):
173         (-[WKProcessPool _clearPermanentCredentialsForProtectionSpace:completionHandler:]): Deleted.
174         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
175         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
176         (WebKit::WebProcessPool::clearPermanentCredentialsForProtectionSpace):
177         * UIProcess/WebProcessPool.cpp:
178         (WebKit::WebProcessPool::clearPermanentCredentialsForProtectionSpace): Deleted.
179         * UIProcess/WebProcessPool.h:
180
181 2019-08-02  Devin Rousso  <drousso@apple.com>
182
183         Web Inspector: Timelines: Develop > Start Timeline Recording doesn't work when focused on a detached inspector window
184         https://bugs.webkit.org/show_bug.cgi?id=200125
185         <rdar://problem/53543008>
186
187         Reviewed by Brian Burg.
188
189         Always show the Timelines tab in Web Inspector whenever timeline recording starts/stops.
190         Notify the UIProcess whenever the timeline recording state changes.
191
192         * WebProcess/WebPage/WebInspector.messages.in:
193         * WebProcess/WebPage/WebInspector.h:
194         * WebProcess/WebPage/WebInspector.cpp:
195         (WebKit::WebInspector::startPageProfiling):
196         (WebKit::WebInspector::stopPageProfiling):
197         (WebKit::WebInspector::timelineRecordingChanged): Added.
198         (WebKit::WebInspector::showTimelines): Deleted.
199
200         * WebProcess/WebPage/WebInspectorUI.messages.in:
201         * WebProcess/WebPage/WebInspectorUI.h:
202         * WebProcess/WebPage/WebInspectorUI.cpp:
203         (WebKit::WebInspectorUI::showTimelines): Deleted.
204
205         * WebProcess/WebCoreSupport/WebInspectorClient.h:
206         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
207         (WebKit::WebInspectorClient::timelineRecordingChanged): Added.
208
209         * UIProcess/WebInspectorProxy.messages.in:
210         * UIProcess/WebInspectorProxy.h:
211         * UIProcess/WebInspectorProxy.cpp:
212         (WebKit::WebInspectorProxy::togglePageProfiling):
213         (WebKit::WebInspectorProxy::timelineRecordingChanged): Added.
214         (WebKit::WebInspectorProxy::showTimelines): Deleted.
215
216         * UIProcess/API/C/WKInspector.cpp:
217         (WKInspectorTogglePageProfiling):
218
219         * UIProcess/API/Cocoa/_WKInspector.h:
220         * UIProcess/API/Cocoa/_WKInspector.mm:
221         (-[_WKInspector showTimelines]): Deleted.
222
223         * WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp:
224         (WKBundleInspectorSetPageProfilingEnabled):
225
226 2019-08-02  Jer Noble  <jer.noble@apple.com>
227
228         [iPadOS] slides.google.com: Full Screen API warning is presented when swiping through slides
229         https://bugs.webkit.org/show_bug.cgi?id=200313
230         <rdar://problem/53777001>
231
232         Reviewed by Eric Carlson.
233
234         Only run the secheuristic scoring during UIGestureRecognizerStateEnded, rather than both
235         UIGestureRecognizerStateEnded and UIGestureRecognizerStateBegan. The goal of the heuristic is
236         to detect fake on-screen keyboards by detecting gestures that look like "typing". Using only
237         UIGestureRecognizerStateEnded still allows us to do this (as typing will usually have identical
238         geometries for both Ended and Began) without generating false-positives during swipe gestures.
239
240         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
241         (-[WKFullScreenViewController _touchDetected:]):
242
243 2019-08-02  Wenson Hsieh  <wenson_hsieh@apple.com>
244
245         [macOS 10.15] Image dragged from Safari does not appear in Notes
246         https://bugs.webkit.org/show_bug.cgi?id=188490
247         <rdar://problem/39462717>
248
249         Reviewed by Andy Estes.
250
251         Removes some logic that clears out the cached promised drag image in the UI process when WebKit is asked to
252         provide TIFF image data. This prevents the drop destination from asking for promised image data, if anything
253         else (e.g. the system) also asks the web view to provide the same data. Additionally, this logic didn't
254         previously guarantee that the promised image would be cleared anyways, since it is dependent on the drop target
255         actually requesting the promised image in order to perform the cleanup.
256
257         In lieu of clearing the promised drag image when it's requested, we instead clear it out upon mainframe
258         navigation, in PageClientImpl::didCommitLoadForMainFrame.
259
260         Test: DragAndDropTests.MultiplePromisedImageDataRequests
261
262         * UIProcess/Cocoa/WebViewImpl.h:
263         * UIProcess/Cocoa/WebViewImpl.mm:
264         (WebKit::WebViewImpl::clearPromisedDragImage):
265         (WebKit::WebViewImpl::pasteboardChangedOwner):
266         (WebKit::WebViewImpl::provideDataForPasteboard):
267
268         Fix the bug by not immediately clearing out the promised drag image.
269
270         * UIProcess/mac/PageClientImplMac.mm:
271         (WebKit::PageClientImpl::didCommitLoadForMainFrame):
272
273 2019-08-02  Keith Rollin  <krollin@apple.com>
274
275         macCatalyst build fails the first attempt, requires a second build
276         https://bugs.webkit.org/show_bug.cgi?id=200242
277         <rdar://problem/53678481>
278
279         macCatalyst builds fail the first time with an error like:
280
281             Code Signing Error: The file
282             "/Users/tim_cook/Build/Debug-maccatalyst/DerivedSources/WebKit2/WebContent-macCatalyst-no-sandbox.entitlements"
283             could not be opened. Verify the value of the
284             CODE_SIGN_ENTITLEMENTS build setting for target "WebContent" is
285             correct and that the file exists on disk.
286
287         This problem is caused by the file referenced by
288         CODE_SIGN_ENTITLEMENTS changing during the build process. For
289         macCatalyst builds, we start with the iOS entitlements files and then
290         tweak them for macCatalyst. When this occurs during a clean build,
291         Xcode sees the entitlements file being generated and complains about
292         it. Restarting the build does so with the file already existing, and
293         so Xcode does not complain about it.
294
295         The approach of generating or tweaking entitlement files may have
296         worked in the past, but the fact is that Xcode doesn't support it.
297
298         We had a similar problem with macOS builds. The entitlements files
299         used to be generated on the fly with scripts like
300         WebKit/Scripts/process-network-sandbox-entitlements.sh. That process
301         was reworked to avoid the issue with Xcode not allowing the files to
302         be generated (see r241135). In short:
303
304         o The various process-*-entitlements.sh scripts were consolidated into
305           a single process-entitlements file
306         o CODE_SIGN_ENTITLEMENTS, which contains the name of the entitlements
307           file to use, was de-initialized so that Xcode would not try to
308           access our generated entitlements file
309         o CODE_SIGN_INJECT_BASE_ENTITLEMENTS (which injects some base
310           entitlements) was set to NO. If it were left set to YES, Xcode would
311           create its own entitlements file and use it as if it were specified
312           in CODE_SIGN_ENTITLEMENTS
313         o WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS was updated with an
314           "--entitlements <generated_file>" option.
315           WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS was then used to initialize
316           OTHER_CODE_SIGN_FLAGS. By specifying the entitlements file this way,
317           we avoid Xcode complaining about it.
318
319         This approach works well for macOS, and so we now also use it to
320         address the issue with macCatalyst. While we're at it, convert the
321         rest of the platforms to use the same approach and also generate their
322         entitlements from the process-entitlements script.
323
324         The new process was validated by performing a build with the old
325         process and the new process, and then comparing the entitlements of
326         the resulting XPC services to make sure they were the same. Builds
327         were performed for all platforms, and for Engineering and Production
328         builds.
329
330         Reviewed by Brent Fulgham.
331
332         * Configurations/BaseXPCService.xcconfig:
333         * Configurations/Network-iOS.entitlements: Removed.
334         * Configurations/Network-macCatalyst.entitlements: Removed.
335         * Configurations/NetworkService.xcconfig:
336         * Configurations/PluginService.64.xcconfig:
337         * Configurations/PluginService.entitlements: Removed.
338         * Configurations/WebContent-iOS.entitlements: Removed.
339         * Configurations/WebContent-macCatalyst.entitlements: Removed.
340         * Configurations/WebContentService.Development.xcconfig:
341         * Configurations/WebContentService.xcconfig:
342         * Scripts/copy-webcontent-resources-to-private-headers.sh:
343         * Scripts/process-entitlements.sh:
344         * WebKit.xcodeproj/project.pbxproj:
345
346 2019-08-02  Carlos Garcia Campos  <cgarcia@igalia.com>
347
348         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.25.4 release
349
350         * gtk/NEWS: Add release notes for 2.25.4.
351
352 2019-08-02  Carlos Garcia Campos  <cgarcia@igalia.com>
353
354         [SOUP] WebSockets: use SOUP_WEBSOCKET_CLOSE_NO_STATUS when closing with no status
355         https://bugs.webkit.org/show_bug.cgi?id=200338
356
357         Reviewed by Alex Christensen.
358
359         * NetworkProcess/soup/WebSocketTaskSoup.cpp:
360         (WebKit::WebSocketTask::close):
361
362 2019-08-01  Alex Christensen  <achristensen@webkit.org>
363
364         Do not send NetworkProcessProxy::LogTestingEvent message if we are not testing
365         https://bugs.webkit.org/show_bug.cgi?id=200360
366
367         Reviewed by Tim Horton.
368
369         Sending this message causes instantiation of the default WebsiteDataStore in the UIProcess,
370         which causes more memory to be used than is needed if we are browsing without the default WebsiteDataStore.
371
372         Covered by an API test.
373
374         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
375         (WebKit::WebResourceLoadStatisticsStore::logTestingEvent):
376         * NetworkProcess/NetworkSession.cpp:
377         (WebKit::NetworkSession::NetworkSession):
378         * NetworkProcess/NetworkSession.h:
379         (WebKit::NetworkSession::enableResourceLoadStatisticsLogTestingEvent const):
380         * NetworkProcess/NetworkSessionCreationParameters.cpp:
381         (WebKit::NetworkSessionCreationParameters::encode const):
382         (WebKit::NetworkSessionCreationParameters::decode):
383         * NetworkProcess/NetworkSessionCreationParameters.h:
384         * UIProcess/WebProcessPool.cpp:
385         (WebKit::WebProcessPool::ensureNetworkProcess):
386         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
387         (WebKit::WebsiteDataStore::parameters):
388         * UIProcess/WebsiteData/WebsiteDataStore.h:
389         (WebKit::WebsiteDataStore::hasStatisticsTestingCallback const):
390
391 2019-08-01  Alex Christensen  <achristensen@webkit.org>
392
393         Move FormData zip file generation to NetworkProcess and enable it for all WebKit clients for uploading directories
394         https://bugs.webkit.org/show_bug.cgi?id=200102
395         <rdar://problem/53275114>
396
397         Reviewed by Darin Adler.
398
399         * NetworkProcess/NetworkResourceLoadParameters.cpp:
400         (WebKit::NetworkResourceLoadParameters::encode const):
401         * Platform/IPC/FormDataReference.h:
402         (IPC::FormDataReference::encode const):
403         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
404         * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
405         (API::InjectedBundle::PageUIClient::shouldGenerateFileForUpload): Deleted.
406         (API::InjectedBundle::PageUIClient::generateFileForUpload): Deleted.
407         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
408         (WebKit::InjectedBundlePageUIClient::shouldGenerateFileForUpload): Deleted.
409         (WebKit::InjectedBundlePageUIClient::generateFileForUpload): Deleted.
410         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
411         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
412         (WebKit::WebChromeClient::shouldReplaceWithGeneratedFileForUpload): Deleted.
413         (WebKit::WebChromeClient::generateReplacementFile): Deleted.
414         * WebProcess/WebCoreSupport/WebChromeClient.h:
415         * WebProcess/com.apple.WebProcess.sb.in:
416
417 2019-08-01  Tim Horton  <timothy_horton@apple.com>
418
419         REGRESSION: HSBC Personal Banking download/print dialog is usually positioned off screen on iPad
420         https://bugs.webkit.org/show_bug.cgi?id=200356
421         <rdar://problem/51885199>
422
423         Reviewed by Beth Dakin.
424
425         * UIProcess/ios/WebPageProxyIOS.mm:
426         (WebKit::desktopClassBrowsingRecommendedForRequest):
427         Add HSBC domains to the list of sites that recommend mobile mode by default.
428
429 2019-08-01  Chris Dumez  <cdumez@apple.com>
430
431         Crash under WebProcessProxy::didBecomeUnresponsive()
432         https://bugs.webkit.org/show_bug.cgi?id=200346
433         <rdar://problem/53795984>
434
435         Reviewed by Geoffrey Garen.
436
437         Make sure the BackgroundProcessResponsivenessTimer / ResponsivenessTimer ref their client
438         while they call mayBecomeUnresponsive() / willChangeIsResponsive() / didChangeIsResponsive()
439         / didBecomeUnresponsive() on their client, in case calling one of these ends up destroying
440         the client.
441
442         * UIProcess/BackgroundProcessResponsivenessTimer.cpp:
443         (WebKit::BackgroundProcessResponsivenessTimer::setResponsive):
444         * UIProcess/ResponsivenessTimer.cpp:
445         (WebKit::ResponsivenessTimer::timerFired):
446         * UIProcess/ResponsivenessTimer.h:
447         * UIProcess/WebProcessProxy.h:
448
449 2019-08-01  Youenn Fablet  <youenn@apple.com>
450
451         UserMediaPermissionRequestManagerProxy should not use audio+video denied requests to deny audio-only or video-only requests
452         https://bugs.webkit.org/show_bug.cgi?id=200317
453
454         Reviewed by Eric Carlson.
455
456         Only match audio+video denied requests with new audio+video requests.
457         That will ensure that audio can still be captured if user denied access to the camera through preferences
458         and website started with a getUserMedia({audio: true, video: true}) call.
459         Covered by added API test.
460
461         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
462         (WebKit::UserMediaPermissionRequestManagerProxy::wasRequestDenied):
463
464 2019-08-01  Carlos Garcia Campos  <cgarcia@igalia.com>
465
466         [SOUP] WebSockets: add support for extensions when using web sockets libsoup API
467         https://bugs.webkit.org/show_bug.cgi?id=199943
468
469         Reviewed by Alex Christensen.
470
471         * NetworkProcess/NetworkSocketChannel.cpp:
472         (WebKit::NetworkSocketChannel::didConnect): Add extensions parameter and pass it to the IPC message.
473         * NetworkProcess/NetworkSocketChannel.h:
474         * NetworkProcess/cocoa/WebSocketTaskCocoa.mm:
475         (WebKit::WebSocketTask::didConnect): Pass empty extensions string.
476         * NetworkProcess/soup/WebSocketTaskSoup.cpp:
477         (WebKit::WebSocketTask::acceptedExtensions const): Build the accepted extensions string.
478         (WebKit::WebSocketTask::didConnect): Pass accepted extensions to NetworkSocketChannel::didConnect().
479         * NetworkProcess/soup/WebSocketTaskSoup.h:
480         * WebProcess/Network/WebSocketChannel.cpp:
481         (WebKit::WebSocketChannel::extensions): Return the extensions string received from the network process.
482         (WebKit::WebSocketChannel::didConnect): Save the extensions string.
483         * WebProcess/Network/WebSocketChannel.h:
484         * WebProcess/Network/WebSocketChannel.messages.in:
485
486 2019-08-01  Carlos Garcia Campos  <cgarcia@igalia.com>
487
488         [SOUP] Switch to use libsoup WebSockets API
489         https://bugs.webkit.org/show_bug.cgi?id=200162
490
491         Reviewed by Michael Catanzaro.
492
493         Remove temporary method added for old WebSockets implementation.
494
495         * NetworkProcess/NetworkStorageSessionProvider.h:
496
497 2019-07-31  Dean Jackson  <dino@apple.com>
498
499         WKImagePreviewViewController not being autoreleased
500         https://bugs.webkit.org/show_bug.cgi?id=200325
501         <rdar://problem/53788214>
502
503         Reviewed by Wenson Hsieh.
504
505         Wenson noticed I wasn't autoreleasing the WKImagePreviewViewController.
506
507         * UIProcess/ios/WKContentViewInteraction.mm:
508         (-[WKContentView continueContextMenuInteraction:]):
509
510 2019-07-31  Chris Dumez  <cdumez@apple.com>
511
512         REGRESSION (r247486?): Flaky API Test TestWebKitAPI.WKWebView.LocalStorageProcessSuspends
513         https://bugs.webkit.org/show_bug.cgi?id=200086
514         <rdar://problem/53501721>
515
516         Reviewed by Alex Christensen.
517
518         The test would first send a ProcessWillSuspendImminently IPC to the NetworkProcess and then
519         run JS in the WebContent process, which would in turn send IPC to the NetworkProcess. The
520         test was flaky because it expected the network process to receive the IPC from the UIProcess
521         *before* the one from the WebContent process. However, there is no guarantee about ordering
522         from IPC messages coming from different connections.
523
524         To address the flakiness, this patch introduces a new ProcessWillSuspendImminentlyForTesting
525         synchronous IPC and uses this instead. As a result, it is now guaranteed that the network
526         process processes this IPC *before* receiving any IPC from the WebContent process that is
527         the result of IPC from the UIProcess.
528
529         * NetworkProcess/NetworkProcess.cpp:
530         (WebKit::NetworkProcess::processWillSuspendImminentlyForTestingSync):
531         * NetworkProcess/NetworkProcess.h:
532         * NetworkProcess/NetworkProcess.messages.in:
533         * UIProcess/API/Cocoa/WKProcessPool.mm:
534         (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):
535         * UIProcess/Network/NetworkProcessProxy.cpp:
536         (WebKit::NetworkProcessProxy::sendProcessWillSuspendImminentlyForTesting):
537         * UIProcess/Network/NetworkProcessProxy.h:
538         * UIProcess/WebProcessPool.cpp:
539         (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminentlyForTesting):
540         (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently): Deleted.
541         * UIProcess/WebProcessPool.h:
542
543 2019-07-31  Wenson Hsieh  <wenson_hsieh@apple.com>
544
545         [iOS 13] Safari crashes when closing a tab with a focused element if the unified field has focus
546         https://bugs.webkit.org/show_bug.cgi?id=200291
547         <rdar://problem/53717946>
548
549         Reviewed by Megan Gardner.
550
551         Makes -requestAutocorrectionContextWithCompletionHandler: robust in the case where the web page has been closed,
552         and there is no Connection object to use when waiting for a sync IPC response.
553
554         Test: AutocorrectionTests.RequestAutocorrectionContextAfterClosingPage
555
556         * UIProcess/ios/WKContentViewInteraction.mm:
557         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
558
559 2019-07-31  Chris Fleizach  <cfleizach@apple.com>
560
561         AX: com.apple.WebKit.WebContent at com.apple.WebKit: -[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]
562         https://bugs.webkit.org/show_bug.cgi?id=200277
563         <rdar://problem/49475009>
564
565         Reviewed by Per Arne Vollan.
566
567         Verify Page is available before calling into it.
568
569         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
570         (-[WKAccessibilityWebPageObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
571
572 2019-07-31  Carlos Garcia Campos  <cgarcia@igalia.com>
573
574         [GTK] Datalist element support for TextFieldInputType
575         https://bugs.webkit.org/show_bug.cgi?id=98934
576
577         Reviewed by Michael Catanzaro.
578
579         Add a WebDataListSuggestionsDropdown implementation for the GTK port using a popup window with a tree view list.
580
581         * Sources.txt:
582         * SourcesGTK.txt:
583         * UIProcess/API/gtk/PageClientImpl.cpp:
584         (WebKit::PageClientImpl::createDataListSuggestionsDropdown):
585         * UIProcess/API/gtk/PageClientImpl.h:
586         * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp: Added.
587         (WebKit::firstTimeItemSelectedCallback):
588         (WebKit::WebDataListSuggestionsDropdownGtk::WebDataListSuggestionsDropdownGtk):
589         (WebKit::WebDataListSuggestionsDropdownGtk::~WebDataListSuggestionsDropdownGtk):
590         (WebKit::WebDataListSuggestionsDropdownGtk::treeViewRowActivatedCallback):
591         (WebKit::WebDataListSuggestionsDropdownGtk::didSelectOption):
592         (WebKit::WebDataListSuggestionsDropdownGtk::show):
593         (WebKit::WebDataListSuggestionsDropdownGtk::handleKeydownWithIdentifier):
594         (WebKit::WebDataListSuggestionsDropdownGtk::close):
595         * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.h: Copied from Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.h.
596
597 2019-07-31  Tim Horton  <timothy_horton@apple.com>
598
599         Remove WebKit2 Makefile guards for pre-Snow Leopard macOS
600         https://bugs.webkit.org/show_bug.cgi?id=200294
601
602         Reviewed by Dan Bernstein.
603
604         * Makefile:
605         It seems ... unlikely ... that anyone is trying to build
606         trunk WebKit for Leopard or prior.
607
608 2019-07-30  Fujii Hironori  <Hironori.Fujii@sony.com>
609
610         [WebKit] Add PageLoadState::Observer C API
611         https://bugs.webkit.org/show_bug.cgi?id=199848
612
613         Reviewed by Alex Christensen.
614
615         There is no WebKit C API to get the timing of title changed since
616         WKPageLoaderClientV0::didReceiveTitleForFrame has been removed in
617         r235398. Cocoa and glib WebKit API exist.
618
619         * PlatformWin.cmake:
620         * UIProcess/API/C/WKPage.cpp:
621         (WKPageSetPageStateClient):
622         * UIProcess/API/C/WKPage.h: Added WKPageSetPageStateClient.
623         * UIProcess/API/C/WKPageStateClient.h: Added.
624         * UIProcess/WebPageProxy.cpp:
625         (WebKit::WebPageProxy::setPageLoadStateObserver):
626         * UIProcess/WebPageProxy.h:
627         * WebKit.xcodeproj/project.pbxproj:
628
629 2019-07-30  Chris Dumez  <cdumez@apple.com>
630
631         Fix non-thread safe use of WeakPtr under sendSecItemRequest()
632         https://bugs.webkit.org/show_bug.cgi?id=200249
633
634         Reviewed by Alex Christensen.
635
636         The function was calling globalNetworkProcess() from a background thread. This is not safe because
637         globalNetworkProcess() deferences a WeakPtr<NetworkProcess> internally and the NetworkProcess object
638         gets destroyed on the main thread.
639
640         * Shared/mac/SecItemShim.cpp:
641         (WebKit::sendSecItemRequest):
642
643 2019-07-24  Carlos Garcia Campos  <cgarcia@igalia.com>
644
645         [SOUP] Move SoupNetworkSession ownership from NetworkStorageSession to NetworkSession
646         https://bugs.webkit.org/show_bug.cgi?id=200076
647
648         Reviewed by Michael Catanzaro.
649
650         NetworkStorageSession should only own the cookie jar, since it's the only thing it handles from the session.
651
652         * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp:
653         (WebKit::WebCookieManager::setCookiePersistentStorage): Use the network session instead of the storage session
654         to set the peristent cookie storage.
655         * NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp:
656         (WebKit::LegacyCustomProtocolManager::registerScheme): Iterate network sessions instead of storage sessions to
657         access the SoupNetworkSession.
658         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
659         (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated): Use
660         NetworkProcess::forEachNetworkSession() to iterate network sessions.
661         * NetworkProcess/NetworkProcess.cpp:
662         (WebKit::NetworkProcess::lowMemoryHandler): Ditto.
663         (WebKit::NetworkProcess::forEachNetworkSession): Added to iterate network sessions intead of exposing the map
664         that is always used to iterate the sessions.
665         (WebKit::NetworkProcess::switchToNewTestingSession): Use the new NetworkStorageSession constructor API.
666         (WebKit::NetworkProcess::ensureSession): Ditto.
667         (WebKit::NetworkProcess::destroySession): Allow to destroy the default session for soup based ports. This is
668         only called right before process exit to ensure we don't leak network resources like the cookies database.
669         (WebKit::NetworkProcess::setResourceLoadStatisticsEnabled): Use NetworkProcess::forEachNetworkSession() to
670         iterate network sessions.
671         (WebKit::NetworkProcess::fetchWebsiteData): Ditto.
672         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): Ditto.
673         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains): Ditto.
674         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData): Ditto.
675         (WebKit::NetworkProcess::setCacheModel): Ditto.
676         (WebKit::NetworkProcess::actualPrepareToSuspend): Ditto.
677         (WebKit::NetworkProcess::resume): Ditto.
678         * NetworkProcess/NetworkProcess.h:
679         * NetworkProcess/NetworkStorageSessionProvider.h:
680         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
681         (WebKit::NetworkProcess::clearDiskCache): Ditto.
682         * NetworkProcess/ios/NetworkProcessIOS.mm:
683         (WebKit::NetworkProcess::clearCacheForAllOrigins): Ditto.
684         * NetworkProcess/soup/NetworkProcessMainSoup.cpp: Destroy the default session before process exists.
685         * NetworkProcess/soup/NetworkProcessSoup.cpp:
686         (WebKit::NetworkProcess::userPreferredLanguagesChanged): Iterate network sessions instead of storage sessions to
687         access the SoupNetworkSession.
688         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const): Use the new NetworkStorageSession constructor API.
689         (WebKit::NetworkProcess::clearDiskCache): Use NetworkProcess::forEachNetworkSession() to iterate network sessions.
690         (WebKit::NetworkProcess::setNetworkProxySettings): Iterate network sessions instead of storage sessions to
691         access the SoupNetworkSession.
692         * NetworkProcess/soup/NetworkSessionSoup.cpp:
693         (WebKit::NetworkSessionSoup::NetworkSessionSoup): Create the SoupNetworkSession and setup cookies.
694         (WebKit::NetworkSessionSoup::soupSession const): Return the SoupSession of SoupNetworkSession.
695         (WebKit::NetworkSessionSoup::setCookiePersistentStorage): Setup a new cookie jar.
696         * NetworkProcess/soup/NetworkSessionSoup.h:
697
698 2019-07-30  Truitt Savell  <tsavell@apple.com>
699
700         Unreviewed, rolling out r247932.
701
702         Broke 8 API tests across all platforms.
703
704         Reverted changeset:
705
706         "Fix non-thread safe use of WeakPtr under
707         sendSecItemRequest()"
708         https://bugs.webkit.org/show_bug.cgi?id=200249
709         https://trac.webkit.org/changeset/247932
710
711 2019-07-29  Wenson Hsieh  <wenson_hsieh@apple.com>
712
713         YouTube search field shows RTL text outside its border on iPadOS
714         https://bugs.webkit.org/show_bug.cgi?id=200253
715         <rdar://problem/53680603>
716
717         Reviewed by Beth Dakin.
718
719         Limits code added in r238939 to respect the current keyboard's writing mode to only editable web views. This
720         behavior was only intended for Mail, and isn't generally compatible with web content.
721
722         While the call to -setInitialDirection is correctly gated on an web view editability check, it appears that
723         other changes in iOS 13 now cause -setBaseWritingDirection:forRange: to be invoked directly from keyboards code.
724         This means that -setBaseWritingDirection:forRange: should additionally be guarded with the same check.
725
726         * UIProcess/ios/WKContentViewInteraction.mm:
727         (-[WKContentView setBaseWritingDirection:forRange:]):
728
729 2019-07-29  Sihui Liu  <sihui_liu@apple.com>
730
731         Try fixing crash at com.apple.WebKit.Networking: NetworkProcess::setSharedHTTPCookieStorage
732         https://bugs.webkit.org/show_bug.cgi?id=200189
733         <rdar://problem/41325767>
734
735         Reviewed by Chris Dumez.
736
737         The crash indicates that sharedCookieStorage is accessed before being set in network process. 
738         sharedCookieStorage is set during the processing of InitializeNetworkProcess message, and access to 
739         sharedCookieStorage is supposed to happen after that. Therefore, it is likely some message is received and 
740         handled before InitializeNetworkProcess. 
741  
742         One possible explanation is WebKit APIs get called on different threads. Because of the race in checking and 
743         setting m_networkProcess, some message is sent between network process gets launched (m_networkProcess is set) 
744         and InitializeNetworkProcess message is sent. To mitigate this issue, we make sure m_networkProcess is set only
745         in the main runloop and only after InitializeNetworkProcess is sent. 
746
747         * UIProcess/WebProcessPool.cpp:
748         (WebKit::WebProcessPool::ensureNetworkProcess):
749
750 2019-07-29  Chris Dumez  <cdumez@apple.com>
751
752         Fix non-thread safe use of WeakPtr under sendSecItemRequest()
753         https://bugs.webkit.org/show_bug.cgi?id=200249
754
755         Reviewed by Alex Christensen.
756
757         The function was calling globalNetworkProcess() from a background thread. This is not safe because
758         globalNetworkProcess() deferences a WeakPtr<NetworkProcess> internally and the NetworkProcess object
759         gets destroyed on the main thread.
760
761         * Shared/mac/SecItemShim.cpp:
762         (WebKit::sendSecItemRequest):
763
764 2019-07-29  Zalan Bujtas  <zalan@apple.com>
765
766         [ContentChangeObserver] didFinishContentChangeObserving should include the type of content change.
767         https://bugs.webkit.org/show_bug.cgi?id=200247
768         <rdar://problem/53681149>
769
770         Reviewed by Simon Fraser.
771
772         * WebProcess/WebCoreSupport/WebChromeClient.h:
773         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
774         (WebKit::WebChromeClient::didFinishContentChangeObserving):
775         * WebProcess/WebPage/WebPage.h:
776         * WebProcess/WebPage/ios/WebPageIOS.mm:
777         (WebKit::WebPage::didFinishContentChangeObserving):
778
779 2019-07-29  Youenn Fablet  <youenn@apple.com>
780
781         REGRESSION: WebSockets no longer work in Service Workers
782         https://bugs.webkit.org/show_bug.cgi?id=199906
783         <rdar://problem/53516732>
784
785         Reviewed by Geoffrey Garen.
786
787         Use WebSocketProvider so that network calls are done in the network process.
788
789         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
790         (WebKit::WebSWContextManagerConnection::installServiceWorker):
791
792 2019-07-29  Zalan Bujtas  <zalan@apple.com>
793
794         [ContentChangeObserver] ChromeClient::observedContentChange() name is misleading
795         https://bugs.webkit.org/show_bug.cgi?id=200238
796         <rdar://problem/53677038>
797
798         Reviewed by Simon Fraser.
799
800         * WebProcess/WebCoreSupport/WebChromeClient.h:
801         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
802         (WebKit::WebChromeClient::didFinishContentChangeObserving):
803         (WebKit::WebChromeClient::observedContentChange): Deleted.
804         * WebProcess/WebPage/WebPage.h:
805         * WebProcess/WebPage/ios/WebPageIOS.mm:
806         (WebKit::WebPage::didFinishContentChangeObserving):
807         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver): Deleted.
808
809 2019-07-26  Ryosuke Niwa  <rniwa@webkit.org>
810
811         ShareableBitmap::createGraphicsContext() should return nullptr when CGBitmapContextCreateWithData returns nil
812         https://bugs.webkit.org/show_bug.cgi?id=200185
813
814         Reviewed by Simon Fraser.
815
816         We should not be creating GraphicsContext with nil CGContextRef in ShareableBitmap::createGraphicsContext()
817         as such a GraphicsContext is only used for specific purposes.
818
819         This patch adds an early return to ShareableBitmap::createGraphicsContext() when CGBitmapContextCreateWithData
820         returns nil CGContextRef.
821
822         * PluginProcess/PluginControllerProxy.cpp:
823         (WebKit::PluginControllerProxy::paint):
824         * Shared/API/c/cg/WKImageCG.cpp:
825         (WKImageCreateFromCGImage):
826         * Shared/ContextMenuContextData.cpp:
827         (WebKit::ContextMenuContextData::ContextMenuContextData):
828         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
829         (WebKit::RemoteLayerBackingStore::display):
830         * Shared/WebCoreArgumentCoders.cpp:
831         (IPC::encodeImage):
832         * Shared/cg/ShareableBitmapCG.cpp:
833         (WebKit::ShareableBitmap::createGraphicsContext):
834         (WebKit::ShareableBitmap::makeCGImageCopy):
835         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
836         (WebKit::imageForRect):
837         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
838         (WebKit::InjectedBundleRangeHandle::renderedImage):
839         * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp:
840         (WebKit::InjectedBundleHitTestResult::image const):
841         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
842         (WebKit::NetscapePlugin::snapshot):
843         * WebProcess/Plugins/PDF/PDFPlugin.mm:
844         (WebKit::PDFPlugin::snapshot):
845         * WebProcess/Plugins/PluginProxy.cpp:
846         (WebKit::PluginProxy::paint):
847         (WebKit::PluginProxy::update):
848         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
849         (WebKit::convertCGImageToBitmap):
850         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
851         (WebKit::DrawingAreaCoordinatedGraphics::display):
852         * WebProcess/WebPage/WebFrame.cpp:
853         (WebKit::WebFrame::createSelectionSnapshot const):
854         * WebProcess/WebPage/WebPage.cpp:
855         (WebKit::WebPage::snapshotAtSize):
856         (WebKit::WebPage::snapshotNode):
857         (WebKit::WebPage::drawRectToImage):
858
859 2019-07-29  Dean Jackson  <dino@apple.com>
860
861         Contextual menu does not present when holding an embedded photo but works with link and attachments
862         https://bugs.webkit.org/show_bug.cgi?id=200239
863         <rdar://problem/53318733>
864
865         Reviewed by Tim Horton.
866
867         If the user long-pressed on an image, and the client implemented the new API but did
868         not provide a configuration, we were not falling back to the default behaviour of
869         giving a menu allowing the user to copy/share/save the image.
870
871         * UIProcess/ios/WKContentViewInteraction.mm:
872         (-[WKContentView continueContextMenuInteraction:]): If we get through the delegates,
873         and the element is an image, return the default configuration.
874
875 2019-07-29  Chris Dumez  <cdumez@apple.com>
876
877         Remove unnecessary null check under WebResourceLoadStatisticsStore::hasStorageAccess()
878         https://bugs.webkit.org/show_bug.cgi?id=200229
879
880         Reviewed by Alex Christensen.
881
882         Remove unnecessary null check under WebResourceLoadStatisticsStore::hasStorageAccess().
883         There is already a null check with an early return a few lines above.
884
885         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
886         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
887
888 2019-07-29  Wenson Hsieh  <wenson_hsieh@apple.com>
889
890         UI process occasionally hangs in -[UIKeyboardTaskQueue lockWhenReadyForMainThread]
891         https://bugs.webkit.org/show_bug.cgi?id=200215
892         <rdar://problem/52976965>
893
894         Reviewed by Tim Horton.
895
896         To implement autocorrection on iOS, UIKit sometimes needs to request contextual information from WebKit. This is
897         handled as a sync IPC message in WebKit, since UIKit would otherwise proceed to block the main thread after
898         sending the request, preventing WebKit from handling any IPC responses in the UI process (potentially resulting
899         in deadlock if any other sync IPC messages were to arrive in the UI process during this time).
900
901         The synchronous nature of this autocorrection request means that if any sync IPC message were to be
902         simultaneously dispatched in the opposite direction (i.e. web to UI process), we need to immediately handle the
903         incoming sync message in the UI process (otherwise, we'd end up deadlocking for 1 second until the
904         autocorrection context request hits a 1-second IPC timeout).
905
906         One such synchronous message from the web process to the UI process is WebPageProxy::CreateNewPage, triggered as
907         a result of synchronously opening a new window. Due to Safari changes in iOS 13 (<rdar://problem/51755088>),
908         this message now calls into code which then causes UIKit to call *back into* -[WKContentView
909         requestAutocorrectionContextWithCompletionHandler:] for the newly opened web view, under the scope of the call
910         to -requestAutocorrectionContextWithCompletionHandler: in the original web view.
911
912         This caused a crash, which was tracked in <rdar://problem/52590170>. There was an attempt to fix this in r247345
913         by invoking the existing handler well before storing the new one; while this avoided the crash, it didn't solve
914         the root problem, which was that keyboard task queues would get into a bad state after this scenario; this would
915         manifest in a UI process hang under -[UIKeyboardTaskQueue lockWhenReadyForMainThread] during the next user
916         gesture, which is tracked by this bug (<rdar://problem/52976965>).
917
918         As it turns out, the keyboard task queue gets into a bad state because it is architected in such a way that
919         tasks added to the queue under the scope of parent task must be finished executing before their parents;
920         otherwise, the call to -[UIKeyboardTaskExecutionContext returnExecutionToParentWithInfo:] never happens when
921         handling the child task. This has the effect of causing the keyboard task queue to end up with a
922         UIKeyboardTaskExecutionContext that can never return execution to its parent context, such that if the task
923         queue is then told to wait until any future task is finished executing, it will hang forever, waiting for these
924         stuck tasks to finish executing (which never happens, because they're all waiting to return execution to their
925         parents which are already done executing!)
926
927         To fix this hang and avoid ever getting into this bad state, we need to invoke the autocorrection request
928         handlers in this order:
929
930         (1) Receive outer autocorrection context request.
931         (2) Receive inner autocorrection context request.
932         (3) Invoke inner autocorrection context request completion handler.
933         (4) Invoke outer autocorrection context request completion handler.
934
935         ...instead of swapping (3) and (4), like we do currently.
936
937         * UIProcess/ios/WKContentViewInteraction.mm:
938         (-[WKContentView resignFirstResponderForWebView]):
939
940         Remove the hack added in r247345 to try and avoid reentrant autocorrection context requests; we don't need this
941         anymore, since we should now be able to handle these reentrant requests in the way UIKit expects.
942
943         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
944
945         Add an early return in the case where the request is synchronous and there's already a pending autocorrection
946         context to ensure that the completion handler for the nested request is invoked before the outer request is
947         finished.
948
949 2019-07-29  Simon Fraser  <simon.fraser@apple.com>
950
951         Can't scroll on yummly.co.uk recipe (scale(0) div covers the content and hit-tests)
952         https://bugs.webkit.org/show_bug.cgi?id=200263
953         rdar://problem/53679408
954
955         Reviewed by Antti Koivisto.
956
957         The content on this page had a scale(0) div overlaying an overflow:scroll element,
958         and our UI-side hit-testing code would find this scale(0) element, because apparently
959         -[UIView convertPoint:fromView:] will happily work with non-invertible matrices, and 
960         -[UIView pointInside:withEvent:] just compares the point with the view bounds.
961
962         Since the view frame takes the transform into account, we can look for an empty frame
963         to detect these non-invertible transforms.
964
965         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
966         (WebKit::collectDescendantViewsAtPoint):
967
968 2019-07-29  Youenn Fablet  <youenn@apple.com>
969
970         NetworkProcess clear and fetch of cache entries might move the callback aggregator more than once
971         https://bugs.webkit.org/show_bug.cgi?id=200228
972
973         Reviewed by Alex Christensen.
974
975         copyRef the callback aggregator instead of moving it.
976
977         * NetworkProcess/NetworkProcess.cpp:
978         (WebKit::NetworkProcess::fetchWebsiteData):
979         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
980
981 2019-07-29  Chris Dumez  <cdumez@apple.com>
982
983         Possible use-after-move under NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated()
984         https://bugs.webkit.org/show_bug.cgi?id=200225
985
986         Reviewed by Brent Fulgham.
987
988         The code was WTFMove()-ing the method parameter inside of a loop, which means that it could
989         move it several times. Instead of copying the parameters, I opted into sending the statistics
990         only to the network session that matches this WebProcess connection.
991
992         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
993         (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
994
995 2019-07-27  Chris Dumez  <cdumez@apple.com>
996
997         Allow more syscalls in the WebContent process' sandbox profile
998         https://bugs.webkit.org/show_bug.cgi?id=200182
999         <rdar://problem/53594973>
1000
1001         Reviewed by Geoffrey Garen.
1002
1003         I reviewed all crash traces attached to the radar and found the following
1004         syscalls that we not yet allowed by the WebContent process's sandbox
1005         profile.
1006
1007         * WebProcess/com.apple.WebProcess.sb.in:
1008
1009 2019-07-26  Jiewen Tan  <jiewen_tan@apple.com>
1010
1011         NavigationSOAuthorizationSession should check the active URL of the responding page after waking up from waiting
1012         https://bugs.webkit.org/show_bug.cgi?id=200150
1013         <rdar://problem/53280170>
1014
1015         Reviewed by Brent Fulgham.
1016
1017         NavigationSOAuthorizationSession should check the active URL of the responding page after waking up from waiting
1018         as the page might have already changed the location.
1019
1020         * UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.h:
1021         * UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm:
1022         (WebKit::NavigationSOAuthorizationSession::shouldStartInternal):
1023         (WebKit::NavigationSOAuthorizationSession::webViewDidMoveToWindow):
1024         (WebKit::NavigationSOAuthorizationSession::pageActiveURLDidChangeDuringWaiting const):
1025         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm:
1026         (WebKit::SubFrameSOAuthorizationSession::abortInternal):
1027
1028 2019-07-26  Chris Dumez  <cdumez@apple.com>
1029
1030         Crashes under XPCServiceMain() / mach_msg_trap() due to sandboxing
1031         https://bugs.webkit.org/show_bug.cgi?id=200173
1032         <rdar://problem/53594973>
1033
1034         Reviewed by Per Arne Vollan.
1035
1036         Allow a few more syscalls as they appear to be needed by mach_msg_trap().
1037
1038         * WebProcess/com.apple.WebProcess.sb.in:
1039
1040 2019-07-26  Daniel Bates  <dabates@apple.com>
1041
1042         [iOS] REGRESSION: Keyboard dismisses and reappears when typing 2FA pin on appleid.apple.com
1043         https://bugs.webkit.org/show_bug.cgi?id=200171
1044         <rdar://problem/50245251>
1045
1046         Reviewed by Wenson Hsieh.
1047
1048         Take out an InputViewUpdateDeferrer token (if we don't already have one) to temporarily defer
1049         tearing down the input view (keyboard) before bluring the previously focused element as part
1050         of switching between focused elements. This avoid a noticeable flash caused by UIKit animating
1051         out and animating in the keyboard should the newly focused element require the keyboard. We
1052         only take out the InputViewUpdateDeferrer until we fall off the end of _elementDidFocus: (or
1053         bail early). Once we fall of the end UIKit will update input view UI.
1054
1055         * UIProcess/ios/WKContentViewInteraction.mm:
1056         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
1057
1058 2019-07-26  Chris Dumez  <cdumez@apple.com>
1059
1060         Avoid WebContent process SIGKILL when using kevent()
1061         https://bugs.webkit.org/show_bug.cgi?id=200170
1062         <rdar://problem/51559921>
1063
1064         Reviewed by Per Arne Vollan.
1065
1066         Avoid WebContent process SIGKILL when using kevent() by updated its sandboxing profile.
1067
1068         * WebProcess/com.apple.WebProcess.sb.in:
1069
1070 2019-07-26  Chris Dumez  <cdumez@apple.com>
1071
1072         [iOS] WebPage::TouchEventSync() & WebPage::GetPositionInformation() sync IPC causes UIProcess hangs
1073         https://bugs.webkit.org/show_bug.cgi?id=200138
1074         <rdar://problem/52698157>
1075
1076         Reviewed by Geoffrey Garen.
1077
1078         Revert most of r247822 and use an alternative approach to address hangs. In this patch, the proposal
1079         is to add a SendSyncOption::ForceDispatchWhenDestinationIsWaitingForUnboundedSyncReply flag on the
1080         WebPage::TouchEventSync() & WebPage::GetPositionInformation() sendSync() calls in the UIProcess.
1081         Those will cause this IPCs to get dispatched right away in the WebContent process, even if the
1082         WebContent process is itself currently stuck on unbounded (i.e. potentially slow) synchronous IPC
1083         (JS alerts / prompts & sync XHR). Because re-entering WebCore on sync IPC is generally unsafe, this
1084         patch also updates the WebPage::getPositionInformation() & WebPage::touchEventSync() to return early
1085         (i.e. cancelled) if they get called while the WebContent process is stuck on a slow sendSync.
1086
1087         This approach should address the UIProcess hangs caused by the WebPage::TouchEventSync() and
1088         WebPage::GetPositionInformation() sync IPC messages when the WebContent process is busy on a slow XHR
1089         or a JS prompt / alert. It should be safe because we do not re-enter WebCore. The only drawback is that
1090         those IPCs will be cancelled (early return with default value) when the WebContent process is busy.
1091         However, I am being told that this is likely acceptable in practice.        
1092
1093         * Platform/IPC/Connection.cpp:
1094         (IPC::Connection::SyncMessageState::processIncomingMessage):
1095         (IPC::Connection::sendMessage):
1096         (IPC::Connection::sendSyncMessage):
1097         (IPC::Connection::dispatchMessage):
1098         * Platform/IPC/Connection.h:
1099         (IPC::UnboundedSynchronousIPCScope::UnboundedSynchronousIPCScope):
1100         (IPC::UnboundedSynchronousIPCScope::~UnboundedSynchronousIPCScope):
1101         (IPC::UnboundedSynchronousIPCScope::hasOngoingUnboundedSyncIPC):
1102         * Platform/IPC/Decoder.cpp:
1103         (IPC::Decoder::shouldDispatchMessageWhenWaitingForSyncReply const):
1104         * Platform/IPC/Decoder.h:
1105         * Platform/IPC/Encoder.cpp:
1106         (IPC::Encoder::shouldDispatchMessageWhenWaitingForSyncReply const):
1107         (IPC::Encoder::setShouldDispatchMessageWhenWaitingForSyncReply):
1108         (IPC::Encoder::wrapForTesting):
1109         * Platform/IPC/Encoder.h:
1110         * Platform/IPC/MessageFlags.h:
1111         * UIProcess/Network/NetworkProcessProxy.cpp:
1112         (WebKit::NetworkProcessProxy::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
1113         * UIProcess/WebPageProxy.cpp:
1114         (WebKit::WebPageProxy::handleTouchEventSynchronously):
1115         * UIProcess/ios/WKContentViewInteraction.mm:
1116         (-[WKContentView ensurePositionInformationIsUpToDate:]):
1117         * WebProcess/Network/WebLoaderStrategy.cpp:
1118         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1119         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1120         (WebKit::WebChromeClient::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
1121         (WebKit::WebChromeClient::runJavaScriptAlert):
1122         (WebKit::WebChromeClient::runJavaScriptConfirm):
1123         (WebKit::WebChromeClient::runJavaScriptPrompt):
1124         * WebProcess/WebPage/WebPage.cpp:
1125         (WebKit::WebPage::layerVolatilityTimerFired):
1126         (WebKit::WebPage::markLayersVolatile):
1127         (WebKit::WebPage::cancelMarkLayersVolatile):
1128         (WebKit::WebPage::touchEventSync):
1129         (WebKit::WebPage::didCompletePageTransition):
1130         (WebKit::WebPage::updatePreferences):
1131         (WebKit::WebPage::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
1132         * WebProcess/WebPage/WebPage.h:
1133         (WebKit::WebPage::sendSyncWithDelayedReply):
1134         * WebProcess/WebPage/ios/WebPageIOS.mm:
1135         (WebKit::WebPage::getPositionInformation):
1136
1137 2019-07-26  Zalan Bujtas  <zalan@apple.com>
1138
1139         Unable to tap/double tap to open files/folders in Google Drive in Safari
1140         https://bugs.webkit.org/show_bug.cgi?id=200096
1141         <rdar://problem/52748552>
1142
1143         Reviewed by Wenson Hsieh.
1144
1145         This patch reverts to the original double-tap-for-double-click implementation (see r244775 and r246347 for more information).
1146
1147         * Shared/WebPageCreationParameters.cpp:
1148         (WebKit::WebPageCreationParameters::encode const):
1149         (WebKit::WebPageCreationParameters::decode):
1150         * Shared/WebPageCreationParameters.h:
1151         * UIProcess/PageClient.h:
1152         * UIProcess/WebPageProxy.cpp:
1153         (WebKit::WebPageProxy::creationParameters):
1154         * UIProcess/WebPageProxy.h:
1155         * UIProcess/ios/PageClientImplIOS.h:
1156         * UIProcess/ios/PageClientImplIOS.mm:
1157         (WebKit::PageClientImpl::doubleTapForDoubleClickDelay): Deleted.
1158         (WebKit::PageClientImpl::doubleTapForDoubleClickRadius): Deleted.
1159         * UIProcess/ios/WKContentViewInteraction.h:
1160         * UIProcess/ios/WKContentViewInteraction.mm:
1161         (-[WKContentView setupInteraction]):
1162         (-[WKContentView cleanupInteraction]):
1163         (-[WKContentView _removeDefaultGestureRecognizers]):
1164         (-[WKContentView _addDefaultGestureRecognizers]):
1165         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): Do not recognize the single and double gestures the same time.
1166         (-[WKContentView gestureRecognizerShouldBegin:]):
1167         (-[WKContentView _doubleTapRecognizedForDoubleClick:]):
1168         (-[WKContentView _didStartProvisionalLoadForMainFrame]):
1169         (-[WKContentView _ensureNonBlockingDoubleTapGestureRecognizer]): Deleted.
1170         (-[WKContentView _doubleTapForDoubleClickDelay]): Deleted.
1171         (-[WKContentView _doubleTapForDoubleClickRadius]): Deleted.
1172         * UIProcess/ios/WebPageProxyIOS.mm:
1173         (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
1174         * WebProcess/WebPage/WebPage.cpp:
1175         * WebProcess/WebPage/WebPage.h:
1176         * WebProcess/WebPage/WebPage.messages.in:
1177         * WebProcess/WebPage/ios/WebPageIOS.mm:
1178         (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
1179         (WebKit::WebPage::commitPotentialTap):
1180         (WebKit::WebPage::handlePotentialDoubleTapForDoubleClickAtPoint): Deleted.
1181
1182 2019-07-26  Eric Liang  <ericliang@apple.com>
1183
1184         AX: web process should load correct bundle path for MACCATALYST
1185         https://bugs.webkit.org/show_bug.cgi?id=200122
1186
1187         Reviewed by Brent Fulgham.
1188
1189         Added the path to accessibility bundle for Mac Catalyst.
1190         Added sandbox profile to read accessibility settings.
1191
1192         * WebProcess/cocoa/WebProcessCocoa.mm:
1193         (WebKit::registerWithAccessibility):
1194         * WebProcess/com.apple.WebProcess.sb.in:
1195
1196 2019-07-26  Alexander Mikhaylenko  <exalm7659@gmail.com>
1197
1198         REGRESSION(r246496): [GTK] Tapping the web view scrolls up a bit
1199         https://bugs.webkit.org/show_bug.cgi?id=200084
1200
1201         Reviewed by Carlos Garcia Campos.
1202
1203         gdk_event_get_scroll_direction() returns false, but also sets direction to GDK_SCROLL_UP if
1204         the direction was GDK_SCROLL_SMOOTH. Relying on zero deltas in this case is not correct, because
1205         they can also be zero with GDK_SCROLL_SMOOTH. In this case, set the direction manually to avoid
1206         that.
1207
1208         See https://gitlab.gnome.org/GNOME/gtk/issues/2048
1209
1210         * Shared/gtk/WebEventFactory.cpp:
1211         (WebKit::WebEventFactory::createWebWheelEvent):
1212
1213 2019-07-26  Loïc Yhuel  <loic.yhuel@softathome.com>
1214
1215         [WPE] Support disk cache dumping like GTK
1216         https://bugs.webkit.org/show_bug.cgi?id=200157
1217
1218         Reviewed by Carlos Garcia Campos.
1219
1220         Creating or touching "dump" would create the dump.json.
1221
1222         * NetworkProcess/cache/NetworkCache.cpp:
1223         (WebKit::NetworkCache::Cache::Cache):
1224
1225 2019-07-26  Rob Buis  <rbuis@igalia.com>
1226
1227         Make storing cross-origin top-level prefetches in HTTP cache optional
1228         https://bugs.webkit.org/show_bug.cgi?id=199499
1229
1230         Reviewed by Youenn Fablet.
1231
1232         Currently when we navigate we check if there is a cross-origin top-level
1233         prefetch we can use for the navigation. The current solution uses the
1234         HTTP cache as a way to store the prefetch and to immediately use it for
1235         the navigation load. However this solution fails in case the prefetch is
1236         not cacheable.
1237
1238         Instead of this, simulate a HTTP Cache entry to process the load and
1239         afterwards try to store the navigation load into the HTTP cache, where
1240         normal store decisions will be applied.
1241
1242         Test: http/wpt/prefetch/link-prefetch-skip-disk-cache.html
1243
1244         * NetworkProcess/NetworkResourceLoader.cpp:
1245         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1246         (WebKit::NetworkResourceLoader::retrieveCacheEntryInternal):
1247         * NetworkProcess/NetworkResourceLoader.h:
1248
1249 2019-07-25  Zan Dobersek  <zdobersek@igalia.com>
1250
1251         Unreviewed build fix in NetworkDataTaskSoup.
1252
1253         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1254         (WebKit::NetworkDataTaskSoup::authenticateCallback):
1255         Fix incorrect use of the dereferencing operator introduced in r247831.
1256
1257 2019-07-25  Jiewen Tan  <jiewen_tan@apple.com>
1258
1259         Unreviewed, build fix after r247851
1260
1261         * UIProcess/WebPageProxy.cpp:
1262         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1263         Reverts an unnecessary change.
1264
1265 2019-07-25  Fujii Hironori  <fujii.hironori@gmail.com>
1266
1267         [GTK] Indistinguishable overloaded callback function inspectorViewDestroyed if RemoteWebInspectorProxyGtk.cpp and WebInspectorProxyGtk.cpp are in a unified build bundle
1268         https://bugs.webkit.org/show_bug.cgi?id=200123
1269
1270         Reviewed by Carlos Garcia Campos.
1271
1272         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
1273         (WebKit::remoteInspectorViewDestroyed): Added.
1274         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
1275         (WebKit::inspectorViewDestroyed): Deleted.
1276         Renamed inspectorViewDestroyed to remoteInspectorViewDestroyed.
1277
1278 2019-07-25  Jiewen Tan  <jiewen_tan@apple.com>
1279
1280         WebPageProxy::receivedPolicyDecision should check navigation ID before clear pendingAPIRequest
1281         https://bugs.webkit.org/show_bug.cgi?id=200108
1282         <rdar://problem/53521238>
1283
1284         Reviewed by Chris Dumez.
1285
1286         Assuming there are two loads happening one after another. There is an issue when clients save
1287         the first decisionHandler and then call WKNavigationActionPolicyCancel for it right after the
1288         second decisionHandler received, -[WKWebView URL] could return a null string even though it is
1289         loading the second one.
1290
1291         To solve that, this patch pairs a navigationID with the pendingAPIRequestURL such that
1292         WebPageProxy::receivedPolicyDecision could clear the pendingAPIRequestURL only if
1293         the passed navigation ID matches the current one.
1294
1295         * UIProcess/PageLoadState.cpp:
1296         (WebKit::PageLoadState::reset):
1297         (WebKit::PageLoadState::activeURL):
1298         (WebKit::PageLoadState::estimatedProgress):
1299         (WebKit::PageLoadState::pendingAPIRequestURL const):
1300         (WebKit::PageLoadState::pendingAPIRequest const):
1301         (WebKit::PageLoadState::setPendingAPIRequest):
1302         (WebKit::PageLoadState::clearPendingAPIRequest):
1303         (WebKit::PageLoadState::isLoading):
1304         (WebKit::PageLoadState::setPendingAPIRequestURL): Deleted.
1305         (WebKit::PageLoadState::clearPendingAPIRequestURL): Deleted.
1306         * UIProcess/PageLoadState.h:
1307         (WebKit::PageLoadState::setPendingAPIRequest):
1308         (WebKit::PageLoadState::setPendingAPIRequestURL): Deleted.
1309         * UIProcess/WebPageProxy.cpp:
1310         (WebKit::WebPageProxy::launchProcessForReload):
1311         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
1312         (WebKit::WebPageProxy::loadFile):
1313         (WebKit::WebPageProxy::loadDataWithNavigationShared):
1314         (WebKit::WebPageProxy::loadAlternateHTML):
1315         (WebKit::WebPageProxy::loadWebArchiveData):
1316         (WebKit::WebPageProxy::reload):
1317         (WebKit::WebPageProxy::goToBackForwardItem):
1318         (WebKit::WebPageProxy::receivedPolicyDecision):
1319         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1320         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
1321         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
1322         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1323
1324 2019-07-25  Commit Queue  <commit-queue@webkit.org>
1325
1326         Unreviewed, rolling out r247806.
1327         https://bugs.webkit.org/show_bug.cgi?id=200141
1328
1329         It is regressing PLT (Requested by youenn on #webkit).
1330
1331         Reverted changeset:
1332
1333         "Disable speculative loading if cache is not to be used for
1334         the load"
1335         https://bugs.webkit.org/show_bug.cgi?id=199644
1336         https://trac.webkit.org/changeset/247806
1337
1338 2019-07-25  Dean Jackson  <dino@apple.com>
1339
1340         WebKit/UIProcess/ios/WKContentViewInteraction.mm: error: implementing deprecated method contextMenuInteractionWillPresent
1341         https://bugs.webkit.org/show_bug.cgi?id=200136
1342         <rdar://problem/53547698>
1343
1344         Reviewed by Wenson Hsieh.
1345
1346         Ignore deprecation warnings for these UIContextMenuInteraction delegates.
1347
1348         * UIProcess/ios/WKContentViewInteraction.mm:
1349         (-[WKContentView contextMenuInteractionWillPresent:]):
1350         (-[WKContentView contextMenuInteraction:willCommitWithAnimator:]):
1351         (-[WKContentView contextMenuInteractionDidEnd:]):
1352
1353 2019-07-25  Dean Jackson  <dino@apple.com>
1354
1355         Add helper for ignoring deprecated implementation warnings
1356         https://bugs.webkit.org/show_bug.cgi?id=200135
1357
1358         Reviewed by Wenson Hsieh.
1359
1360         Add ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN/END macro which
1361         is IGNORE_WARNINGS_BEGIN("deprecated-implementations")
1362
1363         * UIProcess/API/Cocoa/LegacyBundleForClass.mm:
1364         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
1365         (IGNORE_WARNINGS_BEGIN): Deleted.
1366         * UIProcess/API/Cocoa/WKBrowsingContextGroup.mm:
1367         (IGNORE_WARNINGS_BEGIN): Deleted.
1368         * UIProcess/API/Cocoa/WKConnection.mm:
1369         (IGNORE_WARNINGS_BEGIN): Deleted.
1370         * UIProcess/API/Cocoa/WKPreviewElementInfo.mm:
1371         * UIProcess/API/Cocoa/WKProcessGroup.mm:
1372         (IGNORE_WARNINGS_BEGIN): Deleted.
1373         * UIProcess/API/Cocoa/WKTypeRefWrapper.mm:
1374         * UIProcess/API/Cocoa/WKWebView.mm:
1375         (-[WKWebView ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
1376         (-[WKWebView draggedImage:endedAt:operation:]):
1377         (-[WKWebView accessibilityAttributeValue:]):
1378         (-[WKWebView accessibilityAttributeValue:forParameter:]):
1379         (-[WKWebView namesOfPromisedFilesDroppedAtDestination:]):
1380         (-[WKWebView IGNORE_WARNINGS_END]): Deleted.
1381         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1382         (-[WKWebViewConfiguration ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
1383         (-[WKWebViewConfiguration _setWebsiteDataStore:]):
1384         (-[WKWebViewConfiguration IGNORE_WARNINGS_END]): Deleted.
1385         * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm:
1386         * UIProcess/API/mac/WKView.mm:
1387         (-[WKView ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
1388         (-[WKView draggedImage:endedAt:operation:]):
1389         (-[WKView accessibilityAttributeValue:]):
1390         (-[WKView accessibilityAttributeValue:forParameter:]):
1391         (-[WKView namesOfPromisedFilesDroppedAtDestination:]):
1392         (-[WKView IGNORE_WARNINGS_END]): Deleted.
1393         * UIProcess/WKImagePreviewViewController.mm:
1394         (-[WKImagePreviewViewController ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
1395         (-[WKImagePreviewViewController IGNORE_WARNINGS_END]): Deleted.
1396         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
1397         (-[WKAirPlayRoutePicker popoverControllerDidDismissPopover:]):
1398         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1399         (-[WKFileUploadPanel popoverControllerDidDismissPopover:]):
1400         * UIProcess/ios/forms/WKFormPopover.mm:
1401         (-[WKRotatingPopover popoverControllerDidDismissPopover:]):
1402         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1403         (-[WKPDFPluginAccessibilityObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
1404         (-[WKPDFPluginAccessibilityObject accessibilityAttributeValue:]):
1405         (-[WKPDFPluginAccessibilityObject accessibilityAttributeValue:forParameter:]):
1406         (-[WKPDFPluginAccessibilityObject accessibilityPerformAction:]):
1407         (-[WKPDFPluginAccessibilityObject accessibilityIsAttributeSettable:]):
1408         (-[WKPDFPluginAccessibilityObject accessibilitySetValue:forAttribute:]):
1409         (-[WKPDFPluginAccessibilityObject IGNORE_WARNINGS_END]): Deleted.
1410         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1411         (-[WKAccessibilityWebPageObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
1412         (-[WKAccessibilityWebPageObject accessibilityIsAttributeSettable:]):
1413         (-[WKAccessibilityWebPageObject accessibilitySetValue:forAttribute:]):
1414         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
1415         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]):
1416         (-[WKAccessibilityWebPageObject IGNORE_WARNINGS_END]): Deleted.
1417
1418 2019-07-25  Youenn Fablet  <youenn@apple.com>
1419
1420         Make NetworkSession no longer RefCounted
1421         https://bugs.webkit.org/show_bug.cgi?id=200020
1422
1423         This allows to have a simpler memory management model where
1424         NetworkSession cannot live once removed from the network process session map.
1425         This requires some additional null checks, especially in NetworkDataTask.
1426
1427         Reviewed by Carlos Garcia Campos.
1428
1429         * NetworkProcess/curl/NetworkSessionCurl.h:
1430         * NetworkProcess/soup/NetworkSessionSoup.h:
1431         * NetworkProcess/NetworkDataTask.cpp:
1432         (WebKit::NetworkDataTask::NetworkDataTask):
1433         * NetworkProcess/NetworkDataTask.h:
1434         * NetworkProcess/NetworkDataTaskBlob.cpp:
1435         (WebKit::NetworkDataTaskBlob::~NetworkDataTaskBlob):
1436         (WebKit::NetworkDataTaskBlob::download):
1437         * NetworkProcess/NetworkProcess.cpp:
1438         (WebKit::NetworkProcess::lowMemoryHandler):
1439         (WebKit::NetworkProcess::setSession):
1440         (WebKit::NetworkProcess::destroySession):
1441         (WebKit::NetworkProcess::setResourceLoadStatisticsEnabled):
1442         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
1443         * NetworkProcess/NetworkProcess.h:
1444         (WebKit::NetworkProcess::networkSessions):
1445         * NetworkProcess/NetworkSession.cpp:
1446         (WebKit::NetworkSession::create):
1447         * NetworkProcess/NetworkSession.h:
1448         * NetworkProcess/NetworkSocketChannel.cpp:
1449         (WebKit::NetworkSocketChannel::NetworkSocketChannel):
1450         (WebKit::NetworkSocketChannel::~NetworkSocketChannel):
1451         * NetworkProcess/NetworkSocketChannel.h:
1452         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1453         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1454         (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
1455         (WebKit::computeIsAlwaysOnLoggingAllowed):
1456         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1457         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
1458         (WebKit::NetworkDataTaskCocoa::resume):
1459         (WebKit::NetworkDataTaskCocoa::isAlwaysOnLoggingAllowed const):
1460         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1461         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1462         (-[WKNetworkSessionDelegate initWithNetworkSession:withCredentials:]):
1463         (WebKit::NetworkSessionCocoa::create):
1464         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1465         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1466         (WebKit::NetworkDataTaskSoup::createRequest):
1467         (WebKit::NetworkDataTaskSoup::clearRequest):
1468         (WebKit::NetworkDataTaskSoup::cancel):
1469         (WebKit::NetworkDataTaskSoup::authenticateCallback):
1470         (WebKit::NetworkDataTaskSoup::authenticate):
1471         (WebKit::NetworkDataTaskSoup::continueAuthenticate):
1472
1473 2019-07-25  Chris Dumez  <cdumez@apple.com>
1474
1475         Avoid some unnecessary HashMap copies
1476         https://bugs.webkit.org/show_bug.cgi?id=200129
1477
1478         Reviewed by Youenn Fablet.
1479
1480         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1481         (WebKit::NetworkConnectionToWebProcess::didClose):
1482         * UIProcess/AuxiliaryProcessProxy.cpp:
1483         (WebKit::AuxiliaryProcessProxy::connect):
1484         * UIProcess/Launcher/ProcessLauncher.cpp:
1485         (WebKit::ProcessLauncher::ProcessLauncher):
1486         * UIProcess/Launcher/ProcessLauncher.h:
1487         (WebKit::ProcessLauncher::create):
1488         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
1489         (WebKit::WebPluginInfoProvider::setPluginLoadClientPolicy):
1490
1491 2019-07-25  Truitt Savell  <tsavell@apple.com>
1492
1493         Unreviewed, rolling out r247821.
1494
1495         Caused two crashing Layout Tests
1496
1497         Reverted changeset:
1498
1499         "Make storing cross-origin top-level prefetches in HTTP cache
1500         optional"
1501         https://bugs.webkit.org/show_bug.cgi?id=199499
1502         https://trac.webkit.org/changeset/247821
1503
1504 2019-07-25  Michael Catanzaro  <mcatanzaro@igalia.com>
1505
1506         Unreviewed, fix -Wredundant-move warning spam after r247672
1507         https://bugs.webkit.org/show_bug.cgi?id=199967
1508         <rdar://problem/53351435>
1509
1510         * Platform/IPC/ArgumentCoders.cpp:
1511         (IPC::decodeStringText):
1512         * Platform/IPC/ArgumentCoders.h:
1513
1514 2019-07-25  Chris Dumez  <cdumez@apple.com>
1515
1516         Avoid UI Process hangs when the WebContent process is showing JS prompts / alerts
1517         https://bugs.webkit.org/show_bug.cgi?id=200107
1518         <rdar://problem/53034592>
1519
1520         Reviewed by Geoffrey Garen.
1521
1522         * Platform/IPC/Connection.cpp:
1523         (IPC::Connection::SyncMessageState::incrementProcessIncomingSyncMessagesWhenWaitingForSyncReplyCount):
1524         (IPC::Connection::SyncMessageState::decrementProcessIncomingSyncMessagesWhenWaitingForSyncReplyCount):
1525         (IPC::Connection::SyncMessageState::processIncomingMessage):
1526         (IPC::Connection::sendSyncMessage):
1527         * Platform/IPC/Connection.h:
1528         Add support for new SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply flag
1529         to allow processing incoming sync messages while sending a particular sync IPC. This is the
1530         default behavior in all processes except in the WebContent process, where we try to avoid
1531         re-entering to prevent bugs. This flag allows the WebContent process to change its default
1532         behavior for some specific IPCs, where we know it is safe to re-enter and where it benefits
1533         performance to re-renter.
1534
1535         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1536         (WebKit::NetworkConnectionToWebProcess::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
1537         * NetworkProcess/NetworkConnectionToWebProcess.h:
1538         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1539         * UIProcess/Network/NetworkProcessProxy.cpp:
1540         (WebKit::NetworkProcessProxy::didReceiveSyncMessage):
1541         (WebKit::NetworkProcessProxy::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
1542         * UIProcess/Network/NetworkProcessProxy.h:
1543         * UIProcess/Network/NetworkProcessProxy.messages.in:
1544         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1545         (WebKit::WebChromeClient::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
1546         * WebProcess/WebCoreSupport/WebChromeClient.h:
1547         * WebProcess/WebPage/WebPage.cpp:
1548         (WebKit::WebPage::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
1549         * WebProcess/WebPage/WebPage.h:
1550         (WebKit::WebPage::sendSyncWithDelayedReply):
1551         * WebProcess/WebPage/WebPage.messages.in:
1552         SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply
1553         Add testing infrastructure for SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply
1554         flag.
1555
1556         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1557         (WebKit::WebChromeClient::runJavaScriptAlert):
1558         (WebKit::WebChromeClient::runJavaScriptConfirm):
1559         (WebKit::WebChromeClient::runJavaScriptPrompt):
1560         Use new SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply flag when sending
1561         the synchronous IPC for JS alerts / prompt / confirm. This allows the WebProcess to process
1562         incoming synchronous IPC for other processes (in particular the UIProcess) while it is blocked
1563         on those synchronous IPCs. It is safe to re-enter the WebContent process on these sync IPCs
1564         since they are triggered by JS and we return to JS right after. This should avoid UIProcess
1565         hangs when the UIProcess is sending a sync IPC to the WebContent process, which is itself
1566         stuck on the sync IPC to show a JS alert.
1567
1568 2019-07-25  Rob Buis  <rbuis@igalia.com>
1569
1570         Make storing cross-origin top-level prefetches in HTTP cache optional
1571         https://bugs.webkit.org/show_bug.cgi?id=199499
1572
1573         Reviewed by Youenn Fablet.
1574
1575         Currently when we navigate we check if there is a cross-origin top-level
1576         prefetch we can use for the navigation. The current solution uses the
1577         HTTP cache as a way to store the prefetch and to immediately use it for
1578         the navigation load. However this solution fails in case the prefetch is
1579         not cacheable.
1580
1581         Instead of this, simulate a HTTP Cache entry to process the load and
1582         afterwards try to store the navigation load into the HTTP cache, where
1583         normal store decisions will be applied.
1584
1585         Test: http/wpt/prefetch/link-prefetch-skip-disk-cache.html
1586
1587         * NetworkProcess/NetworkResourceLoader.cpp:
1588         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1589         (WebKit::NetworkResourceLoader::retrieveCacheEntryInternal):
1590         * NetworkProcess/NetworkResourceLoader.h:
1591
1592 2019-07-25  Truitt Savell  <tsavell@apple.com>
1593
1594         Unreviewed, rolling out r247817.
1595
1596         Broke 14 http/tests/paymentrequest/ tests. on iOS
1597
1598         Reverted changeset:
1599
1600         "Unable to tap/double tap to open files/folders in Google
1601         Drive in Safari"
1602         https://bugs.webkit.org/show_bug.cgi?id=200096
1603         https://trac.webkit.org/changeset/247817
1604
1605 2019-07-24  Zalan Bujtas  <zalan@apple.com>
1606
1607         Unable to tap/double tap to open files/folders in Google Drive in Safari
1608         https://bugs.webkit.org/show_bug.cgi?id=200096
1609         <rdar://problem/52748552>
1610
1611         Reviewed by Wenson Hsieh.
1612
1613         This patch reverts to the original double-tap-for-double-click implementation (see r244775 and r246347 for more information).
1614
1615         * Shared/WebPageCreationParameters.cpp:
1616         (WebKit::WebPageCreationParameters::encode const):
1617         (WebKit::WebPageCreationParameters::decode):
1618         * Shared/WebPageCreationParameters.h:
1619         * UIProcess/PageClient.h:
1620         * UIProcess/WebPageProxy.cpp:
1621         (WebKit::WebPageProxy::creationParameters):
1622         * UIProcess/WebPageProxy.h:
1623         * UIProcess/ios/PageClientImplIOS.h:
1624         * UIProcess/ios/PageClientImplIOS.mm:
1625         (WebKit::PageClientImpl::doubleTapForDoubleClickDelay): Deleted.
1626         (WebKit::PageClientImpl::doubleTapForDoubleClickRadius): Deleted.
1627         * UIProcess/ios/WKContentViewInteraction.h:
1628         * UIProcess/ios/WKContentViewInteraction.mm:
1629         (-[WKContentView setupInteraction]):
1630         (-[WKContentView cleanupInteraction]):
1631         (-[WKContentView _removeDefaultGestureRecognizers]):
1632         (-[WKContentView _addDefaultGestureRecognizers]):
1633         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): Do not recognize the single and double gestures the same time.
1634         (-[WKContentView gestureRecognizerShouldBegin:]):
1635         (-[WKContentView _doubleTapRecognizedForDoubleClick:]):
1636         (-[WKContentView _didStartProvisionalLoadForMainFrame]):
1637         (-[WKContentView _ensureNonBlockingDoubleTapGestureRecognizer]): Deleted.
1638         (-[WKContentView _doubleTapForDoubleClickDelay]): Deleted.
1639         (-[WKContentView _doubleTapForDoubleClickRadius]): Deleted.
1640         * UIProcess/ios/WebPageProxyIOS.mm:
1641         (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
1642         * WebProcess/WebPage/WebPage.cpp:
1643         * WebProcess/WebPage/WebPage.h:
1644         * WebProcess/WebPage/WebPage.messages.in:
1645         * WebProcess/WebPage/ios/WebPageIOS.mm:
1646         (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
1647         (WebKit::WebPage::commitPotentialTap):
1648         (WebKit::WebPage::handlePotentialDoubleTapForDoubleClickAtPoint): Deleted.
1649
1650 2019-07-24  Yusuke Suzuki  <ysuzuki@apple.com>
1651
1652         [bmalloc] Add IsoHeap test to ensure that IsoHeap pages are not allocating too large VA
1653         https://bugs.webkit.org/show_bug.cgi?id=200103
1654
1655         Reviewed by Mark Lam.
1656
1657         Move MachVMSPI.h from PAL to WTF.
1658
1659         * Platform/cocoa/SharedMemoryCocoa.cpp:
1660
1661 2019-07-24  Youenn Fablet  <youenn@apple.com>
1662
1663         Disable speculative loading if cache is not to be used for the load
1664         https://bugs.webkit.org/show_bug.cgi?id=199644
1665
1666         Reviewed by Alex Christensen.
1667
1668         When the page is reloaded, loads are instructed to not use the cache.
1669         It is therefore unneeded to do speculative revalidation.
1670         Allow speculative revalidation if the cache policy is either the default HTTP policy or
1671         if policy is to refresh all cache data.
1672         Covered by added test.
1673
1674         * NetworkProcess/cache/NetworkCache.cpp:
1675         (WebKit::NetworkCache::cachePolicyValidForSpeculativeRevalidation):
1676         (WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):
1677
1678 2019-07-24  Priyanka Agarwal  <pagarwal999@apple.com>
1679
1680         Allow Clients to Add Fields to the AutoFillContext Dictionary
1681         https://bugs.webkit.org/show_bug.cgi?id=199326
1682         rdar://problem/42816957
1683
1684         Reviewed by Wenson Hsieh.
1685
1686         * UIProcess/API/Cocoa/_WKInputDelegate.h:
1687         Added function declaration for function which returns additional dictionary for autofillcontext
1688
1689         * UIProcess/ios/WKContentViewInteraction.h:
1690         Created dictionary for additional autofillcontext
1691
1692         * UIProcess/ios/WKContentViewInteraction.mm:
1693         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
1694         Populating additional dictionary for autofillcontext
1695
1696         (-[WKContentView _autofillContext]):
1697         Adding new dictionary to the returned autofillcontext
1698
1699 2019-07-24  Chris Dumez  <cdumez@apple.com>
1700
1701         Regression(r247400): Unable to log into AIB Mobile Banking App
1702         https://bugs.webkit.org/show_bug.cgi?id=200094
1703         <rdar://problem/52519818>
1704
1705         Reviewed by Brent Fulgham.
1706
1707         In r247400, a change was made to only set the 'app has universal sandbox access' flag
1708         only when issueing the sandbox extension for / actually succeeded (it usually fails
1709         in practice). Previously, AIB Mobile Banking app was relying on this behavior to
1710         trigger a load for file:///login which is outside their container. However, now that
1711         the 'app has universal sandbox access' flag is no longer set, it trips our security
1712         checks and the load gets ignored.
1713
1714         To address the issue, apply only the 'app has universal sandbox access' flag fix with
1715         a linked-on-after check.
1716
1717         * UIProcess/Cocoa/VersionChecks.h:
1718         * UIProcess/WebPageProxy.cpp:
1719         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
1720
1721 2019-07-24  Tim Horton  <timothy_horton@apple.com>
1722
1723         Module-enabled users of WKWebProcessPlugInFrame.h fail to build; duplicate declaration
1724         https://bugs.webkit.org/show_bug.cgi?id=200095
1725         <rdar://problem/53512407>
1726
1727         Reviewed by Wenson Hsieh.
1728
1729         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
1730         Import <JavaScriptCore/JavaScriptCore.h> (the module header) instead of
1731         <JavaScriptCore/JSContext.h> directly, otherwise we can end up getting
1732         JSContext.h included twice, to the compiler's chagrin.
1733
1734 2019-07-24  Brady Eidson  <beidson@apple.com>
1735
1736         Crash in WebContent process with custom schemes.
1737         <rdar://problem/52968793> and https://bugs.webkit.org/show_bug.cgi?id=200062
1738
1739         Reviewed by Andy Estes.
1740
1741         Almost everywhere in WebURLSchemeTaskProxy where we call processNextPendingTask() we first protect the task with a ref.
1742         But not in didReceiveData.
1743         So lets do that.
1744
1745         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
1746         (WebKit::WebURLSchemeTaskProxy::didReceiveData): Protect this.
1747
1748 2019-07-24  Alex Christensen  <achristensen@webkit.org>
1749
1750         Null check CompletionHandler in WebPreviewLoaderClient::didReceivePassword
1751         https://bugs.webkit.org/show_bug.cgi?id=200080
1752         <rdar://problem/37275772>
1753
1754         Reviewed by Chris Dumez.
1755
1756         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp:
1757         (WebKit::WebPreviewLoaderClient::didReceivePassword):
1758
1759 2019-07-24  Chris Dumez  <cdumez@apple.com>
1760
1761         Crash under WebKit:WTF::Detail::CallableWrapper<WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking(WTF::CompletionHandler<void ()>&&)::$_32::operator()()::'lambda'(), void>::call
1762         https://bugs.webkit.org/show_bug.cgi?id=200071
1763         <rdar://problem/53335583>
1764
1765         Reviewed by Brent Fulgham and Youenn Fablet.
1766
1767         The WebResourceLoadStatisticsStore is a main thread object. In its destructor, it was dispatching
1768         to the background queue to destroy the m_statisticsStore / m_persistentStorage data members, which
1769         live on the background queue. It would then synchronously wait for the background queue to finish
1770         destroying them. The idea was to guarantee that the ResourceLoadStatisticsMemoryStore and the
1771         ResourceLoadStatisticsPersistentStorage would never outlive the WebResourceLoadStatisticsStore,
1772         given that they keep a raw pointer back to the WebResourceLoadStatisticsStore (via m_store data
1773         member).
1774
1775         The issue is that *while* the WebResourceLoadStatisticsStore destructor is running on the main
1776         thread, the background queue may be running code in ResourceLoadStatisticsMemoryStore or
1777         ResourceLoadStatisticsPersistentStorage which refs the WebResourceLoadStatisticsStore, even
1778         though its ref count has already reached 0. It is actually a common pattern in
1779         ResourceLoadStatisticsMemoryStore to call RunLoop::main().dispatch() and ref their m_store in
1780         the lambda, so that they can interact with the WebResourceLoadStatisticsStore.
1781
1782         To address the issue, we now destroy m_statisticsStore / m_persistentStorage *before* the
1783         WebResourceLoadStatisticsStore destructor runs. The NetworkSession destructor now calls
1784         WebResourceLoadStatisticsStore::didDestroyNetworkSession() which takes care of destroying
1785         m_statisticsStore / m_persistentStorage on the background queue, synchronously. The
1786         WebResourceLoadStatisticsStore destructor will only run later, once all remaining references
1787         to it are gone.
1788
1789         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1790         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
1791         (WebKit::WebResourceLoadStatisticsStore::didDestroyNetworkSession):
1792         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1793         * NetworkProcess/NetworkSession.cpp:
1794         (WebKit::NetworkSession::~NetworkSession):
1795
1796 2019-07-24  Youenn Fablet  <youenn@apple.com>
1797
1798         SYS___pthread_markcancel is sometimes used by libwebrtc
1799         https://bugs.webkit.org/show_bug.cgi?id=200087
1800         <rdar://problem/53408606>
1801
1802         Reviewed by Brent Fulgham.
1803
1804         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1805         Whitelist this unix-call within WebProcess as libwebrtc uses it.
1806
1807 2019-07-24  Zalan Bujtas  <zalan@apple.com>
1808
1809         ASSERTION FAILED: settings().textAutosizingEnabled() && settings().textAutosizingUsesIdempotentMode() in WebCore::Page::recomputeTextAutoSizingInAllFrames()
1810         https://bugs.webkit.org/show_bug.cgi?id=200079
1811         <rdar://problem/53474325>
1812
1813         Reviewed by Wenson Hsieh.
1814
1815         Do not reset idempotent values when the text autosizing is off.
1816
1817         * UIProcess/API/C/WKPreferences.cpp:
1818         (WKPreferencesSetTextAutosizingUsesIdempotentMode):
1819         (WKPreferencesGetTextAutosizingUsesIdempotentMode):
1820         * UIProcess/API/C/WKPreferencesRef.h:
1821         * WebProcess/WebPage/ios/WebPageIOS.mm:
1822         (WebKit::WebPage::resetIdempotentTextAutosizingIfNeeded):
1823
1824 2019-07-24  Chris Dumez  <cdumez@apple.com>
1825
1826         Unreviewed, rolling out r247766.
1827
1828         Caused an API test failure
1829
1830         Reverted changeset:
1831
1832         "Crash under
1833         WebKit:WTF::Detail::CallableWrapper<WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking(WTF::CompletionHandler<void
1834         ()>&&)::$_32::operator()()::'lambda'(), void>::call"
1835         https://bugs.webkit.org/show_bug.cgi?id=200071
1836         https://trac.webkit.org/changeset/247766
1837
1838 2019-07-23  Chris Dumez  <cdumez@apple.com>
1839
1840         Crash under WebKit:WTF::Detail::CallableWrapper<WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking(WTF::CompletionHandler<void ()>&&)::$_32::operator()()::'lambda'(), void>::call
1841         https://bugs.webkit.org/show_bug.cgi?id=200071
1842         <rdar://problem/53335583>
1843
1844         Reviewed by Brent Fulgham and Youenn Fablet.
1845
1846         The WebResourceLoadStatisticsStore is a main thread object. In its destructor, it was dispatching
1847         to the background queue to destroy the m_statisticsStore / m_persistentStorage data members, which
1848         live on the background queue. It would then synchronously wait for the background queue to finish
1849         destroying them. The idea was to guarantee that the ResourceLoadStatisticsMemoryStore and the
1850         ResourceLoadStatisticsPersistentStorage would never outlive the WebResourceLoadStatisticsStore,
1851         given that they keep a raw pointer back to the WebResourceLoadStatisticsStore (via m_store data
1852         member).
1853
1854         The issue is that *while* the WebResourceLoadStatisticsStore destructor is running on the main
1855         thread, the background queue may be running code in ResourceLoadStatisticsMemoryStore or
1856         ResourceLoadStatisticsPersistentStorage which refs the WebResourceLoadStatisticsStore, even
1857         though its ref count has already reached 0. It is actually a common pattern in
1858         ResourceLoadStatisticsMemoryStore to call RunLoop::main().dispatch() and ref their m_store in
1859         the lambda, so that they can interact with the WebResourceLoadStatisticsStore.
1860
1861         To address the issue, we now destroy m_statisticsStore / m_persistentStorage *before* the
1862         WebResourceLoadStatisticsStore destructor runs. The NetworkSession destructor now calls
1863         WebResourceLoadStatisticsStore::didDestroyNetworkSession() which takes care of destroying
1864         m_statisticsStore / m_persistentStorage on the background queue, synchronously. The
1865         WebResourceLoadStatisticsStore destructor will only run later, once all remaining references
1866         to it are gone.
1867
1868         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1869         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
1870         (WebKit::WebResourceLoadStatisticsStore::didDestroyNetworkSession):
1871         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1872         * NetworkProcess/NetworkSession.cpp:
1873         (WebKit::NetworkSession::~NetworkSession):
1874
1875 2019-07-23  Alex Christensen  <achristensen@webkit.org>
1876
1877         Move javaScriptConfigurationDirectory SPI from _WKProcessPoolConfiguration to WKProcessPoolPrivate to make it runtime switchable
1878         https://bugs.webkit.org/show_bug.cgi?id=200045
1879
1880         Reviewed by Mark Lam.
1881
1882         This allows me to maintain the status quo in Safari.
1883
1884         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1885         (API::ProcessPoolConfiguration::copy):
1886         * UIProcess/API/APIProcessPoolConfiguration.h:
1887         * UIProcess/API/Cocoa/WKProcessPool.mm:
1888         (-[WKProcessPool _javaScriptConfigurationDirectory]):
1889         (-[WKProcessPool _setJavaScriptConfigurationDirectory:]):
1890         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1891         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1892         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1893         (-[_WKProcessPoolConfiguration javaScriptConfigurationDirectory]): Deleted.
1894         (-[_WKProcessPoolConfiguration setJavaScriptConfigurationDirectory:]): Deleted.
1895         * UIProcess/WebProcessPool.cpp:
1896         (WebKit::legacyWebsiteDataStoreConfiguration):
1897         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
1898         * UIProcess/WebProcessPool.h:
1899
1900 2019-07-23  Russell Epstein  <repstein@apple.com>
1901
1902         Unreviewed, rolling out r247745.
1903
1904         This broke API test
1905         TestWebKitAPI.WKProcessPool.JavaScriptConfiguration as
1906         indicated by EWS
1907
1908         Reverted changeset:
1909
1910         "Move javaScriptConfigurationDirectory SPI from
1911         _WKProcessPoolConfiguration to WKProcessPoolPrivate to make it
1912         runtime switchable"
1913         https://bugs.webkit.org/show_bug.cgi?id=200045
1914         https://trac.webkit.org/changeset/247745
1915
1916 2019-07-23  Chris Fleizach  <cfleizach@apple.com>
1917
1918         AX: CrashTracer: com.apple.WebKit.WebContent at WebKit: WebKit::WebSpeechSynthesisClient::speak
1919         https://bugs.webkit.org/show_bug.cgi?id=199988
1920
1921         Reviewed by Per Arne Vollan.
1922
1923         Improvements to WebSpeechSynthesis to avoid crashing and improve correctness.
1924         - Reset and cancel speech jobs on page close or reload (otherwise the synthesizer keeps talking after your page is gone)
1925         - Have a separate speech finish callback mechanism, use the start speaking callback when the synthesizer tells us.
1926         - Move an assert on utterance state to only apply when we use the in process synthesizer.
1927
1928         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1929         (WebKit::WebPageProxy::didStartSpeaking):
1930         * UIProcess/WebPageProxy.cpp:
1931         (WebKit::WebPageProxy::reload):
1932         (WebKit::WebPageProxy::resetState):
1933         (WebKit::WebPageProxy::resetSpeechSynthesizer):
1934         (WebKit::WebPageProxy::speechSynthesisSetFinishedCallback):
1935         (WebKit::WebPageProxy::speechSynthesisSpeak):
1936         * UIProcess/WebPageProxy.h:
1937         * UIProcess/WebPageProxy.messages.in:
1938         * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp:
1939         (WebKit::WebSpeechSynthesisClient::speak):
1940
1941 2019-07-23  Chris Dumez  <cdumez@apple.com>
1942
1943         Get rid of unnecessary callback aggregators in WebResourceLoadStatisticsStore
1944         https://bugs.webkit.org/show_bug.cgi?id=200042
1945
1946         Reviewed by Brent Fulgham.
1947
1948         Only 1 asynchronous function is called so there is nothing to "aggregate".
1949
1950         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1951         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdate):
1952         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains):
1953         (WebKit::WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains):
1954
1955 2019-07-23  Zalan Bujtas  <zalan@apple.com>
1956
1957         [iOS] Tapping the search field on a search results page on zillow.com shows and immediately dismisses the keyboard
1958         https://bugs.webkit.org/show_bug.cgi?id=200044
1959         <rdar://problem/53103732>
1960
1961         Reviewed by Wenson Hsieh.
1962
1963         * Shared/FocusedElementInformation.cpp:
1964         (WebKit::FocusedElementInformation::encode const):
1965         (WebKit::FocusedElementInformation::decode):
1966         * Shared/FocusedElementInformation.h:
1967         * UIProcess/API/Cocoa/WKWebView.mm:
1968         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
1969         * UIProcess/ios/WKContentViewInteraction.h:
1970         * UIProcess/ios/WKContentViewInteraction.mm:
1971         (-[WKContentView _elementDidBlur]):
1972         (-[WKContentView _shouldAvoidScrollingWhenFocusedContentIsVisible]):
1973         * WebProcess/WebPage/ios/WebPageIOS.mm:
1974         (WebKit::WebPage::getFocusedElementInformation):
1975
1976 2019-07-23  Alex Christensen  <achristensen@webkit.org>
1977
1978         Move javaScriptConfigurationDirectory SPI from _WKProcessPoolConfiguration to WKProcessPoolPrivate to make it runtime switchable
1979         https://bugs.webkit.org/show_bug.cgi?id=200045
1980
1981         Reviewed by Mark Lam.
1982
1983         This allows me to maintain the status quo in Safari.
1984
1985         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1986         (API::ProcessPoolConfiguration::copy):
1987         * UIProcess/API/APIProcessPoolConfiguration.h:
1988         * UIProcess/API/Cocoa/WKProcessPool.mm:
1989         (-[WKProcessPool _javaScriptConfigurationDirectory]):
1990         (-[WKProcessPool _setJavaScriptConfigurationDirectory:]):
1991         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1992         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1993         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1994         (-[_WKProcessPoolConfiguration javaScriptConfigurationDirectory]): Deleted.
1995         (-[_WKProcessPoolConfiguration setJavaScriptConfigurationDirectory:]): Deleted.
1996         * UIProcess/WebProcessPool.cpp:
1997         (WebKit::legacyWebsiteDataStoreConfiguration):
1998         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
1999         * UIProcess/WebProcessPool.h:
2000
2001 2019-07-24  Simon Fraser  <simon.fraser@apple.com>
2002
2003         [iOS WK2] A top fixed bar can flicker when scrolling with the keyboard up
2004         https://bugs.webkit.org/show_bug.cgi?id=200105
2005         rdar://problem/52871975
2006
2007         Reviewed by Wenson Hsieh.
2008
2009         ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition() computes a visual viewport
2010         from the current scroll position and scrollableAreaSize(). This doesn't know anything about
2011         the impact of keyboards on the visual viewport, so it computes a too-large visual viewport
2012         when the keyboard is up, triggering incorrect manipulations of the layout viewport. This
2013         leads to the top bar flashing to position 0 when it should be hidden off the top.
2014
2015         Fix by feeding into the scrolling tree the height of the visual viewport which takes
2016         FrameView::visualViewportOverrideRect() into account. This is stored on ScrollingStateFrameScrollingNode/
2017         ScrollingTreeFrameScrollingNode.
2018
2019         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2020         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
2021         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
2022
2023 2019-07-23  Alex Christensen  <achristensen@webkit.org>
2024
2025         Add SPI for setting media cache and key location on _WKWebsiteDataStoreConfiguration
2026         https://bugs.webkit.org/show_bug.cgi?id=199972
2027
2028         Reviewed by Jer Noble.
2029
2030         This is a step towards removing WebsiteDataStore::legacyDefaultDataStoreConfiguration
2031         I added a unit test for the media cache location,
2032         but the media key location can't reasonably be unit tested in an open source project.
2033
2034         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2035         (-[WKWebsiteDataStore _initWithConfiguration:]):
2036         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2037         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
2038         (-[_WKWebsiteDataStoreConfiguration mediaCacheDirectory]):
2039         (-[_WKWebsiteDataStoreConfiguration setMediaCacheDirectory:]):
2040         (-[_WKWebsiteDataStoreConfiguration mediaKeysStorageDirectory]):
2041         (-[_WKWebsiteDataStoreConfiguration setMediaKeysStorageDirectory:]):
2042
2043 2019-07-23  Wenson Hsieh  <wenson_hsieh@apple.com>
2044
2045         [macOS 10.15] Web process crashes when attempting to show the font panel via Font > Show Fonts
2046         https://bugs.webkit.org/show_bug.cgi?id=200021
2047         <rdar://problem/53301325>
2048
2049         Reviewed by Ryosuke Niwa.
2050
2051         Always return false from canShowFontPanel in WebKit2.
2052
2053         * WebProcess/WebCoreSupport/WebEditorClient.h:
2054
2055 2019-07-23  Carlos Garcia Campos  <cgarcia@igalia.com>
2056
2057         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.25.3 release
2058
2059         * gtk/NEWS: Add release notes for 2.25.3.
2060
2061 2019-07-23  Carlos Garcia Campos  <cgarcia@igalia.com>
2062
2063         [GTK] Emoji chooser is misplaced after scrolling
2064         https://bugs.webkit.org/show_bug.cgi?id=199996
2065
2066         Reviewed by Michael Catanzaro.
2067
2068         Convert caret rectangle coordinates to root view.
2069
2070         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2071         (WebKit::WebPage::showEmojiPicker):
2072
2073 2019-07-22  Ross Kirsling  <ross.kirsling@sony.com>
2074
2075         Unreviewed non-unified build fix.
2076
2077         * NetworkProcess/NetworkCORSPreflightChecker.h:
2078         * NetworkProcess/NetworkLoadChecker.h:
2079         * UIProcess/API/C/WKContext.cpp:
2080         * UIProcess/API/C/WKPageConfigurationRef.cpp:
2081         * UIProcess/Downloads/DownloadProxy.cpp:
2082         * UIProcess/WebPageInjectedBundleClient.cpp:
2083         * UIProcess/WebPreferences.cpp:
2084         * WebProcess/Network/WebSocketChannel.cpp:
2085         (WebKit::PendingMessage::PendingMessage):
2086
2087 2019-07-22  Megan Gardner  <megan_gardner@apple.com>
2088
2089         Remove Staging for scrolling bug
2090         https://bugs.webkit.org/show_bug.cgi?id=199894
2091
2092         Reviewed by Wenson Hsieh.
2093
2094         * UIProcess/ios/WKContentViewInteraction.mm:
2095         (-[WKUIWKTextInteractionAssistant scrollSelectionToVisible]): Deleted.
2096
2097 2019-07-22  Brent Fulgham  <bfulgham@apple.com>
2098
2099         Correct web audio-related crash in seed reports
2100         https://bugs.webkit.org/show_bug.cgi?id=200009
2101         <rdar://problem/51565203>
2102
2103         Reviewed by Per Arne Vollan.
2104
2105         Revise the iOS sandbox to allow the WebContent process to communicate with
2106         the 'com.apple.coremedia.audioprocessingtap.xpc' service, which is needed by
2107         some types of WebAudio.
2108
2109         * WebProcess/com.apple.WebKit.WebContent.sb.in:
2110
2111 2019-07-22  Dean Jackson  <dino@apple.com>
2112
2113         WebKit SPI fix for [ClickyOrb] Audio continues playing after dismissing a video preview in Safari
2114         https://bugs.webkit.org/show_bug.cgi?id=200011
2115         <rdar://problem/53409457>
2116
2117         Reviewed by Tim Horton.
2118
2119         Don't check for the SPI @selector(_webView:contextMenuDidEndForElement:)
2120         on the WKUIDelegate so that clients that got caught implementing the
2121         SPI before moving to the real API can still clean-up state. In other words,
2122         don't force a client that only implements that method to move completely
2123         to the new API.
2124
2125         * UIProcess/ios/WKContentViewInteraction.mm:
2126         (needsDeprecatedPreviewAPI):
2127
2128 2019-07-22  Jer Noble  <jer.noble@apple.com>
2129
2130         REGRESSION(rUnknown): YouTube playback pauses when switching to a new tab
2131         https://bugs.webkit.org/show_bug.cgi?id=199971
2132         <rdar://problem/51951218>
2133
2134         Reviewed by Alex Christensen.
2135
2136         When we get a message notifying us that the view has been removed from the window, we unconditionally
2137         ask the fullscreen manager to exit fullscreen, which has the side effect (on iOS) of pausing the video
2138         unconditionally. Only ask the fullscreen manager to exit fullscreen if there is actually a video in
2139         fullscreen mode.
2140
2141         * UIProcess/WebPageProxy.cpp:
2142         (WebKit::WebPageProxy::viewDidLeaveWindow):
2143
2144 2019-07-22  Youenn Fablet  <youenn@apple.com>
2145
2146         Make sure to unref captured lambda variables given to _strictTrustEvaluate in the main thread
2147         https://bugs.webkit.org/show_bug.cgi?id=199948
2148
2149         Reviewed by Alex Christensen.
2150
2151         Use a weak pointer instead of a Ref for the NetworkSession.
2152         Add a null check in processServerTrustEvaluation for extra safety if we decide to remove the data task NetworkSession ref.
2153         Make sure to move the NetworkDataTask ref in the completion handler so that the unrefing is done in the main thread.
2154
2155         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2156         (processServerTrustEvaluation):
2157         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
2158
2159 2019-07-22  Alex Christensen  <achristensen@webkit.org>
2160
2161         Don't always look for a JSC configuration file after r247685
2162         https://bugs.webkit.org/show_bug.cgi?id=199917
2163
2164         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2165         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
2166         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
2167         ProcessPoolConfiguration's javaScriptConfigurationDirectory wasn't used before r247685,
2168         which made it always look for a file with 'JavaScriptCoreDebug' in its name.  I had assumed
2169         m_javaScriptConfigurationDirectory would default to a null string, but it was defaulting to
2170         defaultJavaScriptConfigurationDirectory.  Make it a null string instead.
2171
2172 2019-07-22  Simon Fraser  <simon.fraser@apple.com>
2173
2174         Make some constructors explicit
2175         https://bugs.webkit.org/show_bug.cgi?id=199981
2176
2177         Reviewed by Daniel Bates.
2178
2179         Make explicit public constructors of objects that take POD or String& arguments,
2180         to reduce the changes of the compiler doing implicit conversions.
2181
2182         * Platform/Module.h:
2183         * WebProcess/WebPage/WebInspector.cpp:
2184         (WebKit::WebInspector::openInNewTab):
2185
2186 2019-07-22  Daniel Bates  <dabates@apple.com>
2187
2188         [iOS] REGRESSION (r241734): Autocorrection highlight should hide when field becomes defocused
2189         https://bugs.webkit.org/show_bug.cgi?id=199807
2190         <rdar://problem/52760259>
2191
2192         Fix a bad merge of r247653. svn-apply was way too forgiving. The original patch touched
2193         the non-existent function, -_didCommitLoadForMainFrame in WKContentViewInteraction.mm. Because
2194         that didn't exist, svn-apply patched up -clearSelection.
2195
2196         * UIProcess/ios/WKContentView.h:
2197         * UIProcess/ios/WKContentView.mm:
2198         (-[WKContentView _didCommitLoadForMainFrame]): Deleted; moved to WKContentViewInteraction.mm
2199         * UIProcess/ios/WKContentViewInteraction.h:
2200         * UIProcess/ios/WKContentViewInteraction.mm:
2201         (-[WKContentView clearSelection]): Remove code that should be in -_didCommitLoadForMainFrame.
2202         (-[WKContentView _didCommitLoadForMainFrame]): Moved from WKContentView.mm
2203
2204 2019-07-22  Alex Christensen  <achristensen@webkit.org>
2205
2206         Add SPI to _WKWebsiteDataStoreConfiguration for configuring application cache storage location
2207         https://bugs.webkit.org/show_bug.cgi?id=199954
2208
2209         Reviewed by Geoff Garen.
2210
2211         This is a step towards removing WebsiteDataStore::legacyDefaultDataStoreConfiguration
2212         Covered by a new API test.
2213
2214         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2215         (-[WKWebsiteDataStore _initWithConfiguration:]):
2216         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2217         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
2218         (-[_WKWebsiteDataStoreConfiguration applicationCacheDirectory]):
2219         (-[_WKWebsiteDataStoreConfiguration setApplicationCacheDirectory:]):
2220         (-[_WKWebsiteDataStoreConfiguration applicationCacheFlatFileSubdirectoryName]):
2221         (-[_WKWebsiteDataStoreConfiguration setApplicationCacheFlatFileSubdirectoryName:]):
2222         * UIProcess/WebProcessPool.cpp:
2223         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
2224         * UIProcess/WebsiteData/WebsiteDataStore.h:
2225         (WebKit::WebsiteDataStore::applicationCacheFlatFileSubdirectoryName const):
2226
2227 2019-07-22  Alex Christensen  <achristensen@webkit.org>
2228
2229         Add SPI _WKProcessPoolConfiguration.javaScriptConfigurationDirectory
2230         https://bugs.webkit.org/show_bug.cgi?id=199917
2231
2232         Reviewed by Sam Weinig.
2233
2234         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2235         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2236         (-[_WKProcessPoolConfiguration javaScriptConfigurationDirectory]):
2237         (-[_WKProcessPoolConfiguration setJavaScriptConfigurationDirectory:]):
2238         * UIProcess/WebProcessPool.cpp:
2239         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
2240
2241 2019-07-22  Carlos Garcia Campos  <cgarcia@igalia.com>
2242
2243         [SOUP] WebSockets: use new api to send text messages
2244         https://bugs.webkit.org/show_bug.cgi?id=199936
2245
2246         Reviewed by Michael Catanzaro.
2247
2248         New API allows to include null character in text messages.
2249
2250         * NetworkProcess/soup/WebSocketTaskSoup.cpp:
2251         (WebKit::WebSocketTask::didReceiveMessageCallback): Pass data size to String::fromUTF8().
2252         (WebKit::WebSocketTask::sendString): Use soup_websocket_connection_send_message() instead of
2253         soup_websocket_connection_send_text() when available. Also use
2254         StrictConversionReplacingUnpairedSurrogatesWithFFFD options when converting to UTF-8.
2255
2256 2019-07-21  Wenson Hsieh  <wenson_hsieh@apple.com>
2257
2258         [iOS] [WebKit2] Add limited support for -isPosition:atBoundary:inDirection: in WKContentView
2259         https://bugs.webkit.org/show_bug.cgi?id=199993
2260         <rdar://problem/49523528>
2261
2262         Reviewed by Beth Dakin.
2263
2264         Add support for -isPosition:atBoundary:inDirection:, only in the cases where the given position is the start or
2265         and position and the given granularity is UITextGranularityParagraph.
2266
2267         Test: EditorStateTests.ParagraphBoundary
2268
2269         * Shared/EditorState.cpp:
2270         (WebKit::EditorState::PostLayoutData::encode const):
2271         (WebKit::EditorState::PostLayoutData::decode):
2272         * Shared/EditorState.h:
2273
2274         Add a couple of bits to indicate whether the selection start or end positions are at paragraph boundaries.
2275
2276         * UIProcess/ios/WKContentViewInteraction.mm:
2277         (-[WKContentView isPosition:atBoundary:inDirection:]):
2278
2279         Implement this to return selectionStartIsAtParagraphBoundary or selectionEndIsAtParagraphBoundary.
2280
2281         * WebProcess/WebPage/ios/WebPageIOS.mm:
2282         (WebKit::WebPage::platformEditorState const):
2283
2284 2019-07-20  Chris Dumez  <cdumez@apple.com>
2285
2286         Speed up HashTable decoding by reserving capacity and avoiding rehashing
2287         https://bugs.webkit.org/show_bug.cgi?id=199982
2288
2289         Reviewed by Saam Barati.
2290
2291         Use HashMap::reserveInitialCapacity() in the HashMap IPC decoder for
2292         performance. I measured a ~35% improvement when decoding a very large
2293         HashMap of Strings (~160k entries) in the context of the
2294         StorageManager::GetValues IPC.
2295
2296         * Platform/IPC/ArgumentCoders.h:
2297         * Shared/API/c/WKDictionary.cpp:
2298         (WKDictionaryCreate):
2299
2300 2019-07-20  Chris Dumez  <cdumez@apple.com>
2301
2302         Micro-optimize HashMap & String IPC decoding
2303         https://bugs.webkit.org/show_bug.cgi?id=199967
2304
2305         Reviewed by Geoffrey Garen.
2306
2307         The legacy HashMap decoder (returning a boolean) was failing to WTFMove()
2308         the key & value when calling HashMap::add(). The modern decoder (returning
2309         an Optional) was properly using WTFMove(). Rewrite the legacy HashMap decoder
2310         to call the modern one to reduce code duplication and to get this optimization.
2311
2312         Also, encode HashMap::size() as a uint32_t instead of a uint64_t since
2313         HashMap::size() returns an 'unsigned int' type. Finally, update the modern
2314         decoder to WTFMove(hashMap) when returning. Because the function returns an
2315         Optional<HashMap> and not a HashMap, I do not believe we get return value
2316         optimization (RVO).
2317
2318         Do similar changes to String IPC coders.
2319
2320         * Platform/IPC/ArgumentCoders.cpp:
2321         (IPC::decodeStringText):
2322         (IPC::ArgumentCoder<String>::decode):
2323         * Platform/IPC/ArgumentCoders.h:
2324
2325 2019-07-20  Alexander Mikhaylenko  <exalm7659@gmail.com>
2326
2327         REGRESSION(r246033/r246496): [GTK] Kinetic scrolling doesn't work
2328         https://bugs.webkit.org/show_bug.cgi?id=199322
2329
2330         Reviewed by Michael Catanzaro.
2331
2332         Check ENABLE(KINETIC_SCROLLING) instead of ENABLE(ASYNC_SCROLLING) when setting wheel event phase and momentum phase.
2333
2334         * Shared/WebEventConversion.cpp:
2335         (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
2336
2337 2019-07-20  Zalan Bujtas  <zalan@apple.com>
2338
2339         [Text autosizing] Do not nuke the style on dynamicViewportSizeUpdate
2340         https://bugs.webkit.org/show_bug.cgi?id=199718
2341         <rdar://problem/53344961>
2342
2343         Reviewed by Simon Fraser.
2344
2345         * WebProcess/WebPage/WebPage.cpp:
2346         (WebKit::m_textAutoSizingAdjustmentTimer):
2347         (WebKit::WebPage::close):
2348         (WebKit::WebPage::didCommitLoad):
2349         (WebKit::WebPage::textAutoSizingAdjustmentTimerFired):
2350         (WebKit::m_shrinkToFitContentTimer): Deleted.
2351         * WebProcess/WebPage/WebPage.h:
2352         * WebProcess/WebPage/ios/WebPageIOS.mm:
2353         (WebKit::WebPage::dynamicViewportSizeUpdate):
2354         (WebKit::WebPage::resetIdempotentTextAutosizingIfNeeded):
2355         (WebKit::WebPage::resetTextAutosizing):
2356         (WebKit::WebPage::viewportConfigurationChanged):
2357
2358 2019-07-19  Youenn Fablet  <youenn@apple.com>
2359
2360         Remote WebInspector should enable mock capture devices in UIProcess if doing it in WebProcess
2361         https://bugs.webkit.org/show_bug.cgi?id=199924
2362         <rdar://problem/50552067>
2363
2364         Reviewed by Devin Rousso.
2365
2366         Add IPC plumbery to pass inspector override value for mock capture devices.
2367         Add an override in UserMediaPermissionRequestManagerProxy so that the value stays in sync with web inspector.
2368         The override will be removed when web inspector goes away.
2369
2370         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2371         (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs const):
2372         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2373         (WebKit::UserMediaPermissionRequestManagerProxy::setMockCaptureDevicesEnabledOverride):
2374         * UIProcess/WebInspectorProxy.cpp:
2375         (WebKit::WebInspectorProxy::setMockCaptureDevicesEnabled):
2376         * UIProcess/WebInspectorProxy.h:
2377         * UIProcess/WebInspectorProxy.messages.in:
2378         * UIProcess/WebPageProxy.cpp:
2379         (WebKit::WebPageProxy::setMockCaptureDevicesEnabledOverride):
2380         * UIProcess/WebPageProxy.h:
2381         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
2382         (WebKit::WebInspectorClient::setMockCaptureDevicesEnabled):
2383         * WebProcess/WebCoreSupport/WebInspectorClient.h:
2384         * WebProcess/WebPage/WebInspector.cpp:
2385         (WebKit::WebInspector::setMockCaptureDevicesEnabled):
2386         * WebProcess/WebPage/WebInspector.h:
2387
2388 2019-07-19  Tim Horton  <timothy_horton@apple.com>
2389
2390         Web Content process gets stuck suspended after navigating away from a system preview
2391         https://bugs.webkit.org/show_bug.cgi?id=199965
2392         <rdar://problem/53109004>
2393
2394         Reviewed by Dean Jackson.
2395
2396         * UIProcess/API/Cocoa/WKWebView.mm:
2397         (-[WKWebView _isBackground]):
2398         * UIProcess/ios/WKSystemPreviewView.h:
2399         * UIProcess/ios/WKSystemPreviewView.mm:
2400         (-[WKSystemPreviewView web_initWithFrame:webView:mimeType:]):
2401         (-[WKSystemPreviewView web_isBackground]):
2402         Apply the fix from r193481 to WKSystemPreviewView as well, having it
2403         become a WKApplicationStateTrackingView and plumbing that through
2404         to our is-background machinery.
2405
2406         We really, really should instead have WKWebView itself be the application
2407         state tracking view, but that is a bigger change (and has some implications
2408         for full-screen video and whatnot).
2409
2410 2019-07-19  Dean Jackson  <dino@apple.com>
2411
2412         Provide correct names for UIContextMenuInteraction API replacements
2413         https://bugs.webkit.org/show_bug.cgi?id=199966
2414
2415         Reviewed by Tim Horton.
2416
2417         We had some old incorrect names for replacements to SPI. While
2418         here, I reordered and expanded the documentation for the new API.
2419
2420         * UIProcess/API/Cocoa/WKUIDelegate.h:
2421         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2422
2423 2019-07-19  Daniel Bates  <dabates@apple.com>
2424
2425         [iOS] REGRESSION (r241734): Autocorrection highlight should hide when field becomes defocused
2426         https://bugs.webkit.org/show_bug.cgi?id=199807
2427         <rdar://problem/52760259>
2428
2429         Reviewed by Wenson Hsieh.
2430
2431         Sometimes the correction highlight may not hide when defocusing an editable field.
2432         This occurs only when a person pressed a key in a non-editable element beforehand.
2433         We need to reset some state to force a re-computation of whether a keyboard is still
2434         needed whenever an element is defocused (blurred in web paralance).
2435
2436         Following r241734 both editable and non-editable key events are handled using the same
2437         code path. This is accomplished by having WKContentView's -_requiresKeyboardWhenFirstResponder
2438         return YES to tell UIKit it needs a keyboard even when there is no editable element focused.
2439         As a result UIKit retains all the keyboard state, including keeping the correction highlight
2440         visible. Prior to r241734 WKContentView's -_requiresKeyboardWhenFirstResponder would not return
2441         YES when a non-editable element was focused and hence UIKit would tear down the keyboard
2442         and its state, including the correction highlight. In r245154, we made keyboard instantiate
2443         for a focused non-editable element lazy as a performance optimization. Although r245154
2444         kept the r241734 behavior (just made it lazy) it re-wrote the code in such a way that we
2445         can utilize it as a hook to fix this bug. In particular, we now clear the bit about a
2446         seen keydown in a non-editable element whenever we are defocusing an editable element
2447         before we reload the input views, as part of hiding the keyboard. On the reload, UIKit
2448         will call -_requiresKeyboardWhenFirstResponder, WebKit will respond with NO now that
2449         a non-editable element is focused and hence UIKit will do what it did pre r241734: tear
2450         down the keyboard.
2451
2452         * UIProcess/ios/WKContentViewInteraction.mm:
2453         (-[WKContentView _didCommitLoadForMainFrame]): Clear the bit about a seen keydown here
2454         so that we don't keep the keyboard around on a new page commit. This includes the case
2455         when the same page is reloaded. There is not much advantage to keeping the keyboard
2456         around across reloads and not doing so will reduce our memory footprint. 
2457         (-[WKContentView _elementDidBlur]): Clear the same bit as well when defocusing an
2458         editable element. This will cause UIKit to tear down the keyboard on reload removing
2459         the correction highlight.
2460
2461 2019-07-19  Dean Jackson  <dino@apple.com>
2462
2463         Add a menu item to toggle between showing and hiding link previews
2464         https://bugs.webkit.org/show_bug.cgi?id=199940
2465         <rdar://problem/53032288>
2466
2467         Reviewed by Beth Dakin.
2468
2469         Add a new _WKElementAction that toggles the display of link previews
2470         in context menus, and add it to the default set of actions we provide
2471         for links.
2472
2473         When a UIAction is created from this new _WKElementAction type,
2474         it can be identified by WKElementActionTypeToggleShowLinkPreviewsIdentifier.
2475         This allows us to check a UIMenu provided by a delegate to make sure
2476         that they have provided the toggle menu item. If they haven't, we add it
2477         back.
2478
2479         The preference for showing links is moved from kCFPreferencesAnyApplication
2480         to standard user defaults, so that it can be set no matter what the
2481         hosting application is.
2482
2483         * UIProcess/API/Cocoa/_WKElementAction.h: New action type.
2484         * UIProcess/API/Cocoa/_WKElementAction.mm: 
2485         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
2486         (+[_WKElementAction imageForElementActionType:]): Use eye.fill for now.
2487         I'll need to check with HI to see if there is a more appropriate glyph.
2488         (elementActionTypeToUIActionIdentifier):
2489         (uiActionIdentifierToElementActionType):
2490
2491         * UIProcess/ios/WKActionSheetAssistant.mm: Add the toggle action to
2492         the default set.
2493         (-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
2494
2495         * UIProcess/ios/WKContentViewInteraction.mm:
2496         (-[WKContentView _registerPreview]): No need to listen for CFPreferences
2497         notifications any more.
2498         (-[WKContentView _unregisterPreview]):
2499         (menuWithShowLinkPreviewAction): New method that adds the UIAction
2500         for toggling previews to a UIMenu if necessary.
2501         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
2502         (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]):
2503         (-[WKContentView _showLinkPreviewsPreferenceChanged:]): Deleted.
2504         (titleForMenu): Deleted. URL text previews will be provided separately.
2505
2506 2019-07-19  Wenson Hsieh  <wenson_hsieh@apple.com>
2507
2508         [iOS] Entering 2FA code on idmsa.apple.com causes unexpected scrolling
2509         https://bugs.webkit.org/show_bug.cgi?id=199949
2510         <rdar://problem/49944428>
2511
2512         Reviewed by Tim Horton and Megan Gardner.
2513
2514         Since at least iOS 11, -[UIScrollView _adjustForAutomaticKeyboardInfo:animated:lastAdjustment:] adjusts the
2515         scroll view's content offset to account for updated keyboard bottom insets. In WebKit, we call this method
2516         whenever keyboard geometry changes (based on system notifications, such as UIKeyboardWillHideNotification).
2517
2518         When switching between focused form fields, we hide the keyboard for the previous focused element prior to
2519         showing the keyboard for the newly focused element. This means that we will actually dismiss the keyboard in the
2520         process of changing the focused element, which posts keyboard geometry notifications, which causes us to scroll
2521         WKScrollView.
2522
2523         On iOS 12, this would be immediately followed by re-presenting the keyboard for the new focused element, which
2524         causes us to adjust the scroll view back to its original position right away; this means that the scrolling that
2525         happens as a result of adjusting for the keyboard insets after dismissal doesn't result in any visible change.
2526
2527         However, on iOS 13, after r239441 and r244546, we now defer scrolling and zooming to reveal the focused element
2528         until later; this means the scrolling that happens as a result of initially dismissing the keyboard now causes a
2529         consistent jump in the scroll view's scroll position (whereas on iOS 12, this only happens rarely, and the jump
2530         is also less noticeable).
2531
2532         To mitigate this, we detect the case where we're moving focus from one element to another; if we're about to
2533         show a keyboard for the newly focused element, then we should avoid scrolling as a result of the impending
2534         "keyboard will hide" notification.
2535
2536         Test: fast/forms/ios/no-scrolling-when-moving-focus-between-adjacent-fields.html
2537
2538         * UIProcess/API/Cocoa/WKWebView.mm:
2539         (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
2540         (-[WKWebView _keyboardWillHide:]):
2541         * UIProcess/ios/WKContentViewInteraction.h:
2542         * UIProcess/ios/WKContentViewInteraction.mm:
2543         (shouldShowKeyboardForElement):
2544
2545         Add a helper to determine whether we're focusing an element which presents a "keyboard" (i.e. a UIKit input
2546         view, as opposed to modal select pickers, modal date pickers, or fields with inputmode="none", for which we
2547         don't show an input view).
2548
2549         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
2550         (-[WKContentView shouldIgnoreKeyboardWillHideNotification]):
2551
2552 2019-07-18  Alex Christensen  <achristensen@webkit.org>
2553
2554         Fix warning when importing WebKit in Swift
2555         https://bugs.webkit.org/show_bug.cgi?id=199914
2556         <rdar://problem/52854930>
2557
2558         Reviewed by Wenson Hsieh.
2559
2560         * UIProcess/API/Cocoa/NSAttributedString.h:
2561         Declare NSAttributedString and update a swift name.
2562         This fix was proposed by Argyrios Kyrtzidis.
2563
2564 2019-07-18  Alex Christensen  <achristensen@webkit.org>
2565
2566         Add and test _WKWebsiteDataStoreConfiguration.deviceIdHashSaltsStorageDirectory SPI
2567         https://bugs.webkit.org/show_bug.cgi?id=199923
2568
2569         Reviewed by Youenn Fablet.
2570
2571         This is a step towards us getting rid of WebsiteDataStore::legacyDefaultDataStoreConfiguration
2572
2573         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2574         (-[WKWebsiteDataStore _initWithConfiguration:]):
2575         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2576         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
2577         (-[_WKWebsiteDataStoreConfiguration deviceIdHashSaltsStorageDirectory]):
2578         (-[_WKWebsiteDataStoreConfiguration setDeviceIdHashSaltsStorageDirectory:]):
2579
2580 2019-07-18  Alex Christensen  <achristensen@webkit.org>
2581
2582         Move NetworkCache ownership from NetworkProcess to NetworkSession
2583         https://bugs.webkit.org/show_bug.cgi?id=199817
2584
2585         Reviewed by Geoff Garen.
2586
2587         I also added SPI to set the path of the NetworkCache with an API test.
2588         If this new SPI is not used, it falls back to getting the cache location from the NetworkProcess to maintain compatibility.
2589         We still get options, cache size, and cache model from the NetworkProcess.  Those should be migrated with new SPI later.
2590         Clearing the cache and other operations now iterate the NetworkSessions instead of assuming there is only one cache.
2591
2592         * NetworkProcess/NetworkProcess.cpp:
2593         (WebKit::NetworkProcess::fetchWebsiteData):
2594         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2595         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
2596         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
2597         (WebKit::NetworkProcess::setCacheModel):
2598         * NetworkProcess/NetworkProcess.h:
2599         (WebKit::NetworkProcess::diskCacheDirectory const):
2600         (WebKit::NetworkProcess::cacheOptions const):
2601         (WebKit::NetworkProcess::cache): Deleted.
2602         * NetworkProcess/NetworkResourceLoader.cpp:
2603         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
2604         * NetworkProcess/NetworkSession.cpp:
2605         (WebKit::NetworkSession::NetworkSession):
2606         * NetworkProcess/NetworkSession.h:
2607         (WebKit::NetworkSession::cache):
2608         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2609         (WebKit::NetworkSessionCreationParameters::encode const):
2610         (WebKit::NetworkSessionCreationParameters::decode):
2611         * NetworkProcess/NetworkSessionCreationParameters.h:
2612         * NetworkProcess/cache/NetworkCache.cpp:
2613         (WebKit::NetworkCache::Cache::open):
2614         (WebKit::NetworkCache::Cache::Cache):
2615         * NetworkProcess/cache/NetworkCache.h:
2616         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2617         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2618         (WebKit::NetworkProcess::clearDiskCache):
2619         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2620         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2621         * NetworkProcess/curl/NetworkSessionCurl.cpp:
2622         (WebKit::NetworkSessionCurl::NetworkSessionCurl):
2623         * NetworkProcess/soup/NetworkSessionSoup.cpp:
2624         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
2625         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2626         (-[WKWebsiteDataStore _initWithConfiguration:]):
2627         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2628         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
2629         (-[_WKWebsiteDataStoreConfiguration networkCacheDirectory]):
2630         (-[_WKWebsiteDataStoreConfiguration setNetworkCacheDirectory:]):
2631         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2632         (WebKit::WebsiteDataStore::parameters):
2633         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2634         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
2635         * UIProcess/WebsiteData/WebsiteDataStore.h:
2636         (WebKit::WebsiteDataStore::resolvedNetworkCacheDirectory const):
2637
2638 2019-07-18  Chris Dumez  <cdumez@apple.com>
2639
2640         Regression(r247486) Multiple Layout Tests in http/tests/cache/* are crashing on iOS Debug WK2
2641         https://bugs.webkit.org/show_bug.cgi?id=199892
2642         <rdar://problem/53230217>
2643
2644         Reviewed by Geoffrey Garen.
2645
2646         The StorageManager was unregistering itself as a WorkQueueMessageReceiver on a given IPC
2647         connection too early. As a result, we would sometimes receive a 'StorageManager:DestroyStorageMap'
2648         IPC in NetworkConnectionToWebProcess::didReceiveMessage() with nobody to process it, which would
2649         trigger an assertion. To address the issue, we stop unregistering the StorageManager as a
2650         WorkQueueMessageReceiver inside removeAllowedSessionStorageNamespaceConnection(). Instead, we
2651         let the logic inside processDidCloseConnection() take care of it once the connection closes.
2652
2653         * NetworkProcess/WebStorage/StorageManager.cpp:
2654         (WebKit::StorageManager::removeAllowedSessionStorageNamespaceConnection):
2655         (WebKit::StorageManager::processDidCloseConnection):
2656         * NetworkProcess/WebStorage/StorageManager.h:
2657
2658 2019-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2659
2660         [GTK] Crash in webkitWebViewBaseRenderHostFileDescriptor
2661         https://bugs.webkit.org/show_bug.cgi?id=199402
2662
2663         Reviewed by Michael Catanzaro.
2664
2665         There are two problems here:
2666
2667          - We need to ensure that the checks we do in HardwareAccelerationManager to disable AC mode are the same
2668            as the ones done in AcceleratedBackingStore create() methods. This is not the case for WPE renderer.
2669          - Some of the places where accelerateBackingStore is used, can be called even if AC mode is disabled, so we
2670            need to null-check there before using the backing store.
2671
2672         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2673         (webkitWebViewBaseDraw): Add an assert to ensure accelerateBackingStore is not nullptr here.
2674         (webkitWebViewBaseEnterAcceleratedCompositingMode): Ditto.
2675         (webkitWebViewBaseUpdateAcceleratedCompositingMode): Ditto.
2676         (webkitWebViewBaseExitAcceleratedCompositingMode): Ditto.
2677         (webkitWebViewBaseMakeGLContextCurrent): Ditto.
2678         (webkitWebViewBaseDidRelaunchWebProcess): Null-check accelerateBackingStore before using it.
2679         (webkitWebViewBasePageClosed): Ditto.
2680         (webkitWebViewBaseRenderHostFileDescriptor): Ditto.
2681         * UIProcess/gtk/AcceleratedBackingStore.cpp:
2682         (WebKit::AcceleratedBackingStore::checkRequirements): Call AcceleratedBackingStoreWayland::checkRequirements()
2683         or AcceleratedBackingStoreX11::checkRequirements() depending on the current display.
2684         (WebKit::AcceleratedBackingStore::create): Return early if AC mode is disabled in HardwareAccelerationManager.
2685         * UIProcess/gtk/AcceleratedBackingStore.h:
2686         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
2687         (WebKit::AcceleratedBackingStoreWayland::checkRequirements): Check requirements for hardware acceleration in Wayland.
2688         (WebKit::AcceleratedBackingStoreWayland::create): Assert that requirements are present.
2689         * UIProcess/gtk/AcceleratedBackingStoreWayland.h:
2690         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
2691         (WebKit::AcceleratedBackingStoreX11::checkRequirements): Check requirements for hardware acceleration in X11.
2692         (WebKit::AcceleratedBackingStoreX11::create): Assert that requirements are present.
2693         * UIProcess/gtk/AcceleratedBackingStoreX11.h:
2694         * UIProcess/gtk/HardwareAccelerationManager.cpp:
2695         (WebKit::HardwareAccelerationManager::HardwareAccelerationManager): Use
2696         AcceleratedBackingStore::checkRequirements() to decide whether to disable AC mode.
2697
2698 2019-07-17  Megan Gardner  <megan_gardner@apple.com>
2699
2700         Early Out of positionInfomation check if possible
2701         https://bugs.webkit.org/show_bug.cgi?id=199885
2702         <rdar://problem/53229413>
2703
2704         This is an early-out check that happens after most of the work is done.
2705         Move it to happen before we make all these calls, if in the end, we will not use the information.
2706
2707         Reviewed by Tim Horton.
2708
2709         * UIProcess/ios/WKContentViewInteraction.mm:
2710         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
2711
2712 2019-07-17  Chris Dumez  <cdumez@apple.com>
2713
2714         Unreviewed, add debug logging to help diagnose flaky crashes on the bots.
2715
2716         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2717         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
2718
2719 2019-07-17  Tim Horton  <timothy_horton@apple.com>
2720
2721         [macCatalyst] Unable to interact with YouTube video while it's playing
2722         https://bugs.webkit.org/show_bug.cgi?id=199893
2723         <rdar://problem/51871151>
2724
2725         Reviewed by Simon Fraser.
2726
2727         * Platform/spi/ios/UIKitSPI.h:
2728         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
2729         (-[WKRemoteView initWithFrame:contextID:]):
2730         (-[WKUIRemoteView initWithFrame:pid:contextID:]):
2731         Disable remote context hit-testing for WKUIRemoteView just like we
2732         already do for WKRemoteView.
2733
2734 2019-07-17  Chris Dumez  <cdumez@apple.com>
2735
2736         Prewarm local storage in the NetworkProcess to reduce WebContent process hangs
2737         https://bugs.webkit.org/show_bug.cgi?id=199879
2738         <rdar://problem/53217757>
2739
2740         Reviewed by Ryosuke Niwa.
2741
2742         * NetworkProcess/WebStorage/StorageManager.cpp:
2743         (WebKit::StorageManager::prewarm):
2744         (WebKit::StorageManager::getValues):
2745         * NetworkProcess/WebStorage/StorageManager.h:
2746         * NetworkProcess/WebStorage/StorageManager.messages.in:
2747         * WebProcess/WebStorage/StorageAreaImpl.cpp:
2748         (WebKit::StorageAreaImpl::prewarm):
2749         * WebProcess/WebStorage/StorageAreaImpl.h:
2750         * WebProcess/WebStorage/StorageAreaMap.cpp:
2751         (WebKit::StorageAreaMap::loadValuesIfNeeded):
2752         (WebKit::StorageAreaMap::prewarm):
2753         * WebProcess/WebStorage/StorageAreaMap.h:
2754
2755 2019-07-19  Simon Fraser  <simon.fraser@apple.com>
2756
2757         [iOS WK2] Allow scrolling interaction on frames and oveflow scroll even when the main frame is rubber-banding
2758         https://bugs.webkit.org/show_bug.cgi?id=199963
2759         rdar://problem/52897797
2760
2761         Reviewed by Tim Horton.
2762
2763         Adopt UIKit SPI to allow for scrolling of inner UIScrollViews when the outer one is still rubber-banding.
2764
2765         * Platform/spi/ios/UIKitSPI.h:
2766         * UIProcess/API/Cocoa/WKWebView.mm:
2767         (-[WKWebView _initializeWithConfiguration:]):
2768         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
2769         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
2770
2771 2019-07-17  Megan Gardner  <megan_gardner@apple.com>
2772
2773         Set WordIsNearTap flag, was not being set at all before
2774         https://bugs.webkit.org/show_bug.cgi?id=199880
2775
2776         Reviewed by Wenson Hsieh.
2777
2778         * WebProcess/WebPage/ios/WebPageIOS.mm:
2779         (WebKit::WebPage::selectWithGesture):
2780
2781 2019-07-17  Jiewen Tan  <jiewen_tan@apple.com>
2782
2783         Provide a NSURL cateogry to tell AppSSO Kerberos URLs
2784         https://bugs.webkit.org/show_bug.cgi?id=199887
2785         <rdar://problem/52323161>
2786
2787         Reviewed by Brent Fulgham.
2788
2789         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.h:
2790         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.mm:
2791         (+[NSURL _web_willPerformSOKerberosAuthorizationWithURL:]):
2792
2793 2019-07-17  Antoine Quint  <graouts@apple.com>
2794
2795         Disable Pointer Events prior to watchOS 6
2796         https://bugs.webkit.org/show_bug.cgi?id=199890
2797         <rdar://problem/53206113>
2798
2799         Reviewed by Dean Jackson.
2800
2801         * Configurations/FeatureDefines.xcconfig:
2802
2803 2019-07-17  Daniel Bates  <dabates@apple.com>
2804
2805         Typing into a cell in a Google Sheet lags behind by one character
2806         https://bugs.webkit.org/show_bug.cgi?id=199587
2807         <rdar://problem/51616845>
2808
2809         Reviewed by Brent Fulgham.
2810
2811         Remove all timers from the holding tank on text insertion or deletion (represented as an
2812         editing command). Timers that were in the holding tank never stopped ticking and will now
2813         be able to execute their action.
2814
2815         * WebProcess/WebPage/WebPage.cpp:
2816         (WebKit::WebPage::executeEditingCommand):
2817         (WebKit::WebPage::insertTextAsync):
2818         (WebKit::WebPage::setCompositionAsync):
2819         (WebKit::WebPage::confirmCompositionAsync):
2820         Call platformWillPerformEditingCommand().
2821
2822         * WebProcess/WebPage/WebPage.h:
2823         (WebKit::WebPage::platformWillPerformEditingCommand): Added.
2824         * WebProcess/WebPage/ios/WebPageIOS.mm:
2825         (WebKit::WebPage::platformWillPerformEditingCommand): Remove all the timers from the holding
2826         tank if we have a holding tank.
2827
2828 2019-07-17  Darin Adler  <darin@apple.com>
2829
2830         No need for isURLAllowed function in Frame
2831         https://bugs.webkit.org/show_bug.cgi?id=120266
2832
2833         Reviewed by Alex Christensen.
2834
2835         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2836         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
2837         Use is<HTMLFrameElementBase> instead of isFrameElementBase.
2838
2839 2019-07-17  Alex Christensen  <achristensen@webkit.org>
2840
2841         Add a runtime-disabled dialog element skeleton
2842         https://bugs.webkit.org/show_bug.cgi?id=199839
2843
2844         Reviewed by Ryosuke Niwa.
2845
2846         * Shared/WebPreferences.yaml:
2847         * UIProcess/API/C/WKPreferences.cpp:
2848         (WKPreferencesSetDialogElementEnabled):
2849         (WKPreferencesGetDialogElementEnabled):
2850         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2851         Add SPI to enable the dialog element for tests.
2852
2853 2019-07-17  Ryosuke Niwa  <rniwa@webkit.org>
2854
2855         [iOS] Option + Up or Down Arrow key doesn’t move cursor past paragraph boundaries in WebKit2
2856         https://bugs.webkit.org/show_bug.cgi?id=199851
2857
2858         Reviewed by Wenson Hsieh.
2859
2860         The bug was caused by the difference in the way AppKit and UIKit responds to Option + Up / Down.
2861
2862         On macOS, AppKit sends moveForward before sending moveToStartOfParagraph and moveBackward
2863         before sending moveToEndOfParagraph. As a result, when Option + Down is pressed when we are at
2864         the end of a line, we would first move to the beginning of the next line (i.e. after the line break)
2865         before moving or extending selection with the paragraph boundary granurality.
2866
2867         On iOS, UIKit only calls _moveToStartOfParagraph without moving forward by a character. As a result,
2868         moving forward by the paragraph boundary granurality immediately stops when we're starting at the
2869         end of a line when Option + Down is pressed. Option + Up case is similar.
2870
2871         Fix the bug on iOS by emulating what happens on macOS. Namely, move the selection forward or backward
2872         by the character granurality before moving by the paragraph boundary granurality.
2873
2874         * UIProcess/ios/WKContentViewInteraction.mm:
2875         (-[WKContentView _moveToStartOfParagraph:withHistory:]):
2876         (-[WKContentView _moveToEndOfParagraph:withHistory:]):
2877
2878 2019-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2879
2880         Unreviewed. Fix GTK and WPE debug build after r247508
2881
2882         * UIProcess/API/glib/WebKitWebResource.cpp:
2883         (webkitWebResourceCreate): Remove invalid assert.
2884
2885 2019-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2886
2887         [WPE][GTK] UI process crash due to NULL dereference in webkitWebViewResourceLoadStarted()
2888         https://bugs.webkit.org/show_bug.cgi?id=199621
2889
2890         Reviewed by Michael Catanzaro.
2891
2892         Null-check frame received in injected bundle message to ensure the frame hasn't been destroyed.
2893
2894         * UIProcess/API/glib/WebKitInjectedBundleClient.cpp:
2895         * UIProcess/API/glib/WebKitWebResource.cpp:
2896         (webkitWebResourceCreate): Receive a reference to the frame instead of a pointer.
2897         * UIProcess/API/glib/WebKitWebResourcePrivate.h:
2898         * UIProcess/API/glib/WebKitWebView.cpp:
2899         (webkitWebViewResourceLoadStarted): Ditto.
2900         * UIProcess/API/glib/WebKitWebViewPrivate.h:
2901
2902 2019-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2903
2904         [GTK][WPE] Do not assert when receiving invalid data in injected bundle messages
2905         https://bugs.webkit.org/show_bug.cgi?id=199830
2906
2907         Reviewed by Michael Catanzaro.
2908
2909         Just silently ignore them to avoid UI process crashes.
2910
2911         * UIProcess/API/glib/WebKitInjectedBundleClient.cpp:
2912
2913 2019-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2914
2915         [GTK] No web view updates after swapping web process if AC mode is forced
2916         https://bugs.webkit.org/show_bug.cgi?id=199826
2917
2918         Reviewed by Michael Catanzaro.
2919
2920         This is because when AC mode is forced the provisional page creates a drawing area that is always in AC
2921         mode. When swapping processes, the current drawing area is destroyed (which exists AC mode) and the provisional
2922         one is set. From that point the web process is in AC mode but the UI process isn't. We need to update the
2923         compositing mode when swapping processes.
2924
2925         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2926         (webkitWebViewBaseDidExitWebProcess):
2927         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h:
2928
2929 2019-07-16  Antoine Quint  <graouts@apple.com>
2930
2931         REGRESSION: fast/events/watchos/double-tap-to-zoom* tests crashing in com.apple.WebKit: -[WKContentView(WKInteraction) _singleTapDidReset:]
2932         https://bugs.webkit.org/show_bug.cgi?id=199840
2933         <rdar://problem/52856531>
2934
2935         Reviewed by Wenson Hsieh.
2936
2937         We need to ensure the NSNumber used for -[WKSyntheticTapGestureRecognizer lastActiveTouchIdentifier] is retained. This innocent change required
2938         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
2939         build errors, which leads to a much bigger patch than just the source change necessary to fix the crash.
2940
2941         * SourcesCocoa.txt:
2942         * UIProcess/ios/WKSyntheticTapGestureRecognizer.mm: Renamed from Source/WebKit/UIProcess/ios/WKSyntheticTapGestureRecognizer.m.
2943         * UIProcess/ios/forms/WKFormPeripheralBase.h:
2944         * UIProcess/ios/forms/WKFormPeripheralBase.mm:
2945         * WebKit.xcodeproj/project.pbxproj:
2946
2947 2019-07-16  Brent Fulgham  <bfulgham@apple.com>
2948
2949         Update WebContent Process sandbox based on user seed data
2950         https://bugs.webkit.org/show_bug.cgi?id=199799
2951         <rdar://problem/52903477>
2952
2953         Reviewed by Alexey Proskuryakov.
2954
2955         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2956
2957 2019-07-16  Andy Estes  <aestes@apple.com>
2958
2959         [macCatalyst] Do not include WebKitLegacy.h in WebKit.h
2960         https://bugs.webkit.org/show_bug.cgi?id=199833
2961         <rdar://problem/53036744>
2962
2963         Reviewed by Tim Horton.
2964
2965         * Shared/API/Cocoa/WebKit.h:
2966
2967 2019-07-16  Frederic Wang  <fwang@igalia.com>
2968
2969         Fix build warning because of missing super_class initializer
2970         https://bugs.webkit.org/show_bug.cgi?id=199825
2971
2972         Reviewed by Jonathan Bedard.
2973
2974         * UIProcess/ios/WKContentView.mm:
2975         (keyCommandsPlaceholderHackForEvernote):
2976
2977 2019-07-16  Tim Horton  <timothy_horton@apple.com>
2978
2979         NSTextFinder holes don't scroll with the page
2980         https://bugs.webkit.org/show_bug.cgi?id=199815
2981         <rdar://problem/52280514>
2982
2983         Reviewed by Simon Fraser.
2984
2985         * UIProcess/API/Cocoa/WKWebView.mm:
2986         (-[WKWebView _usePlatformFindUI]):
2987         (-[WKWebView _setUsePlatformFindUI:]):
2988         (-[WKWebView _ensureTextFinderClient]):
2989         Add a bit so that clients can choose whether they want our find UI,
2990         which respects scrolling, or the system find UI, which works when
2991         doing multi-document searches. Right now you can't have both.
2992
2993         (-[WKWebView scrollFindMatchToVisible:]):
2994         Implement and plumb scrollFindMatchToVisible.
2995
2996         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2997         * UIProcess/WebPageProxy.cpp:
2998         (WebKit::WebPageProxy::indicateFindMatch):
2999         * UIProcess/WebPageProxy.h:
3000         * WebProcess/WebPage/WebPage.cpp:
3001         (WebKit::WebPage::indicateFindMatch):
3002         * WebProcess/WebPage/WebPage.h:
3003         * WebProcess/WebPage/WebPage.messages.in:
3004         Plumb indicateFindMatch to FindController.
3005
3006         * UIProcess/mac/WKTextFinderClient.h:
3007         * UIProcess/mac/WKTextFinderClient.mm:
3008         (-[WKTextFinderClient initWithPage:view:usePlatformFindUI:]):
3009         Store whether or not we are using the platform find UI.
3010
3011         (-[WKTextFinderClient findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:]):
3012         If using WebKit find UI, turn on our UI in the options passed to findString[Matches].
3013
3014         (-[WKTextFinderClient scrollFindMatchToVisible:]):
3015         If using WebKit find UI, when the platform tells us to reveal a find match, indicate it.
3016
3017         (-[WKTextFinderClient didFindStringMatchesWithRects:didWrapAround:]):
3018         If using WebKit find UI, lie to the platform and return no rects so that it doesn't paint a yellow rectangle.
3019
3020         (-[WKTextFinderClient getImageForMatchResult:completionHandler:]):
3021         If using WebKit find UI, lie to the platform and return no image so that it doesn't paint a yellow rectangle.
3022
3023         (-[WKTextFinderClient initWithPage:view:]): Deleted.
3024
3025         * WebProcess/WebPage/FindController.cpp:
3026         (WebKit::FindController::updateFindUIAfterPageScroll):
3027         Make it possible to use our find UI with 'findStringMatches'; since the platform
3028         find infrastrucutre depends on knowing about all matches up front, we need
3029         to use 'findStringMatches' instead of 'findString', but we had never combined
3030         that with our UI. Don't throw away the other matches when we indicate one, and
3031         don't send DidFindString in the case we are coming from 'findStringMatches'.
3032         This all needs a bit of cleanup in the future.
3033
3034         (WebKit::FindController::findString):
3035         Tell updateFindUIAfterPageScroll that we are 'findString' so that it uses its normal behavior.
3036
3037         (WebKit::FindController::findStringMatches):
3038         Tell updateFindUIAfterPageScroll that we are 'findStringMatches' so that it uses the adjusted behavior.
3039
3040         (WebKit::FindController::indicateFindMatch):
3041         Add 'indicateFindMatch', which both selects the match and moves the indicator there.
3042
3043         * WebProcess/WebPage/FindController.h:
3044
3045 2019-07-16  Chris Dumez  <cdumez@apple.com>
3046
3047         Speed up StorageManager::getValues()
3048         https://bugs.webkit.org/show_bug.cgi?id=199812
3049
3050         Reviewed by Alex Christensen.
3051
3052         Made the following performance improvements:
3053         - Made StorageManager a WorkQueueMessageReceiver again (like it was before it
3054           got moved from the UIProcess to the Network process). This avoids a lot of
3055           thread hopping (IPC thread -> Main thread -> StorageManagerThread -> Main Thread)
3056           and a lot of isolatedCopying of the strings.
3057         - Move values around when possible to avoid copying.
3058         - Add fast path to StorageMap::importItems() for when the StorageMap is
3059           empty when importing (15ms -> 2.5ms).
3060
3061         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3062         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
3063         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage):
3064         * NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
3065         (WebKit::LocalStorageDatabase::importItems):
3066         * NetworkProcess/WebStorage/StorageManager.cpp:
3067         (WebKit::StorageManager::addAllowedSessionStorageNamespaceConnection):
3068         (WebKit::StorageManager::removeAllowedSessionStorageNamespaceConnection):
3069         (WebKit::StorageManager::processDidCloseConnection):
3070         (WebKit::StorageManager::createLocalStorageMap):
3071         (WebKit::StorageManager::createTransientLocalStorageMap):
3072         (WebKit::StorageManager::createSessionStorageMap):
3073         (WebKit::StorageManager::destroyStorageMap):
3074         (WebKit::StorageManager::getValues):
3075         (WebKit::StorageManager::setItem):
3076         (WebKit::StorageManager::setItems):
3077         (WebKit::StorageManager::removeItem):
3078         (WebKit::StorageManager::clear):
3079         * NetworkProcess/WebStorage/StorageManager.h:
3080
3081         * Platform/IPC/Connection.cpp:
3082         (IPC::Connection::addWorkQueueMessageReceiver):
3083         (IPC::Connection::removeWorkQueueMessageReceiver):
3084         (IPC::Connection::processIncomingMessage):
3085         (IPC::Connection::dispatchMessage):
3086         (IPC::Connection::dispatchMessageToWorkQueueReceiver):
3087         * Platform/IPC/Connection.h:
3088         * WebProcess/WebStorage/StorageAreaMap.cpp:
3089         (WebKit::StorageAreaMap::loadValuesIfNeeded):
3090         Messages to WorkQueueMessageReceivers are normally dispatched from the IPC WorkQueue. However, there is a race if
3091         a client (here StorageManager) adds itself as a WorkQueueMessageReceiver as a result of receiving an IPC message
3092         on the main thread (here NetworkConnectionToWebProcess::WebPageWasAdded).
3093         The message might have already been dispatched from the IPC WorkQueue to the main thread by the time the
3094         client registers itself as a WorkQueueMessageReceiver. To address this, we check again for messages receivers
3095         once the message arrives on the main thread.
3096
3097 2019-07-16  Zalan Bujtas  <zalan@apple.com>
3098
3099         [ContentChangeObserver] Cancel ongoing content observation when tap is failed/cancelled
3100         https://bugs.webkit.org/show_bug.cgi?id=199828
3101         <rdar://problem/53152696>
3102
3103         Reviewed by Wenson Hsieh.
3104
3105         * WebProcess/WebPage/ios/WebPageIOS.mm:
3106         (WebKit::WebPage::commitPotentialTapFailed):
3107         (WebKit::WebPage::cancelPotentialTap):
3108
3109 2019-07-15  Alex Christensen  <achristensen@webkit.org>
3110
3111         Remove redundant WebsiteDataStoreConfiguration member
3112         https://bugs.webkit.org/show_bug.cgi?id=199820
3113
3114         Reviewed by Geoffrey Garen.
3115
3116         m_webStorageDirectory was only used for _WKWebsiteDataStoreConfiguration._webStorageDirectory's backing,
3117         which was copied over to m_localStorageDirectory of a new object in WKWebsiteDataStore's _initWithConfiguration.
3118         This is a baby step towards cleaning up this mess with no behavior change.  I see no reason to rename the SPI.
3119
3120         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
3121         (-[_WKWebsiteDataStoreConfiguration _webStorageDirectory]):
3122         (-[_WKWebsiteDataStoreConfiguration _setWebStorageDirectory:]):
3123         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
3124         (WebKit::WebsiteDataStoreConfiguration::copy):
3125         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
3126         (WebKit::WebsiteDataStoreConfiguration::webStorageDirectory const): Deleted.
3127         (WebKit::WebsiteDataStoreConfiguration::setWebStorageDirectory): Deleted.
3128
3129 2019-07-15  Fujii Hironori  <Hironori.Fujii@sony.com>
3130
3131         Make WKURLSchemeTask thread safe
3132         https://bugs.webkit.org/show_bug.cgi?id=199764
3133
3134         Unreviewed build fix for WinCairo port.
3135
3136         Source\WebKit\UIProcess\socket\RemoteInspectorProtocolHandler.cpp(82): error C2039: 'request': is not a member of 'WebKit::WebURLSchemeTask'
3137
3138         * UIProcess/WebURLSchemeTask.h:
3139         (WebKit::WebURLSchemeTask::request const): Restored WebURLSchemeTask::request with a threading assertion.
3140
3141 2019-07-15  Ryan Haddad  <ryanhaddad@apple.com>
3142
3143         Unreviewed, rolling out r247444.
3144
3145         Caused two scrolling tests to fail on iOS Simulator
3146
3147         Reverted changeset:
3148
3149         "Typing into a cell in a Google Sheet lags behind by one
3150         character"
3151         https://bugs.webkit.org/show_bug.cgi?id=199587
3152         https://trac.webkit.org/changeset/247444
3153
3154 2019-07-15  Zalan Bujtas  <zalan@apple.com>
3155
3156         outlook.live.com has odd viewport with edge gap
3157         https://bugs.webkit.org/show_bug.cgi?id=199822
3158         <rdar://problem/53029072>
3159
3160         Reviewed by Wenson Hsieh.
3161
3162         * WebProcess/WebPage/WebPage.h:
3163         * WebProcess/WebPage/ios/WebPageIOS.mm:
3164         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
3165         (WebKit::WebPage::dynamicViewportSizeUpdate):
3166         (WebKit::WebPage::resetViewportDefaultConfiguration):
3167         (WebKit::WebPage::immediatelyShrinkToFitContent):
3168         (WebKit::WebPage::viewLayoutSizeAdjustedForQuirks): Deleted.
3169
3170 2019-07-11  Myles C. Maxfield  <mmaxfield@apple.com>
3171
3172         New York font erroneously gets synthetic bold
3173         https://bugs.webkit.org/show_bug.cgi?id=199653
3174         <rdar://problem/51692592>
3175
3176         Reviewed by Simon Fraser.
3177
3178         Add the SPI to enable the new fonts.
3179
3180         * Shared/WebPreferences.yaml:
3181         * UIProcess/API/C/WKPreferences.cpp:
3182         (WKPreferencesSetShouldAllowDesignSystemUIFonts):
3183         (WKPreferencesGetShouldAllowDesignSystemUIFonts):
3184         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3185         * UIProcess/API/Cocoa/WKPreferences.mm:
3186         (-[WKPreferences _shouldAllowDesignSystemUIFonts]):
3187         (-[WKPreferences _setShouldAllowDesignSystemUIFonts:]):
3188         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3189
3190 2019-07-15  Brady Eidson  <beidson@apple.com>
3191
3192         Make WKURLSchemeTask thread safe.
3193         <rdar://problem/50471863> and https://bugs.webkit.org/show_bug.cgi?id=199764
3194
3195         Reviewed by Alex Christensen.
3196
3197         Punt most of the WKURLSchemeTask operations back to the main thread.
3198         Make accessing the NSURLRequest be thread safe with lock protection.
3199
3200         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
3201         (getExceptionTypeFromMainRunLoop):
3202         (-[WKURLSchemeTaskImpl dealloc]):
3203         (-[WKURLSchemeTaskImpl request]):
3204         (-[WKURLSchemeTaskImpl _requestOnlyIfCached]):
3205         (-[WKURLSchemeTaskImpl didReceiveResponse:]):
3206         (-[WKURLSchemeTaskImpl didReceiveData:]):
3207         (-[WKURLSchemeTaskImpl didFinish]):
3208         (-[WKURLSchemeTaskImpl didFailWithError:]):
3209         (-[WKURLSchemeTaskImpl _didPerformRedirection:newRequest:]):
3210
3211         * UIProcess/WebURLSchemeTask.cpp:
3212         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
3213         (WebKit::WebURLSchemeTask::~WebURLSchemeTask):
3214         (WebKit::WebURLSchemeTask::didPerformRedirection):
3215         (WebKit::WebURLSchemeTask::didReceiveResponse):
3216         (WebKit::WebURLSchemeTask::didReceiveData):
3217         (WebKit::WebURLSchemeTask::didComplete):
3218         (WebKit::WebURLSchemeTask::pageDestroyed):
3219         (WebKit::WebURLSchemeTask::stop):
3220         (WebKit::WebURLSchemeTask::nsRequest const):
3221
3222         * UIProcess/WebURLSchemeTask.h:
3223         (WebKit::WebURLSchemeTask::identifier const):
3224         (WebKit::WebURLSchemeTask::pageID const):
3225         (WebKit::WebURLSchemeTask::process):
3226         (WebKit::WebURLSchemeTask::process const): Deleted.
3227         (WebKit::WebURLSchemeTask::request const): Deleted.
3228
3229 2019-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
3230
3231         Followup to r247439
3232         https://bugs.webkit.org/show_bug.cgi?id=199788
3233         <rdar://problem/52142570>
3234
3235         Reviewed by Tim Horton.
3236
3237         As it turns out, sending modern async completion-handler based IPC messages while processing incoming sync
3238         messages results in a debug assertion. Instead of migrating FontAtSelection to the new async IPC mechanism,
3239         restore the older CallbackID-based async IPC.
3240
3241         * UIProcess/WebPageProxy.h:
3242         * UIProcess/WebPageProxy.messages.in:
3243         * UIProcess/mac/WebPageProxyMac.mm:
3244         (WebKit::WebPageProxy::fontAtSelection):
3245         (WebKit::WebPageProxy::fontAtSelectionCallback):
3246         * WebProcess/WebPage/WebPage.h:
3247         * WebProcess/WebPage/WebPage.messages.in:
3248         * WebProcess/WebPage/mac/WebPageMac.mm:
3249         (WebKit::WebPage::fontAtSelection):
3250
3251 2019-07-15  Dean Jackson  <dino@apple.com>
3252
3253         [WebGL] Remove software rendering and simplify context creation on macOS
3254         https://bugs.webkit.org/show_bug.cgi?id=199789
3255
3256         Reviewed by Sam Weinig.
3257
3258         Remove force software WebGL setting.
3259
3260         * Shared/WebPreferences.yaml:
3261         * UIProcess/API/C/WKPreferences.cpp:
3262         (WKPreferencesSetForceSoftwareWebGLRendering): Deleted.
3263         (WKPreferencesGetForceSoftwareWebGLRendering): Deleted.
3264         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3265
3266 2019-07-15  Daniel Bates  <dabates@apple.com>
3267
3268         Typing into a cell in a Google Sheet lags behind by one character
3269         https://bugs.webkit.org/show_bug.cgi?id=199587
3270         <rdar://problem/51616845>
3271
3272         Reviewed by Brent Fulgham.
3273
3274         Remove all timers from the holding tank on text insertion or deletion (represented as an
3275         editing command). Timers that were in the holding tank never stopped ticking and will now
3276         be able to execute their action.
3277
3278         * WebProcess/WebPage/WebPage.cpp:
3279         (WebKit::WebPage::executeEditingCommand):
3280         (WebKit::WebPage::insertTextAsync):
3281         (WebKit::WebPage::setCompositionAsync):
3282         (WebKit::WebPage::confirmCompositionAsync):
3283         Call platformWillPerformEditingCommand().
3284
3285         * WebProcess/WebPage/WebPage.h:
3286         (WebKit::WebPage::platformWillPerformEditingCommand): Added.
3287         * WebProcess/WebPage/ios/WebPageIOS.mm:
3288         (WebKit::WebPage::platformWillPerformEditingCommand): Remove all the timers from the holding
3289         tank if we have a holding tank.
3290
3291 2019-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
3292
3293         [macOS 10.15] Cannot unbold selected text when the system font is used
3294         https://bugs.webkit.org/show_bug.cgi?id=199788
3295         <rdar://problem/52142570>
3296
3297         Reviewed by Tim Horton.
3298
3299         In macOS 10.15, +[NSFont fontWithName:size:] no longer recognizes system fonts (of name
3300         ".SFNS-*") and returns nil instead. However, our existing implementation of
3301         WebPageProxy::fontAtSelection works by grabbing the font name in the web process, and
3302         sending it over to the UI process, where it is mapped to an NSFont. As a result, this always
3303         results in a nil font in macOS 10.15, which causes us to never update NSFontManager's
3304         selected font. In turn, this means that once selected text is bolded, it can't be unbolded
3305         via NSFontManager, since NSFontManager thinks that the text is still not bold.
3306
3307         To fix this, we simply encode and send a platform FontInfo instead of sending the font name.
3308         This allows the UI process to reconstruct NSFonts from font attribute dictionaries instead,
3309         and update the font manager.
3310
3311         * UIProcess/Cocoa/WebViewImpl.mm:
3312         (WebKit::WebViewImpl::updateFontManagerIfNeeded):
3313         * UIProcess/WebPageProxy.h:
3314         * UIProcess/WebPageProxy.messages.in:
3315         * UIProcess/mac/WebPageProxyMac.mm:
3316         (WebKit::WebPageProxy::fontAtSelection):
3317
3318         Refactor this to send a FontInfo (containing a font attribute dictionary) instead of a font
3319         name.
3320
3321         (WebKit::WebPageProxy::fontAtSelectionCallback): Deleted.
3322         * WebProcess/WebPage/WebPage.h:
3323         * WebProcess/WebPage/WebPage.messages.in:
3324
3325         Change FontAtSelection to use sendWithAsyncReply instead of sending a callback ID. This also
3326         allows us to remove FontAtSelectionCallback.
3327
3328         * WebProcess/WebPage/mac/WebPageMac.mm:
3329         (WebKit::WebPage::fontAtSelection):
3330
3331 2019-07-15  Jiewen Tan  <jiewen_tan@apple.com>
3332
3333         [iOS] SOAuthorizationSession should tell AppSSO whether the UIClient is capable of showing the extension UI
3334         https://bugs.webkit.org/show_bug.cgi?id=199790
3335         <rdar://problem/52790112>
3336
3337         Reviewed by Brent Fulgham.
3338
3339         On iOS, WebKit relies on a SPI -[WKUIDelegatePrivate _presentingViewControllerForWebView:] to present the
3340         extension UI. However, third party clients often don't implement this SPI. Therefore, WebKit will not be
3341         able to present the extension UI for them.
3342
3343         To be able to show the extension UI for third party WebKit clients, WebKit should unset SOAuthorization.enableEmbeddedAuthorizationViewController
3344         whenever clients don't implement the above SPI such that AppSSO could show the UI in their UI process.
3345
3346         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
3347         (WebKit::SOAuthorizationSession::start):
3348
3349 2019-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
3350
3351         REGRESSION: Chase app crashes immediately after authentication
3352         https://bugs.webkit.org/show_bug.cgi?id=199798
3353         <rdar://problem/53106179>
3354
3355         Reviewed by Alex Christensen.
3356
3357         After r247411, we sometimes try to consult `_page` from WKWebView, before WKWebView's `_page` has been set. This
3358         happens under a check for -[WKWebView _isEditable], from within -[WKContentView setupInteraction], which happens
3359         if the host app is not linked on the iOS 12 SDK or earlier. To mitigate this, simply add a null check in
3360         -_isEditable.
3361
3362         There's currently no great way to test this, since we don't have a mechanism for simulating linked-on checks.
3363
3364         * UIProcess/API/Cocoa/WKWebView.mm:
3365         (-[WKWebView _isEditable]):
3366
3367 2019-07-13  Andres Gonzalez  <andresg_22@apple.com>
3368
3369         Add accessibility support to WKDataListSuggestionsView.
3370         https://bugs.webkit.org/show_bug.cgi?id=199772
3371         <rdar://problem/47095851>
3372
3373         Reviewed by Chris Fleizach.
3374
3375         Added accessibility announcement notifications to show, dismiss and selection change for the datalist suggestions view.
3376         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
3377         (-[WKDataListSuggestionsView notifyAccessibilityClients:]):
3378         (-[WKDataListSuggestionsView moveSelectionByDirection:]):
3379         (-[WKDataListSuggestionsView invalidate]):
3380         (-[WKDataListSuggestionsView showSuggestionsDropdown:]):
3381
3382 2019-07-13  Zalan Bujtas  <zalan@apple.com>
3383
3384         Cannot bring up custom media controls at all on v.youku.com
3385         https://bugs.webkit.org/show_bug.cgi?id=199699
3386         <rdar://problem/51835327>
3387
3388         Reviewed by Simon Fraser.
3389
3390         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
3391         (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
3392         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
3393         (WebKit::WebPage::performDictionaryLookupAtLocation):
3394         * WebProcess/WebPage/WebFrame.cpp:
3395         (WebKit::WebFrame::hitTest const):
3396         * WebProcess/WebPage/WebPage.cpp:
3397         (WebKit::handleContextMenuEvent):
3398         (WebKit::WebPage::characterIndexForPointAsync):
3399         * WebProcess/WebPage/ios/WebPageIOS.mm:
3400         (WebKit::WebPage::handleStylusSingleTapAtPoint):
3401         (WebKit::textInteractionPositionInformation):
3402         * WebProcess/WebPage/mac/WebPageMac.mm:
3403         (WebKit::WebPage::shouldDelayWindowOrderingEvent):
3404         (WebKit::WebPage::acceptsFirstMouse):
3405         (WebKit::WebPage::performImmediateActionHitTestAtLocation):
3406
3407 2019-07-12  Andy Estes  <aestes@apple.com>
3408
3409         [Cocoa] -loadFileURL:allowingReadAccessToURL: should fully resolve file URLs
3410         https://bugs.webkit.org/show_bug.cgi?id=199768
3411         <rdar://problem/52002206>
3412
3413         Reviewed by Geoffrey Garen.
3414
3415         -loadFileURL:allowingReadAccessToURL: used -_web_originalDataAsWTFString from WKNSURLExtras
3416         to convert the file and read access NSURLs to strings, which under the hood calls
3417         CFURLGetBytes(). CFURLGetBytes() gets the URL's string without considering the base URL, so
3418         if the client creates a URL like this:
3419
3420             NSURL *url = [NSURL fileURLWithPath:@"tmpfile.txt" relativeToURL:[NSURL fileURLWithPath:@"/tmp"]]
3421
3422         ... then -_web_originalDataAsWTFString will merely return the string "tmpfile.txt". When
3423         that is later converted back to a URL in WebPageProxy::loadFile(), we lose track of the base
3424         component and refuse to load something that no longer looks like a file: URL.
3425
3426         Fixed this by fully resolving the URLs passed to -loadFileURL:allowingReadAccessToURL: when
3427         converting to strings by using -[NSURL absoluteString] instead of -_web_originalDataAsWTFString.
3428
3429         * Shared/Cocoa/WKNSURLExtras.mm:
3430         (-[NSURL _web_originalDataAsWTFString]):
3431         * UIProcess/API/Cocoa/WKWebView.mm:
3432         (-[WKWebView loadFileURL:allowingReadAccessToURL:]):
3433
3434 2019-07-12  Megan Gardner  <megan_gardner@apple.com>
3435
3436         Turn off two finger gestures for editable non-scaled content
3437         https://bugs.webkit.org/show_bug.cgi?id=199739
3438         <rdar://problem/52107190>
3439
3440         Reviewed by Tim Horton.
3441
3442         This gesture is blocking a selection gesture. Turn it off as it is not
3443         even being used in editable content.
3444
3445         * UIProcess/ios/WKContentViewInteraction.mm:
3446         (-[WKContentView setupInteraction]):
3447         (-[WKContentView _didChangeWebViewEditability]):
3448
3449 2019-07-12  Jiewen Tan  <jiewen_tan@apple.com>
3450
3451         SOAuthorizationSession::presentViewController should check WebPageProxy::isClosed()
3452         https://bugs.webkit.org/show_bug.cgi?id=199755
3453         <rdar://problem/52323585>
3454
3455         Reviewed by Chris Dumez.
3456
3457         WebPageProxy::pageClient() is not guaranteed to be non null all the time. Therefore, we should check
3458         WebPageProxy::isClosed() before using it.
3459
3460         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
3461         (WebKit::SOAuthorizationSession::presentViewController):
3462
3463 2019-07-12  Chris Dumez  <cdumez@apple.com>
3464
3465         Regression(macOS Catalina): Cannot quick look html documents in Mail
3466         https://bugs.webkit.org/show_bug.cgi?id=199754
3467         <rdar://problem/51304961>
3468
3469         Reviewed by Geoff Garen.
3470
3471         If the client asks us to load a file URL but does not provide a resource path, WebKit
3472         would fallback to issuing a sandbox extension for /. This no longer works on mac OS
3473         Catalina and it would thus fail to load the file.
3474
3475         To address the issue, if the attempt to create a sandbox extension for / fails, we now
3476         fall back to issuing one for the file's baseURL (path of containing folder).
3477
3478         * UIProcess/WebPageProxy.cpp:
3479         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
3480
3481 2019-07-12  Michael Catanzaro  <mcatanzaro@igalia.com>
3482
3483         WebBackForwardListItem::setPageState should receive pageState by rvalue reference
3484         https://bugs.webkit.org/show_bug.cgi?id=199535
3485
3486         Reviewed by Alex Christensen
3487
3488         Coverity is complaining here about copying PageState by value in the parameter list. It's
3489         sort of a false positive, in that the PageState really does need to be copied here, so this
3490         is the best we can do. But pass by value and then WTFMove() is a pretty strange way to write
3491         it. Passing by rvalue reference would be better. This makes the copy more clear.
3492
3493         * Shared/WebBackForwardListItem.h:
3494         (WebKit::WebBackForwardListItem::setPageState):
3495         * UIProcess/WebProcessProxy.cpp:
3496         (WebKit::WebProcessProxy::updateBackForwardItem):
3497
3498 2019-07-12  Youenn Fablet  <youenn@apple.com>
3499
3500         Add release logging for quota checks
3501         https://bugs.webkit.org/show_bug.cgi?id=199697
3502
3503         Reviewed by Alex Christensen.
3504
3505         Log requests made to the page and the result from the application.
3506
3507         * Platform/Logging.h:
3508         * UIProcess/WebPageProxy.cpp:
3509         (WebKit::WebPageProxy::requestStorageSpace):
3510
3511 2019-07-12  Youenn Fablet  <youenn@apple.com>
3512
3513         Remove unneeded variable in LocalStorageNamespace::getOrCreateStorageArea
3514         https://bugs.webkit.org/show_bug.cgi?id=199477
3515
3516         Reviewed by Alex Christensen.
3517
3518         * NetworkProcess/WebStorage/StorageManager.cpp:
3519         (WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea):
3520
3521 2019-07-12  Pawel Stanek  <p.stanek@metrological.com>
3522
3523         Connection::waitForSyncReply() uses wall time clock for timeout
3524         https://bugs.webkit.org/show_bug.cgi?id=198712
3525         Due to a nature of the system time (it might not be set, jump, be off
3526         by a lot) it is better to use monotonically increasing time which is
3527         exactly what's used in a similar place i.e. Connection::waitForMessage()
3528         
3529         Reviewed by Alex Christensen.
3530
3531         * Platform/IPC/Connection.cpp:
3532         (IPC::Connection::waitForSyncReply):
3533
3534 2019-07-12  Timothy Hatcher  <timothy@apple.com>
3535
3536         Drop DarkModeCSSEnabled as an experimental feature and always enable it.
3537         https://bugs.webkit.org/show_bug.cgi?id=199725
3538         rdar://problem/52970972
3539
3540         Reviewed by Megan Gardner.
3541
3542         * Shared/WebPreferences.yaml: Removed DarkModeCSSEnabled.
3543
3544 2019-07-11  Myles C. Maxfield  <mmaxfield@apple.com>
3545
3546         New York font erroneously gets synthetic bold
3547         https://bugs.webkit.org/show_bug.cgi?id=199653
3548         <rdar://problem/51692592>
3549
3550         Reviewed by Simon Fraser.
3551
3552         Add the SPI to enable the new fonts.
3553
3554         * Shared/WebPreferences.yaml:
3555         * UIProcess/API/C/WKPreferences.cpp:
3556         (WKPreferencesSetShouldAllowDesignSystemUIFonts):
3557         (WKPreferencesGetShouldAllowDesignSystemUIFonts):
3558         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3559         * UIProcess/API/Cocoa/WKPreferences.mm:
3560         (-[WKPreferences _shouldAllowDesignSystemUIFonts]):
3561         (-[WKPreferences _setShouldAllowDesignSystemUIFonts:]):
3562         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3563
3564 2019-07-11  Chris Dumez  <cdumez@apple.com>
3565
3566         ASSERTION FAILED: RunLoop::isMain() under IPC::Connection::sendWithAsyncReply()
3567         https://bugs.webkit.org/show_bug.cgi?id=199734
3568         <rdar://problem/52977439>
3569
3570         Reviewed by Geoffrey Garen.
3571
3572         It appears WKProcessTaskStateObserverDelegate's taskStateDidChange handler can get called
3573         on a background thread so we need to make sure we go back to the main thread before we
3574         go into WebKit and do IPC.
3575
3576         * Shared/Cocoa/ProcessTaskStateObserver.mm:
3577         (-[WKProcessTaskStateObserverDelegate process:taskStateDidChange:]):
3578
3579 2019-07-11  Sihui Liu  <sihui_liu@apple.com>
3580
3581         StorageArea should not be destructed on the main thread
3582         https://bugs.webkit.org/show_bug.cgi?id=199713
3583         <rdar://problem/52911900>
3584
3585         Reviewed by Alex Christensen.
3586
3587         After r246079, LocalStorageNameSpace could be destructed on the main thread and it may hold the last reference 
3588         to StorageArea. Then we saw the crashes that StorageArea was wrongly destructed on the main thread.
3589
3590         * NetworkProcess/NetworkSession.cpp:
3591         (WebKit::NetworkSession::~NetworkSession):
3592         * NetworkProcess/WebStorage/StorageManager.cpp:
3593         (WebKit::StorageManager::waitUntilTasksFinished):
3594         (WebKit::StorageManager::waitUntilWritesFinished): Deleted.
3595         * NetworkProcess/WebStorage/StorageManager.h:
3596
3597 2019-07-11  Tim Horton  <timothy_horton@apple.com>
3598
3599         Null deref of Range under WebPage::startAutoscrollAtPosition
3600         https://bugs.webkit.org/show_bug.cgi?id=199724
3601         <rdar://problem/41127089>
3602
3603         Reviewed by Dean Jackson.
3604
3605         * WebProcess/WebPage/ios/WebPageIOS.mm:
3606         (WebKit::WebPage::startAutoscrollAtPosition):
3607         Refactor this function to be early-return-y, and add one more
3608         early return if the Range is null.
3609
3610 2019-07-11  Pablo Saavedra  <psaavedra@igalia.com>
3611
3612         [WPE][GTK] Build failure with ENABLE_ACCESSIBILITY=OFF
3613         https://bugs.webkit.org/show_bug.cgi?id=199625
3614
3615         Added ENABLE(ACCESSIBILITY) and replaced HAVE(ACCESSIBILITY)
3616         with ENABLE(ACCESSIBILITY) in the code.
3617
3618         Additionally, the TestRunner code generator now honors the
3619         Conditional IDL format.
3620
3621         Reviewed by Konstantin Tokarev.
3622
3623         * UIProcess/API/glib/WebKitWebViewAccessible.cpp:
3624         * UIProcess/API/glib/WebKitWebViewAccessible.h:
3625         * UIProcess/API/wpe/PageClientImpl.cpp:
3626         * UIProcess/API/wpe/PageClientImpl.h:
3627         * UIProcess/API/wpe/WPEView.cpp:
3628         (WKWPE::m_backend):
3629         (WKWPE::View::~View):
3630         * UIProcess/API/wpe/WPEView.h:
3631         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3632         (WKAccessibilityRootObject):
3633         (WKAccessibilityFocusedObject):
3634         (WKAccessibilityEnableEnhancedAccessibility):
3635         (WKAccessibilityEnhancedAccessibilityEnabled):
3636         * WebProcess/WebPage/WebPage.cpp:
3637         * WebProcess/WebPage/WebPage.h:
3638         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
3639         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h:
3640         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
3641         (WebKit::WebPage::platformInitialize):
3642         * WebProcess/WebPage/wpe/WebPageWPE.cpp:
3643         (WebKit::WebPage::platformInitialize):
3644         * WebProcess/wpe/WebProcessMainWPE.cpp:
3645
3646 2019-07-11  Commit Queue  <commit-queue@webkit.org>
3647
3648         Unreviewed, rolling out r247314.
3649         https://bugs.webkit.org/show_bug.cgi?id=199721
3650
3651         Caused performance regression. (Requested by deanj on
3652         #webkit).
3653
3654         Reverted changeset:
3655
3656         "Disable speculative loading if cache is not to be used for
3657         the load"
3658         https://bugs.webkit.org/show_bug.cgi?id=199644
3659         https://trac.webkit.org/changeset/247314
3660
3661 2019-07-11  Dean Jackson  <dino@apple.com>
3662
3663         CrashTracer: Regression : MobileSafari at UIKit: -[CALayerAccessibility__UIKit__QuartzCore setBounds:]
3664         https://bugs.webkit.org/show_bug.cgi?id=199720
3665         <rdar://problem/51470469>
3666
3667         Reviewed by Tim Horton.
3668
3669         Speculative fix after confirming that this crash can occur when
3670         a zero width/height view is used for a UITargetedPreview. We
3671         already guarded against this in the default flow, but not in
3672         the fallback path where we take a view snapshot.
3673
3674         * UIProcess/ios/WKContentViewInteraction.mm:
3675         (createFallbackTargetedPreview): Return early if rectangles are empty.
3676
3677 2019-07-11  Alex Christensen  <achristensen@webkit.org>
3678
3679         Use mobile UA on jsfiddle.net
3680         https://bugs.webkit.org/show_bug.cgi?id=199687
3681         <rdar://problem/50839844>
3682
3683         Reviewed by Maciej Stachowiak.
3684
3685         Text selection does not work on iPads using desktop UA.
3686         This isn't the best solution, but it's certainly *a* solution.
3687
3688         * UIProcess/ios/WebPageProxyIOS.mm:
3689         (WebKit::desktopClassBrowsingRecommendedForRequest):
3690
3691 2019-07-11  Simon Fraser  <simon.fraser@apple.com>
3692
3693         [iOS WK2] Can't place caret or select in content that overflows a contenteditable element
3694         https://bugs.webkit.org/show_bug.cgi?id=199741
3695         rdar://problem/50545233
3696
3697         Reviewed by Wenson Hsieh.
3698
3699         Various code paths for editing used renderer->absoluteBoundingBoxRect(), which is the border
3700         box of the element (or a set of line boxes for inline elements) converted to absolute
3701         coordinates. This excludes overflow content, but contenteditable needs to be able to
3702         place the caret in overflow content, and allow selection rects to be in the overflow area
3703         (if the element has visible overflow).
3704
3705         Try to clean this up by adding some static helpers on WebPage for accessing the relevant
3706         rects, and use them in code call from visiblePositionInFocusedNodeForPoint(), and
3707         code that is input to selectionClipRect.
3708
3709         This changes selectionClipRect to use the padding box (excluding borders), which is a progression.
3710
3711         * WebProcess/WebPage/WebPage.h:
3712         * WebProcess/WebPage/ios/WebPageIOS.mm:
3713         (WebKit::WebPage::platformEditorState const):
3714         (WebKit::elementBoundsInFrame):
3715         (WebKit::constrainPoint):
3716         (WebKit::WebPage::rootViewBoundsForElement):
3717         (WebKit::WebPage::absoluteInteractionBoundsForElement):
3718         (WebKit::WebPage::rootViewInteractionBoundsForElement):
3719         (WebKit::WebPage::dispatchSyntheticMouseEventsForSelectionGesture):
3720         (WebKit::WebPage::getFocusedElementInformation):
3721         (WebKit::innerFrameQuad): Deleted.
3722         (WebKit::elementRectInRootViewCoordinates): Deleted.
3723
3724 2019-07-11  Jonathan Bedard  <jbedard@apple.com>
3725
3726         [iOS 13] Enable WebKit build
3727         https://bugs.webkit.org/show_bug.cgi?id=199481
3728         <rdar://problem/52619048>
3729
3730         Reviewed by Tim Horton.
3731
3732         * Platform/spi/ios/UIKitSPI.h: Add UITextEffectsWindow.sharedTextEffectsWindowForWindowScene SPI.
3733         * UIProcess/ios/WKContentViewInteraction.mm:
3734         (-[WKContentView showGlobalMenuControllerInRect:]): setTargetRect, setMenuVisible marked depreciated in iOS 13.
3735         (-[WKContentView hideGlobalMenuController]): Ditto.
3736
3737 2019-07-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3738
3739         MobileSafari may crash under -[UIKeyboardTaskExecutionContext transferExecutionToMainThreadWithTask:]
3740         https://bugs.webkit.org/show_bug.cgi?id=199701
3741         <rdar://problem/52590170>
3742
3743         Reviewed by Tim Horton.
3744
3745         Mitigates a crash wherein we end up calling the completion handler of
3746         -requestAutocorrectionContextWithCompletionHandler: within a nested call
3747         to -requestAutocorrectionContextWithCompletionHandler:. In this particular
3748         case, a sync `window.open` from the web process to the UI process happens
3749         while the UI process is already handling a sync autocorrection context
3750         request. This causes the UI process to try and immediately dispatch the
3751         incoming sync message to avoid deadlock. However, Safari's logic to create
3752         and set up a new web view when opening a new window makes the new view the
3753         first responder, which then prompts UIKit logic to request an autocorrection
3754         context for the new web view.
3755
3756         To avoid the issue for now, simply use -resignFirstResponder as a cue to invoke
3757         pending autocorrection context handlers in the original web view before UIKit
3758         tries to request autocorrection context in the newly created view.
3759
3760         I attempted to write a test for this, but realized that we only end up hitting
3761         the debug assertion pointed out in <https://webkit.org/b/199680>; we should be
3762         able to write a test for this in the future, if we teach Connection to handle
3763         multiple outgoing sync messages.
3764
3765         For the time being, I've attached a manual test case to the bug.
3766
3767         * UIProcess/ios/WKContentViewInteraction.mm:
3768         (-[WKContentView resignFirstResponderForWebView]):
3769         (-[WKContentView _cancelPendingAutocorrectionContextHandler]):
3770
3771         Add a new helper to signify that a pending autocorrection context handler should be cancelled (invoked
3772         immediately with empty data). Use this in a few places where we currently explicitly pass
3773         -[WKAutocorrectionContext emptyAutocorrectionContext].
3774
3775         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
3776
3777 2019-07-10  Simon Fraser  <simon.fraser@apple.com>
3778
3779         [iOS WK2] With modal overlay and body overflow:hidden, can't access all the content
3780         https://bugs.webkit.org/show_bug.cgi?id=199693
3781         rdar://problem/51930364
3782
3783         Reviewed by Tim Horton.
3784
3785         A page with overflow:hidden on the root needs to be scrollable if:
3786         * it's zoomed
3787         * the visual viewport is smaller than the layout viewport (including visible keyboard)
3788         * scrolling is required to hide MobileSafari's squishy bars
3789
3790         This patch does the last two, plumbing a "visual viewport is smaller than layout viewport"
3791         bit up from WebCore via the scrolling tree (that way, when it changes we automatically trigger
3792         a commit), and checking for squished bars in WKWebView.
3793
3794         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
3795         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
3796         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
3797         * UIProcess/API/Cocoa/WKWebView.mm:
3798         (-[WKWebView _didCommitLayerTree:]):
3799         (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:maximumUnobscuredSizeOverride:]):
3800         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
3801         (WebKit::RemoteScrollingCoordinatorProxy::hasScrollableMainFrame const):
3802         * UIProcess/WebPageProxy.h:
3803         (WebKit::WebPageProxy::maximumUnobscuredSize const):
3804         * WebProcess/WebPage/ios/WebPageIOS.mm:
3805         (WebKit::WebPage::dynamicViewportSizeUpdate):
3806         (WebKit::WebPage::updateVisibleContentRects):
3807
3808 2019-07-10  Tim Horton  <timothy_horton@apple.com>
3809
3810         Long pressing on attachments will crash the WebContent process
3811         https://bugs.webkit.org/show_bug.cgi?id=199696
3812         <rdar://problem/52920241>
3813
3814         Reviewed by Dean Jackson.
3815
3816         * WebProcess/WebPage/ios/WebPageIOS.mm:
3817         (WebKit::linkIndicatorPositionInformation):
3818         (WebKit::elementPositionInformation):
3819         (WebKit::selectionPositionInformation):
3820         (WebKit::WebPage::positionInformation):
3821         Instead of one-off creating a node snapshot for <attachment>, just
3822         use TextIndicator. This way, we get an estimated background color,
3823         paint at the right resolution, etc.
3824
3825         Also, hitNode was often null where we were previously calling
3826         shareableBitmapSnapshotForNode, because it depends on the element
3827         having click event handlers. selectionPositionInformation() re-hit-tests
3828         more permissively to find the <attachment>, so moving this code
3829         inside that function ensures that we don't try to snapshot a null node.
3830
3831 2019-07-10  Dean Jackson  <dino@apple.com>
3832
3833         Safari’s context menu actions are missing options
3834         https://bugs.webkit.org/show_bug.cgi?id=199694
3835         <rdar://problem/52726822>
3836
3837         Reviewed by Tim Horton.
3838
3839         One of the most embarrassing errors I've ever made. I was returning
3840         early when something existed, instead of when it didn't exist.
3841         (*cough* tests *cough*)
3842
3843         * UIProcess/ios/WKContentViewInteraction.mm:
3844
3845 2019-07-10  Jon Lee  <jonlee@apple.com>
3846
3847         Opt trello.com to mobile UA
3848         https://bugs.webkit.org/show_bug.cgi?id=199686
3849         rdar://problem/51708119
3850
3851         Reviewed by Wenson Hsieh.
3852
3853         * UIProcess/ios/WebPageProxyIOS.mm:
3854         (WebKit::desktopClassBrowsingRecommendedForRequest): Currently the desktop version
3855         of the site prevents users from tapping cards to edit them. Opt trello into the mobile
3856         UA for now.
3857
3858 2019-07-10  Daniel Bates  <dabates@apple.com>
3859
3860         [iOS] Selection handles "Lollipops" can become gray and stay gray
3861         https://bugs.webkit.org/show_bug.cgi?id=198852
3862         <rdar://problem/51736130>
3863
3864         Reviewed by Wenson Hsieh.
3865
3866         Tell the text interaction assistant to update the selection UI when the tint color changes.
3867         We do this by way of deactivating and activating selection.
3868
3869         * UIProcess/ios/WKContentViewInteraction.mm:
3870         (-[WKContentView tintColorDidChange]):
3871
3872 2019-07-10  Dean Jackson  <dino@apple.com>
3873
3874         Share or Copy image from context menu does not share the correct data
3875         https://bugs.webkit.org/show_bug.cgi?id=199681
3876         <rdar://problem/50538771>
3877
3878         Reviewed by Tim Horton.
3879
3880         The UIContextMenuInteraction calls didEndInteraction before executing the
3881         actions of a selected menu item. This means we were assuming the interaction
3882         had finished before performing the action triggered in the interaction, ending
3883         up in the state where we had forgotten which element we were working with.
3884
3885         Rather than ask for UIKit to change, I'm just starting the interaction again
3886         as the action is run. Thankfully we already had the location of the interaction.
3887         There is a small risk that the page has changed in the meantime, but I'm not
3888         sure what to do about that.
3889
3890         While here, I moved a method only used by us into _WKElementActionInternal,
3891         and changed the location stored by _WKActivatedElementInfo from a CGPoint
3892         to an WebCore::IntPoint (since it doesn't escape WebKit).
3893
3894         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm: Use a WebCore::IntPoint rather than a CGPoint.
3895         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:]):
3896         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:userInfo:]):
3897         (-[_WKActivatedElementInfo _interactionLocation]):
3898         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
3899
3900         * UIProcess/API/Cocoa/_WKElementAction.h: Move uiActionForElementInfo to Internal.
3901         * UIProcess/API/Cocoa/_WKElementActionInternal.h:
3902
3903         * UIProcess/API/Cocoa/_WKElementAction.mm: When executing the handlers, restart the interaction
3904         using the location in _WKActivatedElementInfo.
3905         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
3906
3907         * UIProcess/ios/WKContentViewInteraction.mm: Explicitly start and stop interactions at
3908         the appropriate points in the UIContextMenu flow. This isn't really needed since we're
3909         doing it in the handlers, but it will be correct if the UIKit delegate order changes.
3910         (-[WKContentView continueContextMenuInteraction:]):
3911         (-[WKContentView contextMenuInteractionDidEnd:]):
3912
3913 2019-07-10  Chris Dumez  <cdumez@apple.com>
3914
3915         Crash under IPC::Connection::waitForMessage()
3916         https://bugs.webkit.org/show_bug.cgi?id=199680
3917         <rdar://problem/52500561>
3918
3919         Reviewed by Tim Horton.
3920
3921         IPC::Connection::waitForMessage() is crashing due to a null defererence of
3922         m_waitingForMessage. Since m_waitingForMessage is only ever set to null in
3923         waitForMessage(), this seems to imply we've re-entered waitForMessage().
3924         This is in theory possible since the loop inside waitForMessage() calls
3925         SyncMessageState::singleton().dispatchMessages() on every iteration to
3926         process incoming synchronous IPC messages. In theory, one of these sync
3927         IPC messages could run code which ends up calling waitForAndDispatchImmediately()
3928         (and thus waitForMessage()).
3929
3930         We had a debug assertion to try and catch re-entrancy with a comment stating
3931         "We don't support having multiple clients waiting for messages." but we
3932         would not see those in release and we would crash with a null dereference
3933         instead.
3934
3935         To address the crashes in release, return early in case of re-entrancy
3936         (we would still hit an assertion in debug).
3937
3938         * Platform/IPC/Connection.cpp:
3939         (IPC::Connection::Connection):
3940         (IPC::Connection::waitForMessage):
3941         * Platform/IPC/Connection.h:
3942
3943 2019-07-10  Tim Horton  <timothy_horton@apple.com>
3944
3945         Context menus are not presented for WKWebViews that don't have UIDelegates
3946         https://bugs.webkit.org/show_bug.cgi?id=199678
3947
3948         Reviewed by Dean Jackson.
3949
3950         * UIProcess/ios/WKContentViewInteraction.mm:
3951         (-[WKContentView continueContextMenuInteraction:]):
3952         Remove this unnecessary early-return if we don't have a UIDelegate.
3953         We have a default behavior that we totally want to happen.
3954         Also, rename completion() to continueWithContextMenuConfiguration()
3955         to reduce confusion between completion() and completionBlock() in
3956         this method.
3957
3958 2019-07-10  Commit Queue  <commit-queue@webkit.org>
3959
3960         Unreviewed, rolling out r247223.
3961         https://bugs.webkit.org/show_bug.cgi?id=199679
3962
3963         Caused perf regression. (Requested by deanj on #webkit).
3964
3965         Reverted changeset:
3966
3967         "[iPadOS] Viewport pops while loading sohu.com, xinhuanet.com,
3968         and various other websites"
3969         https://bugs.webkit.org/show_bug.cgi?id=199575
3970         https://trac.webkit.org/changeset/247223
3971
3972 2019-07-10  Youenn Fablet  <youenn@apple.com>
3973
3974         Disable speculative loading if cache is not to be used for the load
3975         https://bugs.webkit.org/show_bug.cgi?id=199644
3976
3977         Reviewed by Chris Dumez.
3978
3979         When the page is reloaded, loads are instructed to not use the cache.
3980         It is therefore unneeded to do speculative revalidation.
3981         Allow speculative revalidation if the cache policy is either the default HTTP policy or
3982         if policy is to refresh all cache data.
3983         Covered by added test.
3984
3985         * NetworkProcess/cache/NetworkCache.cpp:
3986         (WebKit::NetworkCache::cachePolicyValidForSpeculativeRevalidation):
3987         (WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):
3988
3989 2019-07-10  Alex Christensen  <achristensen@webkit.org>
3990
3991         Fix build after Foundation changes UIEdgeInsets definition
3992         https://bugs.webkit.org/show_bug.cgi?id=199660
3993         <rdar://problem/52390453>
3994
3995         Reviewed by Tim Horton.
3996
3997         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3998         * UIProcess/Cocoa/WKWebViewContentProvider.h:
3999
4000 2019-07-10  Antti Koivisto  <antti@apple.com>
4001
4002         Remove TouchActionData