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