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