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