[LFC][Floats] FloatAvoider does not need to keep a pointer to Layout::Box around.
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2020-12-04  Kate Cheney  <katherine_cheney@apple.com>
2
3         Create API to enable/disable text interaction gestures in WKWebView
4         https://bugs.webkit.org/show_bug.cgi?id=217784
5         <rdar://problem/63406241>
6
7         Reviewed by Wenson Hsieh.
8
9         Create a new API to disable text interaction gestures in a WKWebView.
10         We have SPI for this for iOS, but it could be useful to other WebKit
11         clients and on macOS. Add the API to WKPreferences, instead of
12         WKWebViewConfiguration, so it can be changed on the fly.
13
14         Deprecate the SPI.
15
16         * Shared/WebPageCreationParameters.cpp:
17         (WebKit::WebPageCreationParameters::encode const):
18         (WebKit::WebPageCreationParameters::decode):
19         * Shared/WebPageCreationParameters.h:
20         * UIProcess/API/Cocoa/WKPreferences.h:
21         * UIProcess/API/Cocoa/WKPreferences.mm:
22         (-[WKPreferences encodeWithCoder:]):
23         (-[WKPreferences initWithCoder:]):
24         (-[WKPreferences textInteractionEnabled]):
25         (-[WKPreferences setTextInteractionEnabled:]):
26         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
27         (-[WKWebViewConfiguration init]):
28         (-[WKWebViewConfiguration encodeWithCoder:]):
29         (-[WKWebViewConfiguration initWithCoder:]):
30         (-[WKWebViewConfiguration copyWithZone:]):
31         (-[WKWebViewConfiguration _textInteractionEnabled]):
32         (-[WKWebViewConfiguration _setTextInteractionEnabled:]):
33         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
34         * UIProcess/WebPageProxy.cpp:
35         (WebKit::WebPageProxy::creationParameters):
36         * UIProcess/ios/WKContentViewInteraction.mm:
37         (-[WKContentView hasSelectablePositionAtPoint:]):
38         (-[WKContentView pointIsNearMarkedText:]):
39         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
40         (-[WKContentView _cascadeInteractionTintColor]):
41         (-[WKContentView selectForWebView:]):
42         (-[WKContentView selectAllForWebView:]):
43         Add check for textInteractionEnabled in these select*
44         functions because disabling text interaction should disable selection
45         in WKWebView.
46
47         * WebProcess/WebPage/WebPage.cpp:
48         Update the textInteractionEnabled value in the page when
49         preferences are updated.
50
51         (WebKit::WebPage::updatePreferences):
52
53 2020-12-04  Adam Roben  <aroben@apple.com>
54
55         More FALLBACK_PLATFORM adoption
56         https://bugs.webkit.org/show_bug.cgi?id=219545
57
58         Reviewed by Tim Horton.
59
60         * Configurations/SDKVariant.xcconfig:
61         WK_EMPTY_$(THIS_IS_NOT_EMPTY) evaluates to the empty string, not to
62         NO.
63
64 2020-12-04  Said Abou-Hallawa  <said@apple.com>
65
66         [GPU Process] Share the NativeImage with GPU Process through a ShareableBitmap
67         https://bugs.webkit.org/show_bug.cgi?id=218934
68
69         Reviewed by Tim Horton.
70
71         Instead of relying on the IPC coders to transfer the NativeImage to the
72         GPUP, we are going to move this logic to RemoteResourceCacheProxy and
73         RemoteRenderingBackend. The NativeImage will be transfered as a handle of
74         ShareableBitamp and a renderingResourceIdentifier.
75
76         * GPUProcess/graphics/RemoteRenderingBackend.cpp:
77         (WebKit::RemoteRenderingBackend::cacheNativeImage):
78         * GPUProcess/graphics/RemoteRenderingBackend.h:
79         * GPUProcess/graphics/RemoteRenderingBackend.messages.in:
80         * Shared/ShareableBitmap.h:
81         (WebKit::ShareableBitmap::createPlatformImage):
82         Add this helper function and avoid adding directive code in many places.
83
84         * Shared/WebCoreArgumentCoders.cpp:
85         (IPC::ArgumentCoder<Ref<NativeImage>>::encode): Deleted.
86         (IPC::ArgumentCoder<Ref<NativeImage>>::decode): Deleted.
87         * Shared/WebCoreArgumentCoders.h:
88         * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
89         (WebKit::ImageBufferShareableBitmapBackend::copyNativeImage const):
90         * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
91         (WebKit::RemoteRenderingBackendProxy::cacheNativeImage):
92         * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
93         * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
94         (WebKit::createShareableBitmapFromNativeImage):
95         (WebKit::RemoteResourceCacheProxy::cacheNativeImage):
96
97 2020-12-04  Per Arne Vollan  <pvollan@apple.com>
98
99         [macOS] Deny mach-lookup to the service 'com.apple.print.normalizerd' in the WebContent process
100         https://bugs.webkit.org/show_bug.cgi?id=219541
101         <rdar://problem/68878604>
102
103         Reviewed by Darin Adler.
104
105         On macOS, deny mach-lookup to the service 'com.apple.print.normalizerd' in the WebContent process, since there are no
106         reports of this being used.
107
108         No new tests, since the result will depend on the macOS version.
109
110         * WebProcess/com.apple.WebProcess.sb.in:
111
112 2020-12-04  Devin Rousso  <drousso@apple.com>
113
114         [iOS] Provide a context menu action to perform accessibility image extraction
115         https://bugs.webkit.org/show_bug.cgi?id=219524
116         <rdar://problem/69969613>
117
118         Reviewed by Wenson Hsieh.
119
120         * UIProcess/API/Cocoa/_WKElementAction.h:
121         * UIProcess/API/Cocoa/_WKElementAction.mm:
122         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
123         (+[_WKElementAction imageForElementActionType:]):
124         (elementActionTypeToUIActionIdentifier):
125         (uiActionIdentifierToElementActionType):
126         Add a new `_WKElementActionTypeImageExtraction` enum type with a default icon and title.
127
128         * UIProcess/ios/WKActionSheetAssistant.h:
129         * UIProcess/ios/WKActionSheetAssistant.mm:
130         (-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
131         (-[WKActionSheetAssistant defaultActionsForImageSheet:]):
132         (-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]):
133         If the `WKActionSheetAssistantDelegate` allows it, add a `_WKElementActionTypeImageExtraction`
134         action for images (including those inside links). Call out to the `WKActionSheetAssistantDelegate`
135         when handling the action.
136
137 2020-12-04  Peng Liu  <peng.liu6@apple.com>
138
139         [MSE] Move track buffer management from SourceBuffer to SourceBufferPrivate
140         https://bugs.webkit.org/show_bug.cgi?id=219332
141
142         Reviewed by Daniel Bates.
143
144         Update `SourceBufferPrivateRemote` and `RemoteSourceBufferProxy` because of
145         the changes on `SourceBufferPrivate` and `SourceBufferPrivateClient`.
146
147         * GPUProcess/media/RemoteSourceBufferProxy.cpp:
148         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateAppendError):
149         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDurationChanged):
150         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidParseSample):
151         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidDropSample):
152         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateStreamEndedWithDecodeError):
153         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHasAudio const):
154         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHasVideo const):
155         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveSample): Deleted.
156         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateReenqueSamples): Deleted.
157         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidBecomeReadyForMoreSamples): Deleted.
158         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateFastSeekTimeForMediaTime): Deleted.
159         * GPUProcess/media/RemoteSourceBufferProxy.h:
160         * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
161         (WebKit::SourceBufferPrivateRemote::setClient): Deleted.
162         * WebProcess/GPU/media/SourceBufferPrivateRemote.h:
163
164 2020-12-04  Kimmo Kinnunen  <kkinnunen@apple.com>
165
166         GPU Process WindowServer blocking prevents CGL
167         https://bugs.webkit.org/show_bug.cgi?id=219431
168         <rdar://problem/71893390>
169
170         Reviewed by Per Arne Vollan.
171
172         Mark the GPU process as NSSupportsAutomaticGraphicsSwitching.
173         This allows CGL to work in cases when WindowServer connection
174         is blocked.
175
176         No new tests, makes the future WebGL in GPU process work.
177
178         * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-OSX.plist:
179
180 2020-12-03  Simon Fraser  <simon.fraser@apple.com>
181
182         Only the first wheel event in a gesture should be cancelable
183         https://bugs.webkit.org/show_bug.cgi?id=218764
184         <rdar://problem/71248946>
185
186         Reviewed by Tim Horton.
187
188         In EventDispatcher::wheelEvent(), all wheel events now bounce through the scrolling
189         thread, even those destined for main thread scrolling. This allows the scrolling thread
190         to wait on a condition for the event to come back to the scrolling thread via
191         handleWheelEventAfterMainThread(), since we have to know whether content called
192         preventDefault() on the first event before sending subsequent events.
193
194         * WebProcess/WebPage/EventDispatcher.cpp:
195         (WebKit::EventDispatcher::wheelEvent):
196
197 2020-12-03  Alex Christensen  <achristensen@webkit.org>
198
199         Introduce new download API
200         https://bugs.webkit.org/show_bug.cgi?id=217747
201
202         Reviewed by Brady Eidson.
203
204         Safari currently uses _WKDownload, which has evolved strangely over the last decade.
205         In order to make a nicer interface, we need to learn from those lessons and take a step back.
206         I did that, and here's what I came up with: WKDownload and WKDownloadDelegate!
207
208         Notable changes include:
209         1.  The delegate now lives on the download object instead of the process pool.
210         2.  WKDownload does not conform to NSCopying because we have NSMapTable instead of NSDictionary.
211         3.  publishProgressAtURL is gone.  That will be reimplemented in the UI process of the client that used it.
212         4.  cancel has a completion handler to get the resume data instead of waiting for didCancel then getting it from the download object.
213         5.  didFailWithError also gives you the resume data, so there is no way to get it from the download object.  That's more about a fail/cancel
214             event than a property of the download.
215         6.  wasUserInitiated is gone.  Instead, WKNavigationDelegate has a callback that links a navigation action (where _isUserInitiated is exposed) to the download.
216         7.  redirectChain is also gone.  That can also be gotten from the link to the navigation and the download delegate's redirect callback.
217         8.  _downloadDidStart is gone.  Instead, we have completion handlers that expose a WKDownload once it's started.  There's no need to
218             reference the download object before then anyways.  Note: that's when the download "starts" which is before it receives the response,
219             so there will be no server delay in the difference between download object availabilities.
220         9.  didReceiveServerRedirectToURL now gives you the option of continuing or cancelling.  This reflects the amount of control the
221             WKNavigationDelegate has.
222         10. decideDestinationWithSuggestedFilename and didReceiveResponse have been merged, since they actually happen at the same time and
223             NSURLResponse has suggestedFilename API.  allowOverwrite is also gone.  It wasn't used, and not really needed.
224         11. didCreateDestination is gone.  That callback time wasn't really necessary.  If you need to know when it's created, wait until the first
225             didWriteData callback.  The destination has definitely been created by then.
226         12. shouldDecodeSourceDataOfMIMEType is gone.  It's actually not called since we adopted NSURLSession, and we should remove the related dead code.
227         13. originatingFrame is gone.  On _WKDownload it was actually a non-null WKFrameInfo that often contained no information.  When information was there,
228             the information access has been replaced by didBecomeDownload which links the WKNavigationResponse which has frame info on it.
229
230         I wrote API tests for everything I could think of.
231
232         * NetworkProcess/Downloads/DownloadManager.cpp:
233         (WebKit::DownloadManager::resumeDownload):
234         * NetworkProcess/Downloads/DownloadManager.h:
235         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
236         (WebKit::Download::resume):
237         (WebKit::Download::platformCancelNetworkLoad):
238         * NetworkProcess/NetworkDataTaskBlob.cpp:
239         (WebKit::NetworkDataTaskBlob::suggestedFilename const):
240         * NetworkProcess/NetworkProcess.cpp:
241         (WebKit::NetworkProcess::resumeDownload):
242         (WebKit::NetworkProcess::findPendingDownloadLocation):
243         * NetworkProcess/NetworkProcess.h:
244         * NetworkProcess/NetworkProcess.messages.in:
245         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
246         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
247         * Scripts/webkit/messages.py:
248         * Shared/API/Cocoa/WebKit.h:
249         * Shared/API/c/WKSharedAPICast.h:
250         (WebKit::toAPI):
251         * Shared/Cocoa/APIObject.mm:
252         (API::Object::newObject):
253         * Sources.txt:
254         * SourcesCocoa.txt:
255         * UIProcess/API/APIDownloadClient.h:
256         (API::DownloadClient::legacyDidStart):
257         (API::DownloadClient::didFail):
258         (API::DownloadClient::didStart): Deleted.
259         * UIProcess/API/APINavigationAction.h:
260         * UIProcess/API/APINavigationClient.h:
261         (API::NavigationClient::navigationResponseDidBecomeDownload):
262         (API::NavigationClient::navigationActionDidBecomeDownload):
263         (API::NavigationClient::contextMenuDidCreateDownload):
264         * UIProcess/API/APIPolicyClient.h:
265         (API::PolicyClient::decidePolicyForNavigationAction):
266         (API::PolicyClient::decidePolicyForNewWindowAction):
267         * UIProcess/API/C/WKContext.cpp:
268         (WKContextSetDownloadClient): Deleted.
269         * UIProcess/API/C/WKContext.h:
270         * UIProcess/API/C/WKContextDownloadClient.h: Removed.
271         * UIProcess/API/C/WKDownload.cpp: Removed.
272         * UIProcess/API/C/WKDownloadClient.h: Added.
273         * UIProcess/API/C/WKDownloadRef.cpp: Added.
274         (WKDownloadGetTypeID):
275         (WKDownloadCopyRequest):
276         (WKDownloadCancel):
277         (WKDownloadGetOriginatingPage):
278         (WKDownloadGetWasUserInitiated):
279         (WKDownloadSetClient):
280         * UIProcess/API/C/WKDownloadRef.h: Renamed from Source/WebKit/UIProcess/API/C/WKDownload.h.
281         * UIProcess/API/C/WKNavigationActionRef.cpp:
282         (WKNavigationActionGetDownloadAttribute):
283         (WKNavigationActionShouldPerformDownload): Deleted.
284         * UIProcess/API/C/WKNavigationActionRef.h:
285         * UIProcess/API/C/WKPage.cpp:
286         (WKPageSetPagePolicyClient):
287         (WKPageSetPageNavigationClient):
288         * UIProcess/API/C/WKPageNavigationClient.h:
289         * UIProcess/API/Cocoa/WKDownload.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKDownload.h.
290         * UIProcess/API/Cocoa/WKDownload.mm: Added.
291         (-[WKDownload cancel:]):
292         (-[WKDownload originalRequest]):
293         (-[WKDownload delegate]):
294         (-[WKDownload setDelegate:]):
295         (-[WKDownload dealloc]):
296         (-[WKDownload _apiObject]):
297         * UIProcess/API/Cocoa/WKDownloadDelegate.h: Added.
298         * UIProcess/API/Cocoa/WKDownloadInternal.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKDownloadInternal.h.
299         * UIProcess/API/Cocoa/WKNavigationAction.h:
300         * UIProcess/API/Cocoa/WKNavigationAction.mm:
301         (-[WKNavigationAction downloadAttribute]):
302         (-[WKNavigationAction _shouldPerformDownload]):
303         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
304         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
305         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
306         * UIProcess/API/Cocoa/WKProcessPool.mm:
307         (-[WKProcessPool _downloadURLRequest:websiteDataStore:originatingWebView:]):
308         (-[WKProcessPool _resumeDownloadFromData:websiteDataStore:path:originatingWebView:]):
309         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
310         * UIProcess/API/Cocoa/WKWebView.h:
311         * UIProcess/API/Cocoa/WKWebView.mm:
312         (-[WKWebView downloadRequest:completionHandler:]):
313         (-[WKWebView resumeDownloadWithData:completionHandler:]):
314         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
315         * UIProcess/API/Cocoa/_WKDownload.h:
316         * UIProcess/API/Cocoa/_WKDownload.mm:
317         (-[_WKDownload initWithDownload2:]):
318         (+[_WKDownload downloadWithDownload:]):
319         (-[_WKDownload cancel]):
320         (-[_WKDownload publishProgressAtURL:]):
321         (-[_WKDownload request]):
322         (-[_WKDownload originatingWebView]):
323         (-[_WKDownload redirectChain]):
324         (-[_WKDownload wasUserInitiated]):
325         (-[_WKDownload resumeData]):
326         (-[_WKDownload originatingFrame]):
327         (-[_WKDownload _apiObject]):
328         (-[_WKDownload dealloc]): Deleted.
329         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
330         * UIProcess/API/Cocoa/_WKDownloadInternal.h:
331         * UIProcess/API/glib/WebKitDownloadClient.cpp:
332         * UIProcess/Cocoa/LegacyDownloadClient.h:
333         * UIProcess/Cocoa/LegacyDownloadClient.mm:
334         (WebKit::LegacyDownloadClient::legacyDidStart):
335         (WebKit::LegacyDownloadClient::didReceiveResponse):
336         (WebKit::LegacyDownloadClient::didReceiveData):
337         (WebKit::LegacyDownloadClient::didReceiveAuthenticationChallenge):
338         (WebKit::LegacyDownloadClient::didCreateDestination):
339         (WebKit::LegacyDownloadClient::processDidCrash):
340         (WebKit::LegacyDownloadClient::decideDestinationWithSuggestedFilename):
341         (WebKit::LegacyDownloadClient::didFinish):
342         (WebKit::LegacyDownloadClient::didFail):
343         (WebKit::LegacyDownloadClient::legacyDidCancel):
344         (WebKit::LegacyDownloadClient::willSendRequest):
345         (WebKit::LegacyDownloadClient::didStart): Deleted.
346         * UIProcess/Cocoa/NavigationState.h:
347         * UIProcess/Cocoa/NavigationState.mm:
348         (WebKit::NavigationState::setNavigationDelegate):
349         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
350         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
351         (WebKit::NavigationState::NavigationClient::navigationActionDidBecomeDownload):
352         (WebKit::NavigationState::NavigationClient::navigationResponseDidBecomeDownload):
353         (WebKit::NavigationState::NavigationClient::contextMenuDidCreateDownload):
354         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
355         * UIProcess/Downloads/DownloadProxy.cpp:
356         (WebKit::DownloadProxy::~DownloadProxy):
357         (WebKit::DownloadProxy::didStart):
358         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
359         (WebKit::DownloadProxy::didFail):
360         (WebKit::DownloadProxy::setClient):
361         * UIProcess/Downloads/DownloadProxy.h:
362         (WebKit::DownloadProxy::setDidStartCallback):
363         (WebKit::DownloadProxy::setSuggestedFilename):
364         * UIProcess/Network/NetworkProcessProxy.cpp:
365         * UIProcess/WebPageProxy.cpp:
366         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
367         (WebKit::WebPageProxy::receivedPolicyDecision):
368         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
369         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
370         (WebKit::WebPageProxy::decidePolicyForResponseShared):
371         (WebKit::WebPageProxy::resumeDownload):
372         (WebKit::WebPageProxy::downloadRequest):
373         (WebKit::WebPageProxy::contextMenuItemSelected):
374         * UIProcess/WebPageProxy.h:
375         (WebKit::WebPageProxy::receivedPolicyDecision):
376         * UIProcess/WebProcessPool.cpp:
377         (WebKit::WebProcessPool::resumeDownload):
378         * UIProcess/WebProcessPool.h:
379         * WebKit.xcodeproj/project.pbxproj:
380
381 2020-12-03  Adam Roben  <aroben@apple.com>
382
383         Adopt FALLBACK_PLATFORM
384         https://bugs.webkit.org/show_bug.cgi?id=219504
385
386         Reviewed by Tim Horton.
387
388         * Configurations/SDKVariant.xcconfig:
389         * Scripts/check-xcfilelists.sh:
390         Use FALLBACK_PLATFORM it if it's defined, otherwise use PLATFORM_NAME
391         as before.
392
393 2020-12-03  Chris Dumez  <cdumez@apple.com>
394
395         Drop unimplemented suspension functions on GPUConnectionToWebProcess and WebAuthnConnectionToWebProcess
396         https://bugs.webkit.org/show_bug.cgi?id=219513
397
398         Reviewed by Tim Horton.
399
400         These functions are never called and have no implementation. This is just bad copy/paste from
401         NetworkConnectionToWebProcess.
402
403         * GPUProcess/GPUConnectionToWebProcess.h:
404         * WebAuthnProcess/WebAuthnConnectionToWebProcess.h:
405
406 2020-12-03  Brent Fulgham  <bfulgham@apple.com>
407
408         [macOS] Only extend access to the AppleSNBFBUserClient IOKit class if the GPU Process is not used
409         https://bugs.webkit.org/show_bug.cgi?id=219014
410         <rdar://problem/70463873>
411
412         Reviewed by Per Arne Vollan.
413
414         Instead of globally extending access to the AppleSNBFBUserClient IOKit class,
415         only extend it when the GPU process is not in use.
416
417         * UIProcess/WebPageProxy.cpp:
418         (WebKit::gpuIOKitClasses): Add 'AppleSNBFBUserClient' as a dynamically-extended
419         IOKit class.
420         * WebProcess/com.apple.WebProcess.sb.in: Only allow 'AppleSNBFBUserClient' if it
421         was dynamically extended.
422
423 2020-12-03  Said Abou-Hallawa  <said@apple.com>
424
425         [GPU Process] Disconnect NativeImages from RemoteResourceCacheProxy when RemoteRenderingBackendProxy is destroyed
426         https://bugs.webkit.org/show_bug.cgi?id=219417
427
428         Reviewed by Tim Horton.
429
430         If the WebPage is destroyed before destroying the CachedImages, a crash
431         may happen. The NativeImage will try to release itself from its observer,
432         which is RemoteResourceCacheProxy, after it has been freed.
433
434         * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
435         (WebKit::RemoteResourceCacheProxy::~RemoteResourceCacheProxy):
436         (WebKit::RemoteResourceCacheProxy::cacheNativeImage):
437         * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h:
438
439 2020-12-03  Chris Dumez  <cdumez@apple.com>
440
441         Bad IPC from the WebProcess should not terminate the GPUProcess
442         https://bugs.webkit.org/show_bug.cgi?id=219511
443
444         Reviewed by Simon Fraser.
445
446         Bad IPC from the WebProcess should not terminate the GPUProcess. The GPUProcess is shared by all
447         WebProcesses and it is not acceptable for a single bad WebProcess to negatively impact other
448         WebProcesses. Instead, we should terminate the bad WebProcess, like the NetworkProcess already
449         does on bad IPC.
450
451         * GPUProcess/GPUConnectionToWebProcess.cpp:
452         (WebKit::GPUConnectionToWebProcess::didReceiveInvalidMessage):
453         * Shared/ProcessTerminationReason.h:
454         * UIProcess/API/C/WKAPICast.h:
455         (WebKit::toAPI):
456         * UIProcess/Cocoa/NavigationState.mm:
457         (WebKit::wkProcessTerminationReason):
458         * UIProcess/GPU/GPUProcessProxy.cpp:
459         (WebKit::GPUProcessProxy::terminateWebProcess):
460         * UIProcess/GPU/GPUProcessProxy.h:
461         * UIProcess/GPU/GPUProcessProxy.messages.in:
462         * UIProcess/WebPageProxy.cpp:
463         (WebKit::shouldReloadAfterProcessTermination):
464
465 2020-12-03  Alex Christensen  <achristensen@webkit.org>
466
467         Serialize NFA to disk before converting it to a DFA when compiling a WKContentRuleList
468         https://bugs.webkit.org/show_bug.cgi?id=219452
469
470         Reviewed by Geoffrey Garen.
471
472         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
473         (-[WKContentRuleListStore _compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]):
474         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
475         Remove NS_RELEASES_ARGUMENT because it was incorrect and unnecessary because the WTF::String is copied to a background thread.
476
477 2020-12-03  Chris Dumez  <cdumez@apple.com>
478
479         Make sure the GPUConnectionToWebProcess gets destroyed when the connection to the WebProcess gets severed
480         https://bugs.webkit.org/show_bug.cgi?id=219508
481
482         Reviewed by Geoffrey Garen.
483
484         Make sure the GPUConnectionToWebProcess gets destroyed when the connection to the WebProcess gets severed
485         (WebProcess exited normally or crashed). This is similar to what we do in the NetworkProcess for
486         NetworkConnectionToWebProcess.
487
488         * GPUProcess/GPUConnectionToWebProcess.cpp:
489         (WebKit::GPUConnectionToWebProcess::didClose):
490
491 2020-12-03  Tim Horton  <timothy_horton@apple.com>
492
493         GPU Process: Sandbox violations under IOSurface::maximumSize in the Web Content process
494         https://bugs.webkit.org/show_bug.cgi?id=219484
495         <rdar://problem/71603808>
496
497         Reviewed by Ryosuke Niwa.
498
499         * Shared/WebProcessCreationParameters.cpp:
500         (WebKit::WebProcessCreationParameters::encode const):
501         (WebKit::WebProcessCreationParameters::decode):
502         * Shared/WebProcessCreationParameters.h:
503         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
504         (WebKit::WebProcessPool::platformInitializeWebProcess):
505         * WebProcess/cocoa/WebProcessCocoa.mm:
506         (WebKit::WebProcess::platformInitializeWebProcess):
507         Fetch the maximum allowed size of an IOSurface on the current hardware
508         in the UI process, and push it to the Web Content process on creation.
509
510 2020-12-03  Martin Robinson  <mrobinson@igalia.com>
511
512         Move code from AxisScrollSnapOffsets to ScrollSnapOffsetsInfo
513         https://bugs.webkit.org/show_bug.cgi?id=219345
514
515         Reviewed by Daniel Bates.
516
517         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: Remove AxisScrollSnapOffsets.h include.
518         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: Ditto.
519
520 2020-12-02  Tim Horton  <timothy_horton@apple.com>
521
522         Many different assertion failures on the GPU process bot after r270366
523         https://bugs.webkit.org/show_bug.cgi?id=219467
524
525         Reviewed by Simon Fraser.
526
527         * WebProcess/WebPage/DrawingArea.cpp:
528         (WebKit::DrawingArea::supportsGPUProcessRendering):
529         * WebProcess/WebPage/DrawingArea.h:
530         * WebProcess/WebPage/WebPage.cpp:
531         (WebKit::WebPage::WebPage):
532         (WebKit::WebPage::updatePreferences):
533         * WebProcess/WebPage/WebPage.h:
534         Disable DOM rendering in the GPU process if the DrawingArea doesn't support it.
535         Currently only RemoteLayerTreeDrawingArea does.
536
537 2020-12-02  Tim Horton  <timothy_horton@apple.com>
538
539         GPU Process: Temporarily disable Web Fonts when DOM rendering in the GPU process is enabled
540         https://bugs.webkit.org/show_bug.cgi?id=219479
541
542         Reviewed by Simon Fraser.
543
544         * WebProcess/WebPage/WebPage.cpp:
545         (WebKit::WebPage::updatePreferences):
546         Web fonts don't work in the GPU process yet, so disable them.
547         Unstyled text is better than no text.
548
549 2020-12-02  Brent Fulgham  <bfulgham@apple.com>
550
551         [macOS] WebContent sandbox; remove AppleIntelMEUserClient
552         https://bugs.webkit.org/show_bug.cgi?id=219012
553         <rdar://problem/70462796>
554
555         Reviewed by Eric Carlson.
556
557         Instead of globally extending access to the AppleIntelMEUserClient IOKit class,
558         only extend it when the GPU process is not in use.
559
560         * UIProcess/WebPageProxy.cpp:
561         (WebKit::gpuIOKitClasses): Add 'AppleIntelMEUserClient' as a dynamically-extended
562         IOKit class.
563         * WebProcess/com.apple.WebProcess.sb.in: Only allow 'AppleIntelMEUserClient' if it
564         was dynamically extended.
565
566 2020-12-02  Wenson Hsieh  <wenson_hsieh@apple.com>
567
568         Unreviewed, fix the iOS build after r270362
569
570         * UIProcess/ios/WKContentViewInteraction.mm:
571         (-[WKContentView createHighlightInCurrentGroupWithRange:]):
572         (-[WKContentView createHighlightInNewGroupWithRange:]):
573
574 2020-12-02  Megan Gardner  <megan_gardner@apple.com>
575
576         Create and draw app highlights
577         https://bugs.webkit.org/show_bug.cgi?id=219365
578
579         Reviewed by Wenson Hsieh.
580
581         Handle the creation of App Highlights from selections when the context menu item is selected. 
582         This patch will add the highlights to the Document's app Highlight register, and handle drawing
583         them in InlineTextBox. Later patches will handle the persistent storage and repopulation of app
584         highlights on launch or reload of a page. 
585
586         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
587         (WebKit::WebPageProxy::createAppHighlightInSelectedRange):
588         * UIProcess/PageClient.h:
589         * UIProcess/WebPageProxy.cpp:
590         (WebKit::WebPageProxy::contextMenuItemSelected):
591         * UIProcess/WebPageProxy.h:
592         * UIProcess/ios/WKContentViewInteraction.mm:
593         (-[WKContentView createHighlightInCurrentGroupWithRange:]):
594         (-[WKContentView createHighlightInNewGroupWithRange:]):
595         * WebProcess/WebPage/WebPage.cpp:
596         (WebKit::WebPage::createAppHighlightInSelectedRange):
597         * WebProcess/WebPage/WebPage.h:
598         * WebProcess/WebPage/WebPage.messages.in:
599
600 2020-12-02  Brent Fulgham  <bfulgham@apple.com>
601
602         [iOS] Silence sandbox warning for unneeded sysctl-read of "hw.tbfrequency_compat"
603         https://bugs.webkit.org/show_bug.cgi?id=219414
604         <rdar://problem/71740719>
605
606         Reviewed by Per Arne Vollan.
607
608         Silence a spurious log generated when our sandbox denies access to the unused sysctl
609         "hw.tbfrequency_compat". I have confirmed with the framework that attempts to read this
610         value, and they confirm they don't need the value, and actually are not using the result
611         anywhere in their framework.
612
613         Let's silence this report.
614
615         * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
616         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
617
618 2020-12-02  Wenson Hsieh  <wenson_hsieh@apple.com>
619
620         Entire image elements are sometimes selected after ending a image extraction interaction
621         https://bugs.webkit.org/show_bug.cgi?id=219435
622         <rdar://problem/71897557>
623
624         Reviewed by Megan Gardner.
625
626         If the image extraction interaction is currently active, regular text interactions may need to defer to these
627         image extraction interactions. See WebKitAdditions changes for more details.
628
629         * UIProcess/ios/WKContentViewInteraction.mm:
630         (-[WKContentView hasSelectablePositionAtPoint:]):
631         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
632
633 2020-12-02  Wenson Hsieh  <wenson_hsieh@apple.com>
634
635         Context menu should be shown after a long timeout following image extraction
636         https://bugs.webkit.org/show_bug.cgi?id=219415
637         <rdar://problem/71872600>
638
639         Reviewed by Andy Estes.
640
641         Ensures that the context menu can still be shown when triggering an image extraction gesture. To do this, we
642         add a new long press gesture recognizer with a much longer delay. See WebKitAdditions patch for more details.
643
644         * UIProcess/ios/WKContentViewInteraction.h:
645         * UIProcess/ios/WKContentViewInteraction.mm:
646         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
647         (-[WKContentView _doAfterPendingImageExtraction:]):
648         (-[WKContentView _invokeAllActionsToPerformAfterPendingImageExtraction]):
649
650         Drive-by fix: move a couple of methods out of WebKitAdditions and into non-internal source.
651
652 2020-12-01  Tim Horton  <timothy_horton@apple.com>
653
654         GPU Process: IOSurfaces should not be mapped into the Web Content Process
655         https://bugs.webkit.org/show_bug.cgi?id=219368
656
657         Reviewed by Said Abou-Hallawa.
658
659         Since the Web Content process sandbox will eventually not have access to IOKit,
660         it will not be able to map/lock/use IOSurfaces. Thankfully, all it really needs
661         to be able to do is carry a reference to the surface from the GPU process to the
662         UI process (where it is mapped and applied as layer contents).
663
664         * GPUProcess/graphics/PlatformRemoteImageBuffer.h:
665         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
666         (WebKit::RemoteLayerBackingStore::encode const):
667         (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
668         * SourcesCocoa.txt:
669         * WebKit.xcodeproj/project.pbxproj:
670         * WebProcess/GPU/graphics/PlatformImageBufferShareableBackend.h:
671         * WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h:
672         (isType):
673         * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
674         (WebKit::RemoteRenderingBackendProxy::reestablishGPUProcessConnection):
675         (WebKit::RemoteRenderingBackendProxy::createImageBuffer):
676         (WebKit::RemoteRenderingBackendProxy::imageBufferBackendWasCreated):
677         (WebKit::RemoteRenderingBackendProxy::didFlush):
678
679         * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp:
680         (WebKit::ImageBufferShareableIOSurfaceBackend::create):
681         (WebKit::ImageBufferShareableIOSurfaceBackend::createImageBufferBackendHandle const):
682         (WebKit::ImageBufferShareableIOSurfaceBackend::context const):
683         (WebKit::ImageBufferShareableIOSurfaceBackend::copyNativeImage const):
684         (WebKit::ImageBufferShareableIOSurfaceBackend::copyImage const):
685         (WebKit::ImageBufferShareableIOSurfaceBackend::draw):
686         (WebKit::ImageBufferShareableIOSurfaceBackend::drawPattern):
687         (WebKit::ImageBufferShareableIOSurfaceBackend::toDataURL const):
688         (WebKit::ImageBufferShareableIOSurfaceBackend::toData const):
689         (WebKit::ImageBufferShareableIOSurfaceBackend::toBGRAData const):
690         (WebKit::ImageBufferShareableIOSurfaceBackend::getImageData const):
691         (WebKit::ImageBufferShareableIOSurfaceBackend::putImageData):
692         * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h:
693         * WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp: Copied from Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp.
694         (WebKit::ImageBufferShareableMappedIOSurfaceBackend::create):
695         (WebKit::ImageBufferShareableMappedIOSurfaceBackend::createImageBufferBackendHandle const):
696         * WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.h: Copied from Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h.
697         Rename ImageBufferShareableIOSurfaceBackend to ImageBufferShareableMappedIOSurfaceBackend.
698         Readd ImageBufferShareableIOSurfaceBackend, the unmapped variant. The mapped variant is only used:
699         - in the GPU process
700         - in the Web Content process when DOM rendering in the GPU process is disabled
701
702         The unmapped variant cannot perform most ImageBufferBackend duties, except creating an ImageBufferBackendHandle,
703         which it does by cloning the existing handle. It explicitly does *not* map the IOSurface in the
704         process, and is meant for use in Web Content processes that do not have access to IOSurface.
705
706 2020-12-01  Peng Liu  <peng.liu6@apple.com>
707
708         [Media In GPU Process][MSE] Add the support to forward initialization segment from the GPU Process to Web processes
709         https://bugs.webkit.org/show_bug.cgi?id=219227
710
711         Reviewed by Eric Carlson.
712
713         This patch adds the support to forward `sourceBufferPrivateDidReceiveInitializationSegment()`
714         callback from the source buffer parser running in the GPU process to the `SourceBufferPrivateRemote`
715         running in the Web process, which in turn provides the initialization segment to `SourceBuffer`.
716
717         No change in behavior.
718
719         * CMakeLists.txt:
720         * DerivedSources-input.xcfilelist:
721         * DerivedSources-output.xcfilelist:
722         * DerivedSources.make:
723         * GPUProcess/media/InitializationSegmentInfo.h: Added.
724         (WebKit::InitializationSegmentInfo::TrackInformation::encode const):
725         (WebKit::InitializationSegmentInfo::TrackInformation::decode):
726         (WebKit::InitializationSegmentInfo::encode const):
727         (WebKit::InitializationSegmentInfo::decode):
728         * GPUProcess/media/RemoteAudioTrackProxy.cpp:
729         (WebKit::RemoteAudioTrackProxy::RemoteAudioTrackProxy):
730         (WebKit::RemoteAudioTrackProxy::~RemoteAudioTrackProxy):
731         (WebKit::RemoteAudioTrackProxy::configurationChanged):
732         (WebKit::RemoteAudioTrackProxy::willRemove):
733         * GPUProcess/media/RemoteAudioTrackProxy.h:
734         * GPUProcess/media/RemoteAudioTrackProxy.messages.in: Copied from Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in.
735         * GPUProcess/media/RemoteMediaDescription.h: Added.
736         (WebKit::MediaDescriptionInfo::encode const):
737         (WebKit::MediaDescriptionInfo::decode):
738         (WebKit::RemoteMediaDescription::RemoteMediaDescription):
739         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
740         (WebKit::RemoteMediaPlayerProxy::loadMediaSource):
741         (WebKit::RemoteMediaPlayerProxy::addRemoteAudioTrackProxy):
742         (WebKit::RemoteMediaPlayerProxy::addRemoteVideoTrackProxy):
743         (WebKit::RemoteMediaPlayerProxy::addRemoteTextTrackProxy):
744         (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidAddAudioTrack):
745         (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidRemoveAudioTrack):
746         (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidAddVideoTrack):
747         (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidRemoveVideoTrack):
748         (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidAddTextTrack):
749         (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidRemoveTextTrack):
750         (WebKit::RemoteMediaPlayerProxy::audioTrackSetEnabled): Deleted.
751         (WebKit::RemoteMediaPlayerProxy::videoTrackSetSelected): Deleted.
752         (WebKit::RemoteMediaPlayerProxy::textTrackSetMode): Deleted.
753         * GPUProcess/media/RemoteMediaPlayerProxy.h:
754         * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
755         * GPUProcess/media/RemoteMediaSourceProxy.cpp:
756         (WebKit::RemoteMediaSourceProxy::RemoteMediaSourceProxy):
757         (WebKit::RemoteMediaSourceProxy::addSourceBuffer):
758         * GPUProcess/media/RemoteMediaSourceProxy.h:
759         * GPUProcess/media/RemoteSourceBufferProxy.cpp:
760         (WebKit::RemoteSourceBufferProxy::create):
761         (WebKit::RemoteSourceBufferProxy::RemoteSourceBufferProxy):
762         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveInitializationSegment):
763         * GPUProcess/media/RemoteSourceBufferProxy.h:
764         * GPUProcess/media/RemoteTextTrackProxy.cpp:
765         (WebKit::RemoteTextTrackProxy::RemoteTextTrackProxy):
766         (WebKit::RemoteTextTrackProxy::~RemoteTextTrackProxy):
767         (WebKit::RemoteTextTrackProxy::configurationChanged):
768         (WebKit::RemoteTextTrackProxy::willRemove):
769         (WebKit::RemoteTextTrackProxy::addDataCue):
770         (WebKit::RemoteTextTrackProxy::updateDataCue):
771         (WebKit::RemoteTextTrackProxy::removeDataCue):
772         (WebKit::RemoteTextTrackProxy::addGenericCue):
773         (WebKit::RemoteTextTrackProxy::updateGenericCue):
774         (WebKit::RemoteTextTrackProxy::removeGenericCue):
775         (WebKit::RemoteTextTrackProxy::parseWebVTTFileHeader):
776         (WebKit::RemoteTextTrackProxy::parseWebVTTCueData):
777         * GPUProcess/media/RemoteTextTrackProxy.h:
778         * GPUProcess/media/RemoteTextTrackProxy.messages.in: Copied from Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in.
779         * GPUProcess/media/RemoteVideoTrackProxy.cpp:
780         (WebKit::RemoteVideoTrackProxy::RemoteVideoTrackProxy):
781         (WebKit::RemoteVideoTrackProxy::~RemoteVideoTrackProxy):
782         (WebKit::RemoteVideoTrackProxy::configurationChanged):
783         (WebKit::RemoteVideoTrackProxy::willRemove):
784         * GPUProcess/media/RemoteVideoTrackProxy.h:
785         * GPUProcess/media/RemoteVideoTrackProxy.messages.in: Copied from Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in.
786         * Scripts/webkit/messages.py:
787         * WebKit.xcodeproj/project.pbxproj:
788         * WebProcess/GPU/media/AudioTrackPrivateRemote.cpp:
789         (WebKit::AudioTrackPrivateRemote::AudioTrackPrivateRemote):
790         (WebKit::AudioTrackPrivateRemote::setEnabled):
791         * WebProcess/GPU/media/AudioTrackPrivateRemote.h:
792         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
793         (WebKit::MediaPlayerPrivateRemote::addRemoteAudioTrack):
794         (WebKit::MediaPlayerPrivateRemote::addRemoteTextTrack):
795         (WebKit::MediaPlayerPrivateRemote::addRemoteVideoTrack):
796         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
797         * WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in:
798         * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp:
799         (WebKit::MediaSourcePrivateRemote::create):
800         (WebKit::MediaSourcePrivateRemote::MediaSourcePrivateRemote):
801         (WebKit::MediaSourcePrivateRemote::addSourceBuffer):
802         (WebKit::MediaSourcePrivateRemote::readyState const):
803         * WebProcess/GPU/media/MediaSourcePrivateRemote.h:
804         * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
805         (WebKit::SourceBufferPrivateRemote::create):
806         (WebKit::SourceBufferPrivateRemote::SourceBufferPrivateRemote):
807         (WebKit::SourceBufferPrivateRemote::readyState const):
808         (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDidReceiveInitializationSegment):
809         * WebProcess/GPU/media/SourceBufferPrivateRemote.h:
810         * WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in:
811         * WebProcess/GPU/media/TextTrackPrivateRemote.cpp:
812         (WebKit::TextTrackPrivateRemote::TextTrackPrivateRemote):
813         (WebKit::TextTrackPrivateRemote::setMode):
814         * WebProcess/GPU/media/TextTrackPrivateRemote.h:
815         * WebProcess/GPU/media/VideoTrackPrivateRemote.cpp:
816         (WebKit::VideoTrackPrivateRemote::VideoTrackPrivateRemote):
817         (WebKit::VideoTrackPrivateRemote::setSelected):
818         * WebProcess/GPU/media/VideoTrackPrivateRemote.h:
819         (WebKit::VideoTrackPrivateRemote::create):
820
821 2020-12-01  Wenson Hsieh  <wenson_hsieh@apple.com>
822
823         [iOS] Support image extraction interactions for accessibility
824         https://bugs.webkit.org/show_bug.cgi?id=219398
825         <rdar://problem/70744914>
826
827         Reviewed by Devin Rousso.
828
829         Adds support for a new accessibility feature related to images. Refer to the bug for more details.
830
831         * Shared/ios/InteractionInformationRequest.cpp:
832         (WebKit::InteractionInformationRequest::encode const):
833         (WebKit::InteractionInformationRequest::decode):
834         (WebKit::InteractionInformationRequest::isValidForRequest const):
835         * Shared/ios/InteractionInformationRequest.h:
836
837         Add a new flag to request image data via position information. This flag works similarly to the existing
838         `includeSnapshot` flag, except that it only grabs data when the hit-tested node is an image. As such, a position
839         information request with the `includeSnapshot` flag set is valid for an identical request with this new
840         `includeImageData` flag set, but not vice versa.
841
842         * SourcesCocoa.txt:
843         * UIProcess/ios/WKContentViewInteraction.h:
844         * UIProcess/ios/WKContentViewInteraction.mm:
845
846         Add various extension points for new WebKitAdditions snippets.
847
848         (-[WKContentView setUpInteraction]):
849         (-[WKContentView cleanUpInteraction]):
850
851         Call new methods to set up and tear down the image extraction interaction (defined in WebKitAdditions).
852
853         (-[WKContentView _webTouchEventsRecognized:]):
854
855         Upon starting a new gesture, reset the active (or pending) image extraction interaction, if appropriate.
856
857         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
858
859         Allow the image extraction gesture to fire alongside any other gesture.
860
861         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
862         (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]):
863
864         These existing interactions may conflict with pending image extraction interactions. Luckily, since these
865         interactions are both asynchronous, we're able to defer them until any pending image extraction request has
866         finished, to determine whether or not they should commence. In both cases, image extraction should take
867         precedence over dragging and context menus.
868
869         * UIProcess/ios/WKImageExtractionGestureRecognizer.h:
870         * UIProcess/ios/WKImageExtractionGestureRecognizer.mm:
871
872         Add a new long press gesture recognizer that fires on a very short (100ms) delay. This gesture is used to
873         preflight image extraction requests ahead of the other long press gestures (in particular, context menus), such
874         that these other gestures should be minimally impacted by the time required to perform image extraction.
875
876         This is still a long press gesture instead of a regular gesture recognizer, since preflighting image extraction
877         requests could be expensive if performed during every single gesture (i.e. scrolling, taps, etc).
878
879         (-[WKImageExtractionGestureRecognizer initWithDelegate:]):
880         (-[WKImageExtractionGestureRecognizer setState:]):
881         * WebKit.xcodeproj/project.pbxproj:
882         * WebProcess/WebPage/ios/WebPageIOS.mm:
883         (WebKit::imagePositionInformation):
884
885 2020-12-01  Per Arne Vollan  <pvollan@apple.com>
886
887         [macCatalyst] Embedded YouTube videos fail to play
888         https://bugs.webkit.org/show_bug.cgi?id=219412
889         <rdar://problem/71869657>
890
891         Reviewed by Tim Horton.
892
893         Add a missing comma in list of Media services, for which sandbox extensions are created. The missing comma
894         is causing a sandbox violation, since strings are concatenated when there's no comma.
895
896         * UIProcess/WebPageProxy.cpp:
897         (WebKit::mediaRelatedMachServices):
898
899 2020-12-01  Per Arne Vollan  <pvollan@apple.com>
900
901         [macOS] Deny mach lookup of 'com.apple.webinspector' in the WebContent process
902         https://bugs.webkit.org/show_bug.cgi?id=219386
903         <rdar://problem/60932734>
904
905         Reviewed by Darin Adler.
906
907         After r270035, mach-lookup of 'com.apple.webinspector' can be denied in the WebContent process on macOS.
908
909         * WebProcess/com.apple.WebProcess.sb.in:
910
911 2020-12-01  Brent Fulgham  <bfulgham@apple.com>
912
913         [macOS] Add telemetry for sandbox rules we believe are unused
914         https://bugs.webkit.org/show_bug.cgi?id=219141
915         <rdar://problem/71569084>
916
917         Reviewed by Per Arne Vollan.
918
919         This patch adds telemetry to a set of sandbox features we believe are unused. We should
920         capture telemetry to verify, and confirm before removing.
921
922         * WebProcess/com.apple.WebProcess.sb.in:
923
924 2020-12-01  Keith Rollin  <krollin@apple.com>
925
926         Consolidate header postprocessing scripts
927         https://bugs.webkit.org/show_bug.cgi?id=219388
928         <rdar://problem/71840357>
929
930         Reviewed by David Kilzer.
931
932         Our build system contains the following scripts to perform some
933         postprocessing of headers that we export to the SDK:
934
935             JavaScriptCore/postprocess-headers.sh
936             WebKit/mac/postprocess-framework-headers.sh
937             WebKitLegacy/mac/postprocess-headers.sh
938
939         The preceding scripts are used when using the non-XCBuild -- or
940         "legacy" -- Xcode build system. They are invoked in a custom Run
941         Script build phase after the headers have been exported with the
942         standard Xcode facility for creating frameworks.
943
944         Alternatively, we also have the following postprocessing scripts:
945
946             WebKit/Scripts/postprocess-header-rule
947             JavaScriptCore/Scripts/postprocess-header-rule
948             WebKitLegacy/scripts/postprocess-header-rule
949
950         These scripts are used when using the XCBuild build system. They are
951         invoked *during* the header export process to copy and postprocess the
952         headers in one blow. They are part of a Custom Build Rule for
953         exporting files ending in ".h".
954
955         The reason why we have two sets of scripts is because of the different
956         capabilities of the two Xcode build systems. The legacy system does
957         not support a custom "export header" step that would allow us to copy
958         and postprocess each header in a single step. Therefore, when using
959         the legacy build system, we export in one build step and postprocess
960         in a subsequent build step. And XCBuild doesn't like the approach
961         taken by the old build system where files are exported first and then
962         munged in a separate step, since that confuses its notion of the state
963         of the build ("Hey! That file I exported in the previous build? I see
964         now that it's been changed, so I'm going to export it again. And
965         change its modification date. And then rebuild everything downstream
966         that uses it."). Therefore, XCBuild added a facility for copying and
967         postprocessing in one step.
968
969         The scripts supporting each of these approaches are very similar to
970         each other, such that there is a lot of code duplication between them.
971         At the same time, by having two sets of scripts that are very similar
972         to each other, we run the risk of "drift", where files in one set may
973         get updated while their counterparts in the other set are not.
974
975         Address this duplication by making the scripts in the "legacy" set be
976         mere stubs that invoke the scripts in the new "XCBuild" set. In doing
977         this, we also fix a case of drift: the legacy-based scripts made use
978         of a timestamp file to determine if headers needed to be reprocessed
979         and exported, while the XCBuild-based scripts used a "process the
980         files and export them if any actual changes now exist between this new
981         version and any previously-exported version" approach.
982
983         Along the way, fix a bug in WebKitLegacy's postprocess-header-rule
984         that resulted in WebKitAvailability.h not being processed. The
985         practical effect of this bug is that the file ended up with both macOS
986         and iOS code, along with the #if that controlled which chunk of code
987         was compiled, instead of just the chunk of code specific to the
988         targeted SDK. Normally, the unused chunk of code would get removed
989         through the invocation of `unifdef`. But, because of the bug, the
990         results of running `unifdef` were being discarded.
991
992         * mac/postprocess-framework-headers.sh:
993
994 2020-12-01  Kate Cheney  <katherine_cheney@apple.com>
995
996         ITP logging mixes up the UI process ITP state with the Settings ITP state
997         https://bugs.webkit.org/show_bug.cgi?id=219359
998         <rdar://problem/71808489>
999
1000         Reviewed by Youenn Fablet.
1001
1002         Update an ITP logging message in the network process which mixes up
1003         the variables for the ITP state passed from the UI process and the
1004         ITP value from Settings.
1005
1006         No new tests, this only updates an incorrect logging message.
1007
1008         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1009         (WebKit::activateSessionCleanup):
1010
1011 2020-12-01  Alejandro G. Castro  <alex@igalia.com>
1012
1013         [GTK][WPE] Async scrolling udpates are blocked in the main thread
1014         https://bugs.webkit.org/show_bug.cgi?id=219308
1015
1016         Reviewed by Simon Fraser.
1017
1018         We need to use the EventDispatcher from the frameDone callback in
1019         the ThreadedCompositor, for GTK and WPE we receive the frame
1020         information in that thread. We have to notify the scrolling trees
1021         in the scrolling thread even if the main thread is busy or we will
1022         freeze when the main thread is busy. For that we use the API in
1023         the EventDispatcher.
1024
1025         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1026         (WebKit::ThreadedCompositor::sceneUpdateFinished): Call the
1027         EventDispatcher to notify the scrolling trees a frame was rendered.
1028         * WebProcess/WebPage/EventDispatcher.cpp: Enable the compilation
1029         of the notify function for all the ports.
1030         * WebProcess/WebPage/EventDispatcher.h: Ditto.
1031
1032 2020-12-01  Tim Horton  <timothy_horton@apple.com>
1033
1034         GPU Process: Invalid static_cast from ConcreteImageBuffer to RemoteImageBufferProxy
1035         https://bugs.webkit.org/show_bug.cgi?id=219387
1036
1037         Reviewed by Ryosuke Niwa.
1038
1039         * Shared/ConcreteShareableImageBuffer.h: Copied from Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h.
1040         (WebKit::ConcreteShareableImageBuffer::create):
1041         (WebKit::ConcreteShareableImageBuffer::ConcreteShareableImageBuffer):
1042         (WebKit::ConcreteShareableImageBuffer::createImageBufferBackendHandle):
1043         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
1044         (WebKit::RemoteLayerBackingStore::encode const):
1045         (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
1046         * WebKit.xcodeproj/project.pbxproj:
1047         Add and adopt ConcreteShareableImageBuffer. This is a ConcreteImageBuffer that knows how
1048         to create an ImageBufferBackendHandle, with no other behavior change.
1049         Previously, we were (completely incorrectly) casting ConcreteImageBuffer to RemoteImageBufferProxy
1050         to get this behavior, and somehow just got very lucky.
1051
1052         * WebProcess/GPU/media/RemoteAudioSession.cpp:
1053         Fix some unified source issues.
1054
1055 2020-11-30  Per Arne Vollan  <pvollan@apple.com>
1056
1057         [macOS] Adopt SPI to prevent establishing XPC connections to Launch Services
1058         https://bugs.webkit.org/show_bug.cgi?id=219173
1059         <rdar://problem/71595536>
1060
1061         Reviewed by Alex Christensen.
1062
1063         Adopt SPI to prevent establishing XPC connections to Launch Services in the WebContent process on macOS.
1064  
1065         * WebProcess/cocoa/WebProcessCocoa.mm:
1066         (WebKit::WebProcess::platformInitializeWebProcess):
1067
1068 2020-11-30  Tim Horton  <timothy_horton@apple.com>
1069
1070         Unreviewed, reverting r270275.
1071
1072         Broke canvas painting
1073
1074         Reverted changeset:
1075
1076         "GPU Process: IOSurfaces should not be mapped into the Web
1077         Content Process"
1078         https://bugs.webkit.org/show_bug.cgi?id=219368
1079         https://trac.webkit.org/changeset/270275
1080
1081 2020-11-30  Fujii Hironori  <Hironori.Fujii@sony.com>
1082
1083         [WinCairo?] GPU process remains alive even after UI process exited
1084         https://bugs.webkit.org/show_bug.cgi?id=219321
1085
1086         Reviewed by Don Olmstead.
1087
1088         GPUConnectionToWebProcess::didClose is called when web process
1089         exits, and GPUProcess::didClose is called when UI process exits in
1090         GPU process. GPUProcess::didClose should terminate the GPU
1091         process.
1092
1093         AuxiliaryProcess is the base class of GPUProcess.
1094         AuxiliaryProcess::didClose is calling _exit. However, GPUProcess
1095         overrode AuxiliaryProcess::didClose but it did nothing. GPUProcess
1096         doesn't need to override it.
1097
1098         * GPUProcess/GPUProcess.cpp:
1099         (WebKit::GPUProcess::didClose): Deleted.
1100         * GPUProcess/GPUProcess.h:
1101
1102 2020-11-30  Simon Fraser  <simon.fraser@apple.com>
1103
1104         Pass OptionSet<EventHandling> to various wheel event handler functions
1105         https://bugs.webkit.org/show_bug.cgi?id=219373
1106
1107         Reviewed by Tim Horton.
1108
1109         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1110         (WebKit::PDFPlugin::handleWheelEvent):
1111
1112 2020-11-30  Tim Horton  <timothy_horton@apple.com>
1113
1114         GPU Process: IOSurfaces should not be mapped into the Web Content Process
1115         https://bugs.webkit.org/show_bug.cgi?id=219368
1116
1117         Reviewed by Ryosuke Niwa.
1118
1119         Since the Web Content process sandbox will eventually not have access to IOKit,
1120         it will not be able to map/lock/use IOSurfaces. Thankfully, all it really needs
1121         to be able to do is carry a reference to the surface from the GPU process to the
1122         UI process (where it is mapped and applied as layer contents).
1123
1124         * Shared/ConcreteShareableImageBuffer.h: Copied from Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h.
1125         (WebKit::ConcreteShareableImageBuffer::create):
1126         (WebKit::ConcreteShareableImageBuffer::ConcreteShareableImageBuffer):
1127         (WebKit::ConcreteShareableImageBuffer::createImageBufferBackendHandle):
1128         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
1129         (WebKit::RemoteLayerBackingStore::encode const):
1130         (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
1131         Add and adopt ConcreteShareableImageBuffer. This is a ConcreteImageBuffer that knows how
1132         to create an ImageBufferBackendHandle, with no other behavior change.
1133         Previously, we were (completely incorrectly) casting ConcreteImageBuffer to RemoteImageBufferProxy
1134         to get this behavior, and somehow just got very lucky.
1135
1136         * SourcesCocoa.txt:
1137         * WebKit.xcodeproj/project.pbxproj:
1138         * WebProcess/GPU/graphics/PlatformImageBufferShareableBackend.h:
1139         * WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h:
1140         * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp:
1141         * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h:
1142         Remove the ImageBufferShareableIOSurfaceBackend create() method that takes
1143         an ImageBufferBackendHandle, since we always use the Unmapped variant.
1144         ImageBufferShareableIOSurfaceBackend is now only used:
1145         - in the GPU process
1146         - in the Web Content process when DOM rendering in the GPU process is disabled
1147         In both cases, the process that uses ImageBufferShareableIOSurfaceBackend also
1148         originates the surface, so does not create it from a handle.
1149
1150         * WebProcess/GPU/graphics/cocoa/ImageBufferShareableUnmappedIOSurfaceBackend.cpp: Added.
1151         (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::create):
1152         (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::createImageBufferBackendHandle const):
1153         (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::context const):
1154         (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::copyNativeImage const):
1155         (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::copyImage const):
1156         (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::draw):
1157         (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::drawPattern):
1158         (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::toDataURL const):
1159         (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::toData const):
1160         (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::toBGRAData const):
1161         (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::getImageData const):
1162         (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::putImageData):
1163         * WebProcess/GPU/graphics/cocoa/ImageBufferShareableUnmappedIOSurfaceBackend.h: Added.
1164         Add and adopt ImageBufferShareableUnmappedIOSurfaceBackend, which is a ImageBufferBackend
1165         that cannot perform most ImageBufferBackend duties, except creating an ImageBufferBackendHandle,
1166         which it does by cloning the existing handle. It explicitly does *not* map the IOSurface in the
1167         process, and is meant for use in Web Content processes that do not have access to IOSurface.
1168
1169         * WebProcess/GPU/media/RemoteAudioSession.cpp:
1170         Fix some unified source issues.
1171
1172 2020-11-30  Chris Dumez  <cdumez@apple.com>
1173
1174         sessionStorage should not be cloned when a window is opened with rel=noopener
1175         https://bugs.webkit.org/show_bug.cgi?id=218804
1176         <rdar://problem/71286606>
1177
1178         Reviewed by Alex Christensen.
1179
1180         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1181         (WebKit::WebFrameLoaderClient::dispatchCreatePage):
1182         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1183
1184 2020-11-30  Youenn Fablet  <youenn@apple.com>
1185
1186         Introduce an experimental flag specific to VP9 profile 2
1187         https://bugs.webkit.org/show_bug.cgi?id=219350
1188
1189         Reviewed by Eric Carlson.
1190
1191         * WebProcess/WebPage/WebPage.cpp:
1192         (WebKit::WebPage::updatePreferences):
1193
1194 2020-11-30  Antti Koivisto  <antti@apple.com>
1195
1196         Remove throttling code from NetworkLoad
1197         https://bugs.webkit.org/show_bug.cgi?id=219347
1198
1199         Reviewed by Anders Carlsson.
1200
1201         It is not a good latency simulation and no one is using it anyway.
1202
1203         * NetworkProcess/NetworkLoad.cpp:
1204         (WebKit::NetworkLoad::NetworkLoad):
1205         (WebKit::NetworkLoad::didReceiveResponse):
1206         (WebKit::NetworkLoad::didReceiveData):
1207         (WebKit::NetworkLoad::didCompleteWithError):
1208         (WebKit::NetworkLoad::Throttle::Throttle): Deleted.
1209         (WebKit::NetworkLoad::throttleDelayCompleted): Deleted.
1210         * NetworkProcess/NetworkLoad.h:
1211         * NetworkProcess/NetworkSession.h:
1212         (WebKit::NetworkSession::shouldLogCookieInformation const):
1213         (WebKit::NetworkSession::loadThrottleLatency const): Deleted.
1214         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1215         (WebKit::NetworkSessionCreationParameters::encode const):
1216         (WebKit::NetworkSessionCreationParameters::decode):
1217         * NetworkProcess/NetworkSessionCreationParameters.h:
1218         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1219         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1220         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1221         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1222         (WebKit::WebsiteDataStore::platformSetNetworkParameters):
1223
1224 2020-11-29  Adam Mazander  <mazander@apple.com>
1225
1226         Deny logs for benign fontservicesd daemon
1227         https://bugs.webkit.org/show_bug.cgi?id=219180
1228
1229         Reviewed by Per Arne Vollan.
1230
1231         After investigating denials of fontservicesd logs over several submissions 
1232         and without any fallout we are removing logging.
1233
1234         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1235
1236 2020-11-28  Per Arne Vollan  <pvollan@apple.com>
1237
1238         [macOS] Set application information in the Networking process on behalf of the WebContent process
1239         https://bugs.webkit.org/show_bug.cgi?id=218052
1240         <rdar://problem/70586405>
1241
1242         Reviewed by Brent Fulgham.
1243
1244         In preparation for blocking Launch Services in the WebContent process' sandbox, application information for the process
1245         should be set in the Networking process.
1246
1247         * NetworkProcess/NetworkConnectionToWebProcess.h:
1248         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1249         * NetworkProcess/mac/NetworkConnectionToWebProcessMac.mm: Added.
1250         (WebKit::NetworkConnectionToWebProcess::updateActivePages):
1251         * Scripts/process-entitlements.sh:
1252         * WebKit.xcodeproj/project.pbxproj:
1253         * WebProcess/cocoa/WebProcessCocoa.mm:
1254         (WebKit::WebProcess::platformInitializeWebProcess):
1255         (WebKit::activePagesOrigins):
1256         (WebKit::WebProcess::updateActivePages):
1257         (WebKit::WebProcess::getActivePagesOriginsForTesting):
1258         * WebProcess/com.apple.WebProcess.sb.in:
1259
1260 2020-11-28  Per Arne Vollan  <pvollan@apple.com>
1261
1262         [macOS] Issue sandbox extension to icon services when starting a drag operation
1263         https://bugs.webkit.org/show_bug.cgi?id=219159
1264         <rdar://problem/71585876>
1265
1266         Reviewed by Brent Fulgham.
1267
1268         Issue sandbox extension to icon services when starting a drag operation on macOS, since the WebContent process needs
1269         access to these services when a drag is started. This patch detects when a drag is about to start, and sends sandbox
1270         extensions to the icon services along with the mouse event. The sandbox extensions are then temporarily consumed
1271         while handling the mouse event in the WebContent process.
1272
1273         * UIProcess/WebPageProxy.cpp:
1274         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
1275         * WebProcess/WebPage/WebPage.cpp:
1276         (WebKit::WebPage::mouseEvent):
1277         (WebKit::WebPage::simulateMouseDown):
1278         (WebKit::WebPage::simulateMouseUp):
1279         (WebKit::WebPage::simulateMouseMotion):
1280         (WebKit::WebPage::consumeSandboxExtensions):
1281         (WebKit::WebPage::revokeSandboxExtensions):
1282         * WebProcess/WebPage/WebPage.h:
1283         * WebProcess/WebPage/WebPage.messages.in:
1284
1285 2020-11-27  Fujii Hironori  <Hironori.Fujii@sony.com>
1286
1287         Unreviewed, reverting r270210.
1288
1289         It broke TestWebKitAPI.GPUProcess.CrashWhilePlayingVideo on
1290         iOS
1291
1292         Reverted changeset:
1293
1294         "[WinCairo?] GPU process remains alive even after web process
1295         exited"
1296         https://bugs.webkit.org/show_bug.cgi?id=219321
1297         https://trac.webkit.org/changeset/270210
1298
1299 2020-11-27  Fujii Hironori  <Hironori.Fujii@sony.com>
1300
1301         [WinCairo?] GPU process remains alive even after web process exited
1302         https://bugs.webkit.org/show_bug.cgi?id=219321
1303
1304         Reviewed by Don Olmstead.
1305
1306         AuxiliaryProcess::didClose is calling _exit. However, GPUProcess
1307         overrode AuxiliaryProcess::didClose but it did nothing. GPUProcess
1308         doesn't need to override it.
1309
1310         * GPUProcess/GPUProcess.cpp:
1311         (WebKit::GPUProcess::didClose): Deleted.
1312         * GPUProcess/GPUProcess.h:
1313
1314 2020-11-27  Don Olmstead  <don.olmstead@sony.com>
1315
1316         Non-unified build fixes, late November 2020 edition, take two
1317         https://bugs.webkit.org/show_bug.cgi?id=219317
1318
1319         Unreviewed non-unified build fixes.
1320
1321         * Shared/WebPreferencesDefaultValues.cpp:
1322
1323 2020-11-27  Don Olmstead  <don.olmstead@sony.com>
1324
1325         Fix build when ENABLE_RESOURCE_LOAD_STATISTICS is disabled
1326         https://bugs.webkit.org/show_bug.cgi?id=219316
1327
1328         Unreviewed build fix.
1329
1330         Add ENABLE(RESOURCE_LOAD_STATISTICS) guards around NetworkSession requests for
1331         resource load statistics. Move firePrivateClickMeasurementTimerImmediately out of
1332         a ENABLE(RESOURCE_LOAD_STATISTICS) guard and place it where its ordered in the header.
1333
1334         This originally broke the PlayStation build before ENABLE_RESOURCE_LOAD_STATISTICS
1335         was turned on.
1336
1337         No new tests. No change in behavior.
1338
1339         * NetworkProcess/NetworkProcess.cpp:
1340         (WebKit::NetworkProcess::simulateResourceLoadStatisticsSessionRestart):
1341         * NetworkProcess/NetworkSession.cpp:
1342         (WebKit::NetworkSession::firePrivateClickMeasurementTimerImmediately):
1343         * NetworkProcess/PrivateClickMeasurementManager.cpp:
1344         (WebKit::PrivateClickMeasurementManager::storeUnattributed):
1345         (WebKit::PrivateClickMeasurementManager::attribute):
1346         (WebKit::PrivateClickMeasurementManager::clearSentAttributions):
1347         (WebKit::PrivateClickMeasurementManager::updateTimerLastFired):
1348         (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests):
1349         (WebKit::PrivateClickMeasurementManager::clear):
1350         (WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain):
1351         (WebKit::PrivateClickMeasurementManager::clearExpired):
1352         (WebKit::PrivateClickMeasurementManager::toString const):
1353         (WebKit::PrivateClickMeasurementManager::markAllUnattributedAsExpiredForTesting):
1354         (WebKit::PrivateClickMeasurementManager::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
1355
1356 2020-11-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1357
1358         Introduce new display list meta commands in preparation for webkit.org/b/219091
1359         https://bugs.webkit.org/show_bug.cgi?id=219262
1360
1361         Reviewed by Ryosuke Niwa.
1362
1363         See WebCore ChangeLog for more information. Additionally, rename `MetaCommandSwitchToItemBuffer` to
1364         `MetaCommandChangeItemBuffer`, for consistency with the new `MetaCommandChangeDestinationImageBuffer` item.
1365
1366         * GPUProcess/graphics/RemoteImageBuffer.h:
1367         * GPUProcess/graphics/RemoteRenderingBackend.cpp:
1368         (WebKit::RemoteRenderingBackend::decodeItem):
1369         * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
1370
1371 2020-11-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1372
1373         Remove some extraneous PLATFORM(IOS_FAMILY) guards in WKContentViewInteraction
1374         https://bugs.webkit.org/show_bug.cgi?id=219289
1375
1376         Reviewed by Sam Weinig.
1377
1378         Remove several redundant uses of `PLATFORM(IOS_FAMILY)`. The entire class is already conditional on
1379         `IOS_FAMILY`, so adding additional compile-time guards for iOS family is not necessary.
1380
1381         * UIProcess/ios/WKContentViewInteraction.h:
1382         * UIProcess/ios/WKContentViewInteraction.mm:
1383         (-[WKContentView setTimePickerValueToHour:minute:]):
1384         (-[WKContentView timePickerValueHour]):
1385         (-[WKContentView timePickerValueMinute]):
1386
1387 2020-11-27  Adrian Perez de Castro  <aperez@igalia.com>
1388
1389         Non-unified build fixes, late November 2020 edition
1390         https://bugs.webkit.org/show_bug.cgi?id=219306
1391
1392         Unreviewed non-unified build fixes.
1393
1394         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: Add missing
1395         PrivateClickMeasurementManager.h header.
1396         * NetworkProcess/PrivateClickMeasurementManager.cpp: Add missing NetworkSession.h header.
1397         * UIProcess/SpeechRecognitionServer.cpp:
1398         (WebKit::SpeechRecognitionServer::handleRequest): Add missing WebCore:: namespace to uses
1399         of the WebCore::SpeechRecognizer and WebCore::SpeechRecognitionUpdateType types.
1400
1401 2020-11-27  Yoshiaki Jitsukawa  <yoshiaki.jitsukawa@sony.com>
1402
1403         [PlayStation] Define platform argument coders for Font
1404         https://bugs.webkit.org/show_bug.cgi?id=219300
1405
1406         Reviewed by Fujii Hironori.
1407
1408         * PlatformPlayStation.cmake:
1409         * Shared/playstation/WebCoreArgumentCodersPlayStation.cpp: Added.
1410         Define required member functions of ArgumentCoder<Ref<WebCore::Font>> class.
1411
1412 2020-11-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1413
1414         Calling waitForAndDispatchImmediately<M> on a loop fails when multiple M messages arrive simultaneously
1415         https://bugs.webkit.org/show_bug.cgi?id=219240
1416
1417         Reviewed by Chris Dumez.
1418
1419         Fixes a race that may occur when calling `waitForAndDispatchImmediately<N>` in a loop, when multiple messages
1420         `N` arrive on the IPC thread simultaneously. This may result from the following sequence of events (note that
1421         (Main) and (IPC) in the timeline below refer to the main thread and IPC background thread, respectively):
1422
1423         (Main)  Call `waitForAndDispatchImmediately`, and begin waiting.
1424
1425         (IPC)   A message `N` arrives, and is handled in `processIncomingMessage` by setting the decoder of
1426                 `m_waitingForMessage` and notifying the condition variable.
1427
1428         (Main)  The main thread wakes up and starts to process `N`, clearing out `m_waitingForMessage` in the process.
1429
1430         (IPC)   A second message `N` arrives. We see that `m_waitingForMessage` is null, so we don't set the decoder
1431                 and bail. Instead, we prepare to call `enqueueIncomingMessage` and push the message onto the main
1432                 thread, *but importantly*, we haven't done so yet.
1433
1434         (Main)  Call `waitForAndDispatchImmediately` again, set `m_waitingForMessage`, and begin waiting. Since the
1435                 incoming message that was just received above has not been enqueued yet, we are unable to avoid waiting
1436                 due to the incoming message.
1437
1438         (IPC)   We finally call `enqueueIncomingMessage`, which pushes the message `N` into `m_incomingMessages` and
1439                 dispatches onto the main thread. However, this is too late, since the main thread is already stuck
1440                 waiting for the incoming IPC message that we've now just enqueued.
1441
1442         Two minor adjustments are required to fix this, described in the below comments. The combination of these two
1443         changes ensures that the scenario described above is impossible, since we'll either set `m_waitingForMessage`'s
1444         decoder and wake up the main thread in the case where `waitForMessage` is called before `processIncomingMessage`,
1445         or we'll bail early in `waitForMessage` with the enqueued IPC message in the case where `processIncomingMessage`
1446         runs before `waitForMessage`.
1447
1448         * Platform/IPC/Connection.cpp:
1449         (IPC::Connection::waitForMessage):
1450
1451         Move logic that checks the incoming messages queue when calling `Connection::waitForMessage` into the
1452         `m_waitForMessageMutex` critical section.
1453
1454         (IPC::Connection::processIncomingMessage):
1455
1456         Extend the critical section of `m_waitForMessageMutex` when processing an incoming message, such that it
1457         encompasses the part that enqueues the incoming message.
1458
1459 2020-11-26  Lauro Moura  <lmoura@igalia.com>
1460
1461         [GTK][GTK4] Building with GObject-Introspection support does not work
1462         https://bugs.webkit.org/show_bug.cgi?id=219221
1463
1464         Reviewed by Carlos Garcia Campos.
1465
1466         * PlatformGTK.cmake: Forward GTK version to gir scanner and use correct pkg-config package.
1467
1468 2020-11-26  Lauro Moura  <lmoura@igalia.com>
1469
1470         [GTK4] Declare lambda return type to avoid build error deducing it
1471         https://bugs.webkit.org/show_bug.cgi?id=219268
1472
1473         Reviewed by Adrian Perez de Castro.
1474
1475         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
1476         (WebKit::WebPopupMenuProxyGtk::createPopupMenu):
1477
1478 2020-11-26  Fujii Hironori  <Hironori.Fujii@sony.com>
1479
1480         [WinCairo] Enable GPU process
1481         https://bugs.webkit.org/show_bug.cgi?id=219294
1482
1483         Reviewed by Don Olmstead.
1484
1485         Added stub functions to build GPU process.
1486
1487         Invoke the following command to enable GPU process:
1488         > reg add HKEY_CURRENT_USER\Software\WebKit /v gpu_process_canvas_rendering /t REG_DWORD /d 1 /f
1489
1490         Invoke the following command to disable GPU process:
1491         > reg delete HKEY_CURRENT_USER\Software\WebKit /v gpu_process_canvas_rendering /f
1492
1493         * GPUProcess/media/win/RemoteMediaPlayerProxyWin.cpp: Added.
1494         (WebKit::RemoteMediaPlayerProxy::prepareForPlayback):
1495         (WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable):
1496         (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged):
1497         (WebKit::RemoteMediaPlayerProxy::enterFullscreen):
1498         (WebKit::RemoteMediaPlayerProxy::exitFullscreen):
1499         * GPUProcess/win/GPUProcessMainWin.cpp: Added.
1500         (WebKit::initializeAuxiliaryProcess<GPUProcess>):
1501         (WebKit::GPUProcessMain):
1502         * GPUProcess/win/GPUProcessWin.cpp: Added.
1503         (WebKit::GPUProcess::initializeProcess):
1504         (WebKit::GPUProcess::initializeProcessName):
1505         (WebKit::GPUProcess::initializeSandbox):
1506         * PlatformWin.cmake:
1507         * Shared/WebPreferencesDefaultValues.h:
1508         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
1509         (IPC::ArgumentCoder<FontAttributes>::encodePlatformData): Deleted.
1510         (IPC::ArgumentCoder<FontAttributes>::decodePlatformData): Deleted.
1511         (IPC::ArgumentCoder<Ref<Font>>::encodePlatformData): Deleted.
1512         (IPC::ArgumentCoder<Ref<Font>>::decodePlatformData): Deleted.
1513         * Shared/win/WebCoreArgumentCodersWin.cpp: Added.
1514         (IPC::ArgumentCoder<FontAttributes>::encodePlatformData):
1515         (IPC::ArgumentCoder<FontAttributes>::decodePlatformData):
1516         (IPC::ArgumentCoder<Ref<Font>>::encodePlatformData):
1517         (IPC::ArgumentCoder<Ref<Font>>::decodePlatformData):
1518         * Shared/win/WebPreferencesDefaultValuesWin.cpp: Added.
1519         (WebKit::isFeatureFlagEnabled):
1520         * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
1521         (WebKit::RemoteRenderingBackendProxy::submitDisplayList):
1522         (WebKit::RemoteRenderingBackendProxy::createItemBuffer):
1523         * WebProcess/GPU/media/win/VideoLayerRemoteWin.cpp: Added.
1524         (WebKit::createVideoLayerRemote):
1525
1526 2020-11-26  Youenn Fablet  <youenn@apple.com>
1527
1528         https://collab-project.github.io/videojs-record/demo/video-only.html is not working
1529         https://bugs.webkit.org/show_bug.cgi?id=219258
1530         <rdar://problem/69759808>
1531
1532         Reviewed by Eric Carlson.
1533
1534         Fixed a potential null pointer crash in case load is aborted by WebCore at creation time.
1535
1536         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
1537         (WebKit::MediaPlayerPrivateRemote::requestResource):
1538
1539 2020-11-26  Yoshiaki Jitsukawa  <yoshiaki.jitsukawa@sony.com>
1540
1541         [PlayStation] Enable ResourceLoadStatistics
1542         https://bugs.webkit.org/show_bug.cgi?id=219292
1543
1544         Reviewed by Fujii Hironori.
1545
1546         * PlatformPlayStation.cmake:
1547
1548 2020-11-21  Sihui Liu  <sihui_liu@apple.com>
1549
1550         Implement audio capture for SpeechRecognition on macOS
1551         https://bugs.webkit.org/show_bug.cgi?id=218855
1552         <rdar://problem/71331001>
1553
1554         Reviewed by Youenn Fablet.
1555
1556         * UIProcess/SpeechRecognitionPermissionManager.cpp:
1557         (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest): Check and enable mock devices based on 
1558         preference as SpeechRecognition needs it for testing.
1559         * UIProcess/SpeechRecognitionServer.cpp:
1560         (WebKit::SpeechRecognitionServer::start):
1561         (WebKit::SpeechRecognitionServer::requestPermissionForRequest):
1562         (WebKit::SpeechRecognitionServer::handleRequest):
1563         (WebKit::SpeechRecognitionServer::stop):
1564         (WebKit::SpeechRecognitionServer::abort):
1565         (WebKit::SpeechRecognitionServer::invalidate):
1566         (WebKit::SpeechRecognitionServer::sendUpdate):
1567         (WebKit::SpeechRecognitionServer::stopRequest): Deleted.
1568         (WebKit::SpeechRecognitionServer::abortRequest): Deleted.
1569         * UIProcess/SpeechRecognitionServer.h:
1570         * UIProcess/WebPageProxy.cpp:
1571         (WebKit::WebPageProxy::syncIfMockDevicesEnabledChanged):
1572         * UIProcess/WebPageProxy.h:
1573
1574 2020-11-21  Simon Fraser  <simon.fraser@apple.com>
1575
1576         Propagate the 'wheelEventGesturesBecomeNonBlocking' setting to the ScrollingTree
1577         https://bugs.webkit.org/show_bug.cgi?id=219241
1578
1579         Reviewed by Tim Horton.
1580
1581         Propagate the 'wheelEventGesturesBecomeNonBlocking' setting to the ScrollingTree
1582         via the ScrollingStateFrameScrollingNode, as we do for other settings.
1583
1584         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1585         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
1586
1587 2020-11-21  Simon Fraser  <simon.fraser@apple.com>
1588
1589         Add an Experimental Features for wheel event gestures becoming non-blocking
1590         https://bugs.webkit.org/show_bug.cgi?id=219236
1591
1592         Reviewed by Sam Weinig.
1593
1594         Add a feature flag for the behavior that is being added via webkit.org/b/218764,
1595         which is that only the first wheel event in a gesture is cancelable.
1596
1597         * Shared/WebPreferencesDefaultValues.cpp:
1598         (WebKit::defaultWheelEventGesturesBecomeNonBlocking):
1599         * Shared/WebPreferencesDefaultValues.h:
1600
1601 2020-11-21  Jiewen Tan  <jiewen_tan@apple.com>
1602
1603         [WebAuthn] Implement SPI for AuthenticationServices.Framework
1604         https://bugs.webkit.org/show_bug.cgi?id=218893
1605         <rdar://problem/71364731>
1606
1607         Reviewed by Alex Christensen.
1608
1609         This patch implements the SPI for AuthenticationServices.Framework, which is more or less a direct
1610         translation of the WebAuthn Web IDLs and a thin wrapper on top of functionalities of the WebAuthn
1611         process.
1612
1613         It deprecates the existing _WKWebAuthenticationPanel SPI which is for Safari to show UI only. This
1614         patch does not just repurpose the SPI but also modifies some of the implementations. The most noticeable one
1615         is the change of ownerships. Prior to this change, AuthenticatorManager owns the APIWebAuthenticationPanel.
1616         Now, it's the opposite way.
1617
1618         Since there will be a period of time that the deprecated implementation will coexist with the new implementation,
1619         this path also marks things that are meant to deprecate in the future to reduce confusions.
1620
1621         * UIProcess/API/APIWebAuthenticationPanel.cpp:
1622         (API::WebAuthenticationPanel::WebAuthenticationPanel):
1623         (API::WebAuthenticationPanel::handleRequest):
1624         (API::WebAuthenticationPanel::cancel const):
1625         * UIProcess/API/APIWebAuthenticationPanel.h:
1626         Implements the plumbing for the new SPI and owns the AuthenticatorManager now.
1627
1628         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
1629         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
1630         (-[_WKAuthenticationExtensionsClientOutputs initWithAppid:]):
1631         (-[_WKAuthenticatorResponse initWithRawId:extensions:]):
1632         (-[_WKAuthenticatorAssertionResponse initWithRawId:extensions:authenticatorData:signature:userHandle:]):
1633         (-[_WKAuthenticatorAttestationResponse initWithRawId:extensions:attestationObject:]):
1634         (-[_WKAuthenticatorSelectionCriteria init]):
1635         (-[_WKPublicKeyCredentialCreationOptions initWithRp:user:pubKeyCredParams:]):
1636         (-[_WKPublicKeyCredentialDescriptor initWithType:identifier:]):
1637         (-[_WKPublicKeyCredentialEntity initWithName:]):
1638         (-[_WKPublicKeyCredentialParameters initWithType:alg:]):
1639         (-[_WKPublicKeyCredentialRequestOptions init]):
1640         (-[_WKPublicKeyCredentialRpEntity initWithName:]):
1641         (-[_WKPublicKeyCredentialUserEntity initWithName:identifier:displayName:]):
1642         (-[_WKWebAuthenticationPanel init]):
1643         (vectorFromNSData):
1644         (encodeEntity):
1645         (publicKeyCredentialRpEntity):
1646         (publicKeyCredentialUserEntity):
1647         (publicKeyCredentialParameters):
1648         (authenticatorTransport):
1649         (authenticatorTransports):
1650         (publicKeyCredentialDescriptors):
1651         (authenticatorAttachment):
1652         (userVerification):
1653         (authenticatorSelectionCriteria):
1654         (attestationConveyancePreference):
1655         (authenticationExtensionsClientInputs):
1656         (+[_WKWebAuthenticationPanel convertToCoreCreationOptionsWithOptions:]):
1657         (wkAuthenticatorAttestationResponse):
1658         (-[_WKWebAuthenticationPanel makeCredentialWithHash:options:completionHandler:]):
1659         (+[_WKWebAuthenticationPanel convertToCoreRequestOptionsWithOptions:]):
1660         (wkAuthenticatorAssertionResponse):
1661         (-[_WKWebAuthenticationPanel getAssertionWithHash:options:completionHandler:]):
1662         (+[_WKWebAuthenticationPanel isUserVerifyingPlatformAuthenticatorAvailable]):
1663         Implements the SPI.
1664
1665         * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
1666         Marks things as to deprecate.
1667
1668 2020-11-20  Kate Cheney  <katherine_cheney@apple.com>
1669
1670         PCM: Persist pending ad clicks and attributions so they can survive browser restart
1671         https://bugs.webkit.org/show_bug.cgi?id=219134
1672         <rdar://problem/70470129>
1673
1674         Reviewed by John Wilander.
1675
1676         This patch migrates Private Click Measurement to use SQLite,
1677         which is beneficial because it requires less in-memory storage and
1678         persists PCM data across browser sessions. It also updates naming
1679         to match naming agreed upon in standards bodies:
1680
1681         - source -> sourceSite
1682         - campaign/campaignID -> sourceID
1683         - destination -> attributeOnSite
1684         - conversion/conversionValue -> attributionTriggerData
1685         - unconverted -> unattributed
1686         - convert(ed) -> attribute(d)
1687
1688         This adds 3 SQLite tables: one for clicks that haven't been
1689         attributed, one for attributions that haven't been sent, and one to
1690         store the last time the reports were sent to make sure reports get
1691         sent as soon as possible if needed after a browser restart.
1692
1693         Behavior is identical to existing PCM implementation with the addition
1694         of persistence. Existing PCM tests confirm no regressions.
1695
1696         Reviewed by John Wilander.
1697
1698         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1699         (WebKit::createTableQueries):
1700         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
1701         (WebKit::ResourceLoadStatisticsDatabaseStore::createUniqueIndices):
1702         (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
1703         (WebKit::ResourceLoadStatisticsDatabaseStore::destroyStatements):
1704         New queries to interact with PCM data.
1705
1706         (WebKit::ResourceLoadStatisticsDatabaseStore::updateTimerLastFired):
1707         (WebKit::ResourceLoadStatisticsDatabaseStore::timerLastFired):
1708         (WebKit::ResourceLoadStatisticsDatabaseStore::updatePrivateClickMeasurementAttributionTimes):
1709         Set earliestTimeToSend to be the original value minus the time passed since the last timer fire
1710         for each entry. If the result is less than 0, set to 0 so the report gets sent immediately.
1711
1712         (WebKit::ResourceLoadStatisticsDatabaseStore::buildPrivateClickMeasurementFromDatabase):
1713         Creates a PCM object from data in the database.
1714
1715         (WebKit::ResourceLoadStatisticsDatabaseStore::findPrivateClickMeasurement):
1716         (WebKit::ResourceLoadStatisticsDatabaseStore::insertPrivateClickMeasurement):
1717         (WebKit::ResourceLoadStatisticsDatabaseStore::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting):
1718         (WebKit::ResourceLoadStatisticsDatabaseStore::removeUnattributed):
1719         (WebKit::ResourceLoadStatisticsDatabaseStore::attributePrivateClickMeasurement):
1720         (WebKit::ResourceLoadStatisticsDatabaseStore::allAttributedPrivateClickMeasurement):
1721         (WebKit::ResourceLoadStatisticsDatabaseStore::clearPrivateClickMeasurement):
1722         (WebKit::ResourceLoadStatisticsDatabaseStore::clearExpiredPrivateClickMeasurement):
1723         (WebKit::ResourceLoadStatisticsDatabaseStore::attributionToString):
1724         (WebKit::ResourceLoadStatisticsDatabaseStore::privateClickMeasurementToString):
1725         (WebKit::ResourceLoadStatisticsDatabaseStore::clearSentAttributions):
1726         These functions use database queries to implement PCM functionality with exactly the same
1727         behavior as the in-memory PCM implementation.
1728
1729         (WebKit::ResourceLoadStatisticsDatabaseStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
1730         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1731         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
1732         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
1733         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1734         (WebKit::WebResourceLoadStatisticsStore::updateTimerLastFired):
1735         (WebKit::WebResourceLoadStatisticsStore::insertPrivateClickMeasurement):
1736         (WebKit::WebResourceLoadStatisticsStore::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting):
1737         (WebKit::WebResourceLoadStatisticsStore::attributePrivateClickMeasurement):
1738         (WebKit::WebResourceLoadStatisticsStore::allAttributedPrivateClickMeasurement):
1739         (WebKit::WebResourceLoadStatisticsStore::clearPrivateClickMeasurement):
1740         (WebKit::WebResourceLoadStatisticsStore::clearPrivateClickMeasurementForRegistrableDomain):
1741         (WebKit::WebResourceLoadStatisticsStore::clearExpiredPrivateClickMeasurement):
1742         (WebKit::WebResourceLoadStatisticsStore::privateClickMeasurementToString):
1743         (WebKit::WebResourceLoadStatisticsStore::clearSentAttributions):
1744         (WebKit::WebResourceLoadStatisticsStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
1745         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1746
1747         * NetworkProcess/NetworkProcess.cpp:
1748         (WebKit::NetworkProcess::firePrivateClickMeasurementTimerImmediately):
1749         (WebKit::NetworkProcess::simulateResourceLoadStatisticsSessionRestart):
1750         (WebKit::NetworkProcess::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
1751         Test functions to help simulate a browser restart after PCM data has expired during
1752         a session close. This is the only behavior change from the existing PCM implementation.
1753
1754         * NetworkProcess/NetworkProcess.h:
1755         * NetworkProcess/NetworkProcess.messages.in:
1756         * NetworkProcess/NetworkResourceLoader.cpp:
1757         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1758         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
1759         * NetworkProcess/NetworkResourceLoader.h:
1760         * NetworkProcess/NetworkSession.cpp:
1761         (WebKit::NetworkSession::NetworkSession):
1762         (WebKit::NetworkSession::firePrivateClickMeasurementTimerImmediately):
1763         (WebKit::NetworkSession::storePrivateClickMeasurement):
1764         (WebKit::NetworkSession::handlePrivateClickMeasurementConversion):
1765         (WebKit::NetworkSession::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
1766         (WebKit::NetworkSession::markPrivateClickMeasurementsAsExpiredForTesting):
1767         * NetworkProcess/NetworkSession.h:
1768
1769         * NetworkProcess/PrivateClickMeasurementManager.cpp:
1770         (WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager):
1771         Move constructor to cpp file to call startTimer(5_s) which will kick
1772         off sending any reports that have expired in the database. We should
1773         wait 5 seconds so we are sure ITP is up and running.
1774
1775         (WebKit::PrivateClickMeasurementManager::storeUnattributed):
1776         (WebKit::PrivateClickMeasurementManager::handleAttribution):
1777         (WebKit::PrivateClickMeasurementManager::startTimer):
1778         (WebKit::PrivateClickMeasurementManager::attribute):
1779         (WebKit::PrivateClickMeasurementManager::fireConversionRequest):
1780         (WebKit::PrivateClickMeasurementManager::clearSentAttributions):
1781         (WebKit::PrivateClickMeasurementManager::updateTimerLastFired):
1782         (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests):
1783         (WebKit::PrivateClickMeasurementManager::clear):
1784         (WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain):
1785         (WebKit::PrivateClickMeasurementManager::clearExpired):
1786         (WebKit::PrivateClickMeasurementManager::toString const):
1787         (WebKit::PrivateClickMeasurementManager::setConversionURLForTesting):
1788         (WebKit::PrivateClickMeasurementManager::markAllUnattributedAsExpiredForTesting):
1789         (WebKit::PrivateClickMeasurementManager::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
1790         (WebKit::PrivateClickMeasurementManager::storeUnconverted): Deleted.
1791         (WebKit::PrivateClickMeasurementManager::handleConversion): Deleted.
1792         (WebKit::PrivateClickMeasurementManager::convert): Deleted.
1793         (WebKit::PrivateClickMeasurementManager::firePendingConversionRequests): Deleted.
1794         (WebKit::PrivateClickMeasurementManager::markAllUnconvertedAsExpiredForTesting): Deleted.
1795         Implementation moved to ResourceLoadStatisticsDatabaseStore.
1796
1797         * NetworkProcess/PrivateClickMeasurementManager.h:
1798         (WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager): Deleted.
1799         Moved to cpp file.
1800
1801         (WebKit::PrivateClickMeasurementManager::m_sessionID): Deleted.
1802         * UIProcess/API/C/WKPage.cpp:
1803         (WKPageMarkAttributedPrivateClickMeasurementsAsExpiredForTesting):
1804         (WKPageSimulateResourceLoadStatisticsSessionRestart):
1805         * UIProcess/API/C/WKPagePrivate.h:
1806         * UIProcess/WebPageProxy.cpp:
1807         (WebKit::WebPageProxy::didCommitLoadForFrame):
1808         (WebKit::WebPageProxy::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
1809         (WebKit::WebPageProxy::simulateResourceLoadStatisticsSessionRestart):
1810         * UIProcess/WebPageProxy.h:
1811         Testing support.
1812
1813 2020-11-20  Simon Fraser  <simon.fraser@apple.com>
1814
1815         Dispatch main-thread overflow scrolls to the scrolling thread as we do for page scrolls
1816         https://bugs.webkit.org/show_bug.cgi?id=219213
1817
1818         Reviewed by Tim Horton.
1819         
1820         Unify the behavior of overflow scrolling and page scrolling for synchronous scrolls.
1821         
1822         Somewhat surprisingly, synchronous page scrolls move layers via a dispatch to the scrolling thread in
1823         FrameView::handleWheelEventForScrolling(), but overflow scrolls just did main thread compositing updates
1824         to set the new layer positions.
1825
1826         A future patch will require that the "began" event for a synchronous scroll gets back to the scrolling thread,
1827         so unify these code paths to have overflow scrolls also leverage handleWheelEventAfterMainThread(), via
1828         RenderLayer::handleWheelEventForScrolling().
1829
1830         There's some fallout from this. ThreadedScrollingTree::handleWheelEventAfterMainThread() calls into handleWheelEventWithNode(),
1831         but in this special case that codepath needs to know that we're in a special "post main thread" mode that should
1832             1. Behave as if the node is latched, i.e. don't propagate to parent nodes,
1833                and target the node if if it's scrolled to a the min or max to allow rubberbanding
1834             2. Scroll even if the node has synchronous scrolling reasons
1835         This mode is represented by the EventTargeting value.
1836
1837         Finally, EventHandler::handleWheelEventInternal() should only clear latching state if the content has called preventDefault()
1838         on the event.
1839
1840         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp:
1841         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleWheelEvent):
1842         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h:
1843         * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp:
1844         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::handleWheelEvent):
1845         * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.h:
1846
1847 2020-11-20  Simon Fraser  <simon.fraser@apple.com>
1848
1849         Rename some wheel-event handling functions for clarity
1850         https://bugs.webkit.org/show_bug.cgi?id=219211
1851
1852         Reviewed by Tim Horton.
1853         
1854         There are too many functions called wheelEvent() or handleWheelEvent(), making it hard
1855         to know which phase of handling they apply to. So rename some to handleWheelEventForScrolling(),
1856         which applies to the "default handling" phase after DOM event dispatch.
1857         
1858         In addition, make ScrollableArea's handleWheelEventForScrolling() virtual and have FrameView
1859         override it (a future patch will also add an override in RenderLayer).
1860         
1861         Rename ScrollingCoordinator::performDefaultWheelEventHandling() to use handleWheelEventForScrolling()
1862         for clarity.
1863
1864         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1865         (WebKit::PDFPlugin::handleWheelEvent):
1866
1867 2020-11-20  Ryan Haddad  <ryanhaddad@apple.com>
1868
1869         Unreviewed fix for my build fix.
1870
1871         * UIProcess/ios/WKActionSheetAssistant.mm:
1872         (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]):
1873         You have to spell DEPRECATED correctly for this to work.
1874
1875 2020-11-20  Ryan Haddad  <ryanhaddad@apple.com>
1876
1877         Unreviewed, fix the build with recent SDKs.
1878
1879         * UIProcess/ios/WKActionSheetAssistant.mm:
1880         (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]):
1881
1882 2020-11-20  Philippe Normand  <pnormand@igalia.com>
1883
1884         Unreviewed, GTK build warning fix
1885
1886         * UIProcess/Inspector/glib/RemoteInspectorClient.cpp: Mark configurationForRemoteInspector
1887         as override of corresponding parent class method declaration.
1888
1889 2020-11-19  Wenson Hsieh  <wenson_hsieh@apple.com>
1890
1891         REGRESSION (r259151): The "Convert Text to Traditional Chinese" services menu action is broken
1892         https://bugs.webkit.org/show_bug.cgi?id=219190
1893         <rdar://problem/71438389>
1894
1895         Reviewed by Tim Horton.
1896
1897         Some system services, such as "Convert Text to (Traditional|Simplified) Chinese", use `-[NSServicesMenuRequestor
1898         readSelectionFromPasteboard:]` to insert the contents of the given pasteboard into the current selection. After
1899         the changes in r259151, this requires the UI process to explicitly grant access to the contents of the given
1900         pasteboard, on behalf of the web content process.
1901
1902         Fix the bug by adding the missing call to `grantAccessToCurrentPasteboardData`. This is only called from API in
1903         the UI process, so it cannot be abused by a compromised web content process to grab the contents of
1904         `NSPasteboard`.
1905
1906         Test: PasteHTML.ReadSelectionFromPasteboard
1907
1908         * UIProcess/mac/WebPageProxyMac.mm:
1909         (WebKit::WebPageProxy::readSelectionFromPasteboard):
1910
1911 2020-11-19  Fujii Hironori  <Hironori.Fujii@sony.com>
1912
1913         [TextureMapper] Remove m_textureMapper from TextureMapperLayer
1914         https://bugs.webkit.org/show_bug.cgi?id=219191
1915
1916         Reviewed by Carlos Garcia Campos.
1917
1918         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1919         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
1920         (WebKit::CoordinatedGraphicsScene::ensureRootLayer):
1921         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp:
1922         (WebKit::LayerTreeHost::compositeLayersToContext):
1923         (WebKit::LayerTreeHost::flushPendingLayerChanges):
1924         (WebKit::LayerTreeHost::LayerTreeHost):
1925
1926 2020-11-19  Hoa Dinh  <dvh@apple.com>
1927
1928         Code formatting: change instances of "@synthesize a=b" to "@synthesize a = b".
1929         https://bugs.webkit.org/show_bug.cgi?id=219094
1930
1931         Reviewed by Wenson Hsieh.
1932
1933         There was a mix of "@synthesize a=b" and "@synthesize a = b" in the codebase.
1934         Most of the instances are "@synthesize a = b", with spaces around the equal sign.
1935         With https://bugs.webkit.org/show_bug.cgi?id=219092, we're changing the behavior of
1936         the code style checker to require spaces around the equal sign.
1937         The change replace all the instances of "@synthesize a=b" with "@synthesize a = b".
1938
1939         * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
1940         * UIProcess/API/Cocoa/WKPreviewActionItem.mm:
1941         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
1942         * UIProcess/Cocoa/WebViewImpl.mm:
1943         * UIProcess/QuickLookThumbnailLoader.mm:
1944         * UIProcess/WebAuthentication/Mock/MockNfcService.mm:
1945         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1946         * UIProcess/mac/ViewGestureControllerMac.mm:
1947         * UIProcess/mac/WKFullScreenWindowController.mm:
1948         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1949
1950 2020-11-19  Brent Fulgham  <bfulgham@apple.com>
1951
1952         Unreviewed rollout of r269890 and r269911 due to EME issues on Mac Mini.
1953
1954         * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
1955         * WebProcess/com.apple.WebProcess.sb.in:
1956
1957 2020-11-19  Chris Dumez  <cdumez@apple.com>
1958
1959         Web Inspector: Unable to Show JavaScript Console in empty tab in Safari Technology Preview
1960         https://bugs.webkit.org/show_bug.cgi?id=211590
1961         <rdar://problem/63000159>
1962
1963         Reviewed by Simon Fraser.
1964
1965         We used to launch the initial process for the inspected page from inside
1966         WebInspectorProxy::connect(). I thought this was a good bottleneck to
1967         make sure the inspected page has a process to inspect.
1968
1969         However, while WebInspectorProxy::connect() gets called by functions by
1970         WebInspectorProxy::show(), it does not get called by
1971         WebInspectorProxy::showConsole() for example.
1972
1973         To address this, I have moved the code that launches the inspected page's
1974         initial process from WebInspectorProxy::connect() to
1975         WebInspectorProxy::createFrontendPage(). This seems like a much better
1976         bottleneck.
1977
1978         * UIProcess/Inspector/WebInspectorProxy.cpp:
1979         (WebKit::WebInspectorProxy::connect):
1980         (WebKit::WebInspectorProxy::createFrontendPage):
1981
1982 2020-11-19  Per Arne Vollan  <pvollan@apple.com>
1983
1984         [macOS] Issue sandbox extension to Web Inspector service
1985         https://bugs.webkit.org/show_bug.cgi?id=219041
1986         <rdar://problem/71495287>
1987
1988         Reviewed by Brent Fulgham.
1989
1990         In preparation of blocking this service in the WebContent process, a sandbox extension should be issued if Safari's Develop menu is enabled.
1991         This extension will also be dynamically issued to all WebContent processes, if the Develop menu preference changes, by observing this
1992         preference.
1993
1994         * UIProcess/Cocoa/WebInspectorPreferenceObserver.h: Added.
1995         * UIProcess/Cocoa/WebInspectorPreferenceObserver.mm: Added.
1996         (+[WKWebInspectorPreferenceObserver sharedInstance]):
1997         (-[WKWebInspectorPreferenceObserver init]):
1998         (-[WKWebInspectorPreferenceObserver observeValueForKeyPath:ofObject:change:context:]):
1999         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2000         (WebKit::WebProcessPool::platformInitialize):
2001         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2002         (WebKit::WebProcessProxy::enableRemoteInspectorIfNeeded):
2003         * UIProcess/WebProcessPool.h:
2004         * WebKit.xcodeproj/project.pbxproj:
2005
2006 2020-11-19  Per Arne Vollan  <pvollan@apple.com>
2007
2008         [macOS] Issue sandbox extension to audio service if Media in the GPU process is not enabled
2009         https://bugs.webkit.org/show_bug.cgi?id=219051
2010         <rdar://problem/71500898>
2011
2012         Reviewed by Youenn Fablet.
2013
2014         Issue sandbox extension to com.apple.audio.audiohald for the WebContent process on macOS if Media in the GPU process is not enabled.
2015
2016         * UIProcess/WebPageProxy.cpp:
2017         (WebKit::mediaRelatedMachServices):
2018         * WebProcess/com.apple.WebProcess.sb.in:
2019
2020 2020-11-19  Joshua Watt  <JPEW.hacker@gmail.com>
2021
2022         [WPE] Prevent elements getting stuck in a pressed state when scrolling on a touchscreen
2023         https://bugs.webkit.org/show_bug.cgi?id=218903
2024
2025         Reviewed by Adrian Perez de Castro.
2026
2027         Stops the scroll gesture controller from eating touch up events and
2028         preventing them from propagating to the page when the controller is
2029         handling a scroll event. If the scroll logic prevents the events from
2030         propagating to the page, elements on the page (e.g. buttons) can get
2031         stuck in a pressed state when the user lifts their finger.
2032
2033         * UIProcess/API/wpe/ScrollGestureController.cpp:
2034         (WebKit::ScrollGestureController::handleEvent):
2035
2036 2020-11-19  Carlos Garcia Campos  <cgarcia@igalia.com>
2037
2038         Protect WebSocketChannel before calling client methods
2039         https://bugs.webkit.org/show_bug.cgi?id=216791
2040
2041         Reviewed by Youenn Fablet.
2042
2043         Ensure we keep a reference to the WebSocketChannel before calling client methods that might close the channel.
2044
2045         * WebProcess/Network/WebSocketChannel.cpp:
2046         (WebKit::WebSocketChannel::close):
2047         (WebKit::WebSocketChannel::fail):
2048         (WebKit::WebSocketChannel::didClose):
2049         (WebKit::WebSocketChannel::resume):
2050
2051 2020-11-18  Megan Gardner  <megan_gardner@apple.com>
2052
2053         Menu Bar support for app highlights in book.
2054         https://bugs.webkit.org/show_bug.cgi?id=219117
2055
2056         Reviewed by Wenson Hsieh.
2057
2058         Add menu stubs in iOS to support highlights for books in modern webkit. 
2059
2060         * UIProcess/ios/WKContentViewInteraction.mm:
2061         (-[WKContentView setUpInteraction]):
2062         (-[WKContentView canPerformAction:withSender:]):
2063         (-[WKContentView setupAppHighlightMenus]):
2064         (-[WKContentView createHighlightInCurrentGroupWithRange:]):
2065         (-[WKContentView createHighlightInNewGroupWithRange:]):
2066
2067 2020-11-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2068
2069         Rename MetaCommandSwitchTo to MetaCommandSwitchToItemBuffer
2070         https://bugs.webkit.org/show_bug.cgi?id=219130
2071
2072         Reviewed by Tim Horton.
2073
2074         * GPUProcess/graphics/RemoteImageBuffer.h:
2075         * GPUProcess/graphics/RemoteRenderingBackend.cpp:
2076         (WebKit::RemoteRenderingBackend::decodeItem):
2077         * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
2078
2079 2020-11-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2080
2081         [Concurrent display lists] Add a way for display lists to partially replay
2082         https://bugs.webkit.org/show_bug.cgi?id=219067
2083
2084         Reviewed by Simon Fraser.
2085
2086         See WebCore ChangeLog for more details.
2087
2088         * GPUProcess/graphics/RemoteImageBuffer.h:
2089
2090         Make `submitDisplayList` on `RemoteImageBuffer` return a `ReplayResult`.
2091
2092         (WebKit::RemoteImageBuffer::submitDisplayList):
2093         * GPUProcess/graphics/RemoteRenderingBackend.cpp:
2094         (WebKit::RemoteRenderingBackend::applyDisplayListsFromHandle):
2095         * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
2096         (WebKit::RemoteImageBufferProxy::submitDisplayList):
2097
2098 2020-11-18  Chris Dumez  <cdumez@apple.com>
2099
2100         Drop redundant code that tries to bump the QoS of the WebContent main thread of UserInteractive when handling a sync IPC
2101         https://bugs.webkit.org/show_bug.cgi?id=219110
2102
2103         Reviewed by Alex Christensen.
2104
2105         Drop redundant code that tries to bump the QoS of the WebContent main thread of UserInteractive when
2106         handling a sync IPC. Nowadays, we always run the main thread of the WebContent at UserInteractive QoS
2107         (see WTF::Thread::setCurrentThreadIsUserInteractive() call in WebProcess::initializeWebProcess()) so
2108         there is no need to boost the QoS during a sync IPC.
2109
2110         * Platform/IPC/Connection.cpp:
2111         (IPC::Connection::processIncomingMessage):
2112         * Platform/IPC/Connection.h:
2113         (IPC::Connection::setShouldBoostMainThreadOnSyncMessage): Deleted.
2114         * Platform/IPC/Decoder.h:
2115         (IPC::Decoder::setQOSClassOverride): Deleted.
2116         * WebProcess/WebProcess.cpp:
2117         (WebKit::WebProcess::initializeConnection):
2118
2119 2020-11-18  Darin Adler  <darin@apple.com>
2120
2121         Remove advanced plug-in feature: small plug-in blocking
2122         https://bugs.webkit.org/show_bug.cgi?id=219101
2123
2124         Reviewed by Anders Carlsson.
2125
2126         * WebProcess/WebPage/WebPage.cpp:
2127         (WebKit::pluginIsSmall): Deleted.
2128         (WebKit::WebPage::createPlugin): Removed code that blocks small plug-ins.
2129
2130 2020-11-18  Simon Fraser  <simon.fraser@apple.com>
2131
2132         Propagate wheel event handling back to the scrolling thread
2133         https://bugs.webkit.org/show_bug.cgi?id=219050
2134
2135         Reviewed by Chris Dumez.
2136         
2137         For now, use MainThreadForBlockingDOMEventDispatch for the default steps (used by non-macOS platforms).
2138
2139         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2140         (WebKit::RemoteScrollingCoordinatorProxy::handleWheelEvent):
2141         * WebProcess/WebPage/EventDispatcher.cpp:
2142         (WebKit::EventDispatcher::wheelEvent):
2143
2144 2020-11-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2145
2146         Clean up some code in SharedDisplayListHandle
2147         https://bugs.webkit.org/show_bug.cgi?id=219089
2148
2149         Reviewed by Geoff Garen.
2150
2151         Currently, `reservedCapacityAtStart` is defined as a constant 16 bytes, which is enough to encompass the
2152         contents of the header structure in a shared display list handle (i.e. an 8-byte atomic for the lock, and
2153         another 8 bytes for the unread count).
2154
2155         Instead of hard-coding this, we could simply make this a constexpr function that returns the size of
2156         `DisplayListSharedMemoryHeader` (rounded up to ensure alignment of all display list item data).
2157
2158         No change in behavior.
2159
2160         * GPUProcess/graphics/RemoteRenderingBackend.cpp:
2161         (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList):
2162         (WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle):
2163         * Shared/SharedDisplayListHandle.h:
2164         (WebKit::SharedDisplayListHandle::headerSize):
2165         * WebProcess/GPU/graphics/DisplayListWriterHandle.cpp:
2166         (WebKit::DisplayListWriterHandle::resetWritableOffsetIfPossible):
2167         * WebProcess/GPU/graphics/DisplayListWriterHandle.h:
2168         (WebKit::DisplayListWriterHandle::DisplayListWriterHandle):
2169         * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
2170         (WebKit::RemoteRenderingBackendProxy::createItemBuffer):
2171
2172         Also add a static assert that the size of a newly allocated buffer is larger than the reserved header capacity.
2173
2174 2020-11-18  Per Arne Vollan  <pvollan@apple.com>
2175
2176         [macOS] Fix message filter sandbox violation
2177         https://bugs.webkit.org/show_bug.cgi?id=219090
2178         <rdar://problem/71522043>
2179
2180         Reviewed by Geoffrey Garen.
2181
2182         The message filter in the WebContent process on macOS needs to allow some additional messages.
2183
2184         * WebProcess/com.apple.WebProcess.sb.in:
2185
2186 2020-11-18  Chris Dumez  <cdumez@apple.com>
2187
2188         [GPUProcess] Main thread of the GPUProcess should have same priority as main thread of the WebContent
2189         https://bugs.webkit.org/show_bug.cgi?id=219057
2190
2191         Reviewed by Simon Fraser.
2192
2193         Main thread of the GPUProcess should have same priority as main thread of the WebContent since it
2194         is doing rendering on its behalf.
2195
2196         For now, this means that on macOS, the main threads of the GPU and WebContent processes with both
2197         get UserInteractive QoS. On iOS, they will both still get UserInitiated QoS until our RunningBoard
2198         foreground process assertion get fixed to get the right priority (<rdar://problem/71499731>).
2199
2200         * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-OSX.plist:
2201         Use _ProcessType=App, similarly as what we do for the WebContent process. If we don't do
2202         this, the process is an adaptive daemon and its QoS can never be higher than UserInitiated.
2203         We need its priority to go to UserInteractive to match the WebContent process.
2204
2205         * GPUProcess/GPUProcess.cpp:
2206         (WebKit::GPUProcess::initializeGPUProcess):
2207         Request UserInteractive QoS for the main thread of the GPUProcess, similarly to what we do
2208         for the main thread of the WebContent process already in WebProcess::InitializeWebProcess().
2209
2210 2020-11-18  Sam Weinig  <weinig@apple.com>
2211
2212         Address additional feedback from https://bugs.webkit.org/show_bug.cgi?id=218960
2213         https://bugs.webkit.org/show_bug.cgi?id=219044
2214
2215         Reviewed by Alex Christensen.
2216
2217         * Shared/API/Cocoa/WKDataDetectorTypesInternal.h:
2218         (fromWKDataDetectorTypes):
2219         * UIProcess/WebPageProxy.cpp:
2220         (WebKit::WebPageProxy::detectDataInAllFrames):
2221         * UIProcess/WebPageProxy.h:
2222         * WebProcess/WebPage/WebPage.cpp:
2223         (WebKit::WebPage::updatePreferences):
2224         (WebKit::WebPage::detectDataInAllFrames):
2225         Update for rename of WebCore::DataDetectionTypes to WebCore::DataDetectionType.
2226
2227 2020-11-17  Tim Horton  <timothy_horton@apple.com>
2228
2229         GPU-process-hosted RemoteLayerBackingStore should flush off the main thread
2230         https://bugs.webkit.org/show_bug.cgi?id=219063
2231
2232         Reviewed by Simon Fraser.
2233
2234         * GPUProcess/graphics/RemoteRenderingBackend.h:
2235         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
2236         (WebKit::RemoteLayerBackingStore::display):
2237         Construct the ImageBuffer flusher /after/ submitting the final DisplayList,
2238         so that it takes the correct flush identifier.
2239
2240         * GPUProcess/graphics/RemoteImageBuffer.h:
2241         * GPUProcess/graphics/RemoteRenderingBackend.cpp:
2242         (WebKit::RemoteRenderingBackend::didFlush):
2243         (WebKit::RemoteRenderingBackend::flushDisplayListWasCommitted): Deleted.
2244         * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
2245         (WebKit::RemoteImageBufferProxy::didFlush):
2246         (WebKit::RemoteImageBufferProxy::lastSentFlushIdentifier const):
2247         (WebKit::RemoteImageBufferProxy::waitForDidFlushOnSecondaryThread):
2248         (WebKit::RemoteImageBufferProxy::hasPendingFlush const):
2249         (WebKit::RemoteImageBufferProxy::waitForDidFlushWithTimeout):
2250         (WebKit::ThreadSafeRemoteImageBufferFlusher::ThreadSafeRemoteImageBufferFlusher):
2251         (WebKit::RemoteImageBufferProxy::commitFlushDisplayList): Deleted.
2252         (WebKit::RemoteImageBufferProxy::isPendingFlush const): Deleted.
2253         (WebKit::RemoteImageBufferProxy::timeoutWaitForFlushDisplayListWasCommitted): Deleted.
2254         Some renames:
2255
2256         Rename flushDisplayListWasCommitted to didFlush; this is the back-message from
2257         GPU process to Web Content process that a FlushContext display list item was completed successfully.
2258         Rename isPendingFlush to hasPendingFlush, for grammar.
2259         Rename timeoutWaitForFlushDisplayListWasCommitted to waitForDidFlushWithTimeout, for similar reasons.
2260         Rename waitForFlushDisplayListWasCommitted to waitForDidFlush.
2261         Rename commitFlushDisplayList to didFlush.
2262
2263         * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
2264         (WebKit::RemoteRenderingBackendProxy::waitForDidFlush):
2265         (WebKit::RemoteRenderingBackendProxy::didFlush):
2266         (WebKit::RemoteRenderingBackendProxy::waitForFlushDisplayListWasCommitted): Deleted.
2267         (WebKit::RemoteRenderingBackendProxy::flushDisplayListWasCommitted): Deleted.
2268         * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
2269         * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in:
2270         Reimplement ThreadSafeRemoteImageBufferFlusher such that it waits
2271         (on the RemoteLayerTreeDrawingArea CommitQueue, in the only current use of it)
2272         for the correct flush reply to come in before continuing. This is analogous
2273         to what we do for in-process buffers, where we call CGContextFlush()
2274         in the flusher.
2275
2276 2020-11-17  Chris Dumez  <cdumez@apple.com>
2277
2278         [iOS] ASSERTION FAILED: Completion handler should always be called under WebKit::GPUProcess::didReceiveMessage
2279         https://bugs.webkit.org/show_bug.cgi?id=219055
2280         <rdar://problem/71508223>
2281
2282         Reviewed by Alex Christensen.
2283
2284         Make sure GPUProcess::prepareToSuspend() calls its completion handler to avoid delaying suspension
2285         and avoid assertion hits in debug.
2286
2287         * GPUProcess/GPUProcess.cpp:
2288         (WebKit::GPUProcess::prepareToSuspend):
2289
2290 2020-11-17  Chris Dumez  <cdumez@apple.com>
2291
2292         Make sure ProcessThrottler is always holding a ProcessAssertion for its child process
2293         https://bugs.webkit.org/show_bug.cgi?id=219053
2294
2295         Reviewed by Geoff Garen.
2296
2297         Make sure ProcessThrottler is always holding a ProcessAssertion for its child process. Previously, when changing the assertion
2298         type (e.g. when going from background to foreground) we would release the previous assertion and then take the new one.
2299
2300         RunningBoard developers recommend that we wait until the new ProcessAssertion is taken before we release the previous one to
2301         avoid churn. It is also important we always hold a ProcessAssertion at all times for the child process because the child process
2302         may exit otherwise.
2303
2304         * UIProcess/ProcessThrottler.cpp:
2305         (WebKit::ProcessThrottler::setAssertionType):
2306
2307 2020-11-17  Chris Dumez  <cdumez@apple.com>
2308
2309         [macOS] Stop using RunLoopType=_WebKit starting in Big Sur
2310         https://bugs.webkit.org/show_bug.cgi?id=219052
2311         <rdar://problem/61742969>
2312
2313         Reviewed by Geoffrey Garen.
2314
2315         Stop using RunLoopType=_WebKit starting in Big Sur. This was a temporary hack so that our WebProcesses would get the right
2316         scheduling priority. Starting with Big Sur, the right way to do this is to use _ProcessType=App and restore the RunLoopType
2317         to be NSRunLoop.
2318
2319         After this change, I have verified that the WebContent's main thread still runs at UserInteractive QoS. App Nap is also
2320         still working as expected.
2321
2322         * Configurations/WebContentService.xcconfig:
2323         * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-OSX.plist:
2324
2325 2020-11-17  Per Arne Vollan  <pvollan@apple.com>
2326
2327         [macOS] Issue sandbox extension to trust service if Media in the GPU process is not enabled
2328         https://bugs.webkit.org/show_bug.cgi?id=218986
2329         <rdar://problem/71439885>
2330
2331         Reviewed by Brent Fulgham.
2332
2333         Since Media is using the trust service, issue a sandbox extension to the WebContent process if Media in the GPU process is not enabled.
2334
2335         * UIProcess/WebPageProxy.cpp:
2336         (WebKit::mediaRelatedMachServices):
2337         * WebProcess/com.apple.WebProcess.sb.in:
2338
2339 2020-11-17  Sihui Liu  <sihui_liu@apple.com>
2340
2341         Add a default action for SpeechRecognition permission request
2342         https://bugs.webkit.org/show_bug.cgi?id=219021
2343
2344         Reviewed by Youenn Fablet.
2345
2346         When there is no delegate or selector for deciding user permission on speech recognition, force an alert and let 
2347         user decide. This is currently what we do for UserMedia permission request, and it makes testing easier. 
2348
2349         * SourcesCocoa.txt:
2350         * UIProcess/API/APIUIClient.h:
2351         (API::UIClient::decidePolicyForSpeechRecognitionPermissionRequest):
2352         * UIProcess/Cocoa/MediaPermissionUtilities.mm:
2353         (WebKit::visibleDomain):
2354         (WebKit::alertMessageText):
2355         (WebKit::allowButtonText):
2356         (WebKit::doNotAllowButtonText):
2357         (WebKit::alertForPermission):
2358         * UIProcess/Cocoa/UIDelegate.mm:
2359         (WebKit::UIDelegate::UIClient::decidePolicyForSpeechRecognitionPermissionRequest):
2360         * UIProcess/Cocoa/UserMediaPermissionRequestProxy.mm: Removed. Moved alert code to MediaPermissionUtilities so 
2361         it can be shared between UserMedia and SpeechRecognition.
2362         * UIProcess/MediaPermissionUtilities.h:
2363         * UIProcess/SpeechRecognitionPermissionManager.cpp:
2364         (WebKit::SpeechRecognitionPermissionManager::decideByDefaultAction):
2365         * UIProcess/SpeechRecognitionPermissionManager.h:
2366         * UIProcess/UserMediaPermissionRequestProxy.cpp:
2367         (WebKit::UserMediaPermissionRequestProxy::doDefaultAction):
2368         * UIProcess/UserMediaPermissionRequestProxy.h:
2369         * UIProcess/WebPageProxy.cpp:
2370         (WebKit::WebPageProxy::requestSpeechRecognitionPermissionByDefaultAction):
2371         * UIProcess/WebPageProxy.h:
2372         * WebKit.xcodeproj/project.pbxproj:
2373
2374 2020-11-17  Saagar Jha  <saagar@saagarjha.com>
2375
2376         Check com.apple.private.webkit.use-xpc-endpoint only on internal builds
2377         https://bugs.webkit.org/show_bug.cgi?id=215423
2378
2379         Reviewed by Per Arne Vollan.
2380
2381         Signing with com.apple.private entitlements can only be done by Apple internally. Thus,
2382         it should only checked for internal builds.
2383
2384         * Shared/Cocoa/XPCEndpoint.mm:
2385         (WebKit::XPCEndpoint::XPCEndpoint): Wrap check in USE(APPLE_INTERNAL_SDK).
2386         * Shared/Cocoa/XPCEndpointClient.mm:
2387         (WebKit::XPCEndpointClient::setEndpoint): Wrap check in USE(APPLE_INTERNAL_SDK).
2388
2389 2020-11-17  Brent Fulgham  <bfulgham@apple.com>
2390
2391         [macOS] Remove access to the unused AppleSNBFBUserClient IOKit class
2392         https://bugs.webkit.org/show_bug.cgi?id=219014
2393         <rdar://problem/70463873>
2394
2395         Reviewed by Eric Carlson.
2396
2397         Although we originally thought this was needed for H.264 decoding, testing shows
2398         that this class is never used in WebKit flows, and is not needed. We should remove it.
2399
2400         * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
2401         * WebProcess/com.apple.WebProcess.sb.in:
2402
2403 2020-11-17  Chris Dumez  <cdumez@apple.com>
2404
2405         [iOS] Stop leaking an XPC transaction in our XPC services
2406         https://bugs.webkit.org/show_bug.cgi?id=219036
2407
2408         Reviewed by Geoffrey Garen.
2409
2410         Stop leaking an XPC transaction in our XPC services on iOS. We were doing this to control the lifetime of our child services
2411         ourselves. However, this is not needed on iOS because the UIProcess takes RunningBoard process assertions on behalf of its
2412         child processes.
2413
2414         I have verified that our child processes do not exit/jetsam early. I have verified that our child processes are in the
2415         correct jetsam band (IDLE/0 when background and FG/10 when foreground). I have also verified that the main thread of these
2416         processes runs at UserInitiated QoS before and after this change.
2417
2418         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
2419         (WebKit::XPCServiceInitializer):
2420         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
2421         (WebKit::XPCServiceExit):
2422
2423 2020-11-17  Peng Liu  <peng.liu6@apple.com>
2424
2425         [Media In GPU Process][MSE] Add infrastructure needed to run MediaPlayerPrivateMediaSourceAVFObjC in the GPU process
2426         https://bugs.webkit.org/show_bug.cgi?id=218912
2427
2428         Reviewed by Eric Carlson.
2429
2430         Add MediaSourcePrivateRemote/RemoteMediaSourceProxy and SourceBufferPrivateRemote/RemoteSourceBufferProxy,
2431         and setup IPC connections for them.
2432
2433         * CMakeLists.txt:
2434         * DerivedSources-input.xcfilelist:
2435         * DerivedSources-output.xcfilelist:
2436         * DerivedSources.make:
2437         * GPUProcess/GPUProcessSessionParameters.h:
2438         * GPUProcess/media/RemoteLegacyCDMFactoryProxy.cpp:
2439         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
2440         (WebKit::RemoteMediaPlayerProxy::loadMediaSource):
2441         * GPUProcess/media/RemoteMediaPlayerProxy.h:
2442         * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
2443         * GPUProcess/media/RemoteMediaSourceProxy.cpp: Added.
2444         (WebKit::RemoteMediaSourceProxy::RemoteMediaSourceProxy):
2445         (WebKit::RemoteMediaSourceProxy::~RemoteMediaSourceProxy):
2446         (WebKit::RemoteMediaSourceProxy::setPrivateAndOpen):
2447         (WebKit::RemoteMediaSourceProxy::duration const):
2448         (WebKit::RemoteMediaSourceProxy::buffered const):
2449         (WebKit::RemoteMediaSourceProxy::seekToTime):
2450         (WebKit::RemoteMediaSourceProxy::monitorSourceBuffers):
2451         (WebKit::RemoteMediaSourceProxy::setLogIdentifier):
2452         (WebKit::RemoteMediaSourceProxy::failedToCreateRenderer):
2453         (WebKit::RemoteMediaSourceProxy::addSourceBuffer):
2454         * GPUProcess/media/RemoteMediaSourceProxy.h: Added.
2455         * GPUProcess/media/RemoteMediaSourceProxy.messages.in: Added.
2456         * GPUProcess/media/RemoteSourceBufferIdentifier.h: Added.
2457         * GPUProcess/media/RemoteSourceBufferProxy.cpp: Added.
2458         (WebKit::RemoteSourceBufferProxy::create):
2459         (WebKit::RemoteSourceBufferProxy::RemoteSourceBufferProxy):
2460         (WebKit::RemoteSourceBufferProxy::~RemoteSourceBufferProxy):
2461         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveInitializationSegment):
2462         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveSample):
2463         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHasAudio const):
2464         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHasVideo const):
2465         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateReenqueSamples):
2466         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidBecomeReadyForMoreSamples):
2467         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateFastSeekTimeForMediaTime):
2468         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateAppendComplete):
2469         (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveRenderingError):
2470         (WebKit::RemoteSourceBufferProxy::append):
2471         * GPUProcess/media/RemoteSourceBufferProxy.h: Added.
2472         * GPUProcess/media/RemoteSourceBufferProxy.messages.in: Added.
2473         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp:
2474         * Scripts/webkit/messages.py:
2475         * Sources.txt:
2476         * WebKit.xcodeproj/project.pbxproj:
2477         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
2478         (WebKit::MediaPlayerPrivateRemote::load):
2479         (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::load): Deleted.
2480         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
2481         * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: Added.
2482         (WebKit::MediaSourcePrivateRemote::create):
2483         (WebKit::MediaSourcePrivateRemote::MediaSourcePrivateRemote):
2484         (WebKit::MediaSourcePrivateRemote::~MediaSourcePrivateRemote):
2485         (WebKit::MediaSourcePrivateRemote::addSourceBuffer):
2486         (WebKit::MediaSourcePrivateRemote::durationChanged):
2487         (WebKit::MediaSourcePrivateRemote::markEndOfStream):
2488         (WebKit::MediaSourcePrivateRemote::unmarkEndOfStream):
2489         (WebKit::MediaSourcePrivateRemote::readyState const):
2490         (WebKit::MediaSourcePrivateRemote::setReadyState):
2491         (WebKit::MediaSourcePrivateRemote::waitForSeekCompleted):
2492         (WebKit::MediaSourcePrivateRemote::seekCompleted):
2493         (WebKit::MediaSourcePrivateRemote::logChannel const):
2494         * WebProcess/GPU/media/MediaSourcePrivateRemote.h: Added.
2495         * WebProcess/GPU/media/RemoteCDMConfiguration.h:
2496         * WebProcess/GPU/media/RemoteCDMInstanceConfiguration.h:
2497         * WebProcess/GPU/media/RemoteMediaPlayerManager.h:
2498         * WebProcess/GPU/media/RemoteMediaSourceIdentifier.h: Added.
2499         * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: Added.
2500         (WebKit::SourceBufferPrivateRemote::create):
2501         (WebKit::SourceBufferPrivateRemote::SourceBufferPrivateRemote):
2502         (WebKit::SourceBufferPrivateRemote::~SourceBufferPrivateRemote):
2503         (WebKit::SourceBufferPrivateRemote::setClient):
2504         (WebKit::SourceBufferPrivateRemote::append):
2505         (WebKit::SourceBufferPrivateRemote::abort):
2506         (WebKit::SourceBufferPrivateRemote::resetParserState):
2507         (WebKit::SourceBufferPrivateRemote::removedFromMediaSource):
2508         (WebKit::SourceBufferPrivateRemote::readyState const):
2509         (WebKit::SourceBufferPrivateRemote::setReadyState):
2510         (WebKit::SourceBufferPrivateRemote::flush):
2511         (WebKit::SourceBufferPrivateRemote::enqueueSample):
2512         (WebKit::SourceBufferPrivateRemote::isReadyForMoreSamples):
2513         (WebKit::SourceBufferPrivateRemote::setActive):
2514         (WebKit::SourceBufferPrivateRemote::notifyClientWhenReadyForMoreSamples):
2515         (WebKit::SourceBufferPrivateRemote::canSetMinimumUpcomingPresentationTime const):
2516         (WebKit::SourceBufferPrivateRemote::setMinimumUpcomingPresentationTime):
2517         (WebKit::SourceBufferPrivateRemote::clearMinimumUpcomingPresentationTime):
2518         (WebKit::SourceBufferPrivateRemote::canSwitchToType):
2519         (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateAppendComplete):
2520         (WebKit::SourceBufferPrivateRemote::logChannel const):
2521         * WebProcess/GPU/media/SourceBufferPrivateRemote.h: Added.
2522         * WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in: Added.
2523
2524 2020-11-17  Per Arne Vollan  <pvollan@apple.com>
2525
2526         [macOS] Perform AX TCC check in the UI process
2527         https://bugs.webkit.org/show_bug.cgi?id=218870
2528         <rdar://problem/71339830>
2529
2530         Reviewed by Brent Fulgham.
2531
2532         On behalf of the WebContent process, perform AX TCC check in the UI process on macOS.
2533         This is in preparation of blocking tccd in the WebContent process.
2534
2535         No new tests. It has been manually tested that the WebContent process is allowing VoiceOver
2536         to perform AX requests with this patch.
2537
2538         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2539         (WebKit::WebProcessProxy::isAXAuthenticated):
2540         * UIProcess/WebProcessProxy.h:
2541         * UIProcess/WebProcessProxy.messages.in:
2542         * WebProcess/cocoa/WebProcessCocoa.mm:
2543         (WebKit::isAXAuthenticatedCallback):
2544         (WebKit::WebProcess::platformInitializeWebProcess):
2545
2546 2020-11-17  Brian Burg  <bburg@apple.com>
2547
2548         [Cocoa] _WKInspectorExtensionHost should conform to NSObject protocol
2549         https://bugs.webkit.org/show_bug.cgi?id=219035
2550
2551         Reviewed by Alex Christensen.
2552
2553         This was overlooked in the initial patch. Without it, we can't call -isEqual: and
2554         similar basic methods on a type of id<_WKInspectorExtensionHost>.
2555
2556         * UIProcess/API/Cocoa/_WKInspectorExtensionHost.h:
2557
2558 2020-11-17  Tim Horton  <timothy_horton@apple.com>
2559
2560         Preemptive build fix for https://bugs.webkit.org/show_bug.cgi?id=219024
2561
2562         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
2563         (SOFT_LINK_CLASS):
2564         (-[WKAirPlayRoutePicker show:fromRect:]):
2565
2566 2020-11-17  Tim Horton  <timothy_horton@apple.com>
2567
2568         REGRESSION (r269824): YouTube media control bar sometimes flickers
2569         https://bugs.webkit.org/show_bug.cgi?id=219017
2570         <rdar://problem/71454799>
2571
2572         Reviewed by Simon Fraser.
2573
2574         Test: compositing/repaint/transparent-layer-repaint.html
2575
2576         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
2577         (WebKit::RemoteLayerBackingStore::display):
2578         I accidentally lost the Copy composite operator in r269824, causing
2579         the repaint copy-forward to blend instead of just copying.
2580         This wreaks havoc on layers with contents with colors that have 0 < alpha < 1,
2581         because every repaint means the colors intensify.
2582
2583 2020-11-16  Brent Fulgham  <bfulgham@apple.com>
2584
2585         [macOS] Remove access to the unused AppleIntelMEUserClient IOKit class
2586         https://bugs.webkit.org/show_bug.cgi?id=219012
2587         <rdar://problem/70462796>
2588
2589         Reviewed by Eric Carlson.
2590
2591         Although we originally thought this was needed for H.264 decoding, testing shows that
2592         this class is never used in WebKit flows, and is not needed. We should remove it.
2593
2594         * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
2595         * WebProcess/com.apple.WebProcess.sb.in:
2596
2597 2020-11-16  Per Arne Vollan  <pvollan@apple.com>
2598
2599         [macOS] Create sandbox extension for the power log service on internal installs
2600         https://bugs.webkit.org/show_bug.cgi?id=218984
2601         <rdar://problem/58488936>
2602
2603         Reviewed by Brent Fulgham.
2604
2605         Create a sandbox extension for the WebContent process for the power log service on macOS internal installs.
2606
2607         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2608         (WebKit::diagnosticServices):
2609         * WebProcess/com.apple.WebProcess.sb.in:
2610
2611 2020-11-16  Sam Weinig  <weinig@apple.com>
2612
2613         Standardize enums that are used by Settings in preperation for autogeneration
2614         https://bugs.webkit.org/show_bug.cgi?id=218960
2615
2616         Reviewed by Tim Horton.
2617
2618         Update enum uses for renames and scoped syntax use.
2619
2620         * UIProcess/API/C/WKAPICast.h:
2621         (WebKit::toAPI):
2622         (WebKit::toEditableLinkBehavior):
2623         (WebKit::toStorageBlockingPolicy):
2624         * UIProcess/API/C/WKPreferences.cpp:
2625         (WKPreferencesSetEditableLinkBehavior):
2626         (WKPreferencesSetStorageBlockingPolicy):
2627         (WKPreferencesGetStorageBlockingPolicy):
2628         * UIProcess/API/Cocoa/WKPreferences.mm:
2629         (toStorageBlockingPolicy):
2630         (toAPI):
2631         (-[WKPreferences _storageBlockingPolicy]):
2632         (-[WKPreferences _setStorageBlockingPolicy:]):
2633         (toEditableLinkBehavior):
2634         (-[WKPreferences _setEditableLinkBehavior:]):
2635         * UIProcess/WebPreferences.cpp:
2636         (WebKit::WebPreferences::createWithLegacyDefaults):
2637         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2638         (WebKit::WebSWContextManagerConnection::updatePreferencesStore):
2639         * WebProcess/Storage/WebSWContextManagerConnection.h:
2640         * WebProcess/WebPage/WebPage.cpp:
2641         (WebKit::WebPage::updatePreferences):
2642         (WebKit::WebPage::detectDataInAllFrames):
2643
2644 2020-11-16  John Wilander  <wilander@apple.com>
2645
2646         NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking() redacts the cookie name in log output on customer builds
2647         https://bugs.webkit.org/show_bug.cgi?id=218997
2648         <rdar://problem/71460604>
2649
2650         Unreviewed minor change to logging.
2651
2652         NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking() redacts the
2653         cookie name in log output on customer builds. This patch changes the format
2654         specifier from %s to %{public}s.
2655
2656         Note that this logging is just for ITP Debug Mode which is off by default, logs
2657         in-memory only, and is disabled again on browser quit.
2658
2659         No new tests. This just changes log output on customer builds.
2660
2661         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2662         (WebKit::NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking):
2663
2664 2020-11-16  Chris Dumez  <cdumez@apple.com>
2665
2666         [GPUProcess] Update GPUProcess process assertion based on active WebProcesses
2667         https://bugs.webkit.org/show_bug.cgi?id=219002
2668
2669         Reviewed by Simon Fraser.
2670
2671         Update GPUProcess process assertion based on active WebProcesses, similarly to what
2672         we do for the network process. Previously, we would never release the GPUProcess
2673         process assertion and it would time out after 30 seconds in the background.
2674
2675         * UIProcess/GPU/GPUProcessProxy.cpp:
2676         (WebKit::GPUProcessProxy::updateProcessAssertion):
2677         * UIProcess/WebProcessPool.cpp:
2678         (WebKit::WebProcessPool::updateProcessAssertions):
2679
2680 2020-11-16  Brent Fulgham  <bfulgham@apple.com>
2681
2682         [macOS] Remove remote tcp capability from WebContent Sandbox
2683         https://bugs.webkit.org/show_bug.cgi?id=218999
2684         <rdar://problem/70355789>
2685
2686         Reviewed by Per Arne Vollan.
2687
2688         Since we have moved all network activity (aside from some syslog use) out of the WebContent
2689         process, we do not need the ability to open remote tcp connections. We should deny this
2690         capability from our non-Network sandboxes.
2691
2692         * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
2693         * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
2694         * WebProcess/com.apple.WebProcess.sb.in:
2695
2696 2020-11-16  Devin Rousso  <drousso@apple.com>
2697
2698         Ignore deprecation warnings for the uniform types C API
2699         https://bugs.webkit.org/show_bug.cgi?id=218989
2700
2701         Reviewed by Tim Horton.
2702
2703         These should eventually be replaced with the ObjC API `UniformTypeIdentifiers.framework`.
2704         See <https://developer.apple.com/documentation/uniformtypeidentifiers>.
2705
2706         * Shared/ios/WebIconUtilities.mm:
2707         (WebKit::iconForFile):
2708         * Shared/mac/PasteboardTypes.mm:
2709         (WebKit::PasteboardTypes::forEditing):
2710         (WebKit::PasteboardTypes::forSelection):
2711         * UIProcess/API/Cocoa/APIAttachmentCocoa.mm:
2712         (API::isDeclaredOrDynamicTypeIdentifier):
2713         (API::Attachment::mimeType const):
2714         (API::Attachment::utiType const):
2715         (API::Attachment::setFileWrapperAndUpdateContentType):
2716         * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
2717         (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData):
2718         * UIProcess/Cocoa/WebViewImpl.mm:
2719         (WebKit::WebViewImpl::setPromisedDataForImage):
2720         * UIProcess/ios/WKContentView.mm:
2721         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
2722         * UIProcess/ios/WKContentViewInteraction.mm:
2723         (-[WKContentView supportedPasteboardTypesForCurrentSelection]):
2724         * UIProcess/ios/WKPDFView.mm:
2725         (-[WKPDFView actionSheetAssistant:performAction:]):
2726         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2727         (-[WKFileUploadPanel currentAvailableActionTitles]):
2728         (-[WKFileUploadPanel contextMenuInteraction:configurationForMenuAtLocation:]):
2729         (-[WKFileUploadPanel showFilePickerMenu]):
2730         (-[WKFileUploadPanel showDocumentPickerMenu]):
2731         (-[WKFileUploadPanel _uploadItemFromMediaInfo:successBlock:failureBlock:]):
2732         * UIProcess/mac/WebContextMenuProxyMac.mm:
2733         (WebKit::WebContextMenuProxyMac::setupServicesMenu):
2734
2735 2020-11-16  Don Olmstead  <don.olmstead@sony.com>
2736
2737         Non-unified build fixes, mid November 2020 edition
2738         https://bugs.webkit.org/show_bug.cgi?id=218911
2739
2740         Unreviewed build fix.
2741
2742         * UIProcess/SpeechRecognitionServer.cpp:
2743         (WebKit::SpeechRecognitionServer::start):
2744         (WebKit::SpeechRecognitionServer::requestPermissionForRequest):
2745         (WebKit::SpeechRecognitionServer::sendUpdate):
2746
2747 2020-11-16  Per Arne Vollan  <pvollan@apple.com>
2748
2749         [macOS] The WebContent sandbox does not apply for open source builds
2750         https://bugs.webkit.org/show_bug.cgi?id=218982
2751
2752         Reviewed by Alexey Proskuryakov.
2753
2754         The WebContent sandbox does not apply for open source builds on macOS, since it has enabled message filtering,
2755         which requires a private entitlement.
2756
2757         * WebProcess/com.apple.WebProcess.sb.in:
2758
2759 2020-11-16  Megan Gardner  <megan_gardner@apple.com>
2760
2761         Add menu support for app highlights for books
2762         https://bugs.webkit.org/show_bug.cgi?id=218879
2763         <rdar://problem/71352113>
2764
2765         Reviewed by Alex Christensen.
2766
2767         Add menu items and associated plumbing for support for books highlights in modern WebKit.
2768
2769         * FeatureFlags/WebKit.plist:
2770         * Shared/API/c/WKContextMenuItemTypes.h:
2771         * Shared/API/c/WKSharedAPICast.h:
2772         (WebKit::toAPI):
2773         (WebKit::toImpl):
2774         * Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:
2775         (WebKit::isFeatureFlagEnabled):
2776         * Shared/WebPreferencesDefaultValues.cpp:
2777         (WebKit::defaultAppHighlightsEnabled):
2778         * Shared/WebPreferencesDefaultValues.h:
2779         * UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm:
2780         * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
2781         * UIProcess/mac/WebContextMenuProxyMac.mm:
2782         (WebKit::menuItemIdentifier):
2783
2784 2020-11-16  Trevor Stevenson  <trevor_s@apple.com>
2785
2786         Add didReceiveResponseForResource to WKWebProcessPlugInLoadDelegate
2787         https://bugs.webkit.org/show_bug.cgi?id=218925
2788
2789         Reviewed by Alex Christensen.
2790
2791         Expose the callback for didReceiveResponseForResource in WKWebProcessPlugInLoadDelegate
2792         for use in the injected bundle.
2793
2794         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
2795         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2796         (didReceiveResponseForResource):
2797         (setUpResourceLoadClient):
2798
2799 2020-11-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2800
2801         WebDriver: do not focus the main frame when switching to a window
2802         https://bugs.webkit.org/show_bug.cgi?id=218383
2803
2804         Reviewed by Brian Burg.
2805
2806         The spec doesn't say we should focus the main frame. This is confusing WPT test
2807         infrastructure/testdriver/actions/crossOrigin.sub.html that first focuses an input in an iframe and then it send
2808         keyboard events to the window (after switching to the window again even when it's already the current one, that
2809         causes the iframe focus to be lost).
2810
2811         * UIProcess/Automation/WebAutomationSession.cpp:
2812         (WebKit::WebAutomationSession::switchToBrowsingContext):
2813         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2814         * WebProcess/Automation/WebAutomationSessionProxy.h:
2815         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
2816
2817 2020-11-16  Kimmo Kinnunen  <kkinnunen@apple.com>
2818
2819         Final refactor for WebGL implementation to use only GraphicsContextGL
2820         https://bugs.webkit.org/show_bug.cgi?id=218333
2821
2822         Reviewed by Simon Fraser.
2823
2824         Change MediaPlayerPrivate to use GraphicsContextGL abstract class
2825         instead of GraphicsContextGLOpenGL concrete class, since the
2826         calling code is doing the same change.
2827
2828         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
2829         (WebKit::MediaPlayerPrivateRemote::copyVideoTextureToPlatformTexture):
2830         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
2831
2832 2020-11-16  Devin Rousso  <drousso@apple.com>
2833
2834         [iPad] nhl.com cannot select new video to play while video is playing with desktop UA
2835         https://bugs.webkit.org/show_bug.cgi?id=218868
2836         <rdar://problem/67823088>
2837
2838         Reviewed by Antoine Quint.
2839
2840         The desktop "version" of this site uses custom media controls that don't work well on iOS
2841         because they rely on mouse events (which is why it was quirked in r255592). The mobile
2842         "version" uses the default/native media controls, so there is no issue.
2843
2844         Currently, when tapping on another video with a desktop UA, the site uses its touch event
2845         handlers for mouse events. These handlers call `Event.prototype.preventDefault` if the event
2846         is not a touch event, meaning that `"click"` is not fired. This prevents new videos from
2847         being played.
2848
2849         Rather than limit the quirk based on some DOM state (which is fragile if the site changes),
2850         just have the entire site default to a mobile UA.
2851
2852         * UIProcess/ios/WebPageProxyIOS.mm:
2853         (WebKit::desktopClassBrowsingRecommendedForRequest):
2854
2855 2020-11-16  Zan Dobersek  <zdobersek@igalia.com>
2856
2857         [CoordinatedGraphics] Adjust client resizing, render-scope notifying in ThreadedCompositor::renderLayerTree()
2858         https://bugs.webkit.org/show_bug.cgi?id=218701
2859
2860         Reviewed by Carlos Garcia Campos.
2861
2862         Rework the client operations in ThreadedCompositor::renderLayerTree() so
2863         that client resizing is done before the will-render client notification
2864         is dispatched. This ensures everything in the will-render-to-did-render
2865         scope is done for a well-specified size from the client's point of view.
2866
2867         Similar to this change, the GL viewport update is split from the client
2868         resize operation and moved into the aforementioned rendering scope. This
2869         change is mostly cosmetic, but it's done to neatly package all the GL
2870         operations into that scope.
2871
2872         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2873         (WebKit::ThreadedCompositor::renderLayerTree):
2874
2875 2020-11-15  Tim Horton  <timothy_horton@apple.com>
2876
2877         Initial implementation of DOM rendering via the GPU process
2878         https://bugs.webkit.org/show_bug.cgi?id=218928
2879
2880         Reviewed by Simon Fraser.
2881
2882         * Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
2883         (WebKit::RemoteLayerBackingStore::hasFrontBuffer const):
2884         (WebKit::RemoteLayerBackingStore::Buffer::operator bool const):
2885         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
2886         (WebKit::RemoteLayerBackingStore::encode const):
2887         (WebKit::RemoteLayerBackingStore::decode):
2888         (WebKit::RemoteLayerBackingStore::pixelFormat const):
2889         (WebKit::RemoteLayerBackingStore::bytesPerPixel const):
2890         (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
2891         (WebKit::RemoteLayerBackingStore::display):
2892         (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
2893         (WebKit::RemoteLayerBackingStore::takePendingFlusher):
2894         (WebKit::RemoteLayerBackingStore::setBufferVolatility):
2895         (WebKit::RemoteLayerBackingStore::Buffer::discard):
2896         (WebKit::RemoteLayerBackingStore::drawInContext): Deleted.
2897         (WebKit::RemoteLayerBackingStore::takeFrontContextPendingFlush): Deleted.
2898         (WebKit::RemoteLayerBackingStore::surfaceBufferFormat const): Deleted.
2899         Reimplement RemoteLayerBackingStore in terms of ImageBuffer instead of
2900         using ShareableBitmap + IOSurface explicitly.
2901         We use ConcreteImageBuffer versions of the shareable backends in the WebContent process
2902         in the non-GPU-process case, and normal DisplayList-backed RemoteImageBufferProxies
2903         in the GPU process case.
2904
2905         * UIProcess/ViewSnapshotStore.h:
2906         * UIProcess/mac/ViewSnapshotStoreMac.mm:
2907         (WebKit::ViewSnapshot::setVolatile):
2908         (WebKit::ViewSnapshot::asLayerContents):
2909         * WebProcess/GPU/graphics/ImageBufferBackendHandle.h:
2910         * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
2911         (WebKit::ThreadSafeRemoteImageBufferFlusher::ThreadSafeRemoteImageBufferFlusher):
2912         Add a hack to emulate ThreadSafeRemoteImageBufferFlusher; right now,
2913         we'll synchronously flush on the main thread when creating the flusher;
2914         a future patch will move this into the flush() method so that RemoteLayerBackingStore
2915         can do it on a secondary queue.
2916
2917         (WebKit::RemoteImageBufferProxy::createImageBufferBackendHandle):
2918         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2919         (WebKit::WebChromeClient::createImageBuffer const):
2920         (WebKit::WebChromeClient::ensureRemoteRenderingBackendProxy const): Deleted.
2921         * WebProcess/WebCoreSupport/WebChromeClient.h:
2922         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
2923         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
2924         (WebKit::RemoteLayerTreeContext::ensureRemoteRenderingBackendProxy):
2925         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
2926         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2927         (WebKit::RemoteLayerTreeDrawingArea::updateRendering):
2928         (WebKit::RemoteLayerTreeDrawingArea::BackingStoreFlusher::create):
2929         (WebKit::RemoteLayerTreeDrawingArea::BackingStoreFlusher::BackingStoreFlusher):
2930         (WebKit::RemoteLayerTreeDrawingArea::BackingStoreFlusher::flush):
2931         Reimplement BackingStoreFlusher in terms of the abstract ThreadSafeImageBufferFlusher.
2932
2933         * WebProcess/WebPage/WebPage.cpp:
2934         (WebKit::WebPage::ensureRemoteRenderingBackendProxy):
2935         * WebProcess/WebPage/WebPage.h:
2936         Move RemoteRenderingBackendProxy from WebChromeClient to WebPage, so that
2937         other non-WebCore clients can use it without having to think about WebChromeClient.
2938
2939 2020-11-14  Zan Dobersek  <zdobersek@igalia.com>
2940
2941         Unreviewed, suppressing GCC compilation warnings.
2942
2943         * UIProcess/API/wpe/ScrollGestureController.cpp:
2944         (WebKit::ScrollGestureController::handleEvent):
2945         Explicitly store the std::abs() results as uint32_t values. This avoids
2946         comparison between the otherwise-signed return values and the unsigned
2947         constants.
2948
2949 2020-11-13  Sihui Liu  <sihui_liu@apple.com>
2950
2951         Implement basic permission check for SpeechRecognition
2952         https://bugs.webkit.org/show_bug.cgi?id=218476
2953         <rdar://problem/71222638>
2954
2955         Reviewed by Youenn Fablet.
2956
2957         Introduce SpeechRecognitionPermissionManager, which checks and requests speech recognition permissions before 
2958         we actually start capturing audio and perform recognition. SpeechRecognitionPermissionManager is per-page, like
2959         SpeechRecognitionServer. The checks include:
2960         1. Sandbox requirement for microphone
2961         2. TCC check for microphone
2962         3. TCC check for SFSpeechRecognizer
2963         4. User permission on speech recognition for origin
2964
2965         Add a delegate function for requesting user permission. By default, user permission is not granted.
2966
2967         API test: WebKit2.SpeechRecognitionUserPermissionPersistence
2968
2969         * Headers.cmake:
2970         * Shared/API/APIObject.h:
2971         * Shared/API/c/WKBase.h:
2972         * Sources.txt:
2973         * SourcesCocoa.txt:
2974         * UIProcess/API/APIUIClient.h:
2975         (API::UIClient::decidePolicyForSpeechRecognitionPermissionRequest):
2976         * UIProcess/API/C/WKAPICast.h:
2977         * UIProcess/API/C/WKPage.cpp:
2978         (WKPageSetPageUIClient):
2979         * UIProcess/API/C/WKPageUIClient.h:
2980         * UIProcess/API/C/WKSpeechRecognitionPermissionCallback.cpp: Added.
2981         (WKSpeechRecognitionPermissionCallbackGetTypeID):
2982         (WKSpeechRecognitionPermissionCallbackComplete):
2983         * UIProcess/API/C/WKSpeechRecognitionPermissionCallback.h: Added.
2984         * UIProcess/API/Cocoa/WKPreferences.mm:
2985         (-[WKPreferences _speechRecognitionEnabled]):
2986         (-[WKPreferences _setSpeechRecognitionEnabled:]):
2987         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2988         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2989         * UIProcess/Cocoa/MediaPermissionUtilities.mm: Added.
2990         (WebKit::checkSandboxRequirementForType):
2991         (WebKit::checkUsageDescriptionStringForType):
2992         (WebKit::checkUsageDescriptionStringForSpeechRecognition):
2993         (WebKit::requestAVCaptureAccessForType):
2994         (WebKit::checkAVCaptureAccessForType):
2995         (WebKit::requestSpeechRecognitionAccess):
2996         (WebKit::checkSpeechRecognitionServiceAccess):
2997         * UIProcess/Cocoa/UIDelegate.h:
2998         * UIProcess/Cocoa/UIDelegate.mm:
2999         (WebKit::UIDelegate::UIClient::decidePolicyForSpeechRecognitionPermissionRequest):
3000         * UIProcess/Cocoa/UserMediaPermissionRequestManagerProxy.mm:
3001         (WebKit::UserMediaPermissionRequestManagerProxy::permittedToCaptureAudio):
3002         (WebKit::UserMediaPermissionRequestManagerProxy::permittedToCaptureVideo):
3003         (WebKit::UserMediaPermissionRequestManagerProxy::requestSystemValidation):
3004         (WebKit::requestAVCaptureAccessForMediaType): Deleted.
3005         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
3006         * UIProcess/MediaPermissionUtilities.h: Copied from Added.
3007         * UIProcess/SpeechRecognitionPermissionManager.cpp: Added.
3008         (WebKit::computeMicrophoneAccess):
3009         (WebKit::computeSpeechRecognitionServiceAccess):
3010         (WebKit::SpeechRecognitionPermissionManager::SpeechRecognitionPermissionManager):
3011         (WebKit::SpeechRecognitionPermissionManager::~SpeechRecognitionPermissionManager):
3012         (WebKit::SpeechRecognitionPermissionManager::request):
3013         (WebKit::SpeechRecognitionPermissionManager::startNextRequest):
3014         (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest):
3015         (WebKit::SpeechRecognitionPermissionManager::continueProcessingRequest):
3016         (WebKit::SpeechRecognitionPermissionManager::completeCurrentRequest):
3017         (WebKit::SpeechRecognitionPermissionManager::requestSpeechRecognitionServiceAccess):
3018         (WebKit::SpeechRecognitionPermissionManager::requestMicrophoneAccess):
3019         (WebKit::SpeechRecognitionPermissionManager::requestUserPermission):
3020         * UIProcess/SpeechRecognitionPermissionManager.h: Added.
3021         * UIProcess/SpeechRecognitionPermissionRequest.h: Added.
3022         (WebKit::SpeechRecognitionPermissionRequest::create):
3023         (WebKit::SpeechRecognitionPermissionRequest::complete):
3024         (WebKit::SpeechRecognitionPermissionRequest::origin const):
3025         (WebKit::SpeechRecognitionPermissionRequest::SpeechRecognitionPermissionRequest):
3026         (WebKit::SpeechRecognitionPermissionCallback::create):
3027         (WebKit::SpeechRecognitionPermissionCallback::complete):
3028         (WebKit::SpeechRecognitionPermissionCallback::SpeechRecognitionPermissionCallback):
3029         * UIProcess/SpeechRecognitionServer.cpp:
3030         (WebKit::SpeechRecognitionServer::SpeechRecognitionServer):
3031         (WebKit::SpeechRecognitionServer::start):
3032         (WebKit::SpeechRecognitionServer::requestPermissionForRequest):
3033         (WebKit::SpeechRecognitionServer::stop):
3034         (WebKit::SpeechRecognitionServer::abort):
3035         (WebKit::SpeechRecognitionServer::invalidate):
3036         (WebKit::SpeechRecognitionServer::handleRequest):
3037         (WebKit::SpeechRecognitionServer::stopRequest):
3038         (WebKit::SpeechRecognitionServer::abortRequest):
3039         (WebKit::SpeechRecognitionServer::sendUpdate):
3040         (WebKit::SpeechRecognitionServer::processNextPendingRequestIfNeeded): Deleted.
3041         (WebKit::SpeechRecognitionServer::removePendingRequest): Deleted.
3042         (WebKit::SpeechRecognitionServer::startPocessingRequest): Deleted.
3043         (WebKit::SpeechRecognitionServer::stopProcessingRequest): Deleted.
3044         * UIProcess/SpeechRecognitionServer.h:
3045         * UIProcess/SpeechRecognitionServer.messages.in:
3046         * UIProcess/WebPageProxy.cpp:
3047         (WebKit::WebPageProxy::didChangeMainDocument):
3048         (WebKit::WebPageProxy::resetState):
3049         (WebKit::WebPageProxy::requestSpeechRecognitionPermission):
3050         * UIProcess/WebPageProxy.h:
3051         * UIProcess/WebProcessProxy.cpp:
3052         (WebKit::WebProcessProxy::createSpeechRecognitionServer):
3053         * WebKit.xcodeproj/project.pbxproj:
3054         * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp:
3055         (WebKit::WebSpeechRecognitionConnection::start):
3056         (WebKit::WebSpeechRecognitionConnection::didReceiveUpdate):
3057         * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.h:
3058
3059 2020-11-13  Chris Dumez  <cdumez@apple.com>
3060
3061         [GPUProcess] Add basic GPUProcess crash handling for canvas
3062         https://bugs.webkit.org/show_bug.cgi?id=218924
3063
3064         Reviewed by Simon Fraser.
3065
3066         Update RemoteRenderingBackendProxy to be a GPUProcessConnection::Client so that it
3067         gets notified when the IPC connection to the GPUProcess gets severed. When this
3068         happens, RemoteRenderingBackendProxy clears all its SharedMemory handles and
3069         sends IPC messages to the GPU process to recreate all the ImageBuffers we had.
3070
3071         * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
3072         (WebKit::RemoteImageBufferProxy::create):
3073         (WebKit::RemoteImageBufferProxy::clearBackend):
3074         (WebKit::RemoteImageBufferProxy::size const):
3075         (WebKit::RemoteImageBufferProxy::renderingMode const):
3076         (WebKit::RemoteImageBufferProxy::colorSpace const):
3077         (WebKit::RemoteImageBufferProxy::pixelFormat const):
3078         (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy):
3079         * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
3080         (WebKit::RemoteRenderingBackendProxy::RemoteRenderingBackendProxy):
3081         (WebKit::RemoteRenderingBackendProxy::connectToGPUProcess):
3082         (WebKit::recreateImage):
3083         (WebKit::RemoteRenderingBackendProxy::gpuProcessConnectionDidClose):
3084         (WebKit::RemoteRenderingBackendProxy::createImageBuffer):
3085         * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
3086         * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h:
3087         (WebKit::RemoteResourceCacheProxy::imageBuffers const):
3088
3089 2020-11-13  Chris Dumez  <cdumez@apple.com>
3090
3091         [GPUProcess] Add basic low memory handling in the GPUProcess
3092         https://bugs.webkit.org/show_bug.cgi?id=218926
3093         <rdar://problem/70300888>
3094
3095         Reviewed by Geoffrey Garen.
3096
3097         Add basic low memory handling in the GPUProcess. For now, the GPUProcess only calls
3098         WTF::releaseFastMallocFreeMemory() on low memory warning.
3099
3100         * GPUProcess/GPUProcess.cpp:
3101         (WebKit::GPUProcess::initializeGPUProcess):
3102
3103 2020-11-13  Kate Cheney  <katherine_cheney@apple.com>
3104
3105         Can't login to Microsoft Teams
3106         https://bugs.webkit.org/show_bug.cgi?id=218778
3107         <rdar://problem/36331568>
3108
3109         Reviewed by John Wilander.
3110
3111         This is a temporary quirk to assist a high-traffic website while they
3112         complete the large task of migrating away from login flows that
3113         require third party cookies. This quirk will be removed when the site
3114         is updated.
3115
3116         Create a quirk to call the Storage Access API on behalf of Microsoft.
3117
3118         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3119         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
3120         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
3121         Relax the requirement for user interaction for a specific third party
3122         needing cookies for authentication purposes.
3123
3124         (WebKit::ResourceLoadStatisticsDatabaseStore::clear):
3125         (WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess):
3126         Relax the requirement for user interaction for a specific third party
3127         needing cookies for authentication purposes.
3128
3129         (WebKit::ResourceLoadStatisticsDatabaseStore::domainsWithStorageAccess const):
3130         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking):
3131         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
3132         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3133         (WebKit::ResourceLoadStatisticsMemoryStore::clear):
3134         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
3135         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3136         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessEphemeral):
3137         Relax user interaction for reasons above.
3138
3139         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
3140         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3141         (WebKit::RegistrableDomainsToBlockCookiesFor::isolatedCopy const):
3142         * Shared/WebProcessDataStoreParameters.h:
3143         (WebKit::WebProcessDataStoreParameters::encode const):
3144         (WebKit::WebProcessDataStoreParameters::decode):
3145         * UIProcess/Network/NetworkProcessProxy.cpp:
3146         (WebKit::NetworkProcessProxy::setDomainsWithCrossPageStorageAccess):
3147         * UIProcess/Network/NetworkProcessProxy.h:
3148         * UIProcess/Network/NetworkProcessProxy.messages.in:
3149         * UIProcess/WebProcessPool.cpp:
3150         (WebKit::WebProcessPool::webProcessDataStoreParameters):
3151         (WebKit::WebProcessPool::setDomainsWithCrossPageStorageAccess):
3152         * UIProcess/WebProcessPool.h:
3153         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
3154         (WebKit::WebResourceLoadObserver::hasCrossPageStorageAccess const):
3155         (WebKit::WebResourceLoadObserver::setDomainsWithCrossPageStorageAccess):
3156         * WebProcess/WebCoreSupport/WebResourceLoadObserver.h:
3157         * WebProcess/WebProcess.cpp:
3158         (WebKit::WebProcess::setWebsiteDataStoreParameters):
3159         (WebKit::WebProcess::setDomainsWithCrossPageStorageAccess):
3160         Add quirk'd domains to have page level storage access to be able to
3161         use document.cookie.
3162
3163         * WebProcess/WebProcess.h:
3164         * WebProcess/WebProcess.messages.in:
3165         Forward domains with the storage access quirk to the web process to
3166         avoid an async call to the network process.
3167
3168 2020-11-13  Sam Weinig  <weinig@apple.com>
3169
3170         Move some more WebKit and WebKitLegacy preferences bound to Settings to WebPreferences.yaml
3171         https://bugs.webkit.org/show_bug.cgi?id=218914
3172
3173         Reviewed by Tim Horton.
3174
3175         * Shared/WebPageCreationParameters.cpp:
3176         (WebKit::WebPageCreationParameters::encode const):
3177         (WebKit::WebPageCreationParameters::decode):
3178         * Shared/WebPageCreationParameters.h:
3179         * UIProcess/WebPageProxy.cpp:
3180         (WebKit::WebPageProxy::creationParameters):
3181         * UIProcess/WebPageProxy.h:
3182         * UIProcess/mac/WebPageProxyMac.mm:
3183         (WebKit::WebPageProxy::appleMailPaginationQuirkEnabled): Deleted.
3184         (WebKit::WebPageProxy::appleMailLinesClampEnabled): Deleted.
3185         Removes appleMailPaginationQuirkEnabled and appleMailLinesClampEnabled. 
3186         appleMailPaginationQuirkEnabled is now handled via the preferences infrastructure
3187         and appleMailLinesClampEnabled was unused.
3188
3189         * Shared/WebPreferencesDefaultValues.cpp:
3190         (WebKit::defaultAppleMailPaginationQuirkEnabled):
3191         * Shared/WebPreferencesDefaultValues.h:
3192         Adds default value for AppleMailPaginationQuirkEnabled, which is now in WebPreferences.yaml.
3193         Moved from WebPageProxyMac.mm
3194
3195         * WebProcess/WebPage/WebPage.cpp:
3196         (WebKit::WebPage::updatePreferences):
3197         Removes explicit setting of setAppleMailPaginationQuirkEnabled, setContentDispositionAttachmentSandboxEnabled,
3198         setScrollingPerformanceLoggingEnabled and setUseImageDocumentForSubframePDF which are all generated now.
3199         LayoutViewportHeightExpansionFactor was already generated so this call was just redundant.
3200
3201         * WebProcess/WebPage/WebPage.h:
3202         (WebKit::WebPage::setScrollingPerformanceLoggingEnabled): Deleted.
3203         It's also no longer necessary to store m_scrollingPerformanceLoggingEnabled as the value
3204         can be extracted directly from the store in the one place it was read. setScrollingPerformanceLoggingEnabled
3205         was never called, so has been removed.
3206
3207         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3208         (WebKit::TiledCoreAnimationDrawingArea::updatePreferences):
3209         Extract scrollingPerformanceLoggingEnabled directly from the store rather than having the page
3210         set it just for this one place to read it.
3211
3212 2020-11-13  Geoffrey Garen  <ggaren@apple.com>
3213
3214         Removed DeferrableTaskTimer
3215         https://bugs.webkit.org/show_bug.cgi?id=218874
3216
3217         Reviewed by Chris Dumez.
3218
3219         It was (mostly) redundant.
3220
3221         * UIProcess/WebPageProxy.cpp:
3222         (WebKit::WebPageProxy::updateReportedMediaCaptureState):
3223         * UIProcess/WebPageProxy.h: Use WTF::RunLoop::Timer instead of
3224         WebCore::Timer because WebCore::Timer for WebKit code in the UI process
3225         is a no-no, which can crash if the UI process also uses WebThread.
3226
3227 2020-11-13  Per Arne Vollan  <pvollan@apple.com>
3228
3229         [macOS] Issue sandbox extension to the WebContent process for com.apple.lskdd
3230         https://bugs.webkit.org/show_bug.cgi?id=218920
3231         <rdar://problem/69168801>
3232
3233         Reviewed by Geoffrey Garen.
3234
3235         This is a Media related service, and a sandbox extension should be issued to the WebContent process based on GPU runtime settings.
3236
3237         No new tests, covered by existing tests.
3238
3239         * UIProcess/WebPageProxy.cpp:
3240         (WebKit::mediaRelatedMachServices):
3241         * WebProcess/com.apple.WebProcess.sb.in:
3242
3243 2020-11-13  Claudio Saavedra  <csaavedra@igalia.com>
3244
3245         Non-unified build fixes.
3246         https://bugs.webkit.org/show_bug.cgi?id=218905
3247
3248         Unreviewed.
3249
3250         * GPUProcess/graphics/RemoteRenderingBackend.cpp:
3251         * GPUProcess/graphics/RemoteResourceCache.h:
3252
3253 2020-11-13  Alex Christensen  <achristensen@webkit.org>
3254
3255         Remove more SecItemShim leftovers
3256         https://bugs.webkit.org/show_bug.cgi?id=218919
3257
3258         Reviewed by Geoffrey Garen.
3259
3260         * Configurations/SecItemShim.xcconfig: Removed.
3261         * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkServiceEntryPoint.mm:
3262         (NETWORK_SERVICE_INITIALIZER):
3263         * PlatformMac.cmake:
3264         * WebKit.xcodeproj/project.pbxproj:
3265
3266 2020-11-12  Darin Adler  <darin@apple.com>
3267
3268         Remove unused advanced plug-in features: snapshotting and plug-in load policy
3269         https://bugs.webkit.org/show_bug.cgi?id=218835
3270
3271         Reviewed by Tim Horton.
3272
3273         * PluginProcess/mac/PluginProcessMac.mm:
3274         (WebKit::muteAudio): Deleted.
3275         (WebKit::PluginProcess::platformInitializePluginProcess):
3276
3277         * Scripts/webkit/messages.py: Remove PluginProcessType.
3278         * Shared/Plugins/PluginProcessAttributes.h: Ditto.
3279         * Shared/Plugins/PluginProcessCreationParameters.cpp:
3280         (WebKit::PluginProcessCreationParameters::encode const): Ditto.
3281         (WebKit::PluginProcessCreationParameters::decode): Ditto.
3282         * Shared/Plugins/PluginProcessCreationParameters.h: Ditto.
3283
3284         * Shared/WebProcessCreationParameters.cpp:
3285         (WebKit::WebProcessCreationParameters::encode const): Remove plugInAutoStartOrigins
3286         and pluginLoadClientPolicies.
3287         (WebKit::WebProcessCreationParameters::decode): Ditto.
3288         * Shared/WebProcessCreationParameters.h: Ditto.
3289
3290         * Shared/WebProcessDataStoreParameters.h:
3291         (WebKit::WebProcessDataStoreParameters::encode const): Remove plugInAutoStartOriginHashes.
3292         (WebKit::WebProcessDataStoreParameters::decode): Ditto.
3293
3294         * Sources.txt: Remove PlugInAutoStartProvider.cpp and WebPlugInClient.cpp.
3295
3296         * UIProcess/API/C/WKContext.cpp:
3297         (WKContextCopyPlugInAutoStartOriginHashes): Return nullptr.
3298         (WKContextSetPlugInAutoStartOriginHashes): Do nothing.
3299         (WKContextSetPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime): Ditto.
3300         (WKContextSetPlugInAutoStartOrigins): Ditto.
3301
3302         * UIProcess/API/C/WKPage.cpp:
3303         (WKPageSetPageNavigationClient): Remove decidePolicyForPluginLoad.
3304
3305         * UIProcess/API/C/WKPreferences.cpp:
3306         (WKPreferencesSetPlugInSnapshottingEnabled): Do nothing.
3307         (WKPreferencesGetPlugInSnapshottingEnabled): Return false.
3308         (WKPreferencesSetSnapshotAllPlugIns): Do nothing.
3309         (WKPreferencesGetSnapshotAllPlugIns): Return false.
3310         (WKPreferencesSetAutostartOriginPlugInSnapshottingEnabled): Do nothing.
3311         (WKPreferencesGetAutostartOriginPlugInSnapshottingEnabled): Return false.
3312         (WKPreferencesSetPrimaryPlugInSnapshotDetectionEnabled): Do nothing.
3313         (WKPreferencesGetPrimaryPlugInSnapshotDetectionEnabled): Return false.
3314
3315         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
3316         (WKContextIsPlugInUpdateAvailable): Return false.
3317         (WKContextSetPluginLoadClientPolicy): Do nothing.
3318         (WKContextClearPluginClientPolicies): Do nothing.
3319
3320         * UIProcess/API/Cocoa/WKPreferences.mm:
3321         (-[WKPreferences _setPlugInSnapshottingEnabled:]): Do nothing.
3322         (-[WKPreferences _plugInSnapshottingEnabled]): Return NO.
3323         * UIProcess/API/Cocoa/WKProcessPool.mm:
3324         (toPluginLoadClientPoliciesHashMap): Deleted.
3325         (policiesHashMapToDictionary): Deleted.
3326         (-[WKProcessPool _resetPluginLoadClientPolicies:]): Do nothing.
3327         (-[WKProcessPool _pluginLoadClientPolicies]): Return an empty dictionary.
3328
3329         * UIProcess/Cocoa/NavigationState.h: Remove didFailToInitializePlugIn,
3330         didBlockInsecurePluginVersion, decidePolicyForPluginLoad,
3331         webViewDidFailToInitializePlugInWithInfo,
3332         webViewDidBlockInsecurePluginVersionWithInfo, and
3333         webViewDecidePolicyForPluginLoadWithCurrentPolicyPluginInfoCompletionHandler.
3334
3335         * UIProcess/Cocoa/NavigationState.mm:
3336         (WebKit::NavigationState::setNavigationDelegate): Updated for abvoe removals.
3337         (WebKit::NavigationState::NavigationClient::didFailToInitializePlugIn): Deleted.
3338         (WebKit::NavigationState::NavigationClient::didBlockInsecurePluginVersion): Deleted.
3339         (WebKit::pluginModuleLoadPolicy): Deleted.
3340         (WebKit::wkPluginModuleLoadPolicy): Deleted.
3341         (WebKit::NavigationState::NavigationClient::decidePolicyForPluginLoad): Deleted.
3342
3343         * UIProcess/Plugins/PlugInAutoStartProvider.cpp: Removed.
3344         * UIProcess/Plugins/PlugInAutoStartProvider.h: Removed.
3345
3346         * UIProcess/Plugins/PluginProcessManager.cpp:
3347         (WebKit::PluginProcessManager::pluginProcessToken): Removed the
3348         pluginProcessType argument.
3349         (WebKit::PluginProcessManager::fetchWebsiteData): Ditto.
3350         (WebKit::PluginProcessManager::deleteWebsiteData): Ditto.
3351         (WebKit::PluginProcessManager::deleteWebsiteDataForHostNames): Ditto.
3352         * UIProcess/Plugins/PluginProcessManager.h: Ditto.
3353
3354         * UIProcess/Plugins/PluginProcessProxy.cpp:
3355         (WebKit::PluginProcessProxy::didFinishLaunching): Removed the code to
3356         handle PluginProcessType::Snapshot.
3357
3358         * UIProcess/WebPageProxy.cpp:
3359         (WebKit::WebPageProxy::findPlugin): Removed the processType argument.
3360         * UIProcess/WebPageProxy.h: Ditto.
3361         * UIProcess/WebPageProxy.messages.in: Ditto.
3362
3363         * UIProcess/WebProcessPool.cpp:
3364         (WebKit::WebProcessPool::webProcessDataStoreParameters): Removed
3365         plugInAutoStartOriginHashes.
3366         (WebKit::WebProcessPool::initializeNewWebProcess): Removed
3367         plugInAutoStartOrigins and pluginLoadClientPolicies.
3368         (WebKit::WebProcessPool::plugInAutoStartOriginHashes const): Deleted.
3369         (WebKit::WebProcessPool::setPlugInAutoStartOriginHashes): Deleted.
3370         (WebKit::WebProcessPool::setPlugInAutoStartOrigins): Deleted.
3371         (WebKit::WebProcessPool::setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime): Deleted.
3372         (WebKit::WebProcessPool::setPluginLoadClientPolicy): Deleted.
3373         (WebKit::WebProcessPool::resetPluginLoadClientPolicies): Deleted.
3374         (WebKit::WebProcessPool::clearPluginClientPolicies): Deleted.
3375
3376         * UIProcess/WebProcessPool.h: Removed setPluginLoadClientPolicy,
3377         resetPluginLoadClientPolicies, clearPluginClientPolicies,
3378         pluginLoadClientPolicies, plugInAutoStartOriginHashes,
3379         setPlugInAutoStartOriginHashes, setPlugInAutoStartOrigins,
3380         setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime,
3381         plugInAutoStartProvider, m_plugInAutoStartProvider, and
3382         m_pluginLoadClientPolicies.
3383
3384         * UIProcess/WebProcessProxy.cpp:
3385         (WebKit::WebProcessProxy::addPlugInAutoStartOriginHash): Deleted.
3386         (WebKit::WebProcessProxy::plugInDidReceiveUserInteraction): Deleted.
3387         * UIProcess/WebProcessProxy.h: Ditto.
3388         * UIProcess/WebProcessProxy.messages.in: Ditto.
3389
3390         * WebKit.xcodeproj/project.pbxproj: Removed PlugInAutoStartProvider.cpp/h
3391         and WebPlugInClient.cpp/h.
3392
3393         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
3394         Removed include of RenderSnapshottedPlugIn.h.
3395
3396         * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm: