40dd6407fda7c3285df5f05908f06330a4efdaa0
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2020-03-08  Megan Gardner  <megan_gardner@apple.com>
2
3         Build Fix Watch
4         https://bugs.webkit.org/show_bug.cgi?id=208789
5
6         Reviewed by Tim Horton.
7
8         * UIProcess/ios/WKActionSheetAssistant.mm:
9         * UIProcess/ios/forms/WKFileUploadPanel.mm:
10         (-[WKFileUploadPanel dealloc]):
11         (-[WKFileUploadPanel showDocumentPickerMenu]):
12
13 2020-03-08  Tim Horton  <timothy_horton@apple.com>
14
15         Fix the watchOS build
16
17         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
18         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
19
20 2020-03-08  Megan Gardner  <megan_gardner@apple.com>
21
22         Build Fix
23         https://bugs.webkit.org/show_bug.cgi?id=208787
24         <rdar://problem/60203011>
25
26         Reviewed by Tim Horton.
27
28         * Platform/spi/ios/UIKitSPI.h:
29         * UIProcess/ios/WKActionSheetAssistant.mm:
30         * UIProcess/ios/forms/WKFileUploadPanel.mm:
31         (-[WKFileUploadPanel showDocumentPickerMenu]):
32
33 2020-03-06  Jer Noble  <jer.noble@apple.com>
34
35         [GPUP] Move AVSystemController code into the GPU process
36         https://bugs.webkit.org/show_bug.cgi?id=208727
37
38         Reviewed by Eric Carlson.
39
40         Add a new class pair RemoteMediaSessionHelper/Proxy.
41
42         * DerivedSources-input.xcfilelist:
43         * DerivedSources-output.xcfilelist:
44         * DerivedSources.make:
45         * GPUProcess/GPUConnectionToWebProcess.cpp:
46         (WebKit::GPUConnectionToWebProcess::mediaSessionHelperProxy):
47         (WebKit::GPUConnectionToWebProcess::ensureMediaSessionHelper):
48         * GPUProcess/GPUConnectionToWebProcess.h:
49         * GPUProcess/GPUConnectionToWebProcess.messages.in:
50         * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp: Added.
51         (WebKit::RemoteMediaSessionHelperProxy::RemoteMediaSessionHelperProxy):
52         (WebKit::RemoteMediaSessionHelperProxy::~RemoteMediaSessionHelperProxy):
53         (WebKit::RemoteMediaSessionHelperProxy::startMonitoringWirelessRoutes):
54         (WebKit::RemoteMediaSessionHelperProxy::stopMonitoringWirelessRoutes):
55         (WebKit::RemoteMediaSessionHelperProxy::providePresentingApplicationPID):
56         (WebKit::RemoteMediaSessionHelperProxy::receivedInterruption):
57         (WebKit::RemoteMediaSessionHelperProxy::applicationWillEnterForeground):
58         (WebKit::RemoteMediaSessionHelperProxy::applicationDidEnterBackground):
59         (WebKit::RemoteMediaSessionHelperProxy::applicationWillBecomeInactive):
60         (WebKit::RemoteMediaSessionHelperProxy::applicationDidBecomeActive):
61         (WebKit::RemoteMediaSessionHelperProxy::externalOutputDeviceAvailableDidChange):
62         (WebKit::RemoteMediaSessionHelperProxy::isPlayingToAutomotiveHeadUnitDidChange):
63         (WebKit::RemoteMediaSessionHelperProxy::activeAudioRouteDidChange):
64         (WebKit::RemoteMediaSessionHelperProxy::activeVideoRouteDidChange):
65         * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.h: Added.
66         * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.messages.in: Added.
67         * Sources.txt:
68         * SourcesCocoa.txt:
69         * WebKit.xcodeproj/project.pbxproj:
70         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp: Added.
71         (WebKit::RemoteMediaSessionHelper::RemoteMediaSessionHelper):
72         (WebKit::RemoteMediaSessionHelper::connection):
73         (WebKit::RemoteMediaSessionHelper::startMonitoringWirelessRoutes):
74         (WebKit::RemoteMediaSessionHelper::stopMonitoringWirelessRoutes):
75         (WebKit::RemoteMediaSessionHelper::providePresentingApplicationPID):
76         (WebKit::RemoteMediaSessionHelper::receivedInterruption):
77         (WebKit::RemoteMediaSessionHelper::applicationWillEnterForeground):
78         (WebKit::RemoteMediaSessionHelper::applicationDidEnterBackground):
79         (WebKit::RemoteMediaSessionHelper::applicationWillBecomeInactive):
80         (WebKit::RemoteMediaSessionHelper::applicationDidBecomeActive):
81         (WebKit::RemoteMediaSessionHelper::externalOutputDeviceAvailableDidChange):
82         (WebKit::RemoteMediaSessionHelper::isPlayingToAutomotiveHeadUnitDidChange):
83         (WebKit::RemoteMediaSessionHelper::activeAudioRouteDidChange):
84         (WebKit::RemoteMediaSessionHelper::activeVideoRouteDidChange):
85         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.h: Added.
86         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.messages.in: Added.
87         * WebProcess/WebProcess.cpp:
88         (WebKit::WebProcess::setUseGPUProcessForMedia):
89
90 2020-03-08  Jer Noble  <jer.noble@apple.com>
91
92         [GPUP] Null-dereference crash in GPUProcessProxy::openGPUProcessConnection()
93         https://bugs.webkit.org/show_bug.cgi?id=208772
94
95         Reviewed by Maciej Stachowiak.
96
97         AuxiliaryProcessProxy::connection() will return a null-pointer if called before the remote
98         process has launched and a connection established. Rather than send a message directly to
99         the proxy's IPC::Connection object (which can be null), just call sendWithAsyncReply()
100         directly on the proxy inself, which will correctly enqueue the message for sending when the
101         connection is fully established.
102
103         Because this crash occurs whenever the "useGPUProcessForMedia" setting is enabled, this is
104         covered by existing WP2 tests when those tests are run with that setting enabled.
105
106         * UIProcess/GPU/GPUProcessProxy.cpp:
107         (WebKit::GPUProcessProxy::openGPUProcessConnection):
108
109 2020-03-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
110
111         Canvas drawing commands have to be flushed to the GPUProcess in batches
112         https://bugs.webkit.org/show_bug.cgi?id=208597
113
114         Reviewed by Myles C. Maxfield.
115
116         RemoteImageBuffer, which is a superclass of DisplayList::ImageBuffer, will
117         prevent growing its DisplayList more than some limit (512 for now).
118         When this limit is reached, the recoded DisplayListItems will be flushed to
119         the GPUProcess in a batch. Flushing this batch would not require GPUProcess
120         to reply back. RemoteImageBuffer will have to run a full flush anyway
121         when the pixels are needed because the batch flushing does not include the
122         current DisplayList::Item.
123
124         * GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h:
125         * GPUProcess/graphics/RemoteImageBufferProxy.h:
126         * GPUProcess/graphics/RemoteRenderingBackendProxy.cpp:
127         (WebKit::RemoteRenderingBackendProxy::flushImageBufferDrawingContext):
128         (WebKit::RemoteRenderingBackendProxy::flushImageBufferDrawingContextAndCommit):
129         * GPUProcess/graphics/RemoteRenderingBackendProxy.h:
130         * GPUProcess/graphics/RemoteRenderingBackendProxy.messages.in:
131         * WebProcess/GPU/graphics/RemoteImageBuffer.h:
132         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp:
133         (WebKit::RemoteImageBufferMessageHandler::flushDrawingContext):
134         (WebKit::RemoteImageBufferMessageHandler::flushDrawingContextAndWaitCommit):
135
136 2020-03-08  Konstantin Tokarev  <annulen@yandex.ru>
137
138         [GTK] Fix compilation with disabled OpenGL
139         https://bugs.webkit.org/show_bug.cgi?id=208773
140
141         Reviewed by Yusuke Suzuki.
142
143         * UIProcess/API/glib/WebKitProtocolHandler.cpp:
144         (WebKit::WebKitProtocolHandler::handleGPU):
145
146 2020-03-08  Megan Gardner  <megan_gardner@apple.com>
147
148         Adopt Context Menus for Data Detectors
149         https://bugs.webkit.org/show_bug.cgi?id=208779
150
151         Switch to context menus for data detector action sheets.
152
153         Reviewed by Tim Horton.
154
155         * UIProcess/ios/WKActionSheetAssistant.h:
156         * UIProcess/ios/WKActionSheetAssistant.mm:
157         (-[WKActionSheetAssistant removeContextMenuInteraction]):
158         (-[WKActionSheetAssistant ensureContextMenuInteraction]):
159         (-[WKActionSheetAssistant showDataDetectorsSheet]):
160         (-[WKActionSheetAssistant contextMenuInteraction:configurationForMenuAtLocation:]):
161         (-[WKActionSheetAssistant contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
162         (-[WKActionSheetAssistant _contextMenuInteraction:styleForMenuWithConfiguration:]):
163         (-[WKActionSheetAssistant contextMenuInteraction:willEndForConfiguration:animator:]):
164         * UIProcess/ios/WKContentViewInteraction.mm:
165         (-[WKContentView contextMenuDisplayLocationForActionSheetAssistant:]):
166
167 2020-03-07  Brent Fulgham  <bfulgham@apple.com>
168
169         Create a flag to disable in-app browser quirks
170         https://bugs.webkit.org/show_bug.cgi?id=208777
171         <rdar://problem/60062197>
172
173         Reviewed by Simon Fraser.
174
175         This patch makes the following changes:
176
177         1. Adds a new flag 'NeedsInAppBrowserPrivacyQuirks' to allow quirks to be toggled
178            during testing.
179         2. Reclassify this new flag, and the existing 'InAppBrowserPrivacyEnabled' flag from 
180            'settings' to Internal Debug settings
181
182         The renamed flags are covered by existing tests.
183
184         * FeatureFlags/WebKit.plist:
185         * Shared/WebPageCreationParameters.cpp:
186         (WebKit::WebPageCreationParameters::encode const):
187         (WebKit::WebPageCreationParameters::decode):
188         * Shared/WebPageCreationParameters.h:
189         * Shared/WebPreferences.yaml:
190         * Shared/WebPreferencesDefaultValues.cpp:
191         (WebKit::defaultInAppBrowserPrivacy):
192         (WebKit::defaultNeedsInAppBrowserPrivacyQuirks):
193         * Shared/WebPreferencesDefaultValues.h:
194         * UIProcess/API/Cocoa/WKPreferences.mm:
195         (-[WKPreferences _needsInAppBrowserPrivacyQuirks]):
196         (-[WKPreferences _setNeedsInAppBrowserPrivacyQuirks:]):
197         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
198         * UIProcess/WebPageProxy.cpp:
199         * WebProcess/WebPage/WebPage.cpp:
200         (WebKit::WebPage::runJavaScript):
201         * WebProcess/WebPage/WebPage.h:
202
203 2020-03-07  Simon Fraser  <simon.fraser@apple.com>
204
205         Generalize setSynchronousScrollingReasons() to take a ScrollingNodeID
206         https://bugs.webkit.org/show_bug.cgi?id=208774
207
208         Reviewed by Zalan Bujtas.
209
210         Whitespace.
211
212         * WebProcess/WebPage/EventDispatcher.h:
213
214 2020-03-07  Brady Eidson  <beidson@apple.com>
215
216         Make PDF range requests to the network.
217         https://bugs.webkit.org/show_bug.cgi?id=208776
218
219         Reviewed by Alex Christensen.
220
221         We already handle a set of range requests from our data provider callbacks.
222         The current strategy is "wait until we've streamed enough of the entire resource, 
223         perform that request's callback"
224         
225         For linearized PDFs the second request ever made is for the very end of the PDF document,
226         so we have to wait for the entire document to load (which is what we already do in non-incremental mode)
227         
228         Now, we'll actually make the requests for missing data chunks from the network by using the document's request
229         and adding range headers.
230         
231         While it is now entirely misnamed, NetscapePlugInStreamLoader is a perfect fit for this.
232         
233         Once the range request completes from the network we can unblock the PDF thread and go to the next request.
234
235         * WebProcess/Plugins/PDF/PDFPlugin.h:
236         * WebProcess/Plugins/PDF/PDFPlugin.mm:
237         (WebKit::PDFPlugin::unconditionalCompleteOutstandingRangeRequests):
238         (WebKit::PDFPlugin::getResourceBytesAtPosition):
239         (WebKit::PDFPlugin::ByteRangeRequest::clearStreamLoader):
240         (WebKit::PDFPlugin::ByteRangeRequest::completeWithBytes):
241         (WebKit::PDFPlugin::ByteRangeRequest::completeWithAccumulatedData):
242         (WebKit::PDFPlugin::ByteRangeRequest::maybeComplete):
243         (WebKit::PDFPlugin::ByteRangeRequest::completeUnconditionally):
244         (WebKit::PDFPlugin::willSendRequest):
245         (WebKit::PDFPlugin::didReceiveResponse):
246         (WebKit::PDFPlugin::didReceiveData):
247         (WebKit::PDFPlugin::didFail):
248         (WebKit::PDFPlugin::didFinishLoading):
249         (WebKit::PDFPlugin::byteRangeRequestForLoader):
250         (WebKit::PDFPlugin::cancelAndForgetLoader):
251         (WebKit::PDFPlugin::manualStreamDidReceiveData):
252         (WebKit::PDFPlugin::unconditionalCompleteRangeRequest): Deleted.
253
254 2020-03-07  David Quesada  <david_quesada@apple.com>
255
256         Crash in -[_WKRemoteObjectRegistry _invokeMethod:] block when calling a reply block after the web view has deallocated
257         https://bugs.webkit.org/show_bug.cgi?id=208781
258         rdar://problem/60061016
259
260         Reviewed by Alex Christensen.
261
262         Covered by API tests.
263
264         * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
265         (-[_WKRemoteObjectRegistry _invokeMethod:]):
266             When the app calls a reply block for a message from the injected bundle, add a nil
267             check for the underlying WebKit::RemoteObjectRegistry before attempting to send the
268             reply details back to the web process. It's possible that before this block is
269             called, the associated web view could have been deallocated, which would invalidate
270             this _WKRemoteObjectRegistry.
271
272 2020-03-07  Megan Gardner  <megan_gardner@apple.com>
273
274         Adopt UIContextMenu for WKFileUploadPanel
275         https://bugs.webkit.org/show_bug.cgi?id=208687
276
277         Reviewed by Tim Horton.
278
279         Move from the depricated UIDocumentMenuViewController to UIContextMenu.
280         UI change, not currently testable.
281
282         * Platform/spi/ios/UIKitSPI.h:
283         * UIProcess/ios/forms/WKFileUploadPanel.mm:
284         (-[WKFileUploadPanel dealloc]):
285         (-[WKFileUploadPanel presentWithParameters:resultListener:]):
286         (-[WKFileUploadPanel dismiss]):
287         (-[WKFileUploadPanel _browseFilesButtonLabel]):
288         (-[WKFileUploadPanel contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
289         (-[WKFileUploadPanel _contextMenuInteraction:styleForMenuWithConfiguration:]):
290         (-[WKFileUploadPanel contextMenuInteraction:configurationForMenuAtLocation:]):
291         (-[WKFileUploadPanel contextMenuInteraction:willEndForConfiguration:animator:]):
292         (-[WKFileUploadPanel _removeInteraction]):
293         (-[WKFileUploadPanel _initInteraction]):
294         (-[WKFileUploadPanel _showFilePickerMenu]):
295         (-[WKFileUploadPanel _showDocumentPickerMenu]):
296         (-[WKFileUploadPanel _presentPopoverWithContentViewController:animated:]):
297         (-[WKFileUploadPanel _presentFullscreenViewController:animated:]):
298         (photoLibraryIcon): Deleted.
299         (cameraIcon): Deleted.
300         (-[WKFileUploadPanel documentMenu:didPickDocumentPicker:]): Deleted.
301         (-[WKFileUploadPanel documentMenuWasCancelled:]): Deleted.
302
303 2020-03-07  Peng Liu  <peng.liu6@apple.com>
304
305         Use the feature flags mechanism to give default feature preference values
306         https://bugs.webkit.org/show_bug.cgi?id=208607
307
308         Reviewed by Simon Fraser.
309
310         Fix a Catalyst build failure (We should not copy the WebKit.plist for the Catalyst build).
311
312         * WebKit.xcodeproj/project.pbxproj:
313
314 2020-03-07  Daniel Bates  <dabates@apple.com>
315
316         [iOS] Implement support for dictation alternatives
317         https://bugs.webkit.org/show_bug.cgi?id=208720
318         <rdar://problem/58540114>
319
320         Reviewed by Brady Eidson.
321
322         Part 4
323
324         This patch was originally written by Morgan Winer. I just simplified it a bit and fixed some
325         formatting issues to conform to the code style guidelines.
326
327         Note that I haven't enable USE_DICTATION_ALTERNATIVES on iOS. So, this code isn't being
328         compiled for iOS. I will do that in a subsequent change once after all the code is in place
329         to do so.
330
331         * Platform/spi/ios/UIKitSPI.h: Expose more SPI.
332         * UIProcess/ios/WKContentViewInteraction.mm:
333         (-[WKContentView insertText:alternatives:style:]): Added.
334
335 2020-03-07  Daniel Bates  <dabates@apple.com>
336
337         [iOS] Implement support for dictation alternatives
338         https://bugs.webkit.org/show_bug.cgi?id=208720
339         <rdar://problem/58540114>
340
341         Reviewed by Brent Fulgham.
342
343         Part 3
344
345         Move code that was guarded under PLATFORM(MAC) outside of that guard so that we compile it
346         so long as USE(DICTATION_ALTERNATIVES) is enabled.
347
348         Note that I haven't enable USE_DICTATION_ALTERNATIVES on iOS. So, this code isn't being
349         compiled for iOS. I will do that in a subsequent change once after all the code is in place
350         to do so.
351
352         * UIProcess/PageClient.h:
353         * UIProcess/WebPageProxy.cpp:
354         * UIProcess/WebPageProxy.h:
355
356 2020-03-07  Daniel Bates  <dabates@apple.com>
357
358         [iOS] Implement support for dictation alternatives
359         https://bugs.webkit.org/show_bug.cgi?id=208720
360         <rdar://problem/58540114>
361
362         Reviewed by Wenson Hsieh.
363
364         Part 2
365
366         Move insertDictatedTextAsync() from the Mac-specific implementation files to Cocoa-specific
367         implementation files as it can be shared by both Mac and iOS. I did very minor C++ modernization:
368         just more uses of auto and uniform initializer syntax.
369
370         Note that I haven't enable USE_DICTATION_ALTERNATIVES on iOS. So, this code isn't being
371         compiled for iOS. I will do that in a subsequent change once after all the code is in place
372         to do so.
373
374         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
375         (WebKit::WebPageProxy::insertDictatedTextAsync):
376         * UIProcess/WebPageProxy.cpp:
377         * UIProcess/WebPageProxy.h:
378         * UIProcess/mac/WebPageProxyMac.mm:
379         (WebKit::WebPageProxy::insertDictatedTextAsync): Deleted.
380         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
381         (WebKit::WebPage::insertDictatedTextAsync):
382         * WebProcess/WebPage/WebPage.h:
383         * WebProcess/WebPage/WebPage.messages.in:
384         * WebProcess/WebPage/mac/WebPageMac.mm:
385         (WebKit::WebPage::insertDictatedTextAsync): Deleted.
386
387 2020-03-07  Daniel Bates  <dabates@apple.com>
388
389         [iOS] Implement support for dictation alternatives
390         https://bugs.webkit.org/show_bug.cgi?id=208720
391         <rdar://problem/58540114>
392
393         Reviewed by Wenson Hsieh.
394
395         Part 1
396
397         Move some of the PageClientMac dictation alternatives code to PageClientImplCocoa so that it
398         can be shared with iOS.
399
400         Note that I haven't enable USE_DICTATION_ALTERNATIVES on iOS. So, this code isn't being
401         compiled for iOS. I will do that in a subsequent change once after all the code is in place
402         to do so.
403
404         * UIProcess/Cocoa/PageClientImplCocoa.h:
405         (WebKit::PageClientImplCocoa::PageClientImplCocoa): Deleted; moved to be out-of-line to avoid
406         needing to #include AlternativeTextUIController.h from this file. Declare out-of-line destructor
407         for the same reason.
408         * UIProcess/Cocoa/PageClientImplCocoa.mm:
409         (WebKit::PageClientImplCocoa::PageClientImplCocoa): Moved from PageClientImplCocoa.h.
410         (WebKit::PageClientImplCocoa::pageClosed):
411         (WebKit::PageClientImplCocoa::addDictationAlternatives): Moved from PageClientImplMac.mm.
412         (WebKit::PageClientImplCocoa::removeDictationAlternatives): Ditto.
413         (WebKit::PageClientImplCocoa::dictationAlternatives): Ditto.
414         * UIProcess/PageClient.h:
415         * UIProcess/ios/PageClientImplIOS.h:
416         * UIProcess/ios/PageClientImplIOS.mm:
417         (WebKit::PageClientImpl::showDictationAlternativeUI): Added; stub function.
418         (WebKit::PageClientImpl::pageClosed): Deleted; now we will use the base class implementation.
419         * UIProcess/mac/PageClientImplMac.h:
420         * UIProcess/mac/PageClientImplMac.mm:
421         (WebKit::PageClientImpl::PageClientImpl): Moved AlternativeTextUIController logic from here to PageClientImplCocoa::PageClientImplCocoa().
422         (WebKit::PageClientImpl::pageClosed): Moved AlternativeTextUIController logic from here to PageClientImplCocoa::pageClosed()
423         so it can be shared and modified this function to call the base class implementation.
424         (WebKit::PageClientImpl::~PageClientImpl): Deleted; moved to PageClientImplCocoa.mm.
425         (WebKit::PageClientImpl::addDictationAlternatives): Deleted; moved to PageClientImplCocoa.mm.
426         (WebKit::PageClientImpl::removeDictationAlternatives): Deleted; moved to PageClientImplCocoa.mm.
427         (WebKit::PageClientImpl::dictationAlternatives): Deleted; moved to PageClientImplCocoa.mm.
428
429 2020-03-07  Eric Carlson  <eric.carlson@apple.com>
430
431         Implement setWirelessPlaybackTarget, performTaskAtMediaTime, and wouldTaintOrigin in GPUProcess
432         https://bugs.webkit.org/show_bug.cgi?id=208651
433         <rdar://problem/60088298>
434
435         Reviewed by Youenn Fablet.
436
437         * GPUProcess/GPUConnectionToWebProcess.cpp:
438         (WebKit::GPUConnectionToWebProcess::dispatchSyncMessage): Dispatch player manager messages.
439
440         * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
441         (WebKit::RemoteMediaPlayerManagerProxy::didReceiveSyncPlayerMessage): Dispatch player messages.
442         * GPUProcess/media/RemoteMediaPlayerManagerProxy.h:
443
444         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
445         (WebKit::RemoteMediaPlayerProxy::~RemoteMediaPlayerProxy): Clear the completion handler
446         do its destructor doesn't assert.
447         (WebKit::RemoteMediaPlayerProxy::setWirelessPlaybackTarget): Implement.
448         (WebKit::RemoteMediaPlayerProxy::performTaskAtMediaTime): Ditto.
449         (WebKit::RemoteMediaPlayerProxy::wouldTaintOrigin): Ditto.
450         * GPUProcess/media/RemoteMediaPlayerProxy.h:
451         * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
452
453         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
454         (WebKit::MediaPlayerPrivateRemote::updateCachedState): Update wireless playback target name.
455         (WebKit::MediaPlayerPrivateRemote::load): Don't log as unimplemented.
456         (WebKit::MediaPlayerPrivateRemote::wirelessPlaybackTargetName const): Return cached name.
457         (WebKit::MediaPlayerPrivateRemote::setWirelessPlaybackTarget): Implement.
458         (WebKit::MediaPlayerPrivateRemote::wouldTaintOrigin const): Ditto.
459         (WebKit::MediaPlayerPrivateRemote::performTaskAtMediaTime): Ditto.
460         (WebKit::MediaPlayerPrivateRemote::setClosedCaptionsVisible): Deleted, not needed.
461         (WebKit::MediaPlayerPrivateRemote::simulateAudioInterruption): Ditto.
462         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
463
464         * WebProcess/GPU/media/RemoteMediaPlayerConfiguration.h:
465         (WebKit::RemoteMediaPlayerConfiguration::decode): Decode supportsFullscreen too.
466
467 2020-03-07  Brady Eidson  <beidson@apple.com>
468
469         Add runtime flag for incremental PDF loading.
470         https://bugs.webkit.org/show_bug.cgi?id=208763
471
472         Reviewed by Tim Horton.
473
474         * Shared/WebPreferences.yaml:
475         * Shared/WebPreferencesDefaultValues.cpp:
476         (WebKit::defaultIncrementalPDFEnabled):
477         * Shared/WebPreferencesDefaultValues.h:
478         
479         * WebProcess/Plugins/PDF/PDFPlugin.h:
480         * WebProcess/Plugins/PDF/PDFPlugin.mm:
481         (WebKit::PDFPlugin::PDFPlugin):
482         (WebKit::PDFPlugin::pdfDocumentDidLoad):
483         (WebKit::PDFPlugin::manualStreamDidReceiveData):
484         (WebKit::PDFPlugin::manualStreamDidFail):
485
486 2020-03-05  Sam Weinig  <weinig@apple.com>
487
488         Move JavaScriptCore related feature defines from FeatureDefines.xcconfig to PlatformEnableCocoa.h
489         https://bugs.webkit.org/show_bug.cgi?id=207436
490         <rdar://problem/59296762>
491
492         Reviewed by Darin Adler.
493
494         * Configurations/FeatureDefines.xcconfig:
495         Remove JSC related defines.
496
497 2020-03-07  Jer Noble  <jer.noble@apple.com>
498
499         Unreviewed unified build fix; forward declare referenced types. In this case, WebCore::ImageData.
500
501         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h:
502
503 2020-03-07  Myles C. Maxfield  <mmaxfield@apple.com>
504
505         [GPU Process] Implement CanvasRenderingContext2D.getImageData()
506         https://bugs.webkit.org/show_bug.cgi?id=208560
507         <rdar://problem/60060618>
508
509         Reviewed by Said Abou-Hallawa.
510
511         Adds a new synchronous message between the Web Process and the GPU Process.
512         Unfortunately, getImageData() synchronously returns results, and we don't
513         have the infrastructure to make JavaScript interruptible, so this means that
514         the message has to be synchronous, at least until we add that infrastructure.
515
516         When the RemoteImageBuffer receives the getImageData() call, it first
517         asynchronously flushes the pending display list, doesn't wait for a response, 
518         and then sends the synchronous getImageData() message. Because the GPU Process
519         receives messages in-order, the Web Process doesn't have to wait for the
520         response from the flush message.
521
522         After this patch, there are a few optimization opportunities we can exploit
523         where we use SharedBuffer directly instead of copying into and out of the
524         ImageData.
525
526         No new tests because there is no behavior change. We're just using the GPU
527         process now, instead of implementing the command locally in the Web Process.
528
529         * GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h:
530         * GPUProcess/graphics/RemoteImageBufferProxy.h:
531         * GPUProcess/graphics/RemoteRenderingBackendProxy.cpp:
532         (WebKit::RemoteRenderingBackendProxy::getImageData):
533         * GPUProcess/graphics/RemoteRenderingBackendProxy.h:
534         * GPUProcess/graphics/RemoteRenderingBackendProxy.messages.in:
535         * Platform/IPC/ImageDataReference.h: Added.
536         (IPC::ImageDataReference::ImageDataReference):
537         (IPC::ImageDataReference::buffer):
538         (IPC::ImageDataReference::buffer const):
539         (IPC::ImageDataReference::encode const):
540         (IPC::ImageDataReference::decode):
541         * Platform/IPC/MessageSender.h:
542         (IPC::MessageSender::sendSync):
543         * Shared/WebCoreArgumentCoders.cpp:
544         (IPC::ArgumentCoder<RefPtr<WebCore::ImageData>>::encode):
545         (IPC::ArgumentCoder<RefPtr<WebCore::ImageData>>::decode):
546         * Shared/WebCoreArgumentCoders.h:
547         * WebKit.xcodeproj/project.pbxproj:
548         * WebProcess/GPU/graphics/RemoteImageBuffer.h:
549         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp:
550         (WebKit::RemoteImageBufferMessageHandler::getImageData const):
551         (WebKit::RemoteImageBufferMessageHandler::flushDrawingContext):
552         (WebKit::RemoteImageBufferMessageHandler::flushDrawingContextAndWaitCommit):
553         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h:
554
555 2020-03-07  chris fleizach  <cfleizach@apple.com>
556
557         Unreviewed, rolling out r258047.
558
559         Referenced SPI not yet available for Safari builders.
560
561         Reverted changeset:
562
563         "Implementation of AccessibilitySupport AXSIsolatedTreeMode."
564         https://bugs.webkit.org/show_bug.cgi?id=208691
565         https://trac.webkit.org/changeset/258047
566
567 2020-03-06  Per Arne Vollan  <pvollan@apple.com>
568
569         [Cocoa] Re-enable CFPrefs direct mode
570         https://bugs.webkit.org/show_bug.cgi?id=208690
571
572         Reviewed by Brent Fulgham.
573
574         This patch re-enabled CF prefs direct mode on iOS and macOS, and addresses performance issues and Accessibility issues
575         with the original patch. Performance issues are addressed by creating the NSUserDefaults objects in the UI process on
576         a non-main thread, while the Accessibility issues are fixed by issuing an extension to the preferences service when
577         Accessibility is enabled.
578
579         API test: WebKit.GrantAccessPreferencesService
580
581         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
582         * Shared/WebProcessCreationParameters.cpp:
583         (WebKit::WebProcessCreationParameters::encode const):
584         (WebKit::WebProcessCreationParameters::decode):
585         * Shared/WebProcessCreationParameters.h:
586         * UIProcess/API/Cocoa/WKWebView.mm:
587         (-[WKWebView _grantAccessToPreferenceService]):
588         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
589         * UIProcess/Cocoa/PreferenceObserver.mm:
590         (registerDefaultsOverride):
591         (-[WKUserDefaults _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:]):
592         (-[WKPreferenceObserver init]):
593         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
594         (WebKit::WebPageProxy::grantAccessToPreferenceService):
595         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
596         (WebKit::WebProcessPool::platformInitialize):
597         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
598         (WebKit::WebProcessPool::platformInitializeWebProcess):
599         (WebKit::WebProcessPool::registerNotificationObservers):
600         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
601         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
602         (WebKit::WebProcessProxy::unblockPreferenceServiceIfNeeded):
603         * UIProcess/WebPageProxy.h:
604         * UIProcess/WebProcessPool.h:
605         * UIProcess/WebProcessProxy.cpp:
606         (WebKit::WebProcessProxy::didFinishLaunching):
607         * UIProcess/WebProcessProxy.h:
608         * UIProcess/ios/WebProcessProxyIOS.mm:
609         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded): Deleted.
610         * WebProcess/WebProcess.cpp:
611         (WebKit::WebProcess::unblockAccessibilityServer): Deleted.
612         * WebProcess/WebProcess.h:
613         * WebProcess/WebProcess.messages.in:
614         * WebProcess/cocoa/WebProcessCocoa.mm:
615         (WebKit::WebProcess::platformInitializeWebProcess):
616         (WebKit::WebProcess::platformInitializeProcess):
617         (WebKit::WebProcess::unblockPreferenceService):
618         (WebKit::WebProcess::unblockAccessibilityServer):
619         * WebProcess/com.apple.WebProcess.sb.in:
620
621 2020-03-06  Kate Cheney  <katherine_cheney@apple.com>
622
623         UIProcess needs mechanism to specify AppBound domains
624         https://bugs.webkit.org/show_bug.cgi?id=208528
625         <rdar://problem/59980340>
626
627         Reviewed by Brent Fulgham.
628
629         Adds functionality to read app-bound domains from the Info.plist on
630         background thread via the WebFramePolicyListenerProxy and report
631         whether a domain is app-bound. 
632
633         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
634         (-[WKWebsiteDataStore _appBoundDomains:]):
635         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
636         Test API call to get appBoundDomains.
637
638         * UIProcess/WebFramePolicyListenerProxy.cpp:
639         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
640         (WebKit::WebFramePolicyListenerProxy::didReceiveAppBoundDomainResult):
641         (WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
642         (WebFramePolicyListenerProxy::use):
643         (WebFramePolicyListenerProxy::download):
644         (WebFramePolicyListenerProxy::ignore):
645         * UIProcess/WebFramePolicyListenerProxy.h:
646         (WebKit::WebFramePolicyListenerProxy::create):
647         * UIProcess/WebFrameProxy.cpp:
648         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
649         * UIProcess/WebFrameProxy.h:
650         * UIProcess/WebPageProxy.cpp:
651         Added a new function to WebFramePolicyListenerProxy to wait for the
652         app-bound domains to be read before completing a navigation. Each
653         other function must now check if m_isNavigatingToAppBoundDomain has
654         been set before sending a full reply. Also added an enum class
655         ShouldExpectAppBoundDomainResult to tell the listener not to wait for
656         the results in unecessary cases.
657
658         (WebKit::WebPageProxy::isAppBoundDomain const): Deleted
659         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
660         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
661         After the listener responds with the results, set the new
662         value in WebPageProxy. We no longer need to check for isAppBound
663         domain now that we have received the value.
664
665         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
666         (WebKit::WebPageProxy::decidePolicyForResponseShared):
667         No need to listen for app-bound domain response here.
668
669         * UIProcess/WebPageProxy.h:
670         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
671         (WebKit::appBoundDomains):
672         (WebKit::appBoundDomainQueue):
673         Add a separate static queue for reading app-bound domains to avoid
674         raciness.
675
676         (WebKit::WebsiteDataStore::beginAppBoundDomainCheck):
677         (WebKit::WebsiteDataStore::getAppBoundDomainsForTesting):
678         * UIProcess/WebsiteData/WebsiteDataStore.h:
679         Read the app-bound domain list on the background thread, and once
680         done, call the listener on the main thread.
681
682 2020-03-06  David Kilzer  <ddkilzer@apple.com>
683
684         IPC hardening for WebPageProxy::SaveImageToLibrary message
685         <https://webkit.org/b/208730>
686         <rdar://problem/58700693>
687
688         Reviewed by Chris Dumez.
689
690         * UIProcess/ios/WebPageProxyIOS.mm:
691         (MESSAGE_CHECK): Define macro only for methods in this source file.
692         (WebKit::WebPageProxy::saveImageToLibrary):
693         - Make sure the shared memory handle sent over IPC is not null.
694         - Make sure the image size sent over IPC is not zero.
695         - Null check the SharedMemory object after calling
696           SharedMemory::map().
697
698 2020-03-06  Alex Christensen  <achristensen@webkit.org>
699
700         Add SPI to disable cross origin access control checks
701         https://bugs.webkit.org/show_bug.cgi?id=208748
702         <rdar://problem/59861114>
703
704         Reviewed by Tim Hatcher.
705
706         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
707         (WebKit::NetworkCORSPreflightChecker::NetworkCORSPreflightChecker):
708         (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
709         * NetworkProcess/NetworkCORSPreflightChecker.h:
710         * NetworkProcess/NetworkLoadChecker.cpp:
711         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
712         (WebKit::NetworkLoadChecker::validateResponse):
713         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
714         * NetworkProcess/NetworkLoadChecker.h:
715         * NetworkProcess/NetworkResourceLoadParameters.cpp:
716         (WebKit::NetworkResourceLoadParameters::encode const):
717         (WebKit::NetworkResourceLoadParameters::decode):
718         * NetworkProcess/NetworkResourceLoadParameters.h:
719         * NetworkProcess/NetworkResourceLoader.cpp:
720         (WebKit::NetworkResourceLoader::crossOriginAccessControlCheckEnabled const):
721         * NetworkProcess/NetworkResourceLoader.h:
722         * NetworkProcess/PingLoad.cpp:
723         (WebKit::PingLoad::PingLoad):
724         * Shared/WebPageCreationParameters.cpp:
725         (WebKit::WebPageCreationParameters::encode const):
726         (WebKit::WebPageCreationParameters::decode):
727         * Shared/WebPageCreationParameters.h:
728         * UIProcess/API/APIPageConfiguration.cpp:
729         (API::PageConfiguration::copy const):
730         * UIProcess/API/APIPageConfiguration.h:
731         (API::PageConfiguration::crossOriginAccessControlCheckEnabled const):
732         (API::PageConfiguration::setCrossOriginAccessControlCheckEnabled):
733         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
734         (-[WKWebViewConfiguration _setCrossOriginAccessControlCheckEnabled:]):
735         (-[WKWebViewConfiguration _crossOriginAccessControlCheckEnabled]):
736         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
737         * UIProcess/WebPageProxy.cpp:
738         * WebProcess/Network/WebLoaderStrategy.cpp:
739         (WebKit::addParametersShared):
740         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
741         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
742         (WebKit::WebLoaderStrategy::startPingLoad):
743         (WebKit::addParametersFromFrame): Deleted.
744         * WebProcess/WebPage/WebPage.cpp:
745         (WebKit::m_processDisplayName):
746
747 2020-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
748
749         [GPU Process] Implement CanvasRenderingContext2D.putImageData()
750         https://bugs.webkit.org/show_bug.cgi?id=208621
751         <rdar://problem/60068047>
752
753         Reviewed by Simon Fraser.
754
755         * GPUProcess/graphics/RemoteImageBufferProxy.h:
756         * Shared/WebCoreArgumentCoders.cpp:
757         (IPC::ArgumentCoder<Ref<WebCore::SharedBuffer>>::encode):
758         (IPC::ArgumentCoder<Ref<WebCore::SharedBuffer>>::decode):
759         (IPC::ArgumentCoder<Ref<WebCore::ImageData>>::encode):
760         (IPC::ArgumentCoder<Ref<WebCore::ImageData>>::decode):
761         * Shared/WebCoreArgumentCoders.h:
762         * WebProcess/GPU/graphics/RemoteImageBuffer.h:
763         (WebKit::RemoteImageBuffer::putImageData):
764
765 2020-03-06  Daniel Bates  <dabates@apple.com>
766
767         Add support for inserting and removing a text placeholder
768         https://bugs.webkit.org/show_bug.cgi?id=208661
769         <rdar://problem/59371073>
770
771         Reviewed by Simon Fraser and Ryosuke Niwa.
772
773         Implements the UITextInput protocol functions -insertTextPlaceholderWithSize and -removeTextPlaceholder.
774
775         * UIProcess/WebPageProxy.h:
776         * UIProcess/ios/WKContentViewInteraction.mm:
777         (-[WKContentView insertTextPlaceholderWithSize:completionHandler:]):
778         (-[WKContentView removeTextPlaceholder:willInsertText:completionHandler:]):
779         Implement more of the UITextInput protocol. These functions turn around and call
780         the corresponding WebPageProxy functions.
781
782         * UIProcess/ios/WKTextPlaceholder.h:
783         * UIProcess/ios/WKTextPlaceholder.mm: Added.
784         (-[WKTextPlaceholder initWithElementContext:]):
785         (-[WKTextPlaceholder elementContext]):
786         (-[WKTextPlaceholder rects]):
787         * UIProcess/ios/WKTextSelectionRect.h: Remove an unncessary #pragma once since I am here.
788         This file is only included from Objective-C/C++ files so that #pragma is unnecessary.
789
790         * UIProcess/ios/WKTextSelectionRect.mm:
791         (-[WKTextSelectionRect initWithCGRect:]): Added.
792         * UIProcess/ios/WebPageProxyIOS.mm:
793         (WebKit::WebPageProxy::insertTextPlaceholder): Added
794         (WebKit::WebPageProxy::removeTextPlaceholder): Added.
795         * WebKit.xcodeproj/project.pbxproj:
796         * WebProcess/WebPage/WebPage.h:
797         * WebProcess/WebPage/WebPage.messages.in: Add new messages to insert and remove a placeholder.
798         * WebProcess/WebPage/ios/WebPageIOS.mm:
799         (WebKit::WebPage::insertTextPlaceholder):
800         (WebKit::WebPage::removeTextPlaceholder):
801         Turn around and call the corresponding Editor functions.
802
803 2020-03-06  Andres Gonzalez  <andresg_22@apple.com>
804
805         Implementation of AccessibilitySupport AXSIsolatedTreeMode.
806         https://bugs.webkit.org/show_bug.cgi?id=208691
807
808         Reviewed by Chris Fleizach.
809
810         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
811         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
812         Honors AXIsolatedTreeMode setting.
813
814 2020-03-06  Simon Fraser  <simon.fraser@apple.com>
815
816         Hit-test CALayers on the scrolling thread for async frame/overflow scrolling
817         https://bugs.webkit.org/show_bug.cgi?id=208740
818         <rdar://problem/48028836>
819
820         Reviewed by Tim Horton.
821
822         Make sure that each call to eventSender.monitorWheelEvents() clears previous state.
823
824         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
825         (WKBundlePageStartMonitoringScrollOperations):
826
827 2020-03-06  Brady Eidson  <beidson@apple.com>
828
829         Some PDFPlugin cleanup in prep for incremental loading.
830         https://bugs.webkit.org/show_bug.cgi?id=208698
831
832         Reviewed by Alex Christensen.
833
834         - The frame is never cleared, so make it a reference.
835         - Use a new "number of streamed bytes" variable instead of grabbing m_data's length, 
836           as m_data will soon become a "sparse" data buffer
837
838         Refactor only.
839
840         * WebProcess/Plugins/PDF/PDFPlugin.h:
841         * WebProcess/Plugins/PDF/PDFPlugin.mm:
842         (WebKit::PDFPlugin::PDFPlugin):
843         (WebKit::PDFPlugin::unconditionalCompleteRangeRequest):
844         (WebKit::PDFPlugin::getResourceBytesAtPosition):
845         (WebKit::PDFPlugin::updateScrollbars):
846         (WebKit::PDFPlugin::createScrollbar):
847         (WebKit::PDFPlugin::isActive const):
848         (WebKit::PDFPlugin::forceUpdateScrollbarsOnMainThreadForPerformanceTesting const):
849         (WebKit::PDFPlugin::jsPDFDocPrint):
850         (WebKit::PDFPlugin::installPDFDocument):
851         (WebKit::PDFPlugin::streamDidReceiveData):
852         (WebKit::PDFPlugin::manualStreamDidReceiveData):
853         (WebKit::PDFPlugin::updatePageAndDeviceScaleFactors):
854         (WebKit::PDFPlugin::willDetachRenderer):
855         (WebKit::PDFPlugin::destroy):
856         (WebKit::PDFPlugin::paintControlForLayerInContext):
857         (WebKit::PDFPlugin::convertFromPDFViewToScreen const):
858         (WebKit::PDFPlugin::boundsOnScreen const):
859         (WebKit::PDFPlugin::showContextMenuAtPoint):
860         (WebKit::PDFPlugin::handleContextMenuEvent):
861         (WebKit::PDFPlugin::isFullFramePlugin const):
862         (WebKit::PDFPlugin::handlesPageScaleFactor const):
863         (WebKit::PDFPlugin::clickedLink):
864         (WebKit::PDFPlugin::saveToPDF):
865         (WebKit::PDFPlugin::openWithNativeApplication):
866         (WebKit::PDFPlugin::showDefinitionForAttributedString):
867         (WebKit::PDFPlugin::notifySelectionChanged):
868         (WebKit::PDFPlugin::notifyCursorChanged):
869         (WebKit::PDFPlugin::axObjectCache const):
870         (WebKit::PDFPlugin::performWebSearch):
871         (WebKit::PDFPlugin::performSpotlightSearch):
872
873 2020-03-06  Alex Christensen  <achristensen@webkit.org>
874
875         Evaluating JavaScript in main frame before loading should succeed
876         https://bugs.webkit.org/show_bug.cgi?id=208733
877
878         Reviewed by Tim Horton.
879
880         This fixes a bug in the SPI I introduced in r257882 with a test.
881
882         * UIProcess/API/Cocoa/WKWebView.mm:
883         (-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]):
884
885 2020-03-06  Brent Fulgham  <bfulgham@apple.com>
886
887         Expand the feature flags mechanism with additional default feature preference values
888         https://bugs.webkit.org/show_bug.cgi?id=208737
889         <rdar://problem/60109390>
890
891         Reviewed by Simon Fraser.
892
893         No new tests, no functional change.
894
895         Update the new default feature preference implementation with additional flags
896         that would benefit from this approach.
897
898         * FeatureFlags/WebKit.plist:
899         * Shared/WebPreferences.yaml:
900         * Shared/WebPreferencesDefaultValues.cpp:
901         (WebKit::defaultInAppBrowserPrivacy):
902         (WebKit::defaultWebGPUEnabled):
903         * Shared/WebPreferencesDefaultValues.h:
904
905 2020-03-06  Jer Noble  <jer.noble@apple.com>
906
907         [GPUP] Convert CDMFactory away from platformStrategies() and use WebProcess settings instead
908         https://bugs.webkit.org/show_bug.cgi?id=208699
909
910         Reviewed by Youenn Fablet.
911
912         Since platformStrategies() is entirely absent in the UIProcess and GPUProcesses, with no
913         intention of adding strategies there, it must be possible to retain the default behavior
914         of WebCore objects. To that end, rather than require clients to implement a MediaStrategy
915         method in order to register CDMFactory objects, simply replace the factories at runtime
916         when necessary, and only in those processes where such a replacement is necessary.
917
918         * WebProcess/GPU/media/WebMediaStrategy.cpp:
919         (WebKit::WebMediaStrategy::registerCDMFactories): Deleted.
920         * WebProcess/GPU/media/WebMediaStrategy.h:
921         * WebProcess/WebProcess.cpp:
922         (WebKit::WebProcess::setUseGPUProcessForMedia):
923
924 2020-03-06  Jer Noble  <jer.noble@apple.com>
925
926         Unreviewed unified build fix; Include what you use, in this case: FrameInfoData.h.
927
928         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
929
930 2020-03-06  Peng Liu  <peng.liu6@apple.com>
931
932         [GPUP] Enable Picture-in-Picture support on Mac
933         https://bugs.webkit.org/show_bug.cgi?id=208732
934
935         Reviewed by Eric Carlson.
936
937         Covered by existing tests.
938
939         RemoteMediaPlayerProxy needs to send "hasVideo" state to MediaPlayerPrivateRemote
940         in the Web process in order to enable the Picture-in-Picture mode support (on Mac).
941
942         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
943         (WebKit::RemoteMediaPlayerProxy::updateCachedState):
944
945 2020-03-06  Peng Liu  <peng.liu6@apple.com>
946
947         Use the feature flags mechanism to give default feature preference values
948         https://bugs.webkit.org/show_bug.cgi?id=208607
949
950         Reviewed by Youenn Fablet.
951
952         No new tests, no functional change.
953
954         Add WebKit.plist to the project in order to use the feature flags mechanism.
955         * FeatureFlags/WebKit.plist: Added.
956
957         Replace the default feature preference values defined with macros (for async_frame_and_overflow_scrolling,
958         incremental_pdf, canvas_and_media_in_gpu_process, WebGL2, WebGPU, and webrtc_in_gpu_process) with
959         functions implemented with the feature flags mechanism.
960         * Shared/WebPreferences.yaml:
961         * Shared/WebPreferencesDefaultValues.cpp:
962         (WebKit::defaultAsyncFrameAndOverflowScrollingEnabled):
963         (WebKit::defaultAsyncFrameScrollingEnabled):
964         (WebKit::defaultAsyncOverflowScrollingEnabled):
965         (WebKit::defaultUseGPUProcessForMedia):
966         (WebKit::defaultRenderCanvasInGPUProcessEnabled):
967         (WebKit::defaultCaptureAudioInGPUProcessEnabled):
968         (WebKit::defaultCaptureAudioInUIProcessEnabled):
969         (WebKit::defaultCaptureVideoInGPUProcessEnabled):
970         (WebKit::defaultWebRTCCodecsInGPUProcess):
971         (WebKit::defaultWebGL2Enabled):
972         (WebKit::defaultWebGPUEnabled):
973         * Shared/WebPreferencesDefaultValues.h:
974         * WebKit.xcodeproj/project.pbxproj:
975
976 2020-03-06  Youenn Fablet  <youenn@apple.com>
977
978         Use ObjectIdentifier to identify media sessions
979         https://bugs.webkit.org/show_bug.cgi?id=208710
980
981         Reviewed by Eric Carlson.
982
983         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
984         (WebKit::WebPage::requestActiveNowPlayingSessionInfo):
985
986 2020-03-05  Jiewen Tan  <jiewen_tan@apple.com>
987
988         [WebAuthn] Do not perform Attestation with type is 'none'
989         https://bugs.webkit.org/show_bug.cgi?id=208676
990         <rdar://problem/59692104>
991
992         Reviewed by Brent Fulgham.
993
994         Besides the suggested title, this patch also adds a whitelist to restrict
995         access until validation is complete. The whitelist allows file URLs and
996         test-related domains.
997
998         Covered by existing tests with new contents.
999
1000         * UIProcess/API/APIWebAuthenticationPanelClient.h:
1001         (API::WebAuthenticationPanelClient::selectAssertionResponse const):
1002         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h:
1003         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
1004         (WebKit::LocalAuthenticatorInternal::whitelistedRpId):
1005         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification):
1006         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
1007
1008 2020-03-06  Youenn Fablet  <youenn@apple.com>
1009
1010         Make sure completion handler given to AuxiliaryProcessProxy::sendMessage is called asynchronously
1011         https://bugs.webkit.org/show_bug.cgi?id=208701
1012
1013         Reviewed by Chris Dumez.
1014
1015         This is difficult to test as we change the behavior in the case a sendWithAsyncReply fails synchronously.
1016
1017         * UIProcess/AuxiliaryProcessProxy.cpp:
1018         (WebKit::AuxiliaryProcessProxy::sendMessage):
1019         sendMessage completion handler is always called asynchronously for usual cases except in rare cases
1020         like terminated processes or invalid connections.
1021         To make things more consistent, call completion handler asynchronously for these rare cases as well.
1022
1023 2020-03-06  David Quesada  <david_quesada@apple.com>
1024
1025         Add _WKResourceLoadInfo.resourceType SPI
1026         https://bugs.webkit.org/show_bug.cgi?id=208723
1027
1028         Reviewed by Alex Christensen.
1029
1030         * NetworkProcess/NetworkResourceLoader.cpp:
1031         (WebKit::NetworkResourceLoader::resourceLoadInfo):
1032         * Shared/ResourceLoadInfo.h:
1033         (WebKit::ResourceLoadInfo::encode const):
1034         (WebKit::ResourceLoadInfo::decode):
1035         * UIProcess/API/APIResourceLoadInfo.h:
1036         * UIProcess/API/Cocoa/_WKResourceLoadInfo.h:
1037         * UIProcess/API/Cocoa/_WKResourceLoadInfo.mm:
1038         (toWKResourceLoadInfoResourceType):
1039         (-[_WKResourceLoadInfo resourceType]):
1040         (-[_WKResourceLoadInfo initWithCoder:]):
1041         (-[_WKResourceLoadInfo encodeWithCoder:]):
1042
1043 2020-03-06  Youenn Fablet  <youenn@apple.com>
1044
1045         Add support for NowPlaying commands in GPUProcess
1046         https://bugs.webkit.org/show_bug.cgi?id=208707
1047
1048         Reviewed by Eric Carlson.
1049
1050         Add a global NowPlayingManager.
1051         Each GPUConnectionToWebProcess is now a NowPlayingManager client.
1052         On updating NowPlayingInfo, it becomes a client and can start receiving commands.
1053
1054         * GPUProcess/GPUConnectionToWebProcess.cpp:
1055         (WebKit::GPUConnectionToWebProcess::clearNowPlayingInfo):
1056         (WebKit::GPUConnectionToWebProcess::setNowPlayingInfo):
1057         (WebKit::GPUConnectionToWebProcess::didReceiveRemoteControlCommand):
1058         * GPUProcess/GPUConnectionToWebProcess.h:
1059         * GPUProcess/GPUProcess.cpp:
1060         (WebKit::GPUProcess::nowPlayingManager):
1061         * GPUProcess/GPUProcess.h:
1062         * GPUProcess/media/RemoteAudioSessionProxy.cpp:
1063         * GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
1064         (WebKit::RemoteAudioSessionProxyManager::tryToSetActiveForProcess):
1065         * WebProcess/GPU/GPUProcessConnection.cpp:
1066         (WebKit::GPUProcessConnection::didReceiveRemoteCommand):
1067         * WebProcess/GPU/GPUProcessConnection.h:
1068         * WebProcess/GPU/GPUProcessConnection.messages.in:
1069
1070 2020-03-06  Per Arne Vollan  <pvollan@apple.com>
1071
1072         [iOS] Adopt entitlement to avoid treating webcontent as a trusted binary in some cases
1073         https://bugs.webkit.org/show_bug.cgi?id=208668
1074
1075         Reviewed by Brent Fulgham.
1076
1077         On iOS, adopt entitlement to avoid treating the WebContent process as a trusted binary in some cases.
1078
1079         * Scripts/process-entitlements.sh:
1080
1081 2020-03-06  Simon Fraser  <simon.fraser@apple.com>
1082
1083         Move synchronousScrollingReasons to ScrollingTreeScrollingNode
1084         https://bugs.webkit.org/show_bug.cgi?id=208721
1085
1086         Reviewed by Antti Koivisto.
1087
1088         No need to send synchronousScrollingReasons to the UI process; it makes no sense there.
1089
1090         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1091         (ArgumentCoder<ScrollingStateScrollingNode>::encode):
1092         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
1093         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
1094         (WebKit::dump):
1095
1096 2020-03-06  Sihui Liu  <sihui_liu@apple.com>
1097
1098         UIProcess crash after using _prepareForMoveToWindow, then deallocating the WKWebView before moving to the window
1099         https://bugs.webkit.org/show_bug.cgi?id=208365
1100         <rdar://problem/59877296>
1101
1102         Reviewed by Geoffrey Garen.
1103
1104         Fix the issue that observers in WebView may not be removed when WebView is prepared to move to some window but 
1105         does not actually move. Make WebView hold strong reference to the target window so it knows to stop observing at
1106         dealloc even if the move does not happen. The strong reference will be released when WebView actually moves to a
1107         window to avoid reference cycle.
1108
1109         New API tests: WKWebView.PrepareForMoveToWindowThenViewDeallocBeforeMoving
1110                        WKWebView.PrepareForMoveToWindowThenWindowDeallocBeforeMoving
1111
1112         * UIProcess/Cocoa/WebViewImpl.h:
1113         (WebKit::WebViewImpl::targetWindowForMovePreparation const):
1114         * UIProcess/Cocoa/WebViewImpl.mm:
1115         (WebKit::WebViewImpl::~WebViewImpl):
1116         (WebKit::WebViewImpl::intrinsicDeviceScaleFactor const):
1117         (WebKit::WebViewImpl::windowDidChangeScreen):
1118         (WebKit::WebViewImpl::viewWillMoveToWindowImpl):
1119         (WebKit::WebViewImpl::viewWillMoveToWindow):
1120         (WebKit::WebViewImpl::viewDidMoveToWindow):
1121         (WebKit::WebViewImpl::colorSpace):
1122         (WebKit::WebViewImpl::prepareForMoveToWindow):
1123
1124 2020-03-06  Kate Cheney  <katherine_cheney@apple.com>
1125
1126         Remove redundant flags in script evaluation checks
1127         https://bugs.webkit.org/show_bug.cgi?id=208609
1128         <rdar://problem/60058656>
1129
1130         Reviewed by Brent Fulgham.
1131
1132         hasNavigatedAwayFromAppBoundDomain only gets set in WebPageProxy if
1133         its a main frame navigation and In-App Browser privacy is enabled,
1134         we don't need to check again at the sites.
1135
1136         * WebProcess/WebPage/WebPage.cpp:
1137         (WebKit::WebPage::runJavaScript):
1138
1139 2020-03-05  Simon Fraser  <simon.fraser@apple.com>
1140
1141         Use an OptionSet<> for SynchronousScrollingReasons
1142         https://bugs.webkit.org/show_bug.cgi?id=208697
1143
1144         Reviewed by Antti Koivisto.
1145
1146         Convert SynchronousScrollingReasons to an OptionSet<SynchronousScrollingReason>.
1147
1148         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1149         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
1150         * UIProcess/WebPageProxy.cpp:
1151
1152 2020-03-06  Jer Noble  <jer.noble@apple.com>
1153
1154         [GPUP] Set the WebProcess's useGPUProcessForMedia setting during the first page load
1155         https://bugs.webkit.org/show_bug.cgi?id=208694
1156
1157         Reviewed by Youenn Fablet.
1158
1159         Until such a time as we can pass through the correct preference during WebProcess creation,
1160         set the WebProcess's "useGPUProcessForMedia" setting just before the first page load.
1161
1162         * WebProcess/WebPage/WebPage.cpp:
1163         (WebKit::WebPage::updatePreferences):
1164         * WebProcess/WebProcess.cpp:
1165         (WebKit::WebProcess::initializeWebProcess):
1166         * WebProcess/WebProcess.h:
1167
1168 2020-03-06  Antoine Quint  <graouts@webkit.org>
1169
1170         Remove the experimental flag for Pointer Events
1171         https://bugs.webkit.org/show_bug.cgi?id=208655
1172         <rdar://problem/60090545>
1173
1174         Reviewed by Dean Jackson.
1175
1176         * Shared/WebPreferences.yaml:
1177
1178 2020-03-05  Brent Fulgham  <bfulgham@apple.com>
1179
1180         [iOS] Remove reporting for some well-understood framebuffer routines
1181         https://bugs.webkit.org/show_bug.cgi?id=208686
1182         <rdar://problem/59181061>
1183
1184         Reviewed by Per Arne Vollan.
1185
1186         We have captured backlogs capturing the use of more framebuffer-related rules. We
1187         should remove this reporting to reduce log spam.
1188
1189         * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
1190         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1191
1192 2020-03-05  Brent Fulgham  <bfulgham@apple.com>
1193
1194         GPU Process sandbox errors
1195         https://bugs.webkit.org/show_bug.cgi?id=208688
1196         <rdar://problem/60085171>
1197
1198         Reviewed by Per Arne Vollan.
1199
1200         The new GPU Process needs access to a number of properties to support media playback
1201         features available in our shipping software.
1202
1203         * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
1204
1205 2020-03-05  Brady Eidson  <beidson@apple.com>
1206
1207         Pre-fetch first page in new PDF loading model.
1208         https://bugs.webkit.org/show_bug.cgi?id=208669
1209
1210         Reviewed by Alex Christensen.
1211
1212         Also add some logging.
1213
1214         * Platform/Logging.h:
1215         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1216         (WebKit::dataProviderGetBytesAtPositionCallback):
1217         (WebKit::dataProviderGetByteRangesCallback):
1218         (WebKit::PDFPlugin::threadEntry):
1219
1220 2020-03-05  Alex Christensen  <achristensen@webkit.org>
1221
1222         Add WKNavigationDelegatePrivate SPI to inform application of subframe navigations
1223         https://bugs.webkit.org/show_bug.cgi?id=208670
1224
1225         Reviewed by Brady Eidson.
1226
1227         There is no WKNavigation for subframe navigations, so just expose the NSURLRequest directly.
1228         This is equivalent to WKNavigation._request, which is distinct from WKFrameInfo.request.
1229         The former is the currently pending request, the latter is the request that has already loaded.
1230         I needed to move the isMainFrame check to the NavigationClient implementations.
1231         This is needed for <rdar://problem/57201034>.
1232         Covered by API tests.
1233
1234         * UIProcess/API/APINavigationClient.h:
1235         (API::NavigationClient::didStartProvisionalNavigation):
1236         (API::NavigationClient::didFailProvisionalNavigationWithError):
1237         (API::NavigationClient::didCommitNavigation):
1238         (API::NavigationClient::didFinishNavigation):
1239         (API::NavigationClient::didFailNavigationWithError):
1240         (API::NavigationClient::didFailProvisionalLoadInSubframeWithError): Deleted.
1241         * UIProcess/API/C/WKPage.cpp:
1242         (WKPageSetPageNavigationClient):
1243         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1244         * UIProcess/API/glib/WebKitNavigationClient.cpp:
1245         * UIProcess/Cocoa/NavigationState.h:
1246         * UIProcess/Cocoa/NavigationState.mm:
1247         (WebKit::NavigationState::setNavigationDelegate):
1248         (WebKit::NavigationState::NavigationClient::didStartProvisionalNavigation):
1249         (WebKit::createErrorWithRecoveryAttempter):
1250         (WebKit::NavigationState::NavigationClient::didFailProvisionalNavigationWithError):
1251         (WebKit::NavigationState::NavigationClient::didCommitNavigation):
1252         (WebKit::NavigationState::NavigationClient::didFinishNavigation):
1253         (WebKit::NavigationState::NavigationClient::didFailNavigationWithError):
1254         (WebKit::NavigationState::NavigationClient::didFailProvisionalLoadInSubframeWithError): Deleted.
1255         * UIProcess/ProvisionalPageProxy.cpp:
1256         (WebKit::ProvisionalPageProxy::cancel):
1257         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
1258         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
1259         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
1260         * UIProcess/ProvisionalPageProxy.h:
1261         * UIProcess/WebPageProxy.cpp:
1262         (WebKit::WebPageProxy::commitProvisionalPage):
1263         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
1264         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
1265         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
1266         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
1267         (WebKit::WebPageProxy::didCommitLoadForFrame):
1268         (WebKit::WebPageProxy::didFinishLoadForFrame):
1269         (WebKit::WebPageProxy::didFailLoadForFrame):
1270         * UIProcess/WebPageProxy.h:
1271         * UIProcess/WebPageProxy.messages.in:
1272         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1273         (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):
1274         (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
1275         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
1276         (WebKit::WebFrameLoaderClient::dispatchDidFailLoad):
1277         (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad):
1278
1279 2020-03-05  Alex Christensen  <achristensen@webkit.org>
1280
1281         Add WKFrameInfo._parentFrameHandle SPI
1282         https://bugs.webkit.org/show_bug.cgi?id=208674
1283
1284         Reviewed by Brady Eidson.
1285
1286         I got carried away and removed it in r257872 but it's still needed for <rdar://problem/57201034>
1287         Covered by API tests.
1288
1289         * Shared/FrameInfoData.cpp:
1290         (WebKit::FrameInfoData::encode const):
1291         (WebKit::FrameInfoData::decode):
1292         * Shared/FrameInfoData.h:
1293         * UIProcess/API/APIFrameInfo.cpp:
1294         (API::FrameInfo::parentFrameHandle const):
1295         * UIProcess/API/APIFrameInfo.h:
1296         * UIProcess/API/APIFrameTreeNode.cpp:
1297         (API::FrameTreeNode::parentFrameHandle const):
1298         * UIProcess/API/APIFrameTreeNode.h:
1299         * UIProcess/API/Cocoa/WKFrameInfo.mm:
1300         (-[WKFrameInfo _parentFrameHandle]):
1301         * UIProcess/API/Cocoa/WKFrameInfoPrivate.h:
1302         * UIProcess/API/Cocoa/_WKFrameTreeNode.mm:
1303         (-[_WKFrameTreeNode _parentFrameHandle]):
1304         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1305         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1306         * WebProcess/WebPage/WebFrame.cpp:
1307         (WebKit::WebFrame::info const):
1308
1309 2020-03-05  Kate Cheney  <katherine_cheney@apple.com>
1310
1311         Add web page additions to WebPageProxy
1312         https://bugs.webkit.org/show_bug.cgi?id=208666
1313         <rdar://problem/60100413>
1314
1315         Reviewed by Brent Fulgham.
1316
1317         * UIProcess/WebPageProxy.cpp:
1318         (WebKit::WebPageProxy::isAppBoundDomain const):
1319         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
1320
1321 2020-03-05  Brent Fulgham  <bfulgham@apple.com>
1322
1323         [macOS] Create sandbox extension for "com.apple.tccd"
1324         https://bugs.webkit.org/show_bug.cgi?id=208660
1325         <rdar://problem/57666569>
1326
1327         Reviewed by Per Arne Vollan.
1328
1329         Make the same changes for macOS as we did for iOS in Bug 204367. Specifically, remove the
1330         blanket mach-lookup permission for 'com.apple.tccd', and instead make a dynamic extension
1331         only when a camera or microphone request is made.
1332
1333         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1334         (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest): Update to create the
1335         extensions on macOS, too.
1336         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1337         * WebProcess/com.apple.WebProcess.sb.in: Remove blanket access permissions and move them to
1338         the dynamic access permissions section of the sandbox.
1339
1340 2020-03-05  Jiewen Tan  <jiewen_tan@apple.com>
1341
1342         [WebAuthn] Implement SPI -[_WKWebAuthenticationPanelDelegate panel:selectAssertionResponse:source:completionHandler:]
1343         https://bugs.webkit.org/show_bug.cgi?id=208626
1344         <rdar://problem/60074148>
1345
1346         Reviewed by Brent Fulgham.
1347
1348         The patch adds a parameter (source) to the original SPI such that clients can know where those responses are from.
1349         Besides that this patch also changes the completionHandler to accept a pointer instead of a reference such that clients
1350         can pass a nullptr as a no op. In order to keep WebKitTestRunner running, the patch then overrides this SPI in the C API to
1351         always return the first item.
1352
1353         * UIProcess/API/APIWebAuthenticationAssertionResponse.h:
1354         * UIProcess/API/APIWebAuthenticationPanelClient.h:
1355         (API::WebAuthenticationPanelClient::selectAssertionResponse const):
1356         * UIProcess/API/C/WKPage.cpp:
1357         (WKPageSetPageUIClient):
1358         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
1359         * UIProcess/WebAuthentication/Authenticator.h:
1360         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1361         (WebKit::AuthenticatorManager::selectAssertionResponse):
1362         * UIProcess/WebAuthentication/AuthenticatorManager.h:
1363         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
1364         (WebKit::LocalAuthenticator::getAssertion):
1365         * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h:
1366         * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm:
1367         (WebKit::WebAuthenticationPanelClient::WebAuthenticationPanelClient):
1368         (WebKit::wkWebAuthenticationSource):
1369         (WebKit::WebAuthenticationPanelClient::selectAssertionResponse const):
1370         * UIProcess/WebAuthentication/WebAuthenticationFlags.h:
1371         * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
1372         (WebKit::CtapAuthenticator::continueGetNextAssertionAfterResponseReceived):
1373
1374 2020-03-05  Chris Dumez  <cdumez@apple.com>
1375
1376         Running a single layout test makes 28 WebProcessPools (and launches 6 Network processes)
1377         https://bugs.webkit.org/show_bug.cgi?id=208541
1378         <rdar://problem/60018602>
1379
1380         Reviewed by Youenn Fablet.
1381
1382         WebKitTestRunner was contructing a page / process pool and then calling into various
1383         WebsiteDataStore APIs to reset / clear state. Because nothing had been loaded in the
1384         view yet, the page would still be using a dummy process proxy (due to delayed process
1385         launch optimization) at the time the WebsiteDataStore APIs are called. Because the
1386         dummy process proxy would not register itself with the WebsiteDataStore (unlike other
1387         processes), the WebsiteDataStore thought it had no associated process pool and would
1388         thus construct a temporary one every time it needed one.
1389
1390         To address the issue, we now construct one dummy process proxy per session (instead of
1391         one for all sessions). As a result, the dummy process proxy can now behave as a normal
1392         WebProcessProxy and have an associated data store and register / unregister itself from
1393         it, depending on whether or not it has pages.
1394
1395         * UIProcess/WebPageProxy.cpp:
1396         (WebKit::WebPageProxy::launchInitialProcessIfNecessary):
1397         * UIProcess/WebProcessPool.cpp:
1398         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
1399         (WebKit::WebProcessPool::disconnectProcess):
1400         (WebKit::WebProcessPool::processForRegistrableDomain):
1401         (WebKit::WebProcessPool::createWebPage):
1402         * UIProcess/WebProcessPool.h:
1403         * UIProcess/WebProcessProxy.cpp:
1404         (WebKit::WebProcessProxy::isDummyProcessProxy const):
1405         (WebKit::WebProcessProxy::updateRegistrationWithDataStore):
1406         (WebKit::WebProcessProxy::maybeShutDown):
1407         * UIProcess/WebProcessProxy.h:
1408
1409 2020-03-05  Jer Noble  <jer.noble@apple.com>
1410
1411         Unreviewed unified build fix; forward-declare and include GPUConnectionToWebProcess where it's used.
1412
1413         * GPUProcess/media/RemoteAudioSessionProxy.cpp:
1414         * GPUProcess/media/RemoteAudioSessionProxy.h:
1415
1416 2020-03-05  Jer Noble  <jer.noble@apple.com>
1417
1418         [GPUP] Implement RemoteAudioSession
1419         https://bugs.webkit.org/show_bug.cgi?id=208583
1420
1421         Reviewed by Alex Christensen.
1422
1423         Add a subclass of AudioSession which, instead of modifying the audio behavior of the current process, modifies the
1424         audio behavior of the GPU Process. And, in the GPU Process, since it represents the audio behavior of potentially
1425         multiple separate WebContent processes.
1426
1427         Override the default shared AudioSession at WebProcess initialization time.
1428
1429         * DerivedSources-input.xcfilelist:
1430         * DerivedSources-output.xcfilelist:
1431         * DerivedSources.make:
1432         * GPUProcess/GPUConnectionToWebProcess.cpp:
1433         (WebKit::GPUConnectionToWebProcess::didClose):
1434         (WebKit::GPUConnectionToWebProcess::audioSessionProxy):
1435         (WebKit::GPUConnectionToWebProcess::ensureAudioSession):
1436         (WebKit::GPUConnectionToWebProcess::legacyCdmFactoryProxy):
1437         (WebKit::GPUConnectionToWebProcess::dispatchMessage):
1438         (WebKit::GPUConnectionToWebProcess::dispatchSyncMessage):
1439         * GPUProcess/GPUConnectionToWebProcess.h:
1440         * GPUProcess/GPUConnectionToWebProcess.messages.in:
1441         * GPUProcess/GPUProcess.cpp:
1442         (WebKit::GPUProcess::initializeGPUProcess):
1443         (WebKit::GPUProcess::audioSessionManager const):
1444         * GPUProcess/GPUProcess.h:
1445         * GPUProcess/media/RemoteAudioSessionProxy.cpp: Added.
1446         (WebKit::RemoteAudioSessionProxy::create):
1447         (WebKit::RemoteAudioSessionProxy::RemoteAudioSessionProxy):
1448         (WebKit::RemoteAudioSessionProxy::processIdentifier):
1449         (WebKit::RemoteAudioSessionProxy::configuration):
1450         (WebKit::RemoteAudioSessionProxy::setCategory):
1451         (WebKit::RemoteAudioSessionProxy::setPreferredBufferSize):
1452         (WebKit::RemoteAudioSessionProxy::tryToSetActive):
1453         (WebKit::RemoteAudioSessionProxy::beginInterruption):
1454         (WebKit::RemoteAudioSessionProxy::endInterruption):
1455         (WebKit::RemoteAudioSessionProxy::audioSessionManager):
1456         (WebKit::RemoteAudioSessionProxy::connection):
1457         * GPUProcess/media/RemoteAudioSessionProxy.h: Added.
1458         (WebKit::RemoteAudioSessionProxy::category const):
1459         (WebKit::RemoteAudioSessionProxy::routeSharingPolicy const):
1460         (WebKit::RemoteAudioSessionProxy::preferredBufferSize const):
1461         (WebKit::RemoteAudioSessionProxy::isActive const):
1462         * GPUProcess/media/RemoteAudioSessionProxy.messages.in:
1463         * GPUProcess/media/RemoteAudioSessionProxyManager.cpp: Added.
1464         (WebKit::RemoteAudioSessionProxyManager::RemoteAudioSessionProxyManager):
1465         (WebKit::RemoteAudioSessionProxyManager::addProxy):
1466         (WebKit::RemoteAudioSessionProxyManager::removeProxy):
1467         (WebKit::RemoteAudioSessionProxyManager::getProxy):
1468         (WebKit::RemoteAudioSessionProxyManager::setCategoryForProcess):
1469         (WebKit::RemoteAudioSessionProxyManager::setPreferredBufferSizeForProcess):
1470         (WebKit::RemoteAudioSessionProxyManager::tryToSetActiveForProcess):
1471         * GPUProcess/media/RemoteAudioSessionProxyManager.h:
1472         (WebKit::RemoteAudioSessionProxyManager::session const):
1473         * GPUProcess/media/RemoteAudioSessionProxyManager.messages.in:
1474         * Scripts/webkit/messages.py:
1475         * Sources.txt:
1476         * SourcesCocoa.txt:
1477         * WebKit.xcodeproj/project.pbxproj:
1478         * WebProcess/GPU/media/RemoteAudioSession.cpp: Added.
1479         (WebKit::RemoteAudioSession::create):
1480         (WebKit::RemoteAudioSession::RemoteAudioSession):
1481         (WebKit::RemoteAudioSession::connection):
1482         (WebKit::RemoteAudioSession::setCategory):
1483         (WebKit::RemoteAudioSession::setPreferredBufferSize):
1484         (WebKit::RemoteAudioSession::tryToSetActiveInternal):
1485         (WebKit::RemoteAudioSession::configurationChanged):
1486         (WebKit::RemoteAudioSession::beginInterruption):
1487         (WebKit::RemoteAudioSession::endInterruption):
1488         * WebProcess/GPU/media/RemoteAudioSession.h: Added.
1489         * WebProcess/GPU/media/RemoteAudioSession.messages.in:
1490         * WebProcess/GPU/media/RemoteAudioSessionConfiguration.h: Added.
1491         (WebKit::RemoteAudioSessionConfiguration::encode const):
1492         (WebKit::RemoteAudioSessionConfiguration::decode):
1493         * WebProcess/GPU/media/RemoteAudioSessionIdentifier.h:
1494
1495 2020-03-05  Brent Fulgham  <bfulgham@apple.com>
1496
1497         Sandbox: Allow sysctl read of "kern.ostype"
1498         https://bugs.webkit.org/show_bug.cgi?id=208650
1499         <rdar://problem/60010603>
1500
1501         Reviewed by Alexey Proskuryakov.
1502
1503         NSURLSession needs access to "kern.ostype", so the Networking and WebContent
1504         sandboxes should allow it. I corrected this for the iOS Network sandbox in
1505         Bug 208346. I should have handled macOS and the WebContent process (on both
1506         platforms) at the same time.
1507
1508         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
1509         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1510         * WebProcess/com.apple.WebProcess.sb.in:
1511
1512 2020-03-05  Sihui Liu  <sihui_liu@apple.com>
1513
1514         Assertion failed: shouldBeActive() in BackgroundProcessResponsivenessTimer::responsivenessCheckTimerFired()
1515         https://bugs.webkit.org/show_bug.cgi?id=208596
1516
1517         Reviewed by Chris Dumez.
1518
1519         Update state of BackgroundProcessResponsivenessTimer when ServiceWorker is enabled or disabled in web process.
1520
1521         * UIProcess/WebProcessProxy.cpp:
1522         (WebKit::WebProcessProxy::disableServiceWorkers):
1523         (WebKit::WebProcessProxy::enableServiceWorkers):
1524
1525 2020-03-05  youenn fablet  <youenn@apple.com>
1526
1527         Add logging support for capture sources in GPUProcess
1528         https://bugs.webkit.org/show_bug.cgi?id=208637
1529
1530         Reviewed by Eric Carlson.
1531
1532         Add a logger getter to the ConnectionProxy.
1533         Implement it for GPUProcess and UIProcess.
1534         Set source logger to the connection proxy logger.
1535
1536         * GPUProcess/GPUConnectionToWebProcess.cpp:
1537         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1538         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
1539         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
1540         * UIProcess/WebProcessProxy.cpp:
1541         * UIProcess/WebProcessProxy.h:
1542
1543 2020-03-05  Youenn Fablet  <youenn@apple.com>
1544
1545         Export NowPlaying commands to GPUProcess when media playing in GPUProcess is enabled
1546         https://bugs.webkit.org/show_bug.cgi?id=208568
1547
1548         Reviewed by Eric Carlson.
1549
1550         Export NowPlaying orders to GPU process through IPC if GPUProcess is turned on.
1551         Otherwise use the regular in process implementation.
1552         Make sure to sync the hasAudio state so that it gets set properly in WebProcess.
1553
1554         Remove the use of a PlatformMediaSessionManager for capture since it is now using platform strategies in two places.
1555         Instead use directly static methods of MediaSessionManageriOS to implement pid forwarding and AudioSession to set category and buffer size.
1556         A follow-up refactoring should probably rearchitect AudioSession handling.
1557
1558         * GPUProcess/GPUConnectionToWebProcess.cpp:
1559         (WebKit::GPUConnectionToWebProcess::clearNowPlayingInfo):
1560         (WebKit::GPUConnectionToWebProcess::setNowPlayingInfo):
1561         (WebKit::GPUConnectionToWebProcess::sessionManager): Deleted.
1562         * GPUProcess/GPUConnectionToWebProcess.h:
1563         * GPUProcess/GPUConnectionToWebProcess.messages.in:
1564         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
1565         (WebKit::RemoteMediaPlayerProxy::updateCachedState):
1566         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1567         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::SourceProxy):
1568         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::~SourceProxy):
1569         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
1570         (WebKit::UserMediaCaptureManagerProxy::clone):
1571         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
1572         * UIProcess/WebProcessProxy.cpp:
1573         * WebProcess/GPU/media/WebMediaStrategy.cpp:
1574         (WebKit::WebMediaStrategy::clearNowPlayingInfo):
1575         (WebKit::WebMediaStrategy::setNowPlayingInfo):
1576         * WebProcess/GPU/media/WebMediaStrategy.h:
1577
1578 2020-03-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1579
1580         REGRESSION(r257667): [UNIX] Tests http/tests/incremental/split-hex-entities.pl and http/tests/misc/large-js-program.php are crashing
1581         https://bugs.webkit.org/show_bug.cgi?id=208571
1582
1583         Reviewed by Alex Christensen.
1584
1585         We get a release assert in Connection::processMessage() when trying to get a file descriptor from
1586         m_fileDescriptors array that is empty. The problem is that since r257667, a shared buffer is always used by the
1587         network process to send data to the web process (NetworkResourceLoader::sendBuffer) and shared buffer
1588         encoding/decoding was changed to always use shared memory and send the file descriptor over the IPC. When
1589         sending large data in small chunks like these tests are doing, we easily end up with many messages queued in the
1590         web process receiver (Connection::enqueueIncomingMessage), all of them having one file descriptor open. When the
1591         maximum number of open file descriptors per process is reached, recvmsg doesn't fail but it sets the flag
1592         MSG_CTRUNC in msg_flags and the file descriptor is not actually included as part of the control message. The
1593         message info still claims to include a file descriptor, but it hasn't been created and added to the
1594         m_fileDescriptors array. We could check msg_flags, but only to assert earlier, not to fix the problem, since we
1595         are unable to get the file descriptor sent. So, at least in linux I think it's better to send the data over the
1596         IPC instead of using shared memory. We are already using shared memory for any IPC message bigger than 4096.
1597
1598         * Platform/IPC/unix/ConnectionUnix.cpp:
1599         (IPC::readBytesFromSocket): Consider also a read failure when control data is discarded.
1600         * Shared/WebCoreArgumentCoders.cpp:
1601         (IPC::encodeSharedBuffer): Do not use shared memory to encode a SharedBuffer in Unix.
1602         (IPC::decodeSharedBuffer): Do not use shared memory to decode a SharedBuffer in Unix.
1603
1604 2020-03-04  Chris Dumez  <cdumez@apple.com>
1605
1606         WebsiteDataStore methods often create process pools and launch network processes unnecessarily
1607         https://bugs.webkit.org/show_bug.cgi?id=208619
1608
1609         Reviewed by Alex Christensen.
1610
1611         These methods were potentially creating a temporary WebProcessPool object and launching a network
1612         process only to go change something in memory in the network process. Since the newly created
1613         WebProcessPool is temporary, it gets destroyed as soon as we get out of the for loop and the
1614         network go away too. Therefore, the information in memory of the new network process would not
1615         survive. Those methods should never be created a process pool and this patch fixes this.
1616
1617         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1618         (WebKit::WebsiteDataStore::setMaxStatisticsEntries):
1619         (WebKit::WebsiteDataStore::setPruneEntriesDownTo):
1620         (WebKit::WebsiteDataStore::setGrandfatheringTime):
1621         (WebKit::WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval):
1622         (WebKit::WebsiteDataStore::setPrevalentResource):
1623         (WebKit::WebsiteDataStore::setVeryPrevalentResource):
1624         (WebKit::WebsiteDataStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
1625         (WebKit::WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned):
1626         (WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest):
1627         (WebKit::WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured):
1628         (WebKit::WebsiteDataStore::getAllStorageAccessEntries):
1629         (WebKit::WebsiteDataStore::setTimeToLiveUserInteraction):
1630         (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
1631         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
1632         (WebKit::WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses):
1633
1634 2020-03-04  Simon Fraser  <simon.fraser@apple.com>
1635
1636         Make m_slowRepaintObjects a WeakHashSet
1637         https://bugs.webkit.org/show_bug.cgi?id=208623
1638
1639         Reviewed by Ryosuke Niwa.
1640
1641         Fix namespace errors triggered by FrameView include changes.
1642
1643         * UIProcess/API/APIPageConfiguration.cpp:
1644         (API::PageConfiguration::visitedLinkStore):
1645         (API::PageConfiguration::setVisitedLinkStore):
1646
1647 2020-03-04  Brady Eidson  <beidson@apple.com>
1648
1649         Lay initial groundwork for new PDF loading model
1650         https://bugs.webkit.org/show_bug.cgi?id=208599
1651
1652         Reviewed by Alex Christensen.
1653
1654         First piece of adopting some new platform PDF APIs.
1655         Disabled by default even on platforms that support it.
1656         No behavior change for shipping configs.
1657
1658         * WebProcess/Plugins/PDF/PDFPlugin.h:
1659         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1660         (WebKit::PDFPlugin::PDFPlugin):
1661         (WebKit::dataProviderGetBytesAtPositionCallback):
1662         (WebKit::dataProviderGetByteRangesCallback):
1663         (WebKit::dataProviderReleaseInfoCallback):
1664         (WebKit::PDFPlugin::threadEntry):
1665         (WebKit::PDFPlugin::unconditionalCompleteRangeRequest):
1666         (WebKit::PDFPlugin::getResourceBytesAtPosition):
1667         (WebKit::PDFPlugin::adoptBackgroundThreadDocument):
1668         (WebKit::PDFPlugin::pdfDocumentDidLoad):
1669         (WebKit::PDFPlugin::installPDFDocument):
1670         (WebKit::PDFPlugin::manualStreamDidReceiveData):
1671         (WebKit::PDFPlugin::attemptToUnlockPDF):
1672         (WebKit::PDFPlugin::calculateSizes):
1673         (WebKit::PDFPlugin::handleMouseEvent):
1674         (WebKit::PDFPlugin::saveToPDF):
1675         (WebKit::PDFPlugin::openWithNativeApplication):
1676         (WebKit::PDFPlugin::countFindMatches):
1677         (WebKit::PDFPlugin::nextMatchForString):
1678
1679 2020-03-04  Chris Dumez  <cdumez@apple.com>
1680
1681         Construct fewer unnecessary temporary WebProcessPool objects in WebsiteDataStore implementation
1682         https://bugs.webkit.org/show_bug.cgi?id=208610
1683
1684         Reviewed by Alex Christensen.
1685
1686         A lot of methods in WebsiteDataStore were calling ensureProcessPools() and then it a loop do something
1687         if the pool already has a network process. When you construct a new process pool, the pool has initially
1688         no network process. As a result, this code should be using processPools() instead of ensureProcessPools()
1689         to avoid unnecessarily constructing a temporary WebProcessPool object.
1690
1691         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1692         (WebKit::WebsiteDataStore::fetchDataAndApply):
1693         (WebKit::WebsiteDataStore::removeData):
1694         (WebKit::WebsiteDataStore::dumpResourceLoadStatistics):
1695         (WebKit::WebsiteDataStore::isPrevalentResource):
1696         (WebKit::WebsiteDataStore::isGrandfathered):
1697         (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode):
1698         (WebKit::WebsiteDataStore::isVeryPrevalentResource):
1699         (WebKit::WebsiteDataStore::setVeryPrevalentResource):
1700         (WebKit::WebsiteDataStore::setSubframeUnderTopFrameDomain):
1701         (WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder):
1702         (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameDomain):
1703         (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder):
1704         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo):
1705         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom):
1706         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo):
1707         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom):
1708         (WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo):
1709         (WebKit::WebsiteDataStore::clearPrevalentResource):
1710         (WebKit::WebsiteDataStore::resetParametersToDefaultValues):
1711         (WebKit::WebsiteDataStore::submitTelemetry):
1712         (WebKit::WebsiteDataStore::scheduleClearInMemoryAndPersistent):
1713         (WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary):
1714         (WebKit::WebsiteDataStore::scheduleCookieBlockingUpdate):
1715         (WebKit::WebsiteDataStore::scheduleStatisticsAndDataRecordsProcessing):
1716         (WebKit::WebsiteDataStore::setLastSeen):
1717         (WebKit::WebsiteDataStore::mergeStatisticForTesting):
1718         (WebKit::WebsiteDataStore::logUserInteraction):
1719         (WebKit::WebsiteDataStore::hasHadUserInteraction):
1720         (WebKit::WebsiteDataStore::isRelationshipOnlyInDatabaseOnce):
1721         (WebKit::WebsiteDataStore::clearUserInteraction):
1722         (WebKit::WebsiteDataStore::setGrandfathered):
1723         (WebKit::WebsiteDataStore::setUseITPDatabase):
1724         (WebKit::WebsiteDataStore::setCrossSiteLoadWithLinkDecorationForTesting):
1725         (WebKit::WebsiteDataStore::resetCrossSiteLoadsWithLinkDecorationForTesting):
1726         (WebKit::WebsiteDataStore::deleteCookiesForTesting):
1727         (WebKit::WebsiteDataStore::hasLocalStorageForTesting const):
1728         (WebKit::WebsiteDataStore::hasIsolatedSessionForTesting const):
1729         (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldDowngradeReferrerForTesting):
1730         (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting):
1731         (WebKit::WebsiteDataStore::setResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting):
1732         (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources):
1733         (WebKit::WebsiteDataStore::isResourceLoadStatisticsEphemeral const):
1734         (WebKit::WebsiteDataStore::getLocalStorageDetails):
1735         (WebKit::WebsiteDataStore::resetQuota):
1736         (WebKit::WebsiteDataStore::hasAppBoundSession const):
1737         (WebKit::WebsiteDataStore::setInAppBrowserPrivacyEnabled):
1738
1739 2020-03-04  Alex Christensen  <achristensen@webkit.org>
1740
1741         Call globalObjectIsAvailableForFrame before evaluating JavaScript in newly created worlds
1742         https://bugs.webkit.org/show_bug.cgi?id=208615
1743         <rdar://problem/59406743>
1744
1745         Reviewed by Alex Christensen.
1746
1747         globalObjectIsAvailableForFrame is often used for initialization code for a content world.
1748         If we evaluate JavaScript in a content world as the first thing we do in that world, 
1749         globalObjectIsAvailableForFrame hadn't been called, so things were not initialized.
1750         So call it when evaluating JavaScript if we create the world to evaluate in.
1751
1752         Covered by new API tests.
1753
1754         * WebProcess/UserContent/WebUserContentController.cpp:
1755         (WebKit::WebUserContentController::addContentWorld):
1756         * WebProcess/UserContent/WebUserContentController.h:
1757         * WebProcess/WebPage/WebPage.cpp:
1758         (WebKit::WebPage::runJavaScriptInFrameInScriptWorld):
1759
1760 2020-03-04  Jiewen Tan  <jiewen_tan@apple.com>
1761
1762         Unreviewed, a build fix after r257877
1763
1764         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
1765         (WebKit::LocalConnection::verifyUser const):
1766         Restricts LAOptionPasscodeTitle to iOS for now.
1767
1768 2020-03-04  Chris Dumez  <cdumez@apple.com>
1769
1770         Adopt new and improved CFNetwork SPI for cookie change notifications
1771         https://bugs.webkit.org/show_bug.cgi?id=208594
1772         <rdar://problem/60053313>
1773
1774         Reviewed by Alex Christensen.
1775
1776         Adopt new and improved CFNetwork SPI for cookie change notifications. Notifications are now per domain
1777         and the domain matches one of the domains we listen for cookie changes on.
1778
1779         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1780         (WebKit::NetworkConnectionToWebProcess::cookiesDeleted):
1781         (WebKit::NetworkConnectionToWebProcess::allCookiesDeleted):
1782         * NetworkProcess/NetworkConnectionToWebProcess.h:
1783         * WebProcess/Network/NetworkProcessConnection.cpp:
1784         (WebKit::NetworkProcessConnection::cookiesDeleted):
1785         (WebKit::NetworkProcessConnection::allCookiesDeleted):
1786         * WebProcess/Network/NetworkProcessConnection.h:
1787         * WebProcess/Network/NetworkProcessConnection.messages.in:
1788         * WebProcess/WebPage/WebCookieCache.cpp:
1789         (WebKit::WebCookieCache::cookiesDeleted):
1790         (WebKit::WebCookieCache::allCookiesDeleted):
1791         * WebProcess/WebPage/WebCookieCache.h:
1792         * WebProcess/WebPage/WebCookieJar.cpp:
1793         (WebKit::WebCookieJar::cookiesDeleted):
1794         (WebKit::WebCookieJar::allCookiesDeleted):
1795         * WebProcess/WebPage/WebCookieJar.h:
1796
1797 2020-03-04  Alex Christensen  <achristensen@webkit.org>
1798
1799         Add SPI to evaluate JavaScript in an iframe
1800         https://bugs.webkit.org/show_bug.cgi?id=208605
1801
1802         Reviewed by Brady Eidson.
1803
1804         * UIProcess/API/Cocoa/WKWebView.mm:
1805         (-[WKWebView evaluateJavaScript:completionHandler:]):
1806         (-[WKWebView evaluateJavaScript:inContentWorld:completionHandler:]):
1807         (-[WKWebView callAsyncJavaScript:arguments:inContentWorld:completionHandler:]):
1808         (-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]):
1809         (-[WKWebView _evaluateJavaScriptWithoutUserGesture:completionHandler:]):
1810         (-[WKWebView _callAsyncJavaScript:arguments:inFrame:inContentWorld:completionHandler:]):
1811         (-[WKWebView _evaluateJavaScript:inFrame:inContentWorld:completionHandler:]):
1812         (-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:completionHandler:inWorld:]): Deleted.
1813         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1814         * UIProcess/WebPageProxy.cpp:
1815         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
1816         (WebKit::WebPageProxy::runJavaScriptInFrameInScriptWorld):
1817         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld): Deleted.
1818         (WebKit::WebPageProxy::runJavaScriptInFrame): Deleted.
1819         * UIProcess/WebPageProxy.h:
1820         * WebProcess/WebPage/WebPage.cpp:
1821         (WebKit::WebPage::runJavaScriptInFrameInScriptWorld):
1822         (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld): Deleted.
1823         (WebKit::WebPage::runJavaScriptInFrame): Deleted.
1824         * WebProcess/WebPage/WebPage.h:
1825         * WebProcess/WebPage/WebPage.messages.in:
1826
1827 2020-03-04  Per Arne Vollan  <pvollan@apple.com>
1828
1829         Partially revert r256756, since it introduced bugs related to Accessibility.
1830         <rdar://problem/60005574>
1831
1832         Unreviewed partial revert of r256756.
1833
1834         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1835         * WebProcess/com.apple.WebProcess.sb.in:
1836
1837 2020-03-03  Jiewen Tan  <jiewen_tan@apple.com>
1838
1839         [WebAuthn] Implement -[_WKWebAuthenticationPanelDelegate panel:decidePolicyForLocalAuthenticatorWithCompletionHandler:] SPI
1840         https://bugs.webkit.org/show_bug.cgi?id=208533
1841         <rdar://problem/60010184>
1842
1843         Reviewed by Alex Christensen.
1844
1845         This patch implements the above SPI to replace -[_WKWebAuthenticationPanelDelegate panel:verifyUserWithAccessControl:completionHandler:].
1846         The original SPI is designed on the premise that Safari is going to highly customize the LocalAuthentication UI, and that is not happening
1847         anymore. Therefore, WebKit takes back the invocation of LocalAuthentication and offer a new SPI to tell clients when WebKit is about to
1848         show LocalAuthentication UI. Clients then have the trigger to pull at their pleasure.
1849
1850         This patch implements all plumbings to replace the SPI. Besides that, this patch also:
1851         1) enhances the LocalConnection::verifyUser with a slightly customized LocalAuthentication dialog;
1852         2) adds the SPI used above into the SPI header;
1853         3) makes _WKWebAuthenticationPanelDelegate.transports as a NSSet instead of a NSArray;
1854         4) lets LocalService::isAvailable return false if Apple attestation is not available.
1855
1856         * Platform/spi/Cocoa/LocalAuthenticationSPI.h:
1857         * UIProcess/API/APIWebAuthenticationPanelClient.h:
1858         (API::WebAuthenticationPanelClient::decidePolicyForLocalAuthenticator const):
1859         (API::WebAuthenticationPanelClient::verifyUser const): Deleted.
1860         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
1861         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
1862         (-[_WKWebAuthenticationPanel transports]):
1863         * UIProcess/WebAuthentication/Authenticator.h:
1864         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1865         (WebKit::AuthenticatorManager::decidePolicyForLocalAuthenticator):
1866         (WebKit::AuthenticatorManager::verifyUser): Deleted.
1867         * UIProcess/WebAuthentication/AuthenticatorManager.h:
1868         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h:
1869         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
1870         (WebKit::LocalAuthenticator::makeCredential):
1871         (WebKit::LocalAuthenticator::continueMakeCredentialAfterDecidePolicy):
1872         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification):
1873         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
1874         (WebKit::LocalAuthenticator::getAssertion):
1875         (WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected):
1876         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserVerification):
1877         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented): Deleted.
1878         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented): Deleted.
1879         * UIProcess/WebAuthentication/Cocoa/LocalConnection.h:
1880         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
1881         (WebKit::LocalConnection::verifyUser const):
1882         (WebKit::LocalConnection::isUnlocked const): Deleted.
1883         * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
1884         (WebKit::LocalService::isAvailable):
1885         * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h:
1886         * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm:
1887         (WebKit::WebAuthenticationPanelClient::WebAuthenticationPanelClient):
1888         (WebKit::localAuthenticatorPolicy):
1889         (WebKit::WebAuthenticationPanelClient::decidePolicyForLocalAuthenticator const):
1890         (WebKit::WebAuthenticationPanelClient::verifyUser const): Deleted.
1891         * UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
1892         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
1893         (WebKit::MockLocalConnection::verifyUser const):
1894         (WebKit::MockLocalConnection::isUnlocked const): Deleted.
1895         * UIProcess/WebAuthentication/WebAuthenticationFlags.h:
1896
1897 2020-03-04  Alex Christensen  <achristensen@webkit.org>
1898
1899         callAsyncJavaScript with an invalid parameter and no completionHandler should not crash
1900         https://bugs.webkit.org/show_bug.cgi?id=208593
1901
1902         Reviewed by Brady Eidson.
1903
1904         * UIProcess/API/Cocoa/WKWebView.mm:
1905         (-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:completionHandler:inWorld:]):
1906
1907 2020-03-04  Per Arne Vollan  <pvollan@apple.com>
1908
1909         [Cocoa] Add enable flag to disable direct mode for preferences
1910         https://bugs.webkit.org/show_bug.cgi?id=208588
1911
1912         Reviewed by Brent Fulgham.
1913
1914         Add an enable flag for this feature so it can be toggled, and turn it off.
1915
1916         No new tests, since this patch is reverting to previous behavior covered by existing tests.
1917
1918         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1919         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
1920         (WebKit::XPCServiceMain):
1921         * Shared/WebProcessCreationParameters.cpp:
1922         (WebKit::WebProcessCreationParameters::encode const):
1923         (WebKit::WebProcessCreationParameters::decode):
1924         * Shared/WebProcessCreationParameters.h:
1925         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1926         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
1927         (WebKit::WebProcessPool::platformInitializeWebProcess):
1928         * WebProcess/cocoa/WebProcessCocoa.mm:
1929         (WebKit::WebProcess::platformInitializeWebProcess):
1930         * WebProcess/com.apple.WebProcess.sb.in:
1931
1932 2020-03-04  Fujii Hironori  <Hironori.Fujii@sony.com>
1933
1934         Unreviewed build fix for WinCairo
1935         https://bugs.webkit.org/show_bug.cgi?id=208591
1936
1937         * Shared/FrameTreeNodeData.h: Replaced #import with #include.
1938
1939 2020-03-04  Alex Christensen  <achristensen@webkit.org>
1940
1941         WKWebView's frames accessor should return a traversable type
1942         https://bugs.webkit.org/show_bug.cgi?id=208591
1943
1944         Reviewed by Brady Eidson.
1945
1946         Rather than return an array of information that can technically be used to reconstruct a tree,
1947         let's just return the root of a tree. This introduces _WKFrameTreeNode which inherits from WKFrameInfo.
1948         Covered by API tests.
1949
1950         * Shared/API/APIObject.h:
1951         * Shared/Cocoa/APIObject.mm:
1952         (API::Object::newObject):
1953         * Shared/FrameInfoData.cpp:
1954         (WebKit::FrameInfoData::encode const):
1955         (WebKit::FrameInfoData::decode):
1956         * Shared/FrameInfoData.h:
1957         * Shared/FrameTreeNodeData.h: Added.
1958         (WebKit::FrameTreeNodeData::encode const):
1959         (WebKit::FrameTreeNodeData::decode):
1960         * Sources.txt:
1961         * SourcesCocoa.txt:
1962         * UIProcess/API/APIFrameInfo.cpp:
1963         (API::FrameInfo::parentFrameHandle const): Deleted.
1964         (API::FrameInfo::childFrameHandles const): Deleted.
1965         * UIProcess/API/APIFrameInfo.h:
1966         * UIProcess/API/APIFrameTreeNode.cpp: Added.
1967         (API::FrameTreeNode::handle const):
1968         * UIProcess/API/APIFrameTreeNode.h: Added.
1969         * UIProcess/API/Cocoa/WKFrameInfo.mm:
1970         (-[WKFrameInfo _parentFrameHandle]): Deleted.
1971         (-[WKFrameInfo _childFrameHandles]): Deleted.
1972         * UIProcess/API/Cocoa/WKFrameInfoPrivate.h:
1973         * UIProcess/API/Cocoa/WKWebView.mm:
1974         (-[WKWebView _frames:]):
1975         (-[WKWebView _allFrames:]): Deleted.
1976         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1977         * UIProcess/API/Cocoa/_WKFrameTreeNode.h: Added.
1978         * UIProcess/API/Cocoa/_WKFrameTreeNode.mm: Added.
1979         (-[_WKFrameTreeNode dealloc]):
1980         (-[_WKFrameTreeNode isMainFrame]):
1981         (-[_WKFrameTreeNode request]):
1982         (-[_WKFrameTreeNode securityOrigin]):
1983         (-[_WKFrameTreeNode webView]):
1984         (-[_WKFrameTreeNode childFrames]):
1985         (-[_WKFrameTreeNode copyWithZone:]):
1986         (-[_WKFrameTreeNode _handle]):
1987         (-[_WKFrameTreeNode _apiObject]):
1988         * UIProcess/API/Cocoa/_WKFrameTreeNodeInternal.h: Added.
1989         * UIProcess/WebPageProxy.cpp:
1990         (WebKit::WebPageProxy::getAllFrames):
1991         * UIProcess/WebPageProxy.h:
1992         * WebKit.xcodeproj/project.pbxproj:
1993         * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
1994         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1995         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1996         * WebProcess/WebPage/WebFrame.cpp:
1997         (WebKit::WebFrame::info const):
1998         (WebKit::WebFrame::childFrameIDs const): Deleted.
1999         * WebProcess/WebPage/WebFrame.h:
2000         (WebKit::WebFrame::frameID const):
2001         * WebProcess/WebPage/WebPage.cpp:
2002         (WebKit::frameTreeNodeData):
2003         (WebKit::WebPage::getAllFrames):
2004         * WebProcess/WebPage/WebPage.h:
2005         * WebProcess/WebPage/WebPage.messages.in:
2006
2007 2020-03-04  Antoine Quint  <graouts@apple.com>
2008
2009         Add an SPI to allow UserStyleSheet injection to target a specific WKWebView
2010         https://bugs.webkit.org/show_bug.cgi?id=208575
2011         <rdar://problem/59773690>
2012
2013         Reviewed by Brady Eidson.
2014
2015         Since WebCore adds a new Optional<PageIdentifier> member to UserStyleSheet, we now encode that member to be preserved
2016         across UI and Web processes.
2017
2018         Using this new member, WebUserContentController now determines that a UserStyleSheet meant to target a specific page
2019         was added in addUserStyleSheetInternal(), finds the matching WebPage, and calls injectUserStyleSheet() on its backing Page
2020         object. Conversely, WebUserContentController::removeUserStyleSheetInternal() will call into Page::removeInjectedUserStyleSheet().
2021
2022         Finally, we offer a new initializer on _WKUserStyleSheet to target a specific WKWebView, and its page's ID will be set on the
2023         backing UserStyleSheet.
2024
2025         * Shared/WebCoreArgumentCoders.cpp:
2026         (IPC::ArgumentCoder<UserStyleSheet>::encode):
2027         (IPC::ArgumentCoder<UserStyleSheet>::decode):
2028         * UIProcess/API/Cocoa/_WKUserStyleSheet.h:
2029         * UIProcess/API/Cocoa/_WKUserStyleSheet.mm:
2030         (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:userContentWorld:]):
2031         * WebProcess/UserContent/WebUserContentController.cpp:
2032         (WebKit::WebUserContentController::addUserStyleSheetInternal):
2033         (WebKit::WebUserContentController::removeUserStyleSheetInternal):
2034
2035 2020-03-04  Jer Noble  <jer.noble@apple.com>
2036
2037         [GPUP] Implement Modern EME API in the GPU Process
2038         https://bugs.webkit.org/show_bug.cgi?id=208090
2039
2040         Reviewed by Eric Carlson.
2041
2042         Add support for RemoteCDMFactory, RemateCDM, RemoteCDMInstance, RemoteCDMInstanceSession, and all
2043         of their associated Proxy objects.
2044
2045         Allow the existing CDMFactory machinery to work normally  when the GPU process is disabled,
2046         by making initialization of the CDM factories contingent upon the "use GPU" setting.
2047
2048         * DerivedSources-input.xcfilelist:
2049         * DerivedSources-output.xcfilelist:
2050         * DerivedSources.make:
2051         * GPUProcess/GPUConnectionToWebProcess.cpp:
2052         (WebKit::GPUConnectionToWebProcess::cdmFactoryProxy):
2053         (WebKit::GPUConnectionToWebProcess::didReceiveMessage):
2054         (WebKit::GPUConnectionToWebProcess::didReceiveSyncMessage):
2055         * GPUProcess/GPUConnectionToWebProcess.h:
2056         * GPUProcess/media/RemoteCDMFactoryProxy.cpp: Added.
2057         (WebKit::RemoteCDMFactoryProxy::RemoteCDMFactoryProxy):
2058         (WebKit::factoryForKeySystem):
2059         (WebKit::RemoteCDMFactoryProxy::createCDM):
2060         (WebKit::RemoteCDMFactoryProxy::supportsKeySystem):
2061         (WebKit::RemoteCDMFactoryProxy::didReceiveCDMMessage):
2062         (WebKit::RemoteCDMFactoryProxy::didReceiveCDMInstanceMessage):
2063         (WebKit::RemoteCDMFactoryProxy::didReceiveCDMInstanceSessionMessage):
2064         (WebKit::RemoteCDMFactoryProxy::didReceiveSyncCDMMessage):
2065         (WebKit::RemoteCDMFactoryProxy::didReceiveSyncCDMInstanceMessage):
2066         (WebKit::RemoteCDMFactoryProxy::didReceiveSyncCDMInstanceSessionMessage):
2067         (WebKit::RemoteCDMFactoryProxy::addProxy):
2068         (WebKit::RemoteCDMFactoryProxy::removeProxy):
2069         (WebKit::RemoteCDMFactoryProxy::addInstance):
2070         (WebKit::RemoteCDMFactoryProxy::removeInstance):
2071         (WebKit::RemoteCDMFactoryProxy::getInstance):
2072         (WebKit::RemoteCDMFactoryProxy::addSession):
2073         (WebKit::RemoteCDMFactoryProxy::removeSession):
2074         * GPUProcess/media/RemoteCDMFactoryProxy.h: Added.
2075         * GPUProcess/media/RemoteCDMFactoryProxy.messages.in: Added.
2076         * GPUProcess/media/RemoteCDMInstanceProxy.cpp: Added.
2077         (WebKit::RemoteCDMInstanceProxy::create):
2078         (WebKit::RemoteCDMInstanceProxy::RemoteCDMInstanceProxy):
2079         (WebKit::RemoteCDMInstanceProxy::initializeWithConfiguration):
2080         (WebKit::RemoteCDMInstanceProxy::setServerCertificate):
2081         (WebKit::RemoteCDMInstanceProxy::setStorageDirectory):
2082         (WebKit::RemoteCDMInstanceProxy::createSession):
2083         * GPUProcess/media/RemoteCDMInstanceProxy.h: Added.
2084         (WebKit::RemoteCDMInstanceProxy::configuration const):
2085         (WebKit::RemoteCDMInstanceProxy::instance):
2086         * GPUProcess/media/RemoteCDMInstanceProxy.messages.in: Added.
2087         * GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp: Added.
2088         (WebKit::RemoteCDMInstanceSessionProxy::create):
2089         (WebKit::RemoteCDMInstanceSessionProxy::RemoteCDMInstanceSessionProxy):
2090         (WebKit::RemoteCDMInstanceSessionProxy::~RemoteCDMInstanceSessionProxy):
2091         (WebKit::RemoteCDMInstanceSessionProxy::requestLicense):
2092         (WebKit::RemoteCDMInstanceSessionProxy::updateLicense):
2093         (WebKit::RemoteCDMInstanceSessionProxy::loadSession):
2094         (WebKit::RemoteCDMInstanceSessionProxy::closeSession):
2095         (WebKit::RemoteCDMInstanceSessionProxy::removeSessionData):
2096         (WebKit::RemoteCDMInstanceSessionProxy::storeRecordOfKeyUsage):
2097         (WebKit::RemoteCDMInstanceSessionProxy::updateKeyStatuses):
2098         (WebKit::RemoteCDMInstanceSessionProxy::sendMessage):
2099         (WebKit::RemoteCDMInstanceSessionProxy::sessionIdChanged):
2100         * GPUProcess/media/RemoteCDMInstanceSessionProxy.h: Added.
2101         * GPUProcess/media/RemoteCDMInstanceSessionProxy.messages.in: Added.
2102         * GPUProcess/media/RemoteCDMProxy.cpp: Added.
2103         (WebKit::RemoteCDMProxy::create):
2104         (WebKit::RemoteCDMProxy::RemoteCDMProxy):
2105         (WebKit::RemoteCDMProxy::supportsInitData):
2106         (WebKit::RemoteCDMProxy::sanitizeResponse):
2107         (WebKit::RemoteCDMProxy::sanitizeSessionId):
2108         (WebKit::RemoteCDMProxy::getSupportedConfiguration):
2109         (WebKit::RemoteCDMProxy::createInstance):
2110         (WebKit::RemoteCDMProxy::loadAndInitialize):
2111         * GPUProcess/media/RemoteCDMProxy.h: Added.
2112         (WebKit::RemoteCDMProxy::configuration const):
2113         (WebKit::RemoteCDMProxy::factory const):
2114         * GPUProcess/media/RemoteCDMProxy.messages.in: Added.
2115         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
2116         (WebKit::RemoteMediaPlayerProxy::mediaPlayerInitializationDataEncountered):
2117         (WebKit::RemoteMediaPlayerProxy::cdmInstanceAttached):
2118         (WebKit::RemoteMediaPlayerProxy::cdmInstanceDetached):
2119         (WebKit::RemoteMediaPlayerProxy::attemptToDecryptWithInstance):
2120         (WebKit::RemoteMediaPlayerProxy::setShouldContinueAfterKeyNeeded):
2121         * GPUProcess/media/RemoteMediaPlayerProxy.h:
2122         * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
2123         * Shared/WebCoreArgumentCoders.cpp:
2124         (IPC::ArgumentCoder<WebCore::CDMInstanceSession::Message>::encode):
2125         (IPC::ArgumentCoder<WebCore::CDMInstanceSession::Message>::decode):
2126         (IPC::ArgumentCoder<WebCore::CDMInstanceSession::KeyStatusVector>::encode):
2127         (IPC::ArgumentCoder<WebCore::CDMInstanceSession::KeyStatusVector>::decode):
2128         * Shared/WebCoreArgumentCoders.h:
2129         * Sources.txt:
2130         * WebKit.xcodeproj/project.pbxproj:
2131         * WebProcess/GPU/GPUProcessConnection.cpp:
2132         (WebKit::GPUProcessConnection::didReceiveMessage):
2133         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
2134         (WebKit::MediaPlayerPrivateRemote::cdmInstanceAttached):
2135         (WebKit::MediaPlayerPrivateRemote::cdmInstanceDetached):
2136         (WebKit::MediaPlayerPrivateRemote::attemptToDecryptWithInstance):
2137         (WebKit::MediaPlayerPrivateRemote::initializationDataEncountered):
2138         (WebKit::MediaPlayerPrivateRemote::setShouldContinueAfterKeyNeeded):
2139         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
2140         * WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in:
2141         * WebProcess/GPU/media/RemoteCDM.cpp: Added.
2142         (WebKit::RemoteCDM::create):
2143         (WebKit::RemoteCDM::RemoteCDM):
2144         (WebKit::RemoteCDM::getSupportedConfiguration):
2145         (WebKit::RemoteCDM::supportsConfiguration const):
2146         (WebKit::RemoteCDM::supportsConfigurationWithRestrictions const):
2147         (WebKit::RemoteCDM::supportsSessionTypeWithConfiguration const):
2148         (WebKit::RemoteCDM::supportsInitData const):
2149         (WebKit::RemoteCDM::distinctiveIdentifiersRequirement const):
2150         (WebKit::RemoteCDM::persistentStateRequirement const):
2151         (WebKit::RemoteCDM::distinctiveIdentifiersAreUniquePerOriginAndClearable const):
2152         (WebKit::RemoteCDM::createInstance):
2153         (WebKit::RemoteCDM::loadAndInitialize):
2154         (WebKit::RemoteCDM::sanitizeResponse const):
2155         (WebKit::RemoteCDM::sanitizeSessionId const):
2156         * WebProcess/GPU/media/RemoteCDM.h: Added.
2157         * WebProcess/GPU/media/RemoteCDMConfiguration.h: Added.
2158         (WebKit::RemoteCDMConfiguration::encode const):
2159         (WebKit::RemoteCDMConfiguration::decode):
2160         * WebProcess/GPU/media/RemoteCDMFactory.cpp: Added.
2161         (WebKit::RemoteCDMFactory::RemoteCDMFactory):
2162         (WebKit::RemoteCDMFactory::updatePreferences):
2163         (WebKit::RemoteCDMFactory::supplementName):
2164         (WebKit::RemoteCDMFactory::gpuProcessConnection):
2165         (WebKit::RemoteCDMFactory::supportsKeySystem):
2166         (WebKit::RemoteCDMFactory::createCDM):
2167         (WebKit::RemoteCDMFactory::addSession):
2168         (WebKit::RemoteCDMFactory::removeSession):
2169         (WebKit::RemoteCDMFactory::didReceiveSessionMessage):
2170         * WebProcess/GPU/media/RemoteCDMFactory.h: Added.
2171         * WebProcess/GPU/media/RemoteCDMIdentifier.h: Added.
2172         * WebProcess/GPU/media/RemoteCDMInstance.cpp: Added.
2173         (WebKit::RemoteCDMInstance::create):
2174         (WebKit::RemoteCDMInstance::RemoteCDMInstance):
2175         (WebKit::RemoteCDMInstance::initializeWithConfiguration):
2176         (WebKit::RemoteCDMInstance::setServerCertificate):
2177         (WebKit::RemoteCDMInstance::setStorageDirectory):
2178         (WebKit::RemoteCDMInstance::createSession):
2179         * WebProcess/GPU/media/RemoteCDMInstance.h: Added.
2180         * WebProcess/GPU/media/RemoteCDMInstanceConfiguration.h: Added.
2181         (WebKit::RemoteCDMInstanceConfiguration::encode const):
2182         (WebKit::RemoteCDMInstanceConfiguration::decode):
2183         * WebProcess/GPU/media/RemoteCDMInstanceIdentifier.h: Added.
2184         * WebProcess/GPU/media/RemoteCDMInstanceSession.cpp: Added.
2185         (WebKit::RemoteCDMInstanceSession::create):
2186         (WebKit::RemoteCDMInstanceSession::RemoteCDMInstanceSession):
2187         (WebKit::RemoteCDMInstanceSession::requestLicense):
2188         (WebKit::RemoteCDMInstanceSession::updateLicense):
2189         (WebKit::RemoteCDMInstanceSession::loadSession):
2190         (WebKit::RemoteCDMInstanceSession::closeSession):
2191         (WebKit::RemoteCDMInstanceSession::removeSessionData):
2192         (WebKit::RemoteCDMInstanceSession::storeRecordOfKeyUsage):
2193         (WebKit::RemoteCDMInstanceSession::updateKeyStatuses):
2194         (WebKit::RemoteCDMInstanceSession::sendMessage):
2195         (WebKit::RemoteCDMInstanceSession::sessionIdChanged):
2196         * WebProcess/GPU/media/RemoteCDMInstanceSession.h: Added.
2197         * WebProcess/GPU/media/RemoteCDMInstanceSession.messages.in: Added.
2198         * WebProcess/GPU/media/RemoteCDMInstanceSessionIdentifier.h: Added.
2199         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp:
2200         * WebProcess/WebPage/WebPage.cpp:
2201         (WebKit::WebPage::updatePreferences):
2202         * WebProcess/WebProcess.cpp:
2203
2204 2020-03-04  Sihui Liu  <sihui_liu@apple.com>
2205
2206         Assertion failed: !m_function in CompletionHandler::~CompletionHandler()
2207         https://bugs.webkit.org/show_bug.cgi?id=208457
2208
2209         Reviewed by Chris Dumez.
2210
2211         Ensure completion handler is called in WebsiteDataStore::getResourceLoadStatisticsDataSummary.
2212
2213         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2214         (WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary):
2215
2216 2020-03-04  Ben Nham  <nham@apple.com>
2217
2218         Remove initial layout throttler
2219         https://bugs.webkit.org/show_bug.cgi?id=208285
2220
2221         Reviewed by Antti Koivisto.
2222
2223         * Shared/WebPreferences.yaml:
2224         * WebProcess/WebPage/WebPage.cpp:
2225         (WebKit::WebPage::updatePreferences):
2226
2227 2020-03-04  Chris Dumez  <cdumez@apple.com>
2228
2229         Drop WebsiteDataStore::processPools()'s ensureAPoolExists optional parameter and add a ensureProcessPools() method instead
2230         https://bugs.webkit.org/show_bug.cgi?id=208546
2231
2232         Reviewed by Sam Weinig.
2233
2234         Drop WebsiteDataStore::processPools()'s ensureAPoolExists optional parameter and add a ensureProcessPools()
2235         method instead. This was error-prone and we are a lot of code creating process pools unnecessarily as a
2236         result.
2237
2238         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2239         (WebKit::WebsiteDataStore::processPoolForCookieStorageOperations):
2240         (WebKit::WebsiteDataStore::fetchDataAndApply):
2241         (WebKit::WebsiteDataStore::removeData):
2242         (WebKit::WebsiteDataStore::setMaxStatisticsEntries):
2243         (WebKit::WebsiteDataStore::setPruneEntriesDownTo):
2244         (WebKit::WebsiteDataStore::setGrandfatheringTime):
2245         (WebKit::WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval):
2246         (WebKit::WebsiteDataStore::dumpResourceLoadStatistics):
2247         (WebKit::WebsiteDataStore::isPrevalentResource):
2248         (WebKit::WebsiteDataStore::isGrandfathered):
2249         (WebKit::WebsiteDataStore::setPrevalentResource):
2250         (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode):
2251         (WebKit::WebsiteDataStore::isVeryPrevalentResource):
2252         (WebKit::WebsiteDataStore::setVeryPrevalentResource):
2253         (WebKit::WebsiteDataStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2254         (WebKit::WebsiteDataStore::setSubframeUnderTopFrameDomain):
2255         (WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder):
2256         (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameDomain):
2257         (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder):
2258         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo):
2259         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom):
2260         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo):
2261         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom):
2262         (WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo):
2263         (WebKit::WebsiteDataStore::clearPrevalentResource):
2264         (WebKit::WebsiteDataStore::resetParametersToDefaultValues):
2265         (WebKit::WebsiteDataStore::submitTelemetry):
2266         (WebKit::WebsiteDataStore::scheduleClearInMemoryAndPersistent):
2267         (WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary):
2268         (WebKit::WebsiteDataStore::scheduleCookieBlockingUpdate):
2269         (WebKit::WebsiteDataStore::scheduleStatisticsAndDataRecordsProcessing):
2270         (WebKit::WebsiteDataStore::setLastSeen):
2271         (WebKit::WebsiteDataStore::mergeStatisticForTesting):
2272         (WebKit::WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned):
2273         (WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest):
2274         (WebKit::WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured):
2275         (WebKit::WebsiteDataStore::setTimeToLiveUserInteraction):
2276         (WebKit::WebsiteDataStore::logUserInteraction):
2277         (WebKit::WebsiteDataStore::hasHadUserInteraction):
2278         (WebKit::WebsiteDataStore::isRelationshipOnlyInDatabaseOnce):
2279         (WebKit::WebsiteDataStore::clearUserInteraction):
2280         (WebKit::WebsiteDataStore::setGrandfathered):
2281         (WebKit::WebsiteDataStore::setUseITPDatabase):
2282         (WebKit::WebsiteDataStore::setCrossSiteLoadWithLinkDecorationForTesting):
2283         (WebKit::WebsiteDataStore::resetCrossSiteLoadsWithLinkDecorationForTesting):
2284         (WebKit::WebsiteDataStore::deleteCookiesForTesting):
2285         (WebKit::WebsiteDataStore::hasLocalStorageForTesting const):
2286         (WebKit::WebsiteDataStore::hasIsolatedSessionForTesting const):
2287         (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldDowngradeReferrerForTesting):
2288         (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting):
2289         (WebKit::WebsiteDataStore::setResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting):
2290         (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
2291         (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources):
2292         (WebKit::WebsiteDataStore::processPools const):
2293         (WebKit::WebsiteDataStore::ensureProcessPools const):
2294         (WebKit::WebsiteDataStore::plugins const):
2295         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
2296         (WebKit::WebsiteDataStore::setStatisticsTestingCallback):
2297         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
2298         (WebKit::WebsiteDataStore::isResourceLoadStatisticsEphemeral const):
2299         (WebKit::WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses):
2300         (WebKit::WebsiteDataStore::getLocalStorageDetails):
2301         (WebKit::WebsiteDataStore::resetQuota):
2302         (WebKit::WebsiteDataStore::hasAppBoundSession const):
2303         (WebKit::WebsiteDataStore::setInAppBrowserPrivacyEnabled):
2304         * UIProcess/WebsiteData/WebsiteDataStore.h:
2305
2306 2020-03-04  Daniel Bates  <dabates@apple.com>
2307
2308         Implement WKTextSelectionRect in terms of WebCore::SelectionRect and WKTextRange in terms of WKTextSelectionRect
2309         https://bugs.webkit.org/show_bug.cgi?id=208563
2310
2311         Reviewed by Alex Christensen.
2312
2313         It is a layering violation that WebKit2 includes a header from WebKit. Implement
2314         WKTextSelectionRect in terms of WebCore::SelectionRect as a step towards fixing this.
2315         Also avoid the WebCore::SelectionRect -> WebSelectionRect -> WKTextSelectionRect
2316         dance that WKTextRange does so that -[WKTextRange selectionRectsForRange] returns
2317         an array of WKTextSelectionRects by writing WKTextRange in terms of NSArray<WKTextSelectionRect *>*.
2318
2319         * UIProcess/ios/WKContentViewInteraction.mm:
2320         (-[WKContentView _uiTextSelectionRects]):
2321         (-[WKContentView selectedTextRange]):
2322         (-[WKContentView selectionRectsForRange:]):
2323         * UIProcess/ios/WKTextSelectionRect.h:
2324         * UIProcess/ios/WKTextSelectionRect.mm:
2325         (-[WKTextSelectionRect initWithSelectionRect:]):
2326         (-[WKTextSelectionRect rect]):
2327         (-[WKTextSelectionRect writingDirection]):
2328         (-[WKTextSelectionRect containsStart]):
2329         (-[WKTextSelectionRect containsEnd]):
2330         (-[WKTextSelectionRect isVertical]):
2331         (-[WKTextSelectionRect initWithWebRect:]): Deleted.
2332         (-[WKTextSelectionRect dealloc]): Deleted.
2333         (+[WKTextSelectionRect textSelectionRectsWithWebRects:]): Deleted.
2334
2335 2020-03-04  Daniel Bates  <dabates@apple.com>
2336
2337         Move WKTextSelectionRect into its own file
2338         https://bugs.webkit.org/show_bug.cgi?id=208561
2339
2340         Reviewed by Alex Christensen.
2341
2342         WKTextSelectionRect is currently defined in WKContentViewInteraction.mm. Separate it
2343         out into its own file to improve project organization and de-clutter WKContentViewInteraction.mm.
2344
2345         * SourcesCocoa.txt:
2346         * UIProcess/ios/WKContentViewInteraction.mm:
2347         (-[WKTextSelectionRect initWithWebRect:]): Deleted.
2348         (-[WKTextSelectionRect dealloc]): Deleted.
2349         (+[WKTextSelectionRect textSelectionRectsWithWebRects:]): Deleted.
2350         (-[WKTextSelectionRect rect]): Deleted.
2351         (-[WKTextSelectionRect writingDirection]): Deleted.
2352         (-[WKTextSelectionRect range]): Deleted.
2353         (-[WKTextSelectionRect containsStart]): Deleted.
2354         (-[WKTextSelectionRect containsEnd]): Deleted.
2355         (-[WKTextSelectionRect isVertical]): Deleted.
2356         * UIProcess/ios/WKTextSelectionRect.h: Added.
2357         * UIProcess/ios/WKTextSelectionRect.mm: Added.
2358         (-[WKTextSelectionRect initWithWebRect:]):
2359         (-[WKTextSelectionRect dealloc]):
2360         (+[WKTextSelectionRect textSelectionRectsWithWebRects:]):
2361         (-[WKTextSelectionRect rect]):
2362         (-[WKTextSelectionRect writingDirection]):
2363         (-[WKTextSelectionRect range]):
2364         (-[WKTextSelectionRect containsStart]):
2365         (-[WKTextSelectionRect containsEnd]):
2366         (-[WKTextSelectionRect isVertical]):
2367         * WebKit.xcodeproj/project.pbxproj:
2368
2369 2020-03-04  Youenn Fablet  <youenn@apple.com>
2370
2371         WebChromeClient::createImageBuffer should not create a connection to GPU Process if page does not want remote rendering
2372         https://bugs.webkit.org/show_bug.cgi?id=208567
2373         rdar://problem/60020229
2374
2375         Reviewed by Wenson Hsieh.
2376
2377         Manually tested.
2378
2379         * WebProcess/GPU/graphics/RemoteRenderingBackend.cpp:
2380         (WebKit::RemoteRenderingBackend::createImageBuffer):
2381         Minor refactoring to directly take a ShouldAccelerate instead of a RenderingMode.
2382         * WebProcess/GPU/graphics/RemoteRenderingBackend.h:
2383         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2384         (WebKit::WebChromeClient::createImageBuffer const):
2385         In case page does not want to do remote rendering, do not create a remote image buffer.
2386         Instead, return null and let the caller create a local image buffer.
2387
2388 2020-03-04  Zalan Bujtas  <zalan@apple.com>
2389
2390         [First paint] Going from visually empty to non-empty should immediately trigger layer unfreezing
2391         https://bugs.webkit.org/show_bug.cgi?id=208385
2392         <rdar://problem/59895900>
2393
2394         Reviewed by Antti Koivisto.
2395
2396         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2397         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
2398         (WebKit::WebFrameLoaderClient::dispatchDidReachVisuallyNonEmptyState):
2399         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2400         * WebProcess/WebPage/WebPage.cpp:
2401         (WebKit::WebPage::didCompletePageTransition):
2402         * WebProcess/WebPage/ios/WebPageIOS.mm:
2403         (WebKit::WebPage::resetIdempotentTextAutosizingIfNeeded): We don't have this case anymore.
2404         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2405         (WebKit::TiledCoreAnimationDrawingArea::scheduleRenderingUpdate):
2406
2407 2020-03-03  Devin Rousso  <drousso@apple.com>
2408
2409         Web Inspector: re-add `InspectorFrontendHost` support for moving the inspected window
2410         https://bugs.webkit.org/show_bug.cgi?id=208555
2411
2412         Reviewed by Timothy Hatcher.
2413
2414         Partially revert r257759, as the design changed enough such that this code is still useful.
2415
2416         Allow the Web Inspector frontend to ask the containing app (via `InspectorFrontendClient`)
2417         whether it supports the given docking configuration.
2418
2419         * WebProcess/Inspector/WebInspectorUI.h:
2420         * WebProcess/Inspector/WebInspectorUI.cpp:
2421         (WebKit::WebInspectorUI::startWindowDrag): Added.
2422         (WebKit::WebInspectorUI::moveWindowBy): Added.
2423         (WebKit::WebInspectorUI::supportsDockSide): Added.
2424         (WebKit::WebInspectorUI::requestSetDockSide):
2425         (WebKit::WebInspectorUI::setDockSide):
2426         * UIProcess/Inspector/WebInspectorProxy.messages.in:
2427         * UIProcess/Inspector/WebInspectorProxy.h:
2428         * UIProcess/Inspector/WebInspectorProxy.cpp:
2429         (WebKit::WebInspectorProxy::startWindowDrag): Added.
2430         (WebKit::WebInspectorProxy::platformStartWindowDrag): Added.
2431         * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp:
2432         (WebKit::WebInspectorProxy::platformStartWindowDrag): Added.
2433         * UIProcess/Inspector/mac/WebInspectorProxyMac.mm:
2434         (WebKit::WebInspectorProxy::platformStartWindowDrag): Added.
2435         * UIProcess/Inspector/win/WebInspectorProxyWin.cpp:
2436         (WebKit::WebInspectorProxy::platformStartWindowDrag): Added.
2437
2438         * WebProcess/Inspector/RemoteWebInspectorUI.h:
2439         * WebProcess/Inspector/RemoteWebInspectorUI.cpp:
2440         (WebKit::RemoteWebInspectorUI::startWindowDrag): Added.
2441         (WebKit::RemoteWebInspectorUI::moveWindowBy): Added.
2442         (WebKit::RemoteWebInspectorUI::supportsDockSide): Added.
2443         * UIProcess/Inspector/RemoteWebInspectorProxy.messages.in:
2444         * UIProcess/Inspector/RemoteWebInspectorProxy.h:
2445         * UIProcess/Inspector/RemoteWebInspectorProxy.cpp:
2446         (WebKit::RemoteWebInspectorProxy::startWindowDrag): Added.
2447         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag): Added.
2448         * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp:
2449         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag): Added.
2450         * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm:
2451         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag): Added.
2452         * UIProcess/Inspector/win/RemoteWebInspectorProxyWin.cpp:
2453         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag): Added.
2454
2455 2020-03-03  Alex Christensen  <achristensen@webkit.org>
2456
2457         Add SPI _WKResourceLoadInfo.loadedFromCache
2458         https://bugs.webkit.org/show_bug.cgi?id=208554
2459
2460         Reviewed by Wenson Hsieh.
2461
2462         This exposes a boolean value indicating whether the resource was loaded from a cache based on the response source.
2463         This is needed for rdar://problem/57132290
2464
2465         * NetworkProcess/NetworkResourceLoader.cpp:
2466         (WebKit::NetworkResourceLoader::resourceLoadInfo):
2467         * Shared/ResourceLoadInfo.h:
2468         (WebKit::ResourceLoadInfo::encode const):
2469         (WebKit::ResourceLoadInfo::decode):
2470         * UIProcess/API/APIResourceLoadInfo.h:
2471         * UIProcess/API/Cocoa/_WKResourceLoadInfo.h:
2472         * UIProcess/API/Cocoa/_WKResourceLoadInfo.mm:
2473         (-[_WKResourceLoadInfo loadedFromCache]):
2474         (-[_WKResourceLoadInfo initWithCoder:]):
2475         (-[_WKResourceLoadInfo encodeWithCoder:]):
2476
2477 2020-03-03  Ryosuke Niwa  <rniwa@webkit.org>
2478
2479         Batch observations and completions of text manipulations
2480         https://bugs.webkit.org/show_bug.cgi?id=208406
2481
2482         Reviewed by Wenson Hsieh.
2483
2484         Update WKWebView's SPI for text manipulations to batch observations and replacements of multiple paragraphs
2485         at once instead of observing and replacing one paragraph at a time.
2486
2487         _WKTextManipulationDelegate now has a new callback, didFindTextManipulationItems, which gets an array of
2488         _WKTextManipulationItem instead of a single _WKTextManipulationItem like didFindTextManipulationItem,
2489         and WKWebView's _completeTextManipulationForItems replaces multiple paragraphs at once, and gives an array
2490         of NSError for each _WKTextManipulationItem that failed to replace the respective content.
2491
2492         Tests: TestWebKitAPI.TextManipulation.StartTextManipulationSupportsLegacyDelegateCallback: Added.
2493                TestWebKitAPI.TextManipulation.LegacyCompleteTextManipulationReplaceSimpleSingleParagraph: Added.
2494                TestWebKitAPI.TextManipulation.CompleteTextManipulationReplaceMultipleSimpleParagraphsAtOnce: Added.
2495                TestWebKitAPI.TextManipulation.CompleteTextManipulationShouldBatchItemCallback: Added.
2496                TestWebKitAPI.TextManipulation.CompleteTextManipulationFailWhenItemIdentifierIsDuplicated: Added.
2497                TestWebKitAPI.TextManipulation.CompleteTextManipulationCanHandleSubsetOfItemsToFail: Added.
2498
2499         * UIProcess/API/Cocoa/WKWebView.mm:
2500         (-[WKWebView _startTextManipulationsWithConfiguration:completion:]):
2501         (coreTextManipulationItemIdentifierFromString): Added.
2502         (coreTextManipulationTokenIdentifierFromString): Added.
2503         (-[WKWebView _completeTextManipulation:completion:]): Updated to work with the new TextManipulationController
2504         interface.
2505         (makeFailureSetForAllTextManipulationItems): Added.
2506         (wkTextManipulationErrors): Added.
2507         (-[WKWebView _completeTextManipulationForItems:completion:]): Added. This is the new SPI.
2508         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2509         * UIProcess/API/Cocoa/_WKTextManipulationDelegate.h:
2510         * UIProcess/API/Cocoa/_WKTextManipulationItem.h:
2511         (_WKTextManipulationItemErrorDomain): Added.
2512         (_WKTextManipulationItemErrorCode): Added.
2513         (_WKTextManipulationItemErrorItemKey): Added.
2514         * UIProcess/API/Cocoa/_WKTextManipulationItem.mm:
2515         * UIProcess/WebPageProxy.cpp:
2516         * UIProcess/WebPageProxy.h:
2517         * UIProcess/WebPageProxy.messages.in:
2518         * WebProcess/WebPage/WebPage.cpp:
2519         (WebKit::WebPage::startTextManipulations):
2520         (WebKit::WebPage::completeTextManipulation): Updated per TextManipulationController interface change.
2521         To avoid having to duplicate the code to create a vector of ManipulationFailure, this function's completion
2522         handler has a boolean indicating that all replacements had failed.
2523         * WebProcess/WebPage/WebPage.h:
2524         * WebProcess/WebPage/WebPage.messages.in:
2525
2526 2020-03-03  Per Arne Vollan  <pvollan@apple.com>
2527
2528         [Cocoa] Mapping from MIME type to UTI type should be done in the UI process
2529         https://bugs.webkit.org/show_bug.cgi?id=208415
2530
2531         Reviewed by Brent Fulgham.
2532
2533         Send the mapping between MIME types and UTI types to the WebContent process as part of the Web
2534         process creation parameters.
2535
2536         * Shared/WebProcessCreationParameters.cpp:
2537         (WebKit::WebProcessCreationParameters::encode const):
2538         (WebKit::WebProcessCreationParameters::decode):
2539         * Shared/WebProcessCreationParameters.h:
2540         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2541         (WebKit::WebProcessPool::platformInitializeWebProcess):
2542         * WebProcess/cocoa/WebProcessCocoa.mm:
2543         (WebKit::WebProcess::platformInitializeWebProcess):
2544
2545 2020-03-03  James Savage  <james.savage@apple.com>
2546
2547         Refine Swift API for WKWebView JavaScript methods
2548         https://bugs.webkit.org/show_bug.cgi?id=208483
2549
2550         Reviewed by Sam Weinig.
2551         
2552         Refine these interfaces for Swift and to align with our desired API.
2553
2554         * UIProcess/API/Cocoa/WKContentWorld.h: This doesn't need to be refined
2555         for Swift, we can just rename it here.
2556         * UIProcess/API/Cocoa/WKWebView.h: This does need refinement.
2557
2558 2020-03-03  Alex Christensen  <achristensen@webkit.org>
2559
2560         Add response to _WKResourceLoadDelegate didCompleteWithError callback
2561         https://bugs.webkit.org/show_bug.cgi?id=208553
2562
2563         Reviewed by Simon Fraser.
2564
2565         New functionality verified by API test.
2566
2567         * NetworkProcess/NetworkResourceLoader.cpp:
2568         (WebKit::NetworkResourceLoader::didFinishLoading):
2569         (WebKit::NetworkResourceLoader::didFailLoading):
2570         * UIProcess/API/APIResourceLoadClient.h:
2571         * UIProcess/API/Cocoa/_WKResourceLoadDelegate.h:
2572         * UIProcess/Cocoa/ResourceLoadDelegate.h:
2573         * UIProcess/Cocoa/ResourceLoadDelegate.mm:
2574         (WebKit::ResourceLoadDelegate::setDelegate):
2575         (WebKit::ResourceLoadDelegate::ResourceLoadClient::didCompleteWithError const):
2576         * UIProcess/Network/NetworkProcessProxy.cpp:
2577         (WebKit::NetworkProcessProxy::resourceLoadDidCompleteWithError):
2578         * UIProcess/Network/NetworkProcessProxy.h:
2579         * UIProcess/Network/NetworkProcessProxy.messages.in:
2580         * UIProcess/WebPageProxy.cpp:
2581         * UIProcess/WebPageProxy.h:
2582
2583 2020-03-03  Alex Christensen  <achristensen@webkit.org>
2584
2585         Requests sent to _WKResourceLoadDelegate should include HTTPBody
2586         https://bugs.webkit.org/show_bug.cgi?id=208550
2587
2588         Reviewed by Tim Hatcher.
2589
2590         * NetworkProcess/NetworkResourceLoader.cpp:
2591         (WebKit::NetworkResourceLoader::startNetworkLoad):
2592         * UIProcess/Cocoa/ResourceLoadDelegate.mm:
2593         (WebKit::ResourceLoadDelegate::ResourceLoadClient::didSendRequest const):
2594         * UIProcess/Network/NetworkProcessProxy.cpp:
2595         (WebKit::NetworkProcessProxy::resourceLoadDidSendRequest):
2596         * UIProcess/Network/NetworkProcessProxy.h:
2597         * UIProcess/Network/NetworkProcessProxy.messages.in:
2598
2599 2020-03-03  Ross Kirsling  <ross.kirsling@sony.com>
2600
2601         Unreviewed. Fix WinCairo build following r257801.
2602
2603         * UIProcess/Inspector/win/RemoteWebInspectorProxyWin.cpp:
2604         (WebKit::RemoteWebInspectorProxy::platformSetForcedAppearance):
2605         * UIProcess/Inspector/win/WebInspectorProxyWin.cpp:
2606         (WebKit::WebInspectorProxy::platformSetForcedAppearance):
2607
2608 2020-03-03  Alex Christensen  <achristensen@webkit.org>
2609
2610         Expose originalURL and originalHTTPMethod on _WKResourceLoadInfo
2611         https://bugs.webkit.org/show_bug.cgi?id=208522
2612
2613         Reviewed by Brian Weinstein.
2614
2615         Covered by API tests.
2616
2617         * NetworkProcess/NetworkResourceLoader.cpp:
2618         (WebKit::NetworkResourceLoader::resourceLoadInfo):
2619         * Shared/ResourceLoadInfo.h:
2620         (WebKit::ResourceLoadInfo::encode const):
2621         (WebKit::ResourceLoadInfo::decode):
2622         * UIProcess/API/APIResourceLoadInfo.h:
2623         * UIProcess/API/Cocoa/_WKResourceLoadInfo.h:
2624         * UIProcess/API/Cocoa/_WKResourceLoadInfo.mm:
2625         (-[_WKResourceLoadInfo originalURL]):
2626         (-[_WKResourceLoadInfo initWithCoder:]):
2627         (-[_WKResourceLoadInfo encodeWithCoder:]):
2628
2629 2020-03-03  Devin Rousso  <drousso@apple.com>
2630
2631         Web Inspector: setting the frontend appearance doesn't update the window when undocked
2632         https://bugs.webkit.org/show_bug.cgi?id=208503
2633
2634         Reviewed by Timothy Hatcher.
2635
2636         Notify the UIProcess when setting the forced appearance so platforms that support dark mode
2637         are able to run native code to adjust the appearance of the undocked window.
2638
2639         * WebProcess/Inspector/WebInspectorUI.h:
2640         * WebProcess/Inspector/WebInspectorUI.cpp:
2641         (WebKit::WebInspectorUI::setForcedAppearance): Added.
2642         * UIProcess/Inspector/WebInspectorProxy.messages.in:
2643         * UIProcess/Inspector/WebInspectorProxy.h:
2644         * UIProcess/Inspector/WebInspectorProxy.cpp:
2645         (WebKit::WebInspectorProxy::setForcedAppearance): Added.
2646         (WebKit::WebInspectorProxy::platformSetForcedAppearance): Added.
2647         * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp:
2648         (WebKit::WebInspectorProxy::platformSetForcedAppearance): Added.
2649         * UIProcess/Inspector/mac/WebInspectorProxyMac.mm:
2650         (WebKit::WebInspectorProxy::platformCreateFrontendWindow): Added.
2651         (WebKit::WebInspectorProxy::platformSetForcedAppearance): Added.
2652         (WebKit::WebInspectorProxy::applyForcedAppearance): Added.
2653         * UIProcess/Inspector/win/WebInspectorProxyWin.cpp:
2654         (WebKit::WebInspectorProxy::platformSetForcedAppearance): Added.
2655
2656         * WebProcess/Inspector/RemoteWebInspectorUI.h:
2657         * WebProcess/Inspector/RemoteWebInspectorUI.cpp:
2658         (WebKit::RemoteWebInspectorUI::setForcedAppearance): Added.
2659         * UIProcess/Inspector/RemoteWebInspectorProxy.messages.in:
2660         * UIProcess/Inspector/RemoteWebInspectorProxy.h:
2661         * UIProcess/Inspector/RemoteWebInspectorProxy.cpp:
2662         (WebKit::RemoteWebInspectorProxy::setForcedAppearance): Added.
2663         (WebKit::RemoteWebInspectorProxy::platformSetForcedAppearance): Added.
2664         * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp:
2665         (WebKit::RemoteWebInspectorProxy::platformSetForcedAppearance): Added.
2666         * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm:
2667         (WebKit::RemoteWebInspectorProxy::platformSetForcedAppearance): Added.
2668         * UIProcess/Inspector/win/RemoteWebInspectorProxyWin.cpp:
2669         (WebKit::RemoteWebInspectorProxy::platformSetForcedAppearance): Added.
2670
2671 2020-03-03  Per Arne Vollan  <pvollan@apple.com>
2672
2673         [iOS] Add entitlement for message filtering
2674         https://bugs.webkit.org/show_bug.cgi?id=208526
2675         <rdar://problem/58885485>
2676
2677         Reviewed by Brent Fulgham.
2678
2679         On iOS, an entitlement is needed to enable message filtering.
2680
2681         * Scripts/process-entitlements.sh:
2682
2683 2020-03-03  Jiten Mehta  <jmehta@apple.com>
2684
2685         Adopt HTTP Alternative Services Storage
2686         https://bugs.webkit.org/show_bug.cgi?id=208387
2687
2688         Reviewed by Alex Christensen.
2689
2690         Covered by a new API test which verifies that data is written to the correct directory.
2691
2692         * NetworkProcess/NetworkProcess.cpp:
2693         (WebKit::NetworkProcess::fetchWebsiteData):
2694         (WebKit::NetworkProcess::deleteWebsiteData):
2695         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2696         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
2697         * NetworkProcess/NetworkProcess.h:
2698         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2699         (WebKit::NetworkProcess::getHostNamesWithAlternativeServices):
2700         (WebKit::NetworkProcess::deleteAlternativeServicesForHostNames):
2701         (WebKit::NetworkProcess::clearAlternativeServices):
2702         * Shared/WebsiteData/WebsiteData.cpp:
2703         (WebKit::WebsiteData::ownerProcess):
2704         * Shared/WebsiteData/WebsiteDataType.h:
2705         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
2706         (dataTypesToString):
2707         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
2708         (WebKit::toWebsiteDataType):
2709         (WebKit::toWKWebsiteDataTypes):
2710         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
2711         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2712         (+[WKWebsiteDataStore _allWebsiteDataTypesIncludingPrivate]):
2713         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
2714         (WebKit::WebsiteDataRecord::addAlternativeServicesHostname):
2715         * UIProcess/WebsiteData/WebsiteDataRecord.h:
2716
2717 2020-03-03  Kate Cheney  <katherine_cheney@apple.com>
2718
2719         Check for navigation to app-bound domain during script evaluation
2720         https://bugs.webkit.org/show_bug.cgi?id=208319
2721         <rdar://problem/57569321>
2722
2723         Reviewed by Brent Fulgham.
2724
2725         Much of this patch is passing around a new parameter,
2726         m_hasNavigatedAwayFromAppBoundDomain, to the Web Content Process to
2727         indicate conditions for script evaluation. 
2728
2729         * Shared/LoadParameters.cpp:
2730         (WebKit::LoadParameters::encode const):
2731         (WebKit::LoadParameters::decode):
2732         * Shared/LoadParameters.h:
2733         * Shared/PolicyDecision.h:
2734         (WebKit::PolicyDecision::encode const):
2735         (WebKit::PolicyDecision::decode):
2736         * UIProcess/API/Cocoa/WKPreferences.mm:
2737         (-[WKPreferences _inAppBrowserPrivacyEnabled]):
2738         (-[WKPreferences _setInAppBrowserPrivacyEnabled:]):
2739         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2740         * UIProcess/API/Cocoa/WKWebView.mm:
2741         (-[WKWebView _setIsNavigatingToAppBoundDomain:completionHandler:]):
2742         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2743         * UIProcess/ProvisionalPageProxy.cpp:
2744         (WebKit::ProvisionalPageProxy::loadData):
2745         (WebKit::ProvisionalPageProxy::loadRequest):
2746         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync):
2747         * UIProcess/ProvisionalPageProxy.h:
2748         * UIProcess/WebPageProxy.cpp:
2749         (WebKit::WebPageProxy::loadRequest):
2750         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
2751         (WebKit::WebPageProxy::loadData):
2752         (WebKit::WebPageProxy::loadDataWithNavigationShared):
2753         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
2754         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainTesting):
2755         (WebKit::WebPageProxy::receivedPolicyDecision):
2756         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2757         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2758         (WebKit::WebPageProxy::decidePolicyForNavigationActionSyncShared):
2759         * UIProcess/WebPageProxy.h:
2760         (WebKit::WebPageProxy::hasNavigatedAwayFromAppBoundDomain const):
2761         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2762         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2763         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2764         (WebKit::WebFrameLoaderClient::hasNavigatedAwayFromAppBoundDomain):
2765         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2766         * WebProcess/WebPage/WebPage.cpp:
2767         (WebKit::WebPage::loadRequest):
2768         (WebKit::WebPage::loadDataImpl):
2769         (WebKit::WebPage::loadData):
2770         (WebKit::WebPage::loadAlternateHTML):
2771         (WebKit::WebPage::didReceivePolicyDecision):
2772         (WebKit::WebPage::runJavaScript):
2773         (WebKit::WebPage::setIsNavigatingToAppBoundDomainTesting):
2774         A new call to manually set isNavigatingToAppBoundDomain to mimic
2775         test cases in which a webView switches between app-bound and
2776         non-app-bound domains.
2777
2778         (WebKit::WebPage::setIsNavigatingToAppBoundDomain): Deleted.
2779         Moved to header file because its setting a private variable.
2780
2781         * WebProcess/WebPage/WebPage.h:
2782         (WebKit::WebPage::setIsNavigatingToAppBoundDomain):
2783         (WebKit::WebPage::hasNavigatedAwayFromAppBoundDomain const):
2784         (WebKit::WebPage::setHasNavigatedAwayFromAppBoundDomain):
2785         * WebProcess/WebPage/WebPage.messages.in:
2786
2787 2020-03-03  youenn fablet  <youenn@apple.com>
2788
2789         Rename USE(GPU_PROCESS) to ENABLE(GPU_PROCESS_FOR_WEBRTC)
2790         https://bugs.webkit.org/show_bug.cgi?id=208505
2791
2792         Reviewed by Eric Carlson.
2793
2794         * Shared/WebPreferencesDefaultValues.h:
2795
2796 2020-03-03  Commit Queue  <commit-queue@webkit.org>
2797
2798         Unreviewed, rolling out r257754.
2799         https://bugs.webkit.org/show_bug.cgi?id=208513
2800
2801         Introduced API test failure (Requested by perarne on #webkit).
2802
2803         Reverted changeset:
2804
2805         "[Cocoa] Mapping from MIME type to UTI type should be done in
2806         the UI process"
2807         https://bugs.webkit.org/show_bug.cgi?id=208415
2808         https://trac.webkit.org/changeset/257754
2809
2810 2020-03-02  Rob Buis  <rbuis@igalia.com>
2811
2812         https://bugs.webkit.org/show_bug.cgi?id=208447
2813         Make FrameLoadRequest ctor take move parameter
2814
2815         Reviewed by Simon Fraser.
2816
2817         Adapt to API change.
2818
2819         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2820         (WebKit::WebFrameLoaderClient::dispatchCreatePage):
2821
2822 2020-03-02  Ben Nham  <nham@apple.com>
2823
2824         [WTF] Add signpost API
2825         https://bugs.webkit.org/show_bug.cgi?id=208395
2826
2827         Reviewed by Alex Christensen.
2828
2829         We want to start using os_signpost instead of kdebug_trace when emitting performance events,
2830         because it is usually cheaper (doesn't require a system call unless the log buffer is full)
2831         and allows for richer tracepoints (allows for logging strings as well as integers).
2832
2833         To facilitate this, this moves the os_signpost wrappers in NetworkDataTaskCocoa to
2834         WTF. Since signposts can contain sensitive strings (like URLs), currently we only enable
2835         them on Apple-internal devices when an environment variable is set.
2836
2837         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2838         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2839         (WebKit::NetworkDataTaskCocoa::didSendData):
2840         (WebKit::NetworkDataTaskCocoa::didReceiveChallenge):
2841         (WebKit::NetworkDataTaskCocoa::didCompleteWithError):
2842         (WebKit::NetworkDataTaskCocoa::didReceiveData):
2843         (WebKit::NetworkDataTaskCocoa::didReceiveResponse):
2844         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2845         (WebKit::NetworkDataTaskCocoa::cancel):
2846         (WebKit::NetworkDataTaskCocoa::resume):
2847         (signpostLogHandle): Deleted.
2848         (signpostsEnabled): Deleted.
2849
2850 2020-03-02  Devin Rousso  <drousso@apple.com>
2851
2852         Web Inspector: Items in the toolbar take up to much vertical space
2853         https://bugs.webkit.org/show_bug.cgi?id=204627
2854         <rdar://problem/59091905>
2855
2856         Reviewed by Timothy Hatcher.
2857
2858         Now that there is no toolbar area, there is nothing obstructing the ability for the window
2859         to be moved around when dragging via the title bar area. As such, we can remove the unused
2860         `InspectorFrontendHost` APIs.
2861
2862         * WebProcess/Inspector/WebInspectorUI.h:
2863         * WebProcess/Inspector/WebInspectorUI.cpp:
2864         (WebKit::WebInspectorUI::startWindowDrag): Deleted.
2865         (WebKit::WebInspectorUI::moveWindowBy): Deleted.
2866         * UIProcess/Inspector/WebInspectorProxy.messages.in:
2867         * UIProcess/Inspector/WebInspectorProxy.h:
2868         * UIProcess/Inspector/WebInspectorProxy.cpp:
2869         (WebKit::WebInspectorProxy::startWindowDrag): Deleted.
2870         (WebKit::WebInspectorProxy::platformStartWindowDrag): Deleted.
2871         * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp:
2872         (WebKit::WebInspectorProxy::platformStartWindowDrag): Deleted.
2873         * UIProcess/Inspector/mac/WebInspectorProxyMac.mm:
2874         (WebKit::WebInspectorProxy::platformStartWindowDrag): Deleted.
2875         * UIProcess/Inspector/win/WebInspectorProxyWin.cpp:
2876         (WebKit::WebInspectorProxy::platformStartWindowDrag): Deleted.
2877         * UIProcess/Inspector/wpe/WebInspectorProxyWPE.cpp:
2878         (WebKit::WebInspectorProxy::platformStartWindowDrag): Deleted.
2879
2880         * WebProcess/Inspector/RemoteWebInspectorUI.h:
2881         * WebProcess/Inspector/RemoteWebInspectorUI.cpp:
2882         (WebKit::RemoteWebInspectorUI::startWindowDrag): Deleted.
2883         (WebKit::RemoteWebInspectorUI::moveWindowBy): Deleted.
2884         * UIProcess/Inspector/RemoteWebInspectorProxy.messages.in:
2885         * UIProcess/Inspector/RemoteWebInspectorProxy.cpp:
2886         * UIProcess/Inspector/RemoteWebInspectorProxy.h:
2887         (WebKit::RemoteWebInspectorProxy::startWindowDrag): Deleted.
2888         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag): Deleted.
2889         * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp:
2890         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag): Deleted.
2891         * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm:
2892         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag): Deleted.
2893         * UIProcess/Inspector/win/RemoteWebInspectorProxyWin.cpp:
2894         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag): Deleted.
2895
2896 2020-03-02  Brent Fulgham  <bfulgham@apple.com>
2897
2898         Add flag to indicate that ITP state was explicitly set
2899         https://bugs.webkit.org/show_bug.cgi?id=208461
2900         <rdar://problem/59960829>
2901
2902         Reviewed by John Wilander.
2903
2904         Now that ITP is supported in Ephemeral sessions, we would like to move to a process-wide
2905         concept of ITP being on or off, rather than controlling this at a website data level.
2906         This patch takes the first step by adding a flag to the WebKit::NetworkSessionCreationParameters
2907         structure that tracks whether the state of ITP (On or Off) was explicitly set by
2908         SPI (primarily during testing).
2909
2910         This patch also ensures that we can communicate with TCC for the purpose of checking if
2911         ITP is on or off.
2912
2913         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2914         (WebKit::NetworkSessionCreationParameters::encode const):
2915         (WebKit::NetworkSessionCreationParameters::decode):
2916         * NetworkProcess/NetworkSessionCreationParameters.h:
2917         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2918         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2919         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2920         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2921         * Scripts/process-entitlements.sh:
2922         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2923         (WKWebsiteDataStoreSetResourceLoadStatisticsEnabled):
2924         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2925         (-[WKWebsiteDataStore _setResourceLoadStatisticsEnabled:]):
2926         * UIProcess/Cocoa/VersionChecks.h:
2927         * UIProcess/WebProcessPool.cpp:
2928         (WebKit::WebProcessPool::WebProcessPool):
2929         (WebKit::WebProcessPool::ensureNetworkProcess):
2930         (WebKit::WebProcessPool::createNewWebProcess):
2931         * UIProcess/WebProcessPool.h:
2932         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2933         (WebKit::WebsiteDataStore::parameters):
2934         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2935         (WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest):
2936         * UIProcess/WebsiteData/WebsiteDataStore.h:
2937         (WebKit::WebsiteDataStore::itpStateWasExplicitlySet const):
2938         (WebKit::WebsiteDataStore::useExplicitITPState):
2939
2940 2020-03-02  Alan Coon  <alancoon@apple.com>
2941
2942         Add new Mac target numbers
2943         https://bugs.webkit.org/show_bug.cgi?id=208398
2944
2945         Reviewed by Alexey Proskuryakov.
2946
2947         * Configurations/Base.xcconfig:
2948         * Configurations/DebugRelease.xcconfig:
2949         * Configurations/Version.xcconfig:
2950         * Configurations/WebKitTargetConditionals.xcconfig:
2951
2952 2020-03-02  Per Arne Vollan  <pvollan@apple.com>
2953
2954         [Cocoa] Mapping from MIME type to UTI type should be done in the UI process
2955         https://bugs.webkit.org/show_bug.cgi?id=208415
2956
2957         Reviewed by Brent Fulgham.
2958
2959         Send the mapping between MIME types and UTI types to the WebContent process as part of the Web
2960         process creation parameters.
2961
2962         * Shared/WebProcessCreationParameters.cpp:
2963         (WebKit::WebProcessCreationParameters::encode const):
2964         (WebKit::WebProcessCreationParameters::decode):
2965         * Shared/WebProcessCreationParameters.h:
2966         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2967         (WebKit::WebProcessPool::platformInitializeWebProcess):
2968         * WebProcess/cocoa/WebProcessCocoa.mm:
2969         (WebKit::WebProcess::platformInitializeWebProcess):
2970
2971 2020-03-02  Per Arne Vollan  <pvollan@apple.com>
2972
2973         Unreviewed sandbox compile fix.
2974
2975         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2976
2977 2020-03-02  Daniel Bates  <dabates@apple.com>
2978
2979         Annotate editable elements with hit test order
2980         https://bugs.webkit.org/show_bug.cgi?id=208463
2981         <rdar://problem/59962843>
2982
2983         Reviewed by Wenson Hsieh.
2984
2985         Until <rdar://problem/59737118> is fixed, annotate editable elements with their hit test
2986         order towards fixing <rdar://problem/59602885>. Only element contexts created as a result
2987         of calling WebPage::textInputContextsInRect() have a meaningful hit test order.
2988
2989         Note that the hit test order of an element can only be meaningfully compared to the hit test
2990         order of other elements returned in the same invocation of WebPage::textInputContextsInRect().
2991         That is, the hit test order is not render tree-unique. So, the same element returned by two
2992         different invocations of WebPage::textInputContextsInRect() cannot be compared to any other
2993         element outside of the list it was returned in even if its order is the same in both lists.
2994
2995         * UIProcess/API/Cocoa/_WKTextInputContext.mm:
2996         (-[_WKTextInputContext _hitTestOrder]): Added. If the context does not have a hit test order
2997         (e.g. returned form WebPage::contextForElement()) then I chose to return 0 – treat it as the
2998         frontmost element.
2999         * UIProcess/API/Cocoa/_WKTextInputContextInternal.h:
3000         * WebProcess/WebPage/WebPage.cpp:
3001         (WebKit::WebPage::textInputContextsInRect): Assign each element's hit test order. Following
3002         r257722 the elements are already ordered by hit test order (frontmost to backmost). So, we can
3003         simply assign monotonically increasing numbers.
3004         (WebKit::WebPage::contextForElement const): Pass WTF::nullopt for the hit test order as I do
3005         not have a need to support hit test order for individual elements.
3006
3007 2020-03-02  Said Abou-Hallawa  <sabouhallawa@apple.com>
3008
3009         Implement canvas remote rendering
3010         https://bugs.webkit.org/show_bug.cgi?id=204955
3011
3012         Reviewed by Jon Lee.
3013
3014         * WebProcess/GPU/graphics/RemoteImageBuffer.h:
3015         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp:
3016         (WebKit::RemoteImageBufferMessageHandler::waitForCreateImageBufferBackend):
3017         (WebKit::RemoteImageBufferMessageHandler::waitForCommitImageBufferFlushContext):
3018         Synchronize the RemoteImageBuffer backend such that the context and the
3019         DrawingContext are flushed to the backend in the GPUProcess only when
3020         its pixels are needed in the WebProcess.
3021
3022         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h:
3023         (WebKit::RemoteImageBufferMessageHandler::isPendingFlush const):
3024         Tells whether the pixels of the backend is ready to use or a flushing is
3025         being committed.
3026
3027         * WebProcess/GPU/graphics/RemoteRenderingBackend.cpp:
3028         (WebKit::RemoteRenderingBackend::waitForCreateImageBufferBackend):
3029         (WebKit::RemoteRenderingBackend::waitForCommitImageBufferFlushContext):
3030         * WebProcess/GPU/graphics/RemoteRenderingBackend.h:
3031         They block execution till certain RemoteRenderingBackendProxy messages
3032         are received.
3033
3034 2020-03-02  Jacob Uphoff  <jacob_uphoff@apple.com>
3035
3036         Unreviewed, rolling out r257725.
3037
3038         This commit caused 10 API tests to fail
3039
3040         Reverted changeset:
3041
3042         "[Cocoa] Mapping from MIME type to UTI type should be done in
3043         the UI process"
3044         https://bugs.webkit.org/show_bug.cgi?id=208415
3045         https://trac.webkit.org/changeset/257725
3046
3047 2020-03-02  Megan Gardner  <megan_gardner@apple.com>
3048
3049         Add date/time style to macCatalyst
3050         https://bugs.webkit.org/show_bug.cgi?id=208456
3051
3052         Reviewed by Wenson Hsieh.
3053
3054         Add style flag for date/time pickers on macCatalyst.
3055
3056         * Platform/spi/ios/UIKitSPI.h:
3057         * UIProcess/ios/forms/WKFormInputControl.mm:
3058         (-[WKDateTimePicker datePickerStyle]):
3059         (-[WKDateTimePicker initWithView:datePickerMode:]):
3060
3061 2020-03-02  Said Abou-Hallawa  <sabouhallawa@apple.com>
3062
3063         Implement the remote ImageBuffer
3064         https://bugs.webkit.org/show_bug.cgi?id=207221
3065
3066         Reviewed by Jon Lee.
3067
3068         RemoteImageBuffer and RemoteImageBufferProxy represent a single remote
3069         ImageBuffer. The back end should be created by RemoteImageBufferProxy in
3070         GPUProcess and shared with the RemoteImageBuffer in the WebProcess.
3071         Flushing the DrawingContext will be done in GPUProcess. But creating the
3072         native image out of the back end will be in GPUProcess.
3073
3074         RemoteRenderingBackend and RemoteRenderingBackendProxy are central points
3075         for receiving and sending all the messages of the RemoteImageBuffer and
3076         RemoteImageBufferProxy.
3077
3078         * GPUProcess/graphics/PlatformRemoteImageBufferProxy.h: Added.
3079         Defines the platform types of RemoteImageBufferProxy.
3080
3081         * GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.cpp: Added.
3082         (WebKit::RemoteImageBufferMessageHandlerProxy::RemoteImageBufferMessageHandlerProxy):
3083         (WebKit::RemoteImageBufferMessageHandlerProxy::createBackend):
3084         (WebKit::RemoteImageBufferMessageHandlerProxy::commitFlushContext):
3085         * GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h: Added.
3086         Manages sending and receiving the messages of RemoteImageBufferProxy
3087
3088         * GPUProcess/graphics/RemoteImageBufferProxy.h: Added.
3089         (WebKit::RemoteImageBufferProxy::create):
3090         (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy):
3091         It is responsible for creating a shared back end and replaying back drawing
3092         commands.
3093
3094         * GPUProcess/graphics/RemoteRenderingBackendProxy.cpp:
3095         (WebKit::RemoteRenderingBackendProxy::createImageBuffer):
3096         (WebKit::RemoteRenderingBackendProxy::releaseImageBuffer):
3097         (WebKit::RemoteRenderingBackendProxy::flushImageBufferDrawingContext):
3098         * GPUProcess/graphics/RemoteRenderingBackendProxy.h:
3099         (WebKit::RemoteRenderingBackendProxy::renderingBackendIdentifier const):
3100         * GPUProcess/graphics/RemoteRenderingBackendProxy.messages.in:
3101         Handle or dispatch messages received from RemoteRenderingBackend.
3102
3103         * Scripts/webkit/messages.py:
3104         * Sources.txt:
3105         * WebKit.xcodeproj/project.pbxproj:
3106         * WebProcess/GPU/graphics/ImageBufferFlushIdentifier.h: Added.
3107
3108         * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
3109         (WebKit::ImageBufferShareableBitmapBackend::create):
3110         * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h:
3111         Although hostWindow isn't used, this is what ConcreteImageBuffer::create
3112         expects from the creator of the backend.
3113
3114         * WebProcess/GPU/graphics/PlatformRemoteImageBuffer.h: Added.
3115         Defines the platform types of RemoteImageBuffer.
3116
3117         * WebProcess/GPU/graphics/RemoteImageBuffer.h: Added.
3118         (WebKit::RemoteImageBuffer::create):
3119         (WebKit::RemoteImageBuffer::RemoteImageBuffer):
3120         It is responsible for creating RemoteImageBufferProxy and performing the
3121         drawing commands in the GPUProcess.
3122
3123         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp: Added.
3124         (WebKit::RemoteImageBufferMessageHandler::RemoteImageBufferMessageHandler):
3125         (WebKit::RemoteImageBufferMessageHandler::~RemoteImageBufferMessageHandler):
3126         (WebKit::RemoteImageBufferMessageHandler::flushDrawingContext):
3127         (WebKit::RemoteImageBufferMessageHandler::commitFlushContext):
3128         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h: Added.
3129         (WebKit::RemoteImageBufferMessageHandler::imageBufferIdentifier const):
3130         Manages sending and receiving the messages of RemoteImageBuffer.
3131
3132         * WebProcess/GPU/graphics/RemoteRenderingBackend.cpp:
3133         (WebKit::RemoteRenderingBackend::createImageBuffer):
3134         (WebKit::RemoteRenderingBackend::releaseImageBuffer):
3135         (WebKit::RemoteRenderingBackend::createImageBufferBackend):
3136         (WebKit::RemoteRenderingBackend::commitImageBufferFlushContext):
3137         * WebProcess/GPU/graphics/RemoteRenderingBackend.h:
3138         (WebKit::RemoteRenderingBackend::renderingBackendIdentifier const):
3139         * WebProcess/GPU/graphics/RemoteRenderingBackend.messages.in:
3140         Handle or dispatch messages received from RemoteRenderingBackendProxy.
3141
3142         * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp:
3143         (WebKit::ImageBufferShareableIOSurfaceBackend::create):
3144         * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h:
3145         Although hostWindow isn't used, this is what ConcreteImageBuffer::create
3146         expects from the creator of the backend.
3147
3148 2020-03-02  John Wilander  <wilander@apple.com>
3149
3150         ResourceLoadStatistics: Enable cookie blocking and the Storage Access API in ephemeral sessions
3151         https://bugs.webkit.org/show_bug.cgi?id=208399
3152         <rdar://problem/24731650>
3153
3154         Reviewed by Brent Fulgham.
3155
3156         This patch enables resource load statistics, or ITP, in ephemeral sessions.
3157
3158         Since full third-party cookie blocking is stateless, it can now be enabled in
3159         ephemeral sessions. User interaction as a gate for calling the Storage Access
3160         API can be captured in an ephemeral fashion as well to allow authenticated
3161         embeds.
3162
3163         No actual statistics are captured which means that the constructor for
3164         WebKit::WebResourceLoadStatisticsStore skips setting up the memory store,
3165         the persistent store, and the database store.
3166
3167         The functionality that is supported is instead carried out in a set of
3168         private "*Ephemeral()" functions, for instance hasStorageAccessEphemeral().
3169         The public functions check ephemeral status and route accordingly.
3170
3171         A release assertion in WebResourceLoadStatisticsStore::postTask()
3172         guarantees that we never make use of the statistics layer in ephemeral
3173         sessions.
3174
3175         Early returns for ephemeral sessions has been removed in several places.
3176         WebKit::WebResourceLoadObserver now accepts being instantiated in an
3177         ephemeral session but is told whether it is and skips all statistics
3178         collection except user interaction which is needed to gate the
3179         Storage Access API. A release assertion in
3180         WebResourceLoadObserver::ensureResourceStatisticsForRegistrableDomain()
3181         makes sure that we never start collecting statistics in ephemeral mode.
3182
3183         A selection of test cases have been added with an ephemeral setting and
3184         a new test function isResourceLoadStatisticsEphemeral() has been added
3185         so that layout tests can make sure that an ephemeral setup is running.
3186         This last bit is important since test cases will likely still pass if a
3187         regression were to make the test session persistent.
3188
3189         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3190         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
3191         (WebKit::WebResourceLoadStatisticsStore::setIsRunningTest):
3192         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3193         (WebKit::WebResourceLoadStatisticsStore::postTask):
3194         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
3195         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
3196         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
3197         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccessEphemeral):
3198         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
3199         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessEphemeral):
3200         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpenerEphemeral):
3201         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessEphemeral):
3202         (WebKit::WebResourceLoadStatisticsStore::setThirdPartyCookieBlockingMode):
3203         (WebKit::WebResourceLoadStatisticsStore::setFirstPartyWebsiteDataRemovalMode):
3204         (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
3205         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
3206         (WebKit::WebResourceLoadStatisticsStore::logUserInteractionEphemeral):
3207         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
3208         (WebKit::WebResourceLoadStatisticsStore::clearUserInteractionEphemeral):
3209         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
3210         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteractionEphemeral):
3211         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
3212         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
3213         (WebKit::WebResourceLoadStatisticsStore::clearInMemoryEphemeral):
3214         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
3215         (WebKit::WebResourceLoadStatisticsStore::suspend):
3216             Added a comment on why this function is not applicable to ephemeral sessions.
3217         (WebKit::WebResourceLoadStatisticsStore::resume):
3218             Added a comment on why this function is not applicable to ephemeral sessions.
3219         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3220         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3221         (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
3222         * NetworkProcess/NetworkProcess.cpp:
3223         (WebKit::NetworkProcess::isResourceLoadStatisticsEphemeral const):
3224         (WebKit::NetworkProcess::prepareToSuspend):
3225             Skipped call to suspend ITP if it's running in ephemeral mode.
3226         (WebKit::void NetworkProcess::resume):
3227             Skipped call to resume ITP if it's running in ephemeral mode.
3228         * NetworkProcess/NetworkProcess.h:
3229         * NetworkProcess/NetworkProcess.messages.in:
3230         * NetworkProcess/NetworkSession.cpp:
3231         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
3232         (WebKit::NetworkSession::recreateResourceLoadStatisticStore):
3233         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3234         (WKWebsiteDataStoreIsStatisticsEphemeral):
3235         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3236         * UIProcess/Network/NetworkProcessProxy.cpp:
3237         (WebKit::NetworkProcessProxy::isResourceLoadStatisticsEphemeral):
3238         (WebKit::NetworkProcessProxy::addSession):
3239         * UIProcess/Network/NetworkProcessProxy.h:
3240         * UIProcess/WebPageProxy.cpp:
3241         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3242         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3243         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
3244         (WebKit::WebsiteDataStore::isResourceLoadStatisticsEphemeral const):
3245         * UIProcess/WebsiteData/WebsiteDataStore.h:
3246         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
3247         (WebKit::WebResourceLoadObserver::WebResourceLoadObserver):
3248         (WebKit::WebResourceLoadObserver::ensureResourceStatisticsForRegistrableDomain):
3249         (WebKit::WebResourceLoadObserver::logFontLoad):
3250         (WebKit::WebResourceLoadObserver::logCanvasRead):
3251         (WebKit::WebResourceLoadObserver::logCanvasWriteOrMeasure):
3252         (WebKit::WebResourceLoadObserver::logNavigatorAPIAccessed):
3253         (WebKit::WebResourceLoadObserver::logScreenAPIAccessed):
3254         (WebKit::WebResourceLoadObserver::logSubresourceLoading):
3255         (WebKit::WebResourceLoadObserver::logWebSocketLoading):
3256         (WebKit::WebResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3257         (WebKit::WebResourceLoadObserver::logSubresourceLoadingForTesting):
3258         * WebProcess/WebCoreSupport/WebResourceLoadObserver.h:
3259         * WebProcess/WebProcess.cpp:
3260         (WebKit::WebProcess::setWebsiteDataStoreParameters):
3261         (WebKit::WebProcess::setResourceLoadStatisticsEnabled):
3262
3263 2020-03-02  Per Arne Vollan  <pvollan@apple.com>
3264
3265         [Cocoa] Mapping from MIME type to UTI type should be done in the UI process
3266         https://bugs.webkit.org/show_bug.cgi?id=208415
3267
3268         Reviewed by Brent Fulgham.
3269
3270         Send the mapping between MIME types and UTI types to the WebContent process as part of the Web
3271         process creation parameters.
3272
3273         * Shared/WebProcessCreationParameters.cpp:
3274         (WebKit::WebProcessCreationParameters::encode const):
3275         (WebKit::WebProcessCreationParameters::decode):
3276         * Shared/WebProcessCreationParameters.h:
3277         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3278         (WebKit::WebProcessPool::platformInitializeWebProcess):
3279         * WebProcess/cocoa/WebProcessCocoa.mm:
3280         (WebKit::WebProcess::platformInitializeWebProcess):
3281
3282 2020-03-02  Eric Carlson  <eric.carlson@apple.com>
3283
3284         [GPUP] Plumb through more MediaPlayer methods
3285         https://bugs.webkit.org/show_bug.cgi?id=208423
3286         <rdar://problem/59924386>
3287
3288         Unreviewed, remove an invalid ASSERT that causes some tests to crash.
3289
3290         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
3291         (WebKit::MediaPlayerPrivateRemote::load):
3292
3293 2020-03-02  Per Arne Vollan  <pvollan@apple.com>
3294
3295         [iOS] Deny mach lookup access to distributed notifications in the WebContent process
3296         https://bugs.webkit.org/show_bug.cgi?id=208455
3297
3298         Reviewed by Brent Fulgham.
3299
3300         On iOS, deny mach lookup access to the service "com.apple.distributed_notifications@1v3" in the WebContent process.
3301
3302         Test: fast/sandbox/ios/sandbox-mach-lookup.html
3303
3304         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3305
3306 2020-03-02  Jacob Uphoff  <jacob_uphoff@apple.com>
3307
3308         Unreviewed, rolling out r257687.
3309
3310         This commit caused debug tests to crash for macOS & iOS
3311
3312         Reverted changeset:
3313
3314         "[Cocoa] Mapping from MIME type to UTI type should be done in
3315         the UI process"
3316         https://bugs.webkit.org/show_bug.cgi?id=208415
3317         https://trac.webkit.org/changeset/257687
3318
3319 2020-03-02  Eric Carlson  <eric.carlson@apple.com>
3320
3321         [GPUP] Plumb through more MediaPlayer methods
3322         https://bugs.webkit.org/show_bug.cgi?id=208423
3323         <rdar://problem/59924386>
3324
3325         Reviewed by Youenn Fablet.
3326
3327         * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
3328         (WebKit::RemoteMediaPlayerManagerProxy::updateVideoFullscreenInlineImage): Deleted.
3329         (WebKit::RemoteMediaPlayerManagerProxy::setVideoFullscreenFrame): Deleted.
3330         (WebKit::RemoteMediaPlayerManagerProxy::setVideoFullscreenGravity): Deleted.
3331         (WebKit::RemoteMediaPlayerManagerProxy::setVideoFullscreenMode): Deleted.
3332         (WebKit::RemoteMediaPlayerManagerProxy::setVolume): Deleted.
3333         (WebKit::RemoteMediaPlayerManagerProxy::setBufferingPolicy): Deleted.
3334         (WebKit::RemoteMediaPlayerManagerProxy::videoFullscreenStandbyChanged): Deleted.
3335         (WebKit::RemoteMediaPlayerManagerProxy::accessLog): Deleted.
3336         (WebKit::RemoteMediaPlayerManagerProxy::errorLog): Deleted.
3337         * GPUProcess/media/RemoteMediaPlayerManagerProxy.h:
3338         * GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in:
3339         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
3340         (WebKit::RemoteMediaPlayerProxy::mediaPlayerPause): Deleted.
3341         (WebKit::RemoteMediaPlayerProxy::mediaPlayerPlay): Deleted.
3342         * GPUProcess/media/RemoteMediaPlayerProxy.h:
3343
3344 2020-03-02  youenn fablet  <youenn@apple.com>
3345
3346         Enable capture in GPUProcess by default for recent platforms only
3347         https://bugs.webkit.org/show_bug.cgi?id=208437
3348
3349         Reviewed by Eric Carlson.
3350
3351         No change of behavior.
3352
3353         * Shared/WebPreferencesDefaultValues.h:
3354
3355 2020-03-02  Youenn Fablet  <youenn@apple.com>
3356
3357         LocalSampleBufferDisplayLayer is not computing the correct bounds/position in GPUProcess
3358         https://bugs.webkit.org/show_bug.cgi?id=208370
3359
3360         Reviewed by Eric Carlson.
3361
3362         Remove the bounds getter logic.
3363         Make use of new LocalSampleBufferDisplayLayer routine to properly update the layer bounds.
3364
3365         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp:
3366         (WebKit::RemoteSampleBufferDisplayLayer::updateBoundsAndPosition):
3367         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h:
3368         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.messages.in:
3369         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp:
3370         (WebKit::RemoteSampleBufferDisplayLayerManager::createLayer):
3371         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.messages.in:
3372         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp:
3373         (WebKit::SampleBufferDisplayLayer::SampleBufferDisplayLayer):
3374         (WebKit::SampleBufferDisplayLayer::updateBoundsAndPosition):
3375         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h:
3376
3377 2020-03-02  youenn fablet  <youenn@apple.com>
3378
3379         Enable audio MediaStreamTrack rendering in GPUProcess if audio capture happens in GPUProcess
3380         https://bugs.webkit.org/show_bug.cgi?id=208435
3381
3382         Reviewed by Eric Carlson.
3383
3384         Instead of enabling audio track rendering in GPUProcess based on media flag,
3385         use the audio capture flag.
3386         This makes sure things work properly on iOS, where an audio session might interrupt other sessions.
3387
3388         * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
3389         (WebKit::RemoteMediaPlayerManager::updatePreferences):
3390         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
3391         (WebKit::UserMediaCaptureManager::setupCaptureProcesses):
3392
3393 2020-03-02  Rob Buis  <rbuis@igalia.com>
3394
3395         Add referrerpolicy attribute support for anchors
3396         https://bugs.webkit.org/show_bug.cgi?id=208424
3397
3398         Reviewed by Darin Adler.
3399
3400         Adjust to FrameLoadRequest API change.
3401
3402         * WebProcess/Inspector/WebInspector.cpp:
3403         (WebKit::WebInspector::openInNewTab):
3404         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3405         (WebKit::PDFPlugin::clickedLink):
3406         * WebProcess/Plugins/PluginView.cpp:
3407         (WebKit::PluginView::loadURL):
3408         * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
3409         (WebKit::WebContextMenuClient::searchWithGoogle):
3410         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3411         (WebKit::WebFrameLoaderClient::dispatchCreatePage):
3412         * WebProcess/WebPage/WebPage.cpp:
3413         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
3414
3415 2020-03-01  Ting-Wei Lan  <lantw44@gmail.com>
3416
3417         [GTK] Fix the build when Wayland target is disabled
3418         https://bugs.webkit.org/show_bug.cgi?id=208407
3419
3420         Reviewed by Darin Adler.
3421
3422         Values in the enum WebCore::PlatformDisplay::Type are only defined when
3423         their corresponding platform targets are enabled, so we need #if checks
3424         around uses of them.
3425
3426         * UIProcess/API/glib/WebKitProtocolHandler.cpp:
3427         (WebKit::WebKitProtocolHandler::handleGPU):
3428         * UIProcess/API/glib/WebKitUIClient.cpp:
3429         (UIClient::windowConfigureEventCallback):
3430
3431 2020-03-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3432
3433         Unreviewed, rolling out r257618.
3434
3435         This allegedly causes Safari to crash when closing a window
3436         (see rdar://problem/59922725).
3437
3438         Reverted changeset:
3439
3440         "UIProcess crash after using _prepareForMoveToWindow, then
3441         deallocating the WKWebView before moving to the window"
3442         https://bugs.webkit.org/show_bug.cgi?id=208365
3443         https://trac.webkit.org/changeset/257618
3444
3445 2020-03-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3446
3447         Many tests in canvas and fast/canvas are asserting after r257677
3448         https://bugs.webkit.org/show_bug.cgi?id=208431
3449         <rdar://problem/59911910>
3450
3451         Reviewed by Tim Horton.
3452
3453         RemoteRenderingBackend asserts that it should never be created with a RenderingMode that isn't either
3454         RemoteAccelerated or RemoteUnaccelerated. This was previously the case before r257677, because
3455         ImageBuffer::create() would only call into the host window (i.e. the chrome and, in turn, chrome client) to
3456         create the remote image buffer if the rendering mode is RemoteAccelerated or RemoteUnaccelerated. However, since
3457         we want to move away from any references to RemoteAccelerated or RemoteUnaccelerated rendering modes in WebCore,
3458         we should instead fix this by adding a similar check in the client (WebKit) layer.
3459
3460         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3461         (WebKit::WebChromeClient::createImageBuffer const):
3462
3463         Don't bother creating a RemoteRenderingBackend and telling it to create an image buffer, if the given
3464         RenderingMode isn't one of RemoteAccelerated or RemoteUnaccelerated.
3465
3466 2020-02-29  Yusuke Suzuki  <ysuzuki@apple.com>
3467
3468         Remove std::lock_guard
3469         https://bugs.webkit.org/show_bug.cgi?id=206451
3470
3471         Reviewed by Anders Carlsson.
3472
3473         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3474         (WebKit::NetworkCache::Storage::traverse):
3475         * Platform/IPC/Connection.cpp:
3476         (IPC::Connection::SyncMessageState::processIncomingMessage):
3477         (IPC::Connection::SyncMessageState::dispatchMessages):
3478         (IPC::Connection::SyncMessageState::dispatchMessagesAndResetDidScheduleDispatchMessagesForConnection):
3479         (IPC::Connection::addWorkQueueMessageReceiver):
3480         (IPC::Connection::removeWorkQueueMessageReceiver):
3481         (IPC::Connection::addThreadMessageReceiver):
3482         (IPC::Connection::removeThreadMessageReceiver):
3483         (IPC::Connection::sendMessage):
3484         (IPC::Connection::waitForMessage):
3485         (IPC::Connection::processIncomingMessage):
3486         (IPC::Connection::installIncomingSyncMessageCallback):
3487         (IPC::Connection::uninstallIncomingSyncMessageCallback):
3488         (IPC::Connection::hasIncomingSyncMessage):
3489         (IPC::Connection::connectionDidClose):
3490         (IPC::Connection::sendOutgoingMessages):
3491         (IPC::Connection::enqueueIncomingMessage):
3492         (IPC::Connection::dispatchMessageToWorkQueueReceiver):
3493         (IPC::Connection::dispatchMessageToThreadReceiver):
3494         (IPC::Connection::dispatchOneIncomingMessage):
3495         (IPC::Connection::dispatchIncomingMessages):
3496         * Shared/BlockingResponseMap.h:
3497         (BlockingResponseMap::didReceiveResponse):
3498         * UIProcess/mac/WKPrintingView.mm:
3499         (-[WKPrintingView _preparePDFDataForPrintingOnSecondaryThread]):
3500         (prepareDataForPrintingOnSecondaryThread):
3501
3502 2020-02-29  Per Arne Vollan  <pvollan@apple.com>
3503
3504         [Cocoa] Mapping from MIME type to UTI type should be done in the UI process
3505         https://bugs.webkit.org/show_bug.cgi?id=208415
3506
3507         Reviewed by Brent Fulgham.
3508
3509         Send the mapping between MIME types and UTI types to the WebContent process as part of the Web
3510         process creation parameters.
3511
3512         * Shared/WebProcessCreationParameters.cpp:
3513         (WebKit::WebProcessCreationParameters::encode const):
3514         (WebKit::WebProcessCreationParameters::decode):
3515         * Shared/WebProcessCreationParameters.h:
3516         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3517         (WebKit::WebProcessPool::platformInitializeWebProcess):
3518         * WebProcess/cocoa/WebProcessCocoa.mm:
3519         (WebKit::WebProcess::platformInitializeWebProcess):
3520
3521 2020-02-29  Jer Noble  <jer.noble@apple.com>
3522
3523         Unreviewed unified build fix; add include macro for LayerHostingContext.
3524
3525         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
3526
3527 2020-02-28  Peng Liu  <peng.liu6@apple.com>
3528
3529         [Media in GPU process] Implement the video fullscreen and Picture-in-Picture support
3530         https://bugs.webkit.org/show_bug.cgi?id=208252
3531
3532         Reviewed by Simon Fraser.
3533
3534         The RemoteMediaPlayerProxy in the GPU process creates a LayerHostingContext and
3535         share the context ID with the MediaPlayerPrivateRemote in the Web process,
3536         which in turn creates a remote layer used by the VideoFullscreenManager.
3537
3538         Those functions regarding video fullscreen and picture-in-picture have been
3539         moved to RemoteMediaPlayerProxy.
3540         * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
3541         (WebKit::RemoteMediaPlayerManagerProxy::updateVideoFullscreenInlineImage): Deleted.
3542         (WebKit::RemoteMediaPlayerManagerProxy::setVideoFullscreenFrame): Deleted.
3543         (WebKit::RemoteMediaPlayerManagerProxy::setVideoFullscreenGravity): Deleted.
3544         (WebKit::RemoteMediaPlayerManagerProxy::setVideoFullscreenMode): Deleted.
3545         (WebKit::RemoteMediaPlayerManagerProxy::setVolume): Deleted.
3546         (WebKit::RemoteMediaPlayerManagerProxy::setBufferingPolicy): Deleted.
3547         (WebKit::RemoteMediaPlayerManagerProxy::videoFullscreenStandbyChanged): Deleted.
3548         * GPUProcess/media/RemoteMediaPlayerManagerProxy.h:
3549
3550         [GPU process]
3551         Add two asynchronous IPC messages (EnterFullscreen and ExitFullscreen) in RemoteMediaPlayerProxy
3552         and replace the message SetVideoFullscreenFrame with SetVideoFullscreenFrameFenced.
3553         Create the CALayer for the video fullscreen and picture-in-picture features.
3554         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
3555         (WebKit::RemoteMediaPlayerProxy::prepareForPlayback): Deleted.
3556         (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenFrame): Deleted.
3557         (WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable): Deleted.
3558         (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged): Deleted.
3559         * GPUProcess/media/RemoteMediaPlayerProxy.h:
3560         * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
3561         * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm:
3562         (WebKit::RemoteMediaPlayerProxy::prepareForPlayback):
3563         (WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable):
3564         (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged):
3565         (WebKit::RemoteMediaPlayerProxy::setVideoInlineSizeFenced):
3566         (WebKit::RemoteMediaPlayerProxy::enterFullscreen):
3567         (WebKit::RemoteMediaPlayerProxy::exitFullscreen):
3568         (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenFrameFenced):
3569
3570         * SourcesCocoa.txt:
3571         * WebKit.xcodeproj/project.pbxproj:
3572
3573         [Web process]
3574         Create a hosting layer in the Web process corresponding to the CALayer in the
3575         GPU process for video fullscreen and picture-in-picture.
3576         Synchronize the properties of the layers cross process boundary with MachSendRight.
3577         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
3578         (WebKit::MediaPlayerPrivateRemote::prepareForPlayback):
3579         (WebKit::MediaPlayerPrivateRemote::acceleratedRenderingStateChanged):
3580         (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenLayer):
3581         (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenFrameFenced):
3582         (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenGravity):
3583         (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenFrame): Deleted.
3584         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
3585         * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm: Added.
3586         (WebKit::MediaPlayerPrivateRemote::createVideoFullscreenLayer):
3587         (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenFrame):
3588         * WebProcess/GPU/media/cocoa/VideoLayerRemoteCocoa.mm:
3589         (WebKit::createVideoLayerRemote):
3590         * WebProcess/cocoa/VideoFullscreenManager.mm:
3591         (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement):
3592
3593         Fix unified build failures.
3594         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
3595
3596 2020-02-28  Jer Noble  <jer.noble@apple.com>
3597
3598         Unreviewed unified build fix; Add include header for IPC::DataReference.
3599
3600         * WebProcess/Network/WebResourceLoader.cpp:
3601
3602 2020-02-28  Wenson Hsieh  <wenson_hsieh@apple.com>
3603
3604         Add an internal setting to enable or disable canvas rendering in the GPU Process
3605         https://bugs.webkit.org/show_bug.cgi?id=208375
3606
3607         Reviewed by Tim Horton.
3608
3609         See WebCore ChangeLog for more details.
3610
3611         * Shared/WebPageCreationParameters.cpp:
3612         (WebKit::WebPageCreationParameters::encode const):
3613         (WebKit::WebPageCreationParameters::decode):
3614         * Shared/WebPageCreationParameters.h:
3615
3616         Consult the new internal feature when creating a new web process.
3617
3618         * Shared/WebPreferences.yaml:
3619
3620         Add a new internal setting to enable using the GPU process for rendering canvases.
3621
3622         * UIProcess/WebPageProxy.cpp:
3623         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3624         (WebKit::WebChromeClient::createImageBuffer const):
3625         * WebProcess/WebCoreSupport/WebChromeClient.h:
3626         * WebProcess/WebPage/WebPage.cpp:
3627         (WebKit::WebPage::shouldUseRemoteRenderingFor):
3628
3629         Add a helper method that WebChromeClient can use to determine whether it should opt into either
3630         RemoteAccelerated or RemoteUnaccelerated.
3631
3632         * WebProcess/WebPage/WebPage.h:
3633
3634 2020-02-28  Chris Dumez  <cdumez@apple.com>
3635
3636         [iOS 13] Crash in NetworkProcessProxy::takeUploadAssertion
3637         https://bugs.webkit.org/show_bug.cgi?id=204796
3638
3639         Reviewed by Alex Christensen.
3640
3641         * UIProcess/WebProcessPool.cpp:
3642         (WebKit::WebProcessPool::setWebProcessHasUploads):
3643         If the network process has previously crashed, WebProcessPool::m_networkProcess may be null
3644         when WebProcessPool::setWebProcessHasUploads() is called. As a result, we should call
3645         ensureNetworkProcess() instead of dereferencing m_networkProcess unconditionally.
3646
3647 2020-02-28  Jer Noble  <jer.noble@apple.com>
3648
3649         [GPUP] Implement Modern EME API in the GPU Process
3650         https://bugs.webkit.org/show_bug.cgi?id=208090
3651
3652         Reviewed by Alex Christensen.
3653
3654         IPC::SharedBufferDataReference is made more efficient by using the same encode/decode path as is used in
3655         WebCoreArgumentCoders: the SharedBuffer is copied into shared memory, and only a handle is passed across
3656         the XPC boundary. This requires existing users to handle receiving a IPC::SharedBufferDataHandle on the
3657         remote side of the XPC boundary, but this is trivial, and many call sites require a SharedBuffer on the
3658         remote side in the first place. This code could be improved by allowing the SharedMemory object be adopted
3659         by the SharedBuffer object at creation time, potentially leading to zero-copy decoding, but is not done in
3660         this patch.
3661
3662         * NetworkProcess/NetworkResourceLoader.cpp:
3663         (WebKit::NetworkResourceLoader::bufferingTimerFired):
3664         (WebKit::NetworkResourceLoader::sendBuffer):
3665         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
3666         (WebKit::ServiceWorkerFetchTask::didReceiveData):
3667         (WebKit::ServiceWorkerFetchTask::didReceiveSharedBuffer):
3668         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
3669         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.messages.in:
3670         * Platform/IPC/HandleMessage.h:
3671         * Platform/IPC/SharedBufferDataReference.h:
3672         (IPC::SharedBufferDataReference::SharedBufferDataReference):
3673         (IPC::SharedBufferDataReference::buffer):
3674         (IPC::SharedBufferDataReference::buffer const):
3675         (IPC::SharedBufferDataReference::data const):
3676         (IPC::SharedBufferDataReference::size const):
3677         (IPC::SharedBufferDataReference::isEmpty const):
3678         (IPC::SharedBufferDataReference::encode const):
3679         (IPC::SharedBufferDataReference::decode):
3680         * Shared/WebCoreArgumentCoders.cpp:
3681         (IPC::ArgumentCoder<RefPtr<WebCore::SharedBuffer>>::encode):
3682         (IPC::ArgumentCoder<RefPtr<WebCore::SharedBuffer>>::decode):
3683         * Shared/WebCoreArgumentCoders.h:
3684         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3685         (WebKit::WebPageProxy::platformRegisterAttachment):
3686         * UIProcess/WebPageProxy.cpp:
3687         * UIProcess/WebPageProxy.h:
3688         * UIProcess/WebPageProxy.messages.in:
3689         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3690         * WebProcess/Network/WebResourceLoader.cpp:
3691         (WebKit::WebResourceLoader::didReceiveSharedBuffer):
3692         (WebKit::WebResourceLoader::didReceiveData):
3693         * WebProcess/Network/WebResourceLoader.h:
3694         * WebProcess/Network/WebResourceLoader.messages.in:
3695         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
3696         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
3697         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveBlobChunk):
3698         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3699         (WebKit::WebFrameLoaderClient::finishedLoadingIcon):
3700         * WebProcess/WebPage/WebPage.cpp:
3701         (WebKit::WebPage::getSelectionAsWebArchiveData):
3702         (WebKit::WebPage::getWebArchiveOfFrame):
3703         (WebKit::WebPage::drawPagesToPDF):
3704         (WebKit::WebPage::urlSchemeTaskDidReceiveData):
3705         (WebKit::WebPage::updateAttachmentAttributes):
3706         * WebProcess/WebPage/WebPage.h:
3707
3708 2020-02-28  Adrian Perez de Castro  <aperez@igalia.com>
3709
3710         Unreviewed non-unified soures builds fix.
3711
3712         * NetworkProcess/cache/NetworkCacheData.cpp:
3713         (WebKit::NetworkCache::readOrMakeSalt): Add missing namespace to FileSystem::fileExists() call.
3714
3715 2020-02-28  Jer Noble  <jer.noble@apple.com>
3716
3717         [GPUP] Implement Modern EME API in the GPU Process
3718         https://bugs.webkit.org/show_bug.cgi?id=208090
3719
3720         Reviewed by Eric Carlson.
3721
3722         Adopt changes to MediaPlayerProxy.
3723
3724         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
3725         (WebKit::RemoteMediaPlayerProxy::mediaPlayerKeyNeeded):
3726         * GPUProcess/media/RemoteMediaPlayerProxy.h:
3727         * WebProcess/GPU/media/WebMediaStrategy.cpp:
3728         (WebKit::WebMediaStrategy::registerCDMFactories):
3729         * WebProcess/GPU/media/WebMediaStrategy.h:
3730
3731 2020-02-28  Tim Horton  <timothy_horton@apple.com>
3732
3733         macCatalyst: 'Open' context menu item doesn't work
3734         https://bugs.webkit.org/show_bug.cgi?id=208388
3735         <rdar://problem/59820273>
3736
3737         Reviewed by Wenson Hsieh.
3738
3739         * UIProcess/ios/WKContentViewInteraction.h:
3740         * UIProcess/ios/WKContentViewInteraction.mm:
3741         (-[WKContentView cleanupInteraction]):
3742         (-[WKContentView _webTouchEventsRecognized:]):
3743         (-[WKContentView _doubleTapRecognizedForDoubleClick:]):
3744         (-[WKContentView _singleTapRecognized:]):
3745         (-[WKContentView _attemptClickAtLocation:modifierFlags:]):
3746         (-[WKContentView _mouseGestureRecognizerChanged:]):
3747         In r178980, a mechanism was introduced to ensure that synthetic clicks are
3748         only dispatched to the page that the user originally touched.
3749
3750         macCatalyst's WKMouseGestureRecognizer unintentionally entirely bypassed
3751         this mechanism, never setting _layerTreeTransactionIdAtLastTouchStart,
3752         because the touch event gesture recognizer is disabled. This was generally
3753         fine because in this case, we don't need to send synthetic clicks,
3754         instead sending proper mouse events.
3755
3756         However, the "Open" context menu item works by sending a synthetic click
3757         at the original interaction location. Since we did not set 
3758         _layerTreeTransactionIdAtLastTouchStart, the Web Content process will
3759         ignore the click, and perform no action.
3760
3761         Fix this by also setting _layerTreeTransactionIdAtLastTouchStart
3762         on mouseDown.
3763
3764 2020-02-28  Brent Fulgham  <bfulgham@apple.com>
3765
3766         [iOS] Remove access to the "com.apple.lsd.open" mach service from the WebContent process
3767         https://bugs.webkit.org/show_bug.cgi?id=207708
3768         <rdar://problem/56995506>
3769
3770         Reviewed by Per Arne Vollan.
3771
3772         Now that we dynamically create the sandbox extension to the 'com.apple.lsd.open' mach service,
3773         we can remove the global allow rule from the sandbox.
3774  
3775         Reviewed by Per Arne Vollan.
3776
3777         * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
3778         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3779
3780 2020-02-28  Keith Rollin  <krollin@apple.com>
3781
3782         Convert frame address in logging statements to pageID+frameID
3783         https://bugs.webkit.org/show_bug.cgi?id=208325
3784         <rdar://problem/59850768>
3785
3786         Reviewed by Alex Christensen.
3787
3788         Some old logging prints the address of the associated frame object.
3789         Annotating logging statements this way makes it difficult to match up
3790         that logging with other logging that uses pageID+frameID. Update the
3791         logging to consistently use the latter format.
3792
3793         * WebProcess/Network/WebLoaderStrategy.cpp:
3794         (WebKit::WebLoaderStrategy::loadResource):
3795
3796 2020-02-28  Eric Carlson  <eric.carlson@apple.com>
3797
3798         No port uses USE_NATIVE_FULLSCREEN_VIDEO, remove it
3799         https://bugs.webkit.org/show_bug.cgi?id=208378
3800         <rdar://problem/59892497>
3801
3802         Reviewed by Jer Noble.
3803
3804         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
3805         (WebKit::MediaPlayerPrivateRemote::setClosedCaptionsVisible):
3806         (WebKit::MediaPlayerPrivateRemote::enterFullscreen): Deleted.
3807         (WebKit::MediaPlayerPrivateRemote::exitFullscreen): Deleted.
3808         (WebKit::MediaPlayerPrivateRemote::canEnterFullscreen const): Deleted.
3809         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
3810
3811 2020-02-28  Brent Fulgham  <bfulgham@apple.com>
3812
3813         [iOS] Unblock read access to aes_0 device
3814         https://bugs.webkit.org/show_bug.cgi?id=208344
3815         <rdar://problem/59746108>
3816
3817         Reviewed by Alexey Proskuryakov.
3818
3819         Logging needs access to /dev/aes_0 to generate random identifiers. We should unblock this service.
3820
3821         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
3822
3823 2020-02-28  youenn fablet  <youenn@apple.com>
3824
3825         [MacOS/iOS] Enable audio/video capture in GPUProcess by default
3826         https://bugs.webkit.org/show_bug.cgi?id=208130
3827
3828         Reviewed by Eric Carlson.
3829
3830         Covered by existing tests.
3831
3832         * Shared/WebPreferences.yaml:
3833         * Shared/WebPreferencesDefaultValues.h:
3834         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
3835         (WebKit::UserMediaCaptureManager::cloneVideoSource):
3836         Make sure to select the process of the source to clone it.
3837
3838 2020-02-28  Youenn Fablet  <youenn@apple.com>
3839
3840         Conversion between MediaSample and RemoteVideoSample should preserve the rotation information
3841         https://bugs.webkit.org/show_bug.cgi?id=208240
3842
3843         Reviewed by Eric Carlson.
3844
3845         Use new routine that preserves rotation.
3846
3847         * GPUProcess/webrtc/RemoteMediaRecorder.cpp:
3848         (WebKit::RemoteMediaRecorder::videoSampleAvailable):
3849         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp:
3850         (WebKit::RemoteSampleBufferDisplayLayer::enqueueSample):
3851         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
3852         (WebKit::UserMediaCaptureManager::Source::remoteVideoSampleAvailable):
3853
3854 2020-02-27  Don Olmstead  <don.olmstead@sony.com>
3855
3856         Fix WebCore export macros for declspec
3857         https://bugs.webkit.org/show_bug.cgi?id=208363
3858
3859         Reviewed by Konstantin Tokarev.
3860
3861         Add compilation definitions for static linking of PAL and WebCore in WebKit.
3862
3863         * PlatformFTW.cmake:
3864         * PlatformWin.cmake:
3865         * config.h:
3866
3867 2020-02-27  Tim Horton  <timothy_horton@apple.com>
3868
3869         UIProcess crash after using _prepareForMoveToWindow, then deallocating the WKWebView before moving to the window
3870         https://bugs.webkit.org/show_bug.cgi?id=208365
3871
3872         Reviewed by Alex Christensen.
3873
3874         New test: WKWebView.PrepareForMoveToWindowCrashAfterNotMovingToWindow
3875
3876         * UIProcess/Cocoa/WebViewImpl.mm:
3877         (-[WKWindowVisibilityObserver dealloc]):
3878         (-[WKWindowVisibilityObserver setWindowToObserve:]):
3879         (WebKit::WebViewImpl::viewWillMoveToWindow):
3880         Two small changes to make WKWindowVisibilityObserver safer to use, which
3881         fix the aforementioned bug:
3882
3883         - Instead of exposing startObserving/stopObserving and making clients
3884         be careful about pairing them, and remembering which window to stopObserving,
3885         just add "setWindowToObserve", and keep track (weakly) of the current
3886         NSWindow being observed. This avoids double-adding observers.
3887
3888         - Always stopObserving when WKWindowVisibilityObserver is deallocated.
3889         In the "normal" case, WKWebView will always be removed from the view
3890         hierarchy before it is deallocated (and thus before the
3891         WKWindowVisibilityObserver is deallocated), because otherwise its superview
3892         holds a reference to it. But in the _prepareForMoveToWindow case, we do
3893         not have this guarantee, and can end up deallocating the WKWebView without
3894         getting a willMoveToWindow:nil. Make sure to clean up the observers in
3895         that case, if the window is still around, otherwise when NSWindow sends
3896         notifications, it will try to message a deallocated WKWebView.
3897
3898 2020-02-27  Brent Fulgham  <bfulgham@apple.com>
3899
3900         [iOS] Remove logging for sysctl access to properties used by NSURLSession
3901         https://bugs.webkit.org/show_bug.cgi?id=208346
3902         <rdar://problem/59862967>
3903
3904         Reviewed by Alexey Proskuryakov.
3905
3906         Telemetry and logging indicate that two sysctl calls are needed by [NSURLSession sessionWithConfiguration].
3907         We no longer need to log these well understood uses.
3908
3909         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
3910
3911 2020-02-27  Eric Carlson  <eric.carlson@apple.com>
3912
3913         Support in-band generic cues when loading media in the GPU Process
3914         https://bugs.webkit.org/show_bug.cgi?id=208080
3915         <rdar://problem/59687943>
3916
3917         Reviewed by Youenn Fablet.
3918
3919         * GPUProcess/media/RemoteTextTrackProxy.cpp:
3920         (WebKit::RemoteTextTrackProxy::addGenericCue):
3921         (WebKit::RemoteTextTrackProxy::updateGenericCue):
3922         (WebKit::RemoteTextTrackProxy::removeGenericCue):
3923         * GPUProcess/media/RemoteTextTrackProxy.h:
3924         * Scripts/webkit/messages.py:
3925         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
3926         (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::load):
3927         (WebKit::MediaPlayerPrivateRemote::addGenericCue):
3928         (WebKit::MediaPlayerPrivateRemote::updateGenericCue):
3929         (WebKit::MediaPlayerPrivateRemote::removeGenericCue):
3930         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
3931         * WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in:
3932         * WebProcess/GPU/media/TextTrackPrivateRemote.cpp:
3933         (WebKit::TextTrackPrivateRemote::addGenericCue):
3934         (WebKit::TextTrackPrivateRemote::updateGenericCue):
3935         (WebKit::TextTrackPrivateRemote::removeGenericCue):
3936         * WebProcess/GPU/media/TextTrackPrivateRemote.h:
3937
3938 2020-02-27  Per Arne Vollan  <pvollan@apple.com>
3939
3940         [iOS] Issue mach sandbox extensions to the WebContent process for a set of specific services
3941         https://bugs.webkit.org/show_bug.cgi?id=208146
3942
3943         Reviewed by Brent Fulgham.
3944
3945         We are still seeing some accesses from the WebContent process to a small set of services. Since we do not currently have
3946         backtraces for these accesses, make a speculative patch, where we issue these extension for all apps except Safari.
3947
3948         Test: fast/sandbox/ios/sandbox-mach-lookup-mail.html
3949
3950         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3951         * Shared/WebProcessCreationParameters.cpp:
3952         (WebKit::WebProcessCreationParameters::encode const):
3953         (WebKit::WebProcessCreationParameters::decode):
3954         * Shared/WebProcessCreationParameters.h:
3955         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3956         (WebKit::WebProcessPool::platformInitializeWebProcess):
3957         * WebProcess/cocoa/WebProcessCocoa.mm:
3958         (WebKit::WebProcess::platformInitializeWebProcess):
3959
3960 2020-02-27  Per Arne Vollan  <pvollan@apple.com>
3961
3962         [iOS] The GPU process never runs as a foreground process
3963         https://bugs.webkit.org/show_bug.cgi?id=208250
3964
3965         Reviewed by Chris Dumez.
3966
3967         Currently, the GPU process always runs in the background, and never goes into the foreground mode, which is required for media
3968         playback on iOS. This is addressed by creating a layer in the GPU process, whose context ID is used to create a visibility
3969         propagation view in the UI process. This is done in the same way as it is done for the WebContent process. This makes it
3970         possible for the system to determine the visibility of the GPU process. In addition, create foreground process assertions
3971         when media is being played.
3972
3973         No new tests, covered by existing tests.
3974
3975         * GPUProcess/GPUProcess.cpp:
3976         (WebKit::GPUProcess::initializeGPUProcess):
3977         * GPUProcess/GPUProcess.h:
3978         * GPUProcess/ios/GPUProcessIOS.mm:
3979         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3980         (WebKit::WebPageProxy::didCreateContextInGPUProcessForVisibilityPropagation):
3981         * UIProcess/GPU/GPUProcessProxy.cpp:
3982         (WebKit::GPUProcessProxy::GPUProcessProxy):
3983         (WebKit::GPUProcessProxy::openGPUProcessConnection):
3984         (WebKit::GPUProcessProxy::didCreateContextForVisibilityPropagation):
3985         (WebKit::GPUProcessProxy::contextIDForVisibilityPropagation const):
3986         * UIProcess/GPU/GPUProcessProxy.h:
3987         * UIProcess/GPU/GPUProcessProxy.messages.in:
3988         * UIProcess/PageClient.h:
3989         (WebKit::PageClient::didCreateContextInGPUProcessForVisibilityPropagation):
3990         (WebKit::PageClient::gpuProcessCrashed):
3991         * UIProcess/WebPageProxy.cpp:
3992         * UIProcess/WebPageProxy.h:
3993         * UIProcess/WebProcessPool.cpp:
3994         (WebKit::WebProcessPool::gpuProcessCrashed):
3995         (WebKit::WebProcessPool::setWebProcessIsPlayingAudibleMedia):
3996         (WebKit::WebProcessPool::clearWebProcessIsPlayingAudibleMedia):
3997         * UIProcess/WebProcessPool.h:
3998         * UIProcess/WebProcessProxy.cpp:
3999         (WebKit::WebProcessProxy::gpuProcessCrashed):
4000         (WebKit::WebProcessProxy::didCreateContextInGPUProcessForVisibilityPropagation):