0fcd3da77d3c7ba3f7f8aa201441d35d0eb37098
[WebKit.git] / Source / WebKit / ChangeLog
1 2019-10-30  Peng Liu  <peng.liu6@apple.com>
2
3         [Picture-in-Picture Web API] Enable the support for iOS
4         https://bugs.webkit.org/show_bug.cgi?id=202618
5
6         Reviewed by Jer Noble.
7
8         Enable the Picture-in-Picture API support for iOS (iPad only).
9
10         * Configurations/FeatureDefines.xcconfig:
11         * WebProcess/cocoa/VideoFullscreenManager.mm:
12
13 2019-10-30  Alex Christensen  <achristensen@webkit.org>
14
15         Prevent Mac CMake build from bit rotting
16         https://bugs.webkit.org/show_bug.cgi?id=203647
17
18         Rubber-stamped by Tim Horton.
19
20         * NetworkProcess/NetworkProcess.cpp:
21         (WebKit::m_messagePortChannelRegistry):
22         * PlatformMac.cmake:
23         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
24         (-[_WKWebAuthenticationPanel delegate]):
25         (-[_WKWebAuthenticationPanel setDelegate:]):
26         * UIProcess/WebProcessProxy.cpp:
27
28 2019-10-30  Per Arne Vollan  <pvollan@apple.com>
29
30         It should be possible to create a mach sandbox extension for the WebContent process before the audit token is known
31         https://bugs.webkit.org/show_bug.cgi?id=203618
32
33         Reviewed by Brent Fulgham.
34
35         Currently, we are only able to create a mach sandbox extension for the WebContent process if we know its
36         audit token. It should be possible to create a mach extension without the audit token, since this is
37         needed when we want to create extensions before the PID or audit token is known. These extensions are
38         typically sent in the WebProcess creation parameters.
39         
40         No new tests, this is not a behavior change, but a patch in preparation for future patches.
41
42         * Shared/Cocoa/SandboxExtensionCocoa.mm:
43         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
44         (WebKit::SandboxExtension::createHandleForMachLookup):
45         (WebKit::SandboxExtension::createHandleForMachLookupByAuditToken): Deleted.
46         * Shared/SandboxExtension.h:
47         * UIProcess/ios/WebProcessProxyIOS.mm:
48         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
49
50 2019-10-30  Per Arne Vollan  <pvollan@apple.com>
51
52         Fix some sysctl read violations in the WebContent process
53         https://bugs.webkit.org/show_bug.cgi?id=203632
54
55         Reviewed by Brent Fulgham.
56
57         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
58
59 2019-10-30  Dean Jackson  <dino@apple.com>
60
61         REGRESSION(r251568) If we didn't start a Service Worker, don't try talking to it
62         https://bugs.webkit.org/show_bug.cgi?id=203639
63         <rdar://problem/56762071>
64
65         Reviewed by Chris Dumez.
66
67         Similar to the fix that introduced this regression, if the UI process does
68         not have the entitlement to start a service worker, we should not try
69         to load with one.
70
71         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
72         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad): If the
73         parent process doesn't have a service worker, use the regular load path.
74
75 2019-10-30  Simon Fraser  <simon.fraser@apple.com>
76
77         Turn Resize Observer on by default
78         https://bugs.webkit.org/show_bug.cgi?id=203644
79         rdar://problem/56026799
80
81         Reviewed by Tim Horton.
82
83         Change the defaultValue of Resize Observer to true.
84
85         * Shared/WebPreferences.yaml:
86
87 2019-10-30  Per Arne Vollan  <pvollan@apple.com>
88
89         Lookup to mach services with the WebKit extension should list the allowed services
90         https://bugs.webkit.org/show_bug.cgi?id=203619
91
92         Reviewed by Alexey Proskuryakov.
93
94         To tighten the mach lookup rule which allows lookup to services with the "com.apple.webkit.extension.mach"
95         extension, all allowed services should be listed. Currently, we are only creating mach lookup extensions to
96         "com.apple.iphone.axserver-systemwide", but more will come in the future.
97
98         No new tests. Testing this requires UI interaction on the device to enable Accessibility.
99
100         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
101
102 2019-10-30  Alex Christensen  <achristensen@webkit.org>
103
104         WKContentRuleLists should block requests from service workers
105         https://bugs.webkit.org/show_bug.cgi?id=201980
106         <rdar://problem/55516735>
107
108         Reviewed by Chris Dumez.
109
110         Test: http/tests/contentextensions/service-worker.https.html
111
112         Also covered by an API test.
113
114         * Shared/ServiceWorkerInitializationData.cpp: Added.
115         (WebKit::ServiceWorkerInitializationData::encode const):
116         (WebKit::ServiceWorkerInitializationData::decode):
117         * Shared/ServiceWorkerInitializationData.h: Added.
118         * Sources.txt:
119         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
120         (WebKit::WebUserContentControllerProxy::addProcess):
121         (WebKit::WebUserContentControllerProxy::contentRuleListData):
122         * UIProcess/UserContent/WebUserContentControllerProxy.h:
123         * UIProcess/WebProcessPool.cpp:
124         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
125         (WebKit::WebProcessPool::createWebPage):
126         * UIProcess/WebProcessPool.h:
127         * UIProcess/WebProcessProxy.cpp:
128         (WebKit::WebProcessProxy::createForServiceWorkers):
129         (WebKit::WebProcessProxy::establishServiceWorkerContext):
130         (WebKit::contentRuleListsFromIdentifier):
131         (WebKit::WebProcessProxy::enableServiceWorkers):
132         * UIProcess/WebProcessProxy.h:
133         * WebKit.xcodeproj/project.pbxproj:
134         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
135         (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
136         (WebKit::m_userAgent):
137         (WebKit::WebSWContextManagerConnection::installServiceWorker):
138         * WebProcess/Storage/WebSWContextManagerConnection.h:
139         * WebProcess/WebProcess.cpp:
140         (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess):
141         * WebProcess/WebProcess.h:
142         * WebProcess/WebProcess.messages.in:
143
144 2019-10-30  Andres Gonzalez  <andresg_22@apple.com>
145
146         Create base class common to AccessibilityObject and AXIsolatedTreeNode.
147         https://bugs.webkit.org/show_bug.cgi?id=203408
148
149         Reviewed by Chris Fleizach.
150
151         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
152         (WKAccessibilityRootObject):
153         (WKAccessibilityFocusedObject):
154
155 2019-10-30  Chris Dumez  <cdumez@apple.com>
156
157         Unreviewed, fix reversed assertion landed in r251778.
158
159         * UIProcess/ProcessThrottler.h:
160         (WebKit::ProcessThrottler::Activity::invalidate):
161
162 2019-10-30  Chris Dumez  <cdumez@apple.com>
163
164         Unreviewed, fix WatchOS build after r251778.
165
166         * UIProcess/WebProcessProxy.h:
167
168 2019-10-30  Chris Dumez  <cdumez@apple.com>
169
170         WKFrameIsDisplayingMarkupDocument() should return true after a window.open/document.write
171         https://bugs.webkit.org/show_bug.cgi?id=203587
172         <rdar://problem/56717726>
173
174         Reviewed by Alex Christensen.
175
176         When doing a document.open(), we were propagating the document's URL to the UIProcess but not its
177         MIME type. WKFrameIsDisplayingMarkupDocument() was relying on this MIME type.
178
179         * UIProcess/WebFrameProxy.cpp:
180         (WebKit::WebFrameProxy::didExplicitOpen):
181         * UIProcess/WebFrameProxy.h:
182         * UIProcess/WebPageProxy.cpp:
183         (WebKit::WebPageProxy::didExplicitOpenForFrame):
184         * UIProcess/WebPageProxy.h:
185         * UIProcess/WebPageProxy.messages.in:
186         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
187         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
188         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
189
190 2019-10-30  Chris Dumez  <cdumez@apple.com>
191
192         REGRESSION (r238252): HTTP POST is losing application/x-www-form-urlencoded body if there's a redirect to different host
193         https://bugs.webkit.org/show_bug.cgi?id=201950
194         <rdar://problem/55577782>
195
196         Reviewed by Alex Christensen.
197
198         The resource request body was getting lost on cross-site redirects. This was caused by the fact that a cross-site
199         redirect would cause a process-swap and the request to start again from a new process. This would work fine if
200         the request does not have a body. However, we have an optimization in place which avoids encoding the request body
201         whenever it is sent over IPC. Because the WebResourceLoader::WillSendRequest IPC would not encode the request body,
202         any decision to process swap as a result of this IPC (i.e. redirect) would cause the new request in the new process
203         to be missing its body. To address the issue, we now make sure to pass the request body in the WillSendRequest IPC
204         and reconsile the request with its body on the recipient side.
205
206         Test: http/tests/misc/form-submit-file-cross-site-redirect.html
207
208         * NetworkProcess/NetworkResourceLoader.cpp:
209         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
210         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
211         (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse):
212         * WebProcess/Network/WebResourceLoader.cpp:
213         (WebKit::WebResourceLoader::willSendRequest):
214         * WebProcess/Network/WebResourceLoader.h:
215         * WebProcess/Network/WebResourceLoader.messages.in:
216
217 2019-10-30  Jer Noble  <jer.noble@apple.com>
218
219         Enable Remote Playback API by default
220         https://bugs.webkit.org/show_bug.cgi?id=203595
221
222         Reviewed by Eric Carlson.
223
224         * Shared/WebPreferences.yaml:
225
226 2019-10-30  Chris Dumez  <cdumez@apple.com>
227
228         [iOS] [WK2] Improve process assertion-related logging to help identify causes of leaked assertions
229         https://bugs.webkit.org/show_bug.cgi?id=203438
230
231         Reviewed by Antti Koivisto.
232
233         Improve process assertion-related logging to help identify causes of leaked assertions. Previously,
234         whenever our code needed to prevent suspension of a child process due to some kind of activity, it
235         would simply grab a "token" from the child process' ProcessThrottler. This, in-turn, would cause
236         the ProcessThrottler to take the right kind of ProcessAssertion or release it when nobody holds
237         any tokens any more.
238
239         We frequently have issues where the UIProcess keeps its assertions around for too long after getting
240         backgrounding. This causes the assertions to get invalidated and the UIProcess will usually suspend
241         (albeit with a delay, which is bad for power). Sometimes though, we get killed because our invalidation
242         handler does not get a chance to release the assertion in time.
243
244         Finding out why we're keeping around assertions is currently very difficult because we cannot easily
245         see in the logs who is still holding ProcessThrottler tokens. To make such debugging easier, clients
246         now notify the ProcessThrottler when they start some activity and provide a user-readable description
247         of the activity. The client then gets a ForegroundActivity or BackgroundActivity object instead of
248         simply a token. As a result, we are now able to log when a given activity that prevents suspension
249         begins and ends, with a user-friendly string. Also, when the assertion gets invalidated, it will
250         invalidate all these pending activities and we'll see in the logs the name of the activities that
251         were still going on upon invalidation.
252
253         * Shared/API/Cocoa/RemoteObjectRegistry.h:
254         (WebKit::RemoteObjectRegistry::backgroundActivity):
255         * Shared/API/Cocoa/RemoteObjectRegistry.mm:
256         (WebKit::RemoteObjectRegistry::sendInvocation):
257         * UIProcess/Cocoa/DownloadClient.h:
258         * UIProcess/Cocoa/DownloadClient.mm:
259         (WebKit::DownloadClient::takeActivityToken):
260         (WebKit::DownloadClient::releaseActivityTokenIfNecessary):
261         * UIProcess/Cocoa/NavigationState.h:
262         * UIProcess/Cocoa/NavigationState.mm:
263         (WebKit::NavigationState::NavigationState):
264         (WebKit::NavigationState::releaseNetworkActivity):
265         (WebKit::NavigationState::didChangeIsLoading):
266         (WebKit::NavigationState::didSwapWebProcesses):
267         * UIProcess/Cocoa/UIRemoteObjectRegistry.cpp:
268         (WebKit::UIRemoteObjectRegistry::backgroundActivity):
269         * UIProcess/Cocoa/UIRemoteObjectRegistry.h:
270         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
271         (WebKit::WebProcessProxy::processWasResumed):
272         * UIProcess/GenericCallback.h:
273         (WebKit::CallbackBase::CallbackBase):
274         (WebKit::GenericCallback::create):
275         (WebKit::GenericCallback::GenericCallback):
276         (WebKit::CallbackMap::put):
277         * UIProcess/Network/NetworkProcessProxy.cpp:
278         (WebKit::NetworkProcessProxy::fetchWebsiteData):
279         (WebKit::NetworkProcessProxy::deleteWebsiteData):
280         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
281         (WebKit::NetworkProcessProxy::didClose):
282         (WebKit::NetworkProcessProxy::setIsHoldingLockedFiles):
283         (WebKit::NetworkProcessProxy::syncAllCookies):
284         (WebKit::NetworkProcessProxy::didSyncAllCookies):
285         * UIProcess/Network/NetworkProcessProxy.h:
286         * UIProcess/ProcessThrottler.cpp:
287         (WebKit::ProcessThrottler::ProcessThrottler):
288         (WebKit::ProcessThrottler::~ProcessThrottler):
289         (WebKit::ProcessThrottler::addActivity):
290         (WebKit::ProcessThrottler::removeActivity):
291         (WebKit::ProcessThrottler::invalidateAllActivities):
292         (WebKit::ProcessThrottler::expectedAssertionState):
293         (WebKit::ProcessThrottler::setAssertionState):
294         (WebKit::ProcessThrottler::uiAssertionWillExpireImminently):
295         * UIProcess/ProcessThrottler.h:
296         (WebKit::ProcessThrottler::Activity::Activity):
297         (WebKit::ProcessThrottler::Activity::~Activity):
298         (WebKit::ProcessThrottler::Activity::isValid const):
299         (WebKit::ProcessThrottler::Activity::invalidate):
300         (WebKit::ProcessThrottler::shouldBeRunnable const):
301         (WebKit::ProcessThrottler::foregroundActivity):
302         (WebKit::ProcessThrottler::backgroundActivity):
303         * UIProcess/ProvisionalPageProxy.cpp:
304         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
305         * UIProcess/ProvisionalPageProxy.h:
306         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
307         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
308         * UIProcess/SuspendedPageProxy.cpp:
309         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
310         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
311         * UIProcess/SuspendedPageProxy.h:
312         * UIProcess/WebBackForwardCacheEntry.cpp:
313         (WebKit::WebBackForwardCacheEntry::~WebBackForwardCacheEntry):
314         * UIProcess/WebCookieManagerProxy.cpp:
315         (WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
316         (WebKit::WebCookieManagerProxy::deleteCookie):
317         (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
318         (WebKit::WebCookieManagerProxy::setCookies):
319         (WebKit::WebCookieManagerProxy::getAllCookies):
320         (WebKit::WebCookieManagerProxy::getCookies):
321         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
322         (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
323         * UIProcess/WebPageProxy.cpp:
324         (WebKit::WebPageProxy::close):
325         (WebKit::WebPageProxy::updateThrottleState):
326         (WebKit::WebPageProxy::waitForDidUpdateActivityState):
327         (WebKit::WebPageProxy::setInitialFocus):
328         (WebKit::WebPageProxy::validateCommand):
329         (WebKit::WebPageProxy::executeEditCommand):
330         (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart):
331         (WebKit::WebPageProxy::replaceMatches):
332         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
333         (WebKit::WebPageProxy::runJavaScriptInFrame):
334         (WebKit::WebPageProxy::getRenderTreeExternalRepresentation):
335         (WebKit::WebPageProxy::getSourceForFrame):
336         (WebKit::WebPageProxy::getContentsAsString):
337         (WebKit::WebPageProxy::getBytecodeProfile):
338         (WebKit::WebPageProxy::getSamplingProfilerOutput):
339         (WebKit::WebPageProxy::getContentsAsMHTMLData):
340         (WebKit::WebPageProxy::getSelectionOrContentsAsString):
341         (WebKit::WebPageProxy::getSelectionAsWebArchiveData):
342         (WebKit::WebPageProxy::getMainResourceDataOfFrame):
343         (WebKit::WebPageProxy::getResourceDataFromFrame):
344         (WebKit::WebPageProxy::getWebArchiveOfFrame):
345         (WebKit::WebPageProxy::forceRepaint):
346         (WebKit::WebPageProxy::resetStateAfterProcessExited):
347         (WebKit::WebPageProxy::drawToPDF):
348         (WebKit::WebPageProxy::getMarkedRangeAsync):
349         (WebKit::WebPageProxy::getSelectedRangeAsync):
350         (WebKit::WebPageProxy::characterIndexForPointAsync):
351         (WebKit::WebPageProxy::firstRectForCharacterRangeAsync):
352         (WebKit::WebPageProxy::takeSnapshot):
353         (WebKit::WebPageProxy::installActivityStateChangeCompletionHandler):
354         (WebKit::WebPageProxy::getLoadDecisionForIcon):
355         (WebKit::WebPageProxy::insertAttachment):
356         (WebKit::WebPageProxy::updateAttachmentAttributes):
357         (WebKit::WebPageProxy::getApplicationManifest):
358         * UIProcess/WebPageProxy.h:
359         * UIProcess/WebProcessPool.cpp:
360         (WebKit::WebProcessPool::initializeNewWebProcess):
361         (WebKit::WebProcessPool::updateProcessAssertions):
362         (WebKit::WebProcessPool::reinstateNetworkProcessAssertionState):
363         * UIProcess/WebProcessPool.h:
364         * UIProcess/WebProcessProxy.cpp:
365         (WebKit::WebProcessProxy::shutDown):
366         (WebKit::WebProcessProxy::fetchWebsiteData):
367         (WebKit::WebProcessProxy::deleteWebsiteData):
368         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
369         (WebKit::WebProcessProxy::setIsHoldingLockedFiles):
370         (WebKit::WebProcessProxy::startBackgroundActivityForFullscreenInput):
371         (WebKit::WebProcessProxy::endBackgroundActivityForFullscreenInput):
372         * UIProcess/WebProcessProxy.h:
373         * UIProcess/ios/WKContentViewInteraction.mm:
374         (-[WKContentView presentViewControllerForCurrentFocusedElement]):
375         (-[WKContentView dismissAllInputViewControllers:]):
376         * UIProcess/ios/WebPageProxyIOS.mm:
377         (WebKit::WebPageProxy::requestFocusedElementInformation):
378         (WebKit::WebPageProxy::selectWithGesture):
379         (WebKit::WebPageProxy::updateSelectionWithTouches):
380         (WebKit::WebPageProxy::applyAutocorrection):
381         (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
382         (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
383         (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection):
384         (WebKit::WebPageProxy::selectPositionAtPoint):
385         (WebKit::WebPageProxy::beginSelectionInDirection):
386         (WebKit::WebPageProxy::updateSelectionWithExtentPoint):
387         (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
388         (WebKit::WebPageProxy::requestDictationContext):
389         (WebKit::WebPageProxy::getSelectionContext):
390         (WebKit::WebPageProxy::selectWithTwoTouches):
391         (WebKit::WebPageProxy::applicationDidEnterBackground):
392         (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
393         (WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText):
394         (WebKit::WebPageProxy::moveSelectionByOffset):
395         (WebKit::WebPageProxy::focusNextFocusedElement):
396         (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
397
398 2019-10-30  Carlos Garcia Campos  <cgarcia@igalia.com>
399
400         REGRESSION(2.27.2): [GTK] Overview item remove button broken
401         https://bugs.webkit.org/show_bug.cgi?id=203461
402
403         Reviewed by Adrian Perez de Castro.
404
405         This is a regression of the switch to new custom protocols implementation. Epiphany is passing NULL as content
406         type of ephy-resource requests, in which case we should try to guess the mime type, but we are not doing it.
407
408         * UIProcess/API/glib/WebKitURISchemeRequest.cpp:
409         (webkitURISchemeRequestReadCallback): Use MIMETypeRegistry to guess the mime type when content type is nullptr,
410         like NetworkDataTask does.
411
412 2019-10-29  Andy Estes  <aestes@apple.com>
413
414         [Quick Look] Clean up LegacyPreviewLoaderClients
415         https://bugs.webkit.org/show_bug.cgi?id=203472
416
417         Reviewed by Brady Eidson.
418
419         Replaced QuickLookDocumentData with ShareableResource.
420
421         Removed messages WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame and
422         WebPage::DidReceivePasswordForQuickLookDocument, replacing them with async message
423         WebPageProxy::RequestPasswordForQuickLookDocumentInMainFrame.
424
425         * Shared/ios/QuickLookDocumentData.cpp: Removed.
426         * Shared/ios/QuickLookDocumentData.h: Removed.
427         * SourcesCocoa.txt:
428         * UIProcess/API/APILoaderClient.h:
429         * UIProcess/API/APINavigationClient.h:
430         (API::NavigationClient::didFinishLoadForQuickLookDocumentInMainFrame):
431         * UIProcess/Cocoa/NavigationState.h:
432         * UIProcess/Cocoa/NavigationState.mm:
433         (WebKit::NavigationState::NavigationClient::didFinishLoadForQuickLookDocumentInMainFrame):
434         * UIProcess/ProvisionalPageProxy.cpp:
435         (WebKit::ProvisionalPageProxy::requestPasswordForQuickLookDocumentInMainFrame):
436         (WebKit::ProvisionalPageProxy::didReceiveMessage):
437         (WebKit::ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame): Deleted.
438         * UIProcess/ProvisionalPageProxy.h:
439         * UIProcess/WebPageProxy.h:
440         * UIProcess/WebPageProxy.messages.in:
441         * UIProcess/ios/WebPageProxyIOS.mm:
442         (WebKit::WebPageProxy::didFinishLoadForQuickLookDocumentInMainFrame):
443         (WebKit::WebPageProxy::requestPasswordForQuickLookDocumentInMainFrame):
444         (WebKit::WebPageProxy::requestPasswordForQuickLookDocumentInMainFrameShared):
445         (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame): Deleted.
446         (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrameShared): Deleted.
447         * WebKit.xcodeproj/project.pbxproj:
448         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp:
449         (WebKit::WebPreviewLoaderClient::WebPreviewLoaderClient):
450         (WebKit::WebPreviewLoaderClient::didReceiveBuffer):
451         (WebKit::WebPreviewLoaderClient::didFinishLoading):
452         (WebKit::WebPreviewLoaderClient::didFail):
453         (WebKit::WebPreviewLoaderClient::didRequestPassword):
454         (WebKit::passwordCallbacks): Deleted.
455         (WebKit::WebPreviewLoaderClient::~WebPreviewLoaderClient): Deleted.
456         (WebKit::WebPreviewLoaderClient::didReceiveDataArray): Deleted.
457         (WebKit::WebPreviewLoaderClient::didReceivePassword): Deleted.
458         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.h:
459         * WebProcess/WebPage/WebPage.h:
460         * WebProcess/WebPage/WebPage.messages.in:
461         * WebProcess/WebPage/ios/WebPageIOS.mm:
462         (WebKit::WebPage::didStartLoadForQuickLookDocumentInMainFrame):
463         (WebKit::WebPage::didFinishLoadForQuickLookDocumentInMainFrame):
464         (WebKit::WebPage::requestPasswordForQuickLookDocumentInMainFrame):
465         (WebKit::WebPage::didReceivePasswordForQuickLookDocument): Deleted.
466
467 2019-10-29  Jiewen Tan  <jiewen_tan@apple.com>
468
469         [WebAuthn] Add more information to _WKWebAuthenticationPanel
470         https://bugs.webkit.org/show_bug.cgi?id=202561
471         <rdar://problem/55973910>
472
473         Reviewed by Youenn Fablet and Brent Fulgham.
474
475         This change adds transports and type to _WKWebAuthenticationPanel such that
476         clients can know what transport the current ceremony demands and the type of
477         the current ceremony. These extra information allow clients to give users
478         more specific instructions to interact with authenticators.
479
480         To pass transports to client, the way how them is collected is changed significantly:
481         1) The timing is moved to runPanel before the client delegate call.
482         2) NfcService::isAvailable is added for AuthenticatorManager to determine if NFC
483         is available in the current device.
484         3) AuthenticatorManager::filterTransports is added to filter transports requested
485         by RP to ones that are available. This process is handled by each service naturally
486         before.
487         4) AuthenticatorManager::startRequest is now being splitted into AuthenticatorManager::handleRequest,
488         AuthenticatorManager::runPanel and AuthenticatorManager::getTransports.
489
490         To pass type to _WKWebAuthenticationPanel, ClientDataType is moved from
491         WebCore::AuthenticatorCoordinator to WebCore::WebAuthenticationConstants in
492         order to be reused to indicate the ceremony type.
493
494         * UIProcess/API/APIWebAuthenticationPanel.cpp:
495         (API::WebAuthenticationPanel::create):
496         (API::WebAuthenticationPanel::WebAuthenticationPanel):
497         * UIProcess/API/APIWebAuthenticationPanel.h:
498         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
499         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
500         (-[_WKWebAuthenticationPanel relyingPartyID]):
501         (wkWebAuthenticationTransport):
502         (-[_WKWebAuthenticationPanel transports]):
503         (wkWebAuthenticationType):
504         (-[_WKWebAuthenticationPanel type]):
505         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
506         (WebKit::WebCore::collectTransports):
507         (WebKit::WebCore::getClientDataType):
508         (WebKit::AuthenticatorManager::handleRequest):
509         (WebKit::AuthenticatorManager::filterTransports const):
510         (WebKit::AuthenticatorManager::startDiscovery):
511         (WebKit::AuthenticatorManager::initTimeOutTimer):
512         (WebKit::AuthenticatorManager::runPanel):
513         (WebKit::AuthenticatorManager::getTransports const):
514         (WebKit::AuthenticatorManager::respondReceivedInternal): Deleted.
515         (WebKit::AuthenticatorManager::startRequest): Deleted.
516         * UIProcess/WebAuthentication/AuthenticatorManager.h:
517         (WebKit::AuthenticatorManager::respondReceivedInternal):
518         * UIProcess/WebAuthentication/Cocoa/NfcService.h:
519         * UIProcess/WebAuthentication/Cocoa/NfcService.mm:
520         (WebKit::NfcService::isAvailable):
521         (WebKit::NfcService::platformStartDiscovery):
522         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
523         (WebKit::MockAuthenticatorManager::filterTransports const):
524         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h:
525
526 2019-10-29  Wenson Hsieh  <wenson_hsieh@apple.com>
527
528         REGRESSION (r251693): [iOS] Unable to change selection in a focused element if the element's bounds change
529         https://bugs.webkit.org/show_bug.cgi?id=203582
530
531         Reviewed by Tim Horton.
532
533         The refactoring in r251693 broke the ability to change selection in an editable area by tapping in iOS Safari,
534         in the case where the editable element's bounds change after focus. This is because the aforementioned change
535         now compares position informations' element context against the focused element information's element context to
536         check whether or not the position information request was inside the focused element. However, if the bounds of
537         the focused element change in between the position information request and when the element is initially
538         focused, the `operator==` comparison will fail, causing us to prevent text selection.
539
540         To fix this, only check whether or not the two element contexts refer to the same element in the DOM by
541         comparing page, document and element identifiers, but not the element's bounding rect.
542
543         * UIProcess/ios/WKContentViewInteraction.mm:
544         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:nodeHasBuiltInClickHandling:]):
545         (-[WKContentView gestureRecognizerShouldBegin:]):
546         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
547
548 2019-10-07  Jer Noble  <jer.noble@apple.com>
549
550         Implement the Remote Playback API.
551         https://bugs.webkit.org/show_bug.cgi?id=162971
552
553         Reviewed by Youenn Fablet.
554
555         Add a preference to enable the Remote Playback API. Pass the playbackTargetPickerWasDismissed()
556         notification on to Page.
557
558         * Shared/WebPreferencesDefinitions.h:
559         * UIProcess/API/C/WKPreferences.cpp:
560         (WKPreferencesGetRemotePlaybackEnabled):
561         (WKPreferencesSetRemotePlaybackEnabled):
562         * UIProcess/API/C/WKPreferencesRef.h:
563         * UIProcess/WebPageProxy.cpp:
564         (WebKit::WebPageProxy::playbackTargetPickerWasDismissed):
565         * UIProcess/WebPageProxy.h:
566         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
567         (WebKit::WebChromeClient::mockMediaPlaybackTargetPickerDismissPopup):
568         * WebProcess/WebCoreSupport/WebChromeClient.h:
569         * WebProcess/WebPage/WebPage.cpp:
570         (WebKit::WebPage::updatePreferences):
571         * WebProcess/WebPage/WebPage.h:
572         * WebProcess/WebPage/WebPage.messages.in:
573         * WebProcess/WebPage/mac/WebPageMac.mm:
574         (WebKit::WebPage::playbackTargetPickerWasDismissed):
575
576 2019-10-29  Per Arne Vollan  <pvollan@apple.com>
577
578         REGRESSION: WebContent getting killed due to syscall filter violation
579         https://bugs.webkit.org/show_bug.cgi?id=203575
580
581         Reviewed by Alexey Proskuryakov.
582
583         The sandbox profile on macOS needs to open up for a syscall.
584
585         No new tests, covered by existing tests.
586
587         * WebProcess/com.apple.WebProcess.sb.in:
588
589 2019-10-29  Brent Fulgham  <bfulgham@apple.com>
590
591         [iOS] Clean up sandbox to group similar rules together 
592         https://bugs.webkit.org/show_bug.cgi?id=203525
593         <rdar://problem/56686416>
594
595         Reviewed by Per Arne Vollan.
596
597         Clean up the sandbox rules by grouping rules by feature areas to make future editing easier.
598         This change should have no impact on behavior.
599
600         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
601
602 2019-10-29  Myles C. Maxfield  <mmaxfield@apple.com>
603
604         REGRESSION (r251413): Nightly build crashes on launch due to -[WKPreferences _setShouldAllowDesignSystemUIFonts:]: unrecognized selector
605         https://bugs.webkit.org/show_bug.cgi?id=203549
606
607         Reviewed by Simon Fraser.
608
609         r251413 deleted an SPI that new Safari stopped calling. However,
610         old Safari continues to call it. The solution is just to add stub
611         implementations so old Safari doesn't fail to link at runtime.
612
613         * UIProcess/API/Cocoa/WKPreferences.mm:
614         (-[WKPreferences _shouldAllowDesignSystemUIFonts]):
615         (-[WKPreferences _setShouldAllowDesignSystemUIFonts:]):
616         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
617
618 2019-10-27  Wenson Hsieh  <wenson_hsieh@apple.com>
619
620         Add enterkeyhint support
621         https://bugs.webkit.org/show_bug.cgi?id=189546
622         <rdar://problem/51021148>
623
624         Reviewed by Tim Horton.
625
626         This patch adds support for the enterkeyhint HTML attribute on iOS.
627
628         Tests:  EnterKeyHintTests.EnterKeyHintInContentEditableElement
629                 EnterKeyHintTests.EnterKeyHintInTextInput
630                 EnterKeyHintTests.EnterKeyHintInTextArea
631
632         * Shared/FocusedElementInformation.cpp:
633         (WebKit::FocusedElementInformation::encode const):
634         (WebKit::FocusedElementInformation::decode):
635         * Shared/FocusedElementInformation.h:
636
637         Add a new flag to FocusedElementInformation to indicate the EnterKeyHint type that should be used when bringing
638         up an input view for the focused element.
639
640         * UIProcess/ios/WKContentViewInteraction.mm:
641         (-[WKContentView textInputTraits]):
642
643         Map the given EnterKeyHint type to a UIReturnKeyType. If an unsupported (i.e. "previous") or default
644         EnterKeyHint value is used, then we fall back to existing behavior which deduces the default enterkeyhint value
645         from the input type if the focused element is inside an actionable form; otherwise, we avoid setting any value
646         for the `returnKeyType`, defaulting to `UIReturnKeyDefault`.
647
648         * WebProcess/WebPage/ios/WebPageIOS.mm:
649         (WebKit::WebPage::getFocusedElementInformation):
650
651 2019-10-29  Kate Cheney  <katherine_cheney@apple.com>
652
653         Layout Test http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-database.html is a flaky failure
654         https://bugs.webkit.org/show_bug.cgi?id=203542#add_comment
655         <rdar://problem/56689764>
656
657         Reviewed by John Wilander.
658
659         This test was a flaky failure due to its calling
660         scheduleStatisticsProcessingRequestIfNecessary() after logging a cross
661         site load with link decoration. This call is currently unecessary
662         because this function is not yet used to classify resources, and is
663         causing the test to execute a callback before it is ready.
664
665         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
666
667 2019-10-29  Truitt Savell  <tsavell@apple.com>
668
669         Unreviewed, rolling out r251639.
670
671         Caused flakey API failures for GetDisplayMediaTest.Constraints
672
673         Reverted changeset:
674
675         "Enforce user gesture for getUserMedia in case a previous
676         getUserMedia call was denied"
677         https://bugs.webkit.org/show_bug.cgi?id=203362
678         https://trac.webkit.org/changeset/251639
679
680 2019-10-29  Truitt Savell  <tsavell@apple.com>
681
682         Unreviewed, rolling out r251646.
683
684         Caused flakey API failures for GetDisplayMediaTest.Constraints
685
686         Reverted changeset:
687
688         "Unreviewed build fix for !ENABLE(MEDIA_STREAM) builds"
689         https://bugs.webkit.org/show_bug.cgi?id=203362
690         https://trac.webkit.org/changeset/251646
691
692 2019-10-29  Chris Dumez  <cdumez@apple.com>
693
694         Unreviewed, rolling out r251594.
695
696         Caused an API test failure
697
698         Reverted changeset:
699
700         "mp4 video element broken with service worker"
701         https://bugs.webkit.org/show_bug.cgi?id=184447
702         https://trac.webkit.org/changeset/251594        
703
704 2019-10-29  Chris Dumez  <cdumez@apple.com>
705
706         Notification permissions are not remembered for origins without port
707         https://bugs.webkit.org/show_bug.cgi?id=203537
708         <rdar://problem/55281080>
709
710         Reviewed by Brady Eidson.
711
712         When WKSecurityOriginCreate() gets called with a port that is invalid, then pass
713         WTF::nullopt to construct the security origin instead of the invalid port.
714
715         The issue is that the port for security origins is optional internally. However,
716         our API (WKSecurityOriginGetPort() & WKSecurityOrigin.port) will return 0 when
717         there is no port. As a result, clients such as Safari sometimes pass 0 as port to construct
718         a new WKSecurityOriginRef().
719
720         This was causing issues with regards to notifications because Safari would construct
721         origins whose string representation looks like "https://www.apple.com:0" and it would
722         not match the "https://www.apple.com" we expect internally.
723
724         * Shared/API/c/WKSecurityOriginRef.cpp:
725         (WKSecurityOriginCreate):
726
727 2019-10-29  Adrian Perez de Castro  <aperez@igalia.com>
728
729         Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.27.2 release
730
731         * wpe/NEWS: Add release notes for 2.27.2.
732
733 2019-10-28  Wenson Hsieh  <wenson_hsieh@apple.com>
734
735         Replace InteractionInformationAtPosition.nodeAtPositionIsFocusedElement with an element context
736         https://bugs.webkit.org/show_bug.cgi?id=203498
737
738         Reviewed by Tim Horton.
739
740         Refactors InteractionInformationAtPosition, such that it doesn't need a special flag to indicate whether there
741         is a focused element at the position. This is a followup to webkit.org/b/203264; no new tests, as there should
742         be no change in behavior.
743
744         * Shared/FocusedElementInformation.cpp:
745         (WebKit::FocusedElementInformation::encode const):
746         (WebKit::FocusedElementInformation::decode):
747         * Shared/FocusedElementInformation.h:
748
749         Add an elementContext to FocusedElementInformation to represent the focused element; then, instead of checking
750         whether there is a focused element underneath the request position, simply check that the position information's
751         element context matches the FocusedElementInformation's element context.
752
753         Additionally, rename elementRect in FocusedElementInformation to interactionRect, to draw a distinction between
754         this rect and the new ElementContext's boundingRect.
755
756         * Shared/ios/InteractionInformationAtPosition.h:
757         * Shared/ios/InteractionInformationAtPosition.mm:
758         (WebKit::InteractionInformationAtPosition::encode const):
759         (WebKit::InteractionInformationAtPosition::decode):
760
761         Remove the nodeAtPositionIsFocusedElement flag.
762
763         * UIProcess/ios/WKContentViewInteraction.mm:
764         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:nodeHasBuiltInClickHandling:]):
765         (-[WKContentView _zoomToRevealFocusedElement]):
766         (-[WKContentView _selectionClipRect]):
767         (-[WKContentView gestureRecognizerShouldBegin:]):
768         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
769
770         In various places that consult nodeAtPositionIsFocusedElement, instead check that the position information's
771         hit-tested element context is the same as the focused element, via FocusedElementInformation.
772
773         (-[WKContentView _didCommitLoadForMainFrame]):
774
775         Nuke the cached position information data upon navigation; without this tweak, we will fail when running several
776         iOS layout tests back-to-back, that tap in exactly the same location.
777
778         (rectToRevealWhenZoomingToFocusedElement):
779         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
780         (-[WKContentView _elementDidBlur]):
781         (-[WKContentView rectForFocusedFormControlView:]):
782         (-[WKContentView _didChangeFocusedElementRect:toRect:]): Deleted.
783
784         Remove code to invalidate cached position information when changing the focused element rect.
785
786         * UIProcess/ios/forms/WKFormPopover.mm:
787         (-[WKRotatingPopover presentPopoverAnimated:]):
788         * WebProcess/WebPage/ios/WebPageIOS.mm:
789         (WebKit::WebPage::positionInformation):
790         (WebKit::WebPage::getFocusedElementInformation):
791
792 2019-10-28  Adrian Perez de Castro  <aperez@igalia.com>
793
794         [GTK][WPE] Fix various non-unified build issues introduced since r251436
795         https://bugs.webkit.org/show_bug.cgi?id=203492
796
797         Reviewed by Alex Christensen and Mark Lam.
798
799         * UIProcess/InspectorTargetProxy.h: Add forward declaration of ProvisionalPageProxy.
800         * UIProcess/Plugins/PluginProcessProxy.cpp: Add missin inclusion of
801         WebProcessProxyMessages.h
802         * UIProcess/ProcessThrottler.cpp: Add missing inclusion of wtf/CompletionHandler.h
803         * UIProcess/ProvisionalPageProxy.h: Add missing inclusion of WebCore/FrameIdentifier.h
804         * UIProcess/WebPageInspectorController.h: Add missing inclusion of WebCore/PageIdentifier.h
805         * WebProcess/WebPage/WebPageInspectorTargetController.cpp: Add missing inclusion of
806         WebPageInspectorTargetFrontendChannel.h
807
808 2019-10-28  Per Arne Vollan  <pvollan@apple.com>
809
810         [iOS] Fix sandbox violations
811         https://bugs.webkit.org/show_bug.cgi?id=203505
812
813         Reviewed by Brent Fulgham.
814
815         Running layout tests shows that allowing mach lookup is needed for a set of services which was previously denied.
816         This patch add rules for allowing these services again. The service 'com.apple.logd.events' is still denied, since
817         it has not been observed to be in use.
818
819         No new tests, covered by existing tests.
820
821         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
822
823 2019-10-28  Alex Christensen  <achristensen@webkit.org>
824
825         Unreviewed, rolling out r251675.
826
827         Broke some builds
828
829         Reverted changeset:
830
831         "Remove unused WKWebsiteDataStore setter SPI"
832         https://bugs.webkit.org/show_bug.cgi?id=203114
833         https://trac.webkit.org/changeset/251675
834
835 2019-10-28  Wenson Hsieh  <wenson_hsieh@apple.com>
836
837         Add bindings support for the enterkeyhint HTML attribute
838         https://bugs.webkit.org/show_bug.cgi?id=203440
839
840         Reviewed by Ryosuke Niwa.
841
842         Add a new runtime switch for the enterkeyhint attribute, and enable it by default on macOS and iOS.
843
844         * Shared/WebPreferences.yaml:
845         * Shared/WebPreferencesDefaultValues.h:
846
847 2019-10-28  Alex Christensen  <achristensen@webkit.org>
848
849         Remove unused _WKProcessPoolConfiguration SPI
850         https://bugs.webkit.org/show_bug.cgi?id=203066
851
852         Reviewed by Youenn Fablet.
853
854         After rdar://problem/56260478 this is not used, so away it goes!
855
856         * NetworkProcess/NetworkProcess.h:
857         (WebKit::NetworkProcess::suppressesConnectionTerminationOnSystemChange const): Deleted.
858         * NetworkProcess/NetworkProcessCreationParameters.cpp:
859         (WebKit::NetworkProcessCreationParameters::encode const):
860         (WebKit::NetworkProcessCreationParameters::decode):
861         * NetworkProcess/NetworkProcessCreationParameters.h:
862         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
863         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
864         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
865         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
866         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
867         (WebKit::globalCTDataConnectionServiceType): Deleted.
868         (WebKit::NetworkSessionCocoa::ctDataConnectionServiceType const): Deleted.
869         (WebKit::NetworkSessionCocoa::setCTDataConnectionServiceType): Deleted.
870         * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm:
871         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType):
872         * UIProcess/API/APIProcessPoolConfiguration.cpp:
873         (API::ProcessPoolConfiguration::copy):
874         * UIProcess/API/APIProcessPoolConfiguration.h:
875         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
876         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
877         (-[_WKProcessPoolConfiguration suppressesConnectionTerminationOnSystemChange]): Deleted.
878         (-[_WKProcessPoolConfiguration setSuppressesConnectionTerminationOnSystemChange:]): Deleted.
879         (-[_WKProcessPoolConfiguration CTDataConnectionServiceType]): Deleted.
880         (-[_WKProcessPoolConfiguration setCTDataConnectionServiceType:]): Deleted.
881         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
882         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
883         * UIProcess/ios/WebPageProxyIOS.mm:
884         (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType):
885
886 2019-10-28  Alex Christensen  <achristensen@webkit.org>
887
888         Remove unused WKWebsiteDataStore setter SPI
889         https://bugs.webkit.org/show_bug.cgi?id=203114
890
891         Reviewed by Anders Carlsson.
892
893         They have been replaced by _WKWebsiteDataStoreConfiguration SPI which was adopted in rdar://problem/56349165
894
895         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
896         (-[WKWebsiteDataStore _setBoundInterfaceIdentifier:]): Deleted.
897         (-[WKWebsiteDataStore _boundInterfaceIdentifier]): Deleted.
898         (-[WKWebsiteDataStore _setAllowsCellularAccess:]): Deleted.
899         (-[WKWebsiteDataStore _allowsCellularAccess]): Deleted.
900         (-[WKWebsiteDataStore _setProxyConfiguration:]): Deleted.
901         (-[WKWebsiteDataStore _proxyConfiguration]): Deleted.
902         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
903         * UIProcess/WebsiteData/WebsiteDataStore.h:
904         (WebKit::WebsiteDataStore::setBoundInterfaceIdentifier): Deleted.
905         (WebKit::WebsiteDataStore::setAllowsCellularAccess): Deleted.
906         (WebKit::WebsiteDataStore::setProxyConfiguration): Deleted.
907
908 2019-10-28  Brady Eidson  <beidson@apple.com>
909
910         Expose _printOperationWithPrintInfo: SPI as API
911         <rdar://problem/36557179> and https://bugs.webkit.org/show_bug.cgi?id=203496
912
913         Reviewed by Andy Estes.
914
915         * UIProcess/API/Cocoa/WKWebView.h:
916         * UIProcess/API/Cocoa/WKWebView.mm:
917         (-[WKWebView printOperationWithPrintInfo:]):
918         (-[WKWebView _printOperationWithPrintInfo:]):
919
920 2019-10-28  Kate Cheney  <katherine_cheney@apple.com>
921
922         Layout Test http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html is a flaky failure
923         https://bugs.webkit.org/show_bug.cgi?id=203491
924         <rdar://problem/56674176>
925
926         Reviewed by Chris Dumez.
927
928         No new tests, this change is tested by the existing resourceLoadStatistics
929         tests.
930
931         This test started flaking when a new memory store was being created
932         between tests to maintain consistency. The call to grandfatherExistingWebsiteData
933         from populateMemoryStoreFromDisk in the persistent storage was
934         async, causing a race condition that led to occasional failures.
935         Adding a completion handler and changing the callsite of
936         populateMemoryStoreFromDisk should fix this problem.
937
938         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp:
939         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
940         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.h:
941         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
942         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
943         The persistent store in the databaseEnabled case was never being used
944         and is unnecessary.
945
946         (WebKit::WebResourceLoadStatisticsStore::populateMemoryStoreFromDisk):
947         Since persistent storage only exists when using the memory store,
948         populateMemoryStoreFromDisk should check if
949         m_persistentStorage has been initialized.
950
951         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
952         * NetworkProcess/NetworkProcess.cpp:
953         (WebKit::NetworkProcess::setUseITPDatabase):
954         * NetworkProcess/NetworkSession.cpp:
955         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
956         (WebKit::NetworkSession::recreateResourceLoadStatisticStore):
957         * NetworkProcess/NetworkSession.h:
958
959 2019-10-28  Wenson Hsieh  <wenson_hsieh@apple.com>
960
961         [iOS] 3 editing/pasteboard/smart-paste-paragraph-* tests are flaky
962         https://bugs.webkit.org/show_bug.cgi?id=203264
963         <rdar://problem/56512107>
964
965         Reviewed by Tim Horton.
966
967         Fixes several flaky layout tests that exercise a corner case in our logic for caching position information
968         responses in the UI process. When focusing an element via a tap, we send a position information request for the
969         tap location in -_webTouchEventsRecognized:. After the web process computes the information and hands it back to
970         the UI process, we cache this in WKContentView's _positionInformation.
971
972         However, at the time of computing the request, the tapped element has not been focused yet, so the value of the
973         position information's nodeAtPositionIsFocusedElement flag is false. After the tap is recognized, we'll then
974         focus the element, such that if a subsequent position information request were to arrive at the same location,
975         it would have a nodeAtPositionIsFocusedElement flag set to true.
976
977         In this state, if the user taps _exactly_ at the same location again, UIKit (through text interaction gestures)
978         will ask us for information at the same point; we will end up using the cached information, for which
979         nodeAtPositionIsFocusedElement is false, causing us to incorrectly prevent the text interaction. In this
980         particular case, we fail to select text via a double tap gesture.
981
982         To address this, we invalidate the cached position information in the UI process whenever the focused element
983         rect changes (e.g. when the focused element changes); the only exception to this is when the previously cached
984         position information was not over the focused element, and the new focused element rect is empty, in which case
985         the value of nodeAtPositionIsFocusedElement is guaranteed to have not changed.
986
987         While this may potentially leads to an additional synchronous position information request when tapping at the
988         same location after focusing an element, this is very difficult to achieve in practice, since the tap location
989         would need to be _exactly_ at the same location.
990
991         No new test, since this is exercised by existing flaky layout tests.
992
993         * UIProcess/ios/WKContentViewInteraction.mm:
994         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
995         (-[WKContentView _elementDidBlur]):
996
997         Also, add a FIXME about how we clear out surprisingly little of _focusedElementInformation when blurring the
998         focused element.
999
1000         (-[WKContentView _didChangeFocusedElementRect:toRect:]):
1001
1002 2019-10-28  John Wilander  <wilander@apple.com>
1003
1004         Storage Access API: Make the API work with the experimental 3rd-party cookie blocking
1005         https://bugs.webkit.org/show_bug.cgi?id=203428
1006         <rdar://problem/56626949>
1007
1008         Reviewed by Alex Christensen.
1009
1010         Tests: http/tests/storageAccess/deny-due-to-no-interaction-under-general-third-party-cookie-blocking.html
1011                http/tests/storageAccess/grant-with-prompt-under-general-third-party-cookie-blocking.html
1012                http/tests/storageAccess/has-storage-access-under-general-third-party-cookie-blocking-with-cookie.html
1013                http/tests/storageAccess/has-storage-access-under-general-third-party-cookie-blocking-without-cookie.html
1014
1015         This patch adds Storage Access API support for the experimental 3rd-party cookie blocking that
1016         landed in <https://trac.webkit.org/changeset/251467>.
1017
1018         There are three policies at play because it can be changed with the experimental setting:
1019         1. The underlying cookie policy.
1020         2. Shipping ITP.
1021         3. The off by default, experimental 3rd-party cookie blocking.
1022
1023         To support them all, a CookieAccess enum was added to encode how the API should respond.
1024         The enum has these values:
1025         CannotRequest - This third-party cannot request storage access based on the current policy.
1026         BasedOnCookiePolicy – This third-party should be treated according to the underlying cookie policy.
1027         OnlyIfGranted – This third-party can and must get access through the Storage Access API.
1028
1029         Here's the truth table I used to work through the logic for both
1030         document.hasStorageAccess() and document.requestStorageAccess():
1031
1032         Access  | Is        | User        | Has    | 3rd-party    |        |
1033         granted | prevalent | interaction | cookie | cookie block | RESULT |
1034         -------------------------------------------------------------------
1035         |       |           |             |        |              | false  |
1036         -------------------------------------------------------------------
1037         |       |           |             |        | true         | false  |
1038         -------------------------------------------------------------------
1039         |       |           |             | true   |              | true   |
1040         -------------------------------------------------------------------
1041         |       |           |             | true   | true         | false  |
1042         -------------------------------------------------------------------
1043         |       |           | true        |        |              | false  |
1044         -------------------------------------------------------------------
1045         |       |           | true        |        | true         | false  |
1046         -------------------------------------------------------------------
1047         |       |           | true        | true   |              | true   |
1048         -------------------------------------------------------------------
1049         |       |           | true        | true   | true         | false  |
1050         -------------------------------------------------------------------
1051         |       | true      | !care       | !care  | !care        | false  |
1052         -------------------------------------------------------------------
1053         | true  | !care     | !care       | !care  | !care        | true   |
1054         -------------------------------------------------------------------
1055
1056         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1057         (WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess const):
1058         (WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess):
1059         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
1060         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
1061             Extra checks removed since there's no harm in granting access
1062             to a third-party that already has access by way of the underlying
1063             cookie policy. Also, this is a temporary compatibility fix.
1064         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1065         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1066         (WebKit::ResourceLoadStatisticsMemoryStore::cookieAccess const):
1067         (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
1068         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
1069         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
1070             Extra checks removed since there's no harm in granting access
1071             to a third-party that already has access by way of the underlying
1072             cookie policy. Also, this is a temporary compatibility fix.
1073         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
1074         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
1075         (WebKit::ResourceLoadStatisticsStore::setIsThirdPartyCookieBlockingEnabled):
1076         (WebKit::ResourceLoadStatisticsStore::isThirdPartyCookieBlockingEnabled const):
1077         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1078         (WebKit::WebResourceLoadStatisticsStore::setIsThirdPartyCookieBlockingEnabled):
1079             This is now the single path to control this setting in both ITP
1080             and the network storage session. See comment below.
1081         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1082         * NetworkProcess/NetworkProcess.cpp:
1083         (WebKit::NetworkProcess::setShouldBlockThirdPartyCookiesForTesting):
1084         * NetworkProcess/NetworkSession.cpp:
1085         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
1086         (WebKit::NetworkSession::setIsThirdPartyCookieBlockingEnabled):
1087             Restructured these so that they are initiated like the rest of the
1088             parameters and only have a single path for changes so that a
1089             reset to consistent state resets all the state.
1090         * NetworkProcess/NetworkSession.h:
1091         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1092         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1093
1094 2019-10-28  Alex Christensen  <achristensen@webkit.org>
1095
1096         Remove unused NetworkProcessCreationParameters.urlSchemesRegisteredAsCanDisplayOnlyIfCanRequest
1097         https://bugs.webkit.org/show_bug.cgi?id=203393
1098
1099         Reviewed by Chris Dumez.
1100
1101         * NetworkProcess/NetworkProcess.cpp:
1102         (WebKit::NetworkProcess::initializeNetworkProcess):
1103         (WebKit::NetworkProcess::registerURLSchemeAsCanDisplayOnlyIfCanRequest const): Deleted.
1104         * NetworkProcess/NetworkProcess.h:
1105         * NetworkProcess/NetworkProcess.messages.in:
1106         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1107         (WebKit::NetworkProcessCreationParameters::encode const):
1108         (WebKit::NetworkProcessCreationParameters::decode):
1109         * NetworkProcess/NetworkProcessCreationParameters.h:
1110         * UIProcess/WebProcessPool.cpp:
1111         (WebKit::WebProcessPool::ensureNetworkProcess):
1112         (WebKit::WebProcessPool::registerURLSchemeAsCanDisplayOnlyIfCanRequest):
1113
1114 2019-10-28  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1115
1116         [GTK][WPE] Enable CSS typed OM
1117         https://bugs.webkit.org/show_bug.cgi?id=192875
1118
1119         Reviewed by Carlos Garcia Campos.
1120
1121         Enable the runtime feature by default on GTK/WPE when building with
1122         experimental features enabled.
1123
1124         Covered by existing tests.
1125
1126         * Shared/WebPreferences.yaml:
1127         * Shared/WebPreferencesDefaultValues.h:
1128
1129 2019-10-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1130
1131         [GTK] Simplify the Input Method implementation
1132         https://bugs.webkit.org/show_bug.cgi?id=203149
1133
1134         Reviewed by Adrian Perez de Castro.
1135
1136         * Shared/NativeWebKeyboardEvent.h: Stop using WebCore::CompositionResults.
1137         (WebKit::NativeWebKeyboardEvent::text const):
1138         (WebKit::NativeWebKeyboardEvent::handledByInputMethod const):
1139         (WebKit::NativeWebKeyboardEvent::fakedForComposition const):
1140         * Shared/gtk/NativeWebKeyboardEventGtk.cpp: Ditto.
1141         (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
1142         * Shared/gtk/WebEventFactory.cpp:
1143         (WebKit::WebEventFactory::createWebKeyboardEvent): Ditto.
1144         * Shared/gtk/WebEventFactory.h:
1145         * UIProcess/API/gtk/PageClientImpl.cpp:
1146         (WebKit::PageClientImpl::doneWithKeyEvent): Updated to use the new name.
1147         * UIProcess/API/gtk/WebKitWebViewBase.cpp: Stop using WebCore::CompositionResults.
1148         (webkitWebViewBaseKeyPressEvent):
1149         (webkitWebViewBaseKeyReleaseEvent):
1150         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: Remove unused function.
1151         * UIProcess/WebPageProxy.cpp:
1152         (WebKit::WebPageProxy::setComposition): Use EditingRange instead of two integers and remove replacement range
1153         that is unused.
1154         (WebKit::WebPageProxy::confirmComposition): Remove unused selection range parameters.
1155         * UIProcess/WebPageProxy.h:
1156         * UIProcess/gtk/InputMethodFilter.cpp:
1157         (WebKit::InputMethodFilter::handleKeyboardEvent):
1158         (WebKit::InputMethodFilter::handleKeyboardEventWithCompositionResults):
1159         (WebKit::InputMethodFilter::confirmComposition):
1160         (WebKit::InputMethodFilter::updatePreedit):
1161         (WebKit::InputMethodFilter::confirmCurrentComposition):
1162         (WebKit::InputMethodFilter::sendCompositionAndPreeditWithFakeKeyEvents):
1163         (WebKit::InputMethodFilter::logHandleKeyboardEventForTesting):
1164         (WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting):
1165         * UIProcess/gtk/InputMethodFilter.h:
1166         * WebProcess/WebPage/WebPage.cpp:
1167         (WebKit::targetFrameForEditing): Receive a reference instead of a pointer.
1168         (WebKit::WebPage::confirmComposition): Remove the unused code to handle the selection range.
1169         (WebKit::WebPage::setComposition): Remove the unused code to handle the replacement range.
1170         * WebProcess/WebPage/WebPage.h:
1171         * WebProcess/WebPage/WebPage.messages.in:
1172
1173 2019-10-27  Fujii Hironori  <Hironori.Fujii@sony.com>
1174
1175         Unreviewed build fix for !ENABLE(MEDIA_STREAM) builds
1176         https://bugs.webkit.org/show_bug.cgi?id=203362
1177         <rdar://problem/56648232>
1178
1179         * UIProcess/UserMediaPermissionRequestProxy.h: Enclosed isUserGesturePriviledged with #if ENABLE(MEDIA_STREAM).
1180
1181 2019-10-21  Jiewen Tan  <jiewen_tan@apple.com>
1182
1183         [WebAuthn] Warn users when multiple NFC tags present
1184         https://bugs.webkit.org/show_bug.cgi?id=200932
1185         <rdar://problem/54890736>
1186
1187         Reviewed by Brent Fulgham.
1188
1189         This patch utilizes -[_WKWebAuthenticationPanelDelegate panel:updateWebAuthenticationPanel:] to
1190         inform clients about multiple physical tags are presenting such that clients can instruct users
1191         to select only one of them physically. Given a physical tag could have multiple different
1192         interfaces, which NearField will treat them into different NFTags, the tagID is then used to
1193         identify if there are actually multiple physical tags.
1194
1195         This patch also adds the ability to restart polling of a partiuclar NFReaderSession to NfcConnection
1196         and the ability to restart the whole session to NfcService. The former is used to recover from errors
1197         in the discovery stages, and the latter is used to recover from errors returned from authenticators
1198         in the request stages. For the latter, given NfcConnection is not awared of the syntax of FIDO2/U2F
1199         protocol, and CtapAuthenticator/U2fAuthenticator are not awared the transport of the underneath driver.
1200         A generic restartDiscovery process is added to each service and it is up to the actual service to
1201         implement the actual process such that AuthenticatorManager can arbitrarily call it after exceptions
1202         are returned to restart the whole NFC session. To achieve restartDiscovery, NfcConnection is made
1203         RefCounted as well such that both the NfcService and the CtapNfcDriver could hold it at the same time.
1204         CtapNfcDriver uses the connection to complete requests as before while NfcService has the new capability
1205         to use it to stop the current session when restartDiscovery kicks off.
1206
1207         * Platform/spi/Cocoa/NearFieldSPI.h:
1208         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1209         (WebKit::AuthenticatorManager::serviceStatusUpdated):
1210         (WebKit::AuthenticatorManager::respondReceived):
1211         (WebKit::AuthenticatorManager::restartDiscovery):
1212         * UIProcess/WebAuthentication/AuthenticatorManager.h:
1213         * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
1214         (WebKit::AuthenticatorTransportService::startDiscovery):
1215         (WebKit::AuthenticatorTransportService::restartDiscovery):
1216         * UIProcess/WebAuthentication/AuthenticatorTransportService.h:
1217         (WebKit::AuthenticatorTransportService::restartDiscoveryInternal):
1218         * UIProcess/WebAuthentication/Cocoa/NfcConnection.h:
1219         * UIProcess/WebAuthentication/Cocoa/NfcConnection.mm:
1220         (WebKit::NfcConnection::create):
1221         (WebKit::NfcConnection::NfcConnection):
1222         (WebKit::NfcConnection::~NfcConnection):
1223         (WebKit::NfcConnection::stop const):
1224         (WebKit::NfcConnection::didDetectTags):
1225         (WebKit::NfcConnection::restartPolling):
1226         (WebKit::NfcConnection::startPolling):
1227         (WebKit::NfcConnection::didDetectTags const): Deleted.
1228         * UIProcess/WebAuthentication/Cocoa/NfcService.h:
1229         * UIProcess/WebAuthentication/Cocoa/NfcService.mm:
1230         (WebKit::NfcService::NfcService):
1231         (WebKit::NfcService::didConnectTag):
1232         (WebKit::NfcService::didDetectMultipleTags const):
1233         (WebKit::NfcService::setConnection):
1234         (WebKit::NfcService::restartDiscoveryInternal):
1235         (WebKit::NfcService::platformStartDiscovery):
1236         (WebKit::NfcService::setDriver): Deleted.
1237         * UIProcess/WebAuthentication/Mock/MockNfcService.h:
1238         * UIProcess/WebAuthentication/Mock/MockNfcService.mm:
1239         (-[WKMockNFTag tagID]):
1240         (-[WKMockNFTag initWithNFTag:]):
1241         (-[WKMockNFTag dealloc]):
1242         (-[WKMockNFTag initWithType:]):
1243         (-[WKMockNFTag initWithType:tagID:]):
1244         (WebKit::MockNfcService::receiveStopPolling):
1245         (WebKit::MockNfcService::receiveStartPolling):
1246         (WebKit::MockNfcService::platformStartDiscovery):
1247         (WebKit::MockNfcService::detectTags):
1248         (WebKit::MockNfcService::detectTags const): Deleted.
1249         * UIProcess/WebAuthentication/fido/CtapNfcDriver.cpp:
1250         (WebKit::CtapNfcDriver::CtapNfcDriver):
1251         * UIProcess/WebAuthentication/fido/CtapNfcDriver.h:
1252         * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
1253
1254 2019-10-26  youenn fablet  <youenn@apple.com>
1255
1256         Enforce user gesture for getUserMedia in case a previous getUserMedia call was denied
1257         https://bugs.webkit.org/show_bug.cgi?id=203362
1258
1259         Reviewed by Eric Carlson.
1260
1261         In case the request has user gesture priviledge, do not look at denied request history.
1262
1263         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1264         (WebKit::UserMediaPermissionRequestManagerProxy::getRequestAction):
1265         * UIProcess/UserMediaPermissionRequestProxy.h:
1266         (WebKit::UserMediaPermissionRequestProxy::isUserGesturePriviledged const):
1267
1268 2019-10-26  Chris Lord  <clord@igalia.com>
1269
1270         Put OffscreenCanvas behind a build flag
1271         https://bugs.webkit.org/show_bug.cgi?id=203146
1272
1273         Reviewed by Ryosuke Niwa.
1274
1275         Split the ImageBitmapOffscreenCanvas setting into two separate
1276         settings so OffscreenCanvas can be disabled at build time.
1277
1278         * Configurations/FeatureDefines.xcconfig:
1279         * Shared/WebPreferences.yaml:
1280         * Shared/WebPreferencesDefaultValues.h:
1281         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1282         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1283         * WebProcess/WebPage/WebInspectorUI.cpp:
1284         (WebKit::WebInspectorUI::WebInspectorUI):
1285
1286 2019-10-25  Chris Dumez  <cdumez@apple.com>
1287
1288         REGRESSION(r251599): Crash in MobileSafari tests (ASSERTION FAILED: m_pendingRequestToSuspendID)
1289         https://bugs.webkit.org/show_bug.cgi?id=203437
1290         <rdar://problem/56633399>
1291
1292         Reviewed by Geoffrey Garen.
1293
1294         * UIProcess/ProcessThrottler.cpp:
1295         (WebKit::ProcessThrottler::updateAssertionIfNeeded):
1296         Start the timer before sending the PrepareToSuspend IPC. The reason is that if the process has been
1297         terminated, the completion handler may run synchronously and cancel the request to suspend / stop
1298         the timer. Therefore, re-starting the timer after would be a mistake.
1299
1300 2019-10-25  David Kilzer  <ddkilzer@apple.com>
1301
1302         Unused arguments in MESSAGE_CHECK_CONTEXTID() macros
1303         <https://webkit.org/b/203389>
1304         <rdar://problem/55935374>
1305
1306         Reviewed by Alex Christensen.
1307
1308         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
1309         (#define MESSAGE_CHECK_CONTEXTID):
1310         - Rename macro argument from `contextID` to `identifier`
1311           and change `contextId`to `identifier` in the body of
1312           the macro so that the argument is always used.
1313         (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID):
1314         (WebKit::PlaybackSessionManagerProxy::currentTimeChanged):
1315         (WebKit::PlaybackSessionManagerProxy::bufferedTimeChanged):
1316         (WebKit::PlaybackSessionManagerProxy::seekableRangesVectorChanged):
1317         (WebKit::PlaybackSessionManagerProxy::canPlayFastReverseChanged):
1318         (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionOptionsChanged):
1319         (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionOptionsChanged):
1320         (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionIndexChanged):
1321         (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionIndexChanged):
1322         (WebKit::PlaybackSessionManagerProxy::externalPlaybackPropertiesChanged):
1323         (WebKit::PlaybackSessionManagerProxy::wirelessVideoPlaybackDisabledChanged):
1324         (WebKit::PlaybackSessionManagerProxy::mutedChanged):
1325         (WebKit::PlaybackSessionManagerProxy::volumeChanged):
1326         (WebKit::PlaybackSessionManagerProxy::durationChanged):
1327         (WebKit::PlaybackSessionManagerProxy::playbackStartedTimeChanged):
1328         (WebKit::PlaybackSessionManagerProxy::rateChanged):
1329         (WebKit::PlaybackSessionManagerProxy::pictureInPictureSupportedChanged):
1330         (WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged):
1331         (WebKit::PlaybackSessionManagerProxy::handleControlledElementIDResponse const):
1332         - Change `contextID` to `contextId` to match local variable name
1333           now that MESSAGE_CHECK_CONTEXTID() doesn't paper over this
1334           typo for us.
1335
1336         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1337         (#define MESSAGE_CHECK_CONTEXTID):
1338         - Rename macro argument from `contextID` to `identifier`
1339           and change `contextId`to `identifier` in the body of
1340           the macro so that the argument is always used.
1341
1342         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1343         (#define MESSAGE_CHECK_CONTEXTID):
1344         - Rename macro argument and variable in the body of the
1345           macro from `id` to `identifier` for consistency.
1346
1347 2019-10-25  Per Arne Vollan  <pvollan@apple.com>
1348
1349         [iOS] Fix sandbox violations seen while running layout tests
1350         https://bugs.webkit.org/show_bug.cgi?id=203419
1351
1352         Reviewed by Brent Fulgham.
1353
1354         Deny mach lookup to 'com.apple.logd' and 'com.apple.logd.events' and suppress logs, since these are
1355         believed to be unneeded in the WebContent process. Allow sysctl write to 'vm.footprint_suspend'.
1356         Deny mach lookup to 'com.apple.system.notification_center' and suppress logs, since allowing this
1357         is not believed to be needed in the WebContent process.
1358
1359         No new tests, covered by existing tests.
1360
1361         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1362
1363 2019-10-25  Matt Lewis  <jlewis3@apple.com>
1364
1365         Rolling out r251579,r251162,r251512,r251500, and r251498 for build failures
1366         and test failures
1367
1368         Unreviewed rollout.
1369
1370         * Platform/spi/Cocoa/NearFieldSPI.h:
1371         * UIProcess/API/APIWebAuthenticationPanel.cpp:
1372         (API::WebAuthenticationPanel::create):
1373         (API::WebAuthenticationPanel::WebAuthenticationPanel):
1374         * UIProcess/API/APIWebAuthenticationPanel.h:
1375         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
1376         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
1377         (-[_WKWebAuthenticationPanel relyingPartyID]):
1378         (wkWebAuthenticationTransport): Deleted.
1379         (-[_WKWebAuthenticationPanel transports]): Deleted.
1380         (wkWebAuthenticationType): Deleted.
1381         (-[_WKWebAuthenticationPanel type]): Deleted.
1382         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1383         (WebKit::WebCore::collectTransports):
1384         (WebKit::AuthenticatorManager::handleRequest):
1385         (WebKit::AuthenticatorManager::respondReceived):
1386         (WebKit::AuthenticatorManager::respondReceivedInternal):
1387         (WebKit::AuthenticatorManager::startDiscovery):
1388         (WebKit::AuthenticatorManager::initTimeOutTimer):
1389         (WebKit::AuthenticatorManager::runPanel):
1390         (WebKit::AuthenticatorManager::startRequest):
1391         (WebKit::AuthenticatorManager::invokePendingCompletionHandler):
1392         (WebKit::WebCore::getClientDataType): Deleted.
1393         (WebKit::AuthenticatorManager::serviceStatusUpdated): Deleted.
1394         (WebKit::AuthenticatorManager::filterTransports const): Deleted.
1395         (WebKit::AuthenticatorManager::getTransports const): Deleted.
1396         (WebKit::AuthenticatorManager::restartDiscovery): Deleted.
1397         * UIProcess/WebAuthentication/AuthenticatorManager.h:
1398         (WebKit::AuthenticatorManager::respondReceivedInternal): Deleted.
1399         * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
1400         (WebKit::AuthenticatorTransportService::startDiscovery):
1401         (WebKit::AuthenticatorTransportService::restartDiscovery): Deleted.
1402         * UIProcess/WebAuthentication/AuthenticatorTransportService.h:
1403         (WebKit::AuthenticatorTransportService::restartDiscoveryInternal): Deleted.
1404         * UIProcess/WebAuthentication/Cocoa/NfcConnection.h:
1405         * UIProcess/WebAuthentication/Cocoa/NfcConnection.mm:
1406         (WebKit::NfcConnection::NfcConnection):
1407         (WebKit::NfcConnection::~NfcConnection):
1408         (WebKit::NfcConnection::didDetectTags const):
1409         (WebKit::NfcConnection::create): Deleted.
1410         (WebKit::NfcConnection::stop const): Deleted.
1411         (WebKit::NfcConnection::didDetectTags): Deleted.
1412         (WebKit::NfcConnection::restartPolling): Deleted.
1413         (WebKit::NfcConnection::startPolling): Deleted.
1414         * UIProcess/WebAuthentication/Cocoa/NfcService.h:
1415         * UIProcess/WebAuthentication/Cocoa/NfcService.mm:
1416         (WebKit::NfcService::NfcService):
1417         (WebKit::NfcService::didConnectTag):
1418         (WebKit::NfcService::setDriver):
1419         (WebKit::NfcService::platformStartDiscovery):
1420         (WebKit::NfcService::isAvailable): Deleted.
1421         (WebKit::NfcService::didDetectMultipleTags const): Deleted.
1422         (WebKit::NfcService::setConnection): Deleted.
1423         (WebKit::NfcService::restartDiscoveryInternal): Deleted.
1424         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
1425         (WebKit::MockAuthenticatorManager::filterTransports const): Deleted.
1426         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h:
1427         * UIProcess/WebAuthentication/Mock/MockNfcService.h:
1428         * UIProcess/WebAuthentication/Mock/MockNfcService.mm:
1429         (-[WKMockNFTag initWithNFTag:]):
1430         (-[WKMockNFTag dealloc]):
1431         (-[WKMockNFTag initWithType:]):
1432         (WebKit::MockNfcService::platformStartDiscovery):
1433         (WebKit::MockNfcService::detectTags const):
1434         (-[WKMockNFTag tagID]): Deleted.
1435         (-[WKMockNFTag initWithType:tagID:]): Deleted.
1436         (WebKit::MockNfcService::receiveStopPolling): Deleted.
1437         (WebKit::MockNfcService::receiveStartPolling): Deleted.
1438         * UIProcess/WebAuthentication/fido/CtapNfcDriver.cpp:
1439         (WebKit::CtapNfcDriver::CtapNfcDriver):
1440         * UIProcess/WebAuthentication/fido/CtapNfcDriver.h:
1441         * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
1442
1443 2019-10-24  Wenson Hsieh  <wenson_hsieh@apple.com>
1444
1445         [iOS 13] fast/forms/ios/accessory-bar-navigation.html is a flaky failure
1446         https://bugs.webkit.org/show_bug.cgi?id=203294
1447         <rdar://problem/54520848>
1448
1449         Reviewed by Tim Horton.
1450
1451         Add an SPI declaration (as well as an internal-SKD-only header import) for UIKeyboardPreferencesController.
1452         See Tools/ChangeLog for more details.
1453
1454         * Platform/spi/ios/UIKitSPI.h:
1455
1456 2019-10-24  Ryosuke Niwa  <rniwa@webkit.org>
1457
1458         Add exclusion rules to text manipulation SPI
1459         https://bugs.webkit.org/show_bug.cgi?id=203398
1460         <rdar://problem/56567256>
1461
1462         Reviewed by Wenson Hsieh.
1463
1464         Added SPI to specify the configuration for the text manipulation (see r251574), in particular, the set of rules
1465         governing which content should be excluded or included in text manipulations.
1466
1467         Test: TextManipulation.StartTextManipulationExitEarlyWithoutDelegate
1468
1469         * SourcesCocoa.txt:
1470         * UIProcess/API/Cocoa/WKWebView.mm:
1471         (-[WKWebView _startTextManipulationsWithConfiguration:completion:]): Takes _WKTextManipulationConfiguration
1472         as an argument. Also fixed a bug that we weren't calling the completion handler when the delegate was not set.
1473         (-[WKWebView _completeTextManipulation:completion:]):
1474         (-[WKWebView _startTextManipulationsWithCompletionHandler:]): Deleted.
1475         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1476         * UIProcess/API/Cocoa/_WKTextManipulationConfiguration.h: Added.
1477         * UIProcess/API/Cocoa/_WKTextManipulationConfiguration.mm: Added.
1478         * UIProcess/API/Cocoa/_WKTextManipulationExclusionRule.h: Added.
1479         * UIProcess/API/Cocoa/_WKTextManipulationExclusionRule.mm: Added.
1480         (-[_WKTextManipulationExclusionRule initExclusion:forElement:]): Added.
1481         (-[_WKTextManipulationExclusionRule initExclusion:forAttribute:value:]): Added.
1482         (-[_WKTextManipulationExclusionRule elementName]): Added.
1483         (-[_WKTextManipulationExclusionRule attributeName]): Added.
1484         (-[_WKTextManipulationExclusionRule attributeValue]): Added.
1485         * UIProcess/API/Cocoa/_WKTextManipulationToken.h: Added excluded boolean property.
1486         * UIProcess/API/Cocoa/_WKTextManipulationToken.mm: Removed the superflous import of RetainPtr.h
1487         * UIProcess/WebPageProxy.cpp:
1488         (WebKit::WebPageProxy::startTextManipulations):
1489         (WebKit::WebPageProxy::completeTextManipulation):
1490         * UIProcess/WebPageProxy.h:
1491         * WebKit.xcodeproj/project.pbxproj:
1492         * WebProcess/WebPage/WebPage.cpp:
1493         (WebKit::WebPage::startTextManipulations):
1494         (WebKit::WebPage::completeTextManipulation):
1495         * WebProcess/WebPage/WebPage.h:
1496         * WebProcess/WebPage/WebPage.messages.in:
1497
1498 2019-10-25  Chris Dumez  <cdumez@apple.com>
1499
1500         [iOS][WK2] Use sendWithAsyncReply() to simplify the prepareToSuspend logic
1501         https://bugs.webkit.org/show_bug.cgi?id=203422
1502
1503         Reviewed by Alex Christensen.
1504
1505         Use sendWithAsyncReply() to simplify the prepareToSuspend logic and make it easier to
1506         understand.
1507
1508         * NetworkProcess/NetworkProcess.cpp:
1509         (WebKit::NetworkProcess::processWillSuspendImminentlyForTestingSync):
1510         (WebKit::NetworkProcess::prepareToSuspend):
1511         * NetworkProcess/NetworkProcess.h:
1512         * NetworkProcess/NetworkProcess.messages.in:
1513         * UIProcess/API/Cocoa/WKWebView.mm:
1514         (-[WKWebView _processWillSuspendImminentlyForTesting]):
1515         * UIProcess/Network/NetworkProcessProxy.cpp:
1516         (WebKit::NetworkProcessProxy::sendPrepareToSuspend):
1517         (WebKit::NetworkProcessProxy::processReadyToSuspend): Deleted.
1518         * UIProcess/Network/NetworkProcessProxy.h:
1519         * UIProcess/Network/NetworkProcessProxy.messages.in:
1520         * UIProcess/ProcessThrottler.cpp:
1521         (WebKit::ProcessThrottler::processReadyToSuspend):
1522         (WebKit::ProcessThrottler::sendPrepareToSuspendIPC):
1523         * UIProcess/ProcessThrottler.h:
1524         * UIProcess/ProcessThrottlerClient.h:
1525         * UIProcess/WebProcessProxy.cpp:
1526         (WebKit::WebProcessProxy::sendPrepareToSuspend):
1527         (WebKit::WebProcessProxy::processReadyToSuspend): Deleted.
1528         * UIProcess/WebProcessProxy.h:
1529         * UIProcess/WebProcessProxy.messages.in:
1530         * WebProcess/WebProcess.cpp:
1531         (WebKit::WebProcess::prepareToSuspend):
1532         * WebProcess/WebProcess.h:
1533         * WebProcess/WebProcess.messages.in:
1534
1535 2019-10-25  youenn fablet  <youenn@apple.com>
1536
1537         WebProcess should unregister its interest for a SWServerRegistration when all its corresponding ServiceWorkerRegistrations are destroyed
1538         https://bugs.webkit.org/show_bug.cgi?id=203410
1539
1540         Reviewed by Chris Dumez.
1541
1542         A SWServerRegistration is keeping a list of web processes that should be notified of change to its state.
1543         Previously, WebProcesses were registering their interest to a SWServerRegistration on construction of a ServiceWorkerRegistration,
1544         and unregistering their interest on destruction of a ServiceWorkerRegistration.
1545
1546         This does not work in case two ServiceWorkerRegistrations are created for the same SWServerRegistration in the same WebProcess.
1547         In that case, when one of the two ServiceWorkerRegistration is destroyed, the WebProcess will no longer be notified of changes to the SWServerRegistration,
1548         thus breaking the second ServiceWorkerRegistration behavior.
1549
1550         We introduce a map at WebProcess level to keep track of the number of ServiceWorkerRegistration created for a given SWServerRegistration.
1551
1552         Covered by re-enabled tests.
1553
1554         * WebProcess/Storage/WebSWClientConnection.cpp:
1555         (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
1556         (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
1557         * WebProcess/WebProcess.cpp:
1558         (WebKit::WebProcess::addServiceWorkerRegistration):
1559         (WebKit::WebProcess::removeServiceWorkerRegistration):
1560         * WebProcess/WebProcess.h:
1561
1562 2019-10-25  youenn fablet  <youenn@apple.com>
1563
1564         mp4 video element broken with service worker
1565         https://bugs.webkit.org/show_bug.cgi?id=184447
1566         <rdar://problem/39313155>
1567
1568         Reviewed by Chris Dumez.
1569
1570         Make a response as range-requested as per https://fetch.spec.whatwg.org/#http-network-or-cache-fetch step 15.
1571
1572         * NetworkProcess/NetworkLoadChecker.cpp:
1573         (WebKit::NetworkLoadChecker::checkRedirection):
1574         (WebKit::NetworkLoadChecker::validateResponse):
1575         * NetworkProcess/NetworkLoadChecker.h:
1576         * NetworkProcess/NetworkResourceLoader.cpp:
1577         (WebKit::NetworkResourceLoader::didReceiveResponse):
1578         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
1579
1580 2019-10-25  Chris Dumez  <cdumez@apple.com>
1581
1582         [iOS] Regression(r251067) WebProcesses with service workers no longer keep their network process alive
1583         https://bugs.webkit.org/show_bug.cgi?id=203388
1584         <rdar://problem/56600074>
1585
1586         Reviewed by Geoffrey Garen.
1587
1588         Historically, WebProcessProxy::didSetAssertionState() used to return early for service worker processes
1589         because we did not want service worker processes to prevent the network process from suspending. The
1590         WebProcesses using the service worker process would prevent the network process from suspending when
1591         they are visible, so it would work fine.
1592
1593         However, after r251067, there is no longer a concept of service worker process per se. Service workers
1594         will now sometimes run in regular WebProcesses where we have pages. In such cases, didSetAssertionState()
1595         would still return early and fail to keep its network process alive, even when the page(s) in this process
1596         are visible on screen.
1597
1598         To address the issue, we now only return early if the process has a service worker but no page.
1599         This should restore pre-existing behavior.
1600
1601         Note that this was causing hangs such as <rdar://problem/56245136> because the WebProcess would be
1602         stuck on sync IPC to a suspended network process.
1603
1604         * UIProcess/WebProcessProxy.cpp:
1605         (WebKit::WebProcessProxy::didSetAssertionState):
1606
1607 2019-10-25  Chris Dumez  <cdumez@apple.com>
1608
1609         Standardize "PageID=" vs "pageID =" in release logging
1610         https://bugs.webkit.org/show_bug.cgi?id=203002
1611
1612         Reviewed by Geoffrey Garen.
1613
1614         * UIProcess/API/Cocoa/WKWebView.mm:
1615         (-[WKWebView _didCommitLayerTree:]):
1616         (-[WKWebView _updateVisibleContentRects]):
1617         (-[WKWebView _cancelAnimatedResize]):
1618         (-[WKWebView _didCompleteAnimatedResize]):
1619         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
1620         (-[WKWebView _endAnimatedResize]):
1621         (-[WKWebView _resizeWhileHidingContentWithUpdates:]):
1622         * UIProcess/ProvisionalPageProxy.cpp:
1623         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
1624         (WebKit::ProvisionalPageProxy::processDidTerminate):
1625         (WebKit::ProvisionalPageProxy::cancel):
1626         (WebKit::ProvisionalPageProxy::loadData):
1627         (WebKit::ProvisionalPageProxy::loadRequest):
1628         (WebKit::ProvisionalPageProxy::goToBackForwardItem):
1629         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
1630         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
1631         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
1632         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
1633         * WebProcess/Network/WebLoaderStrategy.cpp:
1634         (WebKit::WebLoaderStrategy::loadResource):
1635         (WebKit::WebLoaderStrategy::scheduleLoad):
1636         (WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler):
1637         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1638         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1639         * WebProcess/Network/WebResourceLoader.cpp:
1640         (WebKit::WebResourceLoader::willSendRequest):
1641         (WebKit::WebResourceLoader::didReceiveResponse):
1642         (WebKit::WebResourceLoader::didReceiveData):
1643         (WebKit::WebResourceLoader::didFinishResourceLoad):
1644         (WebKit::WebResourceLoader::serviceWorkerDidNotHandle):
1645         (WebKit::WebResourceLoader::didFailResourceLoad):
1646         (WebKit::WebResourceLoader::didBlockAuthenticationChallenge):
1647         (WebKit::WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied):
1648         (WebKit::WebResourceLoader::didReceiveResource):
1649         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1650         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
1651         (WebKit::WebFrameLoaderClient::dispatchDidFailLoad):
1652         * WebProcess/WebPage/WebPage.cpp:
1653         (WebKit::WebPage::freezeLayerTree):
1654         (WebKit::WebPage::unfreezeLayerTree):
1655
1656 2019-10-24  Chris Dumez  <cdumez@apple.com>
1657
1658         Simplify ProcessThrottler implementation
1659         https://bugs.webkit.org/show_bug.cgi?id=203370
1660
1661         Reviewed by Alex Christensen.
1662
1663         Simplify ProcessThrottler implementation by:
1664         - Getting rid of CancelPrepareToSuspend IPC. Instead a regular ProcessDidResume IPC is sent to
1665           the child process.
1666         - Getting rid of the ProcessWillSuspendImminently IPC and send a regular ProcessDidResume IPC
1667           with a 'isSuspensionImminent' flag instead.
1668         - Whether the suspension is imminent or not, the child process now always responds with
1669           a ProcessReadyToSuspend IPC. This simplifies our logic as the idea is that treating imminent
1670           and non-imminent suspension should share as much of the same logic as possible.
1671         - All PrepareToSuspend IPCs now have an associated identifier and the child process sends back
1672           this identifier when responding with a ProcessReadyToSuspend IPC. This allows the
1673           ProcessThrottler to easily ignore outdated requests to suspend, without requiring the
1674           m_suspendMessageCount data member we had.
1675
1676         This patch also adds more logging to ProcessThrottler and the suspension logic in the child
1677         processes. All ProcessThrottler logging now also shows the child process's PID for clarity.
1678
1679         * NetworkProcess/NetworkProcess.cpp:
1680         (WebKit::NetworkProcess::processWillSuspendImminentlyForTestingSync):
1681         (WebKit::NetworkProcess::prepareToSuspend):
1682         * NetworkProcess/NetworkProcess.h:
1683         * NetworkProcess/NetworkProcess.messages.in:
1684         * UIProcess/API/Cocoa/WKWebView.mm:
1685         (-[WKWebView _processWillSuspendImminentlyForTesting]):
1686         * UIProcess/Network/NetworkProcessProxy.cpp:
1687         (WebKit::NetworkProcessProxy::sendPrepareToSuspend):
1688         (WebKit::NetworkProcessProxy::processReadyToSuspend):
1689         * UIProcess/Network/NetworkProcessProxy.h:
1690         * UIProcess/Network/NetworkProcessProxy.messages.in:
1691         * UIProcess/ProcessThrottler.cpp:
1692         (WebKit::generatePrepareToSuspendRequestID):
1693         (WebKit::ProcessThrottler::ProcessThrottler):
1694         (WebKit::m_backgroundCounter):
1695         (WebKit::ProcessThrottler::expectedAssertionState):
1696         (WebKit::ProcessThrottler::updateAssertionStateNow):
1697         (WebKit::ProcessThrottler::setAssertionState):
1698         (WebKit::ProcessThrottler::updateAssertionIfNeeded):
1699         (WebKit::ProcessThrottler::didConnectToProcess):
1700         (WebKit::ProcessThrottler::prepareToSuspendTimeoutTimerFired):
1701         (WebKit::ProcessThrottler::processReadyToSuspend):
1702         (WebKit::ProcessThrottler::clearPendingRequestToSuspend):
1703         (WebKit::ProcessThrottler::sendPrepareToSuspendIPC):
1704         (WebKit::ProcessThrottler::uiAssertionWillExpireImminently):
1705         * UIProcess/ProcessThrottler.h:
1706         * UIProcess/ProcessThrottlerClient.h:
1707         * UIProcess/WebProcessProxy.cpp:
1708         (WebKit::WebProcessProxy::sendPrepareToSuspend):
1709         (WebKit::WebProcessProxy::processReadyToSuspend):
1710         * UIProcess/WebProcessProxy.h:
1711         * UIProcess/WebProcessProxy.messages.in:
1712         * WebProcess/WebProcess.cpp:
1713         (WebKit::WebProcess::prepareToSuspend):
1714         * WebProcess/WebProcess.h:
1715         * WebProcess/WebProcess.messages.in:
1716
1717 2019-10-23  Ryosuke Niwa  <rniwa@webkit.org>
1718
1719         Add a mechanism to find and manipulate text by paragraphs
1720         https://bugs.webkit.org/show_bug.cgi?id=203286
1721
1722         Reviewed by Wenson Hsieh.
1723
1724         This patch introduces a new SPI to find paragraphs of text and let client replace the content of each paragraph.
1725         For now, this SPI is limited to find & replace contents of main frame's document.
1726
1727         WKWebView's _startTextManipulationsWithCompletionHandler sends StartTextManipulations message to WebContent process
1728         to find all paragraphs in the main frame. WebContent process will send back DidFindTextManipulationItem message
1729         for each paragraph, which in turn calls back _WKTextManipulationDelegate's _webView: didFindTextManipulationItem:.
1730
1731         Upon receiving this delegate callback, the client can invoke WKWebView's _completeTextManipulation to replace
1732         the content. It will send CompleteTextManipulation to WebContent process, which will invoke completeManipulation
1733         on main frame's document's TextManipulationController.
1734
1735         * UIProcess/API/Cocoa/WKWebView.mm:
1736         (-[WKWebView _textManipulationDelegate]): Aded.
1737         (-[WKWebView _setTextManipulationDelegate:]): Aded.
1738         (-[WKWebView _startTextManipulationsWithCompletionHandler:]):
1739         (-[WKWebView _completeTextManipulation:completion:]):
1740         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1741         * UIProcess/API/Cocoa/_WKTextManipulationDelegate.h: Added.
1742         * UIProcess/API/Cocoa/_WKTextManipulationItem.h: Added.
1743         * UIProcess/API/Cocoa/_WKTextManipulationItem.mm: Added.
1744         (-[_WKTextManipulationItem initWithIdentifier:tokens:]):
1745         (-[_WKTextManipulationItem identifier]):
1746         (-[_WKTextManipulationItem tokens]):
1747         * UIProcess/API/Cocoa/_WKTextManipulationToken.h: Added.
1748         * UIProcess/API/Cocoa/_WKTextManipulationToken.mm: Added.
1749         (-[_WKTextManipulationToken init]):
1750         * UIProcess/WebPageProxy.cpp:
1751         (WebKit::WebPageProxy::startTextManipulations):
1752         (WebKit::WebPageProxy::didFindTextManipulationItem):
1753         (WebKit::WebPageProxy::completeTextManipulation):
1754         * UIProcess/WebPageProxy.h:
1755         * UIProcess/WebPageProxy.messages.in:
1756         * WebKit.xcodeproj/project.pbxproj:
1757         * WebProcess/WebPage/WebPage.cpp:
1758         (WebKit::WebPage::startTextManipulations):
1759         (WebKit::WebPage::completeTextManipulation):
1760         * WebProcess/WebPage/WebPage.h:
1761         * WebProcess/WebPage/WebPage.messages.in:
1762
1763 2019-10-24  Matt Lewis  <jlewis3@apple.com>
1764
1765         Unreviewed, rolling out r251558.
1766
1767         This broke internal builds
1768
1769         Reverted changeset:
1770
1771         "Add a mechanism to find and manipulate text by paragraphs"
1772         https://bugs.webkit.org/show_bug.cgi?id=203286
1773         https://trac.webkit.org/changeset/251558
1774
1775 2019-10-24  Alex Christensen  <achristensen@webkit.org>
1776
1777         REGRESSION(r251409) Service worker connection should not be established without service worker entitlement
1778         https://bugs.webkit.org/show_bug.cgi?id=203385
1779         <rdar://problem/37790257>
1780
1781         Reviewed by Chris Dumez.
1782
1783         r251409 introduced a new call to establishSWServerConnection that should have an entitlement check.
1784         This was caught by a unit test in CI that is not easy to reproduce in WebKit's test.  See the radar.
1785
1786         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1787         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
1788
1789 2019-10-24  Brent Fulgham  <bfulgham@apple.com>
1790
1791         [iOS] Mismatch in com.apple.coremedia.audiodeviceclock declarations
1792         https://bugs.webkit.org/show_bug.cgi?id=203367
1793         <rdar://problem/56581166>
1794
1795         Reviewed by Per Arne Vollan.
1796
1797         The 'common.sb' sandbox allows access to "com.apple.coremedia.audiodeviceclock.xpc", but
1798         the WebContent sandbox blocked access to "com.apple.coremedia.audiodeviceclock". This means
1799         we aren't blocking that endpoint.
1800
1801         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1802
1803 2019-10-24  Brent Fulgham  <bfulgham@apple.com>
1804
1805         [iOS] Mismatch in com.apple.MediaPlayer.RemotePlayerService declarations
1806         https://bugs.webkit.org/show_bug.cgi?id=203368
1807         <rdar://problem/56581152>
1808
1809         Reviewed by Per Arne Vollan.
1810
1811         The 'common.sb' sandbox allows access to the xpc-service-name "com.apple.MediaPlayer.RemotePlayerService",
1812         but we block access to the global-name "com.apple.MediaPlayer.RemoteService". We aren't blocking
1813         the right thing.
1814
1815         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1816
1817 2019-10-24  Brady Eidson  <beidson@apple.com>
1818
1819         Expose pageZoom as API.
1820         https://bugs.webkit.org/show_bug.cgi?id=203381
1821
1822         Reviewed by Andy Estes.
1823
1824         No new tests (No behavior change, identical to SPI)
1825
1826         * UIProcess/API/Cocoa/WKWebView.h:
1827         * UIProcess/API/Cocoa/WKWebView.mm:
1828         (-[WKWebView setPageZoom:]):
1829         (-[WKWebView pageZoom]):
1830         (-[WKWebView _pageZoomFactor]):
1831         (-[WKWebView _setPageZoomFactor:]):
1832
1833 2019-10-23  Ryosuke Niwa  <rniwa@webkit.org>
1834
1835         Add a mechanism to find and manipulate text by paragraphs
1836         https://bugs.webkit.org/show_bug.cgi?id=203286
1837
1838         Reviewed by Wenson Hsieh.
1839
1840         This patch introduces a new SPI to find paragraphs of text and let client replace the content of each paragraph.
1841         For now, this SPI is limited to find & replace contents of main frame's document.
1842
1843         WKWebView's _startTextManipulationsWithCompletionHandler sends StartTextManipulations message to WebContent process
1844         to find all paragraphs in the main frame. WebContent process will send back DidFindTextManipulationItem message
1845         for each paragraph, which in turn calls back _WKTextManipulationDelegate's _webView: didFindTextManipulationItem:.
1846
1847         Upon receiving this delegate callback, the client can invoke WKWebView's _completeTextManipulation to replace
1848         the content. It will send CompleteTextManipulation to WebContent process, which will invoke completeManipulation
1849         on main frame's document's TextManipulationController.
1850
1851         * UIProcess/API/Cocoa/WKWebView.mm:
1852         (-[WKWebView _textManipulationDelegate]): Aded.
1853         (-[WKWebView _setTextManipulationDelegate:]): Aded.
1854         (-[WKWebView _startTextManipulationsWithCompletionHandler:]):
1855         (-[WKWebView _completeTextManipulation:completion:]):
1856         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1857         * UIProcess/API/Cocoa/_WKTextManipulationDelegate.h: Added.
1858         * UIProcess/API/Cocoa/_WKTextManipulationItem.h: Added.
1859         * UIProcess/API/Cocoa/_WKTextManipulationItem.mm: Added.
1860         (-[_WKTextManipulationItem initWithIdentifier:tokens:]):
1861         (-[_WKTextManipulationItem identifier]):
1862         (-[_WKTextManipulationItem tokens]):
1863         * UIProcess/API/Cocoa/_WKTextManipulationToken.h: Added.
1864         * UIProcess/API/Cocoa/_WKTextManipulationToken.mm: Added.
1865         (-[_WKTextManipulationToken init]):
1866         * UIProcess/WebPageProxy.cpp:
1867         (WebKit::WebPageProxy::startTextManipulations):
1868         (WebKit::WebPageProxy::didFindTextManipulationItem):
1869         (WebKit::WebPageProxy::completeTextManipulation):
1870         * UIProcess/WebPageProxy.h:
1871         * UIProcess/WebPageProxy.messages.in:
1872         * WebKit.xcodeproj/project.pbxproj:
1873         * WebProcess/WebPage/WebPage.cpp:
1874         (WebKit::WebPage::startTextManipulations):
1875         (WebKit::WebPage::completeTextManipulation):
1876         * WebProcess/WebPage/WebPage.h:
1877         * WebProcess/WebPage/WebPage.messages.in:
1878
1879 2019-10-24  Brent Fulgham  <bfulgham@apple.com>
1880
1881         Unreviewed fix after r251511.
1882
1883         Some syctl names were omitted from the initial checkin.
1884
1885         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1886
1887 2019-10-24  Brady Eidson  <beidson@apple.com>
1888
1889         Formalize PDF snapshot API.
1890         https://bugs.webkit.org/show_bug.cgi?id=203374
1891
1892         Reviewed by Tim Horton.
1893
1894         Covered by API tests and MiniBrowser usage.
1895
1896         * SourcesCocoa.txt:
1897         * UIProcess/API/Cocoa/WKPDFConfiguration.h: Added.
1898         * UIProcess/API/Cocoa/WKPDFConfiguration.mm: Added.
1899         (-[WKPDFConfiguration init]):
1900         (-[WKPDFConfiguration copyWithZone:]):
1901
1902         * UIProcess/API/Cocoa/WKWebView.h:
1903         * UIProcess/API/Cocoa/WKWebView.mm:
1904         (-[WKWebView createPDFWithConfiguration:completionHandler:]):
1905         (-[WKWebView _takePDFSnapshotWithConfiguration:completionHandler:]):
1906
1907         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h: Unified build strikes again.
1908
1909         * WebKit.xcodeproj/project.pbxproj:
1910
1911 2019-10-24  Brent Fulgham  <bfulgham@apple.com>
1912
1913         [iOS] Remove 'deny' rules that do not have a corresponding 'allow' rule
1914         https://bugs.webkit.org/show_bug.cgi?id=203352
1915
1916         Reviewed by Per Arne Vollan.
1917
1918         Now that we no longer import 'common.sb', and have removed entries that allowed
1919         services that we block, we can remove the 'deny' command. This is safe because
1920         everything is denied by default.
1921
1922         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1923
1924 2019-10-24  Alex Christensen  <achristensen@webkit.org>
1925
1926         Pass CORS-enabled schemes through WebProcess instead of having them NetworkProcess-global
1927         https://bugs.webkit.org/show_bug.cgi?id=202891
1928
1929         Reviewed by Youenn Fablet.
1930
1931         No change in behavior.  Now the LegacySchemeRegistry is not used as much in the NetworkProcess, a step towards no use at all.
1932         This functionality is currently only available through the glib API webkit_security_manager_register_uri_scheme_as_cors_enabled
1933         but it has been requested in bug 201180 and bug 199064.
1934
1935         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1936         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
1937         (WebKit::NetworkConnectionToWebProcess::loadPing):
1938         (WebKit::NetworkConnectionToWebProcess::registerURLSchemesAsCORSEnabled):
1939         * NetworkProcess/NetworkConnectionToWebProcess.h:
1940         (WebKit::NetworkConnectionToWebProcess::schemeRegistry):
1941         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1942         * NetworkProcess/NetworkLoadChecker.cpp:
1943         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
1944         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
1945         * NetworkProcess/NetworkLoadChecker.h:
1946         * NetworkProcess/NetworkProcess.cpp:
1947         (WebKit::NetworkProcess::initializeNetworkProcess):
1948         (WebKit::NetworkProcess::registerURLSchemeAsCORSEnabled const): Deleted.
1949         * NetworkProcess/NetworkProcess.messages.in:
1950         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1951         (WebKit::NetworkProcessCreationParameters::encode const):
1952         (WebKit::NetworkProcessCreationParameters::decode):
1953         * NetworkProcess/NetworkProcessCreationParameters.h:
1954         * NetworkProcess/NetworkResourceLoader.cpp:
1955         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
1956         * NetworkProcess/NetworkSchemeRegistry.cpp: Added.
1957         (WebKit::NetworkSchemeRegistry::registerURLSchemeAsCORSEnabled):
1958         (WebKit::NetworkSchemeRegistry::shouldTreatURLSchemeAsCORSEnabled):
1959         * NetworkProcess/NetworkSchemeRegistry.h: Added.
1960         (WebKit::NetworkSchemeRegistry::create):
1961         * NetworkProcess/PingLoad.cpp:
1962         (WebKit::PingLoad::PingLoad):
1963         Use nullptr, indicating that the PingLoad constructor that is used in ad click attribution should not check the custom scheme registry.
1964         This is Ok because ad click attribution is only used for HTTP family schemes.
1965         (WebKit::m_blobFiles):
1966         * NetworkProcess/PingLoad.h:
1967         * Sources.txt:
1968         * UIProcess/WebProcessPool.cpp:
1969         (WebKit::WebProcessPool::ensureNetworkProcess):
1970         (WebKit::WebProcessPool::registerURLSchemeAsCORSEnabled):
1971         * WebKit.xcodeproj/project.pbxproj:
1972         * WebProcess/WebProcess.cpp:
1973         (WebKit::WebProcess::initializeWebProcess):
1974         (WebKit::WebProcess::registerURLSchemeAsCORSEnabled):
1975         (WebKit::WebProcess::ensureNetworkProcessConnection):
1976         (WebKit::WebProcess::registerURLSchemeAsCORSEnabled const): Deleted.
1977         * WebProcess/WebProcess.h:
1978
1979 2019-10-24  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1980
1981         [GTK][WPE] Enable runtime setting with experimental features for Server Timing API
1982         https://bugs.webkit.org/show_bug.cgi?id=203295
1983
1984         Reviewed by Carlos Garcia Campos.
1985
1986         Enable the runtime ServerTiming by default when GTK or WPE is built
1987         with experimental features enabled.
1988
1989         No new tests, no change in behaviour for WTR.
1990
1991         * Shared/WebPreferences.yaml:
1992         * Shared/WebPreferencesDefaultValues.h:
1993
1994 2019-10-23  Chris Dumez  <cdumez@apple.com>
1995
1996         WebBackForwardCache::removeEntriesMatching() may re-enter and crash
1997         https://bugs.webkit.org/show_bug.cgi?id=203341
1998         <rdar://problem/56553939>
1999
2000         Reviewed by Geoffrey Garen.
2001
2002         When WebBackForwardCache::removeEntriesMatching() was clearing the WebBackForwardListItem's
2003         WebBackForwardCacheEntry, it could destroyed a SuspendedPageProxy which could shutdown a
2004         WebProcess. Upon shutting down, we would try to remove WebBackForwardCache entries associated
2005         with a given process, re-enter removeEntriesMatching() and crash.
2006
2007         To address the issue, I made WebBackForwardCache::removeEntriesMatching() safe to re-enter.
2008         We now clear the WebBackForwardListItems' WebBackForwardCacheEntries only after we're done
2009         updating m_itemsWithCachedPage.
2010
2011         * UIProcess/WebBackForwardCache.cpp:
2012         (WebKit::WebBackForwardCache::removeEntriesMatching):
2013
2014 2019-10-23  Megan Gardner  <megan_gardner@apple.com>
2015
2016         Rename force-press-related functions to refer to context menus, and fix a former force-press test
2017         https://bugs.webkit.org/show_bug.cgi?id=202663
2018         <rdar://problem/52699530>
2019
2020         Reviewed by Dean Jackson.
2021
2022         Add plumbing for contextMenu tests to function again, and rename all 
2023         relevant fuctions to more correctly reflect that this does not specifically
2024         require a force press to activate any longer.
2025
2026         * UIProcess/API/Cocoa/WKWebView.mm:
2027         (-[WKWebView _didShowContextMenu]):
2028         (-[WKWebView _didDismissContextMenu]):
2029         (-[WKWebView _didShowForcePressPreview]): Deleted.
2030         (-[WKWebView _didDismissForcePressPreview]): Deleted.
2031         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2032         * UIProcess/ios/WKContentViewInteraction.mm:
2033         (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]):
2034         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
2035         (-[WKContentView _previewItemController:didDismissPreview:committing:]):
2036         (-[WKContentView _previewItemControllerDidCancelPreview:]):
2037
2038 2019-10-23  Tim Horton  <timothy_horton@apple.com>
2039
2040         macCatalyst: Should dispatch contextmenu event on right click
2041         https://bugs.webkit.org/show_bug.cgi?id=203316
2042         <rdar://problem/54617376>
2043
2044         Reviewed by Wenson Hsieh.
2045
2046         * WebProcess/WebPage/WebPage.cpp:
2047         (WebKit::isContextClick):
2048         (WebKit::handleContextMenuEvent):
2049         (WebKit::WebPage::contextMenuForKeyEvent):
2050         (WebKit::handleMouseEvent):
2051         * WebProcess/WebPage/WebPage.h:
2052
2053 2019-10-23  Brent Fulgham  <bfulgham@apple.com>
2054
2055         [iOS] Stop including 'common.sb' 
2056         https://bugs.webkit.org/show_bug.cgi?id=203318
2057
2058         Reviewed by Per Arne Vollan.
2059
2060         Replace the 'import' of common.sb with the equivalent statements. This is the
2061         first step in a task to remove uneeded sandbox rules.
2062
2063         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2064
2065 2019-10-23  Kate Cheney  <katherine_cheney@apple.com>
2066
2067         Implement dumpResourceLoadStatistics in SQLite ITP Database
2068         https://bugs.webkit.org/show_bug.cgi?id=203224
2069         <rdar://problem/56482165>
2070
2071         Reviewed by John Wilander. 
2072
2073         This patch implements dumpResourceLoadStatistics() in the ITP database
2074         store. This function required a boolean flag isScheduledForWebsiteDataRemoval that
2075         now must be stored in the database, resulting in a small schema change.
2076
2077         Because of the schema change, this patch also compares any existing 
2078         database file against the new schema, and deletes the existing file if the schema is 
2079         not current. 
2080
2081         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2082         The logic for topFrameLinkDecorationsFromQuery was the opposite
2083         of all other "xyzFrom" queries. When merging data from the memory 
2084         store, the load statistic being inserted holds a list of topFrames 
2085         which it has been redirected to from. I think it makes more sense
2086         to also organize the table this way.
2087
2088         (WebKit::ObservedDomainsTableSchemaV1):
2089         (WebKit::ObservedDomainsTableSchemaV1Alternate):
2090         For support on both iOS and MacOS, there are two CREATE TABLE queries
2091         to compare to, depending on whether the query result contains quotes
2092         around the table name.
2093
2094         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
2095         (WebKit::ResourceLoadStatisticsDatabaseStore::openITPDatabase):
2096         (WebKit::ResourceLoadStatisticsDatabaseStore::openAndDropOldDatabaseIfNecessary):
2097         The code to check for the current schema was adapted from SQLiteIDBBackingStore.cpp
2098
2099         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements):
2100         (WebKit::ResourceLoadStatisticsDatabaseStore::insertObservedDomain):
2101         (WebKit::ResourceLoadStatisticsDatabaseStore::ensureAndMakeDomainList):
2102         The previous naming of the list parameter in this function was
2103         confusing because it is used by many different relationships not just
2104         subframes under top frames.
2105
2106         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationshipList):
2107         topFrameLinkDecorationsFrom were never inserted into the database.
2108
2109         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
2110         (WebKit::ResourceLoadStatisticsDatabaseStore::merge):
2111         (WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistic):
2112         Since the statement to get all data for a given domain is now used in
2113         multiple places, I stored the query as a constexpr auto.
2114
2115         (WebKit::ResourceLoadStatisticsDatabaseStore::logCrossSiteLoadWithLinkDecoration):
2116         Matched the memory store functionality, which calls the boolean
2117         "gotLinkDecorationFromPrevalentResource." I thought isScheduledForWebsiteDataRemoval 
2118         would be more clear of a name, because this flag gets cleared even when
2119         prevalent top frame link decorations for this domain still exist in the table.
2120
2121         (WebKit::ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics):
2122         (WebKit::ResourceLoadStatisticsDatabaseStore::setIsScheduledForWebsiteDataRemoval):
2123         (WebKit::ResourceLoadStatisticsDatabaseStore::prevalentDomains): Deleted.
2124         (WebKit::ResourceLoadStatisticsDatabaseStore::domains):
2125         To match memory store functionality, the check for website data to
2126         delete should check all domains, not just prevalent ones.
2127
2128         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUnexpiredRecentUserInteraction):
2129         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllWebsiteDataFor):
2130         This now needs to check if the resource is prevalent, because it is
2131         no longer guaranteed.
2132
2133         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllButCookiesFor):
2134         (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor):
2135         (WebKit::ResourceLoadStatisticsDatabaseStore::getDomainStringFromDomainID):
2136         (WebKit::ResourceLoadStatisticsDatabaseStore::getSubStatisticStatement):
2137         (WebKit::ResourceLoadStatisticsDatabaseStore::appendSubStatisticList):
2138         (WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString):
2139         This functionality matches the toString function in
2140         ResourceLoadStatistics.cpp.
2141
2142         (WebKit::CompletionHandler<void):
2143         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
2144
2145 2019-10-23  Yury Semikhatsky  <yurys@chromium.org>
2146
2147         Web Inspector: notify inspector when provisional page is created, committed and destroyed
2148         https://bugs.webkit.org/show_bug.cgi?id=202704
2149
2150         Reviewed by Devin Rousso.
2151
2152         Target.targetCreated event is now generated for provisional pages as well as for regular
2153         ones. This is the first step toward reattaching inspector earlier during PSON. In the future
2154         if debugging is in progress the provisional target (page) will be paused until a signal from
2155         inspector frontend. This will enable the frontend configure all agents before navigation starts.
2156
2157         * Sources.txt:
2158         * UIProcess/API/APIWebAuthenticationPanel.cpp:
2159         (API::WebAuthenticationPanel::WebAuthenticationPanel): Added explicit namespace specifier
2160         to the constructor's argument as otherwise compilation fails due to conflict between API::String
2161         and WTF::String.
2162
2163         * UIProcess/InspectorTargetProxy.cpp:
2164         (WebKit::InspectorTargetProxy::create):
2165         (WebKit::InspectorTargetProxy::connect):
2166         (WebKit::InspectorTargetProxy::disconnect):
2167         (WebKit::InspectorTargetProxy::sendMessageToTargetBackend):
2168         (WebKit::InspectorTargetProxy::didCommitProvisionalTarget):
2169         (WebKit::InspectorTargetProxy::isProvisional const):
2170         (WebKit::InspectorTargetProxy::previousTargetID const):
2171         * UIProcess/InspectorTargetProxy.h: Target proxy can start as a provisional target (with a pointer to
2172         ProvisionalPageProxy) and later either be committed or destroyed.
2173
2174         * UIProcess/ProvisionalPageProxy.cpp:
2175         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
2176         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
2177         (WebKit::ProvisionalPageProxy::didReceiveMessage): Forward inspector messages to parent page's WebPageInspectorController.
2178         Since each WebPage has a unique identifier the target ids will be globally unique and there is no risk of collisions.
2179
2180         * UIProcess/ProvisionalPageProxy.h:
2181         (WebKit::ProvisionalPageProxy::page const):
2182         * UIProcess/WebPageInspectorController.cpp:
2183         (WebKit::getTargetID):
2184         (WebKit::WebPageInspectorController::WebPageInspectorController):
2185         (WebKit::WebPageInspectorController::clearTargets):
2186         (WebKit::WebPageInspectorController::createInspectorTarget):
2187         (WebKit::WebPageInspectorController::destroyInspectorTarget):
2188         (WebKit::WebPageInspectorController::didCreateProvisionalPage):
2189         (WebKit::WebPageInspectorController::didDestroyProvisionalPage):
2190         (WebKit::WebPageInspectorController::didCommitProvisionalPage):
2191         (WebKit::WebPageInspectorController::addTarget):
2192         * UIProcess/WebPageInspectorController.h:
2193         * UIProcess/WebPageInspectorTargetAgent.cpp: Removed. Merged this agent into InspectorTargetAgent.
2194         * UIProcess/WebPageInspectorTargetAgent.h: Removed.
2195         * UIProcess/WebPageProxy.cpp:
2196         (WebKit::m_resetRecentCrashCountTimer):
2197         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2198         (WebKit::WebPageProxy::commitProvisionalPage):
2199         * UIProcess/WebPageProxy.h: Moved the target management logic into WebPageInspectorController.
2200         WebPageProxy/ProvisionalPageProxy are expected to notifiy it about key lifecycle events and also
2201         forward to it messages from inspector in the inspected WebProcess. How it translates to Target
2202         events is inspector's business.
2203
2204         * WebKit.xcodeproj/project.pbxproj:
2205         * WebProcess/WebPage/WebPageInspectorTarget.cpp:
2206         (WebKit::WebPageInspectorTarget::identifier const):
2207         (WebKit::WebPageInspectorTarget::connect):
2208         (WebKit::WebPageInspectorTarget::disconnect):
2209         (WebKit::WebPageInspectorTarget::toTargetID):
2210         * WebProcess/WebPage/WebPageInspectorTarget.h: Made the target own frontend channel instance as it's the
2211         only place where the page specific channel is used.
2212
2213         * WebProcess/WebPage/WebPageInspectorTargetController.cpp:
2214         (WebKit::WebPageInspectorTargetController::removeTarget):
2215         (WebKit::WebPageInspectorTargetController::connectInspector):
2216         (WebKit::WebPageInspectorTargetController::disconnectInspector):
2217         * WebProcess/WebPage/WebPageInspectorTargetController.h:
2218         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
2219         (WebKit::WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel):
2220         (WebKit::WebPageInspectorTargetFrontendChannel::sendMessageToFrontend):
2221         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h: The channel's lifetime is managed by owning
2222         target. No need to reference count it.
2223
2224 2019-10-22  Jiewen Tan  <jiewen_tan@apple.com>
2225
2226         [WebAuthn] Supply FrameInfo in -[WKUIDelegatePrivate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]
2227         https://bugs.webkit.org/show_bug.cgi?id=202563
2228         <rdar://problem/55973968>
2229
2230         Reviewed by Brent Fulgham.
2231
2232         This patch makes WKFrameInfo available to clients via the above SPI. To do so,
2233         SecuirtyOrigin of the caller document is passed from WebContent Process.
2234
2235         * UIProcess/API/APIUIClient.h:
2236         (API::UIClient::runWebAuthenticationPanel):
2237         * UIProcess/API/C/WKPage.cpp:
2238         (WKPageSetPageUIClient):
2239         * UIProcess/Cocoa/UIDelegate.h:
2240         * UIProcess/Cocoa/UIDelegate.mm:
2241         (WebKit::UIDelegate::UIClient::runWebAuthenticationPanel):
2242         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2243         (WebKit::AuthenticatorManager::runPanel):
2244         * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
2245         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
2246         (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
2247         (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
2248         (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):
2249         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
2250         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in:
2251         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
2252         (WebKit::WebAuthenticatorCoordinator::makeCredential):
2253         (WebKit::WebAuthenticatorCoordinator::getAssertion):
2254         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h:
2255
2256 2019-10-23  Andy Estes  <aestes@apple.com>
2257
2258         [Quick Look] Rename PreviewLoader{,Client} to LegacyPreviewLoader{,Client}
2259         https://bugs.webkit.org/show_bug.cgi?id=203306
2260
2261         Reviewed by Tim Horton.
2262
2263         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2264         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2265         * WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm:
2266         (WebKit::WebFrameLoaderClient::createPreviewLoaderClient):
2267         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.h:
2268
2269 2019-10-22  Fujii Hironori  <Hironori.Fujii@sony.com>
2270
2271         Unreviewed build fix for non-unified source builds
2272         https://bugs.webkit.org/show_bug.cgi?id=203055
2273         <rdar://problem/56504295>
2274
2275         * WebProcess/Storage/WebServiceWorkerProvider.cpp: Added #include <WebCore/RuntimeEnabledFeatures.h>.
2276
2277 2019-10-22  John Wilander  <wilander@apple.com>
2278
2279         Resource Load Statistics (experimental): Block all third-party cookies
2280         https://bugs.webkit.org/show_bug.cgi?id=203266
2281         <rdar://problem/56512858>
2282
2283         Reviewed by Alex Christensen.
2284
2285         This change updates the experimental change in
2286         <https://trac.webkit.org/changeset/251213> to block all
2287         third-party cookies, regardless of user interaction with
2288         the first-party website.
2289
2290         * NetworkProcess/NetworkProcess.cpp:
2291         (WebKit::NetworkProcess::setShouldBlockThirdPartyCookiesForTesting):
2292         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2293         (WebKit::NetworkSessionCreationParameters::encode const):
2294         (WebKit::NetworkSessionCreationParameters::decode):
2295         * NetworkProcess/NetworkSessionCreationParameters.h:
2296         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2297         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2298         * Shared/WebPreferences.yaml:
2299         * UIProcess/WebProcessPool.cpp:
2300         (WebKit::WebProcessPool::ensureNetworkProcess):
2301         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2302         (WebKit::WebsiteDataStore::parameters):
2303
2304 2019-10-22  Tim Horton  <timothy_horton@apple.com>
2305
2306         Make it possible to not include IPC Messages headers in other headers
2307         https://bugs.webkit.org/show_bug.cgi?id=203074
2308
2309         * Scripts/webkit/messages_unittest.py:
2310         (GeneratedFileContentsTest.assertHeaderEqual):
2311         (GeneratedFileContentsTest.assertImplementationEqual):
2312         (UnsupportedPrecompilerDirectiveTest.test_error_at_else):
2313         (UnsupportedPrecompilerDirectiveTest.test_error_at_elif):
2314         Fix the message generator unit tests.
2315
2316 2019-10-22  Alex Christensen  <achristensen@webkit.org>
2317
2318         Re-enable legacy TLS by default, keep runtime switch
2319         https://bugs.webkit.org/show_bug.cgi?id=203253
2320
2321         Reviewed by Geoffrey Garen.
2322
2323         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2324         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2325         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2326         (WebKit::WebsiteDataStore::parameters):
2327
2328 2019-10-22  Alex Christensen  <achristensen@webkit.org>
2329
2330         Revert r243010 on pre-Catalina macOS
2331         https://bugs.webkit.org/show_bug.cgi?id=203265
2332         <rdar://problem/55570995>
2333
2334         Reviewed by Per Arne Vollan.
2335
2336         * WebProcess/com.apple.WebProcess.sb.in:
2337
2338 2019-10-22  Tim Horton  <timothy_horton@apple.com>
2339
2340         Update xcfilelists
2341
2342         * DerivedSources-output.xcfilelist:
2343
2344 2019-10-22  Tim Horton  <timothy_horton@apple.com>
2345
2346         Make it possible to not include IPC Messages headers in other headers
2347         https://bugs.webkit.org/show_bug.cgi?id=203074
2348
2349         Reviewed by Geoffrey Garen.
2350
2351         Make the Messages generator generate a new -MessagesReplies.h file, which
2352         only includes headers for and definitions of DelayedReply/AsyncReply types,
2353         which need to be mentioned as arguments to message hander methods, and
2354         thus must be available in various headers throughout the project.
2355
2356         In order to do this, we have to de-nest them from the primary message
2357         class, but we then 'using' them back into place inside the message class
2358         so that most of the code doesn't need to change.
2359
2360         This helps to wildly decrease the header load of WebPage.h and WebPageProxy.h,
2361         especially, because the number of headers needed for types in their replies
2362         is much smaller than the number needed for all message receivers.
2363
2364         Also, only invoke the Messages generator once per source file, and
2365         only parse the source file once, generating all three output files
2366         in one invocation.
2367
2368         And then clean up all the missing indirect includes that we lost by doing this.
2369
2370         All-in-all this is worth roughly 8% on the WebKit2 Build Time Benchmark.
2371
2372         * CMakeLists.txt:
2373         * DerivedSources-input.xcfilelist:
2374         * DerivedSources.make:
2375         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2376         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2377         * NetworkProcess/NetworkConnectionToWebProcess.h:
2378         * NetworkProcess/NetworkResourceLoader.cpp:
2379         * NetworkProcess/NetworkResourceLoader.h:
2380         * PluginProcess/PluginControllerProxy.cpp:
2381         * PluginProcess/PluginControllerProxy.h:
2382         * PluginProcess/WebProcessConnection.h:
2383         * Scripts/Makefile:
2384         * Scripts/generate-message-receiver.py:
2385         (main):
2386         * Scripts/generate-messages-header.py: Removed.
2387         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
2388         * Scripts/webkit/LegacyMessages-expected.h:
2389         * Scripts/webkit/LegacyMessagesReplies-expected.h: Added.
2390         * Scripts/webkit/MessageReceiver-expected.cpp:
2391         * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
2392         * Scripts/webkit/Messages-expected.h:
2393         * Scripts/webkit/MessagesReplies-expected.h: Added.
2394         * Scripts/webkit/MessagesRepliesSuperclassReplies-expected.h: Added.
2395         * Scripts/webkit/MessagesSuperclass-expected.h:
2396         * Scripts/webkit/messages.py:
2397         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2398         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
2399         * UIProcess/Downloads/DownloadProxy.h:
2400         * UIProcess/Network/NetworkProcessProxy.cpp:
2401         * UIProcess/Network/NetworkProcessProxy.h:
2402         * UIProcess/Plugins/PluginProcessManager.cpp:
2403         * UIProcess/Plugins/PluginProcessManager.h:
2404         * UIProcess/Plugins/PluginProcessProxy.h:
2405         * UIProcess/ProvisionalPageProxy.h:
2406         * UIProcess/SuspendedPageProxy.h:
2407         * UIProcess/WebPageProxy.cpp:
2408         * UIProcess/WebPageProxy.h:
2409         * UIProcess/WebProcessPool.cpp:
2410         * UIProcess/WebProcessPool.h:
2411         * UIProcess/WebProcessProxy.h:
2412         * UIProcess/ios/WKContentView.mm:
2413         * UIProcess/ios/WKContentViewInteraction.mm:
2414         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2415         * WebKit.xcodeproj/project.pbxproj:
2416         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2417         * WebProcess/Storage/WebSWContextManagerConnection.h:
2418         * WebProcess/WebPage/WebPage.h:
2419         * WebProcess/WebPage/ios/WebPageIOS.mm:
2420         * WebProcess/cocoa/VideoFullscreenManager.h:
2421         * WebProcess/cocoa/VideoFullscreenManager.mm:
2422
2423 2019-10-22  Chris Dumez  <cdumez@apple.com>
2424
2425         Simplify "Unexpectedly Resumed" assertion handling
2426         https://bugs.webkit.org/show_bug.cgi?id=203254
2427
2428         Reviewed by Geoffrey Garen.
2429
2430         When the WebContent process gets resumed from suspension, it now unconditionally takes a
2431         process assertion on behalf on the UIProcess and sends a ProcessDidResume IPC to the
2432         UIProcess. The UIProcess then sends a DidHandleProcessWasResumed IPC back after handing
2433         the ProcessDidResume IPC allowing the WebContent process to release its assertion on
2434         behalf on the UIProcess.
2435
2436         The previous code was racy because it relied on the m_processIsSuspended flag, which was
2437         queried and set from different threads. Also, the 'unexpectedly resumed' naming was
2438         confusing since we'd often take this assertion whenever the WebProcess got resumed,
2439         wether unexpected or not, simply because the processTaskStateDidChange IPC won the race
2440         with the ProcessDidResume IPC from the UIProcess.
2441
2442         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2443         (WebKit::WebProcessProxy::processWasResumed):
2444         (WebKit::WebProcessProxy::processWasUnexpectedlyUnsuspended): Deleted.
2445         * UIProcess/WebProcessProxy.h:
2446         * UIProcess/WebProcessProxy.messages.in:
2447         * WebProcess/WebProcess.cpp:
2448         (WebKit::WebProcess::processDidResume):
2449         * WebProcess/WebProcess.h:
2450         * WebProcess/WebProcess.messages.in:
2451         * WebProcess/cocoa/WebProcessCocoa.mm:
2452         (WebKit::WebProcess::processTaskStateDidChange):
2453         (WebKit::WebProcess::didHandleProcessWasResumed):
2454
2455 2019-10-22  youenn fablet  <youenn@apple.com>
2456
2457         Remove mayHaveServiceWorkerRegisteredForOrigin
2458         https://bugs.webkit.org/show_bug.cgi?id=203055
2459
2460         Reviewed by Alex Christensen.
2461
2462         This optimization was used for ensuring we would not create a storage process when no service worker registration is stored on disk.
2463         Now that we do not have a storage process and we are doing registration matching direclty in network process, we can safely remove that optimization.
2464         We also move the throttle state handling in WK2 layer. This allows us to not create a network process connection to update throttle state until
2465         there is a network process connection. This allows continuing passing an API test checking network process connections after crashes.
2466
2467         * Shared/WebPageCreationParameters.cpp:
2468         (WebKit::WebPageCreationParameters::encode const):
2469         (WebKit::WebPageCreationParameters::decode):
2470         * Shared/WebPageCreationParameters.h:
2471         * UIProcess/WebPageProxy.cpp:
2472         (WebKit::WebPageProxy::creationParameters):
2473         * UIProcess/WebProcessPool.cpp:
2474         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
2475         (WebKit::WebProcessPool::updateServiceWorkerUserAgent):
2476         * UIProcess/WebProcessPool.h:
2477         * WebProcess/Network/NetworkProcessConnection.h:
2478         * WebProcess/Storage/WebSWClientConnection.h:
2479         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2480         (WebKit::WebServiceWorkerProvider::serviceWorkerConnection):
2481         (WebKit::WebServiceWorkerProvider::updateThrottleState):
2482         * WebProcess/Storage/WebServiceWorkerProvider.h:
2483         * WebProcess/WebPage/WebPage.cpp:
2484         (WebKit::m_textAutoSizingAdjustmentTimer):
2485         (WebKit::WebPage::updateThrottleState):
2486
2487 2019-10-22  Yury Semikhatsky  <yurys@chromium.org>
2488
2489         [GTK] Web Inspector: add an option for disabling minification and concatenation of inspector UI in release build
2490         https://bugs.webkit.org/show_bug.cgi?id=203201
2491
2492         Reviewed by Carlos Garcia Campos.
2493
2494         Allow passing COMBINE_INSPECTOR_RESOURCES and COMBINE_TEST_RESOURCES as cmake arguments. This
2495         enables to avoid minification of Web Inspector scripts in release binaries which is very
2496         convenient during inspector UI development.
2497
2498         * InspectorGResources.cmake:
2499
2500 2019-10-22  Adrian Perez de Castro  <aperez@igalia.com>
2501
2502         [GTK][WPE] Fix non-unified builds after r251326
2503         https://bugs.webkit.org/show_bug.cgi?id=203244
2504
2505         Reviewed by Youenn Fablet.
2506
2507         * Shared/UserData.cpp: Add missing inclusion of WebCoreArgumentCoders.h
2508         * UIProcess/Automation/SimulatedInputDispatcher.cpp: Add missing inclusion of wtf/Variant.h
2509         * UIProcess/ProvisionalPageProxy.h: Add missing inclusion of WebCore/ResourceRequest.h
2510         * UIProcess/WebTextChecker.cpp: Add missing inclusion of WebPageProxy.h
2511         * WebProcess/Databases/WebDatabaseProvider.cpp: Add missing inclusion of WebIDBConnectionToServer.h
2512
2513 2019-10-22  youenn fablet  <youenn@apple.com>
2514
2515         WebSWServerToContextConnection should not assert when failing loads at destruction time
2516         https://bugs.webkit.org/show_bug.cgi?id=203243
2517
2518         Reviewed by Alex Christensen.
2519
2520         On WebSWServerToContextConnection destruction, we move the fetch task map and fail the tasks.
2521         At destruction of the tasks, which happens synchronously, they will try to unregister themselves
2522         and the assertion that the task is in the map will fail.
2523         To fix that, add a specific contextClosed method that will clear the task connection weak pointer.
2524
2525         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
2526         (WebKit::ServiceWorkerFetchTask::contextClosed):
2527         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
2528         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2529         (WebKit::WebSWServerToContextConnection::~WebSWServerToContextConnection):
2530
2531 2019-10-22  youenn fablet  <youenn@apple.com>
2532
2533         ServiceWorkerFetchTask can use the NetworkConnectionToWebProcess sessionID
2534         https://bugs.webkit.org/show_bug.cgi?id=202208
2535
2536         Reviewed by Alex Christensen.
2537
2538         No need to store the sessionID in ServiceWorkerFetchTask since we can get it from its loader.
2539
2540         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
2541         (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):
2542         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
2543         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
2544         (WebKit::WebSWServerConnection::createFetchTask):
2545
2546 2019-10-22  youenn fablet  <youenn@apple.com>
2547
2548         Remove the ability to fallback to custom scheme handlers after a service worker did not handle the load
2549         https://bugs.webkit.org/show_bug.cgi?id=203239
2550
2551         Reviewed by Alex Christensen.
2552
2553         We remove the ability for service workers to intercept custom scheme handlers.
2554         We can then remove the ability for loads that are not handled by service workers to go through custom scheme handlers.
2555
2556         * WebProcess/Network/WebLoaderStrategy.cpp:
2557         (WebKit::WebLoaderStrategy::scheduleLoad):
2558         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2559         * WebProcess/Network/WebResourceLoader.cpp:
2560         (WebKit::WebResourceLoader::serviceWorkerDidNotHandle):
2561
2562 2019-10-22  Carlos Garcia Campos  <cgarcia@igalia.com>
2563
2564         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.27.2 release
2565
2566         * gtk/NEWS: Add release notes for 2.27.2.
2567
2568 2019-10-21  Yusuke Suzuki  <ysuzuki@apple.com>
2569
2570         [JSC] Thread JSGlobalObject* instead of ExecState*
2571         https://bugs.webkit.org/show_bug.cgi?id=202392
2572
2573         Reviewed by Geoffrey Garen.
2574
2575         * WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp:
2576         (webkit_frame_get_js_value_for_dom_object_in_script_world):
2577         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2578         (WebKit::InjectedBundle::reportException):
2579         (WebKit::InjectedBundle::createWebDataFromUint8Array):
2580         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
2581         (WebKit::callMethod):
2582         * WebProcess/Plugins/Netscape/JSNPMethod.h:
2583         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
2584         (WebKit::JSNPObject::callMethod):
2585         (WebKit::JSNPObject::callObject):
2586         (WebKit::JSNPObject::callConstructor):
2587         (WebKit::callNPJSObject):
2588         (WebKit::constructWithConstructor):
2589         (WebKit::JSNPObject::getOwnPropertySlot):
2590         (WebKit::JSNPObject::put):
2591         (WebKit::JSNPObject::deleteProperty):
2592         (WebKit::JSNPObject::deletePropertyByIndex):
2593         (WebKit::JSNPObject::getOwnPropertyNames):
2594         (WebKit::JSNPObject::propertyGetter):
2595         (WebKit::JSNPObject::methodGetter):
2596         (WebKit::JSNPObject::throwInvalidAccessError):
2597         * WebProcess/Plugins/Netscape/JSNPObject.h:
2598         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
2599         (WebKit::identifierFromIdentifierRep):
2600         (WebKit::NPJSObject::hasMethod):
2601         (WebKit::NPJSObject::invoke):
2602         (WebKit::NPJSObject::invokeDefault):
2603         (WebKit::NPJSObject::hasProperty):
2604         (WebKit::NPJSObject::getProperty):
2605         (WebKit::NPJSObject::setProperty):
2606         (WebKit::NPJSObject::removeProperty):
2607         (WebKit::NPJSObject::enumerate):
2608         (WebKit::NPJSObject::construct):
2609         * WebProcess/Plugins/Netscape/NPJSObject.h:
2610         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
2611         (WebKit::NPRuntimeObjectMap::convertNPVariantToJSValue):
2612         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
2613         (WebKit::NPRuntimeObjectMap::evaluate):
2614         (WebKit::NPRuntimeObjectMap::moveGlobalExceptionToExecState):
2615         (WebKit::NPRuntimeObjectMap::globalExec const): Deleted.
2616         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h:
2617         * WebProcess/Plugins/PluginView.cpp:
2618         (WebKit::PluginView::performJavaScriptURLRequest):
2619         * WebProcess/WebPage/WebFrame.cpp:
2620         (WebKit::WebFrame::jsContext):
2621         (WebKit::WebFrame::jsContextForWorld):
2622         (WebKit::WebFrame::frameForContext):
2623         (WebKit::WebFrame::jsWrapperForWorld):
2624         * WebProcess/WebPage/WebPage.cpp:
2625         (WebKit::WebPage::freezeLayerTree):
2626         (WebKit::WebPage::unfreezeLayerTree):
2627         (WebKit::WebPage::runJavaScript):
2628         * WebProcess/WebProcess.cpp:
2629         (WebKit::WebProcess::networkProcessConnectionClosed):
2630
2631 2019-10-22  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2632
2633         [GTK][WPE] Enable service workers by default
2634         https://bugs.webkit.org/show_bug.cgi?id=200815
2635
2636         Reviewed by Carlos Garcia Campos.
2637
2638         Flip the run-time switch to be enabled by default and not only
2639         when building with experimental features enabled.
2640
2641         * Shared/WebPreferencesDefaultValues.h:
2642
2643 2019-10-22  Carlos Garcia Campos  <cgarcia@igalia.com>
2644
2645         [GTK] C++ comments used in C header files
2646         https://bugs.webkit.org/show_bug.cgi?id=203191
2647
2648         Reviewed by Žan Doberšek.
2649
2650         * UIProcess/API/gtk/WebKitAutocleanups.h:
2651         * UIProcess/API/gtk/WebKitDefines.h:
2652         * UIProcess/API/gtk/WebKitForwardDeclarations.h:
2653         * UIProcess/API/gtk/WebKitWebViewBase.h:
2654         * UIProcess/API/wpe/WebKitAutocleanups.h:
2655         * UIProcess/API/wpe/WebKitDefines.h:
2656         * WebProcess/InjectedBundle/API/gtk/WebKitWebEditor.h:
2657         * WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionAutocleanups.h:
2658         * WebProcess/InjectedBundle/API/wpe/WebKitWebEditor.h:
2659         * WebProcess/InjectedBundle/API/wpe/WebKitWebExtensionAutocleanups.h:
2660
2661 2019-10-22  Wenson Hsieh  <wenson_hsieh@apple.com>
2662
2663         imported/w3c/web-platform-tests/clipboard-apis/async-navigator-clipboard-basics.https.html is flaky
2664         https://bugs.webkit.org/show_bug.cgi?id=203181
2665
2666         Reviewed by Ryosuke Niwa.
2667
2668         Add a changeCount argument to informationForItemAtIndex and allPasteboardItemInfo, and also make then return
2669         optional values; also, adjust changeCount to be an `int64_t` in a few places. See WebCore ChangeLog for more
2670         details.
2671
2672         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
2673         (WebKit::WebPasteboardProxy::pasteboardCopy):
2674         (WebKit::WebPasteboardProxy::getPasteboardChangeCount):
2675         (WebKit::WebPasteboardProxy::addPasteboardTypes):
2676         (WebKit::WebPasteboardProxy::setPasteboardTypes):
2677         (WebKit::WebPasteboardProxy::setPasteboardURL):
2678         (WebKit::WebPasteboardProxy::setPasteboardColor):
2679         (WebKit::WebPasteboardProxy::setPasteboardStringForType):
2680         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
2681         (WebKit::WebPasteboardProxy::writeCustomData):
2682         (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
2683         (WebKit::WebPasteboardProxy::informationForItemAtIndex):
2684         * UIProcess/WebPasteboardProxy.cpp:
2685         (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
2686         (WebKit::WebPasteboardProxy::informationForItemAtIndex):
2687         * UIProcess/WebPasteboardProxy.h:
2688         * UIProcess/WebPasteboardProxy.messages.in:
2689         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2690         (WebKit::PDFPlugin::writeItemsToPasteboard):
2691         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2692         (WebKit::WebPlatformStrategies::changeCount):
2693         (WebKit::WebPlatformStrategies::addTypes):
2694         (WebKit::WebPlatformStrategies::setTypes):
2695         (WebKit::WebPlatformStrategies::setBufferForType):
2696         (WebKit::WebPlatformStrategies::setURL):
2697         (WebKit::WebPlatformStrategies::setColor):
2698         (WebKit::WebPlatformStrategies::setStringForType):
2699         (WebKit::WebPlatformStrategies::writeCustomData):
2700         (WebKit::WebPlatformStrategies::allPasteboardItemInfo):
2701         (WebKit::WebPlatformStrategies::informationForItemAtIndex):
2702         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
2703
2704 2019-10-21  Daniel Bates  <dabates@apple.com>
2705
2706         Add some PencilKit extension points
2707         https://bugs.webkit.org/show_bug.cgi?id=202962
2708         <rdar://problem/56269759>
2709
2710         Reviewed by Andy Estes.
2711
2712         This is the WebKit part corresponding to <rdar://problem/56261392>.
2713
2714         * UIProcess/ios/WKContentViewInteraction.mm:
2715         (-[WKContentView setupInteraction]): Call extension point.
2716         (-[WKContentView cleanupInteraction]): Ditto.
2717
2718 2019-10-21  Matt Lewis  <jlewis3@apple.com>
2719
2720         Unreviewed, rolling out r251381.
2721
2722         This broke an internal build.
2723
2724         Reverted changeset:
2725
2726         "Add some PencilKit extension points"
2727         https://bugs.webkit.org/show_bug.cgi?id=202962
2728         https://trac.webkit.org/changeset/251381
2729
2730 2019-10-21  Myles C. Maxfield  <mmaxfield@apple.com>
2731
2732         [Cocoa] Move ui-serif, ui-monospaced, and ui-rounded out from behind SPI
2733         https://bugs.webkit.org/show_bug.cgi?id=203129
2734
2735         Reviewed by Tim Horton.
2736
2737         * Shared/WebPreferences.yaml:
2738         * UIProcess/API/Cocoa/WKPreferences.mm:
2739         (-[WKPreferences _shouldAllowDesignSystemUIFonts]): Deleted.
2740         (-[WKPreferences _setShouldAllowDesignSystemUIFonts:]): Deleted.
2741         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2742
2743 2019-10-21  youenn fablet  <youenn@apple.com>
2744
2745         Move service worker registration matching for navigation loads to network process
2746         https://bugs.webkit.org/show_bug.cgi?id=203144
2747
2748         Reviewed by Chris Dumez.
2749
2750         Create a WebSWServerConnection whenever receiving a load request in NetworkProcess.
2751         This connection is used to check for service worker registration in case of navigation loads.
2752         Similarly, we create a WebSWClientConnection whenever WebProcess needs it, including when receiving WebSWClientConnection messages from NetworkProcess.
2753         This for instance happens when service worker registration import is complete to fill the shared registration origin store.
2754
2755         Delay loads until SWServer has finished importing its registrations.
2756         This is needed since we might otherwise not intercept loads that could be intercepted.
2757         Waiting for importing registrations was previously ensured by WebProcess getting a matching registration in DocumentLoader.
2758
2759         NetworkResourceLoader is now checking for service worker interception in case of redirections for navigations.
2760         This is needed as redirections could end up using a new registration.
2761
2762         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2763         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
2764         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
2765         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
2766         (WebKit::NetworkConnectionToWebProcess::swConnection):
2767         * NetworkProcess/NetworkConnectionToWebProcess.h:
2768         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2769         * NetworkProcess/NetworkResourceLoader.cpp:
2770         (WebKit::NetworkResourceLoader::continueWillSendRequest):
2771         (WebKit::NetworkResourceLoader::startWithServiceWorker):
2772         (WebKit::NetworkResourceLoader::serviceWorkerDidNotHandle):
2773         * NetworkProcess/NetworkResourceLoader.h:
2774         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
2775         (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):
2776         (WebKit::ServiceWorkerFetchTask::start):
2777         (WebKit::ServiceWorkerFetchTask::startFetch):
2778         (WebKit::ServiceWorkerFetchTask::continueFetchTaskWith):
2779         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
2780         (WebKit::ServiceWorkerFetchTask::takeRequest):
2781         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
2782         (WebKit::WebSWServerConnection::controlClient):
2783         (WebKit::WebSWServerConnection::createFetchTask):
2784         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
2785         * WebProcess/Network/NetworkProcessConnection.cpp:
2786         (WebKit::NetworkProcessConnection::didReceiveMessage):
2787         * WebProcess/Network/WebLoaderStrategy.cpp:
2788         (WebKit::WebLoaderStrategy::scheduleLoad):
2789         * WebProcess/Storage/WebSWClientConnection.cpp:
2790         (WebKit::WebSWClientConnection::WebSWClientConnection):
2791         (WebKit::WebSWClientConnection::registrationReady):
2792         (WebKit::WebSWClientConnection::documentIsControlled):
2793         * WebProcess/Storage/WebSWClientConnection.h:
2794         * WebProcess/Storage/WebSWClientConnection.messages.in:
2795
2796 2019-10-21  Sihui Liu  <sihui_liu@apple.com>
2797
2798         Remove IDBBackingStoreTemporaryFileHandler
2799         https://bugs.webkit.org/show_bug.cgi?id=203128
2800
2801         Reviewed by Alex Christensen.
2802
2803         * NetworkProcess/NetworkProcess.cpp:
2804         (WebKit::NetworkProcess::createIDBServer):
2805         (WebKit::NetworkProcess::accessToTemporaryFileComplete): Deleted.
2806         * NetworkProcess/NetworkProcess.h:
2807
2808 2019-10-21  John Wilander  <wilander@apple.com>
2809
2810         Resource Load Statistics: Update cookie blocking in NetworkStorageSession after first user interaction
2811         https://bugs.webkit.org/show_bug.cgi?id=203195
2812         <rdar://problem/56464567>
2813
2814         Reviewed by Alex Christensen and Chris Dumez.
2815
2816         This change makes sure that the state of cookie blocking in
2817         WebCore:: NetworkStorageSession is immediately updated if the logged
2818         user interaction was new for this domain. It adds a completion
2819         handler to WebResourceLoadStatisticsStore::logUserInteraction() so
2820         that the call properly waits for everything to be updated.
2821
2822         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2823         (WebKit::CompletionHandler<void):
2824         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
2825         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2826         (WebKit::ResourceLoadStatisticsMemoryStore::logUserInteraction):
2827         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
2828         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
2829         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2830         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
2831
2832 2019-10-21  Dean Jackson  <dino@apple.com>
2833
2834         Dispatch AR event on the originating anchor element
2835         https://bugs.webkit.org/show_bug.cgi?id=203198
2836         <rdar://55743929>
2837
2838         Reviewed by Simon Fraser.
2839
2840         Use the ElementContext on SystemPreviewInfo.
2841
2842         * UIProcess/API/Cocoa/WKWebView.mm:
2843         (-[WKWebView _triggerSystemPreviewActionOnElement:frame:page:]):
2844         (-[WKWebView _triggerSystemPreviewActionOnFrame:page:]): Deleted.
2845         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2846         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2847         * UIProcess/SystemPreviewController.h:
2848         * WebProcess/WebPage/WebPage.cpp:
2849         (WebKit::WebPage::systemPreviewActionTriggered):
2850
2851 2019-10-21  Dean Jackson  <dino@apple.com>
2852
2853         Move ElementContext from WebKit to WebCore
2854         https://bugs.webkit.org/show_bug.cgi?id=203210
2855         <rdar://problem/56475682>
2856
2857         Reviewed by Simon Fraser.
2858
2859         * Scripts/webkit/messages.py:
2860         * Shared/DocumentEditingContext.h:
2861         * Shared/DocumentEditingContext.mm:
2862         (IPC::ArgumentCoder<WebKit::DocumentEditingContextRequest>::decode):
2863         * Shared/ElementContext.cpp: Removed.
2864         * Shared/ElementContext.h: Removed.
2865         * Shared/WebPreferencesDefaultValues.cpp:
2866         (WebKit::defaultCSSOMViewScrollingAPIEnabled):
2867         * Shared/WebsitePoliciesData.cpp:
2868         (WebKit::WebsitePoliciesData::decode):
2869         * Shared/ios/InteractionInformationAtPosition.h:
2870         * Sources.txt:
2871         * UIProcess/API/Cocoa/WKWebView.mm:
2872         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
2873         * UIProcess/API/Cocoa/_WKTextInputContext.mm:
2874         (-[_WKTextInputContext _initWithTextInputContext:]):
2875         (-[_WKTextInputContext _textInputContext]):
2876         * UIProcess/API/Cocoa/_WKTextInputContextInternal.h:
2877         * UIProcess/WebPageProxy.cpp:
2878         (WebKit::WebPageProxy::textInputContextsInRect):
2879         (WebKit::WebPageProxy::focusTextInputContext):
2880         * UIProcess/WebPageProxy.h:
2881         * WebKit.xcodeproj/project.pbxproj:
2882         * WebProcess/WebPage/WebPage.cpp:
2883         (WebKit::WebPage::textInputContextsInRect):
2884         (WebKit::WebPage::focusTextInputContext):
2885         (WebKit::WebPage::elementForContext const):
2886         (WebKit::WebPage::contextForElement const):
2887         * WebProcess/WebPage/WebPage.h:
2888         * WebProcess/WebPage/WebPage.messages.in:
2889         * WebProcess/WebPage/ios/WebPageIOS.mm:
2890         (WebKit::WebPage::startInteractionWithElementContextOrPosition):
2891
2892 2019-10-21  Alex Christensen  <achristensen@webkit.org>
2893
2894         ServiceWorker tests should use TCPServer instead of WKURLSchemeHandler
2895         https://bugs.webkit.org/show_bug.cgi?id=203141
2896
2897         Reviewed by Youenn Fablet.
2898
2899         * NetworkProcess/NetworkProcess.cpp:
2900         (WebKit::NetworkProcess::initializeNetworkProcess):
2901         (WebKit::NetworkProcess::addWebsiteDataStore):
2902         (WebKit::NetworkProcess::swServerForSession):
2903         (WebKit::NetworkProcess::addServiceWorkerSession):
2904         * NetworkProcess/NetworkProcess.h:
2905         * Shared/WebsiteDataStoreParameters.cpp:
2906         (WebKit::WebsiteDataStoreParameters::encode const):
2907         (WebKit::WebsiteDataStoreParameters::decode):
2908         * Shared/WebsiteDataStoreParameters.h:
2909         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2910         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
2911         (-[_WKWebsiteDataStoreConfiguration registerURLSchemeServiceWorkersCanHandleForTesting:]): Deleted.
2912         * UIProcess/WebProcessPool.cpp:
2913         (WebKit::WebProcessPool::initializeNewWebProcess):
2914         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2915         (WebKit::WebsiteDataStore::parameters):
2916         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
2917         (WebKit::WebsiteDataStoreConfiguration::copy):
2918         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
2919         (WebKit::WebsiteDataStoreConfiguration::serviceWorkerRegisteredSchemes const): Deleted.
2920         (WebKit::WebsiteDataStoreConfiguration::registerServiceWorkerScheme): Deleted.
2921
2922 2019-10-21  Tim Horton  <timothy_horton@apple.com>
2923
2924         macCatalyst: Swipe navigation gestures do not work
2925         https://bugs.webkit.org/show_bug.cgi?id=203205
2926         <rdar://problem/54617473>
2927
2928         Reviewed by Wenson Hsieh.
2929
2930         * UIProcess/ios/ViewGestureControllerIOS.mm:
2931         (-[WKSwipeTransitionController gestureRecognizerForInteractiveTransition:WithTarget:action:]):
2932         Use a different gesture recognizer for swipe in macCatalyst that behaves
2933         more like the macOS implementation, based on scrolling instead of the
2934         gesture coming from a screen edge.
2935
2936 2019-10-21  Daniel Bates  <dabates@apple.com>
2937
2938         Add some PencilKit extension points
2939         https://bugs.webkit.org/show_bug.cgi?id=202962
2940         <rdar://problem/56269759>
2941
2942         Reviewed by Andy Estes.
2943
2944         This is the WebKit part corresponding to <rdar://problem/56261392>.
2945
2946         * UIProcess/ios/WKContentViewInteraction.mm:
2947         (-[WKContentView setupInteraction]): Call extension point.
2948         (-[WKContentView cleanupInteraction]): Ditto.
2949
2950 2019-10-21  Chris Dumez  <cdumez@apple.com>
2951
2952         Add more release logging for "Unexpectedly resumed" assertion
2953         https://bugs.webkit.org/show_bug.cgi?id=203196
2954
2955         Reviewed by Geoffrey Garen.
2956
2957         * WebProcess/WebProcess.cpp:
2958         (WebKit::WebProcess::processDidResume):
2959         * WebProcess/cocoa/WebProcessCocoa.mm:
2960         (WebKit::WebProcess::processTaskStateDidChange):
2961
2962 2019-10-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2963
2964         [GTK] Objects category in emoji picker is empty
2965         https://bugs.webkit.org/show_bug.cgi?id=203189
2966
2967         Reviewed by Adrian Perez de Castro.
2968
2969         There's a typo in the first emopi name of objects section.
2970
2971         * UIProcess/API/gtk/WebKitEmojiChooser.cpp:
2972         (webkitEmojiChooserSetupEmojiSections): uted speaker -> muted speaker
2973
2974 2019-10-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2975
2976         [GTK][WPE] IconDatabase is not thread safe yet
2977         https://bugs.webkit.org/show_bug.cgi?id=202980
2978
2979         Reviewed by Adrian Perez de Castro.
2980
2981         Current implementation is safer, but we still need to protect members used by both threads.
2982
2983         * UIProcess/API/glib/IconDatabase.cpp:
2984         (WebKit::IconDatabase::populatePageURLToIconURLMap):
2985         (WebKit::IconDatabase::clearLoadedIconsTimerFired):
2986         (WebKit::IconDatabase::checkIconURLAndSetPageURLIfNeeded):
2987         (WebKit::IconDatabase::loadIconForPageURL):
2988         (WebKit::IconDatabase::iconURLForPageURL):
2989         (WebKit::IconDatabase::setIconForPageURL):
2990         (WebKit::IconDatabase::clear):
2991         * UIProcess/API/glib/IconDatabase.h:
2992
2993 2019-10-21  Tim Horton  <timothy_horton@apple.com>
2994
2995         Clean up some includes to improve WebKit2 build speed
2996         https://bugs.webkit.org/show_bug.cgi?id=203071
2997
2998         Reviewed by Wenson Hsieh.
2999
3000         This is worth about 6% on WebKit2, and unlocks another 8% improvement
3001         down the line (but which is less mechanical).
3002
3003         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
3004         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3005         * NetworkProcess/NetworkSocketChannel.h:
3006         * NetworkProcess/WebStorage/StorageArea.h:
3007         * NetworkProcess/WebStorage/StorageManager.cpp:
3008         * NetworkProcess/WebStorage/StorageManagerSet.cpp:
3009         * Platform/IPC/Connection.h:
3010         * Shared/API/APIURL.h:
3011         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
3012         * Shared/WebCoreArgumentCoders.cpp:
3013         * Shared/WebCoreArgumentCoders.h:
3014         * UIProcess/API/APIAttachment.h:
3015         * UIProcess/API/Cocoa/_WKInspector.mm:
3016         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
3017         * UIProcess/TextCheckerCompletion.cpp:
3018         * UIProcess/TextCheckerCompletion.h:
3019         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
3020         (WebKit::WebUserContentControllerProxy::addNetworkProcess):
3021         (WebKit::WebUserContentControllerProxy::removeNetworkProcess):
3022         * UIProcess/UserContent/WebUserContentControllerProxy.h:
3023         (WebKit::WebUserContentControllerProxy::addNetworkProcess): Deleted.
3024         (WebKit::WebUserContentControllerProxy::removeNetworkProcess): Deleted.
3025         * WebProcess/Automation/WebAutomationSessionProxy.h:
3026         * WebProcess/Network/NetworkProcessConnection.cpp:
3027         * WebProcess/Network/NetworkProcessConnection.h:
3028         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
3029         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3030         * WebProcess/Plugins/Plugin.cpp:
3031         * WebProcess/Plugins/Plugin.h:
3032         * WebProcess/WebProcess.cpp:
3033
3034 2019-10-20  Brent Fulgham  <bfulgham@apple.com>
3035
3036         Improve serialization logic
3037         https://bugs.webkit.org/show_bug.cgi?id=203039
3038         <rdar://problem/55631691>
3039
3040         Reviewed by Alex Christensen.
3041
3042         Check that the SecItemRequestData only contains relevant types for
3043         CFNetwork uses. 
3044
3045         * Platform/spi/Cocoa/SecItemSPI.h: Added.
3046         * Shared/mac/SecItemRequestData.cpp:
3047         (WebKit::arrayContainsInvalidType): Added.
3048         (WebKit::dictionaryContainsInvalidType): Added.
3049         (WebKit::validTypeIDs): Added.
3050         (WebKit::isValidType): Added.
3051         (WebKit::SecItemRequestData::decode): Check types during decode.
3052         * Shared/mac/SecItemRequestData.h:
3053         * WebKit.xcodeproj/project.pbxproj:
3054
3055 2019-10-19  Adrian Perez de Castro  <aperez@igalia.com>
3056
3057         [GTK][WPE] Fix non-unified builds after r250857
3058         https://bugs.webkit.org/show_bug.cgi?id=203145
3059
3060         Reviewed by Carlos Garcia Campos.
3061
3062         * UIProcess/WebProcessProxy.cpp: Add missing inclusion of the WebBackForwardCache.h header.
3063
3064 2019-10-18  Tim Horton  <timothy_horton@apple.com>
3065
3066         macCatalyst: Cursor should send mouse events, not touch events
3067         https://bugs.webkit.org/show_bug.cgi?id=203175
3068         <rdar://problem/56321134>
3069
3070         Reviewed by Simon Fraser.
3071
3072         * Platform/spi/ios/UIKitSPI.h:
3073         * Shared/NativeWebMouseEvent.h:
3074         * Shared/ios/NativeWebMouseEventIOS.mm:
3075         (WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
3076         Add a NativeWebMouseEvent constructor that doesn't actually wrap a native event,
3077         for creating totally-synthetic events.
3078
3079         * UIProcess/ios/WKMouseGestureRecognizer.h: Added.
3080         * UIProcess/ios/WKMouseGestureRecognizer.mm: Added.
3081         (webEventModifiersForUIKeyModifierFlags):
3082         (-[WKMouseGestureRecognizer initWithTarget:action:]):
3083         (-[WKMouseGestureRecognizer setView:]):
3084         (-[WKMouseGestureRecognizer lastMouseEvent]):
3085         (-[WKMouseGestureRecognizer lastMouseLocation]):
3086         (-[WKMouseGestureRecognizer mouseTouch]):
3087         (-[WKMouseGestureRecognizer _wantsHoverEvents]):
3088         (-[WKMouseGestureRecognizer reset]):
3089         (-[WKMouseGestureRecognizer _shouldReceiveTouch:forEvent:recognizerView:]):
3090         (-[WKMouseGestureRecognizer _shouldReceivePress:]):
3091         (-[WKMouseGestureRecognizer createMouseEventWithType:]):
3092         (-[WKMouseGestureRecognizer touchesBegan:withEvent:]):
3093         (-[WKMouseGestureRecognizer touchesMoved:withEvent:]):
3094         (-[WKMouseGestureRecognizer touchesEnded:withEvent:]):
3095         (-[WKMouseGestureRecognizer touchesCancelled:withEvent:]):
3096         (-[WKMouseGestureRecognizer _hoverEntered:withEvent:]):
3097         (-[WKMouseGestureRecognizer _hoverMoved:withEvent:]):
3098         (-[WKMouseGestureRecognizer _hoverExited:withEvent:]):
3099         (-[WKMouseGestureRecognizer _hoverCancelled:withEvent:]):
3100         (-[WKMouseGestureRecognizer locationInView:]):
3101         (-[WKMouseGestureRecognizer canPreventGestureRecognizer:]):
3102         (-[WKMouseGestureRecognizer canBePreventedByGestureRecognizer:]):
3103         Instead of just using UIHoverGestureRecognizer, introduce a new gesture
3104         recognizer that does what it did, but also supports cases where the button
3105         is pressed (so, mousedown and mouseup instead of just mousemove),
3106         and synthesizes mouse events for all state transitions. These events
3107         should look roughly identical to what a non-macCatalyst app would get
3108         in AppKit's mouseUp/mouseDown/mouseMoved NSResponder methods.
3109
3110         * SourcesCocoa.txt:
3111         * UIProcess/ios/WKContentViewInteraction.h:
3112         * UIProcess/ios/WKContentViewInteraction.mm:
3113         (-[WKContentView setupInteraction]):
3114         (-[WKContentView cleanupInteraction]):
3115         (-[WKContentView _removeDefaultGestureRecognizers]):
3116         (-[WKContentView _addDefaultGestureRecognizers]):
3117         (-[WKContentView gestureRecognizer:shouldReceiveTouch:]):
3118         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
3119         (-[WKContentView _showShareSheet:inRect:completionHandler:]):
3120         (-[WKContentView _mouseGestureRecognizerChanged:]):
3121         (webEventFlagsForUIKeyModifierFlags): Deleted.
3122         (-[WKContentView _hoverGestureRecognizerChanged:]): Deleted.
3123         * WebKit.xcodeproj/project.pbxproj:
3124         Make use of WKMouseGestureRecognizer to plumb the synthesized events directly
3125         to the macOS-style "handleMouseEvent" codepath, instead of going through
3126         the touch events path (and then subsequently generating synthetic clicks).
3127         Also, ensure that other gesture recognizers ignore the mouse "touch" entirely
3128         by returning NO in shouldReceiveTouch.
3129
3130 2019-10-18  Jiewen Tan  <jiewen_tan@apple.com>
3131
3132         [WebAuthn] Warn users when no credentials are found
3133         https://bugs.webkit.org/show_bug.cgi?id=203147
3134         <rdar://problem/55931123>
3135
3136         Reviewed by Brent Fulgham.
3137
3138         This patch returns _WKWebAuthenticationPanelUpdateNoCredentialsFound to client via
3139         -[_WKWebAuthenticationPanelDelegate panel:updateWebAuthenticationPanel:] when either
3140         CtapAuthenticator receives kCtap2ErrNoCredentials or U2fAuthenticator exhausts the
3141         allow list.
3142
3143         This patch also enhances CtapAuthenticator::tryDowngrade to check if the CTAP command
3144         can be converted to U2F commands to ensure kCtap2ErrNoCredentials is returned if it
3145         is the case. Otherwise, after downgrading, U2fAuthenticator will return NotSupportedError
3146         given it can't convert the commands.
3147
3148         * UIProcess/API/APIUIClient.h:
3149         * UIProcess/API/APIWebAuthenticationPanelClient.h:
3150         (API::WebAuthenticationPanelClient::updatePanel const):
3151         * UIProcess/WebAuthentication/Authenticator.h:
3152         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
3153         (WebKit::AuthenticatorManager::authenticatorStatusUpdated):
3154         * UIProcess/WebAuthentication/AuthenticatorManager.h:
3155         * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h:
3156         * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm:
3157         (WebKit::WebAuthenticationPanelClient::WebAuthenticationPanelClient):
3158         (WebKit::wkWebAuthenticationPanelUpdate):
3159         (WebKit::WebAuthenticationPanelClient::updatePanel const):
3160         * UIProcess/WebAuthentication/WebAuthenticationFlags.h: Renamed from Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationPanelFlags.h.
3161         * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
3162         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
3163         * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
3164         (WebKit::CtapAuthenticator::continueGetAssertionAfterResponseReceived):
3165         (WebKit::CtapAuthenticator::tryDowngrade):
3166         * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
3167         (WebKit::U2fAuthenticator::issueSignCommand):
3168         * WebKit.xcodeproj/project.pbxproj:
3169
3170 2019-10-18  Wenson Hsieh  <wenson_hsieh@apple.com>
3171
3172         [Clipboard API] Refactor Pasteboard::read() to take an optional item index
3173         https://bugs.webkit.org/show_bug.cgi?id=203161
3174
3175         Reviewed by Tim Horton.
3176
3177         * Shared/mac/PasteboardTypes.mm:
3178         (WebKit::PasteboardTypes::forEditing):
3179         (WebKit::PasteboardTypes::forSelection):
3180
3181         Support "com.apple.webarchive" alongside the private "Apple Web Archive pasteboard type".
3182
3183         * UIProcess/Cocoa/WebViewImpl.mm:
3184         (WebKit::WebViewImpl::setPromisedDataForImage):
3185
3186 2019-10-18  Ryosuke Niwa  <rniwa@webkit.org>
3187
3188         [iOS] REGRESSION(r251269): fast/events/ios/rotation/do-not-shrink-to-fit-content-after-rotation.html and fast/events/ios/rotation/layout-viewport-during-safari-type-rotation.html fail
3189         https://bugs.webkit.org/show_bug.cgi?id=203162
3190         <rdar://problem/56418459>
3191
3192         Reviewed by Simon Fraser.
3193
3194         Synchronously update the rendering before the orientation change and other viewport size updates.
3195
3196         Otherwise, resize event will be dispatched in the middle of orientation animation,
3197         and would result in non-determistic results.
3198
3199         * WebProcess/WebPage/ios/WebPageIOS.mm:
3200         (WebKit::WebPage::dynamicViewportSizeUpdate):
3201
3202 2019-10-18  Chris Dumez  <cdumez@apple.com>
3203
3204         [iOS] "Unexpectedly Resumed" process assertion may cause us to get terminated
3205         https://bugs.webkit.org/show_bug.cgi?id=203046
3206         <rdar://problem/56179592>
3207
3208         Reviewed by Geoffrey Garen.
3209
3210         This patch implements the following to avoid getting terminated:
3211         1. Schedule the task to release the assertion on a background thread instead of
3212            the main thread so that we end up releasing the task even if the main thread
3213            is somehow hung.
3214         2. Add an invalidation handler to the process assertion which releases the assertion
3215            upon expiration.
3216
3217         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
3218         (WebKit::WebProcessProxy::processWasUnexpectedlyUnsuspended):
3219         * WebProcess/WebProcess.cpp:
3220         (WebKit::WebProcess::processDidResume):
3221         * WebProcess/WebProcess.h:
3222         * WebProcess/cocoa/WebProcessCocoa.mm:
3223         (WebKit::WebProcess::processTaskStateDidChange):
3224
3225 2019-10-18  Jer Noble  <jer.noble@apple.com>
3226
3227         Add experimental HDR MediaCapabilities support.
3228         https://bugs.webkit.org/show_bug.cgi?id=203113
3229
3230         Reviewed by Eric Carlson.
3231
3232         Add experimental hdrMediaCapabilitiesEnabled preference.
3233
3234         * Shared/WebPreferences.yaml:
3235
3236 2019-10-18  Jiewen Tan  <jiewen_tan@apple.com>
3237
3238         [WebAuthn] Implement AuthenticatorCancel
3239         https://bugs.webkit.org/show_bug.cgi?id=191523
3240         <rdar://problem/55920204>
3241
3242         Reviewed by Brent Fulgham.
3243
3244         This patch implement two ways to cancel a pending WebAuthn ceremony:
3245         1) Via navigation activities. Activities include i) main frame navigation, ii) main frame reload,
3246         iii) main frame destruction, iv) sub frame navigation, and v) sub frame destruction. All the above
3247         activities will cancel any pending WebAuthn ceremony that is associated with the frame. To prove
3248         the association, a GlobalFrameIdentifier is bridged into WebAuthenticationRequestData. Navigation
3249         cancel is done in WebPageProxy::didStartProvisionalLoadForFrameShared, and destruction cancel is done
3250         in WebProcessProxy::didDestroyFrame and WebPageProxy::resetState.
3251         2) Via UI. This path is simply bridged -[_WKWebAuthenticationPanel cancel] into AuthenticatorManager.
3252         Noted, this patch follows the spec to wait until time out to notify RPs.
3253         References: i) Step 20 of https://www.w3.org/TR/webauthn/#createCredential, ii) Step 18 of
3254         https://www.w3.org/TR/webauthn/#getAssertion
3255
3256         As for what the cancel actually does, it:
3257         1) stops any HID/NFC scanning;
3258         2) sends CTAPHID_CANCEL to any HID authenticators that have been added. Reference:
3259         https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#usb-hid-cancel
3260         Sending CTAPHID_CANCEL, however, is not trivial. An abstract class FidoAuthenticator is crafted to
3261         do this labor for both CtapAuthenticator and U2fAuthenticator during the time of destructions.
3262         Noted: The CtapHidDriver is the only CtapDriver implements the cancel method. Since the message
3263         is sent during state reset, lifecycle of the HidConenction and HidService which manage the underlying
3264         IOHIDDeviceRef is very hard to hold. This is required for the regular async sender. Therefore,
3265         HidConnection::sendSync is crafted to send the message synchronously to get rid of the tediousness
3266         of managing those lifecycles.
3267
3268         P.S. Vector::grow doesn't initialize POD types. Therefore, this patch also appends it with memset
3269         for FidoHidPacket.
3270
3271         P.S.S. This patch also simplifies AuthenticatorCoordinatorClient by: i) moving code from AuthenticatorCoordinatorClient
3272         to WebAuthenticatorCoordinatorClient, and ii) using sendWithAsyncReply. The latter allows us to
3273         get rid of the complex mechanism of ensuring the right reply is returned.
3274
3275         * DerivedSources.make:
3276         * Sources.txt:
3277         * UIProcess/API/APIWebAuthenticationPanel.cpp:
3278         (API::WebAuthenticationPanel::create):
3279         (API::WebAuthenticationPanel::WebAuthenticationPanel):
3280         (API::WebAuthenticationPanel::cancel const):
3281         * UIProcess/API/APIWebAuthenticationPanel.h:
3282         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
3283         (-[_WKWebAuthenticationPanel cancel]):
3284         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
3285         (WebKit::AuthenticatorManager::cancelRequest):
3286         (WebKit::AuthenticatorManager::clearState):
3287         (WebKit::AuthenticatorManager::runPanel):
3288         (WebKit::AuthenticatorManager::resetState):
3289         * UIProcess/WebAuthentication/AuthenticatorManager.h:
3290         * UIProcess/WebAuthentication/Cocoa/HidConnection.h:
3291         (WebKit::HidConnection::isInitialized const):
3292         (WebKit::HidConnection::setIsInitialized):
3293         * UIProcess/WebAuthentication/Cocoa/HidConnection.mm:
3294         (WebKit::HidConnection::~HidConnection):
3295         (WebKit::HidConnection::initialize):
3296         (WebKit::HidConnection::terminate):
3297         (WebKit::HidConnection::sendSync):
3298         (WebKit::HidConnection::send):
3299         (WebKit::HidConnection::registerDataReceivedCallback):
3300         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
3301         (WebKit::MockHidConnection::initialize):
3302         (WebKit::MockHidConnection::terminate):
3303         (WebKit::MockHidConnection::sendSync):
3304         (WebKit::MockHidConnection::send):
3305         (WebKit::MockHidConnection::feedReports):
3306         * UIProcess/WebAuthentication/Mock/MockHidConnection.h:
3307         * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
3308         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
3309         (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
3310         (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
3311         (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):
3312         (WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable):
3313         (WebKit::WebAuthenticatorCoordinatorProxy::requestReply): Deleted.
3314         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
3315         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in:
3316         * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
3317         (WebKit::CtapAuthenticator::CtapAuthenticator):
3318         (WebKit::CtapAuthenticator::makeCredential):
3319         (WebKit::CtapAuthenticator::getAssertion):
3320         (WebKit::CtapAuthenticator::tryDowngrade):
3321         * UIProcess/WebAuthentication/fido/CtapAuthenticator.h:
3322         * UIProcess/WebAuthentication/fido/CtapDriver.h:
3323         (WebKit::CtapDriver::cancel):
3324         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
3325         (WebKit::CtapHidDriver::Worker::write):
3326         (WebKit::CtapHidDriver::Worker::read):
3327         (WebKit::CtapHidDriver::Worker::returnMessage):
3328         (WebKit::CtapHidDriver::Worker::reset):
3329         (WebKit::CtapHidDriver::Worker::cancel):
3330         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
3331         (WebKit::CtapHidDriver::continueAfterResponseReceived):
3332         (WebKit::CtapHidDriver::returnResponse):
3333         (WebKit::CtapHidDriver::reset):
3334         (WebKit::CtapHidDriver::cancel):
3335         * UIProcess/WebAuthentication/fido/CtapHidDriver.h:
3336         * UIProcess/WebAuthentication/fido/FidoAuthenticator.cpp: Copied from Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.cpp.
3337         (WebKit::FidoAuthenticator::FidoAuthenticator):
3338         (WebKit::FidoAuthenticator::~FidoAuthenticator):
3339         (WebKit::FidoAuthenticator::driver const):
3340         (WebKit::FidoAuthenticator::releaseDriver):
3341         * UIProcess/WebAuthentication/fido/FidoAuthenticator.h: Copied from Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.cpp.
3342         * UIProcess/WebAuthentication/fido/FidoService.cpp:
3343         (WebKit::FidoService::continueAfterGetInfo):
3344         * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
3345         (WebKit::U2fAuthenticator::U2fAuthenticator):
3346         (WebKit::U2fAuthenticator::issueCommand):
3347         * UIProcess/WebAuthentication/fido/U2fAuthenticator.h:
3348         * UIProcess/WebPageProxy.cpp:
3349         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
3350         (WebKit::WebPageProxy::resetState):
3351         * UIProcess/WebProcessProxy.cpp:
3352         (WebKit::WebProcessProxy::didDestroyFrame):
3353         * WebKit.xcodeproj/project.pbxproj:
3354         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
3355         (WebKit::WebAuthenticatorCoordinator::WebAuthenticatorCoordinator):
3356         (WebKit::WebAuthenticatorCoordinator::makeCredential):
3357         (WebKit::WebAuthenticatorCoordinator::getAssertion):
3358         (WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable):
3359         (WebKit::WebAuthenticatorCoordinator::~WebAuthenticatorCoordinator): Deleted.
3360         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h:
3361         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.messages.in: Removed.
3362         * WebProcess/WebPage/WebFrame.cpp:
3363         (WebKit::WebFrame::fromCoreFrame):
3364         * WebProcess/WebPage/WebFrame.h:
3365
3366 2019-10-18  Zan Dobersek  <zdobersek@igalia.com>
3367
3368         Avoid crashes on GCC-compiled binaries by avoiding a use-after-move
3369         that's the result of differring call conventions.
3370
3371         Rubber-stamped by Carlos Garcia Campos.
3372
3373         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
3374         (WebKit::WebSWServerConnection::startFetch): Copy the SW identifier from
3375         the ServiceWorkerFetchTask before it's moved into the lambda.
3376
3377 2019-10-17  Mark Lam  <mark.lam@apple.com>
3378
3379         Use constexpr in more places and remove some unnecessary external linkage.
3380         https://bugs.webkit.org/show_bug.cgi?id=203115
3381
3382         Reviewed by Yusuke Suzuki.
3383
3384         * UIProcess/API/APIContentRuleListStore.h:
3385         * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm:
3386
3387 2019-10-17  Antoine Quint  <graouts@apple.com>
3388
3389         [Web Animations] Enable the Web Animations JavaScript API by default
3390         https://bugs.webkit.org/show_bug.cgi?id=203075
3391
3392         Reviewed by Antti Koivisto.
3393
3394         * Shared/WebPreferences.yaml:
3395
3396 2019-10-17  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3397
3398         [GTK][WPE] File and Directory Entries API is not enabled
3399         https://bugs.webkit.org/show_bug.cgi?id=202796
3400
3401         Reviewed by Adrian Perez de Castro.
3402
3403         Enable by default the DirectoryUpload runtime setting that is
3404         used to enable the APIs of the File and Directory Entries API.
3405
3406         Enable also the DataTransferItemsEnabled runtime setting that
3407         exposes the DataTransferItem API. This makes the manual tests
3408         available at https://w3c-test.org/entries-api mostly pass on
3409         platform GTK (those tests need also the DataTransferItem API
3410         to enable the drag-and-drop).
3411
3412         The bug <https://webkit.org/b/98940> for DataTransferItem API
3413         remains open because the layout test editing/pasteboard/data-transfer-items.html
3414         is still not passing completely. However other manual tests for
3415         DataTransferItem pass after enabling it.
3416
3417         * Shared/WebPreferencesDefaultValues.h:
3418
3419 2019-10-17  Devin Rousso  <drousso@apple.com>
3420
3421         Web Inspector: rework frontend agent construction to allow commands/events to be controlled by the related target's type
3422         https://bugs.webkit.org/show_bug.cgi?id=200384
3423         <rdar://problem/53850352>
3424
3425         Reviewed by Joseph Pecoraro.
3426
3427         * WebProcess/WebPage/RemoteWebInspectorUI.h:
3428         (WebKit::WebInspectorUI::backendCommandsURL const): Added.
3429         (WebKit::WebInspectorUI::debuggableType const): Added.
3430         (WebKit::WebInspectorUI::backendCommandsURL): Deleted.
3431         (WebKit::WebInspectorUI::debuggableType): Deleted.
3432         * WebProcess/WebPage/WebInspectorUI.h:
3433         (WebKit::WebInspectorUI::backendCommandsURL const): Added.
3434         (WebKit::WebInspectorUI::debuggableType const): Added.
3435         * UIProcess/WebPageDebuggable.h:
3436         (WebKit::WebPageDebuggable::type const):
3437         * UIProcess/glib/RemoteInspectorClient.cpp:
3438         (WebKit::RemoteInspectorClient::RemoteInspectorClient):
3439         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h:
3440         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
3441         (debuggableTypeString):
3442         Split the `Web` debuggable type into `Page` (WebCore::Page) and `WebPage` (WebKit::WebPageProxy).
3443
3444 2019-10-16  Emilio Cobos Álvarez  <emilio@crisal.io>
3445
3446         Pass network cache directory in WebsiteDataStore::parameters() for non-Cocoa platforms.
3447         https://bugs.webkit.org/show_bug.cgi?id=203043
3448
3449         This was causing various errors in the network process that were
3450         visible in debug builds.
3451
3452         Reviewed by Alex Christensen.
3453
3454         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3455         (WebKit::WebsiteDataStore::parameters):
3456
3457 2019-10-16  Chris Dumez  <cdumez@apple.com>
3458
3459         Rename PageCache to BackForwardCache
3460         https://bugs.webkit.org/show_bug.cgi?id=203048
3461
3462         Reviewed by Alex Christensen.
3463
3464         Rename PageCache to BackForwardCache for clarity and consistency with the UIProcess's WebBackForwardCache.
3465
3466         * Shared/CacheModel.cpp:
3467         (WebKit::calculateMemoryCacheSizes):
3468         * Shared/CacheModel.h:
3469         * Shared/WebPreferences.yaml:
3470         * UIProcess/API/APINavigationClient.h:
3471         (API::NavigationClient::willGoToBackForwardListItem):
3472         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3473         (API::ProcessPoolConfiguration::copy):
3474         * UIProcess/API/APIProcessPoolConfiguration.h:
3475         * UIProcess/API/C/WKPreferences.cpp:
3476         (WKPreferencesSetPageCacheEnabled):
3477         (WKPreferencesGetPageCacheEnabled):
3478         (WKPreferencesSetPageCacheSupportsPlugins):
3479         (WKPreferencesGetPageCacheSupportsPlugins):
3480         * UIProcess/API/Cocoa/WKPreferences.mm:
3481         (-[WKPreferences _setUsesPageCache:]):
3482         (-[WKPreferences _usesPageCache]):
3483         (-[WKPreferences _setPageCacheSupportsPlugins:]):
3484         (-[WKPreferences _pageCacheSupportsPlugins]):
3485         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3486         (-[_WKProcessPoolConfiguration pageCacheEnabled]):
3487         (-[_WKProcessPoolConfiguration setPageCacheEnabled:]):
3488         * UIProcess/API/glib/WebKitSettings.cpp:
3489         (webkit_settings_get_enable_page_cache):
3490         (webkit_settings_set_enable_page_cache):
3491         * UIProcess/Cocoa/NavigationState.h:
3492         * UIProcess/Cocoa/NavigationState.mm:
3493         (WebKit::NavigationState::setNavigationDelegate):
3494         (WebKit::NavigationState::NavigationClient::willGoToBackForwardListItem):
3495         (WebKit::NavigationState::NavigationClient::didStartProvisionalNavigation):
3496         (WebKit::NavigationState::NavigationClient::didReceiveServerRedirectForProvisionalNavigation):
3497         (WebKit::NavigationState::NavigationClient::didFailProvisionalNavigationWithError):
3498         (WebKit::NavigationState::NavigationClient::didCommitNavigation):
3499         (WebKit::NavigationState::NavigationClient::didFinishDocumentLoad):
3500         (WebKit::NavigationState::NavigationClient::didFinishNavigation):
3501         (WebKit::NavigationState::NavigationClient::didFailNavigationWithError):
3502         (WebKit::NavigationState::NavigationClient::didSameDocumentNavigation):
3503         * UIProcess/ViewGestureController.cpp:
3504         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
3505         * UIProcess/WebPageProxy.cpp:
3506         (WebKit::WebPageProxy::shouldUseBackForwardCache const):
3507         (WebKit::WebPageProxy::willGoToBackForwardListItem):
3508         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
3509         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared):
3510         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
3511         (WebKit::WebPageProxy::didCommitLoadForFrame):
3512         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
3513         (WebKit::WebPageProxy::didFinishLoadForFrame):
3514         (WebKit::WebPageProxy::didFailLoadForFrame):
3515         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
3516         * UIProcess/WebPageProxy.h:
3517         * UIProcess/WebPageProxy.messages.in:
3518         * UIProcess/WebProcessPool.cpp:
3519         (WebKit::WebProcessPool::updateBackForwardCacheCapacity):
3520         * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp:
3521         (WKBundleBackForwardListItemIsInBackForwardCache):
3522         * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h:
3523         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
3524         (WebKit::toBackForwardListItemState):
3525         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3526         (WebKit::WebFrameLoaderClient::WebFrameLoaderClient):
3527         (WebKit::WebFrameLoaderClient::shouldGoToHistoryItem const):
3528         (WebKit::WebFrameLoaderClient::transitionToCommittedFromCachedFrame):
3529         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
3530         (WebKit::WebFrameLoaderClient::didRestoreFromBackForwardCache):
3531         (WebKit::WebFrameLoaderClient::createPlugin):
3532         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3533         * WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm:
3534         (WebKit::WebFrameLoaderClient::forceLayoutOnRestoreFromBackForwardCache):
3535         * WebProcess/WebPage/VisitedLinkTableController.cpp:
3536         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
3537         (WebKit::WebBackForwardListProxy::removeItem):
3538         * WebProcess/WebPage/WebPage.cpp:
3539         (WebKit::WebPage::suspendForProcessSwap):
3540         * WebProcess/WebProcess.cpp:
3541         (WebKit::WebProcess::initializeWebProcess):
3542         (WebKit::WebProcess::setCacheModel):
3543         (WebKit::WebProcess::deleteWebsiteData):
3544         (WebKit::WebProcess::setBackForwardCacheCapacity):
3545         (WebKit::WebProcess::clearCachedPage):
3546         * WebProcess/WebProcess.h:
3547
3548 2019-10-16  Per Arne Vollan  <pvollan@apple.com>
3549
3550         [iOS] Remove ubiquity client rule from sandbox
3551         https://bugs.webkit.org/show_bug.cgi?id=201347
3552
3553         Reviewed by Brent Fulgham.
3554
3555         This rule is most likely not needed, since we have already blocked all of its associated mach services,
3556         and no issues have been reported.
3557
3558         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3559
3560 2019-10-16  Tim Horton  <timothy_horton@apple.com>
3561
3562         iOS: inputmode=none is not respected with a hardware keyboard attached
3563         https://bugs.webkit.org/show_bug.cgi?id=203061
3564
3565         Reviewed by Daniel Bates.
3566
3567         * UIProcess/ios/WKContentViewInteraction.mm:
3568         (-[WKContentView shouldShowAutomaticKeyboardUI]):
3569         We can resolve this FIXME, as the underlying bug was fixed in <rdar://problem/52706523>.
3570         This now means that we will respect inputmode=none even when a hardware
3571         keyboard is attached, significantly improving the experience on sites that use it
3572         by avoiding an intermittent input bar.
3573
3574 2019-10-16  Per Arne Vollan  <pvollan@apple.com>
3575
3576         [iOS] Remove send-signal from mach-lookup rule
3577         https://bugs.webkit.org/show_bug.cgi?id=201203
3578
3579         Reviewed by Brent Fulgham.
3580
3581         The send-signal can be removed, since crashes have not been reported from this rule.
3582
3583         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3584
3585 2019-10-16  Dean Jackson  <dino@apple.com>
3586
3587         Add Swift modulemap for WebKit Private APIs
3588         https://bugs.webkit.org/show_bug.cgi?id=203059
3589
3590         Reviewed by Tim Horton.
3591
3592         Provide a Swift modulemap for WebKit_Private, and
3593         ensure WKPreferencesPrivate.h is exposed.
3594
3595         Renamed OSX.modulemap to macOS.modulemap while here.
3596
3597         * Configurations/WebKit.xcconfig:
3598         * Modules/iOS.private.modulemap: Added.
3599         * Modules/macOS.modulemap: Renamed from Source/WebKit/Modules/OSX.modulemap.
3600         * Modules/macOS.private.modulemap: Added.
3601         * Shared/API/Cocoa/WebKitPrivate.h: Include WKPreferencesPrivate.h.
3602
3603 2019-10-16  John Wilander  <wilander@apple.com>
3604
3605         Resource Load Statistics (experimental): Block all third-party cookies on websites without prior user interaction
3606         https://bugs.webkit.org/show_bug.cgi?id=203017
3607         <rdar://problem/56262708>
3608
3609         Reviewed by Alex Christensen.
3610
3611         This enhancement is off by default and controlled by an internal feature flag.
3612
3613         The functional change is in WebCore::NetworkStorageSession::shouldBlockCookies() which is
3614         called from:
3615         - NetworkDataTaskCocoa::NetworkDataTaskCocoa()
3616         - NetworkDataTaskCocoa::willPerformHTTPRedirection
3617
3618         shouldBlockCookies() now checks if the first-party website has received user interaction
3619         and if not, blocks all third-party cookies, regardless of the status of those third-party
3620         domains (prevalent or not).
3621
3622         The changes to ResourceLoadStatisticsDatabaseStore and ResourceLoadStatisticsMemoryStore
3623         are about communicating which domains have received user interaction (prevalent or not)
3624         to the network storage session so that it can enforce the new restriction.
3625
3626         The C API change and piping through the WebsiteDataStore is test infrastructure.
3627
3628         Bundled cleanup task: Remove the two month old feature flag for NSURLSession switching.
3629
3630         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3631         (WebKit::CompletionHandler<void):
3632         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
3633         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3634         (WebKit::ResourceLoadStatisticsMemoryStore::clear):
3635         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
3636         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3637         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
3638         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3639         (WebKit::RegistrableDomainsToBlockCookiesFor::isolatedCopy const):
3640         * NetworkProcess/NetworkProcess.cpp:
3641         (WebKit::NetworkProcess::initializeNetworkProcess):
3642         (WebKit::NetworkProcess::setShouldBlockThirdPartyCookiesForTesting):
3643         * NetworkProcess/NetworkProcess.messages.in:
3644         * NetworkProcess/NetworkSession.cpp:
3645         (WebKit::NetworkSession::NetworkSession):
3646         * NetworkProcess/NetworkSession.h:
3647         (WebKit::NetworkSession::setResourceLoadStatisticsLogTestingEvent):
3648         (WebKit::NetworkSession::shouldIsolateSessionsForPrevalentTopFrames const): Deleted.
3649         * NetworkProcess/NetworkSessionCreationParameters.cpp:
3650         (WebKit::NetworkSessionCreationParameters::encode const):
3651         (WebKit::NetworkSessionCreationParameters::decode):
3652         * NetworkProcess/NetworkSessionCreationParameters.h:
3653         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3654         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3655         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3656         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3657         * Shared/WebPreferences.yaml:
3658         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3659         (WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting):
3660         (WKWebsiteDataStoreStatisticsResetToConsistentState):
3661         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3662         * UIProcess/Network/NetworkProcessProxy.cpp:
3663         (WebKit::NetworkProcessProxy::setShouldBlockThirdPartyCookiesForTesting):
3664         * UIProcess/Network/NetworkProcessProxy.h:
3665         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3666         (WebKit::WebsiteDataStore::parameters):
3667         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3668         (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting):
3669         * UIProcess/WebsiteData/WebsiteDataStore.h:
3670
3671 2019-10-16  Kate Cheney  <katherine_cheney@apple.com>
3672
3673         WKWebsiteDataStoreStatisticsResetToConsistentState() should call store.setUseITPDatabase(false)
3674         https://bugs.webkit.org/show_bug.cgi?id=203020
3675         <rdar://problem/56314484>
3676
3677         Reviewed by Chris Dumez.
3678
3679         The resourceLoadStatisticsStore should be reset between tests to use
3680         a memory store, and any test that needs to use the database store
3681         can use the setUseITPDatabase function.
3682
3683         * NetworkProcess/NetworkProcess.cpp:
3684         (WebKit::NetworkProcess::setUseITPDatabase):
3685         * NetworkProcess/NetworkProcess.h:
3686         * NetworkProcess/NetworkProcess.messages.in:
3687         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3688         (WKWebsiteDataStoreSetUseITPDatabase):
3689         (WKWebsiteDataStoreStatisticsResetToConsistentState):
3690         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3691         * UIProcess/Network/NetworkProcessProxy.cpp:
3692         (WebKit::NetworkProcessProxy::setUseITPDatabase):
3693         * UIProcess/Network/NetworkProcessProxy.h:
3694         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3695         (WebKit::WebsiteDataStore::setUseITPDatabase):
3696         * UIProcess/WebsiteData/WebsiteDataStore.h:
3697
3698 2019-10-16  Chris Dumez  <cdumez@apple.com>
3699
3700         [WK2] Handle back/forward cache entry expiration in the UIProcess instead of the WebProcess
3701         https://bugs.webkit.org/show_bug.cgi?id=203034
3702         <rdar://problem/56332453>
3703
3704         Reviewed by Antti Koivisto.
3705
3706         Handle back/forward cache entry expiration in the UIProcess instead of the WebProcess,
3707         now that back/forward cache management is done in the UIProcess.
3708
3709         * UIProcess/WebBackForwardCacheEntry.cpp:
3710         (WebKit::WebBackForwardCacheEntry::WebBackForwardCacheEntry):
3711         (WebKit::WebBackForwardCacheEntry::takeSuspendedPage):
3712         (WebKit::WebBackForwardCacheEntry::expirationTimerFired):
3713         * UIProcess/WebBackForwardCacheEntry.h:
3714         Add a Timer to WebBackForwardCacheEntry to make the entry expire after 30 minutes, which is what used
3715         to happen on WebContent process side. One difference in behavior is that when the entry expires we
3716         now remove it from the cache right away to free-up memory, instead of simply refusing to use it later
3717         on.
3718
3719         * WebProcess/WebPage/WebPage.cpp:
3720         Disable back forward cache expiration in the WebContent process when using modern
3721         WebKit.
3722
3723 2019-10-16  Chris Dumez  <cdumez@apple.com>
3724
3725         [iOS] Stop terminating the prewarmed process on application suspension
3726         https://bugs.webkit.org/show_bug.cgi?id=203033
3727
3728         Reviewed by Alex Christensen.
3729
3730         Stop terminating the prewarmed process on application suspension. Having no prewarmed process when the
3731         application resumes means the next cross-site load will be significantly slower. If the system needs
3732         memory, this process can be jetsammed.
3733
3734         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3735         (WebKit::WebProcessPool::applicationIsAboutToSuspend):
3736
3737 2019-10-16  Chris Dumez  <cdumez@apple.com>
3738
3739         Drop unused WKPageSetResourceCachingDisabled() SPI
3740         https://bugs.webkit.org/show_bug.cgi?id=203035
3741
3742         Reviewed by Alex Christensen.
3743
3744         * UIProcess/API/C/WKPage.cpp:
3745         (WKPageGetResourceCachingDisabled): Deleted.
3746         (WKPageSetResourceCachingDisabled): Deleted.
3747         * UIProcess/API/C/WKPagePrivate.h:
3748         * UIProcess/WebPageProxy.cpp:
3749         (WebKit::WebPageProxy::setResourceCachingDisabled): Deleted.
3750         * UIProcess/WebPageProxy.h:
3751         (WebKit::WebPageProxy::isResourceCachingDisabled const): Deleted.
3752         * WebProcess/WebPage/WebPage.cpp:
3753         (WebKit::WebPage::setResourceCachingDisabled): Deleted.
3754         * WebProcess/WebPage/WebPage.h:
3755         * WebProcess/WebPage/WebPage.messages.in:
3756
3757 2019-10-16  Wenson Hsieh  <wenson_hsieh@apple.com>
3758
3759         Unreviewed, fix the internal macOS 10.13 and 10.14 builds after r251171
3760
3761         * Platform/spi/mac/ApplicationServicesSPI.h: Guard SPI declarations that use AXClientType with HAVE(AX_CLIENT_TYPE).
3762
3763 2019-10-15  Carlos Garcia Campos  <cgarcia@igalia.com>
3764
3765         [GTK][WPE] Add user messages API
3766         https://bugs.webkit.org/show_bug.cgi?id=202847
3767
3768         Reviewed by Adrian Perez de Castro.
3769
3770         We have never exposed an API to send/receive messages to/from Web extensions, to allow applications use their own
3771         IPC. Now, with PSON enabled, it's a lot more difficult to implement the custom IPC on the application side,
3772         because applications need to keep track of all the web processes launched, and the changes of web process in the
3773         web view to send the messages to the right extension. That's already done internally by WebKit, so it would be
3774         easier to provide a simple API so that apps don't need to worry about the web process being used. This patch adds
3775         WebKitUserMessage, a simple message API consisting on a message name, parameters and file descriptors. Messages
3776         can be sent from a WebKitWebContext to all the WebKitWebExtensions, or from a WebKitWebExtension to its
3777         WebKitWebContext, or from a WebKitWebView to its WebKitWebPage (and vice versa).
3778
3779         * PlatformGTK.cmake:
3780         * PlatformWPE.cmake:
3781         * Shared/API/glib/WebKitUserMessage.cpp: Added.
3782         (webkitUserMessageDispose):
3783         (webkitUserMessageGetProperty):
3784         (webkitUserMessageSetProperty):
3785         (webkit_user_message_class_init):
3786         (webkitUserMessageCreate):
3787         (webkitUserMessageGetMessage):
3788         (webkit_user_message_new):
3789         (webkit_user_message_new_with_fd_list):
3790         (webkit_user_message_get_name):
3791         (webkit_user_message_get_parameters):
3792         (webkit_user_message_get_fd_list):
3793         (webkit_user_message_send_reply):
3794         * Shared/API/glib/WebKitUserMessagePrivate.h: Added.
3795         * Shared/glib/ArgumentCodersGLib.cpp: Added.
3796         (IPC::encode):
3797         (IPC::decode):
3798         * Shared/glib/ArgumentCodersGLib.h: Added.
3799         * Shared/glib/UserMessage.cpp: Added.
3800         (WebKit::UserMessage::encode const):
3801         (WebKit::UserMessage::decode):
3802         * Shared/glib/UserMessage.h: Added.
3803         (WebKit::UserMessage::UserMessage):
3804         * SourcesGTK.txt:
3805         * SourcesWPE.txt:
3806         * UIProcess/API/glib/WebKitWebContext.cpp:
3807         (webkitWebContextConstructed):
3808         (webkit_web_context_class_init):
3809         (webkit_web_context_send_message_to_all_extensions):
3810         * UIProcess/API/glib/WebKitWebView.cpp:
3811         (webkit_web_view_class_init):
3812         (webkitWebViewDidReceiveUserMessage):
3813         (webkit_web_view_send_message_to_page):
3814         (webkit_web_view_send_message_to_page_finish):
3815         * UIProcess/API/glib/WebKitWebViewPrivate.h:
3816         * UIProcess/API/gtk/WebKitUserMessage.h: Added.
3817         * UIProcess/API/gtk/WebKitWebContext.h:
3818         * UIProcess/API/gtk/WebKitWebView.h:
3819         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
3820         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
3821         * UIProcess/API/gtk/webkit2.h:
3822         * UIProcess/API/wpe/APIViewClient.h:
3823         (API::ViewClient::didReceiveUserMessage):
3824         * UIProcess/API/wpe/PageClientImpl.cpp:
3825         (WebKit::PageClientImpl::sendMessageToWebView):
3826         * UIProcess/API/wpe/PageClientImpl.h:
3827         * UIProcess/API/wpe/WPEView.cpp:
3828         (WKWPE::View::didReceiveUserMessage):
3829         * UIProcess/API/wpe/WPEView.h:
3830         * UIProcess/API/wpe/WebKitUserMessage.h: Added.
3831         * UIProcess/API/wpe/WebKitWebContext.h:
3832         * UIProcess/API/wpe/WebKitWebView.h:
3833         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
3834         * UIProcess/API/wpe/docs/wpe-docs.sgml:
3835         * UIProcess/API/wpe/webkit.h:
3836         * UIProcess/WebPageProxy.h:
3837         * UIProcess/WebPageProxy.messages.in:
3838         * UIProcess/WebProcessPool.h:
3839         * UIProcess/WebProcessProxy.h:
3840         * UIProcess/WebProcessProxy.messages.in:
3841         * UIProcess/glib/WebProcessProxyGLib.cpp:
3842         (WebKit::WebProcessProxy::sendMessageToWebContextWithReply):
3843         (WebKit::WebProcessProxy::sendMessageToWebContext):
3844         * UIProcess/gtk/WebPageProxyGtk.cpp:
3845         (WebKit::WebPageProxy::sendMessageToWebViewWithReply):
3846         (WebKit::WebPageProxy::sendMessageToWebView):
3847         * UIProcess/wpe/WebPageProxyWPE.cpp:
3848         (WebKit::WebPageProxy::sendMessageToWebViewWithReply):
3849         (WebKit::WebPageProxy::sendMessageToWebView):
3850         * WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.h:
3851         (WebKit::WebKitExtensionManager::extension const):
3852         * WebProcess/InjectedBundle/API/glib/WebKitWebExtension.cpp:
3853         (webkitWebExtensionDidReceiveUserMessage):
3854         (webkit_web_extension_send_message_to_context):
3855         (webkit_web_extension_send_message_to_context_finish):
3856         * WebProcess/InjectedBundle/API/glib/WebKitWebExtensionPrivate.h:
3857         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
3858         (webkit_web_page_class_init):
3859         (webkitWebPageDidReceiveUserMessage):
3860         (webkit_web_page_send_message_to_view):
3861         (webkit_web_page_send_message_to_view_finish):
3862         * WebProcess/InjectedBundle/API/glib/WebKitWebPagePrivate.h:
3863         * WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.h:
3864         * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h:
3865         * WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h:
3866         * WebProcess/InjectedBundle/API/wpe/WebKitWebExtension.h:
3867         * WebProcess/InjectedBundle/API/wpe/WebKitWebPage.h:
3868         * WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-1.0-sections.txt:
3869         * WebProcess/InjectedBundle/API/wpe/webkit-web-extension.h:
3870         * WebProcess/WebPage/WebPage.h:
3871         * WebProcess/WebPage/WebPage.messages.in:
3872         * WebProcess/WebPage/glib/WebPageGLib.cpp: Added.
3873         (WebKit::WebPage::sendMessageToWebExtensionWithReply):
3874         (WebKit::WebPage::sendMessageToWebExtension):
3875         * WebProcess/WebProcess.h:
3876         * WebProcess/WebProcess.messages.in:
3877         * WebProcess/glib/WebProcessGLib.cpp:
3878         (WebKit::WebProcess::sendMessageToWebExtension):
3879
3880 2019-10-15  Wenson Hsieh  <wenson_hsieh@apple.com>
3881
3882         Fix the internal macOS build after r251171
3883         https://bugs.webkit.org/show_bug.cgi?id=203022
3884
3885         Reviewed by Dan Bernstein.
3886
3887         Attempts to include <HIServices/AccessibilityPriv.h> in WebKit result in:
3888
3889         ```
3890         fatal error: 'HIServices/AccessibilityPriv.h' file not found
3891         ```
3892
3893         At least on macOS 10.15, it appears that HIServices.framework exists within the ApplicationServices framework.
3894         To fix this build error, we can instead turn AccessibilityPrivSPI.h into an SPI header for ApplicationServices,
3895         ApplicationServicesSPI.h, and use it in several places where we currently directly import <ApplicationServices/
3896         ApplicationServicesPriv.h>.
3897
3898         * Platform/IPC/cocoa/ConnectionCocoa.mm:
3899
3900         Bring some more constants that were defined in the !USE(APPLE_INTERNAL_SDK) case into the ApplicationServices
3901         SPI header.
3902
3903         * Platform/spi/mac/ApplicationServicesSPI.h: Renamed from Source/WebKit/Platform/spi/mac/AccessibilityPrivSPI.h.
3904         * Shared/mac/AuxiliaryProcessMac.mm:
3905         * WebKit.xcodeproj/project.pbxproj:
3906         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
3907
3908 2019-10-15  Kate Cheney  <katherine_cheney@apple.com>
3909
3910         REGRESSION (~244100) [Mac WK2 Debug] Layout Test http/tests/resourceLoadStatistics/prune-statistics.html is a flaky failure (197285)
3911         https://bugs.webkit.org/show_bug.cgi?id=197285
3912         <rdar://problem/50208370>
3913
3914         Reviewed by Chris Dumez.
3915
3916         This patch fixes a flaky failure which was being caused by other
3917         resourceLoadStatistics tests scheduling processing checks which
3918         were called during execution of prune-statistics.html.
3919         Now, any pending processing checks are cancelled between tests.
3920
3921         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3922         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
3923
3924 2019-10-15  Chris Dumez  <cdumez@apple.com>
3925
3926         [iOS] Maintain the last Back/Forward cache entry when the application gets suspended
3927         https://bugs.webkit.org/show_bug.cgi?id=203014
3928
3929         Reviewed by Geoffrey Garen.
3930
3931         Previously, we would clear all back/forward cache entries when the application is about to
3932         be suspended. This means that we would lose fast-back when coming back to the application.
3933         To be memory-friendly but maintain the fast-back when coming back to the application, we now
3934         maintain the last back/forward cache entry when the application gets suspended.
3935
3936         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3937         (WebKit::WebProcessPool::applicationIsAboutToSuspend):
3938         (WebKit::WebProcessPool::notifyProcessPoolsApplicationIsAboutToSuspend):
3939         * UIProcess/WebBackForwardCache.cpp:
3940         (WebKit::WebBackForwardCache::pruneToSize):
3941         * UIProcess/WebBackForwardCache.h:
3942         * UIProcess/WebProcessPool.h:
3943         * UIProcess/ios/ProcessAssertionIOS.mm:
3944         (-[WKProcessAssertionBackgroundTaskManager init]):
3945         (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]):
3946
3947         * WebProcess/WebProcess.cpp:
3948         (WebKit::WebProcess::initializeWebProcess):
3949         A WebProcess no longer clears its PageCache on suspension on iOS. We let the UIProcess's
3950         back/forward cache control when PageCache entries should get destroyed. The back/forward
3951         cache will properly wake up a suspended process to clear one of its PageCache entries if
3952         needed.
3953
3954 2019-10-15  Andres Gonzalez  <andresg_22@apple.com>
3955
3956         AX: Make AXIsolatedTree compile again
3957         https://bugs.webkit.org/show_bug.cgi?id=202702
3958         <rdar://problem/56084968>
3959
3960         Reviewed by Joanmarie Diggs.
3961
3962         Re-submitting r251045 with a fix for internal builds.
3963
3964         * Platform/spi/mac/AccessibilityPrivSPI.h:
3965         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
3966         (-[WKAccessibilityWebPageObjectBase isolatedTreeRootObject]):
3967
3968 2019-10-15  Chris Dumez  <cdumez@apple.com>
3969
3970         Webview's drawing area may stay frozen on cross-site back/forward navigation
3971         https://bugs.webkit.org/show_bug.cgi?id=203004
3972
3973         Reviewed by Tim Horton.
3974
3975         Whenever the UIScene becomes foreground / background, the WebPageProxy notifies its currently associated
3976         WebPage in the committed WebProcess so that it can freeze / unfreeze its layer tree with the
3977         BackgroundApplication reason. The issue is that if a WebPage gets suspended on cross-site navigation
3978         (because the UIScene is in the background when the load commits), then the suspended WebPage kept its
3979         a BackgroundApplication freeze. When the UIScene becomes foreground, the WebPage only notifies its
3980         committed page so the suspended page keeps its BackgroundApplication freeze still. If the user now
3981         navigates back, it will restore the suspended WebPage and the view will stay frozen.
3982
3983         To address the issue, we now have the WebPage drop its BackgroundApplication freeze reason, whenever
3984         it transitions from committed to suspended.
3985
3986         * UIProcess/ios/WKApplicationStateTrackingView.mm:
3987         (-[WKApplicationStateTrackingView didMoveToWindow]):
3988         Fix logging, [self isBackground] needs to be called *after* _applicationStateTracker has been
3989         initialized, or it will return YES unconditionally.
3990
3991         * WebProcess/WebPage/WebPage.cpp:
3992         (WebKit::WebPage::setIsSuspended):
3993
3994 2019-10-15  Peng Liu  <peng.liu6@apple.com>
3995
3996         [Picture-in-Picture Web API] Implement HTMLVideoElement.requestPictureInPicture() / Document.exitPictureInPicture()
3997         https://bugs.webkit.org/show_bug.cgi?id=201024
3998
3999         Reviewed by Eric Carlson.
4000
4001         Add configurations for Picture-in-Picture API and add a preference option for it.
4002
4003         * Configurations/FeatureDefines.xcconfig:
4004         * Shared/WebPreferences.yaml:
4005
4006 2019-10-15  youenn fablet  <youenn@apple.com>
4007
4008         Move headers to keep from a HTTPHeaderNameSet to an OptionSet
4009         https://bugs.webkit.org/show_bug.cgi?id=202977
4010
4011         Reviewed by Anders Carlsson.
4012
4013         * NetworkProcess/NetworkResourceLoadParameters.cpp:
4014         (WebKit::NetworkResourceLoadParameters::decode):
4015         * NetworkProcess/NetworkResourceLoadParameters.h:
4016
4017 2019-10-15  Jiewen Tan  <jiewen_tan@apple.com>
4018
4019         [WebAuthn] Rename -[WKUIDelegatePrivate webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:] to -[WKUIDelegatePrivate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]
4020         https://bugs.webkit.org/show_bug.cgi?id=202564
4021         <rdar://problem/55974027>
4022
4023         Reviewed by Brent Fulgham.
4024
4025         Rename the SPI to a proper SPI style.
4026
4027         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
4028         * UIProcess/Cocoa/UIDelegate.mm:
4029         (WebKit::UIDelegate::setDelegate):
4030         (WebKit::UIDelegate::UIClient::runWebAuthenticationPanel):
4031
4032 2019-10-15  youenn fablet  <youenn@apple.com>
4033
4034         Scheduling a service worker job in server should wait for finishing the registration import
4035         https://bugs.webkit.org/show_bug.cgi?id=202975
4036
4037         Reviewed by Chris Dumez.
4038
4039         * WebProcess/Storage/WebSWClientConnection.cpp:
4040         (WebKit::WebSWClientConnection::scheduleJobInServer):
4041         We should not schedule a job until the registrations are fully imported.
4042         Covered by ServiceWorkerBasic API test flakily hitting debug asserts.
4043
4044 2019-10-15  Alex Christensen  <achristensen@webkit.org>
4045
4046         Unreviewed, rolling out r251138.
4047
4048         Broke API tests
4049
4050         Reverted changeset:
4051
4052         "Pass CORS-enabled schemes through WebProcess instead of
4053         having them NetworkProcess-global"
4054         https://bugs.webkit.org/show_bug.cgi?id=202891