AXIsolatedObject implementation of the title method.
[WebKit.git] / Source / WebKit / ChangeLog
1 2020-03-19  Charlie Turner  <cturner@igalia.com>
2
3         Fix many warnings with Clang 7.0 on GTK x86-64 in Debug.
4         https://bugs.webkit.org/show_bug.cgi?id=209146
5
6         Reviewed by Darin Adler.
7
8         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
9         (WebKit::NetworkHTTPSUpgradeChecker::query):
10         * NetworkProcess/NetworkLoadChecker.cpp: The m_isHTTPSUpgradeEnabled
11         ivar is only used on Cocoa platforms, on GTK it is causing warning
12         spam.
13         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
14         * NetworkProcess/NetworkLoadChecker.h:
15         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
16         (WebKit::CoordinatedGraphicsScene::updateSceneState):
17         *
18         Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
19         m_inForceRepaint is not being used anymore.
20         (WebKit::ThreadedCompositor::forceRepaint):
21         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
22         * UIProcess/API/glib/WebKitNavigationClient.cpp:
23         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
24         (WebKit::RemoteInspectorProtocolHandler::RemoteInspectorProtocolHandler):
25         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.h:
26
27 2020-03-19  youenn fablet  <youenn@apple.com>
28
29         Make URL::path() return a StringView
30         https://bugs.webkit.org/show_bug.cgi?id=209173
31
32         Reviewed by Alex Christensen.
33
34         Update code according new path return type.
35
36         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
37         (WebKit::NetworkDataTaskSoup::didSendRequest):
38         * Shared/API/APIURL.h:
39         (API::URL::path const):
40         * UIProcess/API/glib/WebKitURISchemeRequest.cpp:
41         (webkitURISchemeRequestReadCallback):
42         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
43         (WebKit::WebFrameLoaderClient::objectContentType):
44         * WebProcess/WebPage/WebPage.cpp:
45         (WebKit::WebPage::createPlugin):
46
47 2020-03-19  Megan Gardner  <megan_gardner@apple.com>
48
49         Correctly set up context for Data Detectors
50         https://bugs.webkit.org/show_bug.cgi?id=209258
51         <rdar://problem/60612327>
52
53         Reviewed by Tim Horton.
54
55         Stop passing in a nil context. This is OK now, but won't be in the near future.
56         Also, call -updateContext:withSourceRect: so that DataDetectors can populate the context appropriately.
57
58         * UIProcess/ios/WKActionSheetAssistant.mm:
59         (-[WKActionSheetAssistant contextMenuInteraction:configurationForMenuAtLocation:]):
60         * UIProcess/ios/WKContentViewInteraction.mm:
61         (-[WKContentView dataDetectionContextForPositionInformation:]):
62
63 2020-03-18  Simon Fraser  <simon.fraser@apple.com>
64
65         eventSender.monitorWheelEvents() is very fragile
66         https://bugs.webkit.org/show_bug.cgi?id=197819
67         <rdar://problem/51319456>
68
69         Reviewed by Tim Horton.
70
71         Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness,
72         adding back changes from r257844 that were reverted in r258558.
73         
74         First, have EventSendingController keep track of whether it's seen then "end" event
75         for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which
76         now waits until it sees these, which prevents premature triggering which was a common cause of
77         failure before.
78         
79         Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test
80         for completion in a callout from the end of Page::updateRendering(), which makes it test
81         and fire at a more consistent time.
82         
83         Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral
84         can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch()
85         used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed,
86         also resulting in a premature trigger.
87
88         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
89         (WKBundlePageRegisterScrollOperationCompletionCallback):
90         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
91
92 2020-03-18  Alex Christensen  <achristensen@webkit.org>
93
94         Add HTTP3 as an experimental feature
95         https://bugs.webkit.org/show_bug.cgi?id=209267
96         <rdar://problem/60245262> and <rdar://problem/60245168>
97
98         Reviewed by Brent Fulgham.
99
100         Manually verified this sets the CFNetwork SPI as expected.
101
102         * NetworkProcess/NetworkSessionCreationParameters.cpp:
103         (WebKit::NetworkSessionCreationParameters::encode const):
104         (WebKit::NetworkSessionCreationParameters::decode):
105         * NetworkProcess/NetworkSessionCreationParameters.h:
106         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
107         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
108         * Shared/WebPreferences.yaml:
109         * UIProcess/WebProcessPool.cpp:
110         (WebKit::WebProcessPool::ensureNetworkProcess):
111         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
112         (WebKit::WebsiteDataStore::parameters):
113         (WebKit::WebsiteDataStore::http3Enabled):
114         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
115         (WebKit::WebsiteDataStore::http3Enabled):
116         * UIProcess/WebsiteData/WebsiteDataStore.h:
117
118 2020-03-18  Saam Barati  <sbarati@apple.com>
119
120         SharedMemory::Handle::decode shouldn't check rounded size
121         https://bugs.webkit.org/show_bug.cgi?id=209263
122
123         Reviewed by Sam Weinig.
124
125         * Platform/cocoa/SharedMemoryCocoa.cpp:
126         (WebKit::SharedMemory::Handle::decode):
127         (WebKit::SharedMemory::map):
128
129 2020-03-18  Fujii Hironori  <Hironori.Fujii@sony.com>
130
131         WebCoreArgumentCoders should check bufferIsLargeEnoughToContain before allocating buffers
132         https://bugs.webkit.org/show_bug.cgi?id=209219
133
134         Reviewed by Darin Adler.
135
136         * Shared/WebCoreArgumentCoders.cpp:
137         (IPC::decodeSharedBuffer): Added checking of bufferIsLargeEnoughToContain.
138         (IPC::decodeTypesAndData): Don't allocate a buffer with the
139         decoded size. bufferIsLargeEnoughToContain can't be used in this
140         case because SharedBuffer is encoded as variable length data.
141         Instead, append items one-by-one.
142
143 2020-03-18  John Wilander  <wilander@apple.com>
144
145         WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener() should call its ephemeral counterpart when appropriate
146         https://bugs.webkit.org/show_bug.cgi?id=209245
147         <rdar://problem/60511121>
148
149         Reviewed by Chris Dumez.
150
151         This change makes sure that WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener()
152         calls WebResourceLoadStatisticsStore::requestStorageAccessUnderOpenerEphemeral() for ephemeral
153         sessions.
154
155         Tests: http/tests/storageAccess/deny-storage-access-under-opener-ephemeral.html
156                http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-ephemeral.html
157                http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-ephemeral.html
158
159         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
160         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
161
162 2020-03-18  Brent Fulgham  <bfulgham@apple.com>
163
164         Avoid calling 'notifyThisWebProcessPoolWasCreated' inside the constructor
165         https://bugs.webkit.org/show_bug.cgi?id=209254
166         <rdar://problem/60564526>
167
168         Reviewed by Alex Christensen and Chris Dumez.
169
170         Enqueue calls to 'notifyThisWebProcessPoolWasCreated' so they are not invoked until
171         after the process pool is finished with its constructor.
172
173         Behavior covered by existing tests.
174
175         * UIProcess/WebProcessPool.cpp:
176         (WebKit::WebProcessPool::WebProcessPool):
177
178 2020-03-18  Ross Kirsling  <ross.kirsling@sony.com>
179
180         Unreviewed WinCairo build fix following r258665.
181
182         * NetworkProcess/curl/NetworkProcessCurl.cpp:
183         (WebKit::NetworkProcess::clearCacheForAllOrigins): Deleted.
184
185 2020-03-18  Kate Cheney  <katherine_cheney@apple.com>
186
187         Pass isNavigatingToAppBoundDomain for speculative loads, preconnect tasks and downloads
188         https://bugs.webkit.org/show_bug.cgi?id=209246
189         <rdar://problem/60552712>
190
191         Reviewed by Alex Christensen.
192
193         Pass isNavigatingToAppBoundDomain in 4 new places:
194
195         1) Speculative Loads
196         2) Preconnect Tasks
197         3) Downloads
198         4) CORS preflight checker
199
200         These loads should happen in an app-bound session if isNavigatingToAppBoundDomain
201         is true.
202
203         * NetworkProcess/Downloads/DownloadManager.cpp:
204         (WebKit::DownloadManager::startDownload):
205         * NetworkProcess/Downloads/DownloadManager.h:
206         (WebKit::DownloadManager::startDownload):
207         * NetworkProcess/Downloads/PendingDownload.cpp:
208         (WebKit::PendingDownload::PendingDownload):
209         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
210         (WebKit::NetworkConnectionToWebProcess::startDownload):
211         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
212         * NetworkProcess/NetworkConnectionToWebProcess.h:
213         (WebKit::NetworkConnectionToWebProcess::startDownload):
214         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
215         * NetworkProcess/NetworkProcess.cpp:
216         (WebKit::NetworkProcess::preconnectTo):
217         (WebKit::NetworkProcess::downloadRequest):
218         * NetworkProcess/NetworkProcess.h:
219         * NetworkProcess/NetworkProcess.messages.in:
220         * NetworkProcess/NetworkResourceLoader.cpp:
221         (WebKit::NetworkResourceLoader::start):
222         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
223         (WebKit::NetworkResourceLoader::convertToDownload):
224         * NetworkProcess/PreconnectTask.cpp:
225         * NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp:
226         (WebKit::ServiceWorkerSoftUpdateLoader::ServiceWorkerSoftUpdateLoader):
227         The service worker script should be considered an app-bound load.
228
229         * NetworkProcess/cache/AsyncRevalidation.cpp:
230         (WebKit::NetworkCache::AsyncRevalidation::AsyncRevalidation):
231         * NetworkProcess/cache/AsyncRevalidation.h:
232         * NetworkProcess/cache/NetworkCache.cpp:
233         (WebKit::NetworkCache::Cache::startAsyncRevalidationIfNeeded):
234         (WebKit::NetworkCache::Cache::retrieve):
235         * NetworkProcess/cache/NetworkCache.h:
236         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
237         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
238         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
239         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
240         (WebKit::NetworkCache::SpeculativeLoadManager::registerLoad):
241         (WebKit::NetworkCache::SpeculativeLoadManager::preconnectForSubresource):
242         (WebKit::NetworkCache::SpeculativeLoadManager::revalidateSubresource):
243         (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
244         (WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
245         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
246         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
247         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
248         (WebKit::NetworkSessionCocoa::sessionWrapperForTask):
249         * Shared/NavigatingToAppBoundDomain.h:
250         Separates NavigatingToAppBoundDomain to its own file to allow for
251         sending over IPC.
252
253         * Shared/PolicyDecision.h:
254         * UIProcess/Network/NetworkProcessProxy.cpp:
255         (WebKit::NetworkProcessProxy::preconnectTo):
256         * UIProcess/Network/NetworkProcessProxy.h:
257         * UIProcess/WebPageProxy.cpp:
258         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
259         (WebKit::WebPageProxy::preconnectTo):
260         * UIProcess/WebPageProxy.h:
261         (WebKit::WebPageProxy::isNavigatingToAppBoundDomain const):
262         * UIProcess/WebProcessPool.cpp:
263         (WebKit::WebProcessPool::download):
264         * WebKit.xcodeproj/project.pbxproj:
265         * WebProcess/Network/WebLoaderStrategy.cpp:
266         (WebKit::WebLoaderStrategy::preconnectTo):
267         * WebProcess/WebPage/WebFrame.cpp:
268         (WebKit::WebFrame::startDownload):
269         (WebKit::WebFrame::convertMainResourceLoadToDownload):
270
271 2020-03-18  Sihui Liu  <sihui_liu@apple.com>
272
273         Remove unused IPC message NetworkProcess::ClearCacheForAllOrigins
274         https://bugs.webkit.org/show_bug.cgi?id=209152
275         <rdar://problem/59681717>
276
277         Reviewed by Chris Dumez.
278
279         * NetworkProcess/NetworkProcess.h:
280         * NetworkProcess/NetworkProcess.messages.in:
281         * NetworkProcess/ios/NetworkProcessIOS.mm:
282         (WebKit::NetworkProcess::clearCacheForAllOrigins): Deleted.
283         * NetworkProcess/mac/NetworkProcessMac.mm:
284         (WebKit::NetworkProcess::clearCacheForAllOrigins): Deleted.
285         * NetworkProcess/soup/NetworkProcessSoup.cpp:
286         (WebKit::NetworkProcess::clearCacheForAllOrigins): Deleted.
287         * Shared/ResourceCachesToClear.h: Removed.
288         * UIProcess/API/C/WKAPICast.h:
289         (WebKit::toResourceCachesToClear): Deleted.
290         * WebKit.xcodeproj/project.pbxproj:
291         * WebProcess/WebProcess.cpp:
292         (WebKit::WebProcess::clearResourceCaches): Deleted.
293         * WebProcess/WebProcess.h:
294
295 2020-03-18  youenn fablet  <youenn@apple.com>
296
297         WebPage should own a Ref<WebFrame>
298         https://bugs.webkit.org/show_bug.cgi?id=209235
299
300         Reviewed by Geoffrey Garen.
301
302         Update code since m_mainFrame is now a Ref and no longer a RefPtr.
303
304         Update WebPage constructor to set its m_mainFrame very early.
305         We update WebPage::didCompletePageTransition to compute whether this is initialization or not using the frame state machine state
306         instead of m_mainFrame being null.
307
308         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
309         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
310         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
311         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
312         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
313         (WebKit::WebAutomationSessionProxy::resolveParentFrame):
314         (WebKit::WebAutomationSessionProxy::focusFrame):
315         (WebKit::WebAutomationSessionProxy::computeElementLayout):
316         (WebKit::WebAutomationSessionProxy::selectOptionElement):
317         (WebKit::WebAutomationSessionProxy::setFilesForInputFileUpload):
318         (WebKit::WebAutomationSessionProxy::takeScreenshot):
319         (WebKit::WebAutomationSessionProxy::snapshotRectForScreenshot):
320         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
321         (WebKit::WebAutomationSessionProxy::deleteCookie):
322         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
323         (WKBundlePageGetMainFrame):
324         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
325         (WebKit::findLargestFrameInFrameSet):
326         (WebKit::WebChromeClient::closeWindowSoon):
327         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
328         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
329         (WebKit::WebFrameLoaderClient::dispatchDidLayout):
330         (WebKit::WebFrameLoaderClient::restoreViewState):
331         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
332         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
333         (WebKit::ViewGestureGeometryCollector::collectGeometryForMagnificationGesture):
334         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
335         (WebKit::WebBackForwardListProxy::goToItem):
336         * WebProcess/WebPage/WebPage.cpp:
337         (WebKit::WebPage::WebPage):
338         (WebKit::m_processDisplayName):
339         (WebKit::WebPage::close):
340         (WebKit::WebPage::suspendForProcessSwap):
341         (WebKit::WebPage::loadDataInFrame):
342         (WebKit::WebPage::loadRequest):
343         (WebKit::WebPage::reload):
344         (WebKit::WebPage::didCompletePageTransition):
345         (WebKit::WebPage::runJavaScriptInFrameInScriptWorld):
346         (WebKit::WebPage::setIsSuspended):
347         (WebKit::WebPage::didLoadFromRegistrableDomain):
348         * WebProcess/WebPage/WebPage.h:
349         (WebKit::WebPage::mainWebFrame const):
350         * WebProcess/WebPage/ios/WebPageIOS.mm:
351         (WebKit::WebPage::cancelPotentialTap):
352         * WebProcess/cocoa/WebProcessCocoa.mm:
353         (WebKit::origin):
354
355 2020-03-18  Wenson Hsieh  <wenson_hsieh@apple.com>
356
357         REGRESSION (r257214): Targeted preview animates to the wrong place when dropping in editable content
358         https://bugs.webkit.org/show_bug.cgi?id=209218
359         <rdar://problem/60560831>
360
361         Reviewed by Tim Horton.
362
363         In r257214, we split out the context menu hint preview container view into two views: one for drag and drop, and
364         another for the context menu hint. The container view used for both drag and drop previews was removed under
365         -cleanUpDragSourceSessionState, which is invoked after both drag and drop sessions have ended; however, in the
366         case of a drop in editable content where the drop preview is delayed, the drop animation can end up finishing
367         after -cleanUpDragSourceSessionState is invoked. This means we end up prematurely unparenting the preview
368         container, which results in a broken drop animation.
369
370         To fix this, split the drag and drop container views further, into separate container views for dragging and for
371         dropping. The drag preview container will continue to be removed under -cleanUpDragSourceSessionState, and the
372         drop preview container will now be removed under the delegate call to -dropInteraction:concludeDrop:, which is
373         invoked by UIKit after all drop previews are finished animating.
374
375         Covered by adding additional test assertions while running existing API tests (see Tools/ChangeLog for more
376         details).
377
378         * UIProcess/ios/WKContentViewInteraction.h:
379         * UIProcess/ios/WKContentViewInteraction.mm:
380         (-[WKContentView _createPreviewContainerWithLayerName:]):
381
382         Pull out common logic for creating and setting up a preview container view into a helper method. This is used by
383         the three methods below, which ensure container views for each of the types of previews we create when showing
384         the context menu, dragging an element, and dropping.
385
386         (-[WKContentView containerForDropPreviews]):
387         (-[WKContentView containerForDragPreviews]):
388         (-[WKContentView containerForContextMenuHintPreviews]):
389
390         Add a third preview container view for drop previews, and factor duplicated code in these three methods into a
391         common helper (see above).
392
393         (-[WKContentView _hideTargetedPreviewContainerViews]):
394         (-[WKContentView _deliverDelayedDropPreviewIfPossible:]):
395
396         Instead of using the container for drag previews, use the container for drop previews.
397
398         (-[WKContentView dropInteraction:concludeDrop:]):
399
400         Remove the drop preview container after the drop has concluded (i.e. all animations are complete).
401
402 2020-03-18  Chris Dumez  <cdumez@apple.com>
403
404         Unreviewed, fix iOS build with recent SDKs.
405
406         * Platform/cocoa/PaymentAuthorizationViewController.mm:
407
408 2020-03-18  Megan Gardner  <megan_gardner@apple.com>
409
410         Remove unneeded and incorrect respondsToSelector checks.
411         https://bugs.webkit.org/show_bug.cgi?id=209208
412         <rdar://problem/60512470>
413
414         Reviewed by Tim Horton.
415
416         No behaviour change, no tests needed.
417
418         * UIProcess/ios/WKContentViewInteraction.mm:
419         (-[WKContentView continueContextMenuInteractionWithDataDetectors:]):
420
421 2020-03-18  Brent Fulgham  <bfulgham@apple.com>
422
423         Switch from debug ASSERT to RELEASE_ASSERT in toNPObjectProxy
424         https://bugs.webkit.org/show_bug.cgi?id=209212
425         <rdar://problem/59595502>
426
427         Reviewed by Alex Christensen.
428
429         * Shared/Plugins/NPObjectProxy.h:
430         (WebKit::NPObjectProxy::toNPObjectProxy):
431
432 2020-03-18  Brent Fulgham  <bfulgham@apple.com>
433
434         Switch to release asserts for MediaDeviceSandboxExtension class
435         https://bugs.webkit.org/show_bug.cgi?id=209211
436         <rdar://problem/59595299>
437
438         Reviewed by Eric Carlson.
439
440         Switch from debug ASSERT to RELEASE_ASSERT.
441
442         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp:
443         (WebKit::MediaDeviceSandboxExtensions::MediaDeviceSandboxExtensions):
444         (WebKit::MediaDeviceSandboxExtensions::operator[]):
445
446 2020-03-18  Brent Fulgham  <bfulgham@apple.com>
447
448         Switch from debug ASSERT to RELEASE_ASSERT in PluginQuirks.h
449         https://bugs.webkit.org/show_bug.cgi?id=209213
450         <rdar://problem/59595834>
451
452         Reviewed by Alex Christensen.
453
454         * Shared/Plugins/PluginQuirks.h:
455         (WebKit::PluginQuirks::add):
456
457 2020-03-18  youenn fablet  <youenn@apple.com>
458
459         REGRESSION (r257472): Can't start old Safari with new WebKit (dyld: Symbol not found: _WKContextConfigurationSetShouldCaptureAudioInUIProcess)
460         https://bugs.webkit.org/show_bug.cgi?id=209155
461
462         Reviewed by Eric Carlson.
463
464         Add a no-op WKContextConfigurationSetShouldCaptureAudioInUIProcess to allow latest WebKit being run on older Safari.
465
466         * UIProcess/API/C/WKContextConfigurationRef.cpp:
467         (WKContextConfigurationSetShouldCaptureAudioInUIProcess):
468         * UIProcess/API/C/WKContextConfigurationRef.h:
469
470 2020-03-18  youenn fablet  <youenn@apple.com>
471
472         FrameLoader should own its FrameLoaderClient
473         https://bugs.webkit.org/show_bug.cgi?id=208918
474
475         Reviewed by Geoff Garen.
476
477         Pass a UniqueRef to the PageConfiguration.
478         Update WebFrameLoaderClient according updated FrameLoaderClient interface.
479
480         WebFrame no longer needs to ref/unref itself to keep the loader client alive.
481         Update WebFrame construction to not need a static_cast at initialization of the main frame.
482
483         The ownership is now that a WebCore::FrameLoader owns a FrameLoaderClient who owns a WebFrame.
484
485         * WebProcess/Network/WebLoaderStrategy.cpp:
486         (WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler):
487         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
488         (WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
489         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
490         (WebKit::WebLoaderStrategy::startPingLoad):
491         (WebKit::WebLoaderStrategy::preconnectTo):
492         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
493         (WebKit::WebSWContextManagerConnection::installServiceWorker):
494         * WebProcess/Storage/WebSWContextManagerConnection.h:
495         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
496         (WebKit::WebFrameLoaderClient::WebFrameLoaderClient):
497         (WebKit::WebFrameLoaderClient::~WebFrameLoaderClient):
498         (WebKit::WebFrameLoaderClient::webPageProxyID const):
499         (WebKit::WebFrameLoaderClient::pageID const):
500         (WebKit::WebFrameLoaderClient::frameID const):
501         (WebKit::WebFrameLoaderClient::detachedFromParent2):
502         (WebKit::WebFrameLoaderClient::assignIdentifierToInitialRequest):
503         (WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
504         (WebKit::WebFrameLoaderClient::shouldUseCredentialStorage):
505         (WebKit::WebFrameLoaderClient::dispatchDidReceiveResponse):
506         (WebKit::WebFrameLoaderClient::dispatchDidReceiveContentLength):
507         (WebKit::WebFrameLoaderClient::dispatchDidFinishLoading):
508         (WebKit::WebFrameLoaderClient::dispatchDidFailLoading):
509         (WebKit::WebFrameLoaderClient::dispatchDidDispatchOnloadEvents):
510         (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
511         (WebKit::WebFrameLoaderClient::dispatchDidCancelClientRedirect):
512         (WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect):
513         (WebKit::WebFrameLoaderClient::dispatchDidChangeLocationWithinPage):
514         (WebKit::WebFrameLoaderClient::dispatchDidPushStateWithinPage):
515         (WebKit::WebFrameLoaderClient::dispatchDidReplaceStateWithinPage):
516         (WebKit::WebFrameLoaderClient::dispatchDidPopStateWithinPage):
517         (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):
518         (WebKit::WebFrameLoaderClient::dispatchDidReceiveTitle):
519         (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
520         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
521         (WebKit::WebFrameLoaderClient::dispatchDidFailLoad):
522         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
523         (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad):
524         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
525         (WebKit::WebFrameLoaderClient::dispatchDidLayout):
526         (WebKit::WebFrameLoaderClient::dispatchShow):
527         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
528         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
529         (WebKit::WebFrameLoaderClient::applyToDocumentLoader):
530         (WebKit::WebFrameLoaderClient::allowsContentJavaScriptFromMostRecentNavigation const):
531         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
532         (WebKit::WebFrameLoaderClient::dispatchUnableToImplementPolicy):
533         (WebKit::WebFrameLoaderClient::dispatchWillSendSubmitEvent):
534         (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
535         (WebKit::WebFrameLoaderClient::willReplaceMultipartContent):
536         (WebKit::WebFrameLoaderClient::didReplaceMultipartContent):
537         (WebKit::WebFrameLoaderClient::didDisplayInsecureContent):
538         (WebKit::WebFrameLoaderClient::didRunInsecureContent):
539         (WebKit::WebFrameLoaderClient::didDetectXSS):
540         (WebKit::WebFrameLoaderClient::cancelledError const):
541         (WebKit::WebFrameLoaderClient::blockedError const):
542         (WebKit::WebFrameLoaderClient::blockedByContentBlockerError const):
543         (WebKit::WebFrameLoaderClient::cannotShowURLError const):
544         (WebKit::WebFrameLoaderClient::interruptedForPolicyChangeError const):
545         (WebKit::WebFrameLoaderClient::blockedByContentFilterError const):
546         (WebKit::WebFrameLoaderClient::cannotShowMIMETypeError const):
547         (WebKit::WebFrameLoaderClient::fileDoesNotExistError const):
548         (WebKit::WebFrameLoaderClient::pluginWillHandleLoadError const):
549         (WebKit::WebFrameLoaderClient::shouldFallBack const):
550         (WebKit::WebFrameLoaderClient::restoreViewState):
551         (WebKit::WebFrameLoaderClient::didFinishLoad):
552         (WebKit::WebFrameLoaderClient::userAgent const):
553         (WebKit::WebFrameLoaderClient::createPlugin):
554         (WebKit::WebFrameLoaderClient::webGLPolicyForURL const):
555         (WebKit::WebFrameLoaderClient::resolveWebGLPolicyForURL const):
556         (WebKit::WebFrameLoaderClient::objectContentType):
557         (WebKit::WebFrameLoaderClient::overrideMediaType const):
558         (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld):
559         (WebKit::WebFrameLoaderClient::dispatchGlobalObjectAvailable):
560         (WebKit::WebFrameLoaderClient::willInjectUserScript):
561         (WebKit::WebFrameLoaderClient::willCacheResponse const):
562         (WebKit::WebFrameLoaderClient::createNetworkingContext):
563         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
564         * WebProcess/WebPage/WebFrame.cpp:
565         (WebKit::WebFrame::initWithCoreMainFrame):
566         (WebKit::WebFrame::createSubframe):
567         (WebKit::WebFrame::WebFrame):
568         (WebKit::WebFrame::frameLoaderClient const):
569         (WebKit::WebFrame::fromCoreFrame):
570         (WebKit::WebFrame::didReceivePolicyDecision):
571         * WebProcess/WebPage/WebFrame.h:
572         (WebKit::WebFrame::create):
573         * WebProcess/WebPage/WebPage.cpp:
574         (WebKit::m_processDisplayName):
575
576 2020-03-17  David Kilzer  <ddkilzer@apple.com>
577
578         SharedMemory::Handle::m_size should be more consistent
579         <https://webkit.org/b/209007>
580         <rdar://problem/60340890>
581
582         Reviewed by Darin Adler.
583
584         * Platform/cocoa/SharedMemoryCocoa.cpp:
585         (WebKit::SharedMemory::Handle::decode):
586         - Return early if an invalid `size` is decoded.
587         (WebKit::SharedMemory::map):
588         - Drive-by fix to change '0' to 'nullptr'.
589         - Since all known methods of creating a SharedMemory::Handle()
590           set SharedMemory::Handle::m_size to a value of round_page(),
591           this means we can also change `round_page(handle.m_size)` to
592           `handle.m_size` in the call to mach_vm_map() since we know
593           they're equal.
594
595 2020-03-17  Commit Queue  <commit-queue@webkit.org>
596
597         Unreviewed, reverting r258496.
598         https://bugs.webkit.org/show_bug.cgi?id=209217
599
600         Introduced sandbox regression (Requested by perarne on
601         #webkit).
602
603         Reverted changeset:
604
605         "[iOS] Add telemetry for message filtering"
606         https://bugs.webkit.org/show_bug.cgi?id=208925
607         https://trac.webkit.org/changeset/258496
608
609 2020-03-17  Kate Cheney  <katherine_cheney@apple.com>
610
611         Expand In-App-Browser-Privacy testing
612         https://bugs.webkit.org/show_bug.cgi?id=209142
613         <rdar://problem/60496618>
614
615         Reviewed by Darin Adler.
616
617         Adds a testing API to check whether a navigation was classified as
618         app-bound.
619
620         * UIProcess/API/Cocoa/WKWebView.mm:
621         (-[WKWebView _isNavigatingToAppBoundDomain:]):
622         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
623         * UIProcess/WebPageProxy.cpp:
624         (WebKit::WebPageProxy::isNavigatingToAppBoundDomainTesting):
625         * UIProcess/WebPageProxy.h:
626
627 2020-03-17  Alex Christensen  <achristensen@webkit.org>
628
629         Fix API tests after r258574
630         https://bugs.webkit.org/show_bug.cgi?id=209192
631
632         * UIProcess/WebPageProxy.cpp:
633         (WebKit::WebPageProxy::printFrame):
634         I forgot to call the CompletionHandler from the IPC call.
635
636 2020-03-17  Jiewen Tan  <jiewen_tan@apple.com>
637
638         WebKit::LocalAuthenticator::deleteDuplicateCredential() should check buffer size before memcmp
639         https://bugs.webkit.org/show_bug.cgi?id=209156
640         <rdar://problem/60444655>
641
642         Reviewed by Alex Christensen.
643
644         Covered by existing tests.
645
646         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
647         (WebKit::LocalAuthenticator::deleteDuplicateCredential const):
648
649 2020-03-17  Kate Cheney  <katherine_cheney@apple.com>
650
651        Add internal debugging when initializing an app-bound session
652        https://bugs.webkit.org/show_bug.cgi?id=209190
653        <rdar://problem/60371620>
654
655         Reviewed by Brent Fulgham.
656
657         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
658         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
659         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
660         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
661         (WebKit::SessionWrapper::initialize):
662         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
663         (WebKit::NetworkSessionCocoa::initializeEphemeralStatelessSession):
664         (WebKit::NetworkSessionCocoa::sessionWrapperForTask):
665         (WebKit::NetworkSessionCocoa::appBoundSession):
666         (WebKit::NetworkSessionCocoa::isolatedSession):
667
668 2020-03-17  John Wilander  <wilander@apple.com>
669
670         Add quirk for cookie blocking latch mode ymail.com redirecting to yahoo.com under yahoo.com
671         https://bugs.webkit.org/show_bug.cgi?id=209193
672         <rdar://problem/60089022>
673
674         Reviewed by Brent Fulgham.
675
676         No new tests. Site-specific quirk tested manually on the site in question.
677
678         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
679         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
680         (WebKit::NetworkDataTaskCocoa::unblockCookies):
681         (WebKit::NetworkDataTaskCocoa::needsFirstPartyCookieBlockingLatchModeQuirk const):
682         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
683
684 2020-03-17  Brian Burg  <bburg@apple.com>
685
686         REGRESSION(r256882): WebDriver commands that run before initial navigation do not complete
687         https://bugs.webkit.org/show_bug.cgi?id=209185
688         <rdar://problem/60010248>
689
690         Reviewed by Brian Weinstein.
691
692         No new tests, covered by w3c/webdriver/tests/back/back.py.
693
694         * UIProcess/Automation/WebAutomationSession.cpp:
695         (WebKit::WebAutomationSession::createBrowsingContext):
696         Force eager creation of WebProcess when a browsing context is created. This allows
697         all subsequent commands that use WebProcess IPC to proceed instead of hanging.
698
699 2020-03-17  Alex Christensen  <achristensen@webkit.org>
700
701         Fix GTK build.
702         https://bugs.webkit.org/show_bug.cgi?id=209192
703
704         * UIProcess/API/glib/WebKitUIClient.cpp:
705         I committed r258574 too fast.
706
707 2020-03-17  Alex Christensen  <achristensen@webkit.org>
708
709         Add WKUIDelegatePrivate SPI _webView:printFrame:completionHandler:
710         https://bugs.webkit.org/show_bug.cgi?id=209192
711         <rdar://problem/51313336>
712
713         Reviewed by Geoff Garen.
714
715         This is just like the existing _webView:printFrame: but you tell it when you're done instead of just returning.
716         Covered by API tests.
717
718         * UIProcess/API/APIUIClient.h:
719         (API::UIClient::printFrame):
720         * UIProcess/API/C/WKPage.cpp:
721         (WKPageSetPageUIClient):
722         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
723         * UIProcess/Cocoa/UIDelegate.h:
724         * UIProcess/Cocoa/UIDelegate.mm:
725         (WebKit::UIDelegate::setDelegate):
726         (WebKit::UIDelegate::UIClient::printFrame):
727         * UIProcess/WebPageProxy.cpp:
728         (WebKit::WebPageProxy::printFrame):
729
730 2020-03-17  David Kilzer  <ddkilzer@apple.com>
731
732         REGRESSION (r258334): WebPasteboardProxy::setPasteboardBufferForType should allow zero-size buffers
733         <https://webkit.org/b/209167>
734         <rdar://problem/60516302>
735
736         Reviewed by Geoffrey Garen.
737
738         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
739         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
740         - Remove check for zero-size buffer to match
741           WebPageProxy::dataSelectionForPasteboard().
742
743 2020-03-17  Brent Fulgham  <bfulgham@apple.com>
744
745         Terminate the WebContent process when receiving invalid IPC from a WebInspector session
746         https://bugs.webkit.org/show_bug.cgi?id=209157
747         <rdar://problem/58961055>
748
749         Reviewed by Chris Dumez.
750
751         * UIProcess/WebPageProxy.cpp:
752         (WebKit::WebPageProxy::backForwardGoToItemShared): Add a message check that we are not receiving
753         the request from a WebInspector page.
754         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle): Switch to a release assert.
755
756 2020-03-17  Per Arne Vollan  <pvollan@apple.com>
757
758         [Cocoa] Disable CF prefs direct mode
759         https://bugs.webkit.org/show_bug.cgi?id=209166
760         <rdar://problem/60517387>
761
762         Reviewed by Brent Fulgham.
763
764         Revert <https://trac.webkit.org/changeset/258064> by disabling the CF prefs direct mode feature,
765         since it caused performance regressions.
766
767         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
768         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
769         (WebKit::XPCServiceMain):
770         * UIProcess/Cocoa/PreferenceObserver.mm:
771         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
772         (WebKit::WebPageProxy::grantAccessToPreferenceService):
773         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
774         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
775         * UIProcess/WebProcessPool.h:
776         * UIProcess/WebProcessProxy.h:
777         * WebProcess/WebProcess.h:
778         * WebProcess/WebProcess.messages.in:
779
780 2020-03-17  Commit Queue  <commit-queue@webkit.org>
781
782         Unreviewed, reverting r258339.
783         https://bugs.webkit.org/show_bug.cgi?id=209179
784
785         "Is it sometimes breaking rendering" (Requested by youenn on
786         #webkit).
787
788         Reverted changeset:
789
790         "FrameLoader should own its FrameLoaderClient"
791         https://bugs.webkit.org/show_bug.cgi?id=208918
792         https://trac.webkit.org/changeset/258339
793
794 2020-03-16  Simon Fraser  <simon.fraser@apple.com>
795
796         Add a bit more UIHitTesting logging, and make it possible to dump EventRegions from WebKit
797         https://bugs.webkit.org/show_bug.cgi?id=209058
798
799         Reviewed by Antti Koivisto.
800
801         Add a UIHitTesting log.
802
803         * UIProcess/ios/WKContentViewInteraction.mm:
804         (-[WKContentView gestureRecognizer:shouldReceiveTouch:]):
805
806 2020-03-16  Chris Dumez  <cdumez@apple.com>
807
808         Crash under WebCookieCache::clearForHost()
809         https://bugs.webkit.org/show_bug.cgi?id=209149
810         <rdar://problem/60453086>
811
812         Reviewed by Darin Adler.
813
814         Alternative fix for Bug 209149 based on comments from Darin.
815
816         * WebProcess/WebPage/WebCookieCache.cpp:
817         (WebKit::WebCookieCache::clearForHost):
818         (WebKit::WebCookieCache::pruneCacheIfNecessary):
819
820 2020-03-16  Tim Horton  <timothy_horton@apple.com>
821
822         Fix the macCatalyst build after r258525
823
824         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
825         (WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions):
826
827 2020-03-15  Darin Adler  <darin@apple.com>
828
829         Move most of TextIterator off of live ranges
830         https://bugs.webkit.org/show_bug.cgi?id=209129
831
832         Reviewed by Antti Koivisto.
833
834         * WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm:
835         (-[WKDOMTextIterator initWithRange:]): Leave _textIterator as a nullptr
836         if the passed-in range is nil since we no longer offer a way to create
837         an empty TextIterator; other clients don't seem to need one.
838         (-[WKDOMTextIterator advance]): Add a null check.
839         (-[WKDOMTextIterator atEnd]): Ditto.
840         (-[WKDOMTextIterator currentRange]): Ditto.
841         (-[WKDOMTextIterator currentTextPointer]): Ditto.
842         (-[WKDOMTextIterator currentTextLength]): Ditto.
843
844         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm: Removed include.
845
846         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
847         (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales): Pass
848         a reference to a range known not to be null.
849
850         * WebProcess/WebPage/WebPage.cpp: Removed an include.
851
852         * WebProcess/WebPage/ios/WebPageIOS.mm: Removed a "using naemsapce WebCore".
853         Added two local functions
854         (WebKit::plainTextForContext): Added. Helper for just this file where calling
855         plainTextReplacingNoBreakSpace on a possibly null Range is common.
856         (WebKit::plainTextForDisplay): Ditto. This one passes true for isDisplayString.
857         Not entirely clear how carefully we chose which of the two to call, or if there
858         is sufficient test coverage.
859         (WebKit::WebPage::platformEditorState const): Use plainTextForContext
860         and plainTextForDisplay.
861         (WebKit::WebPage::getSelectionContext): Ditto.
862         (WebKit::WebPage::getRectsAtSelectionOffsetWithText): Use plainTextForDisplay.
863         (WebKit::WebPage::requestDictationContext): Use plainTextForContext.
864         (WebKit::WebPage::replaceSelectedText): Ditto.
865         (WebKit::WebPage::replaceDictatedText): Ditto.
866         (WebKit::WebPage::requestAutocorrectionData): Ditto.
867         (WebKit::WebPage::applyAutocorrectionInternal): Ditto.
868         (WebKit::WebPage::autocorrectionContext): Ditto.
869         (WebKit::dataDetectorLinkPositionInformation): Use plainTextForDisplay.
870         (WebKit::WebPage::requestDocumentEditingContext): Use RetainPtr instead of
871         autorelease. Use makeBoundaryPoint to convert Position objects to SimpleRange.
872
873 2020-03-16  Chris Dumez  <cdumez@apple.com>
874
875         Crash under WebCookieCache::clearForHost()
876         https://bugs.webkit.org/show_bug.cgi?id=209149
877         <rdar://problem/60453086>
878
879         Reviewed by Alex Christensen.
880
881         Make sure WebCookieCache::pruneCacheIfNecessary() keeps alive the host String it is passing
882         to WebCookieCache::clearForHost(). Previously, it was merely deferencing a HashSet iterator
883         and passing that to clearForHost(). However, clearForHost() would then drop the String from
884         the HashSet and the host would no longer be valid.
885
886         Change covered by new API test.
887
888         * WebProcess/WebPage/WebCookieCache.cpp:
889         (WebKit::WebCookieCache::pruneCacheIfNecessary):
890
891 2020-03-16  Per Arne Vollan  <pvollan@apple.com>
892
893         [macOS] Accessibility sandbox regressions
894         https://bugs.webkit.org/show_bug.cgi?id=209065
895         <rdar://problem/60202450>
896
897         Reviewed by Brent Fulgham.
898
899         When Accessibility is enabled, the WebContent process needs access to the preference service, since Accessibility
900         is relying on some advanced features of the service. Also, when CF prefs direct mode is enabled, the WebContent
901         sandbox needs to explicitly allow reading of the various plist files.
902
903         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
904         (WebKit::WebProcessPool::registerNotificationObservers):
905         * WebProcess/com.apple.WebProcess.sb.in:
906
907 2020-03-16  Per Arne Vollan  <pvollan@apple.com>
908
909         [Cocoa] Crash under -[WKPreferenceObserver init]
910         https://bugs.webkit.org/show_bug.cgi?id=209145
911
912         Reviewed by Darin Adler.
913
914         Handle the case when calling [NSUserDefaults initWithSuiteName:] did not succeed.
915
916         No new tests, since I have not been able to reproduce.
917
918         * UIProcess/Cocoa/PreferenceObserver.mm:
919         (-[WKPreferenceObserver init]):
920
921 2020-03-16  Brent Fulgham  <bfulgham@apple.com>
922
923         Remove unused IPC messages from DrawingAreaProxy
924         https://bugs.webkit.org/show_bug.cgi?id=209090
925         <rdar://problem/60333300>
926
927         Reviewed by Wenson Hsieh.
928
929         Do not compile the following three unused messages in DrawingAreaProxy when
930         building for a Cocoa platform target.
931
932         DrawingAreaProxy::Update
933         DrawingAreaProxy::DidUpdateBackingStoreState
934         DrawingAreaProxy::ExitAcceleratedCompositingMode
935
936         * UIProcess/DrawingAreaProxy.h:
937         (WebKit::DrawingAreaProxy::enterAcceleratedCompositingMode):
938         (WebKit::DrawingAreaProxy::update):
939         (WebKit::DrawingAreaProxy::didUpdateBackingStoreState):
940         (WebKit::DrawingAreaProxy::exitAcceleratedCompositingMode):
941         * UIProcess/DrawingAreaProxy.messages.in:
942         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
943         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
944         (WebKit::TiledCoreAnimationDrawingAreaProxy::exitAcceleratedCompositingMode): Deleted.
945
946 2020-03-16  Per Arne Vollan  <pvollan@apple.com>
947
948         [Cocoa] Only set CF prefs direct mode for the WebContent process
949         https://bugs.webkit.org/show_bug.cgi?id=209091
950         <rdar://problem/60337842>
951
952         Reviewed by Brent Fulgham.
953
954         Currently, we enable CF prefs direct mode in XPCServiceMain. This is incorrect, it should only be enabled
955         for the WebContent process.
956
957         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
958         (WebKit::XPCServiceMain):
959
960 2020-03-16  David Kilzer  <ddkilzer@apple.com>
961
962         WebPage::GetDataSelectionForPasteboard should validate its `size` variable
963         <https://webkit.org/b/209092>
964         <rdar://problem/60181345>
965
966         Reviewed by Brent Fulgham.
967
968         * Platform/IPC/Connection.h:
969         (MESSAGE_CHECK_WITH_RETURN_VALUE_BASE): Add.
970         - Variant of MESSAGE_CHECK_BASE() that takes a return value.
971         * UIProcess/mac/WebPageProxyMac.mm:
972         (MESSAGE_CHECK_WITH_RETURN_VALUE): Add.
973         (WebKit::WebPageProxy::dataSelectionForPasteboard):
974         - Use new MESSAGE_CHECK_WITH_RETURN_VALUE() macro to update
975           check for handle.isNull() and to add check for `size`
976           variable.
977         - Add static_cast<size_t>() to `size` variable to denote type
978           change.
979
980 2020-03-16  Youenn Fablet  <youenn@apple.com>
981
982         Apply rotation at source level if WebRTC sink ask so
983         https://bugs.webkit.org/show_bug.cgi?id=205645
984
985         Reviewed by Eric Carlson.
986
987         Implement RealtimeMediaSource setShouldApplyRotation by sending IPC to capture process.
988         In capture process, if rotation should be applied, use an ImageRotationSessionVT session to apply it before sending the video frame.
989         This allows WebProcess to no longer need an ImageRotationSessionVT for WebRTC.
990
991         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
992         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::setShouldApplyRotation):
993         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::rotatePixelBuffer):
994         (WebKit::UserMediaCaptureManagerProxy::setShouldApplyRotation):
995         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
996         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
997         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
998         (WebKit::UserMediaCaptureManager::Source::setShouldApplyRotation):
999
1000         * WebProcess/WebPage/mac/WebPageMac.mm: Removed an include.
1001
1002 2020-03-13  Sergio Villar Senin  <svillar@igalia.com>
1003
1004         [WebXR] IDLs, stubs and build configuration for WPE
1005         https://bugs.webkit.org/show_bug.cgi?id=208702
1006
1007         Reviewed by Dean Jackson.
1008
1009         Added WebXR to the list of experimental features.
1010
1011         * Configurations/FeatureDefines.xcconfig: Added ENABLE_WEBXR off by default.
1012         * Shared/WebPreferences.yaml: Added WebXR feature.
1013         * Shared/WebPreferencesDefaultValues.cpp:
1014         (WebKit::defaultWebXREnabled): Set WebXR to off by default unless HAVE_SYSTEM_FEATURE_FLAGS.
1015         * Shared/WebPreferencesDefaultValues.h:
1016         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1017         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1018
1019 2020-03-16  Per Arne Vollan  <pvollan@apple.com>
1020
1021         [iOS] Add telemetry for message filtering
1022         https://bugs.webkit.org/show_bug.cgi?id=208925
1023         <rdar://problem/58885485>
1024
1025         Reviewed by Darin Adler.
1026
1027         On iOS, add telemetry for message filtering in the WebContent process' sandbox.
1028
1029         No new tests, no behavior change.
1030
1031         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1032
1033 2020-03-16  Per Arne Vollan  <pvollan@apple.com>
1034
1035         [Cocoa] Limit set of classes that can be decoded when a preference has changed
1036         https://bugs.webkit.org/show_bug.cgi?id=208012
1037
1038         Reviewed by Brent Fulgham.
1039
1040         As a hardening measure, limit the set of ObjectiveC classes that can be decoded in the WebContent process
1041         as a result of a preference change.
1042
1043         API tests: WebKit.PreferenceChangesDictionary
1044                    WebKit.PreferenceChangesData
1045                    WebKit.PreferenceChangesDate
1046
1047         * WebProcess/cocoa/WebProcessCocoa.mm:
1048         (WebKit::WebProcess::notifyPreferencesChanged):
1049
1050 2020-03-16  youenn fablet  <youenn@apple.com>
1051
1052         Unique origins should not be Potentially Trustworthy
1053         https://bugs.webkit.org/show_bug.cgi?id=209049
1054
1055         Reviewed by Darin Adler.
1056
1057         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1058         (WebKit::WebFrameLoaderClient::hasNavigatedAwayFromAppBoundDomain):
1059         We should only check this for the main frame since this is tied to the page.
1060
1061 2020-03-16  Rob Buis  <rbuis@igalia.com>
1062
1063         Simplify ChromeClient.createWindow
1064         https://bugs.webkit.org/show_bug.cgi?id=209123
1065
1066         Reviewed by Darin Adler.
1067
1068         Adapt to API change.
1069
1070         * WebProcess/Inspector/WebInspector.cpp:
1071         (WebKit::WebInspector::openInNewTab):
1072         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1073         (WebKit::WebChromeClient::createWindow):
1074         * WebProcess/WebCoreSupport/WebChromeClient.h:
1075         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1076         (WebKit::WebFrameLoaderClient::dispatchCreatePage):
1077
1078 2020-03-15  Yusuke Suzuki  <ysuzuki@apple.com>
1079
1080         Should not use variable-length-array (VLA)
1081         https://bugs.webkit.org/show_bug.cgi?id=209043
1082
1083         Reviewed by Mark Lam.
1084
1085         * Configurations/Base.xcconfig:
1086         * UIProcess/_WKTouchEventGenerator.mm:
1087         (-[_WKTouchEventGenerator touchDown:touchCount:]):
1088         (-[_WKTouchEventGenerator liftUp:touchCount:]):
1089         (-[_WKTouchEventGenerator moveToPoints:touchCount:duration:]):
1090
1091 2020-03-14  Brady Eidson  <beidson@apple.com>
1092
1093         Fix the "deliver cached ranges" logic in PDFPlugin (and other small cleanups)
1094         https://bugs.webkit.org/show_bug.cgi?id=209097
1095
1096         Reviewed by Tim Hatcher.
1097
1098         Streaming in data always appended to the buffer instead of first growing the buffer.
1099         This wasn't noticed earlier because we often did not grow the buffer for successful range request completion.
1100         But now we often do!
1101         
1102         So this cleans that all up.
1103         
1104         At the same time it revealed other interactions with PDFKit that force us to handle data requests on the main
1105         thread after the document load is complete - Which is fine!
1106
1107         * WebProcess/Plugins/PDF/PDFPlugin.h:
1108         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1109         (WebKit::dataProviderGetBytesAtPositionCallback): If on the main thread (and the document load is complete)
1110           handle the request directly!
1111         (WebKit::PDFPlugin::getResourceBytesAtPositionMainThread):
1112         (WebKit::PDFPlugin::ByteRangeRequest::completeWithAccumulatedData):
1113         (WebKit::PDFPlugin::ensureDataBufferLength):
1114         (WebKit::PDFPlugin::didFail):
1115         (WebKit::PDFPlugin::maybeClearHighLatencyDataProviderFlag):
1116         (WebKit::PDFPlugin::documentDataDidFinishLoading):
1117         (WebKit::PDFPlugin::installPDFDocument):
1118         (WebKit::PDFPlugin::manualStreamDidReceiveData): Grow the buffer instead of append.
1119
1120
1121 2020-03-14  Brent Fulgham  <bfulgham@apple.com>
1122
1123         Add missing checks needed for AppBound Quirk
1124         https://bugs.webkit.org/show_bug.cgi?id=209117
1125         <rdar://problem/60460097>
1126
1127         Reviewed by John Wilander.
1128
1129         The checks for the 'NeedsInAppBrowserPrivacyQuirks' flag added in r258101 was incomplete.
1130         These changes let the WebFrameLoaderClient report the quirk state to WebCore code. 
1131
1132         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1133         (WebKit::WebFrameLoaderClient::needsInAppBrowserPrivacyQuirks): Added.
1134         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1135         * WebProcess/WebPage/WebPage.h:
1136         (WebKit::WebPage::needsInAppBrowserPrivacyQuirks const): Added.
1137
1138 2020-03-10  Darin Adler  <darin@apple.com>
1139
1140         Change all return values in TextIterator header from live ranges to SimpleRange
1141         https://bugs.webkit.org/show_bug.cgi?id=208906
1142
1143         Reviewed by Antti Koivisto.
1144
1145         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: Removed unneeded include of
1146         TextIterator.h.
1147
1148         * WebProcess/WebPage/ios/WebPageIOS.mm:
1149         (WebKit::rangeNearPositionMatchesText): Removed unused originalRange argument,
1150         changed return type to Optional<SimpleRange> since findClosestPlainText now
1151         returns a SimpleRange.
1152         (WebKit::WebPage::getRectsAtSelectionOffsetWithText): Updated since
1153         rangeNearPositionMatchesText now returns Optional<SimpleRange>, use createLiveRange.
1154         (WebKit::WebPage::requestDocumentEditingContext): Updated since
1155         CharacterIterator::range returns SimpleRange, use createLiveRange.
1156
1157 2020-03-14  Brady Eidson  <beidson@apple.com>
1158
1159         Gather PDF scripts to run on a background thread.
1160         https://bugs.webkit.org/show_bug.cgi?id=209063
1161
1162         Reviewed by Geoff Garen.
1163         
1164         In incremental loading mode, gathering document scripts will sometimes require PDFKit/CG
1165         to lock and wait on data loads from our data provider.
1166         
1167         So if we gather them on the main thread, we will hang the main thread and therefore deadlock
1168         with our data provider thread/queue.
1169         
1170         So let's gather those scripts on a background thread!
1171
1172         * WebProcess/Plugins/PDF/PDFPlugin.h:
1173         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1174         (WebKit::PDFPlugin::threadEntry):
1175         (WebKit::PDFPlugin::ByteRangeRequest::completeWithAccumulatedData):
1176         (WebKit::PDFPlugin::documentDataDidFinishLoading):
1177         (WebKit::PDFPlugin::installPDFDocument):
1178         (WebKit::PDFPlugin::streamDidFinishLoading):
1179         (WebKit::PDFPlugin::manualStreamDidFinishLoading):
1180         (WebKit::PDFPlugin::tryRunScriptsInPDFDocument): Only actually gathers scripts to execute if there
1181           is a m_pdfDocument and the entire document data finished loading.
1182         (WebKit::PDFPlugin::pdfDocumentDidLoad): Deleted.
1183         (WebKit::PDFPlugin::runScriptsInPDFDocument): Deleted.
1184
1185 2020-03-13  Alex Christensen  <achristensen@webkit.org>
1186
1187         WKWebView._negotiatedLegacyTLS should be correct after back/forward navigations
1188         https://bugs.webkit.org/show_bug.cgi?id=209011
1189         <rdar://problem/59370588>
1190
1191         Reviewed by Youenn Fablet.
1192
1193         * NetworkProcess/NetworkDataTask.cpp:
1194         (WebKit::NetworkDataTask::didReceiveResponse):
1195         * NetworkProcess/NetworkLoad.cpp:
1196         (WebKit::NetworkLoad::notifyDidReceiveResponse):
1197         * UIProcess/WebPageProxy.cpp:
1198         (WebKit::WebPageProxy::usedLegacyTLS): Deleted.
1199         * UIProcess/WebPageProxy.h:
1200         * UIProcess/WebPageProxy.messages.in:
1201         * WebProcess/Network/WebResourceLoader.cpp:
1202         (WebKit::WebResourceLoader::didReceiveResponse):
1203         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1204         (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame):
1205
1206 2020-03-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1207
1208         [watchOS] Don’t display empty text suggestions in Quickboard when editing input fields
1209         https://bugs.webkit.org/show_bug.cgi?id=209089
1210
1211         Reviewed by Tim Horton.
1212
1213         Handle text suggestions that lack `displayText` gracefully in Quickboard by not showing them as AutoFill
1214         candidates. Currently, they are presented as blank collection view cells in Quickboard, which leads to a
1215         confusing user experience.
1216
1217         Test: WKWebViewAutoFillTests.DoNotShowBlankTextSuggestions
1218
1219         * UIProcess/ios/forms/WKFocusedFormControlView.mm:
1220         (-[WKFocusedFormControlView setSuggestions:]):
1221
1222 2020-03-13  Brent Fulgham  <bfulgham@apple.com>
1223
1224         Clean up sandbox violations found during testing
1225         https://bugs.webkit.org/show_bug.cgi?id=209096
1226         <rdar://problem/59931477>
1227
1228         Reviewed by Geoffrey Garen.
1229
1230         Remove telemetry from some items, and allow access to some IOKit properties
1231         needed for media playback on macOS and iOS.
1232
1233         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1234         * WebProcess/com.apple.WebProcess.sb.in:
1235
1236 2020-03-13  Chris Dumez  <cdumez@apple.com>
1237
1238         Unreviewed, drop unused variable in WebPageProxy::backForwardGoToItem().
1239
1240         * UIProcess/WebPageProxy.cpp:
1241
1242 2020-03-13  John Wilander  <wilander@apple.com>
1243
1244         Remove unused code related to removePrevalentDomains()
1245         https://bugs.webkit.org/show_bug.cgi?id=209078
1246         <rdar://problem/59681984>
1247
1248         Reviewed by Brent Fulgham.
1249
1250         The various removePrevalentDomains() functions and its IPC endpoint are unused and should be removed.
1251
1252         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
1253         (WebKit::ResourceLoadStatisticsStore::clearBlockingStateForDomains): Deleted.
1254         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1255         (WebKit::WebResourceLoadStatisticsStore::removePrevalentDomains): Deleted.
1256         (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler): Deleted.
1257         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1258         * NetworkProcess/NetworkProcess.cpp:
1259         (WebKit::NetworkProcess::removePrevalentDomains): Deleted.
1260         * NetworkProcess/NetworkProcess.h:
1261         * NetworkProcess/NetworkProcess.messages.in:
1262
1263 2020-03-13  Myles C. Maxfield  <mmaxfield@apple.com>
1264
1265         [Cocoa] Push applicationSDKVersion() down from WebCore into WTF
1266         https://bugs.webkit.org/show_bug.cgi?id=209030
1267
1268         Reviewed by Simon Fraser.
1269
1270         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1271         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1272         * Shared/WebPreferencesDefaultValues.cpp:
1273         (WebKit::defaultCSSOMViewScrollingAPIEnabled):
1274         * WebProcess/cocoa/WebProcessCocoa.mm:
1275         (WebKit::WebProcess::platformInitializeWebProcess):
1276
1277 2020-03-13  Brent Fulgham  <bfulgham@apple.com>
1278
1279         Remove unused IPC function UserMediaCaptureManagerProxy::SetMuted
1280         https://bugs.webkit.org/show_bug.cgi?id=209087
1281         <rdar://problem/59658963>
1282
1283         Reviewed by Eric Carlson.
1284
1285         Remove the unused UserMediaCaptureManagerProxy message 'SetMuted'.
1286
1287         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1288         (WebKit::UserMediaCaptureManagerProxy::setMuted): Deleted.
1289         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
1290         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
1291
1292 2020-03-13  Brent Fulgham  <bfulgham@apple.com>
1293
1294         Remove unused GetNetworkLoadInformationRequest call
1295         https://bugs.webkit.org/show_bug.cgi?id=209081
1296         <rdar://problem/59659064>
1297
1298         Reviewed by Geoffrey Garen.
1299
1300         Remove dead code associated with an unused IPC message.
1301
1302         * NetworkProcess/NetworkConnectionToWebProcess.h:
1303         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadInformationRequest): Deleted.
1304         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1305
1306 2020-03-13  Jiewen Tan  <jiewen_tan@apple.com>
1307
1308         [WebAuthn] Customize a bit more on the macOS LocalAuthentication prompt
1309         https://bugs.webkit.org/show_bug.cgi?id=208703
1310         <rdar://problem/60136974>
1311
1312         Reviewed by Darin Adler.
1313
1314         On macOS, LocalAuthentication prompt can be shown anywhere that is probably not on top of
1315         our UI clients. Therefore, add a RP ID to the dialog to help users to identify what has
1316         happened. In addition, it removes the password fallback button.
1317
1318         * Platform/spi/Cocoa/LocalAuthenticationSPI.h:
1319         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
1320         (WebKit::LocalAuthenticator::continueMakeCredentialAfterDecidePolicy):
1321         (WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected):
1322         * UIProcess/WebAuthentication/Cocoa/LocalConnection.h:
1323         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
1324         (WebKit::LocalConnection::verifyUser const):
1325         * UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
1326         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
1327         (WebKit::MockLocalConnection::verifyUser const):
1328
1329 2020-03-13  Brent Fulgham  <bfulgham@apple.com>
1330
1331         Remove Unused IPC message PlaybackSessionManagerProxy::PictureInPictureActiveChanged
1332         https://bugs.webkit.org/show_bug.cgi?id=209085
1333         <rdar://problem/59658916>
1334
1335         Reviewed by Geoffrey Garen.
1336
1337         Remove the unused PlaybackSessionManagerProxy message 'PictureInPictureActiveChanged'.
1338
1339         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
1340         * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
1341         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
1342         (WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged): Deleted.
1343
1344 2020-03-13  Kate Cheney  <katherine_cheney@apple.com>
1345
1346         [ iOS and Mac wk2 ] http/tests/in-app-browser-privacy/ tests failing
1347         https://bugs.webkit.org/show_bug.cgi?id=209016
1348         <rdar://problem/60329530> 
1349
1350         Reviewed by Chris Dumez.
1351
1352         This patch adds a function to re-initialize app bound domains for
1353         in-app-browser-privacy tests, since they are only initialized once
1354         when the WebsiteDataStore is created. This causes issues if the tests
1355         are run in parallel with other tests with different app-bound domains.
1356
1357         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1358         (WKWebsiteDataStoreReinitializeAppBoundDomains):
1359         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1360         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1361         (WebKit::WebsiteDataStore::clearAppBoundDomains):
1362         (WebKit::WebsiteDataStore::reinitializeAppBoundDomains):
1363         * UIProcess/WebsiteData/WebsiteDataStore.h:
1364
1365 2020-03-13  Ryan Haddad  <ryanhaddad@apple.com>
1366
1367         Unreviewed, reverting r258391.
1368
1369         Breaks internal builds.
1370
1371         Reverted changeset:
1372
1373         "Apply rotation at source level if WebRTC sink ask so"
1374         https://bugs.webkit.org/show_bug.cgi?id=205645
1375         https://trac.webkit.org/changeset/258391
1376
1377 2020-03-13  Kate Cheney  <katherine_cheney@apple.com>
1378
1379         Report all third party loads on a per-page basis
1380         https://bugs.webkit.org/show_bug.cgi?id=209032
1381         <rdar://problem/60397323>
1382
1383         Reviewed by Chris Dumez.
1384
1385         Test: http/tests/resourceLoadStatistics/loaded-registrable-domains-get-reported.html
1386
1387         Removed IPC to the Network Process asking if a resource load is from
1388         a prevalent domain. This now stores and sends all loaded registrable
1389         domains. This patch is mostly updating naming to reflect this and
1390         deleting the unnecessary code to communicate with the
1391         ResourceLoadStatisticsStore.
1392
1393         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1394         (WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
1395         (WebKit::NetworkConnectionToWebProcess::isPrevalentSubresourceLoad): Deleted.
1396         * NetworkProcess/NetworkConnectionToWebProcess.h:
1397         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1398         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1399         (-[WKWebsiteDataStore _loadedThirdPartyDomainsFor:completionHandler:]):
1400         (-[WKWebsiteDataStore _clearLoadedThirdPartyDomainsFor:]):
1401         (-[WKWebsiteDataStore _getPrevalentDomainsFor:completionHandler:]): Deleted.
1402         (-[WKWebsiteDataStore _clearPrevalentDomainsFor:]): Deleted.
1403         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1404         * UIProcess/WebPageProxy.cpp:
1405         * UIProcess/WebPageProxy.h:
1406         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1407         (WebKit::WebFrameLoaderClient::didLoadFromRegistrableDomain):
1408         (WebKit::WebFrameLoaderClient::addLoadedRegistrableDomain): Deleted.
1409         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1410         * WebProcess/WebPage/WebPage.cpp:
1411         (WebKit::WebPage::didCommitLoad):
1412         (WebKit::WebPage::didLoadFromRegistrableDomain):
1413         Add a check that this is a third party by comparing the target domain
1414         to the main frame domain.
1415
1416         (WebKit::WebPage::loadedThirdPartyDomains):
1417         (WebKit::WebPage::clearLoadedThirdPartyDomains):
1418         (WebKit::WebPage::addLoadedRegistrableDomain): Deleted.
1419         (WebKit::WebPage::getPrevalentDomains): Deleted.
1420         (WebKit::WebPage::clearPrevalentDomains): Deleted.
1421         * WebProcess/WebPage/WebPage.h:
1422         * WebProcess/WebPage/WebPage.messages.in:
1423
1424 2020-03-13  Brent Fulgham  <bfulgham@apple.com>
1425
1426         Remove unused SmartMagnificationController Magnify message
1427         https://bugs.webkit.org/show_bug.cgi?id=209036
1428         <rdar://problem/59678060>
1429
1430         Reviewed by Tim Horton.
1431
1432         Remove the unused Magnify message from the SmartMagnificationController, since this is dead code.
1433
1434         * UIProcess/ios/SmartMagnificationController.h:
1435         * UIProcess/ios/SmartMagnificationController.messages.in:
1436         * UIProcess/ios/SmartMagnificationController.mm:
1437         (WebKit::SmartMagnificationController::magnify): Deleted.
1438
1439 2020-03-13  David Kilzer  <ddkilzer@apple.com>
1440
1441         WebPageProxy::SetPromisedDataForImage should validate its `imageSize` and `archiveSize` parameters
1442         <https://webkit.org/b/209029>
1443         <rdar://problem/60181394>
1444
1445         Reviewed by Youenn Fablet.
1446
1447         * UIProcess/mac/WebPageProxyMac.mm:
1448         (WebKit::WebPageProxy::setPromisedDataForImage):
1449         - Validate `imageSize` and `archiveSize` using MESSAGE_CHECK().
1450         - Add static_cast<size_t>() to `imageSize` and `archiveSize`
1451           parameters to denote type change.
1452         - Add nullptr check for SharedMemory::map() result with
1453           `archiveHandle`.
1454
1455 2020-03-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1456
1457         [SOUP] Notify web process about WebSocket handshake request and response
1458         https://bugs.webkit.org/show_bug.cgi?id=208994
1459
1460         Reviewed by Youenn Fablet.
1461
1462         This makes WebSockets appear again in web inspector.
1463
1464         * NetworkProcess/soup/WebSocketTaskSoup.cpp:
1465         (WebKit::WebSocketTask::WebSocketTask): Save the handshake message and notify the channel when the request is sent.
1466         (WebKit::WebSocketTask::didConnect): Notify the channel that handshake response has been received.
1467         (WebKit::WebSocketTask::didFail): Notify the channel that handshake response has been received if handshake
1468         failed.
1469         * NetworkProcess/soup/WebSocketTaskSoup.h:
1470
1471 2020-03-13  Youenn Fablet  <youenn@apple.com>
1472
1473         Apply rotation at source level if WebRTC sink ask so
1474         https://bugs.webkit.org/show_bug.cgi?id=205645
1475
1476         Reviewed by Eric Carlson.
1477
1478         Implement RealtimeMediaSource setShouldApplyRotation by sending IPC to capture process.
1479         In capture process, if rotation should be applied, use an ImageRotationSessionVT session to apply it before sending the video frame.
1480         This allows WebProcess to no longer need an ImageRotationSessionVT for WebRTC.
1481
1482         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1483         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::setShouldApplyRotation):
1484         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::rotatePixelBuffer):
1485         (WebKit::UserMediaCaptureManagerProxy::setShouldApplyRotation):
1486         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
1487         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
1488         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
1489         (WebKit::UserMediaCaptureManager::Source::setShouldApplyRotation):
1490
1491 2020-03-13  youenn fablet  <youenn@apple.com>
1492
1493         Remove use of PlatformMediaSession types in AudioSession
1494         https://bugs.webkit.org/show_bug.cgi?id=208995
1495
1496         Reviewed by Eric Carlson.
1497
1498         Update code according WebCore API changes.
1499         Make use of AudioSession current code path to make RemoteAudioSession notify its observers.
1500
1501         * GPUProcess/media/RemoteAudioSessionProxy.cpp:
1502         (WebKit::RemoteAudioSessionProxy::setCategory):
1503         (WebKit::RemoteAudioSessionProxy::beginInterruption):
1504         (WebKit::RemoteAudioSessionProxy::endInterruption):
1505         * GPUProcess/media/RemoteAudioSessionProxy.h:
1506         * GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
1507         (WebKit::RemoteAudioSessionProxyManager::tryToSetActiveForProcess):
1508         (WebKit::RemoteAudioSessionProxyManager::beginAudioSessionInterruption):
1509         (WebKit::RemoteAudioSessionProxyManager::endAudioSessionInterruption):
1510         * GPUProcess/media/RemoteAudioSessionProxyManager.h:
1511         * WebProcess/GPU/media/RemoteAudioSession.cpp:
1512         (WebKit::RemoteAudioSession::beginInterruption): Deleted.
1513         (WebKit::RemoteAudioSession::endInterruption): Deleted.
1514         * WebProcess/GPU/media/RemoteAudioSession.h:
1515         * WebProcess/GPU/media/RemoteAudioSession.messages.in:
1516
1517 2020-03-13  Ryosuke Niwa  <rniwa@webkit.org>
1518
1519         Release build fix after r258384.
1520
1521         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1522         (WebKit::PDFPlugin::threadEntry):
1523         (WebKit::PDFPlugin::ByteRangeRequest::maybeComplete):
1524
1525 2020-03-12  Brady Eidson  <beidson@apple.com>
1526
1527         Add a very verbose logging mode for incremental PDF loading
1528         https://bugs.webkit.org/show_bug.cgi?id=208975
1529
1530         Reviewed by Simon Fraser.
1531
1532         Adds a verbose logging channel that includes a full dump of the PDFPlugin's loading status
1533         for each logging message.
1534         
1535         * Platform/Logging.h:
1536
1537         * WebProcess/Plugins/PDF/PDFPlugin.h:
1538         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1539         (WebKit::PDFPlugin::pdfLog):
1540         (WebKit::PDFPlugin::logStreamLoader):
1541         (WebKit::PDFPlugin::verboseLog):
1542         (WebKit::dataProviderGetBytesAtPositionCallback):
1543         (WebKit::dataProviderGetByteRangesCallback):
1544         (WebKit::PDFPlugin::getResourceBytesAtPosition):
1545         (WebKit::PDFPlugin::adoptBackgroundThreadDocument):
1546         (WebKit::PDFPlugin::ByteRangeRequest::completeWithBytes):
1547         (WebKit::PDFPlugin::ByteRangeRequest::completeWithAccumulatedData):
1548         (WebKit::PDFPlugin::forgetLoader):
1549
1550 2020-03-12  Brent Fulgham  <bfulgham@apple.com>
1551
1552         Correct preference handling and naming conventions in AppBound browsing preferences
1553         https://bugs.webkit.org/show_bug.cgi?id=209031
1554         <rdar://problem/60396298>
1555
1556         Reviewed by John Wilander.
1557
1558         I made a mistake in the handling of preferences related to the IsInAppBrowserPrivacyEnabled
1559         and the quirk flag, which led to some code not executing when expected.
1560
1561         This patch does the following:
1562
1563         1. Uses the correct naming scheme for WebKit Internal Debug flags. They should be
1564            'WebKitDebug', not 'WebKitInternal' or 'WebKitInternalDebug'.
1565         2. Updates the local quirk state in WebPage when page settings change.
1566
1567         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1568         (WebKit::WebsiteDataStore::parameters):
1569         * WebProcess/WebPage/WebPage.cpp:
1570         (WebKit::WebPage::updatePreferences):
1571
1572 2020-03-12  David Kilzer  <ddkilzer@apple.com>
1573
1574         WebPageProxy::SaveImageToLibrary should validate its `imageSize` parameter
1575         <https://webkit.org/b/209012>
1576         <rdar://problem/60181295>
1577
1578         Reviewed by Chris Dumez.
1579
1580         * UIProcess/ios/WebPageProxyIOS.mm:
1581         (WebKit::WebPageProxy::saveImageToLibrary):
1582         - Validate upper bound of `imageSize` parameter.
1583         - Add static_cast<size_t>() to `imageSize` parameter to denote
1584           type change.
1585
1586 2020-03-12  Chris Dumez  <cdumez@apple.com>
1587
1588         Check for overflows in MachMessage::messageSize()
1589         https://bugs.webkit.org/show_bug.cgi?id=209020
1590         <rdar://problem/58264215>
1591
1592         Reviewed by Alex Christensen.
1593
1594         * Platform/IPC/cocoa/ConnectionCocoa.mm:
1595         (IPC::Connection::sendOutgoingMessage):
1596         * Platform/IPC/cocoa/MachMessage.cpp:
1597         (IPC::MachMessage::messageSize):
1598         * Platform/IPC/cocoa/MachMessage.h:
1599
1600 2020-03-12  Per Arne Vollan  <pvollan@apple.com>
1601
1602         [macOS] _AXSApplicationAccessibilityEnabled should not be called
1603         https://bugs.webkit.org/show_bug.cgi?id=208953
1604
1605         Reviewed by Brent Fulgham.
1606
1607         On macOS, stop using the function _AXSApplicationAccessibilityEnabled and listening to the notification
1608         kAXSApplicationAccessibilityEnabledNotification, since they do not have the same behavior as on iOS.
1609
1610         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1611         (WebKit::WebProcessPool::platformInitializeWebProcess):
1612         (WebKit::WebProcessPool::registerNotificationObservers):
1613         (WebKit::WebProcessPool::unregisterNotificationObservers):
1614         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
1615         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
1616         * WebProcess/cocoa/WebProcessCocoa.mm:
1617         (WebKit::WebProcess::platformInitializeProcess):
1618         (WebKit::WebProcess::unblockAccessibilityServer):
1619
1620 2020-03-12  Kate Cheney  <katherine_cheney@apple.com>
1621
1622         Resource load statistics data summary should return all third party data
1623         https://bugs.webkit.org/show_bug.cgi?id=209000
1624         <rdar://problem/60348306>
1625
1626         Reviewed by John Wilander.
1627
1628         No new tests, this patch adjusts old tests to test this new behavior
1629
1630         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1631         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1632         (-[WKWebsiteDataStore _setThirdPartyCookieBlockingMode:onlyOnSitesWithoutUserInteraction:completionHandler:]):
1633         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1634         Added new function _setThirdPartyCookieBlockingMode so API tests can
1635         set this parameter.
1636
1637 2020-03-12  Alex Christensen  <achristensen@webkit.org>
1638
1639         WKWebView.hasOnlySecureContent should be correct after back/forward navigations
1640         https://bugs.webkit.org/show_bug.cgi?id=207609
1641
1642         Reviewed by Ryosuke Niwa.
1643
1644         * UIProcess/WebPageProxy.cpp:
1645         (WebKit::WebPageProxy::usedLegacyTLS):
1646         (WebKit::WebPageProxy::hasInsecureContent): Deleted.
1647         * UIProcess/WebPageProxy.h:
1648         * UIProcess/WebPageProxy.messages.in:
1649         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1650         (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame):
1651
1652 2020-03-12  Chris Dumez  <cdumez@apple.com>
1653
1654         Drop unused WebProcess::UpdateActivePages IPC
1655         https://bugs.webkit.org/show_bug.cgi?id=209002
1656         <rdar://problem/59682658>
1657
1658         Reviewed by Geoffrey Garen.
1659
1660         * WebProcess/WebProcess.messages.in:
1661
1662 2020-03-12  youenn fablet  <youenn@apple.com>
1663
1664         FrameLoader should own its FrameLoaderClient
1665         https://bugs.webkit.org/show_bug.cgi?id=208918
1666
1667         Reviewed by Geoffrey Garen.
1668
1669         Pass a UniqueRef to the PageConfiguration.
1670         Update WebFrameLoaderClient according updated FrameLoaderClient interface.
1671
1672         WebFrame no longer needs to ref/unref itself to keep the loader client alive.
1673         Update WebFrame construction to not need a static_cast at initialization of the main frame.
1674
1675         The ownership is now that a WebCore::FrameLoader owns a FrameLoaderClient who owns a WebFrame.
1676
1677         * WebProcess/Network/WebLoaderStrategy.cpp:
1678         (WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler):
1679         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1680         (WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
1681         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1682         (WebKit::WebLoaderStrategy::startPingLoad):
1683         (WebKit::WebLoaderStrategy::preconnectTo):
1684         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1685         (WebKit::WebSWContextManagerConnection::installServiceWorker):
1686         * WebProcess/Storage/WebSWContextManagerConnection.h:
1687         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1688         (WebKit::WebFrameLoaderClient::WebFrameLoaderClient):
1689         (WebKit::WebFrameLoaderClient::~WebFrameLoaderClient):
1690         (WebKit::WebFrameLoaderClient::webPageProxyID const):
1691         (WebKit::WebFrameLoaderClient::pageID const):
1692         (WebKit::WebFrameLoaderClient::frameID const):
1693         (WebKit::WebFrameLoaderClient::detachedFromParent2):
1694         (WebKit::WebFrameLoaderClient::assignIdentifierToInitialRequest):
1695         (WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
1696         (WebKit::WebFrameLoaderClient::shouldUseCredentialStorage):
1697         (WebKit::WebFrameLoaderClient::dispatchDidReceiveResponse):
1698         (WebKit::WebFrameLoaderClient::dispatchDidReceiveContentLength):
1699         (WebKit::WebFrameLoaderClient::dispatchDidFinishLoading):
1700         (WebKit::WebFrameLoaderClient::dispatchDidFailLoading):
1701         (WebKit::WebFrameLoaderClient::dispatchDidDispatchOnloadEvents):
1702         (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
1703         (WebKit::WebFrameLoaderClient::dispatchDidCancelClientRedirect):
1704         (WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect):
1705         (WebKit::WebFrameLoaderClient::dispatchDidChangeLocationWithinPage):
1706         (WebKit::WebFrameLoaderClient::dispatchDidPushStateWithinPage):
1707         (WebKit::WebFrameLoaderClient::dispatchDidReplaceStateWithinPage):
1708         (WebKit::WebFrameLoaderClient::dispatchDidPopStateWithinPage):
1709         (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):
1710         (WebKit::WebFrameLoaderClient::dispatchDidReceiveTitle):
1711         (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
1712         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
1713         (WebKit::WebFrameLoaderClient::dispatchDidFailLoad):
1714         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
1715         (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad):
1716         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
1717         (WebKit::WebFrameLoaderClient::dispatchDidLayout):
1718         (WebKit::WebFrameLoaderClient::dispatchShow):
1719         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
1720         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
1721         (WebKit::WebFrameLoaderClient::applyToDocumentLoader):
1722         (WebKit::WebFrameLoaderClient::allowsContentJavaScriptFromMostRecentNavigation const):
1723         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1724         (WebKit::WebFrameLoaderClient::dispatchUnableToImplementPolicy):
1725         (WebKit::WebFrameLoaderClient::dispatchWillSendSubmitEvent):
1726         (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
1727         (WebKit::WebFrameLoaderClient::willReplaceMultipartContent):
1728         (WebKit::WebFrameLoaderClient::didReplaceMultipartContent):
1729         (WebKit::WebFrameLoaderClient::didDisplayInsecureContent):
1730         (WebKit::WebFrameLoaderClient::didRunInsecureContent):
1731         (WebKit::WebFrameLoaderClient::didDetectXSS):
1732         (WebKit::WebFrameLoaderClient::cancelledError const):
1733         (WebKit::WebFrameLoaderClient::blockedError const):
1734         (WebKit::WebFrameLoaderClient::blockedByContentBlockerError const):
1735         (WebKit::WebFrameLoaderClient::cannotShowURLError const):
1736         (WebKit::WebFrameLoaderClient::interruptedForPolicyChangeError const):
1737         (WebKit::WebFrameLoaderClient::blockedByContentFilterError const):
1738         (WebKit::WebFrameLoaderClient::cannotShowMIMETypeError const):
1739         (WebKit::WebFrameLoaderClient::fileDoesNotExistError const):
1740         (WebKit::WebFrameLoaderClient::pluginWillHandleLoadError const):
1741         (WebKit::WebFrameLoaderClient::shouldFallBack const):
1742         (WebKit::WebFrameLoaderClient::restoreViewState):
1743         (WebKit::WebFrameLoaderClient::didFinishLoad):
1744         (WebKit::WebFrameLoaderClient::userAgent const):
1745         (WebKit::WebFrameLoaderClient::createPlugin):
1746         (WebKit::WebFrameLoaderClient::webGLPolicyForURL const):
1747         (WebKit::WebFrameLoaderClient::resolveWebGLPolicyForURL const):
1748         (WebKit::WebFrameLoaderClient::objectContentType):
1749         (WebKit::WebFrameLoaderClient::overrideMediaType const):
1750         (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld):
1751         (WebKit::WebFrameLoaderClient::dispatchGlobalObjectAvailable):
1752         (WebKit::WebFrameLoaderClient::willInjectUserScript):
1753         (WebKit::WebFrameLoaderClient::willCacheResponse const):
1754         (WebKit::WebFrameLoaderClient::createNetworkingContext):
1755         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1756         * WebProcess/WebPage/WebFrame.cpp:
1757         (WebKit::WebFrame::initWithCoreMainFrame):
1758         (WebKit::WebFrame::createSubframe):
1759         (WebKit::WebFrame::WebFrame):
1760         (WebKit::WebFrame::frameLoaderClient const):
1761         (WebKit::WebFrame::fromCoreFrame):
1762         (WebKit::WebFrame::didReceivePolicyDecision):
1763         * WebProcess/WebPage/WebFrame.h:
1764         (WebKit::WebFrame::create):
1765         * WebProcess/WebPage/WebPage.cpp:
1766         (WebKit::m_processDisplayName):
1767
1768 2020-03-12  Brent Fulgham  <bfulgham@apple.com>
1769
1770         Drop unused LogGlobalDiagnosticMessageWithValue IPC message
1771         https://bugs.webkit.org/show_bug.cgi?id=208974
1772         <rdar://problem/59682189>
1773
1774         Reviewed by Chris Dumez.
1775
1776         I added these messages for ITP, but we later switched to tracking network sessions
1777         individually and no longer need this "global" message.
1778
1779         * UIProcess/Network/NetworkProcessProxy.cpp:
1780         (WebKit::NetworkProcessProxy::logGlobalDiagnosticMessageWithValue): Deleted.
1781         * UIProcess/Network/NetworkProcessProxy.h:
1782         * UIProcess/Network/NetworkProcessProxy.messages.in:
1783
1784 2020-03-12  Chris Dumez  <cdumez@apple.com>
1785
1786         Networking process should kill the WebContent process if an invalid IPC message is received from it
1787         https://bugs.webkit.org/show_bug.cgi?id=208999
1788
1789         Reviewed by Geoffrey Garen.
1790
1791         If the NetworkProcess receives a bad IPC from a WebProcess, it now sends an IPC to the UIProcess
1792         asking for said WebProcess to be terminated.
1793
1794         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1795         (WebKit::NetworkConnectionToWebProcess::didReceiveInvalidMessage):
1796
1797         * Platform/IPC/HandleMessage.h:
1798         (IPC::handleMessage):
1799         (IPC::handleMessageSynchronous):
1800         (IPC::handleMessageSynchronousWantsConnection):
1801         (IPC::handleMessageAsync):
1802         I noticed when testing this patch that the decoder was sometimes not marked as invalid even though
1803         decoding failed (verified this by not decoding enough data or decoding too much data). As a result,
1804         the IPC message would get ignored but didReceiveInvalidMessage() would not get called. To address
1805         this, I know mark the decoder as invalid anytime decoding fails, instead of asserting that it is
1806         already invalid.
1807
1808         * Shared/ProcessTerminationReason.h:
1809         * UIProcess/API/C/WKAPICast.h:
1810         (WebKit::toAPI):
1811         * UIProcess/Cocoa/NavigationState.mm:
1812         (WebKit::wkProcessTerminationReason):
1813         * UIProcess/Network/NetworkProcessProxy.cpp:
1814         (WebKit::NetworkProcessProxy::terminateWebProcess):
1815         * UIProcess/Network/NetworkProcessProxy.h:
1816         * UIProcess/Network/NetworkProcessProxy.messages.in:
1817         * UIProcess/WebPageProxy.cpp:
1818         * UIProcess/WebProcessProxy.cpp:
1819         (WebKit::WebProcessProxy::requestTermination):
1820
1821 2020-03-12  Alex Christensen  <achristensen@webkit.org>
1822
1823         Remove unused GetWebCoreStatistics message
1824         https://bugs.webkit.org/show_bug.cgi?id=209001
1825         <rdar://problem/59682747>
1826
1827         Reviewed by Chris Dumez.
1828
1829         * WebProcess/WebProcess.cpp:
1830         (WebKit::fromCountedSetToHashMap): Deleted.
1831         (WebKit::getWebCoreMemoryCacheStatistics): Deleted.
1832         (WebKit::WebProcess::getWebCoreStatistics): Deleted.
1833         * WebProcess/WebProcess.h:
1834         * WebProcess/WebProcess.messages.in:
1835
1836 2020-03-12  David Kilzer  <ddkilzer@apple.com>
1837
1838         WebPasteboardProxy::SetPasteboardBufferForType should validate its `size` parameter
1839         <https://webkit.org/b/208902>
1840         <rdar://problem/60181117>
1841
1842         Reviewed by Chris Dumez.
1843
1844         * Platform/IPC/Connection.h:
1845         (MESSAGE_CHECK_BASE):
1846         - Define in terms of MESSAGE_CHECK_COMPLETION_BASE() with a
1847           no-op completion handler.
1848         (MESSAGE_CHECK_COMPLETION_BASE):
1849         - Rename from MESSAGE_CHECK_BASE() and add completion handler
1850           parameter.
1851
1852         * Platform/SharedMemory.h:
1853         (WebKit::SharedMemory::Handle::size const): Add.
1854
1855         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
1856         (MESSAGE_CHECK):
1857         - Define macro to use in
1858           WebPasteboardProxy::setPasteboardBufferForType().
1859         - Undefine macro at end of source file due to unified sources.
1860         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
1861         - Add IPC::Connection& parameter after change to
1862           WebPasteboardProxy.messages.in.  Use with MESSAGE_CHECK().
1863         - Validate `size` parameter using MESSAGE_CHECK().  Because
1864           SharedMemory::Handle::size() returns a size_t value, we do not
1865           need to check `size <= std::numeric_limits<size_t>::max()`.
1866         - Add static_cast<size_t>() to size parameter to denote type
1867           change.
1868         * UIProcess/WebPasteboardProxy.h:
1869         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
1870         - Add IPC::Connection& parameter after change to
1871           WebPasteboardProxy.messages.in.
1872         * UIProcess/WebPasteboardProxy.messages.in:
1873         (SetPasteboardBufferForType):
1874         - Add 'WantsConnection' attribute to add IPC::Connection&
1875           parameter to WebPasteboardProxy::setPasteboardBufferForType().
1876
1877 2020-03-12  Youenn Fablet  <youenn@apple.com>
1878
1879         Provide orientation to GPUProcess when it will start to capture
1880         https://bugs.webkit.org/show_bug.cgi?id=208911
1881
1882         Reviewed by Eric Carlson.
1883
1884         Provide orientation to GPUProcess whenever starting to capture.
1885         This fixes the case of spinning the GPUProcess/starting capture in landscape mode.
1886         Do not send orientation to GPUProcess if it is not yet started as an optimization.
1887
1888         Manually tested.
1889
1890         * UIProcess/WebPageProxy.cpp:
1891
1892 2020-03-12  Eric Carlson  <eric.carlson@apple.com>
1893
1894         Remove TextTrackPrivateRemote.messages.in
1895         https://bugs.webkit.org/show_bug.cgi?id=208935
1896
1897         Reviewed by Don Olmstead.
1898
1899         No new tests, no functional change.
1900
1901         * CMakeLists.txt:
1902         * DerivedSources-input.xcfilelist:
1903         * WebKit.xcodeproj/project.pbxproj:
1904         * WebProcess/GPU/media/TextTrackPrivateRemote.messages.in: Removed.
1905
1906 2020-03-12  youenn fablet  <youenn@apple.com>
1907
1908         Move AudioSession interruption listener code to AudioSession
1909         https://bugs.webkit.org/show_bug.cgi?id=208714
1910
1911         Reviewed by Jer Noble.
1912
1913         Make RemoteAudioSessionProxyManager an observer for AudioSession interruptions.
1914         When being interrupted, notify all WebProcesses and trigger begin/end interruption mechanisms.
1915         We only send interruption to sessions that are active in RemoteAudioSessionProxyManager.
1916         Minor refactorting to move manager proxies from a map to a weak hash set.
1917
1918         * GPUProcess/GPUConnectionToWebProcess.cpp:
1919         (WebKit::GPUConnectionToWebProcess::didClose):
1920         (WebKit::GPUConnectionToWebProcess::audioSessionProxy):
1921         * GPUProcess/media/RemoteAudioSessionProxy.cpp:
1922         (WebKit::RemoteAudioSessionProxy::setCategory):
1923         (WebKit::RemoteAudioSessionProxy::setPreferredBufferSize):
1924         (WebKit::RemoteAudioSessionProxy::tryToSetActive):
1925         * GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
1926         (WebKit::RemoteAudioSessionProxyManager::RemoteAudioSessionProxyManager):
1927         (WebKit::RemoteAudioSessionProxyManager::~RemoteAudioSessionProxyManager):
1928         (WebKit::RemoteAudioSessionProxyManager::addProxy):
1929         (WebKit::RemoteAudioSessionProxyManager::removeProxy):
1930         (WebKit::RemoteAudioSessionProxyManager::setCategoryForProcess):
1931         (WebKit::RemoteAudioSessionProxyManager::setPreferredBufferSizeForProcess):
1932         (WebKit::RemoteAudioSessionProxyManager::tryToSetActiveForProcess):
1933         (WebKit::RemoteAudioSessionProxyManager::beginAudioSessionInterruption):
1934         (WebKit::RemoteAudioSessionProxyManager::endAudioSessionInterruption):
1935         * GPUProcess/media/RemoteAudioSessionProxyManager.h:
1936         * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp:
1937         * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.h:
1938         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp:
1939         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.h:
1940         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.messages.in:
1941
1942 2020-03-12  Don Olmstead  <don.olmstead@sony.com>
1943
1944         [GPUP] Use standard int type in RemoteMediaPlayerState
1945         https://bugs.webkit.org/show_bug.cgi?id=208962
1946
1947         Reviewed by Eric Carlson.
1948
1949         An unsigned long long is at least 64-bits so use uint64_t instead. This issue
1950         was found when compiling out the GPU Process. No specialization of unsigned long
1951         long was found which resulted in errors. This appears to be a non-Cocoa problem.
1952
1953         * WebProcess/GPU/media/RemoteMediaPlayerState.h:
1954         (WebKit::RemoteMediaPlayerState::decode):
1955
1956 2020-03-12  youenn fablet  <youenn@apple.com>
1957
1958         GPUProcess should ensure UIProcess granted capture access to a WebProcess making a capture request
1959         https://bugs.webkit.org/show_bug.cgi?id=208910
1960
1961         Reviewed by Eric Carlson.
1962
1963         When UIProcess receives a getUserMedia request, it will send to GPUProcess a notification of what is allowed.
1964         GPUProcess stores for each connection to web process whether microphone, camera and/or display are allowed.
1965         We do not disable access for a given process for now.
1966         A future refactoring should probably streamline the implementation so that, in case capture happens in GPUProcess,
1967         GPUProcess receives the getUserMedia request, asks permission to UIProcess and, upon granted permission, creates directly the sources.
1968
1969         Covered by existing tests.
1970
1971         * GPUProcess/GPUConnectionToWebProcess.cpp:
1972         (WebKit::GPUConnectionToWebProcess::updateCaptureAccess):
1973         * GPUProcess/GPUConnectionToWebProcess.h:
1974         (WebKit::GPUConnectionToWebProcess::allowsAudioCapture const):
1975         (WebKit::GPUConnectionToWebProcess::allowsVideoCapture const):
1976         (WebKit::GPUConnectionToWebProcess::allowsDisplayCapture const):
1977         * GPUProcess/GPUProcess.cpp:
1978         (WebKit::GPUProcess::createGPUConnectionToWebProcess):
1979         (WebKit::GPUProcess::updateCaptureAccess):
1980         * GPUProcess/GPUProcess.h:
1981         * GPUProcess/GPUProcess.messages.in:
1982         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1983         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
1984         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
1985         * UIProcess/GPU/GPUProcessProxy.cpp:
1986         (WebKit::GPUProcessProxy::updateCaptureAccess):
1987         * UIProcess/GPU/GPUProcessProxy.h:
1988         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1989         (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest):
1990         * UIProcess/WebPageProxy.cpp:
1991         * UIProcess/WebPageProxy.h:
1992         * UIProcess/WebProcessProxy.cpp:
1993
1994 2020-03-12  Brent Fulgham  <bfulgham@apple.com>
1995
1996         Drop unused EnableEnumeratingAllNetworkInterfaces / DisableEnumeratingAllNetworkInterfaces IPC messages
1997         https://bugs.webkit.org/show_bug.cgi?id=208973
1998         <rdar://problem/59683940>
1999
2000         Reviewed by Youenn Fablet.
2001
2002         Remove two unused IPC messages.
2003
2004         * WebProcess/WebPage/WebPage.cpp:
2005         (WebKit::WebPage::disableEnumeratingAllNetworkInterfaces): Deleted.
2006         (WebKit::WebPage::enableEnumeratingAllNetworkInterfaces): Deleted.
2007         * WebProcess/WebPage/WebPage.h:
2008         * WebProcess/WebPage/WebPage.messages.in:
2009
2010 2020-03-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
2011
2012         [GPU Process] encodeNativeImage() should pass imageSize to GraphicsContext::drawNativeImage()
2013         https://bugs.webkit.org/show_bug.cgi?id=208936
2014
2015         Reviewed by Myles C. Maxfield.
2016
2017         Passing an empty FloatSize makes drawNativeImage() draws nothing to
2018         the ShareableBitmap
2019
2020         * Shared/WebCoreArgumentCoders.cpp:
2021         (IPC::encodeNativeImage):
2022
2023 2020-03-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
2024
2025         RemoteImageBuffer::getImageData() has to clear its DisplayList after calling flushDrawingContext()
2026         https://bugs.webkit.org/show_bug.cgi?id=208931
2027
2028         Reviewed by Myles C. Maxfield.
2029
2030         Instead of letting every caller to flushDrawingContextAndWaitCommit() or
2031         flushDrawingContext() be responsible of clearing the DisplayList, we can
2032         make these functions take this responsibility.
2033
2034         * WebProcess/GPU/graphics/RemoteImageBuffer.h:
2035         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp:
2036         (WebKit::RemoteImageBufferMessageHandler::flushDrawingContext):
2037         (WebKit::RemoteImageBufferMessageHandler::flushDrawingContextAndWaitCommit):
2038         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h:
2039
2040 2020-03-11  Don Olmstead  <don.olmstead@sony.com>
2041
2042         Non-unified build fixes early March 2020 edition Take 2
2043         https://bugs.webkit.org/show_bug.cgi?id=208968
2044
2045         Unreviewed build fix.
2046
2047         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp:
2048         * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
2049         (WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer):
2050
2051 2020-03-11  Don Olmstead  <don.olmstead@sony.com>
2052
2053         [GPUP] Add entry points for non-Cocoa ports
2054         https://bugs.webkit.org/show_bug.cgi?id=208965
2055
2056         Reviewed by Michael Catanzaro.
2057
2058         Add a CMake target for the GPU Process that is optionally defined based on
2059         whether the process is enabled.
2060
2061         Add an entry point for the GPU Process for unix and windows ports. Use this
2062         as the source for the GPU Process by specifying it in the Platform CMake file.
2063
2064         Add in hooks for both Windows and GLib to launch the GPU Process if it is
2065         enabled in the port.
2066
2067         * CMakeLists.txt:
2068         * GPUProcess/EntryPoint/unix/GPUProcessMain.cpp: Added.
2069         (main):
2070         * GPUProcess/EntryPoint/win/GPUProcessMain.cpp: Added.
2071         (main):
2072         * GPUProcess/GPUProcessMain.h: Added.
2073         * PlatformFTW.cmake:
2074         * PlatformGTK.cmake:
2075         * PlatformMac.cmake:
2076         * PlatformPlayStation.cmake:
2077         * PlatformWPE.cmake:
2078         * PlatformWin.cmake:
2079         * Shared/ProcessExecutablePath.h:
2080         * Shared/glib/ProcessExecutablePathGLib.cpp:
2081         (WebKit::executablePathOfGPUProcess):
2082         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2083         (WebKit::ProcessLauncher::launchProcess):
2084         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
2085         (WebKit::processName):
2086
2087 2020-03-11  Don Olmstead  <don.olmstead@sony.com>
2088
2089         [GPUP] Add special handling of MediaTime within message generator
2090         https://bugs.webkit.org/show_bug.cgi?id=208958
2091
2092         Reviewed by Eric Carlson.
2093
2094         When compiling the GPU Process sources without unified sources there were
2095         numerous compilation errors around MediaTime. Only GPU Process .messages.in
2096         files reference this type so there was no special handling within messages.py.
2097         Adding explicit references to MediaTime so the proper header is used and all
2098         sources compile.
2099
2100         * Scripts/webkit/messages.py:
2101
2102 2020-03-11  Per Arne Vollan  <pvollan@apple.com>
2103
2104         [macOS] Register with accessibility when the WebContent process starts
2105         https://bugs.webkit.org/show_bug.cgi?id=208960
2106
2107         Reviewed by Brent Fulgham.
2108
2109         When we reenabled CF prefs direct mode in <https://bugs.webkit.org/show_bug.cgi?id=208690>, we started to register
2110         with accessibility when we received a message to do so from the UI process. This would typically happen when the user
2111         enabled accessibility. On macOS, this notification does not work the same way as on iOS, and it is assumed that
2112         accessibility should always be enabled. Therefore we should go back to registering with accessibility on startup of
2113         the WebContent process on macOS.
2114
2115         * WebProcess/cocoa/WebProcessCocoa.mm:
2116         (WebKit::WebProcess::platformInitializeProcess):
2117         (WebKit::WebProcess::unblockAccessibilityServer):
2118
2119 2020-03-11  Don Olmstead  <don.olmstead@sony.com>
2120
2121         [GPUP] RemoteAudioDestination classes should require ENABLE(WEB_AUDIO)
2122         https://bugs.webkit.org/show_bug.cgi?id=208956
2123
2124         Reviewed by Dean Jackson.
2125
2126         RemoteAudioDestinationProxy uses AudioBus directly. For ports that don't 
2127         ENABLE(WEB_AUDIO) there is no implementation and linker errors will occur after
2128         building with ENABLE(GPU_PROCESS).
2129
2130         Add guards for ENABLE(WEB_AUDIO) around relevant implementations.
2131
2132         * GPUProcess/GPUConnectionToWebProcess.cpp:
2133         (WebKit::GPUConnectionToWebProcess::dispatchMessage):
2134         (WebKit::GPUConnectionToWebProcess::dispatchSyncMessage):
2135         * GPUProcess/GPUConnectionToWebProcess.h:
2136         * GPUProcess/media/RemoteAudioDestinationManager.cpp:
2137         * GPUProcess/media/RemoteAudioDestinationManager.h:
2138         * GPUProcess/media/RemoteAudioDestinationManager.messages.in:
2139         * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp:
2140         * WebProcess/GPU/media/RemoteAudioDestinationProxy.h:
2141         * WebProcess/GPU/media/RemoteAudioDestinationProxy.messages.in:
2142
2143 2020-03-11  Commit Queue  <commit-queue@webkit.org>
2144
2145         Unreviewed, reverting r258294.
2146         https://bugs.webkit.org/show_bug.cgi?id=208957
2147
2148         Introduced API failure (Requested by perarne on #webkit).
2149
2150         Reverted changeset:
2151
2152         "[macOS] _AXSApplicationAccessibilityEnabled should not be
2153         called"
2154         https://bugs.webkit.org/show_bug.cgi?id=208953
2155         https://trac.webkit.org/changeset/258294
2156
2157 2020-03-11  Kate Cheney  <katherine_cheney@apple.com>
2158
2159         Add a parameter to allow ignoring app-bound domain categorization
2160         https://bugs.webkit.org/show_bug.cgi?id=208949
2161         <rdar://problem/60239187>
2162
2163         Reviewed by Brent Fulgham.
2164
2165         Introduce a new parameter to ignore app-bound domain categorization
2166         for specific WebViews.
2167
2168         * UIProcess/API/APIPageConfiguration.h:
2169         (API::PageConfiguration::ignoresAppBoundDomains const):
2170         (API::PageConfiguration::setIgnoresAppBoundDomains):
2171         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2172         (-[WKWebViewConfiguration _ignoresAppBoundDomains]):
2173         (-[WKWebViewConfiguration _setIgnoresAppBoundDomains:]):
2174         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2175         * UIProcess/WebPageProxy.cpp:
2176         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
2177
2178 2020-03-11  Per Arne Vollan  <pvollan@apple.com>
2179
2180         [macOS] _AXSApplicationAccessibilityEnabled should not be called
2181         https://bugs.webkit.org/show_bug.cgi?id=208953
2182
2183         Reviewed by Brent Fulgham.
2184
2185         This function should only be called on iOS, not on macOS.
2186
2187         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2188         (WebKit::WebProcessPool::platformInitializeWebProcess):
2189         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2190         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
2191
2192 2020-03-11  Jiewen Tan  <jiewen_tan@apple.com>
2193
2194         [WebAuthn] Formalize the Keychain schema
2195         https://bugs.webkit.org/show_bug.cgi?id=183533
2196         <rdar://problem/43347926>
2197
2198         Reviewed by Brent Fulgham.
2199
2200         This patch formalizes the schema for the Keychain as follows:
2201         kSecAttrLabel: RP ID
2202         kSecAttrApplicationLabel: Credential ID (auto-gen by Keychain)
2203         kSecAttrApplicationTag: { "id": UserEntity.id, "name": UserEntity.name } (CBOR encoded)
2204         Noted, the vale of kSecAttrApplicationLabel is automatically generated by the Keychain, which is a SHA-1 hash of
2205         the public key.
2206
2207         According to the Step 7. from https://www.w3.org/TR/webauthn/#op-make-cred, the following fields are mandatory
2208         1. rpId (rpEntity.id);
2209         2. userHandle (userEntity.id), this is required for authenticators that support resident keys;
2210         3. credentialId.
2211
2212         Some other optional fields are:
2213         (from https://www.w3.org/TR/webauthn/#dictdef-publickeycredentialrpentity)
2214         1. rpEntity.name;
2215         2. rpEnitty.icon;
2216         (from https://www.w3.org/TR/webauthn/#dictdef-publickeycredentialuserentity)
2217         3. userEntity.displayName;
2218         4. userEntity.name;
2219         5. userEntity.icon;
2220         (from https://www.w3.org/TR/webauthn/#sign-counter)
2221         6. signature counter.
2222
2223         Among the six possible fields, only 4. is chosen to store. Here is why:
2224         For rpEntity, rpEntity.id which is either the domain or the eTLD + 1 of the website is
2225         sufficient enough to either classify the credential or serving the UI. Also, this is the only
2226         trustworthy information that the UserAgent produce. Others could potentially be used by
2227         malicious websites for attacking the Keychain or spoofing/phishing users when being displayed
2228         in the UI. Also, rpEnitty.icon is a URL to the website's favicon, which if not implemented
2229         correctly can be used for tracking.
2230
2231         For userEntity, userEntity.name is the human readable version of userEntity.id, and therefore
2232         is chosen to store such that later on WebKit can pass it to UI client to help users disambiguate
2233         different credentials. And it is necessary as userEntity.id is not guaranteed to be human
2234         readable. Others are abandoned for the very same reason as above.
2235
2236         We hard code a zero value for 'signature counter'. While this is a theoretically interesting
2237         technique for a RP to detect private key cloning, it is unlikely to be useful in practice.
2238         We store the private keys in our SEP. This counter would only be a meaningful protection if
2239         adversaries were able to extract private key data from the SEP without Apple noticing, but
2240         were not able to manipulate this counter to fool the RP.
2241
2242         In terms of the schema,
2243         1) RP ID is needed to query all credentials related, and therefore it needs a column and kSecAttrLabel
2244         is supposed to be human readable;
2245         2) kSecAttrApplicationLabel is the auto generated programmatical identifier for a SecItem, and
2246         therefore is suitable as the credential ID. Given the input to the SHA-1 is generated by us, and
2247         it is only needed to be powerful enough to be unique across the keychain within a device, and potentially
2248         to be unique across different other credential ID for the same user. The SHA-1 collision attack
2249         doesn't seem valid here.
2250         3) kSecAttrApplicationTag is the only other column Keychain allows applications to modify. Therefore,
2251         UserEntity.id and UserEntity.name is bundled to use this slot. The reason to use CBOR here is that
2252         it is more friendly then JSON to encode binaries, and it is used widely in WebAuthn.
2253
2254         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h:
2255         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
2256         (WebKit::LocalAuthenticatorInternal::toArrayBuffer):
2257         (WebKit::LocalAuthenticatorInternal::getExistingCredentials):
2258         (WebKit::LocalAuthenticator::makeCredential):
2259         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification):
2260         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
2261         (WebKit::LocalAuthenticator::getAssertion):
2262         (WebKit::LocalAuthenticator::deleteDuplicateCredential const):
2263         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
2264         (WebKit::MockLocalConnection::filterResponses const):
2265
2266 2020-03-11  Per Arne Vollan  <pvollan@apple.com>
2267
2268         [macOS] Crash under WebKit::WebProcessPool::platformInitialize()
2269         https://bugs.webkit.org/show_bug.cgi?id=208945
2270
2271         Unreviewed temporary compile fix.
2272
2273         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2274         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
2275
2276 2020-03-11  Per Arne Vollan  <pvollan@apple.com>
2277
2278         [macOS] Crash under WebKit::WebProcessPool::platformInitialize()
2279         https://bugs.webkit.org/show_bug.cgi?id=208945
2280
2281         Reviewed by Tim Horton.
2282
2283         Check that accessibility library is present before attempting to call functions in it.
2284
2285         No new tests, since I am not able to reproduce.
2286
2287         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2288         (WebKit::WebProcessPool::platformInitializeWebProcess):
2289         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2290         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
2291
2292 2020-03-11  Per Arne Vollan  <pvollan@apple.com>
2293
2294         [macOS] Crash under WebKit::WebProcessPool::platformInitialize()
2295         https://bugs.webkit.org/show_bug.cgi?id=208945
2296         <rdar://problem/60330751>
2297         
2298         Reviewed by Brent Fulgham.
2299
2300         Check that accessibility library is present before attempting to use constants from it.
2301
2302         No new tests, since I am unable to reproduce.
2303
2304         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2305         (WebKit::WebProcessPool::registerNotificationObservers):
2306         (WebKit::WebProcessPool::unregisterNotificationObservers):
2307
2308 2020-03-11  Alex Christensen  <achristensen@webkit.org>
2309
2310         Enable safe browsing warnings in Mac Catalyst WebKit
2311         https://bugs.webkit.org/show_bug.cgi?id=208944
2312         <rdar://problem/58854302>
2313
2314         Reviewed by Tim Horton.
2315
2316         I manually verified using the steps in the radar that it works as one would hope.
2317
2318         * Configurations/WebKit.xcconfig:
2319
2320 2020-03-11  Alex Christensen  <achristensen@webkit.org>
2321
2322         Fix the macCatalyst build after r258250
2323
2324         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
2325         (WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions):
2326
2327 2020-03-11  Chris Dumez  <cdumez@apple.com>
2328
2329         Terminate the Network / Plugin processes when receiving invalid IPC from them
2330         https://bugs.webkit.org/show_bug.cgi?id=208933
2331         <rdar://problem/58026473>
2332
2333         Reviewed by Geoffrey Garen.
2334
2335         * UIProcess/Network/NetworkProcessProxy.cpp:
2336         (WebKit::NetworkProcessProxy::didReceiveInvalidMessage):
2337         * UIProcess/Plugins/PluginProcessProxy.cpp:
2338         (WebKit::PluginProcessProxy::didReceiveInvalidMessage):
2339
2340 2020-03-11  Timothy Horton  <timothy_horton@apple.com>
2341
2342         Fix the macCatalyst build after r258250
2343
2344         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
2345
2346 2020-03-11  Chris Dumez  <cdumez@apple.com>
2347
2348         Assertion hit under WebPageProxy::suspendCurrentPageIfPossible() when bypassing certificate warning page
2349         https://bugs.webkit.org/show_bug.cgi?id=208927
2350         <rdar://problem/55448331>
2351
2352         Reviewed by Alex Christensen.
2353
2354         When suspending a previous page after a process-swap, we refuse to do the suspension if the currently
2355         committed URL does not match the url of the current back/forward list item. This makes sense since we
2356         will store the suspended page on the back/forward list item and restore that back when navigating back
2357         to that item. I had a debug assertion in there to help me figure out how this could happen. It turns
2358         out that calling loadAlternateHTML on the view will replace the content of the view with the provided
2359         HTML string, update the committed URL but not create a new back/forward list item. This is so that
2360         if you reload or go/back to this back/forward list item, we will attempt to load the original URL
2361         again. This would however trip my assertion. I am therefore removing my debug assertion and adding API
2362         test coverage.
2363
2364         * UIProcess/WebPageProxy.cpp:
2365         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
2366
2367 2020-03-11  Alex Christensen  <achristensen@webkit.org>
2368
2369         Introduce ResourceLoadStatisticsParameters and move members from NetworkSessionCreationParameters
2370         https://bugs.webkit.org/show_bug.cgi?id=208895
2371
2372         Reviewed by Youenn Fablet.
2373
2374         No change in behavior yet, but this will help us organize things better.
2375
2376         * NetworkProcess/NetworkProcess.cpp:
2377         (WebKit::NetworkProcess::initializeNetworkProcess):
2378         * NetworkProcess/NetworkSession.cpp:
2379         (WebKit::NetworkSession::NetworkSession):
2380         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2381         (WebKit::NetworkSessionCreationParameters::encode const):
2382         (WebKit::NetworkSessionCreationParameters::decode):
2383         * NetworkProcess/NetworkSessionCreationParameters.h:
2384         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2385         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2386         * Shared/ResourceLoadStatisticsParameters.h: Added.
2387         (WebKit::ResourceLoadStatisticsParameters::encode const):
2388         (WebKit::ResourceLoadStatisticsParameters::decode):
2389         * UIProcess/WebProcessPool.cpp:
2390         (WebKit::WebProcessPool::ensureNetworkProcess):
2391         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2392         (WebKit::WebsiteDataStore::parameters):
2393         * WebKit.xcodeproj/project.pbxproj:
2394
2395 2020-03-11  Chris Dumez  <cdumez@apple.com>
2396
2397         Defer async scripts until DOMContentLoaded or first paint, whichever comes first
2398         https://bugs.webkit.org/show_bug.cgi?id=208896
2399
2400         Reviewed by Darin Adler.
2401
2402         Defer async scripts until DOMContentLoaded or first paint, whichever comes first. In
2403         Bug 207698, we deferred them until DOMContentLoaded, as a first-paint optimization.
2404         However, this seems overly aggressive on pages like wikipedia and it is sufficient
2405         to defer those scripts until first-paint to get the performance win.
2406
2407         * Shared/WebPreferences.yaml:
2408         * UIProcess/API/Cocoa/WKWebView.mm:
2409         (-[WKWebView _setupPageConfiguration:]):
2410
2411 2020-03-11  Commit Queue  <commit-queue@webkit.org>
2412
2413         Unreviewed, reverting r258263.
2414         https://bugs.webkit.org/show_bug.cgi?id=208922
2415
2416         it is breaking internal builds (Requested by youenn on
2417         #webkit).
2418
2419         Reverted changeset:
2420
2421         "Move AudioSession interruption listener code to AudioSession"
2422         https://bugs.webkit.org/show_bug.cgi?id=208714
2423         https://trac.webkit.org/changeset/258263
2424
2425 2020-03-11  youenn fablet  <youenn@apple.com>
2426
2427         Move AudioSession interruption listener code to AudioSession
2428         https://bugs.webkit.org/show_bug.cgi?id=208714
2429
2430         Reviewed by Jer Noble.
2431
2432         Make RemoteAudioSessionProxyManager an observer for AudioSession interruptions.
2433         When being interrupted, notify all WebProcesses and trigger begin/end interruption mechanisms.
2434         We only send interruption to sessions that are active in RemoteAudioSessionProxyManager.
2435         Minor refactorting to move manager proxies from a map to a weak hash set.
2436
2437         * GPUProcess/GPUConnectionToWebProcess.cpp:
2438         (WebKit::GPUConnectionToWebProcess::didClose):
2439         (WebKit::GPUConnectionToWebProcess::audioSessionProxy):
2440         * GPUProcess/media/RemoteAudioSessionProxy.cpp:
2441         (WebKit::RemoteAudioSessionProxy::setCategory):
2442         (WebKit::RemoteAudioSessionProxy::setPreferredBufferSize):
2443         (WebKit::RemoteAudioSessionProxy::tryToSetActive):
2444         * GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
2445         (WebKit::RemoteAudioSessionProxyManager::RemoteAudioSessionProxyManager):
2446         (WebKit::RemoteAudioSessionProxyManager::~RemoteAudioSessionProxyManager):
2447         (WebKit::RemoteAudioSessionProxyManager::addProxy):
2448         (WebKit::RemoteAudioSessionProxyManager::removeProxy):
2449         (WebKit::RemoteAudioSessionProxyManager::setCategoryForProcess):
2450         (WebKit::RemoteAudioSessionProxyManager::setPreferredBufferSizeForProcess):
2451         (WebKit::RemoteAudioSessionProxyManager::tryToSetActiveForProcess):
2452         (WebKit::RemoteAudioSessionProxyManager::beginAudioSessionInterruption):
2453         (WebKit::RemoteAudioSessionProxyManager::endAudioSessionInterruption):
2454         * GPUProcess/media/RemoteAudioSessionProxyManager.h:
2455         * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp:
2456         * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.h:
2457         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp:
2458         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.h:
2459         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.messages.in:
2460
2461 2020-03-10  Don Olmstead  <don.olmstead@sony.com>
2462
2463         [GPU Process] Work towards compiling out on non-Cocoa ports
2464         https://bugs.webkit.org/show_bug.cgi?id=208899
2465
2466         Reviewed by Darin Adler.
2467
2468         Work through some compilation issues on non-Cocoa ports when attempting to build
2469         out the GPU Process. Fix platform guards for some methods. Fix compilation issues
2470         for non-unified builds.
2471
2472         Add in CMake listing of messages.in and include directories required for building
2473         with ENABLE_GPU_PROCESS.
2474
2475         * CMakeLists.txt:
2476         * GPUProcess/GPUConnectionToWebProcess.cpp:
2477         (WebKit::GPUConnectionToWebProcess::didClose):
2478         * GPUProcess/GPUConnectionToWebProcess.messages.in:
2479         * GPUProcess/GPUProcess.cpp:
2480         * GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h:
2481         * GPUProcess/graphics/RemoteImageBufferProxy.h:
2482         (WebKit::RemoteImageBufferProxy::create):
2483         * GPUProcess/graphics/RemoteRenderingBackendProxy.cpp:
2484         * GPUProcess/graphics/RemoteRenderingBackendProxy.h:
2485         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
2486         (WebKit::RemoteMediaPlayerProxy::getConfiguration):
2487         (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenGravity):
2488         (WebKit::RemoteMediaPlayerProxy::updateVideoFullscreenInlineImage):
2489         (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenMode):
2490         (WebKit::RemoteMediaPlayerProxy::videoFullscreenStandbyChanged):
2491         (WebKit::RemoteMediaPlayerProxy::mediaPlayerReadyStateChanged):
2492         (WebKit::RemoteMediaPlayerProxy::notifyTrackModeChanged):
2493         * GPUProcess/media/RemoteMediaPlayerProxy.h:
2494         * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
2495         * UIProcess/GPU/GPUProcessProxy.h:
2496         * WebProcess/GPU/GPUProcessConnection.cpp:
2497         * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
2498         * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h:
2499         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h:
2500         * WebProcess/GPU/graphics/RemoteRenderingBackend.cpp:
2501         * WebProcess/GPU/media/AudioTrackPrivateRemote.h:
2502         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
2503         * WebProcess/GPU/media/TextTrackPrivateRemote.h:
2504
2505 2020-03-10  Per Arne Vollan  <pvollan@apple.com>
2506
2507         [iOS] A syscall is denied by the sandbox
2508         https://bugs.webkit.org/show_bug.cgi?id=208892
2509         <rdar://problem/60294880>
2510
2511         Reviewed by Brent Fulgham.
2512
2513         Add denied syscall to sandbox on iOS.
2514
2515         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2516
2517 2020-03-08  Darin Adler  <darin@apple.com>
2518
2519         Make TextIterator::range return a SimpleRange
2520         https://bugs.webkit.org/show_bug.cgi?id=208797
2521
2522         Reviewed by Don Olmstead.
2523
2524         * WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm:
2525         (-[WKDOMTextIterator currentRange]): Use createLiveRange.
2526
2527         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: Added includes.
2528
2529 2020-03-10  Don Olmstead  <don.olmstead@sony.com>
2530
2531         Non-unified build fixes early March 2020 edition
2532         https://bugs.webkit.org/show_bug.cgi?id=208897
2533
2534         Unreviewed build fix.
2535
2536         * NetworkProcess/NetworkLoadChecker.h:
2537
2538 2020-03-10  Kate Cheney  <katherine_cheney@apple.com>
2539
2540         Some common domains should always be App-bound domains
2541         https://bugs.webkit.org/show_bug.cgi?id=208893
2542          <rdar://problem/60280943>
2543
2544         Reviewed by Brent Fulgham.
2545
2546         Some domains, like about:blank and pages loaded from files should
2547         always be considered app-bound.
2548
2549         * UIProcess/WebPageProxy.cpp:
2550         (WebKit::shouldBeTreatedAsAppBound):
2551         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
2552
2553 2020-03-10  Devin Rousso  <drousso@apple.com>
2554
2555         Web Inspector: make `WebKit::WebInspectorProxy::m_isOpening` GTK only
2556         https://bugs.webkit.org/show_bug.cgi?id=208831
2557         <rdar://problem/57720692>
2558
2559         Reviewed by Brian Burg.
2560
2561         * UIProcess/Inspector/WebInspectorProxy.h:
2562         * UIProcess/Inspector/WebInspectorProxy.cpp:
2563         (WebKit::WebInspectorProxy::open):
2564
2565 2020-03-10  David Kilzer  <ddkilzer@apple.com>
2566
2567         [CoreIPC] WebPasteboardProxy::SetPasteboardBufferForType uses "0" for both uint64_t and a pointer value
2568         <https://webkit.org/b/208879>
2569         <rdar://problem/60165624>
2570
2571         Reviewed by Wenson Hsieh.
2572
2573         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
2574         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
2575         - Change 0 to nullptr to make code easier to read.
2576
2577 2020-03-10  Andres Gonzalez  <andresg_22@apple.com>
2578
2579         Enable accessibility IsolatedTree in WebKit.
2580         https://bugs.webkit.org/show_bug.cgi?id=208881
2581
2582         Reviewed by Chris Fleizach.
2583
2584         Sets the default value of accessibility IsolatedTree support to true.
2585
2586         * Shared/WebPreferences.yaml:
2587
2588 2020-03-10  Megan Gardner  <megan_gardner@apple.com>
2589
2590         File upload cancels before files can be uploaded.
2591         https://bugs.webkit.org/show_bug.cgi?id=208846
2592         <rdar://problem/60244249>
2593
2594         Reviewed by Tim Horton.
2595
2596         With the new UIContextMenus, we needed to cancel in order for everything to be 
2597         reset correctly in WebCore. But this can only be done in the animation completion
2598         handler, but we only want to cancel if we aren't presenting a different picker.
2599
2600         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2601         (-[WKFileUploadPanel contextMenuInteraction:configurationForMenuAtLocation:]):
2602         (-[WKFileUploadPanel contextMenuInteraction:willEndForConfiguration:animator:]):
2603         (-[WKFileUploadPanel ensureContextMenuInteraction]):
2604
2605 2020-03-10  youenn fablet  <youenn@apple.com>
2606
2607         Make sure that ServiceWorkerFrameLoaderClient lifetime exceeds its frame lifetime
2608         https://bugs.webkit.org/show_bug.cgi?id=208855
2609         <rdar://problem/60187332>
2610
2611         Reviewed by Geoffrey Garen.
2612
2613         In case connection is destroyed, for instance due to network process crashing,
2614         we destroy all service worker frame loader clients.
2615         This is too soon as service worker thread proxy is refcounted and can last longer.
2616         For that reason, we now let the SWContextManager handle the lifetime of the frame loader clients.
2617         Drive-by fix: generate a new frame identifier instead of using an internal counter which can be wrong in case of new connection
2618         and might clash with other frame identifiers now that service workers can run in process with pages.
2619
2620         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2621         (WebKit::ServiceWorkerFrameLoaderClient::create):
2622         (WebKit::ServiceWorkerFrameLoaderClient::ServiceWorkerFrameLoaderClient):
2623         (WebKit::ServiceWorkerFrameLoaderClient::frameLoaderDestroyed):
2624         (WebKit::WebSWContextManagerConnection::installServiceWorker):
2625         * WebProcess/Storage/WebSWContextManagerConnection.h:
2626
2627 2020-03-10  Youenn Fablet  <youenn@apple.com>
2628
2629         Do not create a service worker connection if service worker is not enabled in network process
2630         https://bugs.webkit.org/show_bug.cgi?id=208851
2631
2632         Reviewed by Simon Fraser.
2633
2634         In case of navigation redirection, we were trying to go to service worker without checking the service worker entitlement.
2635         Instead, we should check the service worker entitlement and return early in that case.
2636
2637         Covered by manually running minibrowser on simulator.
2638
2639         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2640         (WebKit::NetworkConnectionToWebProcess::isServiceWorkerAllowed const):
2641         (WebKit::NetworkConnectionToWebProcess::createFetchTask):
2642         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
2643         * NetworkProcess/NetworkConnectionToWebProcess.h:
2644         * NetworkProcess/NetworkResourceLoader.cpp:
2645         (WebKit::NetworkResourceLoader::continueWillSendRequest):
2646         (WebKit::NetworkResourceLoader::startWithServiceWorker):
2647
2648 2020-03-10  youenn fablet  <youenn@apple.com>
2649
2650         Remove SampleBufferDisplayLayer sync IPC
2651         https://bugs.webkit.org/show_bug.cgi?id=208804
2652
2653         Reviewed by Eric Carlson.
2654
2655         Implement the initialize method as an async IPC.
2656
2657         * GPUProcess/GPUConnectionToWebProcess.cpp:
2658         (WebKit::GPUConnectionToWebProcess::dispatchSyncMessage):
2659         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp:
2660         (WebKit::RemoteSampleBufferDisplayLayer::RemoteSampleBufferDisplayLayer):
2661         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp:
2662         (WebKit::RemoteSampleBufferDisplayLayerManager::createLayer):
2663         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h:
2664         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.messages.in:
2665         * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
2666         (WebKit::RemoteMediaPlayerManager::updatePreferences):
2667         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp:
2668         (WebKit::SampleBufferDisplayLayer::create):
2669         (WebKit::SampleBufferDisplayLayer::SampleBufferDisplayLayer):
2670         (WebKit::SampleBufferDisplayLayer::initialize):
2671         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h:
2672         * WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.cpp:
2673         (WebKit::SampleBufferDisplayLayerManager::createLayer):
2674         * WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.h:
2675
2676 2020-03-10  youenn fablet  <youenn@apple.com>
2677
2678         [iOS] Make sure a MediStreamTrack clone does not interrupt the being cloned track
2679         https://bugs.webkit.org/show_bug.cgi?id=208634
2680
2681         Reviewed by Eric Carlson.
2682
2683         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2684         (WebKit::UserMediaCaptureManager::VideoFactory::setActiveSource):
2685         Do nothing since GPUProcess will handle the muting itself if it creates multiple sources.
2686         * WebProcess/cocoa/UserMediaCaptureManager.h:
2687
2688 2020-03-10  youenn fablet  <youenn@apple.com>
2689
2690         Remove sync IPC when creating a remote capture source
2691         https://bugs.webkit.org/show_bug.cgi?id=208816
2692
2693         Reviewed by Eric Carlson.
2694
2695         Use whenInitialized to wait for the async IPC that tells whether the remote source was created successfully.
2696         Use the async response to gather the capabilities so as to remove the corresponding sync IPC.
2697
2698         * Platform/IPC/Connection.h:
2699         (IPC::AsyncReplyError::create):
2700         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2701         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
2702         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
2703         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
2704         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2705         (WebKit::UserMediaCaptureManager::Source::didFail):
2706         (WebKit::UserMediaCaptureManager::Source::setAsReady):
2707         (WebKit::UserMediaCaptureManager::Source::setCapabilities):
2708         (WebKit::UserMediaCaptureManager::createCaptureSource):
2709         (WebKit::UserMediaCaptureManager::Source::capabilities):
2710
2711 2020-03-10  youenn fablet  <youenn@apple.com>
2712
2713         Do not process RTC Network messages coming from NetworkProcess if LibWebRTCNetwork is not active
2714         https://bugs.webkit.org/show_bug.cgi?id=207376
2715
2716         Reviewed by Eric Carlson.
2717
2718         In case LibWebRTCNetwork is not active, we do not have instantiated any peer connection.
2719         We do not have started any related RTC thread so we are not expecting any RTC message from Network Process.
2720         Exit early in that case.
2721
2722         * WebProcess/Network/NetworkProcessConnection.cpp:
2723         (WebKit::NetworkProcessConnection::didReceiveMessage):
2724         * WebProcess/Network/webrtc/LibWebRTCNetwork.h:
2725         (WebKit::LibWebRTCNetwork::isActive const):
2726
2727 2020-03-10  Diego Pino Garcia  <dpino@igalia.com>
2728
2729         REGRESSION(r258182): [GTK] Remove reference to unrequestedTextCheckingSequence
2730         https://bugs.webkit.org/show_bug.cgi?id=208852
2731
2732         Reviewed by Carlos Garcia Campos.
2733         
2734         unrequestedTextCheckingSequence was removed in r258182. This variable
2735         was still used in an assertion, which broke GTK Debug build.
2736
2737         * UIProcess/gtk/TextCheckerGtk.cpp:
2738         (WebKit::TextChecker::requestCheckingOfString):
2739
2740 2020-03-10  Chris Dumez  <cdumez@apple.com>
2741
2742         Drop unused DisableICECandidateFiltering / EnableICECandidateFiltering IPC messages
2743         https://bugs.webkit.org/show_bug.cgi?id=208843
2744         <rdar://problem/59683940>
2745
2746         Reviewed by Youenn Fablet.
2747
2748         * WebProcess/WebPage/WebPage.cpp:
2749         (WebKit::m_processDisplayName):
2750         (WebKit::WebPage::disableICECandidateFiltering): Deleted.
2751         (WebKit::WebPage::enableICECandidateFiltering): Deleted.
2752         * WebProcess/WebPage/WebPage.h:
2753         * WebProcess/WebPage/WebPage.messages.in:
2754
2755 2020-03-09  Megan Gardner  <megan_gardner@apple.com>
2756
2757         Build Fix
2758         https://bugs.webkit.org/show_bug.cgi?id=208838
2759
2760         Build fix of older iOS.
2761
2762         Reviewed by Tim Horton.
2763
2764         * UIProcess/ios/WKActionSheetAssistant.mm:
2765         (-[WKActionSheetAssistant showDataDetectorsSheet]):
2766         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2767         (-[WKFileUploadPanel showDocumentPickerMenu]):
2768
2769 2020-03-09  Simon Fraser  <simon.fraser@apple.com>
2770
2771         ASSERT(!m_textCheckingRequest) on editing/spelling/spellcheck-async-remove-frame.html
2772         https://bugs.webkit.org/show_bug.cgi?id=126606
2773
2774         Reviewed by Wenson Hsieh.
2775
2776         SpellChecker's sequence numbers need to be unique between frames, because they are sent out
2777         to EditorClient which may be one per web view, so use a static to hold the current
2778         sequence number.
2779
2780         Also convert from int to TextCheckingSequence to make them easier to find, and use
2781         Markable and Optional in TextCheckingRequestData to represent the unset state.
2782
2783         * Shared/WebCoreArgumentCoders.cpp:
2784         (IPC::ArgumentCoder<TextCheckingRequestData>::encode):
2785         (IPC::ArgumentCoder<TextCheckingRequestData>::decode):
2786
2787 2020-03-09  Don Olmstead  <don.olmstead@sony.com>
2788
2789         Remove obsolete feature flags
2790         https://bugs.webkit.org/show_bug.cgi?id=208830
2791
2792         Reviewed by Alex Christensen.
2793
2794         Remove ENABLE_CUSTOM_SCHEME_HANDLER and ENABLE_MAC_VIDEO_TOOLBOX since they
2795         are no longer used.
2796
2797         * Configurations/FeatureDefines.xcconfig:
2798         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: ENABLE(WIRELESS_TARGET_PLAYBACK) -> ENABLE(WIRELESS_PLAYBACK_TARGET).
2799         (-[WKWebViewConfiguration copyWithZone:]):
2800
2801 2020-03-09  Chris Dumez  <cdumez@apple.com>
2802
2803         [iOS] Replace "unexpectedly resumed" observer with RunningBoard suspendible assertions
2804         https://bugs.webkit.org/show_bug.cgi?id=205687
2805         <rdar://problem/57890246>
2806
2807         Reviewed by Tim Horton.
2808
2809         Adopt new RunningBoard process assertion to indicate that WebContent processes depend on their
2810         UIProcess (and therefore, the UIProcess must be running if the WebContent process is). This
2811         replaces our "Unexpectedly resumed" assertion which was causing unexpected terminations in some
2812         cases.
2813
2814         * Configurations/WebKit.xcconfig:
2815         * Platform/spi/ios/RunningBoardServicesSPI.h: Added.
2816         * Scripts/process-entitlements.sh:
2817         * Shared/DependencyProcessAssertion.cpp: Added.
2818         (WebKit::DependencyProcessAssertion::DependencyProcessAssertion):
2819         (WebKit::DependencyProcessAssertion::~DependencyProcessAssertion):
2820         * Shared/DependencyProcessAssertion.h: Added.
2821         * Shared/ios/DependencyProcessAssertionIOS.mm: Added.
2822         (WebKit::DependencyProcessAssertion::DependencyProcessAssertion):
2823         (WebKit::DependencyProcessAssertion::~DependencyProcessAssertion):
2824         * Sources.txt:
2825         * SourcesCocoa.txt:
2826         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2827         * UIProcess/WebProcessProxy.h:
2828         * UIProcess/WebProcessProxy.messages.in:
2829         * WebKit.xcodeproj/project.pbxproj:
2830         * WebProcess/WebProcess.cpp:
2831         (WebKit::WebProcess::initializeConnection):
2832         * WebProcess/WebProcess.h:
2833         * WebProcess/cocoa/WebProcessCocoa.mm:
2834
2835 2020-03-09  Per Arne Vollan  <pvollan@apple.com>
2836
2837         [macOS] Notification observer is not removed
2838         https://bugs.webkit.org/show_bug.cgi?id=208834
2839
2840         Reviewed by Tim Horton.
2841
2842         The Accessibility notification observer is not being removed on macOS.
2843
2844         API test: WebKit.EnableAccessibilityCrash
2845
2846         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2847         (WebKit::WebProcessPool::unregisterNotificationObservers):
2848
2849 2020-03-09  Per Arne Vollan  <pvollan@apple.com>
2850
2851         [iOS] Only map UTI from tags in Safari
2852         https://bugs.webkit.org/show_bug.cgi?id=208829
2853         <rdar://problem/60234672>
2854
2855         Reviewed by Tim Horton.
2856
2857         Since this mapping caused regressions in other apps, only enable it for Safari as a temporary workaround.
2858
2859         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2860         (WebKit::WebProcessPool::platformInitializeWebProcess):
2861         * WebProcess/cocoa/WebProcessCocoa.mm:
2862         (WebKit::WebProcess::platformInitializeWebProcess):
2863
2864 2020-03-09  Per Arne Vollan  <pvollan@apple.com>
2865
2866         Unreviewed build fix.
2867
2868         * Shared/WebProcessCreationParameters.cpp:
2869         (WebKit::WebProcessCreationParameters::decode):
2870
2871 2020-03-09  Jer Noble  <jer.noble@apple.com>
2872
2873         [GPUP] Implement Legacy EME API in the GPU Process
2874         https://bugs.webkit.org/show_bug.cgi?id=208402
2875         <rdar://problem/60178488>
2876
2877         Reviewed by Eric Carlson.
2878
2879         Follow-up: adding the RemoteLegacyCDMFactory as a suppliment got dropped from the initial patch by
2880         a merge/rebase mistake.
2881
2882         * WebProcess/WebProcess.cpp:
2883
2884 2020-03-09  David Kilzer  <ddkilzer@apple.com>
2885
2886         [IPC] WebPageProxy::dataSelectionForPasteboard should check the result of SharedMemory::map
2887         <https://webkit.org/b/208735>
2888         <rdar://problem/58701732>
2889
2890         Reviewed by Darin Adler.
2891
2892         * UIProcess/mac/WebPageProxyMac.mm:
2893         (WebKit::WebPageProxy::dataSelectionForPasteboard): Add null
2894         check.
2895
2896 2020-03-09  Antoine Quint  <graouts@apple.com>
2897
2898         Remove the compile-time flag for Pointer Events
2899         https://bugs.webkit.org/show_bug.cgi?id=208821
2900         <rdar://problem/60223471>
2901
2902         Reviewed by Dean Jackson.
2903
2904         * Configurations/FeatureDefines.xcconfig:
2905         * Shared/WebCoreArgumentCoders.h:
2906         * Shared/WebPreferencesDefaultValues.h:
2907         * UIProcess/API/ios/WKWebViewIOS.mm:
2908         (-[WKWebView scrollViewWillBeginZooming:withView:]):
2909         (-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
2910         (-[WKWebView _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]):
2911         * UIProcess/PageClient.h:
2912         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2913         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
2914         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
2915         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
2916         (WebKit::touchActionsForPoint):
2917         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
2918         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
2919         (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
2920         (-[WKScrollingNodeScrollViewDelegate cancelPointersForGestureRecognizer:]):
2921         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::cancelPointersForGestureRecognizer):
2922         * UIProcess/WebPageProxy.cpp:
2923         (WebKit::WebPageProxy::touchWithIdentifierWasRemoved):
2924         * UIProcess/WebPageProxy.h:
2925         * UIProcess/ios/PageClientImplIOS.h:
2926         * UIProcess/ios/PageClientImplIOS.mm:
2927         (WebKit::PageClientImpl::activeTouchIdentifierForGestureRecognizer):
2928         * UIProcess/ios/WKContentViewInteraction.h:
2929         * UIProcess/ios/WKContentViewInteraction.mm:
2930         (-[WKContentView preventsPanningInYAxis]):
2931         (-[WKContentView setupInteraction]):
2932         (-[WKContentView cleanupInteraction]):
2933         (-[WKContentView _removeDefaultGestureRecognizers]):
2934         (-[WKContentView _addDefaultGestureRecognizers]):
2935         (-[WKContentView activeTouchIdentifierForGestureRecognizer:]):
2936         (-[WKContentView _webTouchEventsRecognized:]):
2937         (-[WKContentView _resetPanningPreventionFlags]):
2938         (-[WKContentView _singleTapDidReset:]):
2939         (-[WKContentView _commitPotentialTapFailed]):
2940         (-[WKContentView _didCompleteSyntheticClick]):
2941         (-[WKContentView _singleTapRecognized:]):
2942         (-[WKContentView _didEndScrollingOrZooming]):
2943         * UIProcess/ios/WKSyntheticTapGestureRecognizer.h:
2944         * UIProcess/ios/WKSyntheticTapGestureRecognizer.mm:
2945         (-[WKSyntheticTapGestureRecognizer reset]):
2946         (-[WKSyntheticTapGestureRecognizer touchesEnded:withEvent:]):
2947         * UIProcess/ios/WKTouchActionGestureRecognizer.h:
2948         * UIProcess/ios/WKTouchActionGestureRecognizer.mm:
2949         * WebProcess/WebPage/WebPage.cpp:
2950         (WebKit::WebPage::touchWithIdentifierWasRemoved):
2951         * WebProcess/WebPage/WebPage.h:
2952         * WebProcess/WebPage/WebPage.messages.in:
2953
2954 2020-03-09  Rob Buis  <rbuis@igalia.com>
2955
2956         Rename urlSelected to changeLocation
2957         https://bugs.webkit.org/show_bug.cgi?id=208529
2958
2959         Reviewed by Darin Adler.
2960
2961         Adapt to API change.
2962
2963         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2964         (WebKit::PDFPlugin::clickedLink):
2965         * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
2966         (WebKit::WebContextMenuClient::searchWithGoogle):
2967         * WebProcess/WebPage/WebPage.cpp:
2968         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
2969
2970 2020-03-09  Jer Noble  <jer.noble@apple.com>
2971
2972         Unreviewed build fix after r258129: include WebCore/SimpleRange.h where VisibleSelection is used.
2973
2974         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
2975
2976 2020-03-09  Zan Dobersek  <zdobersek@igalia.com>
2977
2978         [WPE] AsyncScrolling: scrolling with the mouse wheel over sub-scrollable areas scrolls the main frame
2979         https://bugs.webkit.org/show_bug.cgi?id=208635
2980
2981         Reviewed by Carlos Garcia Campos.
2982
2983         Rework the default values for the async frame and overflow scrolling
2984         so that the latter stays disabled for Nicosia-using ports as it
2985         undergoes bigger changes.
2986
2987         * Shared/WebPreferencesDefaultValues.cpp:
2988         (WebKit::defaultAsyncFrameAndOverflowScrollingEnabled):
2989         (WebKit::defaultAsyncFrameScrollingEnabled):
2990
2991 2020-03-09  Carlos Garcia Campos  <cgarcia@igalia.com>
2992
2993         [GTK][WPE] Surrounding text for input methods should not be limited to the current paragraph
2994         https://bugs.webkit.org/show_bug.cgi?id=208706
2995
2996         Reviewed by Žan Doberšek.
2997
2998         It should include all the text around the cursor position.
2999
3000         * Shared/EditorState.cpp:
3001         (WebKit::EditorState::PostLayoutData::encode const): Rename paragraphContext* as surroundingContext*.
3002         (WebKit::EditorState::PostLayoutData::decode): Ditto.
3003         * Shared/EditorState.h:
3004         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3005         (webkitWebViewBaseUpdateTextInputState): Ditto.
3006         * UIProcess/API/wpe/WPEView.cpp:
3007         (WKWPE::View::selectionDidChange): Ditto.
3008         * WebProcess/WebPage/WebPage.cpp:
3009         (WebKit::WebPage::deleteSurrounding): Use content editable text as context instead of just paragraph.
3010         * WebProcess/WebPage/glib/WebPageGLib.cpp:
3011         (WebKit::WebPage::platformEditorState const): Ditto.
3012
3013 2020-03-07  Darin Adler  <darin@apple.com>
3014
3015         Begin moving off of live ranges for WebKit internals
3016         https://bugs.webkit.org/show_bug.cgi?id=208432
3017
3018         Reviewed by Daniel Bates.
3019
3020         * Shared/EditingRange.cpp:
3021         (WebKit::EditingRange::fromRange): Initialize out arguments.
3022
3023         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp: Added include.
3024         * WebProcess/WebPage/FindController.cpp: Ditto.
3025         * WebProcess/WebPage/WebPage.cpp: Ditto.
3026         * WebProcess/WebPage/mac/WebPageMac.mm: Ditto.
3027
3028 2020-03-08  Wenson Hsieh  <wenson_hsieh@apple.com>
3029
3030         CAN_SECURELY_ARCHIVE_FILE_WRAPPER incorrectly excludes watchOS and tvOS
3031         https://bugs.webkit.org/show_bug.cgi?id=208791
3032
3033         Reviewed by Tim Horton.
3034
3035         This is one of several places where a __IPHONE_OS_VERSION_MIN_REQUIRED check unintentionally caused a compiler
3036         flag to not be defined on watchOS, when it really should apply to all iOS family targets. Now that we don't
3037         care about building for any iOS family targets aligned with iOS 11 or prior, and also don't build for 10.13 and
3038         prior, we can simply remove the !CAN_SECURELY_ARCHIVE_FILE_WRAPPER codepath.
3039
3040         * UIProcess/API/Cocoa/APIAttachmentCocoa.mm:
3041         (API::Attachment::createSerializedRepresentation const):
3042         (API::Attachment::updateFromSerializedRepresentation):
3043
3044 2020-03-08  Brent Fulgham  <bfulgham@apple.com>
3045
3046         Revise In-App Browser Privacy checks to better reflect the meaning of the flag
3047         https://bugs.webkit.org/show_bug.cgi?id=208793
3048         <rdar://problem/60206256>
3049
3050         Reviewed by John Wilander.
3051
3052         The 'isInAppBrowserPrivacyEnabled' seems like a feature, but it's really an internal debugging flag.
3053
3054         Revise the use of these calls to make it clearer.
3055
3056         Tested by existing test cases.
3057
3058         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3059         (WebKit::NetworkSessionCocoa::sessionWrapperForTask):
3060         * UIProcess/WebPageProxy.cpp:
3061         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
3062
3063 2020-03-08  Brady Eidson  <beidson@apple.com>
3064
3065         Remember completed subranges during incremental PDF loading.
3066         https://bugs.webkit.org/show_bug.cgi?id=208785
3067
3068         Reviewed by Tim Horton.
3069
3070         When a range request from a stream loader completes, we will now extend the main resource buffer
3071         to be large enough to hold that range, then we memcpy the data into the main buffer.
3072         
3073         We then keep a RangeSet to remember which ranges we've loaded.
3074         Any future range request that comes in we first check against that RangeSet to see if we can handle it from memory.
3075         
3076         This is a necessary optimization because PDFKit tends to ask for the same (or overlapping) ranges quite often.
3077         
3078         * WebProcess/Plugins/PDF/PDFPlugin.h:
3079         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3080         (WebKit::PDFPlugin::ByteRangeRequest::completeWithAccumulatedData):
3081         (WebKit::PDFPlugin::ByteRangeRequest::maybeComplete):
3082         (WebKit::PDFPlugin::pdfDocumentDidLoad):
3083         (WebKit::PDFPlugin::manualStreamDidReceiveData):
3084
3085 2020-02-28  Jer Noble  <jer.noble@apple.com>
3086
3087         [GPUP] Implement Legacy EME API in the GPU Process
3088         https://bugs.webkit.org/show_bug.cgi?id=208402
3089
3090         Reviewed by Eric Carlson.
3091
3092         Add support for RemoteLegacyCDMFactory, RemateLegacyCDM,RemoteLegacyCDMSession, and all
3093         of their associated Proxy objects.
3094
3095         * DerivedSources-input.xcfilelist:
3096         * DerivedSources-output.xcfilelist:
3097         * DerivedSources.make:
3098         * GPUProcess/GPUConnectionToWebProcess.cpp:
3099         (WebKit::GPUConnectionToWebProcess::legacyCdmFactoryProxy):
3100         (WebKit::GPUConnectionToWebProcess::dispatchMessage):
3101         (WebKit::GPUConnectionToWebProcess::dispatchSyncMessage):
3102         * GPUProcess/GPUConnectionToWebProcess.h:
3103         * GPUProcess/media/RemoteLegacyCDMFactoryProxy.cpp: Added.
3104         (WebKit::RemoteLegacyCDMFactoryProxy::RemoteLegacyCDMFactoryProxy):
3105         (WebKit::RemoteLegacyCDMFactoryProxy::createCDM):
3106         (WebKit::RemoteLegacyCDMFactoryProxy::supportsKeySystem):
3107         (WebKit::RemoteLegacyCDMFactoryProxy::didReceiveCDMMessage):
3108         (WebKit::RemoteLegacyCDMFactoryProxy::didReceiveCDMSessionMessage):
3109         (WebKit::RemoteLegacyCDMFactoryProxy::didReceiveSyncCDMMessage):
3110         (WebKit::RemoteLegacyCDMFactoryProxy::didReceiveSyncCDMSessionMessage):
3111         (WebKit::RemoteLegacyCDMFactoryProxy::addProxy):
3112         (WebKit::RemoteLegacyCDMFactoryProxy::removeProxy):
3113         (WebKit::RemoteLegacyCDMFactoryProxy::addSession):
3114         (WebKit::RemoteLegacyCDMFactoryProxy::removeSession):
3115         (WebKit::RemoteLegacyCDMFactoryProxy::getSession const):
3116         * GPUProcess/media/RemoteLegacyCDMFactoryProxy.h: Added.
3117         * GPUProcess/media/RemoteLegacyCDMFactoryProxy.messages.in: Added.
3118         * GPUProcess/media/RemoteLegacyCDMProxy.cpp: Added.
3119         (WebKit::RemoteLegacyCDMProxy::create):
3120         (WebKit::RemoteLegacyCDMProxy::RemoteLegacyCDMProxy):
3121         (WebKit::RemoteLegacyCDMProxy::supportsMIMEType):
3122         (WebKit::RemoteLegacyCDMProxy::createSession):
3123         (WebKit::RemoteLegacyCDMProxy::setPlayerId):
3124         (WebKit::RemoteLegacyCDMProxy::cdmMediaPlayer const):
3125         * GPUProcess/media/RemoteLegacyCDMProxy.h: Added.
3126         (WebKit::RemoteLegacyCDMProxy::factory const):
3127         * GPUProcess/media/RemoteLegacyCDMProxy.messages.in: Added.
3128         * GPUProcess/media/RemoteLegacyCDMSessionProxy.cpp: Added.
3129         (WebKit::RemoteLegacyCDMSessionProxy::create):
3130         (WebKit::RemoteLegacyCDMSessionProxy::RemoteLegacyCDMSessionProxy):
3131         (WebKit::convertToUint8Array):
3132         (WebKit::convertToOptionalDataReference):
3133         (WebKit::RemoteLegacyCDMSessionProxy::generateKeyRequest):
3134         (WebKit::RemoteLegacyCDMSessionProxy::releaseKeys):
3135         (WebKit::RemoteLegacyCDMSessionProxy::update):
3136         (WebKit::RemoteLegacyCDMSessionProxy::getCachedKeyForKeyId):
3137         (WebKit::RemoteLegacyCDMSessionProxy::cachedKeyForKeyID):
3138         (WebKit::RemoteLegacyCDMSessionProxy::sendMessage):
3139         (WebKit::RemoteLegacyCDMSessionProxy::sendError):
3140         (WebKit::RemoteLegacyCDMSessionProxy::mediaKeysStorageDirectory const):
3141         * GPUProcess/media/RemoteLegacyCDMSessionProxy.h: Added.
3142         (WebKit::RemoteLegacyCDMSessionProxy::factory const):
3143         (WebKit::RemoteLegacyCDMSessionProxy::session const):
3144         (WebKit::RemoteLegacyCDMSessionProxy::setPlayer):
3145         * GPUProcess/media/RemoteLegacyCDMSessionProxy.messages.in: Added.
3146         * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
3147         (WebKit::RemoteMediaPlayerManagerProxy::getProxy):
3148         * GPUProcess/media/RemoteMediaPlayerManagerProxy.h:
3149         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
3150         (WebKit::RemoteMediaPlayerProxy::mediaPlayerCachedKeyForKeyId const):
3151         (WebKit::RemoteMediaPlayerProxy::mediaPlayerKeyNeeded):
3152         (WebKit::RemoteMediaPlayerProxy::setLegacyCDMSession):
3153         * GPUProcess/media/RemoteMediaPlayerProxy.h:
3154         * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
3155         * GPUProcess/media/RemoteTextTrackProxy.cpp:
3156         * GPUProcess/media/RemoteTextTrackProxy.h:
3157         * Scripts/webkit/messages.py:
3158         * Sources.txt:
3159         * WebKit.xcodeproj/project.pbxproj:
3160         * WebProcess/GPU/GPUProcessConnection.cpp:
3161         (WebKit::GPUProcessConnection::mediaPlayerManager):
3162         (WebKit::GPUProcessConnection::legacyCDMFactory):
3163         * WebProcess/GPU/GPUProcessConnection.h:
3164         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
3165         (WebKit::MediaPlayerPrivateRemote::setCDM):
3166         (WebKit::MediaPlayerPrivateRemote::setCDMSession):
3167         (WebKit::MediaPlayerPrivateRemote::mediaPlayerKeyNeeded):
3168         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
3169         * WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in:
3170         * WebProcess/GPU/media/RemoteLegacyCDM.cpp: Added.
3171         (WebKit::RemoteLegacyCDM::create):
3172         (WebKit::RemoteLegacyCDM::RemoteLegacyCDM):
3173         (WebKit::RemoteLegacyCDM::supportsMIMEType):
3174         (WebKit::RemoteLegacyCDM::createSession):
3175         (WebKit::RemoteLegacyCDM::setPlayerId):
3176         * WebProcess/GPU/media/RemoteLegacyCDM.h: Added.
3177         * WebProcess/GPU/media/RemoteLegacyCDMFactory.cpp: Added.
3178         (WebKit::RemoteLegacyCDMFactory::RemoteLegacyCDMFactory):
3179         (WebKit::RemoteLegacyCDMFactory::registerFactory):
3180         (WebKit::RemoteLegacyCDMFactory::supplementName):
3181         (WebKit::RemoteLegacyCDMFactory::gpuProcessConnection):
3182         (WebKit::RemoteLegacyCDMFactory::supportsKeySystem):
3183         (WebKit::RemoteLegacyCDMFactory::supportsKeySystemAndMimeType):
3184         (WebKit::RemoteLegacyCDMFactory::createCDM):
3185         (WebKit::RemoteLegacyCDMFactory::addSession):
3186         (WebKit::RemoteLegacyCDMFactory::removeSession):
3187         (WebKit::RemoteLegacyCDMFactory::findCDM const):
3188         (WebKit::RemoteLegacyCDMFactory::didReceiveSessionMessage):
3189         * WebProcess/GPU/media/RemoteLegacyCDMFactory.h: Added.
3190         * WebProcess/GPU/media/RemoteLegacyCDMIdentifier.h: Added.
3191         * WebProcess/GPU/media/RemoteLegacyCDMSession.cpp: Added.
3192         (WebKit::convertToArrayBuffer):
3193         (WebKit::convertToUint8Array):
3194         (WebKit::convertToOptionalDataReference):
3195         (WebKit::convertToDataReference):
3196         (WebKit::RemoteLegacyCDMSession::create):
3197         (WebKit::RemoteLegacyCDMSession::RemoteLegacyCDMSession):
3198         (WebKit::RemoteLegacyCDMSession::generateKeyRequest):
3199         (WebKit::RemoteLegacyCDMSession::releaseKeys):
3200         (WebKit::RemoteLegacyCDMSession::update):
3201         (WebKit::RemoteLegacyCDMSession::cachedKeyForKeyID const):
3202         (WebKit::RemoteLegacyCDMSession::sendMessage):
3203         (WebKit::RemoteLegacyCDMSession::sendError):
3204         * WebProcess/GPU/media/RemoteLegacyCDMSession.h: Added.
3205         * WebProcess/GPU/media/RemoteLegacyCDMSession.messages.in: Added.
3206         * WebProcess/GPU/media/RemoteLegacyCDMSessionIdentifier.h: Added.
3207         * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
3208         (WebKit::RemoteMediaPlayerManager::findRemotePlayerId):
3209         * WebProcess/GPU/media/RemoteMediaPlayerManager.h:
3210         * WebProcess/GPU/media/WebMediaStrategy.cpp:
3211         (WebKit::WebMediaStrategy::registerLegacyCDMFactories):
3212         * WebProcess/WebPage/WebPage.cpp:
3213         (WebKit::WebPage::updatePreferences):
3214         * WebProcess/WebProcess.cpp:
3215
3216 2020-03-08  Per Arne Vollan  <pvollan@apple.com>
3217
3218         [iOS] Mapping to UTI from tag and tag class should be performed in the UI process
3219         https://bugs.webkit.org/show_bug.cgi?id=208783
3220
3221         Reviewed by Brent Fulgham.
3222
3223         Send mapping from tag/tag class to UTI from the UI process to the WebContent process as part of the WebProcess
3224         creation parameters. Also, issue some mach-lookup extensions to the WebContent process if Accessibility is
3225         enabled.
3226
3227         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3228         * Shared/WebProcessCreationParameters.cpp:
3229         (WebKit::WebProcessCreationParameters::encode const):
3230         (WebKit::WebProcessCreationParameters::decode):
3231         * Shared/WebProcessCreationParameters.h:
3232         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3233         (WebKit::WebProcessPool::platformInitializeWebProcess):
3234         * WebProcess/cocoa/WebProcessCocoa.mm:
3235         (WebKit::WebProcess::platformInitializeWebProcess):
3236
3237 2020-03-08  Per Arne Vollan  <pvollan@apple.com>
3238
3239         REGRESSION (r258064): API tests intermittently crashing under WebKit::registerDefaultsOverride
3240         https://bugs.webkit.org/show_bug.cgi?id=208784
3241         <rdar://problem/60201631>
3242
3243         Reviewed by Darin Adler.
3244
3245         Speculative crash fix; swizzle [NSUserDefaults registerDefaults:] on the main thread, instead of on a worker thread.
3246
3247         No new tests, since I have not been able to reproduce this issue.
3248
3249         * UIProcess/Cocoa/PreferenceObserver.h:
3250         * UIProcess/Cocoa/PreferenceObserver.mm:
3251         (registerDefaultsOverride):
3252         (+[WKPreferenceObserver swizzleRegisterDefaults]):
3253         (-[WKPreferenceObserver init]):
3254         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3255         (WebKit::WebProcessPool::platformInitialize):
3256
3257 2020-03-08  Wenson Hsieh  <wenson_hsieh@apple.com>
3258
3259         Lazily generate CGPaths for some simple types of paths, such as arcs and lines
3260         https://bugs.webkit.org/show_bug.cgi?id=208464
3261         <rdar://problem/59963226>
3262
3263         Reviewed by Daniel Bates, Darin Adler and Tim Horton.
3264
3265         Add argument coders for `WTF::Monostate`, so that Variants of the form: `Variant<Monostate, Foo, Bar>` can be
3266         encoded and decoded over IPC.
3267
3268         * Platform/IPC/ArgumentCoders.cpp:
3269         (IPC::ArgumentCoder<Monostate>::encode):
3270         (IPC::ArgumentCoder<Monostate>::decode):
3271         * Platform/IPC/ArgumentCoders.h:
3272
3273 2020-03-08  Brady Eidson  <beidson@apple.com>
3274
3275         Better stream loader management with incremental PDF loading.
3276         https://bugs.webkit.org/show_bug.cgi?id=208790
3277
3278         Reviewed by Tim Horton.
3279
3280         When a stream loader was completing normally, we were leaking it forever.
3281         This adds much better management of outstanding stream loaders
3282         (and logging to help verify the count is as expected)
3283
3284         * WebProcess/Plugins/PDF/PDFPlugin.h:
3285         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3286         (WebKit::PDFPlugin::getResourceBytesAtPosition):
3287         (WebKit::PDFPlugin::ByteRangeRequest::completeWithBytes):
3288         (WebKit::PDFPlugin::ByteRangeRequest::completeWithAccumulatedData):
3289         (WebKit::PDFPlugin::ByteRangeRequest::maybeComplete):
3290         (WebKit::PDFPlugin::ByteRangeRequest::completeUnconditionally):
3291         (WebKit::PDFPlugin::didReceiveResponse):
3292         (WebKit::PDFPlugin::didFinishLoading):
3293         (WebKit::PDFPlugin::forgetLoader):
3294         (WebKit::PDFPlugin::cancelAndForgetLoader):
3295
3296 2020-03-08  Konstantin Tokarev  <annulen@yandex.ru>
3297
3298         [CMake] Some fixes for building Mac port
3299         https://bugs.webkit.org/show_bug.cgi?id=208770
3300
3301         Reviewed by Don Olmstead.
3302
3303         * PlatformMac.cmake:
3304
3305 2020-03-08  Andres Gonzalez  <andresg_22@apple.com>
3306
3307         Implementation of AccessibilitySupport AXSIsolatedTreeMode.
3308         https://bugs.webkit.org/show_bug.cgi?id=208691
3309         <rdar://problem/60178602>
3310
3311         Reviewed by Chris Fleizach.
3312
3313         Honors system AccessibilitySupport IsolatedTreeMode setting.
3314
3315         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
3316         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
3317
3318 2020-03-08  Megan Gardner  <megan_gardner@apple.com>
3319
3320         Build Fix Watch
3321         https://bugs.webkit.org/show_bug.cgi?id=208789
3322
3323         Reviewed by Tim Horton.
3324
3325         * UIProcess/ios/WKActionSheetAssistant.mm:
3326         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3327         (-[WKFileUploadPanel dealloc]):
3328         (-[WKFileUploadPanel showDocumentPickerMenu]):
3329
3330 2020-03-08  Tim Horton  <timothy_horton@apple.com>
3331
3332         Fix the watchOS build
3333
3334         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3335         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
3336
3337 2020-03-08  Megan Gardner  <megan_gardner@apple.com>
3338
3339         Build Fix
3340         https://bugs.webkit.org/show_bug.cgi?id=208787
3341         <rdar://problem/60203011>
3342
3343         Reviewed by Tim Horton.
3344
3345         * Platform/spi/ios/UIKitSPI.h:
3346         * UIProcess/ios/WKActionSheetAssistant.mm:
3347         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3348         (-[WKFileUploadPanel showDocumentPickerMenu]):
3349
3350 2020-03-06  Jer Noble  <jer.noble@apple.com>
3351
3352         [GPUP] Move AVSystemController code into the GPU process
3353         https://bugs.webkit.org/show_bug.cgi?id=208727
3354
3355         Reviewed by Eric Carlson.
3356
3357         Add a new class pair RemoteMediaSessionHelper/Proxy.
3358
3359         * DerivedSources-input.xcfilelist:
3360         * DerivedSources-output.xcfilelist:
3361         * DerivedSources.make:
3362         * GPUProcess/GPUConnectionToWebProcess.cpp:
3363         (WebKit::GPUConnectionToWebProcess::mediaSessionHelperProxy):
3364         (WebKit::GPUConnectionToWebProcess::ensureMediaSessionHelper):
3365         * GPUProcess/GPUConnectionToWebProcess.h:
3366         * GPUProcess/GPUConnectionToWebProcess.messages.in:
3367         * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp: Added.
3368         (WebKit::RemoteMediaSessionHelperProxy::RemoteMediaSessionHelperProxy):
3369         (WebKit::RemoteMediaSessionHelperProxy::~RemoteMediaSessionHelperProxy):
3370         (WebKit::RemoteMediaSessionHelperProxy::startMonitoringWirelessRoutes):
3371         (WebKit::RemoteMediaSessionHelperProxy::stopMonitoringWirelessRoutes):
3372         (WebKit::RemoteMediaSessionHelperProxy::providePresentingApplicationPID):
3373         (WebKit::RemoteMediaSessionHelperProxy::receivedInterruption):
3374         (WebKit::RemoteMediaSessionHelperProxy::applicationWillEnterForeground):
3375         (WebKit::RemoteMediaSessionHelperProxy::applicationDidEnterBackground):
3376         (WebKit::RemoteMediaSessionHelperProxy::applicationWillBecomeInactive):
3377         (WebKit::RemoteMediaSessionHelperProxy::applicationDidBecomeActive):
3378         (WebKit::RemoteMediaSessionHelperProxy::externalOutputDeviceAvailableDidChange):
3379         (WebKit::RemoteMediaSessionHelperProxy::isPlayingToAutomotiveHeadUnitDidChange):
3380         (WebKit::RemoteMediaSessionHelperProxy::activeAudioRouteDidChange):
3381         (WebKit::RemoteMediaSessionHelperProxy::activeVideoRouteDidChange):
3382         * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.h: Added.
3383         * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.messages.in: Added.
3384         * Sources.txt:
3385         * SourcesCocoa.txt:
3386         * WebKit.xcodeproj/project.pbxproj:
3387         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp: Added.
3388         (WebKit::RemoteMediaSessionHelper::RemoteMediaSessionHelper):
3389         (WebKit::RemoteMediaSessionHelper::connection):
3390         (WebKit::RemoteMediaSessionHelper::startMonitoringWirelessRoutes):
3391         (WebKit::RemoteMediaSessionHelper::stopMonitoringWirelessRoutes):
3392         (WebKit::RemoteMediaSessionHelper::providePresentingApplicationPID):
3393         (WebKit::RemoteMediaSessionHelper::receivedInterruption):
3394         (WebKit::RemoteMediaSessionHelper::applicationWillEnterForeground):
3395         (WebKit::RemoteMediaSessionHelper::applicationDidEnterBackground):
3396         (WebKit::RemoteMediaSessionHelper::applicationWillBecomeInactive):
3397         (WebKit::RemoteMediaSessionHelper::applicationDidBecomeActive):
3398         (WebKit::RemoteMediaSessionHelper::externalOutputDeviceAvailableDidChange):
3399         (WebKit::RemoteMediaSessionHelper::isPlayingToAutomotiveHeadUnitDidChange):
3400         (WebKit::RemoteMediaSessionHelper::activeAudioRouteDidChange):
3401         (WebKit::RemoteMediaSessionHelper::activeVideoRouteDidChange):
3402         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.h: Added.
3403         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.messages.in: Added.
3404         * WebProcess/WebProcess.cpp:
3405         (WebKit::WebProcess::setUseGPUProcessForMedia):
3406
3407 2020-03-08  Jer Noble  <jer.noble@apple.com>
3408
3409         [GPUP] Null-dereference crash in GPUProcessProxy::openGPUProcessConnection()
3410         https://bugs.webkit.org/show_bug.cgi?id=208772
3411
3412         Reviewed by Maciej Stachowiak.
3413
3414         AuxiliaryProcessProxy::connection() will return a null-pointer if called before the remote
3415         process has launched and a connection established. Rather than send a message directly to
3416         the proxy's IPC::Connection object (which can be null), just call sendWithAsyncReply()
3417         directly on the proxy inself, which will correctly enqueue the message for sending when the
3418         connection is fully established.
3419
3420         Because this crash occurs whenever the "useGPUProcessForMedia" setting is enabled, this is
3421         covered by existing WP2 tests when those tests are run with that setting enabled.
3422
3423         * UIProcess/GPU/GPUProcessProxy.cpp:
3424         (WebKit::GPUProcessProxy::openGPUProcessConnection):
3425
3426 2020-03-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
3427
3428         Canvas drawing commands have to be flushed to the GPUProcess in batches
3429         https://bugs.webkit.org/show_bug.cgi?id=208597
3430
3431         Reviewed by Myles C. Maxfield.
3432
3433         RemoteImageBuffer, which is a superclass of DisplayList::ImageBuffer, will
3434         prevent growing its DisplayList more than some limit (512 for now).
3435         When this limit is reached, the recoded DisplayListItems will be flushed to
3436         the GPUProcess in a batch. Flushing this batch would not require GPUProcess
3437         to reply back. RemoteImageBuffer will have to run a full flush anyway
3438         when the pixels are needed because the batch flushing does not include the
3439         current DisplayList::Item.
3440
3441         * GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h:
3442         * GPUProcess/graphics/RemoteImageBufferProxy.h:
3443         * GPUProcess/graphics/RemoteRenderingBackendProxy.cpp:
3444         (WebKit::RemoteRenderingBackendProxy::flushImageBufferDrawingContext):
3445         (WebKit::RemoteRenderingBackendProxy::flushImageBufferDrawingContextAndCommit):
3446         * GPUProcess/graphics/RemoteRenderingBackendProxy.h:
3447         * GPUProcess/graphics/RemoteRenderingBackendProxy.messages.in:
3448         * WebProcess/GPU/graphics/RemoteImageBuffer.h:
3449         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp:
3450         (WebKit::RemoteImageBufferMessageHandler::flushDrawingContext):
3451         (WebKit::RemoteImageBufferMessageHandler::flushDrawingContextAndWaitCommit):
3452
3453 2020-03-08  Konstantin Tokarev  <annulen@yandex.ru>
3454
3455         [GTK] Fix compilation with disabled OpenGL
3456         https://bugs.webkit.org/show_bug.cgi?id=208773
3457
3458         Reviewed by Yusuke Suzuki.
3459
3460         * UIProcess/API/glib/WebKitProtocolHandler.cpp:
3461         (WebKit::WebKitProtocolHandler::handleGPU):
3462
3463 2020-03-08  Megan Gardner  <megan_gardner@apple.com>
3464
3465         Adopt Context Menus for Data Detectors
3466         https://bugs.webkit.org/show_bug.cgi?id=208779
3467
3468         Switch to context menus for data detector action sheets.
3469
3470         Reviewed by Tim Horton.
3471
3472         * UIProcess/ios/WKActionSheetAssistant.h:
3473         * UIProcess/ios/WKActionSheetAssistant.mm:
3474         (-[WKActionSheetAssistant removeContextMenuInteraction]):
3475         (-[WKActionSheetAssistant ensureContextMenuInteraction]):
3476         (-[WKActionSheetAssistant showDataDetectorsSheet]):
3477         (-[WKActionSheetAssistant contextMenuInteraction:configurationForMenuAtLocation:]):
3478         (-[WKActionSheetAssistant contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
3479         (-[WKActionSheetAssistant _contextMenuInteraction:styleForMenuWithConfiguration:]):
3480         (-[WKActionSheetAssistant contextMenuInteraction:willEndForConfiguration:animator:]):
3481         * UIProcess/ios/WKContentViewInteraction.mm:
3482         (-[WKContentView contextMenuDisplayLocationForActionSheetAssistant:]):
3483
3484 2020-03-07  Brent Fulgham  <bfulgham@apple.com>
3485
3486         Create a flag to disable in-app browser quirks
3487         https://bugs.webkit.org/show_bug.cgi?id=208777
3488         <rdar://problem/60062197>
3489
3490         Reviewed by Simon Fraser.
3491
3492         This patch makes the following changes:
3493
3494         1. Adds a new flag 'NeedsInAppBrowserPrivacyQuirks' to allow quirks to be toggled
3495            during testing.
3496         2. Reclassify this new flag, and the existing 'InAppBrowserPrivacyEnabled' flag from 
3497            'settings' to Internal Debug settings
3498
3499         The renamed flags are covered by existing tests.
3500
3501         * FeatureFlags/WebKit.plist:
3502         * Shared/WebPageCreationParameters.cpp:
3503         (WebKit::WebPageCreationParameters::encode const):
3504         (WebKit::WebPageCreationParameters::decode):
3505         * Shared/WebPageCreationParameters.h:
3506         * Shared/WebPreferences.yaml:
3507         * Shared/WebPreferencesDefaultValues.cpp:
3508         (WebKit::defaultInAppBrowserPrivacy):
3509         (WebKit::defaultNeedsInAppBrowserPrivacyQuirks):
3510         * Shared/WebPreferencesDefaultValues.h:
3511         * UIProcess/API/Cocoa/WKPreferences.mm:
3512         (-[WKPreferences _needsInAppBrowserPrivacyQuirks]):
3513         (-[WKPreferences _setNeedsInAppBrowserPrivacyQuirks:]):
3514         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3515         * UIProcess/WebPageProxy.cpp:
3516         * WebProcess/WebPage/WebPage.cpp:
3517         (WebKit::WebPage::runJavaScript):
3518         * WebProcess/WebPage/WebPage.h:
3519
3520 2020-03-07  Simon Fraser  <simon.fraser@apple.com>
3521
3522         Generalize setSynchronousScrollingReasons() to take a ScrollingNodeID
3523         https://bugs.webkit.org/show_bug.cgi?id=208774
3524
3525         Reviewed by Zalan Bujtas.
3526
3527         Whitespace.
3528
3529         * WebProcess/WebPage/EventDispatcher.h:
3530
3531 2020-03-07  Brady Eidson  <beidson@apple.com>
3532
3533         Make PDF range requests to the network.
3534         https://bugs.webkit.org/show_bug.cgi?id=208776
3535
3536         Reviewed by Alex Christensen.
3537
3538         We already handle a set of range requests from our data provider callbacks.
3539         The current strategy is "wait until we've streamed enough of the entire resource, 
3540         perform that request's callback"
3541         
3542         For linearized PDFs the second request ever made is for the very end of the PDF document,
3543         so we have to wait for the entire document to load (which is what we already do in non-incremental mode)
3544         
3545         Now, we'll actually make the requests for missing data chunks from the network by using the document's request
3546         and adding range headers.
3547         
3548         While it is now entirely misnamed, NetscapePlugInStreamLoader is a perfect fit for this.
3549         
3550         Once the range request completes from the network we can unblock the PDF thread and go to the next request.
3551
3552         * WebProcess/Plugins/PDF/PDFPlugin.h:
3553         * WebProcess/Plugins/PDF/PDFPlugin.mm: