[GTK][CMake] Make gtk-unix-print a component of FindGTK.cmake
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2020-04-21  Adrian Perez de Castro  <aperez@igalia.com>
2
3         [GTK][CMake] Make gtk-unix-print a component of FindGTK.cmake
4         https://bugs.webkit.org/show_bug.cgi?id=210792
5
6         Reviewed by Carlos Garcia Campos.
7
8         No new tests needed.
9
10         * PlatformGTK.cmake: Use the GTK::UnixPrint imported target.
11
12 2020-04-21  Philippe Normand  <pnormand@igalia.com>
13
14         [CMake] gst-build-backed build fails
15         https://bugs.webkit.org/show_bug.cgi?id=210742
16
17         Reviewed by Xabier Rodriguez-Calvar.
18
19         * PlatformWPE.cmake:
20
21 2020-04-21  Adrian Perez de Castro  <aperez@igalia.com>
22
23         Non-unified build fixes late February 2020 edition
24         https://bugs.webkit.org/show_bug.cgi?id=210767
25
26         Unreviewed build fix.
27
28         * NetworkProcess/NetworkResourceLoadMap.h: Add missing wtf/Function.h header.
29
30 2020-04-20  Ross Kirsling  <ross.kirsling@sony.com>
31
32         Classes marked final should not use protected access specifier
33         https://bugs.webkit.org/show_bug.cgi?id=210775
34
35         Reviewed by Daniel Bates.
36
37         * Shared/API/APIDictionary.h:
38         * WebProcess/GPU/media/TextTrackPrivateRemote.h:
39         * WebProcess/Plugins/Netscape/JSNPMethod.h:
40         * WebProcess/Plugins/Netscape/JSNPObject.h:
41
42 2020-04-20  Peng Liu  <peng.liu6@apple.com>
43
44         Fix build failures when video fullscreen and picture-in-picture is disabled
45         https://bugs.webkit.org/show_bug.cgi?id=210777
46
47         Reviewed by Eric Carlson.
48
49         Wrap video fullscreen and picture-in-picture related code with "#if ENABLE(VIDEO_PRESENTATION_MODE)".
50
51         * Configurations/FeatureDefines.xcconfig:
52         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
53         (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenGravity):
54         (WebKit::RemoteMediaPlayerProxy::updateVideoFullscreenInlineImage):
55         (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenMode):
56         (WebKit::RemoteMediaPlayerProxy::videoFullscreenStandbyChanged):
57         (WebKit::RemoteMediaPlayerProxy::setBufferingPolicy):
58         * GPUProcess/media/RemoteMediaPlayerProxy.h:
59         * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
60         * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm:
61         (WebKit::RemoteMediaPlayerProxy::prepareForPlayback):
62         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
63         (WebKit::MediaPlayerPrivateRemote::prepareForPlayback):
64
65 2020-04-20  Alex Christensen  <achristensen@webkit.org>
66
67         SPI clients using fastServerTrustEvaluationEnabled need SPI to inform them of modern TLS negotiation
68         https://bugs.webkit.org/show_bug.cgi?id=210533
69
70         Reviewed by Brady Eidson.
71
72         * NetworkProcess/NetworkDataTask.h:
73         (WebKit::NetworkDataTaskClient::didNegotiateModernTLS):
74         * NetworkProcess/NetworkLoad.cpp:
75         (WebKit::NetworkLoad::didNegotiateModernTLS):
76         * NetworkProcess/NetworkLoad.h:
77         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
78         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
79         (WebKit::NetworkDataTaskCocoa::didNegotiateModernTLS):
80         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
81         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
82         * UIProcess/API/APINavigationClient.h:
83         (API::NavigationClient::didNegotiateModernTLS):
84         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
85         * UIProcess/Cocoa/NavigationState.h:
86         * UIProcess/Cocoa/NavigationState.mm:
87         (WebKit::NavigationState::setNavigationDelegate):
88         (WebKit::NavigationState::NavigationClient::didNegotiateModernTLS):
89         * UIProcess/Network/NetworkProcessProxy.cpp:
90         (WebKit::NetworkProcessProxy::didNegotiateModernTLS):
91         * UIProcess/Network/NetworkProcessProxy.h:
92         * UIProcess/Network/NetworkProcessProxy.messages.in:
93         * UIProcess/WebPageProxy.cpp:
94         * UIProcess/WebPageProxy.h:
95
96 2020-04-20  Kate Cheney  <katherine_cheney@apple.com>
97
98         App-bound domain behavior should abide by the limitsNavigationsToAppBoundDomains argument in WKWebView configuration
99         https://bugs.webkit.org/show_bug.cgi?id=210769
100         <rdar://problem/62065241>
101
102         Reviewed by Brent Fulgham.
103
104         Changes app-bound domain behavior to be triggered by the value of
105         limitsNavigationsToAppBoundDomains, a WebView configuration flag.
106         If the WebView has this parameter set and is currently navigating to
107         an app bound domain, then app-bound privileges will be granted.
108
109         * UIProcess/WebPageProxy.cpp:
110         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted):
111         Update this function to return a boolean to indicate whether the
112         navigation should fail. A failure should occur if a WebView has set
113         the limitsNavigationsToAppBoundDomains flag and attempts to navigate
114         away from an app-bound domain.
115
116         If the limitsNavigationsToAppBoundDomains value has not been set to
117         true, maintain non-app bound behavior regardless of whether the domain
118         is app-bound or not.
119
120         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
121         Check the result of setIsNavigatingToAppBoundDomainAndCheckIfPermitted and fail the
122         navigation if needed, with both RELEASE logging and an appropriate
123         error message.
124
125         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain): Deleted.
126         * UIProcess/WebPageProxy.h:
127         Renamed for clarity.
128
129 2020-04-20  Nikos Mouchtaris  <nmouchtaris@apple.com>
130
131         WK2 Quicklook for attachments
132         https://bugs.webkit.org/show_bug.cgi?id=208891
133
134         Reviewed by Darin Adler.
135
136         Allow attachment elements to render QuickLook thumbnail generated
137         from contents of the file as its icon, rather than the default
138         icons associated with each mime type.
139
140         * Configurations/WebKit.xcconfig:
141         Link QuickLook thumbnailing framework.
142         * UIProcess/API/APIAttachment.h:
143         * UIProcess/API/Cocoa/WKWebView.mm:
144         (-[WKWebView _insertAttachmentWithFileWrapper:contentType:completion:]):
145         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
146         Create thumbnail request and add to queue.
147         (WebKit::convertNSImageToBitmap):
148         (WebKit::convertUIImageToBitmap):
149         (WebKit::WebPageProxy::getQLThumbnailForGenerationRequestion):
150         (WebKit::WebPageProxy::getQLThumbnailForFileWrapper):
151         (WebKit::WebPageProxy::getQLThumbnailForAttachment):
152         * UIProcess/QLThumbnailLoad.h: Added.
153         * UIProcess/QLThumbnailLoad.mm: Added.
154         Add code to request thumbnail for file data.
155         (-[WKQLThumbnailQueueManager init]):
156         (+[WKQLThumbnailQueueManager sharedInstance]):
157         (-[WKQLThumbnailLoadOperation initWithAttachment:identifier:]):
158         (-[WKQLThumbnailLoadOperation initWithURL:identifier:]):
159         (-[WKQLThumbnailLoadOperation start]):
160         (-[WKQLThumbnailLoadOperation isAsynchronous]):
161         (-[WKQLThumbnailLoadOperation isExecuting]):
162         (-[WKQLThumbnailLoadOperation setExecuting:]):
163         (-[WKQLThumbnailLoadOperation isFinished]):
164         (-[WKQLThumbnailLoadOperation setFinished:]):
165         * UIProcess/WebPageProxy.cpp:
166         * UIProcess/WebPageProxy.h:
167         * WebKit.xcodeproj/project.pbxproj:
168         * WebProcess/WebPage/WebPage.cpp:
169         (WebKit::WebPage::updateAttachmentIcon):
170         Set thumbnail of attachment element
171         * WebProcess/WebPage/WebPage.h:
172         * WebProcess/WebPage/WebPage.messages.in:
173         Thumbnail request message.
174
175 2020-04-20  Kate Cheney  <katherine_cheney@apple.com>
176
177         Unreviewed macCatalyst build fix.
178
179         * UIProcess/WebPageProxy.cpp:
180         (WebKit::WebPageProxy::disableServiceWorkerEntitlementInNetworkProcess):
181         (WebKit::WebPageProxy::clearServiceWorkerEntitlementOverride):
182
183 2020-04-20  Simon Fraser  <simon.fraser@apple.com>
184
185         Scrolling with background-attachment: fixed needs to trigger repaints
186         https://bugs.webkit.org/show_bug.cgi?id=193893
187         <rdar://problem/47587017>
188
189         Reviewed by Dean Jackson.
190
191         When scrolling an overflow scroll which has "background-atttachment:fixed" in the content,
192         the node will have non-empty synchronous scrolling reasons. In this case we need to
193         send the scroll to the main thread, and trigger a repaint on scroll.
194
195         If handling the wheel event on the scrolling thread determines that the scroll must be sent
196         to the main thread, EventDispatcher::wheelEvent() does so in the callback function.
197
198         To trigger the repaint, RenderLayer::scrollTo() asks the composited layers backing whether
199         the node has synchronous scrolling reasons; this is implemented by asking the scrolling
200         coordinator.
201
202         * WebProcess/WebPage/EventDispatcher.cpp:
203         (WebKit::EventDispatcher::wheelEvent):
204
205 2020-04-20  Megan Gardner  <megan_gardner@apple.com>
206
207         Date and Time form controls not showing correct initial values on immediate second invocation.
208         https://bugs.webkit.org/show_bug.cgi?id=210613
209
210         Reviewed by Wenson Hsieh.
211
212         Updating the webprocess with the newly picked time did not update the local store of that data in the
213         UI process, so when the control was activated a second time, and we skipped the round trip to the
214         webprocess to get the data we were certian we already had, we did not start the popover in the 
215         correct state. We now update the webprocess and the local UI stored variable at the same time.
216
217         Test: fast/forms/ios/time-picker-value-change.html
218
219         * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
220         * UIProcess/API/ios/WKWebViewTestingIOS.mm:
221         (-[WKWebView timePickerValueHour]):
222         (-[WKWebView timePickerValueMinute]):
223         * UIProcess/ios/WKContentViewInteraction.h:
224         * UIProcess/ios/WKContentViewInteraction.mm:
225         (-[WKContentView updateValueAsNumberForViewController:]):
226         (-[WKContentView updateValueForViewController:]):
227         (-[WKContentView setTimePickerValueToHour:minute:]):
228         (-[WKContentView timePickerValueHour]):
229         (-[WKContentView timePickerValueMinute]):
230         * UIProcess/ios/forms/WKFormInputControl.h:
231         * UIProcess/ios/forms/WKFormInputControl.mm:
232         (-[WKDateTimePicker hour]):
233         (-[WKDateTimePicker minute]):
234         (-[WKDateTimePicker _dateChangedSetAsNumber]):
235         (-[WKDateTimePicker _dateChangedSetAsString]):
236         (-[WKDateTimePicker setHour:minute:]):
237         (-[WKFormInputControl setTimePickerHour:minute:]):
238         (-[WKFormInputControl timePickerValueHour]):
239         (-[WKFormInputControl timePickerValueMinute]):
240         (-[WKDateTimePopover setHour:minute:]):
241         (-[WKDateTimePopover hour]):
242         (-[WKDateTimePopover minute]):
243
244 2020-04-20  Timothy Horton  <timothy_horton@apple.com>
245
246         Try to fix the macCatalyst build after r260366
247
248         * UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h:
249
250 2020-04-20  Stephan Szabo  <stephan.szabo@sony.com>
251
252         Fix build when !ENABLE(RESOURCE_LOAD_STATISTICS)
253         https://bugs.webkit.org/show_bug.cgi?id=210757
254
255         Reviewed by Ross Kirsling.
256
257         Build fix, no new tests
258
259         * NetworkProcess/NetworkDataTask.cpp:
260         Add ENABLE(RESOURCE_LOAD_STATISTICS) around block
261         using NetworkSession functions only declared when
262         that is enabled.
263
264 2020-04-20  Alex Christensen  <achristensen@webkit.org>
265
266         When SpeculativeLoadManager is destroyed, properly clean up its PendingFrameLoads
267         https://bugs.webkit.org/show_bug.cgi?id=210759
268         <rdar://problem/62056856>
269
270         Reviewed by Darin Adler.
271
272         Recent work on the resourceLoadStatistics layout tests increased the amount we swap out the WebsiteDataStore.
273         When this happens, the NetworkSession is eventually destroyed in the NetworkProcess, sometimes when running the next test.
274         An assertion was firing in the PendingFrameLoad destructor because it hadn't been marked as complete when it was destroyed.
275         Rather than remove the assertion, when we destroy the SpeculativeLoadManager (which only happens when a WebsiteDataStore
276         is destroyed) during a speculative pending frame load, just mark the pending frame load as complete because it is being cancelled.
277         Marking the pending frame load as complete can tell the SpeculativeLoadManager to mutate m_pendingFrameLoads, which we don't want
278         to do while iterating, so copy the RefPtrs into a Vector first then iterate that to get them all.
279
280         This fixes an assertion that was sometimes hit in http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects-database.html
281         but only after running other tests that had initiated speculative pending frame loads.  This was ostensibly started by r260322 but is quite unrelated.
282
283         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
284         (WebKit::NetworkCache::SpeculativeLoadManager::~SpeculativeLoadManager):
285
286 2020-04-20  Stephan Szabo  <stephan.szabo@sony.com>
287
288         [PlayStation] Fix build after r260277
289         https://bugs.webkit.org/show_bug.cgi?id=210756
290
291         Reviewed by Don Olmstead.
292
293         Build fix, no new tests.
294
295         * PlatformPlayStation.cmake:
296
297 2020-04-20  Chris Dumez  <cdumez@apple.com>
298
299         Sending beacons when Fetch KeepAlive feature is disabled crashes the WebProcess
300         https://bugs.webkit.org/show_bug.cgi?id=210753
301         <rdar://problem/61896221>
302
303         Reviewed by Geoffrey Garen.
304
305         * WebProcess/Network/WebLoaderStrategy.cpp:
306         (WebKit::WebLoaderStrategy::startPingLoad):
307         Make sure NetworkResourceLoadParameters's webPageProxyID / webPageID / webFrameID are properly
308         initialized before sending the IPC or IPC decoding will fail.
309
310 2020-04-20  David Kilzer  <ddkilzer@apple.com>
311
312         [IPC hardening] Use ObjectIdentifier<> for geolocationID
313         <https://webkit.org/b/210680>
314         <rdar://problem/58892340>
315
316         Reviewed by Chris Dumez.
317
318         Replace uses of uint64_t with GeolocationIdentifier.
319
320         * Scripts/webkit/messages.py:
321         * UIProcess/GeolocationIdentifier.h: Add.
322         * UIProcess/GeolocationPermissionRequestManagerProxy.cpp:
323         (WebKit::GeolocationPermissionRequestManagerProxy::createRequest):
324         (WebKit::GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision):
325         * UIProcess/GeolocationPermissionRequestManagerProxy.h:
326         * UIProcess/GeolocationPermissionRequestProxy.cpp:
327         (WebKit::GeolocationPermissionRequestProxy::GeolocationPermissionRequestProxy):
328         * UIProcess/GeolocationPermissionRequestProxy.h:
329         (WebKit::GeolocationPermissionRequestProxy::create):
330         * UIProcess/WebPageProxy.cpp:
331         * UIProcess/WebPageProxy.h:
332         * UIProcess/WebPageProxy.messages.in:
333         * WebKit.xcodeproj/project.pbxproj:
334         * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
335         (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
336         (WebKit::GeolocationPermissionRequestManager::cancelRequestForGeolocation):
337         (WebKit::GeolocationPermissionRequestManager::didReceiveGeolocationPermissionDecision):
338         (WebKit::generateGeolocationID): Delete.
339         - Replace with GeolocationIdentifier::generate().
340         * WebProcess/Geolocation/GeolocationPermissionRequestManager.h:
341         * WebProcess/WebPage/WebPage.cpp:
342         (WebKit::WebPage::didReceiveGeolocationPermissionDecision):
343         * WebProcess/WebPage/WebPage.h:
344         * WebProcess/WebPage/WebPage.messages.in:
345
346 2020-04-20  Chris Dumez  <cdumez@apple.com>
347
348         [iOS] Refactor WebKit media playback process assertion logic to minimize chances of leaking them
349         https://bugs.webkit.org/show_bug.cgi?id=210670
350
351         Reviewed by Geoffrey Garen.
352
353         Refactor WebKit media playback process assertion logic to minimize chances of leaking them. In particular,
354         the following changes were made:
355         1. Instead of the WebProcessPool having a HashMap of media playback process assertions for
356            the WebProcess, we now store the assertion on the WebProcessProxy object itself. This is
357            less likely to get out of sync and leak.
358         2. Add a RefCounter to the WebProcessPool to count WebProcesses that have audible media.
359            Whenever a WebProcess starts or stops playing audible media, it merely grabs a RefCounter
360            token or releases it. The WebProcessPool relies on this counter to decide whether or not
361            to take a media playback assertion on behalf of the UIProcess. Since this is token-based
362            and the token is stored on the WebProcessProxy object, it makes it less likely to leak
363            the assertion.
364         3. The WebProcessProxy object now has a AudibleMediaActivity data structure wrapping both
365            its media playback assertion and its WebProcessWithAudibleMediaToken that it got from
366            the WebProcessPool. When the WebProcess shuts down (normally or due to crash/termination),
367            we make sure to clear this data structure.
368         4. Make sure that the WebProcessProxy updates its AudibleMediaActivity whenever a page is
369            removed from the WebProcess.
370
371         * UIProcess/WebPageProxy.cpp:
372         * UIProcess/WebProcessPool.cpp:
373         (WebKit::m_webProcessWithAudibleMediaCounter):
374         (WebKit::WebProcessPool::disconnectProcess):
375         (WebKit::WebProcessPool::webProcessWithAudibleMediaToken const):
376         (WebKit::WebProcessPool::updateAudibleMediaAssertions):
377         * UIProcess/WebProcessPool.h:
378         * UIProcess/WebProcessProxy.cpp:
379         (WebKit::WebProcessProxy::shutDown):
380         (WebKit::WebProcessProxy::removeWebPage):
381         (WebKit::WebProcessProxy::updateAudibleMediaAssertions):
382         * UIProcess/WebProcessProxy.h:
383
384 2020-04-20  Kate Cheney  <katherine_cheney@apple.com>
385
386         <rdar://problem/62059046>
387
388         Unreviewed macCatalyst build fix.
389
390         * NetworkProcess/NetworkProcess.messages.in:
391
392 2020-04-20  Darin Adler  <darin@apple.com>
393
394         Use #import instead of #include in Objective-C and don't use #pragma once
395         https://bugs.webkit.org/show_bug.cgi?id=210724
396
397         Reviewed by David Kilzer.
398
399         * mac/MigrateHeadersFromWebKitLegacy.make: Delete stale MemoryMeasure.h
400         forwarding header from incremental WebKit builds and ignore when generating
401         new forwarding headers.
402
403         * Platform/foundation/LoggingFoundation.mm:
404         (WebKit::logLevelString): Use string directly instead of a named constant.
405
406         * UIProcess/mac/WebColorPickerMac.h: Mark class final.
407
408         * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
409         * NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm:
410         * NetworkProcess/cache/NetworkCacheDataCocoa.mm:
411         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
412         * NetworkProcess/cocoa/NetworkActivityTrackerCocoa.mm:
413         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
414         * NetworkProcess/webrtc/NetworkRTCProvider.mm:
415         * Platform/spi/Cocoa/DeviceManagementSPI.h:
416         * Platform/spi/Cocoa/LocalAuthenticationSPI.h:
417         * Platform/spi/Cocoa/NearFieldSPI.h:
418         * Platform/spi/Cocoa/SafeBrowsingSPI.h:
419         * Platform/spi/mac/AppKitSPI.h:
420         * Shared/API/Cocoa/RemoteObjectInvocation.mm:
421         * Shared/API/Cocoa/WKMain.mm:
422         * Shared/APIWebArchive.mm:
423         * Shared/APIWebArchiveResource.mm:
424         * Shared/Authentication/cocoa/AuthenticationChallengeDispositionCocoa.mm:
425         * Shared/Cocoa/LoadParametersCocoa.mm:
426         * Shared/Cocoa/SandboxInitialiationParametersCocoa.mm:
427         * Shared/Cocoa/WKNSData.mm:
428         * Shared/DocumentEditingContext.mm:
429         * Shared/Plugins/mac/PluginSandboxProfile.mm:
430         * Shared/RemoteLayerTree/WKAnimationDelegate.h:
431         * Shared/UserInterfaceIdiom.mm:
432         * Shared/ios/WebIconUtilities.mm:
433         * Shared/mac/CodeSigning.mm:
434         * Shared/mac/ColorSpaceData.mm:
435         * Shared/mac/HangDetectionDisablerMac.mm:
436         * Shared/mac/PDFKitImports.mm:
437         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
438         * UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm:
439         * UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm:
440         * UIProcess/API/Cocoa/WKContentRuleList.mm:
441         * UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm:
442         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
443         * UIProcess/API/Cocoa/WKPreviewActionItemIdentifiers.mm:
444         * UIProcess/API/Cocoa/WKWebViewInternal.h:
445         * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h:
446         * UIProcess/API/Cocoa/_WKApplicationManifest.h:
447         * UIProcess/API/Cocoa/_WKAttachment.h:
448         * UIProcess/API/Cocoa/_WKResourceLoadInfoInternal.h:
449         * UIProcess/API/Cocoa/_WKResourceLoadStatisticsFirstPartyInternal.h:
450         * UIProcess/API/Cocoa/_WKResourceLoadStatisticsThirdPartyInternal.h:
451         * UIProcess/API/Cocoa/_WKTextManipulationExclusionRule.mm:
452         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
453         * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponseInternal.h:
454         * UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h:
455         * UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h:
456         * UIProcess/Authentication/mac/WebCredentialMac.mm:
457         * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
458         * UIProcess/Cocoa/IconLoadingDelegate.mm:
459         * UIProcess/Cocoa/MediaUtilities.mm:
460         * UIProcess/Cocoa/PreferenceObserver.h:
461         * UIProcess/Cocoa/PreferenceObserver.mm:
462         * UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm:
463         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.h:
464         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
465         * UIProcess/Cocoa/SOAuthorization/WKSOAuthorizationDelegate.h:
466         * UIProcess/Cocoa/WKEditCommand.h:
467         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.h:
468         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
469         * UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm:
470         * UIProcess/Inspector/mac/WKInspectorViewController.h:
471         * UIProcess/Inspector/mac/WKInspectorWKWebView.h:
472         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
473         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
474         * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm:
475         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm:
476         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
477         * UIProcess/WebAuthentication/Cocoa/WKNFReaderSessionDelegate.h:
478         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
479         * UIProcess/ios/WKDeferringGestureRecognizer.h:
480         * UIProcess/ios/WKHighlightLongPressGestureRecognizer.h:
481         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.h:
482         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
483         * UIProcess/ios/forms/WKDatePickerViewController.h:
484         * UIProcess/ios/forms/WKDatePickerViewController.mm:
485         * UIProcess/ios/forms/WKFocusedFormControlView.h:
486         * UIProcess/ios/forms/WKFocusedFormControlView.mm:
487         * UIProcess/ios/forms/WKFormColorPicker.mm:
488         * UIProcess/ios/forms/WKNumberPadViewController.h:
489         * UIProcess/ios/forms/WKNumberPadViewController.mm:
490         * UIProcess/ios/forms/WKQuickboardListViewController.h:
491         * UIProcess/ios/forms/WKQuickboardListViewController.mm:
492         * UIProcess/ios/forms/WKSelectMenuListViewController.h:
493         * UIProcess/ios/forms/WKTimePickerViewController.h:
494         * UIProcess/ios/forms/WKTimePickerViewController.mm:
495         * UIProcess/ios/fullscreen/WKFullScreenViewController.h:
496         * UIProcess/ios/fullscreen/WKFullscreenStackView.h:
497         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
498         * UIProcess/mac/PageClientImplMac.mm:
499         * UIProcess/mac/WKSharingServicePickerDelegate.h:
500         * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm:
501         * WebProcess/GPU/media/cocoa/VideoLayerRemoteCocoa.h:
502         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageBannerMac.mm:
503         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
504         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
505         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
506         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
507         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.cpp:
508         * WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.h:
509         * WebProcess/WebPage/mac/PageBannerMac.mm:
510         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h:
511         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.h:
512         * WebProcess/cocoa/WebProcessCocoa.mm:
513         More #import, less #pragma once.
514
515 2020-04-20  Pablo Saavedra  <psaavedra@igalia.com>
516
517         [GTK][WPE] lowWatermarkPages() in MemoryPressureMonitor.cpp only searches the "low" value inside the first "Node" section
518         https://bugs.webkit.org/show_bug.cgi?id=210345
519
520         Reviewed by Adrian Perez de Castro.
521
522         * UIProcess/linux/MemoryPressureMonitor.cpp:
523         (WebKit::lowWatermarkPages):
524
525 2020-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
526
527         [GTK][WPE] Enable resource load statistics
528         https://bugs.webkit.org/show_bug.cgi?id=210184
529
530         Reviewed by Žan Doberšek.
531
532         * NetworkProcess/NetworkDataTask.cpp:
533         (WebKit::NetworkDataTask::create): Pass page and frame identifiers to the constructor.
534         (WebKit::NetworkDataTask::isThirdPartyRequest const): Moved from NetworkDataTaskCocoa.mm.
535         (WebKit::NetworkDataTask::restrictRequestReferrerToOriginIfNeeded): Ditto.
536         * NetworkProcess/NetworkDataTask.h:
537         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
538         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
539         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
540         (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): Initialize m_frameID and m_pageID.
541         (WebKit::NetworkDataTaskSoup::createRequest): Add WasBlockingCookies parameter. Call
542         restrictRequestReferrerToOriginIfNeeded() and disable cookies in the soup message if cookies should be blocked.
543         (WebKit::NetworkDataTaskSoup::clearRequest): Reset m_isBlockingCookies.
544         (WebKit::NetworkDataTaskSoup::continueHTTPRedirection): Pass WasBlockingCookies to createRequest().
545         * NetworkProcess/soup/NetworkDataTaskSoup.h:
546         * UIProcess/API/C/WKPage.cpp:
547         (WKPageLoadedThirdPartyDomains): Added for tests.
548         (WKPageClearLoadedThirdPartyDomains): Ditto.
549         * UIProcess/API/C/WKPagePrivate.h:
550         * UIProcess/glib/WebsiteDataStoreGLib.cpp:
551         (WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): Use lowercase for consistency with other
552         default directories.
553
554 2020-04-20  David Kilzer  <ddkilzer@apple.com>
555
556         REGRESSION (r259610): Leak of RBSAssertionInvalidationCallbackType due to missing -dealloc
557         <https://webkit.org/b/210711>
558         <rdar://problem/61993361>
559
560         Reviewed by Geoffrey Garen.
561
562         * UIProcess/ios/ProcessAssertionIOS.mm:
563         (-[WKRBSAssertionDelegate dealloc]): Add.
564         - Release _invalidationCallback to fix the leak.
565
566 2020-04-19  Brady Eidson  <beidson@apple.com>
567
568         Add WKScriptMessageHandler API that asynchronously responds with a promise.
569         rdar://problem/57243492 and https://bugs.webkit.org/show_bug.cgi?id=206398
570
571         Reviewed by Andy Estes.
572         
573         Change webkit.messageHandlers.<name>.postMessage() to return a promise instead of undefined.
574         
575         Allow for that promise to be resolved by an asynchronous reply block up in the API client.
576         This is like the spiritual opposite version of [WKWebView callAsyncFunction:...]
577         
578         And while we're adding a new script message handler variant, we're adding it sandboxed by WKContentWorld.
579
580         * Shared/API/APISerializedScriptValue.h:
581         * UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm:
582         (API::validateObject):
583         (API::coreValueFromNSObject):
584         (API::SerializedScriptValue::createFromNSObject):
585         (API::SerializedScriptValue::wireBytesFromNSObject): Deleted.
586
587         * UIProcess/API/Cocoa/WKScriptMessage.h: Now that script message handlers can be per-world, messages
588           declare which world they were posted from.
589         * UIProcess/API/Cocoa/WKScriptMessage.mm:
590         (-[WKScriptMessage _initWithBody:webView:frameInfo:name:world:]):
591         (-[WKScriptMessage world]):
592         (-[WKScriptMessage _initWithBody:webView:frameInfo:name:]): Deleted.
593         * UIProcess/API/Cocoa/WKScriptMessageInternal.h:
594
595         * UIProcess/API/Cocoa/WKScriptMessageHandlerWithReply.h: Added.
596           Declare the new protocol for a script message handler that can reply to messages asynchronously.
597
598         * UIProcess/API/Cocoa/WKUserContentController.h:
599         * UIProcess/API/Cocoa/WKUserContentController.mm:
600         (-[WKUserContentController _addScriptMessageHandler:]):
601         (-[WKUserContentController addScriptMessageHandler:name:]):
602         (-[WKUserContentController addScriptMessageHandler:contentWorld:name:]):
603         (-[WKUserContentController addScriptMessageHandlerWithReply:contentWorld:name:]):
604         (-[WKUserContentController removeScriptMessageHandlerForName:contentWorld:]):
605         (-[WKUserContentController removeAllScriptMessageHandlersFromContentWorld:]):
606         (-[WKUserContentController removeAllScriptMessageHandlers]):
607         * UIProcess/API/Cocoa/WKUserContentControllerInternal.h:
608         * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
609         
610         * UIProcess/API/Cocoa/WKWebView.mm:
611         (-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]):
612         Update for new shared API::SerializedScriptValue initialization.
613         
614         * UIProcess/API/glib/WebKitUserContentManager.cpp:
615         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
616         * UIProcess/Inspector/socket/RemoteInspectorProtocolHandler.cpp:
617         
618         * UIProcess/UserContent/WebScriptMessageHandler.h:
619         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
620         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
621         (WebKit::WebUserContentControllerProxy::didPostMessage):
622         * UIProcess/UserContent/WebUserContentControllerProxy.h:
623         * UIProcess/UserContent/WebUserContentControllerProxy.messages.in:
624         
625         * WebKit.xcodeproj/project.pbxproj:
626         
627         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
628         (webkit_dom_dom_window_webkit_message_handlers_post_message):
629         
630         * WebProcess/UserContent/WebUserContentController.cpp:
631         (WebKit::WebUserContentController::removeAllUserScriptMessageHandlers):
632         (WebKit::WebUserContentController::removeAllUserScriptMessageHandlersForWorlds):
633         * WebProcess/UserContent/WebUserContentController.h:
634         * WebProcess/UserContent/WebUserContentController.messages.in:
635
636 2020-04-19  David Kilzer  <ddkilzer@apple.com>
637
638         REGRESSION (r244091): Leak of TaskStateChangedCallbackType due to missing -dealloc
639         <https://webkit.org/b/210710>
640         <rdar://problem/61992856>
641
642         Reviewed by Darin Adler.
643
644         * Shared/Cocoa/ProcessTaskStateObserver.mm:
645         (-[WKProcessTaskStateObserverDelegate dealloc]): Add.
646         - Release _taskStateChangedCallback to fix the leak.
647
648 2020-04-19  David Kilzer  <ddkilzer@apple.com>
649
650         [IPC hardening] Use MESSAGE_CHECK in WebPageProxy::loadRecentSearches() and WebPageProxy::saveRecentSearches()
651         <https://webkit.org/b/210683>
652         <rdar://problem/59240446>
653
654         Reviewed by Geoffrey Garen.
655
656         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
657         (MESSAGE_CHECK): Add.
658         (MESSAGE_CHECK_COMPLETION): Add.
659         (WebKit::WebPageProxy::saveRecentSearches):
660         (WebKit::WebPageProxy::loadRecentSearches):
661         - Replace boolean check of const String& with MESSAGE_CHECK.
662
663 2020-04-18  Darin Adler  <darin@apple.com>
664
665         Update header postprocessing version cutoff to keep Apple internal builds working
666         https://bugs.webkit.org/show_bug.cgi?id=210708
667
668         Reviewed by Brady Eidson.
669
670         * Configurations/WebKit.xcconfig: Update versions to make building with older
671         Apple internal SDKs continue to work.
672
673         * Shared/API/Cocoa/WKFoundation.h:
674         * Shared/API/Cocoa/_WKFrameHandle.h:
675         * Shared/API/Cocoa/_WKRemoteObjectInterface.h:
676         * UIProcess/API/Cocoa/WKContentWorld.h:
677         * UIProcess/API/Cocoa/WKFindConfiguration.h:
678         * UIProcess/API/Cocoa/WKFindResult.h:
679         * UIProcess/API/Cocoa/WKFrameInfoPrivate.h:
680         * UIProcess/API/Cocoa/WKHTTPCookieStorePrivate.h:
681         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
682         * UIProcess/API/Cocoa/WKPDFConfiguration.h:
683         * UIProcess/API/Cocoa/WKPreferences.h:
684         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
685         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
686         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
687         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
688         * UIProcess/API/Cocoa/WKUserScriptPrivate.h:
689         * UIProcess/API/Cocoa/WKWebView.h:
690         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
691         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
692         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
693         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
694         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
695         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
696         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
697         * UIProcess/API/Cocoa/_WKDownload.h:
698         * UIProcess/API/Cocoa/_WKFrameTreeNode.h:
699         * UIProcess/API/Cocoa/_WKInputDelegate.h:
700         * UIProcess/API/Cocoa/_WKInspectorDebuggableInfo.h:
701         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
702         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h:
703         * UIProcess/API/Cocoa/_WKResourceLoadDelegate.h:
704         * UIProcess/API/Cocoa/_WKResourceLoadInfo.h:
705         * UIProcess/API/Cocoa/_WKResourceLoadStatisticsFirstParty.h:
706         * UIProcess/API/Cocoa/_WKResourceLoadStatisticsThirdParty.h:
707         * UIProcess/API/Cocoa/_WKTextManipulationConfiguration.h:
708         * UIProcess/API/Cocoa/_WKTextManipulationExclusionRule.h:
709         * UIProcess/API/Cocoa/_WKTextManipulationItem.h:
710         * UIProcess/API/Cocoa/_WKTextManipulationToken.h:
711         * UIProcess/API/Cocoa/_WKUserContentWorld.h:
712         * UIProcess/API/Cocoa/_WKUserStyleSheet.h:
713         * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.h:
714         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
715         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
716         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
717         Because the way we do post-processing of headers in the legacy Xcode
718         build system won't work once the files have been processed once, touch
719         each file that has WK_MAC_TBA, WK_IOS_TBA, or
720         WK_FRAMEWORK_HEADER_POSTPROCESSING_ENABLED in it. Found something to
721         change in each file. This is likely unnecessary in the new Xcode build
722         system, but I wasn't able to test that locally.
723
724         * WebKit.xcodeproj/project.pbxproj:
725         (postprocess-header-rule): Added dependencies so that post-processing will be
726         redone if Configurations/WebKit.xcconfig is touched, since that is where
727         WK_FRAMEWORK_HEADER_POSTPROCESSING_DISABLED is set, or if
728         Scripts/postprocess-header-rule is touched, since that is where the
729         post-processing code is. If either of those files changes it could affect the
730         output of post-processing. This should make a change like this work in the
731         new Xcode build system without touching files as is done above.
732
733 2020-04-18  Brady Eidson  <beidson@apple.com>
734
735         Fix WebUserContentControllerProxy vs ContentWorld lifetime
736         https://bugs.webkit.org/show_bug.cgi?id=210700
737
738         Reviewed by Alex Christensen.
739
740         Covered by API test.
741         
742         WebUserContentControllerProxy currently keeps all of its associated API::ContentWorlds alive via RefPtrs.
743         
744         This is despite the fact that all of the associated WebScriptMessageHandlers, UserScripts, and 
745         UserStyleSheets already keep their associated API::ContentWorlds alive.
746
747         It then decideds to tell WebProcesses to forget a content world after all of its clients are removed.
748         
749         Unfortunately, content worlds are used for more than just content controller stuff. They're used for direct
750         JavaScript evaluation as well.
751         
752         So a client could:
753           - Add a script message handler in a content world.
754           - Evaluate JavaScript in that content world, setting up some persistent state.
755           - Remove the script message handler.
756           - Find that their persistent state from the JavaScript evaluation is gone from that world, even though they
757             still retain a usable handle to that world.
758         
759         The only party who has any business managing the lifetime of an API::ContentWorld is the API::ContentWorld itself.
760         
761         Making this change is:
762           1 - Nice cleanup
763           2 - Fixes the above mentioned bug
764         
765         * UIProcess/API/APIContentWorld.cpp:
766         (API::ContentWorld::worldForIdentifier):
767         (API::ContentWorld::ContentWorld):
768         (API::ContentWorld::sharedWorldWithName):
769         (API::ContentWorld::~ContentWorld):
770         (API::ContentWorld::addAssociatedUserContentControllerProxy):
771         (API::ContentWorld::userContentControllerProxyDestroyed):
772         * UIProcess/API/APIContentWorld.h:
773
774         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
775         (WebKit::WebUserContentControllerProxy::parameters const):
776         (WebKit::WebUserContentControllerProxy::addContentWorld):
777         (WebKit::WebUserContentControllerProxy::contentWorldDestroyed):
778         (WebKit::WebUserContentControllerProxy::addUserScript):
779         (WebKit::WebUserContentControllerProxy::removeUserScript):
780         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
781         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
782         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
783         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
784         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
785         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
786         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
787         (WebKit::WebUserContentControllerProxy::addContentWorldUse): Deleted.
788         (WebKit::WebUserContentControllerProxy::shouldSendRemoveContentWorldsMessage): Deleted.
789         (WebKit::WebUserContentControllerProxy::removeContentWorldUses): Deleted.
790         * UIProcess/UserContent/WebUserContentControllerProxy.h:
791
792 2020-04-18  David Kilzer  <ddkilzer@apple.com>
793
794         Attempt #4 to fix tvOS build
795
796         Unreviewed.
797
798         * WebProcess/cocoa/WebProcessCocoa.mm:
799         (WebKit::WebProcess::platformInitializeWebProcess):
800         - Add #if ENABLE(VIDEO_PRESENTATION_MODE)/#endif to protect
801           function defined in WebCore/PictureInPictureSupport.h.
802         - See previous build fixes in r260307, r260308 and r260313.
803
804 2020-04-18  Alex Christensen  <achristensen@webkit.org>
805
806         Fix client certificate authentication when using non-default WKWebsiteDataStores
807         https://bugs.webkit.org/show_bug.cgi?id=210681
808
809         Reviewed by Brady Eidson.
810
811         NetworkProcessProxy was trying to keep a map of WebsiteDataStores, but it wasn't as accurate as the one WebsiteDataStore was maintaining.
812         Use the latter map instead and client certificate authentication works.  Otherwise, the credential isn't serialized correctly.
813         I found this while working on <rdar://problem/60340449> but this was unrelated so I put it in a different change.
814         This may fix <rdar://problem/60910392>.
815
816         * UIProcess/Network/NetworkProcessProxy.cpp:
817         (WebKit::NetworkProcessProxy::websiteDataStoreFromSessionID):
818
819 2020-04-18  Pablo Saavedra  <psaavedra@igalia.com>
820
821         [GTK][WPE] Replace evil strtok() calls with fscanf() in MemoryPressureMonitor.cpp
822         https://bugs.webkit.org/show_bug.cgi?id=210346
823
824         Reviewed by Adrian Perez de Castro.
825
826         * UIProcess/linux/MemoryPressureMonitor.cpp:
827         (WebKit::lowWatermarkPages):
828         (WebKit::getCgroupControllerPath):
829         (WebKit::systemMemoryUsedAsPercentage):
830         (WebKit::CGroupMemoryController::getCgroupFileValue):
831
832 2020-04-18  Rob Buis  <rbuis@igalia.com>
833
834         Reduce parameter list of the FrameLoadRequest constructor
835         https://bugs.webkit.org/show_bug.cgi?id=210668
836
837         Reviewed by Darin Adler.
838
839         Adapt to API change.
840
841         * WebProcess/Inspector/WebInspector.cpp:
842         (WebKit::WebInspector::openInNewTab):
843         * WebProcess/Plugins/PluginView.cpp:
844         (WebKit::PluginView::performFrameLoadURLRequest):
845         (WebKit::PluginView::loadURL):
846         * WebProcess/WebPage/WebPage.cpp:
847         (WebKit::WebPage::loadURLInFrame):
848         (WebKit::WebPage::loadDataInFrame):
849         (WebKit::WebPage::loadRequest):
850         (WebKit::WebPage::loadDataImpl):
851
852 2020-04-18  David Kilzer  <ddkilzer@apple.com>
853
854         [IPC hardening] Use MESSAGE_CHECK in WebPasteboardProxy
855         <https://webkit.org/b/210684>
856         <rdar://problem/59906721>
857
858         Reviewed by Wenson Hsieh.
859
860         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
861         - Add missing #undef of MESSAGE_CHECK_COMPLETION and
862           MESSAGE_CHECK_WITH_RETURN_VALUE.
863         (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType):
864         (WebKit::WebPasteboardProxy::getPasteboardStringForType):
865         (WebKit::WebPasteboardProxy::getPasteboardStringsForType):
866         (WebKit::WebPasteboardProxy::getPasteboardBufferForType):
867         (WebKit::WebPasteboardProxy::setPasteboardStringForType):
868         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
869         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
870         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
871         (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
872         - Replace existing code with MESSAGE_CHECK_COMPLETION macros.
873
874         * UIProcess/WebPasteboardProxy.cpp:
875         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
876         * UIProcess/WebPasteboardProxy.h:
877         * UIProcess/WebPasteboardProxy.messages.in:
878         - Add IPC::Connection to TypesSafeForDOMToReadAndWrite.
879
880 2020-04-17  Kate Cheney  <katherine_cheney@apple.com>
881
882         Enable service workers for app-bound domains
883         https://bugs.webkit.org/show_bug.cgi?id=210451
884         <rdar://problem/61479474>
885
886         Reviewed by Brent Fulgham.
887
888         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
889         (WebKit::NetworkConnectionToWebProcess::createFetchTask):
890         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
891         (WebKit::NetworkConnectionToWebProcess::swConnection):
892         (WebKit::NetworkConnectionToWebProcess::isServiceWorkerAllowed const): Deleted.
893         * NetworkProcess/NetworkConnectionToWebProcess.h:
894         Removed ASSERTS and service worker entitlement checks which are now done along with app-bound
895         domain checks in SWServer.cpp.
896
897         * NetworkProcess/NetworkProcess.cpp:
898         (WebKit::NetworkProcess::initializeNetworkProcess):
899         (WebKit::NetworkProcess::addWebsiteDataStore):
900         Remove the check for parentProcessHasServiceWorkerEntitlement() before
901         adding a serviceWorkerSession. This doesn't do anything except add an
902         entry to a map, and simplifies the case where we need a session for
903         app-bound instances which should have service workers but have no entitlement.
904
905         Pass the entitlement and a new callback to request app-bound domains
906         from the UI Process to the SWServer. This will make sure the server
907         checks for the entitlement or list of app-bound domains before completing a load.
908
909         (WebKit::NetworkProcess::registerSWServerConnection):
910         Remove unnecessary ASSERT for entitlement.
911
912         * NetworkProcess/NetworkProcess.h:
913         * NetworkProcess/NetworkProcess.messages.in:
914         * NetworkProcess/ios/NetworkProcessIOS.mm:
915         (WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const):
916         (WebKit::NetworkProcess::disableServiceWorkerEntitlement):
917         (WebKit::NetworkProcess::clearServiceWorkerEntitlementOverride):
918         In order to test this thoroughly, TestWebKitAPI needed a way to
919         temporarily disable the service worker entitlement. This function
920         overrides the check for the entitlement if the bool is set, disabling
921         the entitlement.
922
923         * Shared/WebPageCreationParameters.cpp:
924         (WebKit::WebPageCreationParameters::encode const):
925         (WebKit::WebPageCreationParameters::decode):
926         * Shared/WebPageCreationParameters.h:
927         WebPage needs to know if it is app-bound when created so it can update
928         the service worker preferences key accordingly.
929
930         * Shared/WebPreferences.yaml:
931         * UIProcess/API/Cocoa/WKPreferences.mm:
932         (-[WKPreferences _serviceWorkerEntitlementDisabledForTesting]):
933         (-[WKPreferences _setServiceWorkerEntitlementDisabledForTesting:]):
934         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
935         Disable entitlement for testing.
936
937         * UIProcess/API/APIPageConfiguration.cpp:
938         (API::PageConfiguration::copy const):
939         * UIProcess/API/APIPageConfiguration.h:
940         (API::PageConfiguration::limitsNavigationsToAppBoundDomains const):
941         (API::PageConfiguration::setLimitsNavigationsToAppBoundDomains):
942         (API::PageConfiguration::limitsNavigationToAppBoundDomains const): Deleted.
943         (API::PageConfiguration::setLimitsNavigationToAppBoundDomains): Deleted.
944         (-[WKWebViewConfiguration limitsNavigationsToAppBoundDomains]):
945         (-[WKWebViewConfiguration setLimitsNavigationsToAppBoundDomains:]):
946         (-[WKWebViewConfiguration limitsNavigationToAppBoundDomains]): Deleted.
947         (-[WKWebViewConfiguration setLimitsNavigationToAppBoundDomains:]): Deleted.
948         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
949         Inconsistent naming (Navigation vs Navigations).
950
951         * UIProcess/API/Cocoa/WKWebView.mm:
952         (-[WKWebView _setupPageConfiguration:]):
953         Check for entitlement or app-bound webview.
954
955         (-[WKWebView _serviceWorkersEnabled:]):
956         (-[WKWebView _clearServiceWorkerEntitlementOverride:]):
957         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
958         Testing SPIs.
959
960         * UIProcess/Network/NetworkProcessProxy.cpp:
961         (WebKit::NetworkProcessProxy::getAppBoundDomains):
962         * UIProcess/Network/NetworkProcessProxy.h:
963         * UIProcess/Network/NetworkProcessProxy.messages.in:
964         Sends the app-bound domains to the Network Process.
965
966         * UIProcess/WebPageProxy.cpp:
967         (WebKit::m_limitsNavigationsToAppBoundDomains):
968         (WebKit::m_limitsNavigationToAppBoundDomains): Deleted.
969         Naming inconsistency.
970
971         (WebKit::WebPageProxy::disableServiceWorkerEntitlementInNetworkProcess):
972         (WebKit::WebPageProxy::clearServiceWorkerEntitlementOverride):
973         * UIProcess/WebPageProxy.h:
974         Disable entitlement for testing.
975
976         * WebProcess/WebPage/WebPage.cpp:
977         (WebKit::m_isNavigatingToAppBoundDomain):
978         Set this parameter in the constructor so it will be accurate when
979         updating preferences.
980
981         (WebKit::WebPage::updatePreferences):
982         * WebProcess/WebPage/WebPage.h:
983         (WebKit::WebPage::clearServiceWorkerEntitlementOverride):
984         * WebProcess/WebPage/WebPage.messages.in:
985         * WebProcess/WebPage/ios/WebPageIOS.mm:
986         (WebKit::WebPage::parentProcessHasServiceWorkerEntitlement const):
987         (WebKit::WebPage::disableServiceWorkerEntitlement):
988         (WebKit::WebPage::clearServiceWorkerEntitlementOverride):
989         Disable entitlement for testing.
990
991 2020-04-17  Alex Christensen  <achristensen@webkit.org>
992
993         NetworkSessionCocoa should request client certificate only once per host/port
994         https://bugs.webkit.org/show_bug.cgi?id=210626
995         <rdar://problem/60340449>
996
997         Reviewed by Geoffrey Garen.
998
999         NSURLSession creates more than one TCP connection to a server when using HTTP 1.1.
1000         Each TCP connection with TLS generates a didReceiveChallenge to do the server trust evaluation of the certificate chain.
1001         If the server requests a client certificate in the TLS handshake, it also generates a didReceiveChallenge to request client
1002         certificates as well.  This is an implementation detail of our networking.  We should not actually ask the WKNavigationDelegate
1003         for client certificates more than once per host/port.  We should remember the credential and give it to NSURLSession immediately
1004         if we have used this credential in the past for a task that has received bytes (either a response or a redirect).  If the TLS
1005         handshake fails, we should not reuse that same certificate automatically.
1006
1007         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1008         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1009         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
1010         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
1011         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
1012         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
1013         (WebKit::NetworkSessionCocoa::clientCertificateSuggestedForHost):
1014         (WebKit::NetworkSessionCocoa::taskReceivedBytes):
1015         (WebKit::NetworkSessionCocoa::taskFailed):
1016         (WebKit::NetworkSessionCocoa::successfulClientCertificateForHost const):
1017
1018 2020-04-17  David Kilzer  <ddkilzer@apple.com>
1019
1020         Bug 210646: REGRESSION (r260112): createArchiveList() leaks malloc memory on early returns due to an error
1021         <https://webkit.org/b/210646>
1022         <rdar://problem/61928031>
1023
1024         Reviewed by Darin Adler.
1025
1026         * Shared/mac/WebCoreArgumentCodersMac.mm:
1027         (IPC::createArchiveList):
1028         - Move early returns for protocolProperties, protocolProperties
1029           and mimeType above memory allocation to fix the memory leak.
1030
1031 2020-04-17  Brady Eidson  <beidson@apple.com>
1032
1033         Pass sandbox extensions for back/forward list navigations after the policy is decided at process-swap time.
1034         <rdar://problem/59535167> and https://bugs.webkit.org/show_bug.cgi?id=210623
1035
1036         Reviewed by Geoff Garen.
1037
1038         Covered by almost all existing tests, and a new API test.
1039
1040         Instead of granting a sandbox extension when updating the back/forward cursor for a pending 
1041         back/forward list traversal, do so after the client decides the policy.
1042         (Which is also along with a process swap in interesting cases)
1043
1044         * Shared/PolicyDecision.h:
1045         (WebKit::PolicyDecision::encode const):
1046         (WebKit::PolicyDecision::decode):
1047
1048         * Shared/WebPageCreationParameters.h:
1049
1050         * UIProcess/API/APINavigation.cpp:
1051         (API::Navigation::Navigation):
1052         * UIProcess/API/APINavigation.h:
1053         (API::Navigation::create):
1054         (API::Navigation::reloadItem const):
1055
1056         * UIProcess/ProvisionalPageProxy.cpp:
1057         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
1058         * UIProcess/ProvisionalPageProxy.h:
1059
1060         * UIProcess/WebNavigationState.cpp:
1061         (WebKit::WebNavigationState::createReloadNavigation):
1062         * UIProcess/WebNavigationState.h:
1063
1064         * UIProcess/WebPageProxy.cpp:
1065         (WebKit::WebPageProxy::launchProcessForReload):
1066         (WebKit::WebPageProxy::reload):
1067         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1068         (WebKit::WebPageProxy::receivedPolicyDecision):
1069         * UIProcess/WebPageProxy.h:
1070         (WebKit::WebPageProxy::receivedPolicyDecision):
1071         * UIProcess/WebPageProxy.messages.in:
1072
1073         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1074         (WebKit::WebBackForwardListProxy::goToItem):
1075
1076         * WebProcess/WebPage/WebFrame.cpp:
1077         (WebKit::WebFrame::didReceivePolicyDecision):
1078
1079         * WebProcess/WebPage/WebPage.cpp:
1080         (WebKit::WebPage::SandboxExtensionTracker::didStartProvisionalLoad):
1081
1082 2020-04-17  David Kilzer  <ddkilzer@apple.com>
1083
1084         REGRESSION (r234105): [iOS] WKColorButton leaks a UIColor
1085         <https://webkit.org/b/210658>
1086         <rdar://problem/61938137>
1087
1088         Reviewed by Darin Adler.
1089
1090         * UIProcess/ios/forms/WKFormColorPicker.mm:
1091         (-[WKColorButton dealloc]): Add.
1092         - Release _color instance variable to fix leak.
1093
1094 2020-04-17  Per Arne Vollan  <pvollan@apple.com>
1095
1096         [iOS] Deny iokit open access of unused class in the WebContent sandbox
1097         https://bugs.webkit.org/show_bug.cgi?id=210669
1098
1099         Reviewed by Brent Fulgham.
1100
1101         Telemetry shows that iokit open access of an iokit class can be removed from the WebContent sandbox.
1102
1103         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1104
1105 2020-04-17  Chris Dumez  <cdumez@apple.com>
1106
1107         [iOS] Refactor WebKit uploads process assertion logic to minimize chances of leaking them
1108         https://bugs.webkit.org/show_bug.cgi?id=210664
1109         <rdar://problem/61751982>
1110
1111         Reviewed by Geoff Garen.
1112
1113         To minimize chances of leaking "WebKit uploads" process assertion, the following refactoring
1114         was done:
1115         1. WebKit upload assertions are now held by NetworkProcessProxy instead of the WebProcessPool.
1116            This makes more sense since uploads are tied to a particular network process. In base of
1117            a network process crash, we would not want those assertions to persist for example.
1118         2. Store all upload assertions (UIProcess + NetworkProcess + WebProcesses) into a single
1119            UploadActivity data structure that can easily be cleared. Make sure we clear it on network
1120            process crash.
1121         3. No longer on the WebProcess to send IPC whenever its has pending uploads or not. Instead,
1122            have the network process send such IPC. This makes more sense, especially now that all
1123            webkit upload process assertions are now stored on NetworkProcessProxy. It also makes it
1124            so that we deal properly with WebProcess crashes. In case of a WebProcess crash, its
1125            connection to the network process will get closed. NetworkConnectionToWebProcess::didClose()
1126            gets called and causes all NetworkResourceLoader objects for this connection to get
1127            destroyed. As a result, the network process will properly notify the UIProcess that this
1128            process no longer has any upload in progress.
1129
1130         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1131         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
1132         (WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess):
1133         (WebKit::NetworkConnectionToWebProcess::hasUploadStateChanged):
1134         * NetworkProcess/NetworkConnectionToWebProcess.h:
1135         * NetworkProcess/NetworkResourceLoadMap.cpp:
1136         (WebKit::NetworkResourceLoadMap::NetworkResourceLoadMap):
1137         (WebKit::NetworkResourceLoadMap::~NetworkResourceLoadMap):
1138         (WebKit::NetworkResourceLoadMap::add):
1139         (WebKit::NetworkResourceLoadMap::clear):
1140         (WebKit::NetworkResourceLoadMap::take):
1141         (WebKit::NetworkResourceLoadMap::setHasUpload):
1142         * NetworkProcess/NetworkResourceLoadMap.h:
1143         (WebKit::NetworkResourceLoadMap::hasUpload const):
1144         * UIProcess/Network/NetworkProcessProxy.cpp:
1145         (WebKit::NetworkProcessProxy::didClose):
1146         (WebKit::NetworkProcessProxy::setWebProcessHasUploads):
1147         * UIProcess/Network/NetworkProcessProxy.h:
1148         * UIProcess/Network/NetworkProcessProxy.messages.in:
1149         * UIProcess/ProcessAssertion.cpp:
1150         (WebKit::ProcessAssertion::ProcessAssertion):
1151         * UIProcess/ProcessAssertion.h:
1152         (WebKit::ProcessAssertion::pid const):
1153         * UIProcess/WebProcessPool.cpp:
1154         * UIProcess/WebProcessPool.h:
1155         * UIProcess/WebProcessPool.messages.in:
1156         * UIProcess/WebProcessProxy.cpp:
1157         (WebKit::WebProcessProxy::~WebProcessProxy):
1158         * UIProcess/WebProcessProxy.h:
1159         * WebProcess/Network/WebLoaderStrategy.cpp:
1160         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1161         (WebKit::WebLoaderStrategy::remove):
1162         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1163         * WebProcess/Network/WebLoaderStrategy.h:
1164
1165 2020-04-17  Jer Noble  <jer.noble@apple.com>
1166
1167         Bring Fullscreen API + alert() behavior from iOS to macOS
1168         https://bugs.webkit.org/show_bug.cgi?id=210662
1169
1170         Reviewed by Eric Carlson.
1171
1172         When a page is showing an alert(), all non-synchronous messages will be blocked until the sync XPC for alert()
1173         ends. And when exiting fullscreen, we block completing the fullscreen exit animation until a repaint XPC completes.
1174         So a page that is showing an alert() will never fully exit element fullscreen mode.
1175
1176         On iOS, we fixed this behavior by exiting fullscreen mode whenever the page shows an alert() or prompt(). We should
1177         bring this behavior to macOS as well.
1178
1179         * UIProcess/WebPageProxy.cpp:
1180         (WebKit::WebPageProxy::runJavaScriptAlert):
1181         (WebKit::WebPageProxy::runJavaScriptConfirm):
1182         (WebKit::WebPageProxy::runJavaScriptPrompt):
1183
1184 2020-04-17  Don Olmstead  <don.olmstead@sony.com>
1185
1186         [CMake] Add WebKit::WebCore target
1187         https://bugs.webkit.org/show_bug.cgi?id=210445
1188
1189         Reviewed by Michael Catanzaro.
1190
1191         Use the WebKit::WebCore target within the WebKit target.
1192
1193         * CMakeLists.txt:
1194         * PlatformGTK.cmake:
1195         * PlatformWPE.cmake:
1196         * PlatformWin.cmake:
1197
1198 2020-04-17  Simon Fraser  <simon.fraser@apple.com>
1199
1200         Turn async frame and overflow scrolling on by default on macOS
1201         https://bugs.webkit.org/show_bug.cgi?id=210661
1202         rdar://problem/60420037
1203
1204         Reviewed by Tim Horton.
1205
1206         Flip the plist value and the default value for macOS which is outside of the feature flag #ifdef.
1207
1208         Testing keeps async overflow scrolling off by default, so this should not affect testing.
1209
1210         This only impacts WebKit2.
1211
1212         * FeatureFlags/WebKit.plist:
1213         * Shared/WebPreferencesDefaultValues.cpp:
1214         (WebKit::defaultAsyncFrameAndOverflowScrollingEnabled):
1215
1216 2020-04-17  Per Arne Vollan  <pvollan@apple.com>
1217
1218         [iOS] Add telemetry to some mach lookup sandbox extensions
1219         https://bugs.webkit.org/show_bug.cgi?id=210657
1220
1221         Reviewed by Darin Adler.
1222
1223         Add telemetry in order to learn more about how some of the mach lookup extensions are being used in the WebContent process on iOS.
1224
1225         No new tests, since this patch does not change any behavior.
1226
1227         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1228
1229 2020-04-17  Youenn Fablet  <youenn@apple.com>
1230
1231         Validate socket in NetworkRTCProvider::wrapNewTCPConnection
1232         https://bugs.webkit.org/show_bug.cgi?id=210594
1233
1234         Reviewed by Eric Carlson.
1235
1236         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
1237         (WebKit::NetworkRTCProvider::wrapNewTCPConnection):
1238         Add a null check in case the identifier does not relate to an existing pending socket.
1239
1240 2020-04-17  Peng Liu  <peng.liu6@apple.com>
1241
1242         Cleanup the macros for video fullscreen and picture-in-picture
1243         https://bugs.webkit.org/show_bug.cgi?id=210638
1244
1245         Reviewed by Eric Carlson.
1246
1247         Replace some "#if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))"
1248         and all "#if (PLATFORM(IOS_FAMILY) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))"
1249         with "#if ENABLE(VIDEO_PRESENTATION_MODE)".
1250
1251         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
1252         (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenGravity):
1253         (WebKit::RemoteMediaPlayerProxy::updateVideoFullscreenInlineImage):
1254         (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenMode):
1255         (WebKit::RemoteMediaPlayerProxy::videoFullscreenStandbyChanged):
1256         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
1257         * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in:
1258         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1259         * UIProcess/WebPageProxy.cpp:
1260         (WebKit::WebPageProxy::didAttachToRunningProcess):
1261         (WebKit::WebPageProxy::viewDidLeaveWindow):
1262         (WebKit::WebPageProxy::exitFullscreenImmediately):
1263         * UIProcess/WebPageProxy.h:
1264         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
1265         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
1266         * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm:
1267         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1268         * WebProcess/WebCoreSupport/WebChromeClient.h:
1269         * WebProcess/WebPage/WebPage.cpp:
1270         (WebKit::WebPage::~WebPage):
1271         * WebProcess/WebPage/WebPage.h:
1272         * WebProcess/cocoa/VideoFullscreenManager.h:
1273         * WebProcess/cocoa/VideoFullscreenManager.messages.in:
1274         * WebProcess/cocoa/VideoFullscreenManager.mm:
1275
1276 2020-04-17  Claudio Saavedra  <csaavedra@igalia.com>
1277
1278         [GTK] Update for GdkKeymap API changes
1279         https://bugs.webkit.org/show_bug.cgi?id=210642
1280
1281         Reviewed by Adrian Perez de Castro.
1282
1283         No new tests needed.
1284
1285         gdk_keymap_get_default() is deprecated in GTK+ 3.22, so use
1286         gdk_keymap_get_for_display() instead. Since in GTK4 this method is
1287         removed to gdk_display_get_keymap(), add a helper to
1288         GtkVersioning.h to avoid cluttering with ifdefs all over the
1289         place.
1290
1291         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
1292         (WebKit::doKeyStrokeEvent):
1293
1294 2020-04-17  Antoine Quint  <graouts@apple.com>
1295
1296         Allow the UserStyleLevel to be set through _WKUserStyleSheet
1297         https://bugs.webkit.org/show_bug.cgi?id=210653
1298         <rdar://problem/60506645>
1299
1300         Reviewed by Tim Horton.
1301
1302         Add a new _WKUserStyleLevel enum such that we may provide the specificity level of the backing UserStyleSheet, represented by the UserStyleLevel enum in WebCore.
1303
1304         * UIProcess/API/Cocoa/_WKUserStyleSheet.h:
1305         * UIProcess/API/Cocoa/_WKUserStyleSheet.mm:
1306         (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:level:userContentWorld:]):
1307         (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:level:userContentWorld:]):
1308         (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:userContentWorld:]): Deleted.
1309         * UIProcess/API/Cocoa/_WKUserStyleSheetInternal.h:
1310         (API::toWebCoreUserStyleLevel):
1311
1312 2020-04-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1313
1314         [GTK][X11] REGRESSION(r259944): Wrong position of select popup menu in X11
1315         https://bugs.webkit.org/show_bug.cgi?id=210603
1316
1317         Reviewed by Michael Catanzaro.
1318
1319         gdk_window_move_to_rect expects the given rectangle in coordinates relative to the top-left corner of the window
1320         that the popup window is transient for. We were using screen coordinates.
1321
1322         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
1323         (WebKit::WebPopupMenuProxyGtk::showPopupMenu): Translate widget coordinates to window coordinates before passing
1324         the rectangle to gdk_window_move_to_rect().
1325
1326 2020-04-17  David Kilzer  <ddkilzer@apple.com>
1327
1328         REGRESSION (r256756): -[WKUserDefaults initWithSuiteName:]: Instance variable used while 'self' is not set to the result of '[(super or self) init...]'
1329         <https://webkit.org/b/210647>
1330         <rdar://problem/61928289>
1331
1332         Reviewed by Anders Carlsson.
1333
1334         * UIProcess/Cocoa/PreferenceObserver.mm:
1335         (-[WKUserDefaults initWithSuiteName:]):
1336         - Call `[self initWithSuite:]` and set `self` to fix the clang
1337           static analyzer warning.
1338         - Fix camelCase of `suitename` parameter.
1339
1340 2020-04-17  Per Arne Vollan  <pvollan@apple.com>
1341
1342         [iOS] Deny iokit open access to graphics related classes
1343         https://bugs.webkit.org/show_bug.cgi?id=210616
1344
1345         Reviewed by Darin Adler.
1346
1347         Deny iokit open access to graphics related classes in the WebContent process on iOS, but issue
1348         extensions for these for some devices which still need access to them.
1349
1350         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1351         * Shared/Cocoa/SandboxExtensionCocoa.mm:
1352         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
1353         (WebKit::SandboxExtension::createHandleForIOKitClassExtension):
1354         * Shared/SandboxExtension.h:
1355         * Shared/WebProcessCreationParameters.cpp:
1356         (WebKit::WebProcessCreationParameters::encode const):
1357         (WebKit::WebProcessCreationParameters::decode):
1358         * Shared/WebProcessCreationParameters.h:
1359         * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
1360         * UIProcess/API/ios/WKWebViewTestingIOS.mm:
1361         (-[WKWebView _setDeviceHasAGXCompilerServiceForTesting]):
1362         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1363         (WebKit::WebProcessPool::platformInitializeWebProcess):
1364         (WebKit::deviceHasAGXCompilerService): Deleted.
1365         * UIProcess/WebPageProxy.h:
1366         * UIProcess/ios/WebPageProxyIOS.mm:
1367         (WebKit::WebPageProxy::setDeviceHasAGXCompilerServiceForTesting const):
1368         * WebProcess/cocoa/WebProcessCocoa.mm:
1369         (WebKit::WebProcess::platformInitializeWebProcess):
1370
1371 2020-04-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1372
1373         [GTK] UI process crash when entering compositing mode when WPE_RENDERER is enabled
1374         https://bugs.webkit.org/show_bug.cgi?id=209118
1375
1376         Reviewed by Michael Catanzaro.
1377
1378         Check if EGL_WL_bind_wayland_display extension is available when using WPE_RENDERER, since we don't suport the
1379         SHM interface.
1380
1381         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
1382         (WebKit::AcceleratedBackingStoreWayland::checkRequirements): Return false if EGL_WL_bind_wayland_display is not present.
1383
1384 2020-04-17  Rob Buis  <rbuis@igalia.com>
1385
1386         Move allowPlugins to FrameLoader
1387         https://bugs.webkit.org/show_bug.cgi?id=205876
1388
1389         Reviewed by Darin Adler.
1390
1391         Adapt to API change.
1392
1393         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
1394         (WebKit::WebPluginInfoProvider::pluginInfo):
1395         (WebKit::WebPluginInfoProvider::populatePluginCache):
1396         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1397         (WebKit::WebFrameLoaderClient::objectContentType):
1398         * WebProcess/WebPage/WebPage.cpp:
1399         (WebKit::WebPage::createPlugin):
1400         (WebKit::WebPage::canPluginHandleResponse):
1401         (WebKit::WebPage::canShowMIMEType const):
1402
1403 2020-04-16  Peng Liu  <peng.liu6@apple.com>
1404
1405         Cleanup the usage of ENABLE_FULLSCREEN_API
1406         https://bugs.webkit.org/show_bug.cgi?id=210630
1407
1408         Reviewed by Daniel Bates.
1409
1410         Replace "#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API" with
1411         "#if ENABLE(FULLSCREEN_API)".
1412
1413         No new tests, no functional change
1414
1415         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1416         (WKBundlePageSetFullScreenClient):
1417         (WKBundlePageWillEnterFullScreen):
1418         (WKBundlePageDidEnterFullScreen):
1419         (WKBundlePageWillExitFullScreen):
1420         (WKBundlePageDidExitFullScreen):
1421
1422 2020-04-16  Kate Cheney  <katherine_cheney@apple.com>
1423
1424         Distinguish between an empty WKAppBoundDomains array and a missing entry
1425         https://bugs.webkit.org/show_bug.cgi?id=210628
1426         <rdar://problem/61909669>
1427
1428         Reviewed by Brent Fulgham.
1429
1430         Currently we treat a missing WKAppBoundDomains key the same as an empty
1431         key, which is incorrect. Having the key present, even with no entries,
1432         should opt an app into app-bound domain behavior.
1433
1434         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1435         (WebKit::WebsiteDataStore::initializeAppBoundDomains):
1436         (WebKit::WebsiteDataStore::beginAppBoundDomainCheck):
1437
1438 2020-04-16  Brent Fulgham  <bfulgham@apple.com>
1439
1440         Add a new 'limitNavigationsToAppBoundDomains' property to WKWebViewConfiguration 
1441         https://bugs.webkit.org/show_bug.cgi?id=210620
1442         <rdar://problem/61903225>
1443
1444         Reviewed by Andy Estes.
1445
1446         Follow-up fix. The property exposed by WKWebViewConfiguration should not
1447         use a local BOOL; it simply exposes the APIPageConfiguration value.
1448
1449         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1450         (-[WKWebViewConfiguration init]):
1451         (-[WKWebViewConfiguration copyWithZone:]):
1452         (-[WKWebViewConfiguration limitsNavigationToAppBoundDomains]):
1453         (-[WKWebViewConfiguration setLimitsNavigationToAppBoundDomains:]):
1454         (-[WKWebViewConfiguration _setIgnoresAppBoundDomains:]):
1455
1456 2020-04-16  Brent Fulgham  <bfulgham@apple.com>
1457
1458         Switch NetworkProcess and NetworkProcessProxy messages to use CallbackID class
1459         https://bugs.webkit.org/show_bug.cgi?id=210566
1460         <rdar://problem/61791784>
1461
1462         Reviewed by David Kilzer.
1463
1464         Instead of using the raw uint64_t type to represent callbacks, use the purpose
1465         built WebKit::CallbackID type.
1466
1467         Tested by existing cases.
1468
1469         * NetworkProcess/NetworkProcess.cpp:
1470         (WebKit::NetworkProcess::fetchWebsiteData):
1471         (WebKit::NetworkProcess::deleteWebsiteData):
1472         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1473         * NetworkProcess/NetworkProcess.h:
1474         * NetworkProcess/NetworkProcess.messages.in:
1475         * UIProcess/Network/NetworkProcessProxy.cpp:
1476         (WebKit::NetworkProcessProxy::fetchWebsiteData):
1477         (WebKit::NetworkProcessProxy::deleteWebsiteData):
1478         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
1479         (WebKit::NetworkProcessProxy::didFetchWebsiteData):
1480         (WebKit::NetworkProcessProxy::didDeleteWebsiteData):
1481         (WebKit::NetworkProcessProxy::didDeleteWebsiteDataForOrigins):
1482         * UIProcess/Network/NetworkProcessProxy.h:
1483         * UIProcess/Network/NetworkProcessProxy.messages.in:
1484
1485 2020-04-16  Timothy Horton  <timothy_horton@apple.com>
1486
1487         Try to fix the macCatalyst build
1488
1489         * UIProcess/ios/WKActionSheetAssistant.h:
1490         * UIProcess/ios/WKContentViewInteraction.h:
1491         * UIProcess/ios/WKContentViewInteraction.mm:
1492         (uiImageForImage):
1493         (createTargetedPreview):
1494         (createFallbackTargetedPreview):
1495         (-[WKContentView _createTargetedContextMenuHintPreviewIfPossible]):
1496
1497 2020-04-16  David Kilzer  <ddkilzer@apple.com>
1498
1499         Re-land: [IPC Hardening] MachMessage::create() should use checked arithmetic
1500         <https://webkit.org/b/210572>
1501         <rdar://problem/61729947>
1502
1503         Reviewed by Chris Dumez.
1504
1505         * Platform/IPC/cocoa/ConnectionCocoa.mm:
1506         (IPC::Connection::sendOutgoingMessage):
1507         - Add nullptr check since MachMessage::create() can return an
1508           empty std::unique_ptr<> now.
1509         * Platform/IPC/cocoa/MachMessage.cpp:
1510         (IPC::MachMessage::create):
1511         - Use CheckedSize to compute the buffer size.
1512
1513 2020-04-16  Brent Fulgham  <bfulgham@apple.com>
1514
1515         Add a new 'limitNavigationsToAppBoundDomains' property to WKWebViewConfiguration 
1516         https://bugs.webkit.org/show_bug.cgi?id=210620
1517         <rdar://problem/61903225>
1518
1519         Reviewed by Andy Estes.
1520
1521         Provide a way for Developers to opt-in to AppBound domains through a new WKWebViewConfiguration
1522         property.
1523
1524         This patch only creates the property and exposes the flag to the APIPageConfiguration and
1525         WebPageProxy. A separate patch will take action based on its value.
1526
1527         * UIProcess/API/APIPageConfiguration.cpp:
1528         (API::PageConfiguration::copy const):
1529         * UIProcess/API/APIPageConfiguration.h:
1530         (API::PageConfiguration::limitsNavigationToAppBoundDomains const):
1531         (API::PageConfiguration::setLimitsNavigationToAppBoundDomains):
1532         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
1533         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1534         (-[WKWebViewConfiguration init]):
1535         (-[WKWebViewConfiguration copyWithZone:]):
1536         (-[WKWebViewConfiguration limitsNavigationToAppBoundDomains]):
1537         (-[WKWebViewConfiguration setLimitsNavigationToAppBoundDomains:]):
1538         (-[WKWebViewConfiguration _setIgnoresAppBoundDomains:]): Keep the new property in
1539         sync with this internal flag.
1540         * UIProcess/WebPageProxy.cpp:
1541         (WebKit::m_limitsNavigationToAppBoundDomains):
1542         * UIProcess/WebPageProxy.h:
1543
1544 2020-04-16  Sergio Villar Senin  <svillar@igalia.com>
1545
1546         Unreviewed build fix for non unified builds.
1547
1548         * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: Added missing include.
1549
1550 2020-04-16  Daniel Bates  <dabates@apple.com>
1551
1552         Remove unused -_focusTextInputContext
1553         https://bugs.webkit.org/show_bug.cgi?id=210619
1554
1555         Reviewed by Darin Adler.
1556
1557         While this function was in the "SPI" header, there is no software at Apple that was using
1558         this funciton and I will assume no non-Apple software was using it either.
1559
1560         * UIProcess/API/Cocoa/WKWebView.mm:
1561         (-[WKWebView _focusTextInputContext:completionHandler:]): Deleted.
1562         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1563         * UIProcess/WebPageProxy.cpp:
1564         * UIProcess/WebPageProxy.h:
1565
1566 2020-04-16  Brent Fulgham  <bfulgham@apple.com>
1567
1568         [macOS] Switch unused IOKit classes from allow-with-report to deny-with-report
1569         https://bugs.webkit.org/show_bug.cgi?id=210136
1570         <rdar://problem/61403216>
1571
1572         Reviewed by Per Arne Vollan.
1573
1574         After tracking telemetry for several weeks, we can now safely switch the default state
1575         of a number of IOKit classes from 'allow with telemetry' to 'deny with telemetry'.
1576
1577         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1578  
1579 2020-04-16  Daniel Bates  <dabates@apple.com>
1580
1581         Fix the iOS build when building without EDITABLE_REGION after r260192
1582         (https://bugs.webkit.org/show_bug.cgi?id=210398)
1583
1584         Have -_mayContainEditableElementsInRect compile-time conditionally call WebKit::mayContainEditableElementsInRect().
1585         If ENABLE(EDITABLE_REGION) is not enabled then return NO.
1586
1587         * UIProcess/API/ios/WKWebViewTestingIOS.mm:
1588         (-[WKWebView _mayContainEditableElementsInRect:]):
1589
1590 2020-04-16  David Kilzer  <ddkilzer@apple.com>
1591
1592         Rollout: [IPC Hardening] MachMessage::create() should use checked arithmetic
1593         <https://webkit.org/b/210572>
1594         <rdar://problem/61729947>
1595
1596         Unreviewed rollout of r260160.
1597
1598         Appears to have caused 8 API test failures on iOS.
1599
1600         * Platform/IPC/cocoa/ConnectionCocoa.mm:
1601         (IPC::Connection::sendOutgoingMessage):
1602         * Platform/IPC/cocoa/MachMessage.cpp:
1603         (IPC::MachMessage::create):
1604
1605 2020-04-16  Brent Fulgham  <bfulgham@apple.com>
1606
1607         REGRESSION(r260081) Broke iOS PLT due to InjectedBundle initialization (edit)
1608         https://bugs.webkit.org/show_bug.cgi?id=210582
1609         <rdar://problem/61838584>
1610
1611         Reviewed by Darin Adler.
1612
1613         The changes in r260081 began enforcing NSSecureCoding best practices, triggering
1614         a bug in InjectedBundleMac.mm, which is used by iOS as well.
1615
1616         This patch does the following:
1617
1618         1. Delays parameter decoding until we use the appropriate InjectedBundle mechanism
1619            for expressing the valid classes to use in the Unarchiver.
1620         2. Removes a temporary workaround needed to get PLT running on iOS again.
1621
1622         This patch also moves the check of the CFBundleGetFunctionPointerForName slightly earlier
1623         so we can use a single function pointer check, and only invoke the parameter decoding
1624         if we are using the C API.
1625         
1626         If not, we delay parameter decoding until we have constructed the WKWebProcessPlugIn
1627         object so we can consume it's 'additionalClassesForParameterCoder' before calling
1628         its initialization method.
1629
1630         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
1631         (WebKit::InjectedBundle::decodeBundleParameters): Remove temporary workaround
1632         needed to get PLT working again. Instead of using a debug assert, return as
1633         a decoding failure if the resulting object is not an NSDictionary.
1634         (WebKit::InjectedBundle::initialize): Delay decoding the bundle parameters on
1635         iOS until the Plugin's additionalClassesForParameterCoder method can be called.
1636
1637 2020-04-16  Daniel Bates  <dabates@apple.com>
1638
1639         [iOS] Add a way to focus a text input and place a caret
1640         https://bugs.webkit.org/show_bug.cgi?id=210611
1641         <rdar://problem/61893062>
1642
1643         Reviewed by Darin Adler.
1644
1645         Add some IPI that will be used by code in WebKitAdditions to focus a text input context
1646         and place the caret in it. This will replace the existing -focusTextInput SPI, which I
1647         will remove in a subsequent commit.
1648
1649         * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
1650         * UIProcess/API/ios/WKWebViewTestingIOS.mm:
1651         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Fix up code style
1652         of signature while I am here.
1653         (-[WKWebView _focusTextInputContext:placeCaretAt:completionHandler:]): Added.
1654         * UIProcess/WebPageProxy.h:
1655         * UIProcess/ios/WKContentViewInteraction.h:
1656         * UIProcess/ios/WKContentViewInteraction.mm:
1657         (-[WKContentView _isTextInputContextFocused:]): Added.
1658         (-[WKContentView _focusTextInputContext:placeCaretAt:completionHandler:]): Added.
1659         (-[WKContentView _requestTextInputContextsInRect:completionHandler:]): Fix up code style
1660         of signature while I am here.
1661         * UIProcess/ios/WebPageProxyIOS.mm:
1662         (WebKit::WebPageProxy::focusTextInputContextAndPlaceCaret):
1663         * WebProcess/WebPage/WebPage.cpp:
1664         (WebKit::WebPage::focusTextInputContext): Use auto now that elementForContext() returns a RefPtr.
1665         (WebKit::WebPage::elementForContext const): Have it return a RefPtr instead of a raw
1666         pointer so callers don't have to remember to take out a ref of otherwise be mindful
1667         of the element's lifetime.
1668         * WebProcess/WebPage/WebPage.h:
1669         * WebProcess/WebPage/WebPage.messages.in:
1670         * WebProcess/WebPage/ios/WebPageIOS.mm:
1671         (WebKit::WebPage::removeTextPlaceholder): Use auto now that elementForContext() returns a RefPtr.
1672         (WebKit::WebPage::requestDocumentEditingContext): Ditto.
1673         (WebKit::WebPage::focusTextInputContextAndPlaceCaret): Added.
1674
1675 2020-04-16  Chris Dumez  <cdumez@apple.com>
1676
1677         Use safeRoundPage() instead of round_page() in SharedMemory
1678         https://bugs.webkit.org/show_bug.cgi?id=210608
1679         <rdar://problem/60600443>
1680
1681         Reviewed by Geoffrey Garen.
1682
1683         Use new safeRoundPage() instead of round_page() in SharedMemory, to deal safely with overflows.
1684
1685         * Platform/cocoa/SharedMemoryCocoa.cpp:
1686         (WebKit::SharedMemory::allocate):
1687         (WebKit::makeMemoryEntry):
1688         (WebKit::SharedMemory::~SharedMemory):
1689         (WebKit::SharedMemory::createHandle):
1690
1691 2020-04-16  Adrian Perez de Castro  <aperez@igalia.com>
1692
1693         Non-unified build fixes mid April 2020 edition
1694         https://bugs.webkit.org/show_bug.cgi?id=210599
1695
1696         Unreviewed build fix.
1697
1698         * UIProcess/DeviceIdHashSaltStorage.cpp: Add missing Logging.h header.
1699         * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp:
1700         (WebKit::WebInspectorProxy::platformSetForcedAppearance): Add missing WebCore:: namespace
1701         prefix.
1702         * UIProcess/linux/MemoryPressureMonitor.h: Add missing wtf/text/CString.h header.
1703
1704 2020-04-16  Daniel Bates  <dabates@apple.com>
1705
1706         REGRESSION (r259762): Should always hit test for editable elements if the WKWebView is fully editable
1707         https://bugs.webkit.org/show_bug.cgi?id=210558
1708         <rdar://problem/61798347>
1709
1710         Reviewed by Wenson Hsieh.
1711
1712         If the entire WKWebView is marked editable (via SPI -[WKWebView _setEditable]) then
1713         always ask the web process to hit test the page because every element is considered
1714         editable.
1715
1716         * UIProcess/ios/WKContentViewInteraction.mm:
1717         (-[WKContentView _requestTextInputContextsInRect:completionHandler:]):
1718
1719 2020-04-16  Daniel Bates  <dabates@apple.com>
1720
1721         Move -_requestTextInputContextsInRect to WKContentView to simplify implementation
1722         https://bugs.webkit.org/show_bug.cgi?id=210398
1723         <rdar://problem/61656931>
1724
1725         Reviewed by Darin Adler.
1726
1727         -_requestTextInputContextsInRect is not needed on Mac, but supporting it complicates
1728         its implementation: it has to deal with coordinate space differences due to differences
1729         in what is the root view on Mac and iOS + it has to know about iOS's custom content views.
1730         While this function was in the "SPI" header, there is no software at Apple that was using
1731         these outside of WebKit, and I will assume no non-Apple software was using them either.
1732         Moving this function to WKContentView lets me simplify the implementation.
1733
1734         * Platform/spi/ios/UIKitSPI.h: Add more forward declarations.
1735         * UIProcess/API/Cocoa/WKWebView.mm:
1736         (-[WKWebView _convertRectFromRootViewCoordinates:]): Deleted.
1737         (-[WKWebView _convertRectToRootViewCoordinates:]): Deleted.
1738         (-[WKWebView _mayContainEditableElementsInRect:]): Deleted; moved to WKWebViewTestingIOS.mm.
1739         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Deleted; moved to WKContentViewInteraction.mm.
1740         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1741         * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
1742         * UIProcess/API/ios/WKWebViewTestingIOS.mm:
1743         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Added. Turns around and
1744         calls the function of the same name on the WKContentView. It takes care to convert the specified
1745         rect from WKWebView coordinates to WKContentView coordinates and fixes up the bounding rects
1746         for the returned contexts to be in WKWebView coordinates. This keeps existings tests passing
1747         as mekes using this function intuitive since callers specify and get rects in WKWebView coordinates.
1748         (-[WKWebView _requestDocumentContext:completionHandler:]): Added.
1749         (-[WKWebView _adjustSelectionWithDelta:completionHandler:]): Added.
1750         (-[WKWebView _mayContainEditableElementsInRect:]): Moved from WKWebView.mm.
1751         * UIProcess/ios/WKContentViewInteraction.h:
1752         * UIProcess/ios/WKContentViewInteraction.mm:
1753         (-[WKContentView _requestTextInputContextsInRect:completionHandler:]): Moved from WKWebView.mm and simplified.
1754
1755 2020-04-16  David Kilzer  <ddkilzer@apple.com>
1756
1757         [IPC Hardening] Use ObjectIdentifier<> for LegacyCustomProtocol
1758         <https://webkit.org/b/210580>
1759         <rdar://problem/61791686>
1760
1761         Reviewed by Chris Dumez.
1762
1763         Replace uses of uint64_t with LegacyCustomProtocolID.
1764
1765         * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
1766         (WebKit::LegacyCustomProtocolManager::didFailWithError):
1767         (WebKit::LegacyCustomProtocolManager::didLoadData):
1768         (WebKit::LegacyCustomProtocolManager::didReceiveResponse):
1769         (WebKit::LegacyCustomProtocolManager::didFinishLoading):
1770         (WebKit::LegacyCustomProtocolManager::wasRedirectedToRequest):
1771         (WebKit::LegacyCustomProtocolManager::protocolForID):
1772         * NetworkProcess/CustomProtocols/LegacyCustomProtocolID.h: Add.
1773         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
1774         (WebKit::LegacyCustomProtocolManager::addCustomProtocol):
1775         (WebKit::LegacyCustomProtocolManager::removeCustomProtocol):
1776         (WebKit::LegacyCustomProtocolManager::startLoading):
1777         (WebKit::LegacyCustomProtocolManager::stopLoading):
1778         (WebKit::generateCustomProtocolID): Delete.
1779         - Replace with LegacyCustomProtocolID::generate().
1780         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
1781         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.messages.in:
1782         * Scripts/webkit/messages.py:
1783         * UIProcess/API/APICustomProtocolManagerClient.h:
1784         (API::CustomProtocolManagerClient::startLoading):
1785         (API::CustomProtocolManagerClient::stopLoading):
1786         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.h:
1787         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
1788         (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
1789         (WebKit::LegacyCustomProtocolManagerClient::startLoading):
1790         (WebKit::LegacyCustomProtocolManagerClient::stopLoading):
1791         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp:
1792         (WebKit::LegacyCustomProtocolManagerProxy::startLoading):
1793         (WebKit::LegacyCustomProtocolManagerProxy::stopLoading):
1794         (WebKit::LegacyCustomProtocolManagerProxy::wasRedirectedToRequest):
1795         (WebKit::LegacyCustomProtocolManagerProxy::didReceiveResponse):
1796         (WebKit::LegacyCustomProtocolManagerProxy::didLoadData):
1797         (WebKit::LegacyCustomProtocolManagerProxy::didFailWithError):
1798         (WebKit::LegacyCustomProtocolManagerProxy::didFinishLoading):
1799         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h:
1800         - Remove unused typedef and instance variable.
1801         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.messages.in:
1802         * WebKit.xcodeproj/project.pbxproj:
1803         - Add LegacyCustomProtocolID.h to project.
1804
1805 2020-04-16  Tim Horton  <timothy_horton@apple.com>
1806
1807         REGRESSION (r259898): WebKit-based Books views are all blank
1808         https://bugs.webkit.org/show_bug.cgi?id=210590
1809         <rdar://problem/61791109>
1810
1811         Reviewed by Chris Dumez.
1812
1813         * UIProcess/Cocoa/WebViewImpl.h:
1814         * UIProcess/Cocoa/WebViewImpl.mm:
1815         (WebKit::WebViewImpl::enterAcceleratedCompositingWithRootLayer):
1816         (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer):
1817         (WebKit::WebViewImpl::setAcceleratedCompositingRootLayerAfterFlush): Deleted.
1818         * UIProcess/mac/PageClientImplMac.mm:
1819         (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
1820         (WebKit::PageClientImpl::didFirstLayerFlush):
1821         The changes to setAcceleratedCompositingRootLayer in r259898 proved
1822         to be wrong in a second way (the first being fixed in r260104): when
1823         setAcceleratedCompositingRootLayer is called from updateAcceleratedCompositingMode,
1824         because the layer hosting mode changed (Books appears to use app-hosted layers),
1825         it incorrectly identified the root layer change as a process swap, resulting
1826         in the correct layer never being unhidden.
1827
1828         This is enough mistakes that I'm going to try a different approach:
1829         put setAcceleratedCompositingRootLayer back to the way it was before, where
1830         it immediately updates the layer without any smarts, remove
1831         setAcceleratedCompositingRootLayerAfterFlush, because it's no longer necessary,
1832         and add enterAcceleratedCompositingWithRootLayer, which is specifically only
1833         called in the case where DrawingArea will for-sure send us a follow-up
1834         (didFirstLayerFlush) that will unhide the root layer.
1835
1836 2020-04-16  Eric Carlson  <eric.carlson@apple.com>
1837
1838         [macOS] Update ScreenTime as playback state changes
1839         https://bugs.webkit.org/show_bug.cgi?id=210518
1840         <rdar://problem/61181092>
1841
1842         Reviewed by Jer Noble.
1843
1844         Add a manager that gets media element state changes, and a Cocoa-specific
1845         implementation that passes that state to ScreenTime.
1846
1847         * Scripts/webkit/messages.py:
1848         * Sources.txt:
1849         * SourcesCocoa.txt:
1850         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1851         (WebKit::WebPageProxy::mediaUsageManager):
1852         (WebKit::WebPageProxy::addMediaUsageManagerSession):
1853         (WebKit::WebPageProxy::updateMediaUsageManagerSessionState):
1854         (WebKit::WebPageProxy::removeMediaUsageManagerSession):
1855         * UIProcess/Media/MediaUsageManager.cpp: Added.
1856         (WebKit::MediaUsageManager::create):
1857         (WebKit::reset):
1858         (WebKit::MediaUsageManager::addMediaSession):
1859         (WebKit::MediaUsageManager::removeMediaSession):
1860         (WebKit::MediaUsageManager::updateMediaUsage):
1861         * UIProcess/Media/MediaUsageManager.h: Added.
1862         * UIProcess/Media/cocoa/MediaUsageManagerCocoa.h: Added.
1863         (WebKit::MediaUsageManagerCocoa::SessionMediaUsage::SessionMediaUsage):
1864         * UIProcess/Media/cocoa/MediaUsageManagerCocoa.mm: Added.
1865         (WebKit::usageTrackingAvailable):
1866         (WebKit::MediaUsageManager::create):
1867         (WebKit::MediaUsageManagerCocoa::~MediaUsageManagerCocoa):
1868         (WebKit::MediaUsageManagerCocoa::reset):
1869         (WebKit::MediaUsageManagerCocoa::addMediaSession):
1870         (WebKit::MediaUsageManagerCocoa::removeMediaSession):
1871         (WebKit::MediaUsageManagerCocoa::updateMediaUsage):
1872         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1873         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
1874         * UIProcess/WebPageProxy.cpp:
1875         * UIProcess/WebPageProxy.h:
1876         * UIProcess/WebPageProxy.messages.in:
1877         * WebKit.xcodeproj/project.pbxproj:
1878         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1879         (WebKit::WebChromeClient::addMediaUsageManagerSession):
1880         (WebKit::WebChromeClient::updateMediaUsageManagerSessionState):
1881         (WebKit::WebChromeClient::removeMediaUsageManagerSession):
1882         * WebProcess/WebCoreSupport/WebChromeClient.h:
1883         * WebProcess/WebPage/WebPage.cpp:
1884         (WebKit::WebPage::addMediaUsageManagerSession):
1885         (WebKit::WebPage::updateMediaUsageManagerSessionState):
1886         (WebKit::WebPage::removeMediaUsageManagerSession):
1887         * WebProcess/WebPage/WebPage.h:
1888
1889 2020-04-16  David Kilzer  <ddkilzer@apple.com>
1890
1891         [IPC hardening] DrawingArea::updateBackingStoreState() is not used on Apple platforms
1892         <https://webkit.org/b/210585>
1893         <rdar://problem/61802011>
1894
1895         Reviewed by Geoffrey Garen.
1896
1897         * UIProcess/DrawingAreaProxy.h:
1898         * UIProcess/DrawingAreaProxy.messages.in:
1899         * WebProcess/WebPage/DrawingArea.h:
1900         (WebKit::DrawingArea::updateBackingStoreState):
1901         * WebProcess/WebPage/DrawingArea.messages.in:
1902         - Use USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER) to
1903           protect code not used on Apple platforms.
1904
1905 2020-04-16  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1906
1907         [GTK] MiniBrowser opens new windows too small causing failures on some WPT tests
1908         https://bugs.webkit.org/show_bug.cgi?id=210206
1909
1910         Reviewed by Carlos Garcia Campos.
1911
1912         Provide the size of the default window (if is set) when windowRect is called
1913         before the window is shown.
1914
1915         * UIProcess/API/glib/WebKitUIClient.cpp:
1916
1917 2020-04-16  Tomoki Imai  <Tomoki.Imai@sony.com>
1918
1919         TextureMapper renders video element with "object-fit: cover" incorrectly
1920         https://bugs.webkit.org/show_bug.cgi?id=210544
1921
1922         Reviewed by Žan Doberšek.
1923
1924         Propagate GraphicsLayer::contentsClippingRect information to TextureMapperLayer
1925         to properly clip the outside of DOM element when the element has "object-fit: cover".
1926
1927         Unfortunately, the test is disabled on WebKitGTK due to bug 177536, bug 163528.
1928         Test: compositing/video/video-object-fit.html
1929
1930         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1931         (WebKit::CoordinatedGraphicsScene::updateSceneState):
1932
1933 2020-04-15  Jer Noble  <jer.noble@apple.com>
1934
1935         REGRESSION (r260102): ASSERTION FAILED: m_arbitrators.contains(proxy) in WebKit::SharedArbitrator::endRoutingArbitrationForArbitrator
1936         https://bugs.webkit.org/show_bug.cgi?id=210589
1937         <rdar://problem/61844208>
1938
1939         Reviewed by Eric Carlson.
1940
1941         Protect against an assertion in the SharedArbitrator in case where a WebProcess is terminated before it can call
1942         endRoutingArbitration().
1943
1944         * UIProcess/Media/AudioSessionRoutingArbitratorProxy.cpp:
1945         (WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate):
1946         * UIProcess/Media/AudioSessionRoutingArbitratorProxy.h:
1947         * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
1948         (WebKit::SharedArbitrator::isInRoutingArbitrationForArbitrator):
1949         (WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator):
1950         (WebKit::SharedArbitrator::endRoutingArbitrationForArbitrator):
1951         (WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate):
1952         * UIProcess/WebProcessProxy.cpp:
1953         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
1954
1955 2020-04-15  Tim Horton  <timothy_horton@apple.com>
1956
1957         REGRESSION (r258337): Crash when right clicking on link that uses the system UI font with optimizeLegibility on Mojave
1958         https://bugs.webkit.org/show_bug.cgi?id=210575
1959         <rdar://problem/61646717>
1960
1961         Reviewed by Darin Adler.
1962
1963         * Shared/Cocoa/ArgumentCodersCocoa.mm:
1964         (-[WKSecureCodingFontAttributeNormalizer archiver:willEncodeObject:]):
1965         (IPC::encodeSecureCodingInternal):
1966         The workaround introduced in r250640 and r251086 for archiving NSFonts
1967         with optical sizing attributes is still incomplete, which was recently
1968         revealed by making decoding failures more apparent (in r258337).
1969
1970         Specifically, the workaround was not applied to fonts encoded inside
1971         NSAttributedStrings, which are encoded using a keyed archiver... only
1972         to fonts encoded directly with CoreIPC.
1973
1974         Use a NSKeyedArchiver delegate to apply our fix-up to the optical sizing
1975         attribute when any NSFont is being encoded, and only on platforms
1976         that still exhibit the bug.
1977
1978         * Shared/Cocoa/CoreTextHelpers.h:
1979         * Shared/Cocoa/CoreTextHelpers.mm:
1980         (WebKit::fontWithAttributes):
1981         (WebKit::fontDescriptorWithFontAttributes): Deleted.
1982         * UIProcess/Cocoa/WebViewImpl.mm:
1983         (WebKit::WebViewImpl::updateFontManagerIfNeeded):
1984         * UIProcess/mac/WebPopupMenuProxyMac.mm:
1985         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
1986         Refactor fontDescriptorWithFontAttributes to just return a font since that's what all callers actually want.
1987
1988 2020-04-15  John Wilander  <wilander@apple.com>
1989
1990         Add SPI to configure WebsiteDataStores with a URL for standalone web applications and use it to disable first-party website data removal in ITP
1991         https://bugs.webkit.org/show_bug.cgi?id=209634
1992         <rdar://problem/60943970>
1993
1994         Reviewed by Alex Christensen.
1995
1996         This change adds a new property to _WKWebsiteDataStoreConfiguration.h called
1997         standaloneApplicationURL with which the hosting application can inform the
1998         website data store that it's running as a standalone web application.
1999
2000         This change also forwards an existing standaloneApplicationURL as a
2001         WebCore::RegistrableDomain into ITP so that explicit exemptions can be made
2002         to first parties of standalone web applications. The exemptions made here
2003         all for all of ITP's website data removal. This part of the change is
2004         covered by the new layout tests.
2005
2006         Tests: http/tests/resourceLoadStatistics/standalone-web-application-exempt-from-website-data-deletion-database.html
2007                http/tests/resourceLoadStatistics/standalone-web-application-exempt-from-website-data-deletion.html
2008
2009         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2010         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2011         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor):
2012         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
2013         (WebKit::ResourceLoadStatisticsStore::setStandaloneApplicationDomain):
2014         (WebKit::ResourceLoadStatisticsStore::standaloneApplicationDomain const):
2015         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2016         (WebKit::WebResourceLoadStatisticsStore::setStandaloneApplicationDomain):
2017         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2018         * NetworkProcess/NetworkSession.cpp:
2019         (WebKit::NetworkSession::NetworkSession):
2020         (WebKit::NetworkSession::forwardResourceLoadStatisticsSettings):
2021         * NetworkProcess/NetworkSession.h:
2022         * Shared/ResourceLoadStatisticsParameters.h:
2023         (WebKit::ResourceLoadStatisticsParameters::encode const):
2024         (WebKit::ResourceLoadStatisticsParameters::decode):
2025         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2026         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
2027         (-[_WKWebsiteDataStoreConfiguration standaloneApplicationURL]):
2028         (-[_WKWebsiteDataStoreConfiguration setStandaloneApplication:]):
2029         * UIProcess/WebProcessPool.cpp:
2030         (WebKit::WebProcessPool::ensureNetworkProcess):
2031         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2032         (WebKit::WebsiteDataStore::platformSetNetworkParameters):
2033         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
2034         (WebKit::WebsiteDataStoreConfiguration::copy const):
2035         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
2036         (WebKit::WebsiteDataStoreConfiguration::standaloneApplicationURL const):
2037         (WebKit::WebsiteDataStoreConfiguration::setStandaloneApplicationURL):
2038
2039 2020-04-15  Chris Dumez  <cdumez@apple.com>
2040
2041         [IPC Hardening] MachMessage::messageSize() should use checked arithmetic
2042         https://bugs.webkit.org/show_bug.cgi?id=210567
2043         <rdar://problem/61734355>
2044
2045         Reviewed by Geoffrey Garen.
2046
2047         Replace call to round_msg() call with a call to our new safeRoundMsg() which does
2048         the same alignment up but using checked arithmetic to protect against overflows.
2049
2050         * Platform/IPC/cocoa/MachMessage.cpp:
2051         (IPC::safeRoundMsg):
2052         (IPC::MachMessage::messageSize):
2053
2054 2020-04-15  David Kilzer  <ddkilzer@apple.com>
2055
2056         [IPC Hardening] MachMessage::create() should use checked arithmetic
2057         <https://webkit.org/b/210572>
2058         <rdar://problem/61729947>
2059
2060         Reviewed by Chris Dumez.
2061
2062         * Platform/IPC/cocoa/ConnectionCocoa.mm:
2063         (IPC::Connection::sendOutgoingMessage):
2064         - Add nullptr check since MachMessage::create() can return an
2065           empty std::unique_ptr<> now.
2066         * Platform/IPC/cocoa/MachMessage.cpp:
2067         (IPC::MachMessage::create):
2068         - Use CheckedSize to compute the buffer size.
2069
2070 2020-04-15  Brent Fulgham  <bfulgham@apple.com>
2071
2072         Unreviewed PLT fix after r260081.
2073
2074         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
2075         (WebKit::InjectedBundle::decodeBundleParameters):
2076
2077 2020-04-15  Ben Nham  <nham@apple.com>
2078
2079         DidFirstLayerFlush IPC can be head-of-line-blocked and delay first paint by 200+ ms on process swap
2080         https://bugs.webkit.org/show_bug.cgi?id=210571
2081
2082         Reviewed by Geoffrey Garen.
2083
2084         When we process swap, the layer swap/unhiding for the new hosted layer is gated by the
2085         DidFirstLayerFlush IPC. But actually sending this IPC can be head-of-line blocked for an
2086         arbitrarily long time because we append it to the queue of messages for the main run loop to
2087         process. In some cases, e.g. for the NYT PLT content, this blocks first paint by 200 ms
2088         while the WebProcess main thread is busy doing other things (like executing deferred
2089         scripts).
2090
2091         To fix this, use a CATransaction commit handler to send the IPC right after we commit.
2092
2093         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2094         (WebKit::TiledCoreAnimationDrawingArea::sendDidFirstLayerFlushIfNeeded):
2095
2096 2020-04-15  Wenson Hsieh  <wenson_hsieh@apple.com>
2097
2098         Unreviewed, fix the watchOS and tvOS builds after r260146
2099
2100         Move some code for controlling the presentation of context menus on iOS behind USE(UICONTEXTMENU).
2101
2102         * UIProcess/ios/WKActionSheetAssistant.h:
2103         * UIProcess/ios/WKContentViewInteraction.mm:
2104
2105 2020-04-15  Peng Liu  <peng.liu6@apple.com>
2106
2107         Video elements don't return to the correct position when exiting fullscreen
2108         https://bugs.webkit.org/show_bug.cgi?id=210529
2109
2110         Reviewed by Jer Noble.
2111
2112         Some web pages use the "resize" event handler to calculate the element size after
2113         they exit fullscreen, and the calculation is based on the container element size which
2114         might be affected by the fullscreen mode.
2115
2116         We need to call WebPageProxy::setNeedsDOMWindowResizeEvent() to fire the "resize" event
2117         in the repaint callback after the exiting fullscreen process is completed and the
2118         possible layout change due to exiting fullscreen is done. Otherwise the size calculation
2119         might be wrong.
2120
2121         * UIProcess/WebPageProxy.cpp:
2122         * UIProcess/WebPageProxy.h:
2123         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2124         (-[WKFullScreenWindowController _completedExitFullScreen]):
2125         * UIProcess/mac/WKFullScreenWindowController.mm:
2126         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
2127         * WebProcess/WebPage/WebPage.cpp:
2128         (WebKit::WebPage::setNeedsDOMWindowResizeEvent):
2129         * WebProcess/WebPage/WebPage.h:
2130         * WebProcess/WebPage/WebPage.messages.in:
2131
2132 2020-04-15  Wenson Hsieh  <wenson_hsieh@apple.com>
2133
2134         [iPadOS] Some pages indefinitely zoom in and out due to idempotent text autosizing
2135         https://bugs.webkit.org/show_bug.cgi?id=210551
2136         <rdar://problem/56820674>
2137
2138         Reviewed by Tim Horton.
2139
2140         On a non-responsive web page with one or lines of non-wrapping text of a specific length (just under 1920px),
2141         it's possible for the combination of idempotent text autosizing heuristics and viewport shrink-to-fit to cause
2142         the single line of text to grow and shrink in size indefinitely, and additionally cause the initial scale to
2143         thrash between multiple values indefinitely. This manifests in the entire page repeatedly zooming in and out
2144         immediately after page load.
2145
2146         Consider the following scenario:
2147
2148         (1) A viewport configuration change (e.g. due to parsing the viewport meta tag) schedules the timer to reset
2149             idempotent text autosizing. Let's suppose the page has a really long line of non-wrapping 12px text that is
2150             below 1920px wide.
2151
2152         (2) The timer fires, invalidating styles and recomputing text autosizing given the current initial scale. The
2153             current initial scale is below 1, since ViewportConfiguration will attempt to shrink to fit the page to
2154             avoid horizontal scrolling. This causes text autosizing to boost the long line of text to a larger value
2155             (let's say 17px).
2156
2157         (3) The next time we perform style recomputation and layout, we discover that the content width of the page is
2158             now larger than 1920px, which is the maximum width which we'll attempt to shrink to fit; when computing
2159             initial scale, we give up trying to shrink down to avoid making the inital scale too small, and instead just
2160             keep it at 1.
2161
2162         (4) This change in viewport configuration then schedules another idempotent text autosizing reset. When this
2163             timer fires, it sees that the initial scale is now 1, which means that the text is no longer boosted, so we
2164             make the single line of text small again (12px).
2165
2166         (5) After the next style recomputation and layout, this causes the content width of the page to dip below the
2167             1920px threshold, causing the initial scale to dip below 1 again. As detailed above, this schedules another
2168             idempotent text autosizing update, which now boosts font size once again, and the cycle continues.
2169
2170         To fix this, instead of consulting the initial scale (`ViewportConfiguration::initialScale()`) when computing
2171         the boosted font size for idempotent text autosizing, we can instead ask for the initial scale ignoring content
2172         size (`ViewportConfiguration::initialScaleIgnoringContentSize()`). This prevents changes in content size due to
2173         idempotent autosizing from affecting the idempotent autosizing heuristic (through the different initial scale),
2174         and ensures that this method of text autosizing actually remains idempotent.
2175
2176         * WebProcess/WebPage/ios/WebPageIOS.mm:
2177         (WebKit::WebPage::resetIdempotentTextAutosizingIfNeeded):
2178         (WebKit::WebPage::viewportConfigurationChanged):
2179
2180 2020-04-14  Megan Gardner  <megan_gardner@apple.com>
2181
2182         Data Detected Actions sheets are presented from odd locations.
2183         https://bugs.webkit.org/show_bug.cgi?id=210531
2184         <rdar://problem/60941346>
2185
2186         Reviewed by Wenson Hsieh.
2187
2188         Use the existing context menu targeted preview code to ensure that the
2189         data detected menus are presented in a good location.
2190
2191         * UIProcess/ios/WKActionSheetAssistant.h:
2192         * UIProcess/ios/WKActionSheetAssistant.mm:
2193         (-[WKActionSheetAssistant contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
2194         * UIProcess/ios/WKContentViewInteraction.mm:
2195         (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]):
2196
2197 2020-04-15  Per Arne Vollan  <pvollan@apple.com>
2198
2199         [iOS] Potential crash under WebProcess::platformInitializeWebProcess
2200         https://bugs.webkit.org/show_bug.cgi?id=210547
2201
2202         Reviewed by Brent Fulgham.
2203
2204         If the UI process fails to issue an extension to the runningboard service, the WebContent process will crash
2205         while trying to consume this extension.
2206
2207         No new tests, since the test runners are unsandboxed, so issuing the extension will always succeed.
2208
2209         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2210         (WebKit::WebProcessPool::platformInitializeWebProcess):
2211         * WebProcess/cocoa/WebProcessCocoa.mm:
2212         (WebKit::WebProcess::platformInitializeWebProcess):
2213
2214 2020-04-15  Brent Fulgham  <bfulgham@apple.com>
2215
2216         [Cocoa] Remove generic parameter serialization fallback
2217         https://bugs.webkit.org/show_bug.cgi?id=210509
2218         <rdar://problem/55522650>
2219
2220         Reviewed by Geoffrey Garen.
2221
2222         Tested by BundleFormDelegate parameter serialization tests...
2223
2224         * UIProcess/API/Cocoa/WKWebView.mm:
2225         (-[WKWebView _setInputDelegate:]):
2226         * UIProcess/ios/PageClientImplIOS.mm:
2227         (WebKit::PageClientImpl::elementDidFocus):
2228
2229 2020-04-15  Chris Dumez  <cdumez@apple.com>
2230
2231         REGRESSION (r259610): WebGL does not work at all on iOS (was: Google Maps tiles turn black after initial load)
2232         <rdar://problem/61794480>
2233
2234         Unreviewed, partial revert of r259610 because it broke Google Maps.
2235         Stop using RunningBoard for the "Foreground" assertion because it fails to
2236         give the target GPU access.
2237
2238         * UIProcess/ios/ProcessAssertionIOS.mm:
2239         (WebKit::runningBoardNameForAssertionType):
2240
2241 2020-04-15  Carlos Garcia Campos  <cgarcia@igalia.com>
2242
2243         [GTK4] Fix use of gtk init functions
2244         https://bugs.webkit.org/show_bug.cgi?id=210550
2245
2246         Reviewed by Adrian Perez de Castro.
2247
2248         Include GtkVersioning.h instead of gtk.h
2249
2250         * WebProcess/gtk/WebProcessMainGtk.cpp:
2251
2252 2020-04-15  Peng Liu  <peng.liu6@apple.com>
2253
2254         Adopt interface AVAudioRoutingArbiter for Mac
2255         https://bugs.webkit.org/show_bug.cgi?id=210167
2256
2257         Reviewed by Jer Noble.
2258
2259         A follow-up patch to fix a build error.
2260
2261         * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
2262         (WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator):
2263
2264 2020-04-15  Adrian Perez de Castro  <aperez@igalia.com>
2265
2266         [GTK4] Provide an alternative to gtk_widget_{get,is}_toplevel()
2267         https://bugs.webkit.org/show_bug.cgi?id=210463
2268
2269         Reviewed by Carlos Garcia Campos.
2270
2271         * UIProcess/API/glib/WebKitUIClient.cpp: Adapt to take into account that GTK4 does not
2272         provide the GtkWidget.configure-event signal.
2273
2274 2020-04-15  Said Abou-Hallawa  <sabouhallawa@apple.com>
2275
2276         Unreviewed, reverting r259891.
2277
2278         Causes significant iOS MotionMark regression
2279
2280         Reverted changeset:
2281
2282         "Switch unused IOKit classes from allow-with-report to deny-
2283         with-report"
2284         https://bugs.webkit.org/show_bug.cgi?id=210136
2285         https://trac.webkit.org/changeset/259891
2286
2287 2020-04-14  Megan Gardner  <megan_gardner@apple.com>
2288
2289         File Upload Menus presented from odd locations.
2290         https://bugs.webkit.org/show_bug.cgi?id=210523
2291         <rdar://problem/60390846>
2292
2293         Use the existing context menu targeted preview code to ensure that the
2294         file menus are presented in a good location.
2295
2296         Reviewed by Wenson Hsieh.
2297
2298         * UIProcess/ios/WKContentViewInteraction.h:
2299         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2300         (-[WKFileUploadPanel contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
2301
2302 2020-04-14  David Kilzer  <ddkilzer@apple.com>
2303
2304         dictionaryValueOfType() in WebCoreArgumentCodersMac.mm can be replaced with dynamic_cf_cast<>()
2305         <https://webkit.org/b/210456>
2306
2307         Reviewed by Darin Adler.
2308
2309         * Shared/mac/WebCoreArgumentCodersMac.mm:
2310         (IPC::dictionaryValueOfType): Delete.
2311         (IPC::extractDictionaryValue): Add.
2312         - Use dynamic_cf_cast<>() in place of manually checking the
2313           CFTypeID of each object.
2314         (IPC::createArchiveList):
2315         - Call new extractDictionaryValue() template function to verify
2316           values are the correct types in the dictionary and to set the
2317           output variables.
2318
2319 2020-04-14  David Kilzer  <ddkilzer@apple.com>
2320
2321         Use CFArrayGetValues() in createArchiveList() in WebCoreArgumentCodersMac.mm
2322         <https://webkit.org/b/210519>
2323
2324         Reviewed by Darin Adler.
2325
2326         * Shared/mac/WebCoreArgumentCodersMac.mm:
2327         (IPC::createArchiveList):
2328         - Use CFArrayGetValues() to copy array more efficiently.
2329
2330 2020-04-14  Tim Horton  <timothy_horton@apple.com>
2331
2332         REGRESSION (r259898): Tabs occasionally go blank and get stuck that way
2333         https://bugs.webkit.org/show_bug.cgi?id=210520
2334         <rdar://problem/61776830>
2335
2336         Reviewed by Simon Fraser.
2337
2338         * UIProcess/Cocoa/WebViewImpl.mm:
2339         (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer):
2340         setThumbnailView calls setAcceleratedCompositingRootLayer in order to reconnect the
2341         existing root layer. After r259898, this would cause us to go down the
2342         process-swap path, and hide the root layer, and nothing would ever
2343         come along and fix it.
2344
2345         If setAcceleratedCompositingRootLayer is called with the existing root
2346         layer, that cannot be a process swap, so ignore it and proceed as before.
2347
2348 2020-04-14  Jer Noble  <jer.noble@apple.com>
2349
2350         Adopt interface AVAudioRoutingArbiter for Mac
2351         https://bugs.webkit.org/show_bug.cgi?id=210167
2352         <rdar://problem/59113994>
2353
2354         Reviewed by Eric Carlson.
2355
2356         Add a new cross-process object pair, AudioSessionRouterAbitrator/Proxy which passes routing
2357         arbitration commands from WebContent -> UIProcess. Because the UIProcess can represent
2358         multiple WebContent processes, it must track all outstanding arbitration requests globally.
2359
2360         * DerivedSources-input.xcfilelist:
2361         * DerivedSources-output.xcfilelist:
2362         * DerivedSources.make:
2363         * GPUProcess/GPUProcess.cpp:
2364         (WebKit::GPUProcess::initializeGPUProcess):
2365         * Sources.txt:
2366         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2367         (WebKit::mediaRelatedMachServices):
2368         * UIProcess/Media/AudioSessionRoutingArbitratorProxy.cpp: Added.
2369         (WebKit::AudioSessionRoutingArbitratorProxy::AudioSessionRoutingArbitratorProxy):
2370         (WebKit::AudioSessionRoutingArbitratorProxy::~AudioSessionRoutingArbitratorProxy):
2371         (WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory):
2372         (WebKit::AudioSessionRoutingArbitratorProxy::leaveRoutingArbitration):
2373         * UIProcess/Media/AudioSessionRoutingArbitratorProxy.h: Added.
2374         (WebKit::AudioSessionRoutingArbitratorProxy::category const):
2375         (WebKit::AudioSessionRoutingArbitratorProxy::destinationId):
2376         * UIProcess/Media/AudioSessionRoutingArbitratorProxy.messages.in: Added.
2377         * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm: Added.
2378         (WebKit::SharedArbitrator::sharedInstance):
2379         (WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator):
2380         (WebKit::SharedArbitrator::leaveRoutingArbitrationForArbitrator):
2381         (WebKit::AudioSessionRoutingArbitratorProxy::AudioSessionRoutingArbitratorProxy):
2382         (WebKit::AudioSessionRoutingArbitratorProxy::~AudioSessionRoutingArbitratorProxy):
2383         (WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory):
2384         (WebKit::AudioSessionRoutingArbitratorProxy::leaveRoutingArbitration):
2385         * UIProcess/WebPageProxy.h:
2386         * UIProcess/WebProcessProxy.cpp:
2387         (WebKit::WebProcessProxy::WebProcessProxy):
2388         * UIProcess/WebProcessProxy.h:
2389         * WebKit.xcodeproj/project.pbxproj:
2390         * WebProcess/WebPage/WebPage.cpp:
2391         (WebKit::m_processDisplayName):
2392         * WebProcess/WebProcess.cpp:
2393         * WebProcess/cocoa/AudioSessionRoutingArbitrator.cpp: Added.
2394         (WebKit::AudioSessionRoutingArbitrator::AudioSessionRoutingArbitrator):
2395         (WebKit::AudioSessionRoutingArbitrator::supplementName):
2396         (WebKit::AudioSessionRoutingArbitrator::beginRoutingArbitrationWithCategory):
2397         (WebKit::AudioSessionRoutingArbitrator::leaveRoutingAbritration):
2398         * WebProcess/cocoa/AudioSessionRoutingArbitrator.h: Added.
2399         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2400         (WebKit::UserMediaCaptureManager::AudioFactory::createAudioCaptureSource):
2401         * WebProcess/com.apple.WebProcess.sb.in:
2402
2403 2020-04-14  David Kilzer  <ddkilzer@apple.com>
2404
2405         createArchiveList() in WebCoreArgumentCodersMac.mm should do more validity checks
2406         <https://webkit.org/b/210448>
2407         <rdar://problem/61677029>
2408
2409         Reviewed by Darin Adler.
2410
2411         * Shared/mac/WebCoreArgumentCodersMac.mm:
2412         (IPC::createArchiveList): Add more validity checks.
2413
2414 2020-04-14  Brent Fulgham  <bfulgham@apple.com>
2415
2416         Do more checking before reusing precompiled sandbox
2417         https://bugs.webkit.org/show_bug.cgi?id=210304
2418         <rdar://problem/61155623>
2419
2420         Reviewed by Darin Adler.
2421
2422         We recently discovered that the system sandbox framework version does not always change
2423         when breaking changes in the sandbox format are made. This can lead to the precompiled
2424         version of a sandbox not working properly when a sandbox version changes.
2425
2426         To guard against this, make the following changes:
2427
2428         1. Compare the SANDBOX_BUILD_ID in place when the sandbox was compiled to the value on
2429            the current system. SANDBOX_BUILD_ID, which is a GUID, is always regenerated when the
2430            sandbox framework is rebuilt.
2431
2432         2. Compare the OS version in place when the sandbox was compiled to the value on the current
2433            system. This will trigger us recompiling sandboxes even when the sandbox framework did not
2434            change, but this is a small performance cost that would only happen after a software update.
2435
2436         * Shared/mac/AuxiliaryProcessMac.mm:
2437         (WebKit::compileAndCacheSandboxProfile):
2438         (WebKit::tryApplyCachedSandbox):
2439
2440 2020-04-14  Per Arne Vollan  <pvollan@apple.com>
2441
2442         [iOS] Content filtering needs access to the frontboard service
2443         https://bugs.webkit.org/show_bug.cgi?id=210505
2444
2445         Reviewed by Geoffrey Garen.
2446
2447         Content filtering in the WebContent process needs access to the frontboard service on iOS. Issue an extension
2448         to this service when content filtering is enabled.
2449
2450         API test: WebKit.WebFilterFeatureHasFrontboardServiceAccess
2451
2452         * Shared/WebProcessCreationParameters.cpp:
2453         (WebKit::WebProcessCreationParameters::encode const):
2454         (WebKit::WebProcessCreationParameters::decode):
2455         * Shared/WebProcessCreationParameters.h:
2456         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2457         (WebKit::WebProcessPool::platformInitializeWebProcess):
2458         * WebProcess/cocoa/WebProcessCocoa.mm:
2459         (WebKit::WebProcess::platformInitializeWebProcess):
2460
2461 2020-04-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2462
2463         [iPadOS] Wikipedia articles lay out incorrectly in 1/3 multitasking window
2464         https://bugs.webkit.org/show_bug.cgi?id=210501
2465         <rdar://problem/54856323>
2466
2467         Reviewed by Tim Horton.
2468
2469         Apply the viewport quirk if needed; see WebCore/ChangeLog for more details.
2470
2471         * WebProcess/WebPage/ios/WebPageIOS.mm:
2472         (WebKit::WebPage::updateVisibleContentRects):
2473
2474 2020-04-14  Brent Fulgham  <bfulgham@apple.com>
2475
2476         InjectedBundle parameters often need initialization function called before unarchiving
2477         https://bugs.webkit.org/show_bug.cgi?id=189709
2478         <rdar://problem/44573653>
2479
2480         Reviewed by Ryosuke Niwa.
2481
2482         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
2483         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
2484         after the bundle initialiation function runs, which gives the embedding program the opportunity to
2485         register additional classes that are safe for serialization.
2486
2487         Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need
2488         to be serialized by the InjectedBundle.
2489         
2490         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
2491         Revise 'initialize' to call this new method.
2492
2493         * WebProcess/InjectedBundle/InjectedBundle.h:
2494         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
2495         (WebKit::InjectedBundle::initialize): Use the new method.
2496         (WebKit::InjectedBundle::decodeBundleParameters): Added.
2497         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
2498         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
2499         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
2500         NSDictionary object may itself hold other kinds of objects.
2501         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
2502         (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added.
2503
2504 2020-04-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2505
2506         Address review comments after r260035
2507         https://bugs.webkit.org/show_bug.cgi?id=210440
2508
2509         Reviewed by David Kilzer.
2510
2511         Omit unused argument names.
2512
2513         * UIProcess/API/C/WKPreferences.cpp:
2514         (WKPreferencesSetIgnoreViewportScalingConstraints):
2515         (WKPreferencesGetIgnoreViewportScalingConstraints):
2516
2517 2020-04-14  Megan Gardner  <megan_gardner@apple.com>
2518
2519         YouTube sometimes navigates unexpectedly when invoking a context menu on a video link. 
2520         https://bugs.webkit.org/show_bug.cgi?id=210467
2521         <rdar://problem/58841584>
2522
2523         Reviewed by Tim Horton.
2524
2525         Cancel any outstanding touches tracked by WebTouchEventsGestureRecognizer, so that we dispatch
2526         `touchcancel` to the page instead of `touchend`, so that the page does not misinterpret
2527         context menu invocation as a tap.
2528
2529         * UIProcess/ios/WKContentViewInteraction.mm:
2530         (-[WKContentView contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
2531
2532 2020-04-14  Youenn Fablet  <youenn@apple.com>
2533
2534         Do not process RTC Network messages coming from NetworkProcess if LibWebRTCNetwork is not active
2535         https://bugs.webkit.org/show_bug.cgi?id=207376
2536         <rdar://problem/59238611>
2537
2538         Unreviewed.
2539         Post-commit review update, change variable name to network.
2540         No change of behavior.
2541
2542         * WebProcess/Network/NetworkProcessConnection.cpp:
2543         (WebKit::NetworkProcessConnection::didReceiveMessage):
2544
2545 2020-04-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2546
2547         [GTK] Bring back support for rendering scrollbars using the system appearance
2548         https://bugs.webkit.org/show_bug.cgi?id=209805
2549
2550         Reviewed by Michael Catanzaro.
2551
2552         Add WebKitWebContext:use-system-appearance-for-scrollbars property. It's enabled by default to keep backwards
2553         compatibility.
2554
2555         * Shared/WebProcessCreationParameters.cpp:
2556         (WebKit::WebProcessCreationParameters::encode const): Encode useSystemAppearanceForScrollbars.
2557         (WebKit::WebProcessCreationParameters::decode): Decode useSystemAppearanceForScrollbars.
2558         * Shared/WebProcessCreationParameters.h:
2559         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2560         (API::ProcessPoolConfiguration::copy): Copy m_useSystemAppearanceForScrollbars;
2561         * UIProcess/API/APIProcessPoolConfiguration.h:
2562         * UIProcess/API/glib/WebKitWebContext.cpp:
2563         (webkitWebContextGetProperty):
2564         (webkitWebContextSetProperty):
2565         (webkitWebContextConstructed):
2566         (webkit_web_context_class_init):
2567         (webkit_web_context_set_use_system_appearance_for_scrollbars):
2568         (webkit_web_context_get_use_system_appearance_for_scrollbars):
2569         * UIProcess/API/gtk/WebKitWebContext.h:
2570         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2571         * UIProcess/glib/WebProcessPoolGLib.cpp:
2572         (WebKit::WebProcessPool::platformInitializeWebProcess): Initialize useSystemAppearanceForScrollbars parameter.
2573         * WebProcess/WebProcess.h:
2574         * WebProcess/WebProcess.messages.in:
2575         * WebProcess/glib/WebProcessGLib.cpp:
2576         (WebKit::WebProcess::platformInitializeWebProcess): Call setUseSystemAppearanceForScrollbars to set
2577         useSystemAppearanceForScrollbars parameter.
2578         (WebKit::WebProcess::setUseSystemAppearanceForScrollbars): Call ScrollbarThemeGtk::setUseSystemAppearance().
2579
2580 2020-04-14  Youenn Fablet  <youenn@apple.com>
2581
2582         WebSocketChannel should remove itself from its manager map
2583         https://bugs.webkit.org/show_bug.cgi?id=210424
2584
2585         Reviewed by Alex Christensen.
2586
2587         WebSocketChannelManager was never removing any entry from its map.
2588         To fix this, the manager is now keeping a WeakPtr to each channel.
2589         When the channel is destroyed, it will remove itself from its channel manager.
2590
2591         * WebProcess/Network/WebSocketChannel.cpp:
2592         (WebKit::WebSocketChannel::WebSocketChannel):
2593         (WebKit::WebSocketChannel::~WebSocketChannel):
2594         * WebProcess/Network/WebSocketChannel.h:
2595         * WebProcess/Network/WebSocketChannelManager.cpp:
2596         (WebKit::WebSocketChannelManager::addChannel):
2597         (WebKit::WebSocketChannelManager::createWebSocketChannel): Deleted.
2598         * WebProcess/Network/WebSocketChannelManager.h:
2599         (WebKit::WebSocketChannelManager::removeChannel):
2600         * WebProcess/Network/WebSocketProvider.cpp:
2601         (WebKit::WebSocketProvider::createWebSocketChannel):
2602
2603 2020-04-14  Youenn Fablet  <youenn@apple.com>
2604
2605         Add logging in case of WebRTC socket error
2606         https://bugs.webkit.org/show_bug.cgi?id=210428
2607
2608         Reviewed by Eric Carlson.
2609
2610         Add some release logging in case of error when sending, setting option or closing a socket.
2611
2612         * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:
2613         (WebKit::LibWebRTCSocketClient::sendTo):
2614         (WebKit::LibWebRTCSocketClient::close):
2615         (WebKit::LibWebRTCSocketClient::setOption):
2616
2617 2020-04-13  David Kilzer  <ddkilzer@apple.com>
2618
2619         Replace use of Checked<size_t, RecordOverflow> with CheckedSize
2620         <https://webkit.org/b/210461>
2621
2622         Reviewed by Mark Lam.
2623
2624         * Platform/IPC/cocoa/MachMessage.cpp:
2625         (IPC::MachMessage::messageSize):
2626         * Platform/IPC/cocoa/MachMessage.h:
2627         * WebProcess/Network/WebSocketChannel.cpp:
2628         (WebKit::WebSocketChannel::increaseBufferedAmount):
2629
2630 2020-04-13  Per Arne Vollan  <pvollan@apple.com>
2631
2632         [iOS] Update message filters in the WebContent sandbox
2633         https://bugs.webkit.org/show_bug.cgi?id=210455
2634
2635         Reviewed by Geoffrey Garen.
2636
2637         Update message filters in the WebContent sandbox on iOS with required messages.
2638
2639         No new tests, since this patch should not introduce a behavior change.
2640
2641         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2642
2643 2020-04-13  Brent Fulgham  <bfulgham@apple.com>
2644
2645         Add roblox.com to the desktop class quirks list
2646         https://bugs.webkit.org/show_bug.cgi?id=210452
2647         <rdar://problem/58859657>
2648
2649         Reviewed by Zalan Bujtas.
2650
2651         * UIProcess/ios/WebPageProxyIOS.mm:
2652         (WebKit::desktopClassBrowsingRecommendedForRequest):
2653
2654 2020-04-13  Wenson Hsieh  <wenson_hsieh@apple.com>
2655
2656         Remove the "IgnoreViewportScalingConstraints" debug WebKit feature
2657         https://bugs.webkit.org/show_bug.cgi?id=210440
2658
2659         Reviewed by Tim Horton.
2660
2661         Remove the internal WebKit2 feature; this was introduced around iOS 9 to unconditionally force pages to shrink
2662         to fit if they specified a responsive viewport, to avoid horizontal scrolling.
2663
2664         Nowadays, this behavior is instead controlled by the `-[WKWebView _allowsViewportShrinkToFit]` SPI, which
2665         ensures that this shrink-to-fit preference is updated in sync with the visible content rect update lifecycle; it
2666         is currently used by Safari to scale web pages down to fit in smaller multitasking viewports.
2667
2668         In contrast, this preference has no internal clients. Instead of maintaining two different ways for clients to
2669         control shrink-to-fit behavior, remove support for the preference and make it a no-op.
2670
2671         * Shared/WebPreferences.yaml:
2672         * UIProcess/API/C/WKPreferences.cpp:
2673         (WKPreferencesSetIgnoreViewportScalingConstraints):
2674         (WKPreferencesGetIgnoreViewportScalingConstraints):
2675         * WebProcess/WebPage/WebPage.cpp:
2676         (WebKit::WebPage::updatePreferences):
2677         * WebProcess/WebPage/WebPage.h:
2678         * WebProcess/WebPage/ios/WebPageIOS.mm:
2679
2680         Remove this redundant mechanism for shrinking web pages down to fit.
2681
2682         (WebKit::WebPage::updateVisibleContentRects):
2683
2684 2020-04-13  Per Arne Vollan  <pvollan@apple.com>
2685
2686         [iOS] Remove unused UTType swizzler code
2687         https://bugs.webkit.org/show_bug.cgi?id=210435
2688
2689         Unreviewed rollout of r258120.
2690
2691         * Shared/WebProcessCreationParameters.cpp:
2692         (WebKit::WebProcessCreationParameters::encode const):
2693         (WebKit::WebProcessCreationParameters::decode):
2694         * Shared/WebProcessCreationParameters.h:
2695         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2696         (WebKit::WebProcessPool::platformInitializeWebProcess):
2697         * WebProcess/cocoa/WebProcessCocoa.mm:
2698         (WebKit::WebProcess::platformInitializeWebProcess):
2699
2700 2020-04-13  Kate Cheney  <katherine_cheney@apple.com>
2701
2702         Turn all instances of NavigatingToAppBoundDomain into Optionals
2703         https://bugs.webkit.org/show_bug.cgi?id=210363
2704         <rdar://problem/61612861>
2705
2706         Reviewed by Brent Fulgham.
2707
2708         NavigatingToAppBoundDomain should be an Optional when passed to the
2709         Network Process to distinguish the case of an empty app-bound domain
2710         list versus an actual app-bound domain navigation. An empty list and
2711         an app-bound navigation should have the same behavior in NetworkSessionCocoa,
2712         but we will need distinguished behavior in the future.
2713
2714         * NetworkProcess/Downloads/DownloadManager.cpp:
2715         (WebKit::DownloadManager::startDownload):
2716         * NetworkProcess/Downloads/DownloadManager.h:
2717         (WebKit::DownloadManager::startDownload):
2718         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2719         (WebKit::NetworkConnectionToWebProcess::startDownload):
2720         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
2721         * NetworkProcess/NetworkConnectionToWebProcess.h:
2722         (WebKit::NetworkConnectionToWebProcess::startDownload):
2723         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2724         * NetworkProcess/NetworkLoadParameters.h:
2725         * NetworkProcess/NetworkProcess.cpp:
2726         (WebKit::NetworkProcess::preconnectTo):
2727         (WebKit::NetworkProcess::downloadRequest):
2728         * NetworkProcess/NetworkProcess.h:
2729         * NetworkProcess/NetworkProcess.messages.in:
2730         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2731         (WebKit::NetworkResourceLoadParameters::decode):
2732         * NetworkProcess/NetworkResourceLoadParameters.h:
2733         * NetworkProcess/cache/AsyncRevalidation.cpp:
2734         (WebKit::NetworkCache::AsyncRevalidation::AsyncRevalidation):
2735         * NetworkProcess/cache/AsyncRevalidation.h:
2736         * NetworkProcess/cache/NetworkCache.cpp:
2737         (WebKit::NetworkCache::Cache::startAsyncRevalidationIfNeeded):
2738         (WebKit::NetworkCache::Cache::retrieve):
2739         * NetworkProcess/cache/NetworkCache.h:
2740         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2741         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
2742         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
2743         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2744         (WebKit::NetworkCache::SpeculativeLoadManager::registerLoad):
2745         (WebKit::NetworkCache::SpeculativeLoadManager::preconnectForSubresource):
2746         (WebKit::NetworkCache::SpeculativeLoadManager::revalidateSubresource):
2747         (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
2748         (WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
2749         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
2750         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2751         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2752         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2753         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
2754         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2755         (WebKit::NetworkSessionCocoa::sessionWrapperForTask):
2756         We should treat an empty WKAppBoundDomains list like an app-bound domain
2757         navigation in the network session, so this sets
2758         NavigatingToAppBoundDomain to Yes if the Optional is WTF::nullopt.
2759
2760         (WebKit::NetworkSessionCocoa::appBoundSession): Deleted.
2761         (WebKit::NetworkSessionCocoa::isolatedSession): Deleted.
2762         (WebKit::NetworkSessionCocoa::hasIsolatedSession const): Deleted.
2763         (WebKit::NetworkSessionCocoa::clearIsolatedSessions): Deleted.
2764         (WebKit::NetworkSessionCocoa::invalidateAndCancel): Deleted.
2765         (WebKit::NetworkSessionCocoa::clearCredentials): Deleted.
2766         (WebKit::certificatesMatch): Deleted.
2767         (WebKit::NetworkSessionCocoa::allowsSpecificHTTPSCertificateForHost): Deleted.
2768         (WebKit::NetworkSessionCocoa::continueDidReceiveChallenge): Deleted.
2769         (WebKit::NetworkSessionCocoa::deviceManagementPolicyMonitor): Deleted.
2770         (WebKit::NetworkSessionCocoa::createWebSocketTask): Deleted.
2771         (WebKit::NetworkSessionCocoa::addWebSocketTask): Deleted.
2772         (WebKit::NetworkSessionCocoa::removeWebSocketTask): Deleted.
2773         (WebKit::NetworkSessionCocoa::hostNamesWithAlternativeServices const): Deleted.
2774         (WebKit::NetworkSessionCocoa::deleteAlternativeServicesForHostNames): Deleted.
2775         (WebKit::NetworkSessionCocoa::clearAlternativeServices): Deleted.
2776         * Shared/LoadParameters.h:
2777         * Shared/PolicyDecision.h:
2778         (WebKit::PolicyDecision::decode):
2779         * UIProcess/Network/NetworkProcessProxy.cpp:
2780         (WebKit::NetworkProcessProxy::preconnectTo):
2781         * UIProcess/Network/NetworkProcessProxy.h:
2782         * UIProcess/ProvisionalPageProxy.cpp:
2783         (WebKit::ProvisionalPageProxy::loadData):
2784         (WebKit::ProvisionalPageProxy::loadRequest):
2785         * UIProcess/ProvisionalPageProxy.h:
2786         * UIProcess/WebPageProxy.cpp:
2787         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
2788         (WebKit::WebPageProxy::loadDataWithNavigationShared):
2789         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
2790         Set this to WTF::nullopt instead of NavigatingToAppBoundDomain::Yes
2791         so the two cases are distinguished.
2792
2793         (WebKit::WebPageProxy::isNavigatingToAppBoundDomainTesting):
2794         * UIProcess/WebPageProxy.h:
2795         (WebKit::WebPageProxy::isNavigatingToAppBoundDomain const):
2796         * UIProcess/WebProcessPool.cpp:
2797         (WebKit::WebProcessPool::download):
2798         * WebProcess/WebPage/WebFrame.cpp:
2799         (WebKit::WebFrame::startDownload):
2800         (WebKit::WebFrame::convertMainResourceLoadToDownload):
2801         * WebProcess/WebPage/WebPage.cpp:
2802         (WebKit::WebPage::loadDataImpl):
2803         * WebProcess/WebPage/WebPage.h:
2804         (WebKit::WebPage::setIsNavigatingToAppBoundDomain):
2805         (WebKit::WebPage::isNavigatingToAppBoundDomain const):
2806
2807 2020-04-13  David Kilzer  <ddkilzer@apple.com>
2808
2809         Fix clang static analyzer warnings about unused instance variables in WebIconDatabase, WKView
2810         <https://webkit.org/b/210427>
2811
2812         Reviewed by Alex Christensen.
2813
2814         * UIProcess/API/Cocoa/WKView.h:
2815         (WKView._unused):
2816         - Use WK_UNUSED_INSTANCE_VARIABLE to ignore unused instance
2817           variable.
2818
2819 2020-04-13  David Kilzer  <ddkilzer@apple.com>
2820
2821         Add WARN_UNUSED_RETURN to decode methods in Source/WebKit
2822         <https://webkit.org/b/210423>
2823         <rdar://problem/61715582>
2824
2825         Reviewed by Alex Christensen.
2826
2827         * GPUProcess/GPUProcessCreationParameters.h:
2828         * NetworkProcess/Downloads/DownloadID.h:
2829         (IPC::ArgumentCoder<WebKit::DownloadID>::decode):
2830         * NetworkProcess/NetworkProcessCreationParameters.h:
2831         * NetworkProcess/cache/NetworkCacheKey.h:
2832         (WebKit::NetworkCache::DataKey::decode):
2833         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2834         (WebKit::NetworkCache::decodeRecordMetaData):
2835         (WebKit::NetworkCache::decodeRecordHeader):
2836         * Platform/SharedMemory.h:
2837         * PluginProcess/PluginCreationParameters.h:
2838         * Shared/API/APIData.h:
2839         * Shared/API/APIError.h:
2840         * Shared/API/APIFrameHandle.h:
2841         * Shared/API/APIGeometry.h:
2842         * Shared/API/APINumber.h:
2843         (API::Number::decode):
2844         * Shared/API/APIPageGroupHandle.h:
2845         * Shared/API/APIPageHandle.h:
2846         * Shared/API/APIURL.h:
2847         (API::URL::decode):
2848         * Shared/API/APIURLRequest.h:
2849         * Shared/API/APIURLResponse.h:
2850         * Shared/API/Cocoa/RemoteObjectInvocation.h:
2851         * Shared/Cocoa/ArgumentCodersCocoa.h:
2852         * Shared/ContextMenuContextData.h:
2853         * Shared/Databases/IndexedDB/WebIDBResult.h:
2854         * Shared/EditorState.h:
2855         * Shared/FocusedElementInformation.h:
2856         * Shared/FontInfo.h:
2857         * Shared/LayerTreeContext.h:
2858         * Shared/LoadParameters.h:
2859         * Shared/OptionalCallbackID.h:
2860         (WebKit::OptionalCallbackID::decode):
2861         * Shared/PlatformPopupMenuData.h:
2862         * Shared/Plugins/PluginProcessCreationParameters.h:
2863         * Shared/PrintInfo.h:
2864         * Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
2865         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
2866         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2867         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.h:
2868         * Shared/SessionState.h:
2869         * Shared/ShareableBitmap.h:
2870         * Shared/ShareableResource.h:
2871         * Shared/TouchBarMenuData.h:
2872         * Shared/UpdateInfo.h:
2873         * Shared/VisibleContentRectUpdateInfo.h:
2874         * Shared/WebEvent.h:
2875         * Shared/WebHitTestResultData.h:
2876         * Shared/WebNavigationDataStore.h:
2877         (WebKit::WebNavigationDataStore::decode):
2878         * Shared/WebPreferencesStore.h:
2879         * Shared/WebProcessCreationParameters.h:
2880         * Shared/WebsiteData/WebsiteData.h:
2881         * Shared/cf/ArgumentCodersCF.h:
2882         * Shared/gtk/ArgumentCodersGtk.cpp:
2883         (IPC::decodeImage):
2884         (IPC::decodeGKeyFile):
2885         * Shared/gtk/ArgumentCodersGtk.h:
2886         * Shared/gtk/WebSelectionData.h:
2887         * Shared/ios/InteractionInformationAtPosition.h:
2888         * Shared/ios/InteractionInformationRequest.h:
2889         * Shared/mac/ColorSpaceData.h:
2890         * Shared/mac/ObjCObjectGraph.h:
2891         * Shared/mac/SecItemRequestData.h:
2892         * Shared/mac/WebGestureEvent.h:
2893         * UIProcess/Cocoa/SessionStateCoding.h:
2894         * UIProcess/LegacySessionStateCoding.h:
2895         * UIProcess/mac/LegacySessionStateCoding.cpp:
2896         (WebKit::decodeSessionHistoryEntryData):
2897         (WebKit::decodeSessionHistoryEntry):
2898         (WebKit::decodeSessionHistoryEntries):
2899         (WebKit::decodeV0SessionHistory):
2900         (WebKit::decodeV1SessionHistory):
2901         (WebKit::decodeSessionHistory):
2902         * WebProcess/GPU/GPUProcessConnectionInfo.h:
2903         (WebKit::GPUProcessConnectionInfo::decode):
2904         * WebProcess/GPU/media/RemoteAudioBusData.h:
2905         (WebKit::RemoteAudioBusData::decode):
2906         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h:
2907         * WebProcess/Network/NetworkProcessConnectionInfo.h:
2908         (WebKit::NetworkProcessConnectionInfo::decode):
2909         * WebProcess/Plugins/Plugin.h:
2910         - Add WARN_UNUSED_RETURN to all decode functions.
2911
2912 2020-04-13  Per Arne Vollan  <pvollan@apple.com>
2913
2914         [iOS] Add message filtering to all iokit open rules
2915         https://bugs.webkit.org/show_bug.cgi?id=210352
2916
2917         Reviewed by Sam Weinig.
2918
2919         Apply message filtering with reports and telemetry to all iokit-open rules in the WebContent process' sandbox on iOS
2920         to gain a better understanding of which iokit-open rules we can investigate.
2921
2922         No new tests, since adding telemetry will not introduce a change in behavior.
2923
2924         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2925
2926 2020-04-13  Joonghun Park  <jh718.park@samsung.com>
2927
2928         Unreviewed. Remove redundant move in return statement.
2929
2930         Return statement already returns rvalue,
2931         so we don't need move here.
2932
2933         This patch removes the build warning below since r259922.
2934         warning: redundant move in return statement [-Wredundant-move]
2935
2936         * NetworkProcess/cache/NetworkCacheCoders.cpp:
2937         (WTF::Persistence::Coder<WebCore::HTTPHeaderMap>::decode):
2938
2939 2020-04-13  Michael Catanzaro  <mcatanzaro@gnome.org>
2940
2941         Fix various build warnings
2942         https://bugs.webkit.org/show_bug.cgi?id=210429
2943
2944         Reviewed by Mark Lam.
2945
2946         Use private-code instead of deprecated code command to build the Wayland protocol.
2947
2948         * PlatformGTK.cmake:
2949
2950 2020-04-12  Darin Adler  <darin@apple.com>
2951
2952         Fix some strange uses of start/endOfDocument
2953         https://bugs.webkit.org/show_bug.cgi?id=210408
2954
2955         Reviewed by Wenson Hsieh.
2956
2957         * WebProcess/WebPage/ios/WebPageIOS.mm:
2958         (WebKit::WebPage::replaceDictatedText): Pass the document to startOfDocument,
2959         rather than getting the documentelement, because the function works on any
2960         node, so there's no reason to write code to get a particular one.
2961         (WebKit::WebPage::applyAutocorrectionInternal): Ditto.
2962
2963 2020-04-12  Carlos Garcia Campos  <cgarcia@igalia.com>
2964
2965         [GTK] Use gdk_window_move_to_rect() to position popup menus
2966         https://bugs.webkit.org/show_bug.cgi?id=210069
2967
2968         Reviewed by Michael Catanzaro.
2969
2970         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
2971         (WebKit::WebPopupMenuProxyGtk::showPopupMenu):
2972
2973 2020-04-12  Carlos Garcia Campos  <cgarcia@igalia.com>
2974
2975         [GTK] Page is not drawn with PSON, hardware acceleration and address typed in URL bar
2976         https://bugs.webkit.org/show_bug.cgi?id=208091
2977
2978         Reviewed by Michael Catanzaro.
2979
2980         This happens only when accelerated compositing mode policy is set to always. In this case, the
2981         bindSurfaceToWebPage wayland message is received before the WebPageProxy has updated the web page identifier. We
2982         should always check if there's a provisional page and get its web page identifier.
2983
2984         * UIProcess/gtk/WaylandCompositor.cpp:
2985         (WebKit::WaylandCompositor::bindSurfaceToWebPage):
2986
2987 2020-04-12  Carlos Garcia Campos  <cgarcia@igalia.com>
2988
2989         [GTK][PSON] Crash in WaylandCompositor::Surface destructor with USE_WPE_RENDERER disabled
2990         https://bugs.webkit.org/show_bug.cgi?id=209345
2991
2992         Reviewed by Michael Catanzaro.
2993
2994         In case of PSON the web page identifier can change fo the same web page proxy. When swapping processes the new
2995         web page calls bindSurfaceToWebPage(), but we still have the web page proxy bound to the previous surface. We
2996         just need to unbind the current surface before binding the new one.
2997
2998         * UIProcess/gtk/WaylandCompositor.cpp:
2999         (WebKit::WaylandCompositor::bindSurfaceToWebPage):
3000
3001 2020-04-11  David Kilzer  <ddkilzer@apple.com>
3002
3003         Follow-up: Add WARN_UNUSED_RETURN to decode methods in Source/WebKit/Platform/IPC
3004         <https://webkit.org/b/210316>
3005         <rdar://problem/61559305>
3006
3007         Changes based on feedback from Alex Christensen and Darin Adler:
3008         - Remove WARN_UNUSED_RETURN from methods returning Optional<>.
3009         - Place WARN_UNUSED_RETURN consistently before the return type.
3010
3011         * Platform/IPC/ArgumentCoder.h:
3012         * Platform/IPC/ArgumentCoders.cpp:
3013         * Platform/IPC/ArgumentCoders.h:
3014         (IPC::ArgumentCoder<OptionSet<T>>::decode):
3015         (IPC::ArgumentCoder<Optional<T>>::decode):
3016         (IPC::ArgumentCoder<Box<T>>::decode):
3017         (IPC::TupleDecoderImpl::decode):
3018         (IPC::TupleDecoderImpl<Type>::decode):
3019         (IPC::TupleDecoder::decode):
3020         (IPC::TupleDecoder<0>::decode):
3021         (IPC::VariantCoder::decode):
3022         * Platform/IPC/Attachment.h:
3023         * Platform/IPC/DataReference.h:
3024         * Platform/IPC/Decoder.h:
3025         * Platform/IPC/FormDataReference.h:
3026         (IPC::FormDataReference::decode):
3027         * Platform/IPC/ImageDataReference.h:
3028         (IPC::ImageDataReference::decode):
3029         * Platform/IPC/SharedBufferDataReference.h:
3030         (IPC::SharedBufferDataReference::decode):
3031         * Platform/IPC/StringReference.h:
3032
3033 2020-04-11  David Kilzer  <ddkilzer@apple.com>
3034
3035         Follow-up: Add WARN_UNUSED_RETURN to decode methods in WebCoreArgumentCoders
3036         <https://webkit.org/b/210322>
3037         <rdar://problem/61565148>
3038
3039         Changes based on feedback from Alex Christensen and Darin Adler:
3040         - Remove WARN_UNUSED_RETURN from methods returning Optional<>.
3041         - Place WARN_UNUSED_RETURN consistently before the return type.
3042
3043         * Shared/WebCoreArgumentCoders.cpp:
3044         * Shared/WebCoreArgumentCoders.h:
3045
3046 2020-04-11  Daniel Bates  <dabates@apple.com>
3047
3048         Add text interaction delegate functions
3049         https://bugs.webkit.org/show_bug.cgi?id=210395
3050         <rdar://problem/61650549>
3051
3052         Reviewed by Wenson Hsieh.
3053
3054         Implement some delegate callbacks that are used to toggle selection reveal,
3055         placeholder text, and selection assistance.
3056
3057         * UIProcess/ios/WKContentViewInteraction.h:
3058         * UIProcess/ios/WKContentViewInteraction.mm:
3059         (-[WKContentView _willBeginTextInteractionInTextInputContext:]): Added.
3060         (-[WKContentView _didFinishTextInteractionInTextInputContext:]): Added.
3061
3062 2020-04-10  Darin Adler  <darin@apple.com>
3063
3064         Move more from live range to SimpleRange: callers of absoluteTextRects
3065         https://bugs.webkit.org/show_bug.cgi?id=210369
3066
3067         Reviewed by Anders Carlsson.
3068
3069         * WebProcess/InjectedBundle/API/mac/WKDOMNode.mm:
3070         (-[WKDOMNode textRects]): Moved implementation here. There's no reason for Node
3071         to have a textRects function, since it's a layout/rendering operation and a
3072         single node is also an unusual special case, but for now at least we will keep
3073         this legacy method.
3074         * WebProcess/InjectedBundle/API/mac/WKDOMRange.mm:
3075         (-[WKDOMRange textRects]): Changed to call RenderObject::absoluteTextRects
3076         instead of Range::absoluteTextRects.
3077
3078         * WebProcess/WebPage/FindController.cpp:
3079         (WebKit::FindController::updateFindUIAfterPageScroll): Use
3080         RenderObject::absoluteTextRects instead of Range::absoluteRectRects.
3081         (WebKit::FindController::findStringMatches): Ditto.
3082
3083 2020-04-10  Pablo Saavedra  <psaavedra@igalia.com>
3084
3085         [GTK][WPE] Replace fopen/fclose by fopen/fseek functions in MemoryPressureMonitor
3086         https://bugs.webkit.org/show_bug.cgi?id=209942
3087
3088         Reviewed by Adrian Perez de Castro.
3089
3090         Replacing the open()/close() logic to get the data from /proc/meminfo,
3091         /proc/self/cgroup, ... with a new logic where the files are just
3092         opened once and we just perform a seek to the initial position of
3093         of an unbuffered file.
3094
3095         Also refactoring of some logic:
3096
3097         - Added the CGroupMemoryController class what encapsulates the logic
3098           to calculate the the total memory and the memory usage with
3099           cgroups.
3100         - CGroupMemoryController encpasulates the FILE pointers to the
3101           relative files to cgroups.
3102         - The memInfoFile, zoneInfoFile and cgroupControllerFile are now
3103           opened once in the Thread::create() invoked by the
3104           MemoryPressureMonitor::start().
3105
3106         * UIProcess/linux/MemoryPressureMonitor.cpp:
3107         (WebKit::lowWatermarkPages):
3108         (WebKit::calculateMemoryAvailable):
3109         (WebKit::getCgroupFile):
3110         (WebKit::getCgroupControllerPath):
3111         (WebKit::systemMemoryUsedAsPercentage):
3112         (WebKit::MemoryPressureMonitor::start):
3113         (WebKit::CGroupMemoryController::setMemoryControllerPath):
3114         (WebKit::CGroupMemoryController::disposeMemoryController):
3115         (WebKit::CGroupMemoryController::getCgroupFileValue):
3116         (WebKit::CGroupMemoryController::getMemoryTotalWithCgroup):
3117         (WebKit::CGroupMemoryController::getMemoryUsageWithCgroup):
3118         (WebKit::getCgroupFileValue): Deleted.
3119         (WebKit::getMemoryTotalWithCgroup): Deleted.
3120         (WebKit::getMemoryUsageWithCgroup): Deleted.
3121         * UIProcess/linux/MemoryPressureMonitor.h:
3122         (WebKit::CGroupMemoryController::isActive):
3123         (WebKit::CGroupMemoryController::~CGroupMemoryController):
3124
3125 2020-04-10  Alex Christensen  <achristensen@webkit.org>
3126
3127         PersistentCoders should use modern decoding syntax
3128         https://bugs.webkit.org/show_bug.cgi?id=207497
3129
3130         Reviewed by Darin Adler.
3131
3132         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
3133         (WebKit::CacheStorage::decodeDOMCacheRecord):
3134         (WebKit::CacheStorage::Cache::decodeRecordHeader):
3135         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
3136         (WebKit::CacheStorage::Caches::readOrigin):
3137         (WebKit::CacheStorage::decodeCachesNames):
3138         * NetworkProcess/cache/NetworkCacheCoders.cpp:
3139         (WTF::Persistence::Coder<WebCore::HTTPHeaderMap>::decode):
3140         * NetworkProcess/cache/NetworkCacheEntry.cpp:
3141         (WebKit::NetworkCache::Entry::decodeStorageRecord):
3142         * NetworkProcess/cache/NetworkCacheKey.cpp:
3143         (WebKit::NetworkCache::Key::decode):
3144         * NetworkProcess/cache/NetworkCacheKey.h:
3145         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3146         (WebKit::NetworkCache::decodeRecordMetaData):
3147         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
3148         (WebKit::NetworkCache::SubresourceInfo::encode const):
3149         (WebKit::NetworkCache::SubresourceInfo::decode):
3150         (WebKit::NetworkCache::SubresourcesEntry::decodeStorageRecord):
3151         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
3152         * Shared/UserData.cpp:
3153         (WebKit::UserData::decode):
3154         * UIProcess/API/APIContentRuleListStore.cpp:
3155         (API::decodeContentRuleListMetaData):
3156
3157 2020-04-10  Devin Rousso  <drousso@apple.com>
3158
3159         Web Inspector: add `broadcastConsoleMessage` calls for new ITPDebug logs after r259275
3160         https://bugs.webkit.org/show_bug.cgi?id=210362
3161
3162         Reviewed by John Wilander.
3163
3164         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3165         (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation):
3166         (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor):
3167         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3168         (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
3169         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor):
3170
3171 2020-04-10  Chris Dumez  <cdumez@apple.com>
3172
3173         [IPC Hardening] WebHitTestResultData IPC decoder should validate imageSharedMemory / imageSize
3174         https://bugs.webkit.org/show_bug.cgi?id=210361
3175         <rdar://problem/60758280>
3176
3177         Reviewed by Geoffrey Garen.
3178
3179         WebHitTestResultData IPC decoder should validate imageSharedMemory / imageSize to make sure they are consistent.
3180
3181         * Shared/WebHitTestResultData.cpp:
3182         (WebKit::WebHitTestResultData::decode):
3183
3184 2020-04-10  Alex Christensen  <achristensen@webkit.org>
3185
3186         Add SPI to handle proxy authentication and require secure proxy connections
3187         https://bugs.webkit.org/show_bug.cgi?id=210343
3188         <rdar://problem/61546396> <rdar://problem/61546519> and <rdar://problem/61546658>
3189
3190         Reviewed by Geoffrey Garen.
3191
3192         I also use WKWebViewConfiguration.connectionProxyDictionary instead of CFURLRequestSetProxySettings
3193         to set proxy settings.  The equivalence of this behavior is covered by the API tests.
3194
3195         * NetworkProcess/NetworkSessionCreationParameters.cpp:
3196         (WebKit::NetworkSessionCreationParameters::encode const):
3197         (WebKit::NetworkSessionCreationParameters::decode):
3198         * NetworkProcess/NetworkSessionCreationParameters.h:
3199         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3200         (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
3201         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
3202         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3203         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
3204         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3205         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
3206         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
3207         (-[_WKWebsiteDataStoreConfiguration preventsSystemHTTPProxyAuthentication]):
3208         (-[_WKWebsiteDataStoreConfiguration setPreventsSystemHTTPProxyAuthentication:]):
3209         (-[_WKWebsiteDataStoreConfiguration requiresSecureHTTPSProxyConnection]):
3210         (-[_WKWebsiteDataStoreConfiguration setRequiresSecureHTTPSProxyConnection:]):
3211         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3212         (WebKit::WebsiteDataStore::parameters):
3213         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
3214         (WebKit::WebsiteDataStoreConfiguration::copy const):
3215         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
3216         (WebKit::WebsiteDataStoreConfiguration::preventsSystemHTTPProxyAuthentication const):
3217         (WebKit::WebsiteDataStoreConfiguration::setPreventsSystemHTTPProxyAuthentication):
3218         (WebKit::WebsiteDataStoreConfiguration::requiresSecureHTTPSProxyConnection const):
3219         (WebKit::WebsiteDataStoreConfiguration::setRequiresSecureHTTPSProxyConnection):
3220
3221 2020-04-10  Chris Dumez  <cdumez@apple.com>
3222
3223         [IPC Hardening] WebDeviceOrientationAndMotionAccessController::shouldAllowAccess() should not crash on invalid input
3224         https://bugs.webkit.org/show_bug.cgi?id=210359
3225         <rdar://problem/60092453>
3226
3227         Reviewed by Geoffrey Garen.
3228
3229         Make sure the security origin is a valid HashMap key before trying to do a HashMap lookup.
3230         The security origin is coming from IPC and thus cannot be trusted.
3231
3232         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.cpp:
3233         (WebKit::WebDeviceOrientationAndMotionAccessController::cachedDeviceOrientationPermission const):
3234
3235 2020-04-10  John Wilander  <wilander@apple.com>
3236
3237         Add capability to opt in specific domains into SameSite=strict bounce tracking protection
3238         https://bugs.webkit.org/show_bug.cgi?id=210347
3239         <rdar://problem/61593323>
3240
3241         Reviewed by Brent Fulgham.
3242
3243         This change adds an additional opt-in condition to the shouldEnforceSameSiteStrictFor()
3244         functions in both ResourceLoadStatisticsMemoryStore and ResourceLoadStatisticsDatabaseStore.
3245
3246         No new tests. This adds domain specific logic, quirk-style. The logFrameNavigation()
3247         changes are covered by existing tests.
3248
3249         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3250         (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation):
3251             Now only captures real redirects for the purposes of the SameSite=strict rule.
3252         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldEnforceSameSiteStrictFor):
3253         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3254         (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
3255             Now only captures real redirects for the purposes of the SameSite=strict rule.
3256         (WebKit::ResourceLoadStatisticsMemoryStore::shouldEnforceSameSiteStrictFor):
3257         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor):
3258             Removed stray newline.
3259         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
3260         (WebKit::ResourceLoadStatisticsStore::shouldEnforceSameSiteStrictForSpecificDomain const):
3261            The new function with domains to subject to the new rule.
3262         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
3263
3264 2020-04-10  Chris Dumez  <cdumez@apple.com>
3265
3266         First render after a process swap does not use accelerated rendering
3267         https://bugs.webkit.org/show_bug.cgi?id=210297
3268         <rdar://problem/61432515>
3269
3270         Reviewed by Antti Koivisto.
3271
3272         To prevent flashing on navigation when process-swapping, we were delaying the
3273         DrawingAreaProxy::EnterAcceleratedCompositingMode IPC message from the WebProcess
3274         to the UIProcess, until the new page is ready to display. The reason we did this
3275         is that the EnterAcceleratedCompositingMode IPC message ends up setting the root
3276         CALayer so the new content would become visible on screen. However, another side
3277         effect of this is that we would also delay the point until which we get
3278         accelerated rendering, which would negatively impact early page load performance.
3279
3280         To address the issue, the following changes were made:
3281         1. We no longer delay the DrawingAreaProxy::EnterAcceleratedCompositingMode IPC.
3282            In non process-swap cases, we send it as soon as the DrawingArea is constructed.
3283            In process-swap cases, we send it as soon as we commit the load since this is
3284            when the provisional drawing area gets committed and happens before we have
3285            any content to paint.
3286         2. In the UIProcess, when we get the DrawingAreaProxy::EnterAcceleratedCompositingMode
3287            IPC and we already have a root layer, we add the new one behind the existing one
3288            instead of replacing the existing one. As a result, the new layer will get
3289            accelerated compositing but will not be visible on screen yet.
3290         3. Introduce a new DrawingAreaProxy::DidFirstLayerFlush IPC which gets send at the
3291            point where we used to send the EnterAcceleratedCompositingMode IPC, meaning where
3292            the new content is ready to display. When the UIProcess receives this IPC, it
3293            actually replaces the root layer with the new layer so that the new content visible.
3294
3295         After this patch, our CALayers get accelerated compositing right away after a
3296         process-swap but we still do not see any blank-flashing on navigation.
3297
3298         * UIProcess/Cocoa/WebViewImpl.h:
3299         * UIProcess/Cocoa/WebViewImpl.mm:
3300         (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer):
3301         (WebKit::WebViewImpl::setAcceleratedCompositingRootLayerAfterFlush):
3302         * UIProcess/DrawingAreaProxy.h:
3303         (WebKit::DrawingAreaProxy::didFirstLayerFlush):
3304         * UIProcess/DrawingAreaProxy.messages.in:
3305         * UIProcess/PageClient.h:
3306         (WebKit::PageClient::didFirstLayerFlush):
3307         * UIProcess/SuspendedPageProxy.cpp:
3308         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
3309         (WebKit::SuspendedPageProxy::pageDidFirstLayerFlush):
3310         (WebKit::SuspendedPageProxy::closeWithoutFlashing):
3311         * UIProcess/SuspendedPageProxy.h:
3312         * UIProcess/WebPageProxy.cpp:
3313         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
3314         (WebKit::WebPageProxy::commitProvisionalPage):
3315         * UIProcess/WebPageProxy.h:
3316         * UIProcess/mac/PageClientImplMac.h:
3317         * UIProcess/mac/PageClientImplMac.mm:
3318         (WebKit::PageClientImpl::didFirstLayerFlush):
3319         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
3320         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
3321         (WebKit::TiledCoreAnimationDrawingAreaProxy::didFirstLayerFlush):
3322         * WebProcess/WebPage/DrawingArea.h:
3323         (WebKit::DrawingArea::sendEnterAcceleratedCompositingModeIfNeeded):
3324         * WebProcess/WebPage/WebPage.cpp:
3325         (WebKit::WebPage::didCommitLoad):
3326         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
3327         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3328         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
3329         (WebKit::TiledCoreAnimationDrawingArea::sendDidFirstLayerFlushIfNeeded):
3330         (WebKit::TiledCoreAnimationDrawingArea::sendEnterAcceleratedCompositingModeIfNeeded):
3331         (WebKit::TiledCoreAnimationDrawingArea::updateRendering):
3332
3333 2020-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
3334
3335         [iOS] Unable to select text by tap-hold or double tap-hold when allowsLinkPreview property is set to NO
3336         https://bugs.webkit.org/show_bug.cgi?id=210191
3337         <rdar://problem/60454016>
3338
3339         Reviewed by Tim Horton.
3340
3341         In iOS 13.4, UIWKTextInteractionAssistant no longer uses the (misleadingly-named) "force press" gesture to drive
3342         text selection when performing a long press. Instead, it now uses the UIVariableDelayLoupeGestureRecognizer,
3343         i.e. the text interaction assistant's loupe gesture recognizer.
3344
3345         The highlight long press gesture, which is only enabled when `allowsLinkPreview` is set to `NO`, is currently
3346         allowed to recognize alongside the force press gesture but not the loupe gesture. This means that when link
3347         previews are disabled, we'll end up allowing the highlight long press gesture to prevent text selection. A
3348         similar issue already exists for the tap-and-half gesture as well.
3349
3350         To fix this, we allow the highlight long press gesture to recognize alongside both gestures.
3351
3352         Test: editing/selection/ios/select-text-with-link-preview-disabled.html
3353
3354         * UIProcess/ios/WKContentViewInteraction.mm:
3355         (tapAndAHalfRecognizerClass):
3356
3357         While UITapAndAHalfRecognizer is declared in a UIKit private header, it is (perhaps unintentionally) not
3358         exported, so attempting to call +[UITapAndAHalfRecognizer class] leads to a linker error. Work around this by
3359         dynamically grabbing the `Class` from the class name.
3360
3361         The tap and half gesture recognizer is private in UIKit and only used for text interaction gestures, so we
3362         always want the highlight long press gesture to be able to recognize alongside it.
3363
3364         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
3365
3366         Also clean up some existing code by replacing `.get().`s with Objective-C bracket operators.
3367
3368 2020-04-10  Brent Fulgham  <bfulgham@apple.com>
3369
3370         Switch unused IOKit classes from allow-with-report to deny-with-report
3371         https://bugs.webkit.org/show_bug.cgi?id=210136
3372         <rdar://problem/61403216>
3373
3374         Reviewed by Per Arne Vollan.
3375
3376         After tracking telemetry for several weeks, we can now safely switch the default state
3377         of a number of IOKit classes from 'allow with telemetry' to 'deny with telemetry'.
3378
3379         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3380         * WebProcess/com.apple.WebProcess.sb.in:
3381
3382 2020-04-10  Daniel Bates  <dabates@apple.com>
3383
3384         mayContainEditableElementsInRect() can terminate search once the search rect is wholly contained inside a layer
3385         https://bugs.webkit.org/show_bug.cgi?id=210340
3386
3387         Reviewed by Simon Fraser.
3388
3389         Reduce false positives. This makes mayContainEditableElementsInRect() return false when the
3390         search rect is wholly contained inside a higher paint order layer with no editable elements
3391         that overlaps a layer with editable elements.
3392
3393         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
3394         (WebKit::mayContainEditableElementsInRect):
3395
3396 2020-04-10  Per Arne Vollan  <pvollan@apple.com>
3397
3398         [iOS] Add routines to message filter in the WebContent sandbox
3399         https://bugs.webkit.org/show_bug.cgi?id=210338
3400
3401         Reviewed by Geoffrey Garen.
3402
3403         Add required routines to the message filter in the WebContent sandbox on iOS. These have been observed
3404         being in use during local testing.
3405
3406         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3407
3408 2020-04-10  Simon Fraser  <simon.fraser@apple.com>
3409
3410         Reset view navigation gesture state between tests
3411         https://bugs.webkit.org/show_bug.cgi?id=210283
3412
3413         Re-land r259818 with a null-check on m_webPageProxyForBackForwardListForCurrentSwipe.
3414
3415         * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
3416         * UIProcess/API/Cocoa/WKWebViewTesting.mm:
3417         (-[WKWebView _resetNavigationGestureStateForTesting]):
3418         * UIProcess/ViewGestureController.cpp: