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