Don't use AVCapture on watchOS and tvOS
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-11-15  Eric Carlson  <eric.carlson@apple.com>
2
3         Don't use AVCapture on watchOS and tvOS
4         https://bugs.webkit.org/show_bug.cgi?id=204254
5         <rdar://problem/45508044>
6
7         Reviewed by Youenn Fablet.
8
9         * Configurations/FeatureDefines.xcconfig:
10
11 2019-11-15  Myles C. Maxfield  <mmaxfield@apple.com>
12
13         [Apple] Enable variation fonts on all Apple platforms
14         https://bugs.webkit.org/show_bug.cgi?id=198100
15
16         Reviewed by Simon Fraser.
17
18         * Configurations/FeatureDefines.xcconfig:
19
20 2019-11-15  Chris Dumez  <cdumez@apple.com>
21
22         Add more release logging for network load restarts
23         https://bugs.webkit.org/show_bug.cgi?id=204234
24
25         Reviewed by Youenn Fablet.
26
27         * NetworkProcess/NetworkResourceLoader.cpp:
28         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
29         (WebKit::NetworkResourceLoader::restartNetworkLoad):
30         (WebKit::NetworkResourceLoader::continueWillSendRequest):
31         (WebKit::NetworkResourceLoader::serviceWorkerDidNotHandle):
32
33 2019-11-15  Per Arne Vollan  <pvollan@apple.com>
34
35         [iOS] Fix sysctl-read sandbox violation
36         https://bugs.webkit.org/show_bug.cgi?id=204238
37         <rdar://problem/57198954>
38
39         Reviewed by Brent Fulgham.
40
41         There is missing a rule for reading a specific sysctl property in the WebContent process on iOS.
42
43         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
44
45 2019-11-15  Benjamin Nham  <nham@apple.com>
46
47         Add SPI to clear web process cache
48         https://bugs.webkit.org/show_bug.cgi?id=204210
49
50         Reviewed by Chris Dumez.
51
52         This adds an SPI to clear cached web processes. The intended use case is to add a lukewarm mode to
53         Mac PLT5 in which web pages load in a new WebProcess and load resources from the disk cache.
54
55         * UIProcess/API/Cocoa/WKProcessPool.mm:
56         (-[WKProcessPool _clearWebProcessCache]):
57         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
58         (-[WKProcessPool _clearWebProcessCache]):
59
60 2019-11-15  Per Arne Vollan  <pvollan@apple.com>
61
62         [iOS] Fix sandbox violation in the WebContent process related to WebRTC audio captures
63         https://bugs.webkit.org/show_bug.cgi?id=204240
64         <rdar://problem/57170333>
65
66         Reviewed by Brent Fulgham.
67
68         The WebContent process needs access to read a new audio related preference domain.
69
70         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
71
72 2019-11-15  Alex Christensen  <achristensen@webkit.org>
73
74         Reduce structure copies when creating an API::FrameInfo
75         https://bugs.webkit.org/show_bug.cgi?id=204199
76
77         Reviewed by Brady Eidson.
78
79         Use WTFMove and references where possible.  This is cleanup needed for a future patch.
80
81         * Shared/FrameInfoData.cpp:
82         (WebKit::FrameInfoData::decode):
83         * Shared/FrameInfoData.h:
84         * UIProcess/API/APIFrameInfo.cpp:
85         (API::FrameInfo::create):
86         (API::FrameInfo::FrameInfo):
87         (API::FrameInfo::~FrameInfo): Deleted.
88         (API::FrameInfo::clearPage): Deleted.
89         * UIProcess/API/APIFrameInfo.h:
90         * UIProcess/API/APINavigationClient.h:
91         (API::NavigationClient::didFailProvisionalLoadInSubframeWithError):
92         * UIProcess/API/APIUIClient.h:
93         (API::UIClient::runJavaScriptAlert):
94         (API::UIClient::runJavaScriptConfirm):
95         (API::UIClient::runJavaScriptPrompt):
96         (API::UIClient::runBeforeUnloadConfirmPanel):
97         (API::UIClient::runOpenPanel):
98         (API::UIClient::runWebAuthenticationPanel):
99         * UIProcess/API/C/WKFrame.cpp:
100         (WKFrameCreateFrameInfo):
101         * UIProcess/API/C/WKPage.cpp:
102         (WKPageSetPageUIClient):
103         (WKPageSetPageNavigationClient):
104         * UIProcess/API/Cocoa/WKFrameInfo.mm:
105         (-[WKFrameInfo webView]):
106         * UIProcess/API/Cocoa/WKUserContentController.mm:
107         * UIProcess/Cocoa/NavigationState.h:
108         * UIProcess/Cocoa/NavigationState.mm:
109         (WebKit::NavigationState::NavigationClient::didFailProvisionalLoadInSubframeWithError):
110         * UIProcess/Cocoa/UIDelegate.h:
111         * UIProcess/Cocoa/UIDelegate.mm:
112         (WebKit::UIDelegate::UIClient::runJavaScriptAlert):
113         (WebKit::UIDelegate::UIClient::runJavaScriptConfirm):
114         (WebKit::UIDelegate::UIClient::runJavaScriptPrompt):
115         (WebKit::UIDelegate::UIClient::decidePolicyForGeolocationPermissionRequest):
116         (WebKit::UIDelegate::UIClient::runBeforeUnloadConfirmPanel):
117         (WebKit::UIDelegate::UIClient::runOpenPanel):
118         (WebKit::UIDelegate::UIClient::runWebAuthenticationPanel):
119         * UIProcess/ProvisionalPageProxy.cpp:
120         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
121         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
122         * UIProcess/ProvisionalPageProxy.h:
123         * UIProcess/UserContent/WebScriptMessageHandler.h:
124         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
125         (WebKit::WebUserContentControllerProxy::didPostMessage):
126         * UIProcess/UserContent/WebUserContentControllerProxy.h:
127         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
128         (WebKit::AuthenticatorManager::runPanel):
129         * UIProcess/WebPageProxy.cpp:
130         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
131         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
132         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
133         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
134         (WebKit::WebPageProxy::decidePolicyForResponse):
135         (WebKit::WebPageProxy::decidePolicyForResponseShared):
136         (WebKit::WebPageProxy::createNewPage):
137         (WebKit::WebPageProxy::runJavaScriptAlert):
138         (WebKit::WebPageProxy::runJavaScriptConfirm):
139         (WebKit::WebPageProxy::runJavaScriptPrompt):
140         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
141         (WebKit::WebPageProxy::runOpenPanel):
142         * UIProcess/WebPageProxy.h:
143
144 2019-11-15  Chris Dumez  <cdumez@apple.com>
145
146         Regression(r244361) iOS: Layout test http/tests/quicklook/rtf-document-domain-is-empty-string.html is crashing
147         https://bugs.webkit.org/show_bug.cgi?id=204205
148         <rdar://problem/51864314>
149
150         Reviewed by Alex Christensen.
151
152         In this test, NSHTMLWriter ends up creating a WebArchive providing file:///index.html as URL. The page's script
153         then calls document.open(), which triggers a DidExplicitOpenForFrame() IPC to the UIProcess with this URL.
154         This trips our MESSAGE_CHECK_URL() check in the UIProcess when this path is not within the WebContent process'
155         sandbox, and we kill the WebContent process. To address the issue, this patch replaces the MESSAGE_CHECK_URL()
156         with an if check and an early return so that we ignore the IPC if the URL does not make sense, without actually
157         terminating the WebContent process.
158
159         * UIProcess/WebPageProxy.cpp:
160         (WebKit::WebPageProxy::didExplicitOpenForFrame):
161
162 2019-11-12  Youenn Fablet  <youenn@apple.com>
163
164         Update libwebrtc to M78
165         https://bugs.webkit.org/show_bug.cgi?id=203897
166
167         Reviewed by Eric Carlson.
168
169         Update include paths.
170         Update according API change to client TCP socket creation and network monitor.
171
172         * NetworkProcess/webrtc/LibWebRTCSocketClient.h:
173         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
174         (WebKit::NetworkRTCProvider::createClientTCPSocket):
175         * NetworkProcess/webrtc/NetworkRTCProvider.h:
176         * NetworkProcess/webrtc/NetworkRTCProvider.mm:
177         * NetworkProcess/webrtc/NetworkRTCSocket.h:
178         * Shared/RTCPacketOptions.h:
179         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
180         (WebKit::RTCSocketFactory::CreateClientTcpSocket):
181         * WebProcess/Network/webrtc/LibWebRTCResolver.h:
182         * WebProcess/Network/webrtc/LibWebRTCSocket.h:
183         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
184         (WebKit::LibWebRTCSocketFactory::createClientTcpSocket):
185         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
186         * WebProcess/Network/webrtc/WebRTCMonitor.cpp:
187         * WebProcess/Network/webrtc/WebRTCMonitor.h:
188
189 2019-11-14  Alex Christensen  <achristensen@webkit.org>
190
191         Make NetworkResourceLoader::didReceiveResponse more straightforward after r244700
192         https://bugs.webkit.org/show_bug.cgi?id=204134
193
194         Reviewed by Youenn Fablet.
195
196         If m_isKeptAlive is true, we do not want to receive any HTTP body.
197         Rather than storing the CompletionHandler and relying on the destructor to call it, just call it.
198
199         No change in behavior.
200
201         * NetworkProcess/NetworkResourceLoader.cpp:
202         (WebKit::NetworkResourceLoader::didReceiveResponse):
203
204 >>>>>>> .r252470
205 2019-11-14  Chris Dumez  <cdumez@apple.com>
206
207         [iOS] Crash under WebProcess::processTaskStateDidChange(WebKit::ProcessTaskStateObserver::TaskState)
208         https://bugs.webkit.org/show_bug.cgi?id=204177
209
210         Reviewed by Jer Noble.
211
212         Delay creating the ProcessTaskStateObserver until the WebProcess's connection to its parent had been
213         initialized. This is necessary because ProcessTaskStateObserver may call WebProcess::processTaskStateDidChange()
214         on a background thread, which will deference the IPC connection.
215
216         * WebProcess/WebProcess.cpp:
217         (WebKit::m_webSQLiteDatabaseTracker):
218         (WebKit::WebProcess::~WebProcess):
219         (WebKit::WebProcess::initializeConnection):
220         (WebKit::m_taskStateObserver): Deleted.
221         * WebProcess/WebProcess.h:
222
223 2019-11-14  Brady Eidson  <beidson@apple.com>
224
225         Summary: WKWebView is missing an equivalent to WebKit 1's API to set the media style.
226         <rdar://problem/49862107> and https://bugs.webkit.org/show_bug.cgi?id=203974
227
228         Reviewed by Alex Christensen.
229
230         Covered by new API test.
231
232         This is basically:
233         - Expose a read/write property on WKWebView.
234         - Pipe the new media type to the WebProcess.
235         - Force a style recalc.
236
237         * UIProcess/API/Cocoa/WKWebView.h:
238         * UIProcess/API/Cocoa/WKWebView.mm:
239         (-[WKWebView setMediaType:]):
240         (-[WKWebView mediaType]):
241         
242         * UIProcess/WebPageProxy.cpp:
243         (WebKit::WebPageProxy::setOverriddenMediaType):
244         * UIProcess/WebPageProxy.h:
245         (WebKit::WebPageProxy::overriddenMediaType const):
246         
247         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
248         (WebKit::WebFrameLoaderClient::overrideMediaType const):
249         
250         * WebProcess/WebPage/WebPage.cpp:
251         (WebKit::WebPage::setOverriddenMediaType):
252         * WebProcess/WebPage/WebPage.h:
253         (WebKit::WebPage::overriddenMediaType const):
254         * WebProcess/WebPage/WebPage.messages.in:
255
256 2019-11-14  Brady Eidson  <beidson@apple.com>
257
258         pageZoom/setPageZoom: should not be in a Mac-only part of WKWebView.mm
259         https://bugs.webkit.org/show_bug.cgi?id=204128
260
261         Reviewed by Alex Christensen.
262
263         * UIProcess/API/Cocoa/WKWebView.mm:
264         (-[WKWebView setPageZoom:]):
265         (-[WKWebView pageZoom]):
266
267 2019-11-13  Per Arne Vollan  <pvollan@apple.com>
268
269         REGRESSION: WKWebView navigation fails when navigating from about:blank
270         https://bugs.webkit.org/show_bug.cgi?id=203852
271         <rdar://problem/56973112>
272
273         Reviewed by Brent Fulgham.
274
275         Previously, WebPageProxy::loadFile would unconditionally create a sandbox extension for the resource directory URL. Currently,
276         this method is calling WebPageProxy::maybeInitializeSandboxExtension to create a sandbox extension if needed. The sandbox
277         extension for the resource URL is not created if the WebContent process already has assumed access to the resource URL, which
278         is the case when loading the same file for the second time. The sandbox extension still needs to be issued in this case, since
279         the WebContent process is revoking its extension when the load is done. This patch restore the original behaviour by adding a
280         flag to WebPageProxy::maybeInitializeSandboxExtension to indicate whether the method should check if the process already has
281         assumed access.
282
283         API test: WKWebView.LoadRelativeFileURL
284
285         * UIProcess/WebPageProxy.cpp:
286         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
287         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
288         (WebKit::WebPageProxy::loadFile):
289         * UIProcess/WebPageProxy.h:
290         * UIProcess/WebProcessProxy.cpp:
291         (WebKit::WebProcessProxy::shouldSendPendingMessage):
292         * WebProcess/WebPage/WebPage.cpp:
293         (WebKit::WebPage::loadRequestWaitingForProcessLaunch):
294         (WebKit::WebPage::loadRequestWaitingForPID): Deleted.
295         * WebProcess/WebPage/WebPage.h:
296         * WebProcess/WebPage/WebPage.messages.in:
297
298 2019-11-13  Myles C. Maxfield  <mmaxfield@apple.com>
299
300         [Mac] Fix build
301         https://bugs.webkit.org/show_bug.cgi?id=204136
302
303         Reviewed by Alex Christensen.
304
305         Remove deprecation warnings.
306
307         * PluginProcess/mac/PluginProcessMac.mm:
308         (WebKit::replacedNSWorkspace_launchApplicationAtURL_options_configuration_error):
309         (WebKit::initializeCocoaOverrides):
310         * UIProcess/API/Cocoa/WKWebView.mm:
311         (-[WKWebView changeFont:]):
312         (-[WKWebView changeColor:]):
313         (-[WKWebView view:stringForToolTip:point:userData:]):
314         (-[WKWebView pasteboardChangedOwner:]):
315         (-[WKWebView pasteboard:provideDataForType:]):
316         * UIProcess/API/mac/WKView.mm:
317         (-[WKView changeFont:]):
318         (-[WKView view:stringForToolTip:point:userData:]):
319         (-[WKView pasteboardChangedOwner:]):
320         (-[WKView pasteboard:provideDataForType:]):
321         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
322         (WebKit::PluginProcessProxy::launchApplicationAtURL):
323         (WebKit::PluginProcessProxy::openFile):
324         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
325         (-[WKDataListSuggestionView setBackgroundStyle:]):
326         * UIProcess/mac/WebPageProxyMac.mm:
327         (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication):
328         (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication):
329
330 2019-11-13  Megan Gardner  <megan_gardner@apple.com>
331
332         Cleanup old UIKit Staging
333         https://bugs.webkit.org/show_bug.cgi?id=204130
334
335         Reviewed by Wenson Hsieh.
336
337         Not new tests - linking only.
338
339         * Platform/spi/ios/UIKitSPI.h:
340
341         Removing old staging code that should be unnecessary now. 
342
343 2019-11-13  Per Arne Vollan  <pvollan@apple.com>
344
345         [iOS] Cannot open camera from websites
346         https://bugs.webkit.org/show_bug.cgi?id=204168
347         <rdar://problem/57138788>
348
349         Reviewed by Jer Noble.
350
351         The sandbox is blocking a required service.
352
353         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
354
355 2019-11-13  Benjamin Nham  <nham@apple.com>
356
357         VeryHigh priority loads are actually loading at VeryLow priority
358         https://bugs.webkit.org/show_bug.cgi?id=203423
359         <rdar://problem/56621789>
360
361         Reviewed by Antti Koivisto.
362
363         There are two issues with the way we translate ResourceLoadPriority to
364         CFURLRequestPriority:
365
366         1. We call _CFNetworkHTTPConnectionCacheSetLimit and set 1 too few
367         priority levels. This means VeryHigh priority loads are actually out
368         of bounds, which causes CFNetwork to set the priority level back to 0
369         in HTTPConnectionCacheEntry::_prepareNewRequest. After this patch we'll
370         call _CFNetworkHTTPConnectionCacheSetLimit with the correct number of
371         levels.
372
373         2. _CFNetworkHTTPConnectionCacheSetLimit doesn't work for NSURLSession
374         right now (<rdar://problem/56621205>), so we have to map to the default
375         number of CFURLRequestPriority levels, which is 4. Right now we have 5
376         ResourceLoadPriority levels, so there will be some aliasing involved.
377         After this patch VeryLow gets a priority of -1 and Low gets a priority
378         of 0, but due to the aforementioned clamping behavior both VeryLow and
379         Low will effectively both have a CFURLRequestPriority of 0.
380
381         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
382         (WebKit::initializeNetworkSettings):
383
384 2019-11-13  Youenn Fablet  <youenn@apple.com>
385
386         Remove timer to stop service worker process
387         https://bugs.webkit.org/show_bug.cgi?id=204118
388
389         Reviewed by Alex Christensen.
390
391         Removal of a timer that is never get activated.
392         No change of behavior.
393
394         * UIProcess/WebProcessPool.cpp:
395         (WebKit::WebProcessPool::createNewWebProcess):
396         * UIProcess/WebProcessPool.h:
397
398 2019-11-13  Youenn Fablet  <youenn@apple.com>
399
400         Take service worker assertions based on client processes assertion states
401         https://bugs.webkit.org/show_bug.cgi?id=204119
402
403         Reviewed by Chris Dumez.
404
405         Compute in network process which processes contain clients for service workers of a given process.
406         WebSWServerConnection implements it and sends update to UIProcess/WebProcessProxy.
407         WebProcessProxy keeps for each service worker process a set of client web processes.
408         WebProcessProxy now computes the service worker process assertion based on this set.
409
410         Add some private APIs to set process assertions/get service worker process assertion states.
411         Covered by new API test.
412
413         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
414         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
415         (WebKit::WebSWServerConnection::unregisterServiceWorkerClient):
416         (WebKit::WebSWServerConnection::contextConnectionCreated):
417         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
418         (WebKit::WebSWServerToContextConnection::webProcessIdentifier const):
419         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
420         * UIProcess/API/Cocoa/WKWebView.mm:
421         (-[WKWebView _setAssertionStateForTesting:]):
422         (-[WKWebView _hasServiceWorkerBackgroundActivityForTesting]):
423         (-[WKWebView _hasServiceWorkerForegroundActivityForTesting]):
424         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
425         * UIProcess/Network/NetworkProcessProxy.cpp:
426         (WebKit::NetworkProcessProxy::registerWebProcessToServiceWorkerProcess):
427         (WebKit::NetworkProcessProxy::unregisterWebProcessToServiceWorkerProcess):
428         * UIProcess/Network/NetworkProcessProxy.h:
429         * UIProcess/Network/NetworkProcessProxy.messages.in:
430         * UIProcess/WebProcessPool.cpp:
431         (WebKit::WebProcessPool::updateProcessAssertions):
432         (WebKit::WebProcessPool::hasServiceWorkerForegroundActivityForTesting const):
433         (WebKit::WebProcessPool::hasServiceWorkerBackgroundActivityForTesting const):
434         * UIProcess/WebProcessPool.h:
435         * UIProcess/WebProcessProxy.cpp:
436         (WebKit::WebProcessProxy::updateServiceWorkerProcessAssertion):
437         (WebKit::WebProcessProxy::registerWebProcessToServiceWorkerProcess):
438         (WebKit::WebProcessProxy::unregisterWebProcessToServiceWorkerProcess):
439         (WebKit::WebProcessProxy::hasServiceWorkerForegroundActivityForTesting const):
440         (WebKit::WebProcessProxy::hasServiceWorkerBackgroundActivityForTesting const):
441         * UIProcess/WebProcessProxy.h:
442         (WebKit::WebProcessProxy::setAssertionStateForTesting):
443
444 2019-11-13  Andres Gonzalez  <andresg_22@apple.com>
445
446         AXObjectCache::rootObject should generate the isolated tree.
447         https://bugs.webkit.org/show_bug.cgi?id=204131
448
449         Reviewed by Chris Fleizach.
450
451         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h:
452         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
453         (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
454         (-[WKAccessibilityWebPageObjectBase clientSupportsIsolatedTree]): Became a member of AXObjectCache.
455         (-[WKAccessibilityWebPageObjectBase isolatedTreeRootObject]): Deleted.
456         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
457         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
458
459 2019-11-13  Youenn Fablet  <youenn@apple.com>
460
461         [ iOS ]: Layout Test http/tests/IndexedDB/storage-limit-1.https.html is a Flaky Failure
462         https://bugs.webkit.org/show_bug.cgi?id=203275
463         <rdar://problem/56516249>
464
465         Reviewed by Alex Christensen.
466
467         Fix flakiness by clearing the storage of each cache when the cache is being cleared.
468         This ensures that the storage salt gets recreated if needed.
469
470         To further improve repeatability, make sure that initialize based tasks happen after clear tasks are complete.
471         For that purpose, add a clear task counter and append initialize callbacks to a Vector if counter is not zero.
472         Increment counter at clear task creation and decrement counter at completion time.
473         If counter is back to 0, we can safely process the pending clear tasks.
474
475         Covered by unflaked test.
476
477         * NetworkProcess/cache/CacheStorageEngine.cpp:
478         (WebKit::CacheStorage::Engine::~Engine):
479         (WebKit::CacheStorage::Engine::initialize):
480         (WebKit::CacheStorage::CompletionHandler<void):
481         (WebKit::CacheStorage::Engine::clearAllCaches):
482         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
483         * NetworkProcess/cache/CacheStorageEngine.h:
484         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
485         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
486
487 2019-11-13  Chris Dumez  <cdumez@apple.com>
488
489         Rollout(r251358) Causes load hangs
490         https://bugs.webkit.org/show_bug.cgi?id=204158
491         <rdar://problem/57120002>
492
493         Unreviewed, revert r251358 because it causes load hangs.
494
495         * Platform/spi/Cocoa/SecItemSPI.h: Removed.
496         * Shared/mac/SecItemRequestData.cpp:
497         (WebKit::SecItemRequestData::decode):
498         * Shared/mac/SecItemRequestData.h:
499         * WebKit.xcodeproj/project.pbxproj:
500
501 2019-11-13  Philippe Normand  <pnormand@igalia.com>
502
503         Unreviewed, fix build for ServiceWorkers disabled
504
505         * UIProcess/WebProcessProxy.cpp:
506         (WebKit::WebProcessProxy::enableServiceWorkers):
507
508 2019-11-13  Rob Buis  <rbuis@igalia.com>
509
510         Support stale-while-revalidate cache strategy
511         https://bugs.webkit.org/show_bug.cgi?id=201461
512
513         Reviewed by Youenn Fablet.
514
515         Add a new UseDecision value AsyncRevalidate for async revalidation. This is used
516         when the retrieved cache entry is a stale-while-revalidate response [1].
517         In case of AsyncRevalidate, a check is made to see if there is a
518         current async revalidation ongoing for the entry, if not one is
519         started. Regardless, the stale entry is returned, until either the
520         async revalidation ends successfully or at the moment when the
521         response expires for real.
522
523         [1] https://fetch.spec.whatwg.org/#concept-stale-while-revalidate-response
524
525         * NetworkProcess/NetworkSession.cpp:
526         (WebKit::NetworkSession::NetworkSession):
527         * NetworkProcess/NetworkSession.h:
528         (WebKit::NetworkSession::isStaleWhileRevalidateEnabled const):
529         * NetworkProcess/NetworkSessionCreationParameters.cpp:
530         (WebKit::NetworkSessionCreationParameters::encode const):
531         (WebKit::NetworkSessionCreationParameters::decode):
532         * NetworkProcess/NetworkSessionCreationParameters.h:
533         * NetworkProcess/cache/AsyncRevalidation.cpp: Added.
534         (WebKit::NetworkCache::constructRevalidationRequest):
535         (WebKit::NetworkCache::AsyncRevalidation::staleWhileRevalidateEnding):
536         (WebKit::NetworkCache::AsyncRevalidation::AsyncRevalidation):
537         * NetworkProcess/cache/AsyncRevalidation.h: Added.
538         (WebKit::NetworkCache::AsyncRevalidation::load const):
539         * NetworkProcess/cache/NetworkCache.cpp:
540         (WebKit::NetworkCache::responseNeedsRevalidation):
541         (WebKit::NetworkCache::makeUseDecision):
542         (WebKit::NetworkCache::makeStoreDecision):
543         (WebKit::NetworkCache::Cache::startAsyncRevalidationIfNeeded):
544         (WebKit::NetworkCache::Cache::retrieve):
545         (WebKit::NetworkCache::responseHasExpired): Deleted.
546         * NetworkProcess/cache/NetworkCache.h:
547         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
548         (WebKit::NetworkCache::dumpHTTPHeadersDiff):
549         (WebKit::NetworkCache::requestsHeadersMatch):
550         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
551         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
552         (WebKit::NetworkCache::dumpHTTPHeadersDiff): Deleted.
553         (WebKit::NetworkCache::requestsHeadersMatch): Deleted.
554         * Sources.txt:
555         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.cpp:
556         (WKWebsiteDataStoreConfigurationGetStaleWhileRevalidateEnabled):
557         (WKWebsiteDataStoreConfigurationSetStaleWhileRevalidateEnabled):
558         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.h:
559         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
560         (WebKit::WebsiteDataStore::parameters):
561         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
562         (WebKit::WebsiteDataStoreConfiguration::copy const):
563         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
564         (WebKit::WebsiteDataStoreConfiguration::staleWhileRevalidateEnabled const):
565         (WebKit::WebsiteDataStoreConfiguration::setStaleWhileRevalidateEnabled):
566         * WebKit.xcodeproj/project.pbxproj:
567
568 2019-11-12  Simon Fraser  <simon.fraser@apple.com>
569
570         Convert CSSPrimitiveValue::UnitType to an enum class, and cleanup
571         https://bugs.webkit.org/show_bug.cgi?id=204101
572
573         Reviewed by Antti Koivisto.
574
575         Move CSSPrimitiveValue::UnitType to a standalone enum class CSSUnitType, and
576         CSSPrimitiveVallue::UnitCategory to CSSUnitCategory; these are going to more extensive
577         use in calc() and in the CSS OM.
578
579         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
580         (WebKit::PDFPluginAnnotation::updateGeometry):
581         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
582         (WebKit::PDFPluginChoiceAnnotation::updateGeometry):
583         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
584         (WebKit::PDFPluginTextAnnotation::updateGeometry):
585
586 2019-11-12  Sihui Liu  <sihui_liu@apple.com>
587
588         Add size file for CacheStorage
589         https://bugs.webkit.org/show_bug.cgi?id=204027
590         <rdar://problem/57100861>
591
592         Reviewed by Youenn Fablet.
593
594         Keep the CacheStorage size in a separate file so that we can get that value without waiting for Engine to 
595         initialize and read caches from disk.
596
597         No behavior change as the file is not in use now.
598
599         * NetworkProcess/cache/CacheStorageEngine.cpp:
600         (WebKit::CacheStorage::Engine::writeSizeFile):
601         (WebKit::CacheStorage::Engine::readSizeFile):
602         (WebKit::CacheStorage::Engine::clearAllCachesFromDisk):
603         (WebKit::CacheStorage::Engine::deleteDirectoryRecursivelyOnBackgroundThread):
604         * NetworkProcess/cache/CacheStorageEngine.h:
605         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
606         (WebKit::CacheStorage::Caches::cachesSizeFilename):
607         (WebKit::CacheStorage::Caches::updateSizeFile):
608         (WebKit::CacheStorage::Caches::initializeSize):
609         (WebKit::CacheStorage::Caches::writeRecord):
610         (WebKit::CacheStorage::Caches::removeRecord):
611         (WebKit::CacheStorage::Caches::resetSpaceUsed):
612         * NetworkProcess/cache/CacheStorageEngineCaches.h:
613
614 2019-11-12  Wenson Hsieh  <wenson_hsieh@apple.com>
615
616         [iOS] WKWebView does not respect system spellchecking preference
617         https://bugs.webkit.org/show_bug.cgi?id=204100
618         <rdar://problem/56653808>
619
620         Reviewed by Tim Horton.
621
622         Implements a platform hook on iOS (-setContinuousSpellCheckingEnabled:) to allow UIKit to inform us when the
623         system spellchecking preference changes, and adds logic to propagate these changes to the web process. See below
624         for more details.
625
626         Test: editing/spelling/toggle-spellchecking.html
627
628         * UIProcess/API/Cocoa/WKWebView.mm:
629         (-[WKWebView _setContinuousSpellCheckingEnabledForTesting:]):
630         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
631
632         Add testing SPI to enable or disable continuous spellchecking, for both iOS and macOS.
633
634         * UIProcess/Cocoa/WebViewImpl.h:
635         * UIProcess/Cocoa/WebViewImpl.mm:
636         (WebKit::WebViewImpl::setContinuousSpellCheckingEnabled):
637         * UIProcess/TextChecker.h:
638         * UIProcess/gtk/TextCheckerGtk.cpp:
639         (WebKit::TextChecker::setContinuousSpellCheckingEnabled):
640         * UIProcess/ios/TextCheckerIOS.mm:
641         (WebKit::TextChecker::setContinuousSpellCheckingEnabled):
642         * UIProcess/ios/WKContentViewInteraction.h:
643         * UIProcess/ios/WKContentViewInteraction.mm:
644         (-[WKContentView setupInteraction]):
645         (-[WKContentView setContinuousSpellCheckingEnabled:]):
646
647         Implement this method to handle changes to the system spellchecking preference. This hook is also used by legacy
648         WebKit on iOS to turn spellchecking on or off. If the value of the preference changed, we additionally notify
649         the web process. In the future, we should consider refactoring TextCheckerState to be per-web view and per-page,
650         since Cocoa platform APIs would allow for different WKWebViews to have different spell checking preferences.
651
652         * UIProcess/mac/TextCheckerMac.mm:
653         (WebKit::TextChecker::setContinuousSpellCheckingEnabled):
654         * UIProcess/win/TextCheckerWin.cpp:
655         (WebKit::TextChecker::setContinuousSpellCheckingEnabled):
656         * UIProcess/wpe/TextCheckerWPE.cpp:
657         (WebKit::TextChecker::setContinuousSpellCheckingEnabled):
658
659         Adjusted setContinuousSpellCheckingEnabled to return whether or not the continuous spellchecking state changed.
660
661 2019-11-12  Truitt Savell  <tsavell@apple.com>
662
663         Unreviewed, rolling out r252351.
664
665         casued 50+ crashes on Mac and iOS wk2 debug
666
667         Reverted changeset:
668
669         "Add size file for CacheStorage"
670         https://bugs.webkit.org/show_bug.cgi?id=204027
671         https://trac.webkit.org/changeset/252351
672
673 2019-11-12  Alex Christensen  <achristensen@webkit.org>
674
675         Revert remainder of r251676
676         https://bugs.webkit.org/show_bug.cgi?id=203066
677         <rdar://problem/57115922>
678
679         * NetworkProcess/NetworkProcessCreationParameters.cpp:
680         (WebKit::NetworkProcessCreationParameters::encode const):
681         (WebKit::NetworkProcessCreationParameters::decode):
682         * NetworkProcess/NetworkProcessCreationParameters.h:
683         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
684         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
685         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
686         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
687         (WebKit::globalCTDataConnectionServiceType):
688         (WebKit::NetworkSessionCocoa::setCTDataConnectionServiceType):
689         (WebKit::NetworkSessionCocoa::dataConnectionServiceType const):
690         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
691         * UIProcess/API/APIProcessPoolConfiguration.h:
692         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
693         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
694         (-[_WKProcessPoolConfiguration CTDataConnectionServiceType]):
695         (-[_WKProcessPoolConfiguration setCTDataConnectionServiceType:]):
696         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
697         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
698         * UIProcess/ios/WebPageProxyIOS.mm:
699         (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType):
700
701 2019-11-12  Megan Gardner  <megan_gardner@apple.com>
702
703         Rename _textSelectionAssistant to _textInteractionAssistant to reflect the only class it can now represent
704         https://bugs.webkit.org/show_bug.cgi?id=204103
705
706         Reviewed by Wenson Hsieh.
707
708         No new tests - rename only.
709
710         Now that UIWKSelectionAssistant is no longer, the _textSelectionAssistant can only be a
711         UIWKTextInteractionAssistant. There is enough confusion around all the selection and 
712         interaction assistants, renaming this should alleviate some of that confusion.
713
714         * UIProcess/ios/WKContentView.mm:
715         (-[WKContentView _didExitStableState]):
716         * UIProcess/ios/WKContentViewInteraction.h:
717         * UIProcess/ios/WKContentViewInteraction.mm:
718         (-[WKContentView cleanupInteraction]):
719         (-[WKContentView becomeFirstResponderForWebView]):
720         (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]):
721         (-[WKContentView _scrollingNodeScrollingWillBegin]):
722         (-[WKContentView _scrollingNodeScrollingDidEnd]):
723         (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]):
724         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
725         (-[WKContentView _uiTextSelectionRects]):
726         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
727         (-[WKContentView setUpTextSelectionAssistant]):
728         (-[WKContentView _willStartScrollingOrZooming]):
729         (-[WKContentView _didEndScrollingOrZooming]):
730         (-[WKContentView _lookupForWebView:]):
731         (-[WKContentView _shareForWebView:]):
732         (-[WKContentView _addShortcutForWebView:]):
733         (-[WKContentView _promptForReplaceForWebView:]):
734         (-[WKContentView _transliterateChineseForWebView:]):
735         (-[WKContentView tintColorDidChange]):
736         (-[WKContentView _didHideMenu:]):
737         (-[WKContentView selectForWebView:]):
738         (-[WKContentView selectAllForWebView:]):
739         (-[WKContentView _showTextStyleOptionsForWebView:]):
740         (-[WKContentView _showDictionary:]):
741         (-[WKContentView interactionAssistant]):
742         (-[WKContentView _showKeyboard]):
743         (-[WKContentView _hideKeyboard]):
744         (-[WKContentView _updateChangedSelection:]):
745         (-[WKContentView _startSuppressingSelectionAssistantForReason:]):
746         (-[WKContentView _stopSuppressingSelectionAssistantForReason:]):
747         (-[WKContentView _restoreCalloutBarIfNeeded]):
748         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
749
750 2019-11-12  Carlos Alberto Lopez Perez  <clopez@igalia.com>
751
752         [GTK][WPE] Support Pointer Events
753         https://bugs.webkit.org/show_bug.cgi?id=202789
754
755         Reviewed by Carlos Garcia Campos.
756
757         Covered by existing tests.
758
759         * UIProcess/PageClient.h: Add a ifdef for platform COCOA on two
760         function declarations that depend on the UIGestureRecognizer ObjC type.
761         This is not needed for GTK/WPE code.
762
763 2019-11-12  Alex Christensen  <achristensen@webkit.org>
764
765         Revert part of r251676
766         https://bugs.webkit.org/show_bug.cgi?id=203066
767         <rdar://problem/57008444>
768
769         * NetworkProcess/NetworkProcess.h:
770         (WebKit::NetworkProcess::suppressesConnectionTerminationOnSystemChange const):
771         * NetworkProcess/NetworkProcessCreationParameters.cpp:
772         (WebKit::NetworkProcessCreationParameters::encode const):
773         (WebKit::NetworkProcessCreationParameters::decode):
774         * NetworkProcess/NetworkProcessCreationParameters.h:
775         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
776         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
777         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
778         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
779         * UIProcess/API/APIProcessPoolConfiguration.cpp:
780         (API::ProcessPoolConfiguration::copy):
781         * UIProcess/API/APIProcessPoolConfiguration.h:
782         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
783         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
784         (-[_WKProcessPoolConfiguration suppressesConnectionTerminationOnSystemChange]):
785         (-[_WKProcessPoolConfiguration setSuppressesConnectionTerminationOnSystemChange:]):
786         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
787         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
788
789 2019-11-12  Carlos Alberto Lopez Perez  <clopez@igalia.com>
790
791         [GTK][WPE] Enable CSS Painting API
792         https://bugs.webkit.org/show_bug.cgi?id=190710
793
794         Reviewed by Don Olmstead.
795
796         Enable the runtime feature by default on GTK/WPE when building with
797         experimental features enabled.
798
799         Covered by existing tests.
800
801         * Shared/WebPreferences.yaml:
802         * Shared/WebPreferencesDefaultValues.h:
803
804 2019-11-12  Carlos Garcia Campos  <cgarcia@igalia.com>
805
806         [GTK] WebDriver: implement new window command
807         https://bugs.webkit.org/show_bug.cgi?id=203994
808
809         Reviewed by Carlos Alberto Lopez Perez.
810
811         Add new API to support new window command. The WebKitAutomationSession::create-web-view signal can now receive a
812         detail that can be "window" or "tab". Applications can use that to decide whether to add the new webview to a
813         new window or tab. WebKitWebView has a new construct only property automation-presentation-type, which is an
814         enum that can be either window or tab value. Appplications should use the new property when creating the web
815         view for automation to indicate whether the web view was added to a new window or tab.
816
817         * UIProcess/API/glib/WebKitAutomationSession.cpp:
818         (webkit_automation_session_class_init):
819         * UIProcess/API/glib/WebKitWebView.cpp:
820         (webkitWebViewSetProperty):
821         (webkitWebViewGetProperty):
822         (webkit_web_view_class_init):
823         (webkit_web_view_get_automation_presentation_type):
824         * UIProcess/API/gtk/WebKitAutomationSession.h:
825         * UIProcess/API/gtk/WebKitWebView.h:
826         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
827         * UIProcess/API/wpe/WebKitWebView.h:
828         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
829
830 2019-11-12  Carlos Garcia Campos  <cgarcia@igalia.com>
831
832         REGRESSION(r250707): [GTK] UIClient::setWindowFrame only works the first time
833         https://bugs.webkit.org/show_bug.cgi?id=204068
834
835         Reviewed by Adrian Perez de Castro.
836
837         This is because we are connecting to configure-event of parent window, but not returning FALSE from the callback
838         to propagate the event.
839
840         * UIProcess/API/glib/WebKitUIClient.cpp:
841         (UIClient::windowConfigureEventCallback): Make it boolean and return FALSE.
842
843 2019-11-11  Alex Christensen  <achristensen@webkit.org>
844
845         Add SPI to access a WebsiteDataStore without instantiating it, and its configuration
846         https://bugs.webkit.org/show_bug.cgi?id=204089
847
848         Reviewed by Tim Horton.
849
850         Calling WKWebViewConfiguration.websiteDataStore instantiates the default data store.
851         We need a way to query if it has been set but not instantiate anything if it hasn't.
852         We also need a way to access the configuration used to create a WKWebsiteDataStore like we do with WKWebView.
853         These have been requested to fix <rdar://problem/57091216> and I think they're a good idea in general.
854
855         Covered by API tests.
856
857         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
858         (-[WKWebViewConfiguration _websiteDataStoreIfExists]):
859         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
860         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
861         (-[WKWebsiteDataStore _setDelegate:]):
862         (-[WKWebsiteDataStore set_delegate:]):
863         (-[WKWebsiteDataStore _configuration]):
864         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
865         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
866         (WebKit::WebsiteDataStoreConfiguration::copy const):
867         (WebKit::WebsiteDataStoreConfiguration::copy): Deleted.
868         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
869
870 2019-11-11  Sihui Liu  <sihui_liu@apple.com>
871
872         Add size file for CacheStorage
873         https://bugs.webkit.org/show_bug.cgi?id=204027
874
875         Reviewed by Youenn Fablet.
876
877         Keep the CacheStorage size in a separate file so that we can get that value without waiting for Engine to 
878         initialize and read caches from disk.
879
880         No behavior change as the file is not in use now.
881
882         * NetworkProcess/cache/CacheStorageEngine.cpp:
883         (WebKit::CacheStorage::Engine::writeSizeFile):
884         (WebKit::CacheStorage::Engine::readSizeFile):
885         * NetworkProcess/cache/CacheStorageEngine.h:
886         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
887         (WebKit::CacheStorage::cachesSizeFilename):
888         (WebKit::CacheStorage::Caches::updateSizeFile):
889         (WebKit::CacheStorage::Caches::initializeSize):
890         (WebKit::CacheStorage::Caches::writeRecord):
891         (WebKit::CacheStorage::Caches::removeRecord):
892         (WebKit::CacheStorage::Caches::resetSpaceUsed):
893         * NetworkProcess/cache/CacheStorageEngineCaches.h:
894
895 2019-11-11  Youenn Fablet  <youenn@apple.com>
896
897         Fail cross-origin redirection loads in case of CORS with redirection URLs having credentials
898         https://bugs.webkit.org/show_bug.cgi?id=204036
899
900         Reviewed by Alex Christensen.
901
902         Implement https://fetch.spec.whatwg.org/#http-redirect-fetch steps 7 and 8.
903         Covered by updated tests.
904
905         * NetworkProcess/NetworkLoadChecker.cpp:
906         (WebKit::NetworkLoadChecker::checkRedirection):
907
908 2019-11-11  Per Arne Vollan  <pvollan@apple.com>
909
910         [iOS] Unable to view .pages files
911         https://bugs.webkit.org/show_bug.cgi?id=204076
912         <rdar://problem/57079557>
913
914         Reviewed by Brent Fulgham.
915
916         This is caused by a syscall being blocked by the sandbox. The syscall was previously unused in the
917         WebContent process.
918        
919         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
920
921 2019-11-11  Carlos Garcia Campos  <cgarcia@igalia.com>
922
923         WebDriver: implement proxy support
924         https://bugs.webkit.org/show_bug.cgi?id=180408
925
926         Reviewed by Carlos Alberto Lopez Perez.
927
928         * UIProcess/API/glib/WebKitAutomationSession.cpp:
929         (parseProxyCapabilities): Parse the proxy settings from capabilities.
930         (webkitAutomationSessionCreate): Set the proxy settings received from capabilities.
931
932 2019-11-10  David Kilzer  <ddkilzer@apple.com>
933
934         StorageManagerSet.m_storageAreas should use weak pointers to StorageArea
935         <https://webkit.org/b/204048>
936         <rdar://problem/55342744>
937
938         Reviewed by Geoffrey Garen.
939
940         * NetworkProcess/WebStorage/StorageArea.h:
941         (class WebKit::StorageArea):
942         - Inherit from CanMakeWeakPtr<StorageArea>.
943         * NetworkProcess/WebStorage/StorageManagerSet.cpp:
944         (WebKit::StorageManagerSet::removeConnection):
945         (WebKit::StorageManagerSet::waitUntilSyncingLocalStorageFinished):
946         (WebKit::StorageManagerSet::connectToLocalStorageArea):
947         (WebKit::StorageManagerSet::connectToTransientLocalStorageArea):
948         (WebKit::StorageManagerSet::connectToSessionStorageArea):
949         (WebKit::StorageManagerSet::disconnectFromStorageArea):
950         (WebKit::StorageManagerSet::getValues): Initialize `quotaError`
951         stack value since it is not guaranteed to be set.
952         (WebKit::StorageManagerSet::setItem):
953         (WebKit::StorageManagerSet::removeItem):
954         (WebKit::StorageManagerSet::clear):
955         - Use makeWeakPtr() to add StorageArea pointers to
956           m_storageAreas.
957         - Use `const auto&` to store WeakPtr<StorageArea> values from
958           m_storageAreas.
959         - Add nullptr checks before using WeakPtr<StorageArea> values.
960         * NetworkProcess/WebStorage/StorageManagerSet.h:
961         (WebKit::StorageManagerSet::m_storageAreas):
962         - Use WeakPtr<StorageArea>.
963
964 2019-11-09  Dean Jackson  <dino@apple.com>
965
966         Clicky Orbing support.apple.com categories shows a PNG instead of the web page preview, tapping loads image asset only instead of web page
967         https://bugs.webkit.org/show_bug.cgi?id=204037
968         <rdar://55614939>
969
970         Reviewed by Simon Fraser.
971
972         When Safari adopted the ContextMenu API they began providing a PreviewViewController that
973         showed the image rather than the link, for the case of <a><img></a>.
974
975         This could be fixed in Safari, but I noticed that we actually tell the delegate that the
976         type of the activated element is an image, which is why they treat it as such. It's not
977         clear that because the image also has a link attached, a client should defer to the link.
978
979         Instead, I think it makes more sense to identify this as a link, because that is the more
980         important information in this API.
981
982         While here I also changed the logic to make sure we call the API if both the API and SPI
983         are available.
984
985         New ContextMenus and WKRequestActivatedElementInfo API tests.
986
987         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm: Identify as a link if you have a link.
988         (-[_WKActivatedElementInfo _initWithInteractionInformationAtPosition:userInfo:]):
989         * UIProcess/ios/WKContentViewInteraction.mm: Look for the API before the SPI.
990         (-[WKContentView continueContextMenuInteraction:]):
991
992 2019-11-08  Brady Eidson  <beidson@apple.com>
993
994         WKWebView Find-in-page API.
995         <rdar://problem/46971112> and https://bugs.webkit.org/show_bug.cgi?id=203872
996
997         Reviewed by Tim Horton.
998
999         Covered by API tests.
1000
1001         - Promote _findString:
1002         - Add a completion handler for it.
1003
1004         * SourcesCocoa.txt:
1005         
1006         * UIProcess/API/Cocoa/WKFindConfiguration.h: Added.
1007         * UIProcess/API/Cocoa/WKFindConfiguration.mm: Added.
1008         (-[WKFindConfiguration init]):
1009         (-[WKFindConfiguration copyWithZone:]):
1010
1011         * UIProcess/API/Cocoa/WKFindResult.h: Added.
1012         * UIProcess/API/Cocoa/WKFindResult.mm: Added.
1013         (-[WKFindResult init]):
1014         (-[WKFindResult _initWithMatchFound:]):
1015         (-[WKFindResult copyWithZone:]):
1016         * UIProcess/API/Cocoa/WKFindResultInternal.h: Added.
1017
1018         * UIProcess/API/Cocoa/WKWebView.h:
1019         * UIProcess/API/Cocoa/WKWebView.mm:
1020         (toFindOptions):
1021         (-[WKWebView findString:withConfiguration:completionHandler:]):
1022         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1023
1024         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1025
1026         * UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.h:
1027         * UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm:
1028
1029         * UIProcess/WebPageProxy.cpp:
1030         (WebKit::WebPageProxy::findString):
1031         (WebKit::WebPageProxy::findStringCallback):
1032         * UIProcess/WebPageProxy.h:
1033         * UIProcess/WebPageProxy.messages.in:
1034
1035         * WebKit.xcodeproj/project.pbxproj:
1036
1037         * WebProcess/WebPage/FindController.cpp:
1038         (WebKit::FindController::findString):
1039         * WebProcess/WebPage/FindController.h:
1040
1041         * WebProcess/WebPage/WebPage.cpp:
1042         (WebKit::WebPage::findString):
1043         * WebProcess/WebPage/WebPage.h:
1044         * WebProcess/WebPage/WebPage.messages.in:
1045
1046 2019-11-08  Jiewen Tan  <jiewen_tan@apple.com>
1047
1048         [WebAuthn] Add quirk needed to support legacy Google NFC Titan security keys
1049         https://bugs.webkit.org/show_bug.cgi?id=204024
1050         <rdar://problem/56962320>
1051
1052         Reviewed by Brent Fulgham.
1053
1054         Some legacy U2F keys such as Google T1 Titan don't understand the FIDO applet command. Instead,
1055         they are configured to only have the FIDO applet. Therefore, when the above command fails, we
1056         use U2F_VERSION command to double check if the connected tag can actually speak U2F, indicating
1057         we are interacting with one of these legacy keys.
1058
1059         * UIProcess/WebAuthentication/Cocoa/NfcConnection.mm:
1060         (WebKit::fido::compareVersion):
1061         (WebKit::fido::trySelectFidoApplet):
1062         (WebKit::NfcConnection::transact const):
1063         (WebKit::NfcConnection::didDetectTags):
1064
1065 2019-11-08  Jonathan Bedard  <jbedard@apple.com>
1066
1067         Unreviewed, rolling out r252260.
1068
1069         Breaks half of API tests
1070
1071         Reverted changeset:
1072
1073         "Make DownloadID an ObjectIdentifier"
1074         https://bugs.webkit.org/show_bug.cgi?id=203962
1075         https://trac.webkit.org/changeset/252260
1076
1077 2019-11-08  Antti Koivisto  <antti@apple.com>
1078
1079         Use separate cache directory for development WebKit on Mac
1080         https://bugs.webkit.org/show_bug.cgi?id=204015
1081
1082         Reviewed by Youenn Fablet.
1083
1084         Replace the NetworkCache::lastStableVersion scheme with a completely separate directory.
1085         This way potential bugs in development WebKit can't end up affecting system WebKit cache.
1086         This also removes the need to keep lastStableVersion updated.
1087
1088         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1089         (WebKit::NetworkCache::makeCachePath):
1090
1091         Add '/Development' to cache path if this is not system WebKit.
1092
1093         (WebKit::NetworkCache::Storage::open):
1094         (WebKit::NetworkCache::Storage::deleteOldVersions):
1095
1096         No need to avoid deleting lastStableVersion anymore.
1097
1098         * NetworkProcess/cache/NetworkCacheStorage.h:
1099
1100 2019-11-08  Per Arne Vollan  <pvollan@apple.com>
1101
1102         [macOS] [iOS] Add logging and telemetry to mach lookup rules
1103         https://bugs.webkit.org/show_bug.cgi?id=203999
1104
1105         Reviewed by Brent Fulgham.
1106
1107         Add logging and telemetry to help determine if mach lookups to a set of services can be denied in the WebContent process.
1108
1109         No new tests, since this only adds logging and telemetry.
1110
1111         * WebProcess/com.apple.WebProcess.sb.in:
1112
1113 2019-11-08  Alex Christensen  <achristensen@webkit.org>
1114
1115         Make DownloadID an ObjectIdentifier
1116         https://bugs.webkit.org/show_bug.cgi?id=203962
1117
1118         Reviewed by Youenn Fablet.
1119
1120         Also deprecate the unused WKDownloadGetID because this identifier is internal.
1121
1122         * NetworkProcess/Downloads/Download.cpp:
1123         (WebKit::Download::Download):
1124         (WebKit::Download::didReceiveData):
1125         (WebKit::Download::didFinish):
1126         (WebKit::Download::didFail):
1127         (WebKit::Download::didCancel):
1128         (WebKit::Download::messageSenderDestinationID const):
1129         * NetworkProcess/Downloads/DownloadID.h:
1130         (WebKit::DownloadID::DownloadID): Deleted.
1131         (WebKit::DownloadID::operator== const): Deleted.
1132         (WebKit::DownloadID::operator!= const): Deleted.
1133         (WebKit::DownloadID::downloadID const): Deleted.
1134         (IPC::ArgumentCoder<WebKit::DownloadID>::encode): Deleted.
1135         (IPC::ArgumentCoder<WebKit::DownloadID>::decode): Deleted.
1136         (WTF::DownloadIDHash::hash): Deleted.
1137         (WTF::DownloadIDHash::equal): Deleted.
1138         (WTF::HashTraits<WebKit::DownloadID>::emptyValue): Deleted.
1139         (WTF::HashTraits<WebKit::DownloadID>::constructDeletedValue): Deleted.
1140         (WTF::HashTraits<WebKit::DownloadID>::isDeletedValue): Deleted.
1141         * NetworkProcess/Downloads/DownloadMonitor.cpp:
1142         (WebKit::DownloadMonitor::applicationWillEnterForeground):
1143         (WebKit::DownloadMonitor::applicationDidEnterBackground):
1144         (WebKit::DownloadMonitor::timerFired):
1145         * NetworkProcess/Downloads/PendingDownload.cpp:
1146         (WebKit::PendingDownload::messageSenderDestinationID const):
1147         * NetworkProcess/Downloads/PendingDownload.h:
1148         * NetworkProcess/NetworkDataTask.h:
1149         (WebKit::NetworkDataTask::setPendingDownloadID):
1150         (WebKit::NetworkDataTask::isDownload const):
1151         * NetworkProcess/NetworkProcess.cpp:
1152         (WebKit::NetworkProcess::pendingDownloadCanceled):
1153         (WebKit::NetworkProcess::findPendingDownloadLocation):
1154         * NetworkProcess/NetworkProcess.h:
1155         * NetworkProcess/NetworkResourceLoader.cpp:
1156         (WebKit::NetworkResourceLoader::convertToDownload):
1157         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1158         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
1159         (-[WKNetworkSessionDelegate URLSession:downloadTask:didFinishDownloadingToURL:]):
1160         (-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]):
1161         (WebKit::NetworkSessionCocoa::continueDidReceiveChallenge):
1162         * Scripts/webkit/messages.py:
1163         * Shared/Authentication/AuthenticationManager.h:
1164         * UIProcess/API/C/WKDownload.cpp:
1165         (WKDownloadGetID):
1166         * UIProcess/API/C/WKDownload.h:
1167         * UIProcess/Downloads/DownloadProxy.cpp:
1168         (WebKit::DownloadProxy::DownloadProxy):
1169         (WebKit::generateDownloadID): Deleted.
1170         * UIProcess/Downloads/DownloadProxy.h:
1171         * UIProcess/Downloads/DownloadProxyMap.cpp:
1172         (WebKit::DownloadProxyMap::createDownloadProxy):
1173         (WebKit::DownloadProxyMap::downloadFinished):
1174         (WebKit::DownloadProxyMap::invalidate):
1175         * WebProcess/WebPage/WebFrame.cpp:
1176         (WebKit::WebFrame::startDownload):
1177         (WebKit::WebFrame::convertMainResourceLoadToDownload):
1178         * WebProcess/WebPage/WebFrame.h:
1179         * WebProcess/WebPage/WebPage.h:
1180
1181 2019-11-08  Alex Christensen  <achristensen@webkit.org>
1182
1183         Fix flaky tests in http/tests/cache/disk-cache
1184         https://bugs.webkit.org/show_bug.cgi?id=203822
1185
1186         Reviewed by Youenn Fablet.
1187
1188         Right now tests that set the cache model do so using a race condition.  I think this will fix the flakyness we've observed.
1189
1190         * NetworkProcess/NetworkProcess.cpp:
1191         (WebKit::NetworkProcess::setCacheModelSynchronouslyForTesting):
1192         * NetworkProcess/NetworkProcess.h:
1193         * NetworkProcess/NetworkProcess.messages.in:
1194         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1195         (WKWebsiteDataStoreSetCacheModelSynchronouslyForTesting):
1196         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1197         * UIProcess/WebProcessPool.cpp:
1198         (WebKit::WebProcessPool::setCacheModelSynchronouslyForTesting):
1199         * UIProcess/WebProcessPool.h:
1200         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1201         (WebKit::WebsiteDataStore::setCacheModelSynchronouslyForTesting):
1202         * UIProcess/WebsiteData/WebsiteDataStore.h:
1203
1204 2019-11-08  Alex Christensen  <achristensen@webkit.org>
1205
1206         Revert some changes accidentally committed with r252257
1207         https://bugs.webkit.org/show_bug.cgi?id=202178
1208
1209         * UIProcess/API/C/WKContextPrivate.h:
1210
1211 2019-11-08  Alex Christensen  <achristensen@webkit.org>
1212
1213         Move schemes for SchemeRegistry from WebProcessPool to LegacyGlobalSettings
1214         https://bugs.webkit.org/show_bug.cgi?id=202178
1215
1216         Reviewed by Youenn Fablet.
1217
1218         The current users of the SPI to set these only have one WebProcessPool, so they intend these settings to be global.
1219         Moving them to LegacyGlobalSettings allows me to make a NetworkProcessProxy without a WebProcessPool and not regress existing functionality.
1220         I move only the four sets of schemes needed to launch a NetworkProcess to remove the dependency the NetworkProcess has on the WebProcessPool.
1221
1222         * UIProcess/LegacyGlobalSettings.h:
1223         (WebKit::LegacyGlobalSettings::schemesToRegisterAsSecure):
1224         (WebKit::LegacyGlobalSettings::registerURLSchemeAsSecure):
1225         (WebKit::LegacyGlobalSettings::schemesToRegisterAsBypassingContentSecurityPolicy):
1226         (WebKit::LegacyGlobalSettings::registerURLSchemeAsBypassingContentSecurityPolicy):
1227         (WebKit::LegacyGlobalSettings::schemesToRegisterAsLocal):
1228         (WebKit::LegacyGlobalSettings::registerURLSchemeAsLocal):
1229         (WebKit::LegacyGlobalSettings::schemesToRegisterAsNoAccess):
1230         (WebKit::LegacyGlobalSettings::registerURLSchemeAsNoAccess):
1231         * UIProcess/WebProcessPool.cpp:
1232         (WebKit::WebProcessPool::ensureNetworkProcess):
1233         (WebKit::WebProcessPool::initializeNewWebProcess):
1234         (WebKit::WebProcessPool::registerURLSchemeAsSecure):
1235         (WebKit::WebProcessPool::registerURLSchemeAsBypassingContentSecurityPolicy):
1236         (WebKit::WebProcessPool::registerURLSchemeAsLocal):
1237         (WebKit::WebProcessPool::registerURLSchemeAsNoAccess):
1238         * UIProcess/WebProcessPool.h:
1239
1240 2019-11-08  Daniel Bates  <dabates@apple.com>
1241
1242         Add WebKit Legacy SPI to retrieve editable elements in rect
1243         https://bugs.webkit.org/show_bug.cgi?id=204006
1244         <rdar://problem/57024093>
1245
1246         Reviewed by Wenson Hsieh.
1247
1248         Write WebPage::textInputContextsInRect() in terms of Page::editableElementsInRect().
1249         Also make use of Element::clientRect() instead of elementRectInRootViewCoordinates(),
1250         which duplicates what the former does.
1251
1252         * WebProcess/WebPage/WebPage.cpp:
1253         (WebKit::WebPage::textInputContextsInRect): Write in terms of Page::editableElementsInRect().
1254         (WebKit::WebPage::contextForElement const): Use Element::clientRect() which does what
1255         elementRectInRootViewCoordinates() does.
1256         (WebKit::elementRectInRootViewCoordinates): Deleted.
1257         (WebKit::isEditableTextInputElement): Deleted.
1258
1259 2019-11-06  Jiewen Tan  <jiewen_tan@apple.com>
1260
1261         [WebAuthn] Return NotAllowedError immediately for UI cancellations
1262         https://bugs.webkit.org/show_bug.cgi?id=203937
1263         <rdar://problem/56962420>
1264
1265         Reviewed by Brent Fulgham.
1266
1267         NotAllowedError representing UI cancellations should be returned to sites
1268         immediately such that sites could show appropriate error page immediately.
1269
1270         Covered by existing tests.
1271
1272         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1273         (WebKit::AuthenticatorManager::cancelRequest):
1274         (WebKit::AuthenticatorManager::clearState):
1275         (WebKit::AuthenticatorManager::resetState): Deleted.
1276         * UIProcess/WebAuthentication/AuthenticatorManager.h:
1277
1278 2019-11-08  Carlos Garcia Campos  <cgarcia@igalia.com>
1279
1280         [GTK] Add pointer lock permission request API
1281         https://bugs.webkit.org/show_bug.cgi?id=203896
1282
1283         Reviewed by Adrian Perez de Castro.
1284
1285         Add a WebKitPointerLockPermissionRequest class to handle pointer lock permissions.
1286
1287         * PlatformGTK.cmake:
1288         * SourcesGTK.txt:
1289         * UIProcess/API/glib/WebKitPointerLockPermissionRequest.cpp: Added.
1290         (webkitPointerLockPermissionRequestAllow):
1291         (webkitPointerLockPermissionRequestDeny):
1292         (webkit_permission_request_interface_init):
1293         (webkitPointerLockPermissionRequestDispose):
1294         (webkit_pointer_lock_permission_request_class_init):
1295         (webkitPointerLockPermissionRequestCreate):
1296         (webkitPointerLockPermissionRequestDidLosePointerLock):
1297         * UIProcess/API/glib/WebKitPointerLockPermissionRequestPrivate.h: Added.
1298         * UIProcess/API/glib/WebKitUIClient.cpp:
1299         (UIClient::~UIClient):
1300         * UIProcess/API/glib/WebKitWebView.cpp:
1301         (webkitWebViewPermissionRequest):
1302         (webkitWebViewDenyPointerLockRequest):
1303         * UIProcess/API/glib/WebKitWebViewPrivate.h:
1304         * UIProcess/API/gtk/WebKitPointerLockPermissionRequest.h: Added.
1305         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1306         * UIProcess/API/gtk/docs/webkit2gtk-4.0.types:
1307         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
1308         * UIProcess/API/gtk/webkit2.h:
1309
1310 2019-11-07  Tim Horton  <timothy_horton@apple.com>
1311
1312         Remove an unused icon resource
1313         https://bugs.webkit.org/show_bug.cgi?id=203983
1314
1315         Reviewed by Wenson Hsieh.
1316
1317         * Resources/mac/mediaIcon.pdf: Removed.
1318         * WebKit.xcodeproj/project.pbxproj:
1319         This file has not been used in years.
1320
1321 2019-11-07  Per Arne Vollan  <pvollan@apple.com>
1322
1323         [iOS] Add logging and telemetry to more mach lookup rules
1324         https://bugs.webkit.org/show_bug.cgi?id=203978
1325
1326         Reviewed by Brent Fulgham.
1327
1328         Add logging and telemetry to help determine if mach lookup of these services can be denied in the WebContent process.
1329
1330         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1331
1332 2019-11-07  Alex Christensen  <achristensen@webkit.org>
1333
1334         Re-enable NSURLSession isolation after r252116
1335         https://bugs.webkit.org/show_bug.cgi?id=203934
1336         <rdar://problem/56921584>
1337
1338         Reviewed by Chris Dumez.
1339
1340         r252116 was a rollout of r248640, which introduced cases where data tasks from different NSURLSessions
1341         which can have the same task identifiers were put into the same maps.  This key collision caused data from the wrong
1342         tasks to be sent to NetworkResourceLoader, causing rare and strange loading bugs.  In order to prevent insertion into
1343         wrong maps again, I made a new abstraction, SessionWrapper, which wraps a NSURLSession, its delegate, and all maps
1344         that are scoped to that NSURLSession.  Along the way I found a few other places where we had made similar mistakes.
1345
1346         Covered by an API test which would've failed before r252116 because it exercises the key collision condition,
1347         and by tests which were skipped in r252116 and I now unskipped.
1348
1349         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
1350         (WebKit::Download::resume):
1351         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1352         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1353         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1354         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
1355         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1356         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1357         (-[WKNetworkSessionDelegate initWithSessionWrapper:withCredentials:]):
1358         (-[WKNetworkSessionDelegate sessionInvalidated]):
1359         (-[WKNetworkSessionDelegate existingTask:]):
1360         (-[WKNetworkSessionDelegate sessionCocoa]):
1361         (-[WKNetworkSessionDelegate URLSession:didBecomeInvalidWithError:]):
1362         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
1363         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
1364         (-[WKNetworkSessionDelegate URLSession:dataTask:willCacheResponse:completionHandler:]):
1365         (processServerTrustEvaluation):
1366         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
1367         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
1368         (-[WKNetworkSessionDelegate URLSession:downloadTask:didFinishDownloadingToURL:]):
1369         (-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]):
1370         (-[WKNetworkSessionDelegate URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:]):
1371         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
1372         (-[WKNetworkSessionDelegate existingWebSocketTask:]):
1373         (WebKit::SessionWrapper::initialize):
1374         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1375         (WebKit::NetworkSessionCocoa::initializeEphemeralStatelessSession):
1376         (WebKit::NetworkSessionCocoa::sessionWrapperForTask):
1377         (WebKit::NetworkSessionCocoa::isolatedSession):
1378         (WebKit::NetworkSessionCocoa::invalidateAndCancel):
1379         (WebKit::NetworkSessionCocoa::continueDidReceiveChallenge):
1380         (WebKit::NetworkSessionCocoa::createWebSocketTask):
1381         (WebKit::NetworkSessionCocoa::addWebSocketTask):
1382         (WebKit::NetworkSessionCocoa::removeWebSocketTask):
1383         (-[WKNetworkSessionDelegate initWithNetworkSession:withCredentials:]): Deleted.
1384         (WebKit::NetworkSessionCocoa::initializeEphemeralStatelessCookielessSession): Deleted.
1385         (WebKit::NetworkSessionCocoa::session): Deleted.
1386         (WebKit::NetworkSessionCocoa::dataTaskForIdentifier): Deleted.
1387         (WebKit::NetworkSessionCocoa::downloadTaskWithResumeData): Deleted.
1388         (WebKit::NetworkSessionCocoa::addDownloadID): Deleted.
1389         (WebKit::NetworkSessionCocoa::downloadID): Deleted.
1390         (WebKit::NetworkSessionCocoa::takeDownloadID): Deleted.
1391         (WebKit::NetworkSessionCocoa::webSocketDataTaskForIdentifier): Deleted.
1392         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1393         (-[WKWebsiteDataStore _logUserInteraction:completionHandler:]):
1394         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1395
1396 2019-11-07  Peng Liu  <peng.liu6@apple.com>
1397
1398         ASSERTION FAILED: m_clientCounts.contains(contextId) in WebKit::VideoFullscreenManagerProxy::removeClientForContext(uint64_t)
1399         https://bugs.webkit.org/show_bug.cgi?id=203918
1400
1401         Reviewed by Jer Noble.
1402
1403         Postpone the transition to exit fullscreen of a video element
1404         before the previous transition of fullscreen mode change is completed.
1405
1406         Fix a flakey layout test (media/video-autoplay.html). No new test is needed.
1407
1408         * WebProcess/cocoa/VideoFullscreenManager.mm:
1409         (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement):
1410
1411 2019-11-07  Carlos Garcia Campos  <cgarcia@igalia.com>
1412
1413         WebDriver: correctly handle errors when focusing element before sending key events
1414         https://bugs.webkit.org/show_bug.cgi?id=203945
1415
1416         Reviewed by Carlos Alberto Lopez Perez.
1417
1418         Handle ElementNotInteractable JavaScript exception to generate the appropriate Automation error.
1419
1420         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1421         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
1422
1423 2019-11-06  Eric Liang  <ericliang@apple.com>
1424
1425         AX: WKWebView does not shift Accessibility Focus for Catalyst (203798)
1426         https://bugs.webkit.org/show_bug.cgi?id=203798
1427
1428         Reviewed by Chris Fleizach.
1429
1430         Added the code to register/unregister remote UI Process identifier on the host app.
1431         This is used so that the host app can appear as the sender for notifications sent from its web processes. Unfortunately this has to be done in WebKit: in accessibility bundles the swizzled code is not called because of bundle loading time.
1432         Added AppKit softlink for Mac catalyst.
1433
1434         * SourcesCocoa.txt:
1435         * UIProcess/Cocoa/WebViewImpl.mm:
1436         * UIProcess/ios/AppKitSoftLink.h: Added.
1437         * UIProcess/ios/AppKitSoftLink.mm: Added.
1438         * UIProcess/ios/ViewGestureControllerIOS.mm:
1439         (-[WKSwipeTransitionController gestureRecognizerForInteractiveTransition:WithTarget:action:]):
1440         * UIProcess/ios/WKContentView.mm:
1441         (-[WKContentView _updateRemoteAccessibilityRegistration:]):
1442         (-[WKContentView _accessibilityRegisterUIProcessTokens]):
1443         (-[WKContentView _processDidExit]):
1444         * WebKit.xcodeproj/project.pbxproj:
1445         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1446         * WebProcess/WebPage/mac/WebPageMac.mm:
1447         * WebProcess/cocoa/WebProcessCocoa.mm:
1448
1449 2019-11-06  Keith Rollin  <krollin@apple.com>
1450
1451         Update availability annotations to match the macOS 10.15 and iOS 13.0 GM SDKs
1452         https://bugs.webkit.org/show_bug.cgi?id=202243
1453         <rdar://problem/55720747>
1454
1455         Reviewed by Brent Fulgham.
1456
1457         Changed WK_MAC_TBA and WK_IOS_TBA to 10.15 and 13.0, respectively, in
1458         all declarations that appear in the GM SDKs.
1459
1460         * Configurations/WebKit.xcconfig:
1461         * Shared/API/Cocoa/WKMain.h:
1462         * UIProcess/API/Cocoa/NSAttributedString.h:
1463         * UIProcess/API/Cocoa/WKContextMenuElementInfo.h:
1464         * UIProcess/API/Cocoa/WKError.h:
1465         * UIProcess/API/Cocoa/WKErrorPrivate.h:
1466         * UIProcess/API/Cocoa/WKNavigation.h:
1467         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
1468         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
1469         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1470         * UIProcess/API/Cocoa/WKNavigationResponsePrivate.h:
1471         * UIProcess/API/Cocoa/WKPreferences.h:
1472         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1473         * UIProcess/API/Cocoa/WKPreviewActionItem.h:
1474         * UIProcess/API/Cocoa/WKPreviewActionItemIdentifiers.h:
1475         * UIProcess/API/Cocoa/WKPreviewElementInfo.h:
1476         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1477         * UIProcess/API/Cocoa/WKSnapshotConfiguration.h:
1478         * UIProcess/API/Cocoa/WKUIDelegate.h:
1479         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1480         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
1481         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
1482         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1483         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1484         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
1485         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
1486         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1487         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
1488         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
1489         * UIProcess/API/Cocoa/_WKContentRuleListAction.h:
1490         * UIProcess/API/Cocoa/_WKCustomHeaderFields.h:
1491         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
1492         * UIProcess/API/Cocoa/_WKElementAction.h:
1493         * UIProcess/API/Cocoa/_WKInspectorWindow.h:
1494         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1495         * UIProcess/API/Cocoa/_WKTextInputContext.h:
1496         * UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
1497         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
1498         * UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h:
1499         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
1500         * UIProcess/_WKTouchEventGenerator.h:
1501         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
1502
1503 2019-11-06  Antti Koivisto  <antti@apple.com>
1504
1505         REGRESSION: [ iOS ] ( r251015 ) Layout Test fast/text/whitespace/pre-wrap-overflow-selection.html is flaky
1506         https://bugs.webkit.org/show_bug.cgi?id=203366
1507         <rdar://problem/56580680>
1508
1509         Reviewed by Simon Fraser.
1510
1511         WKBundlePageForceRepaint may fail to do synchronous layer flush if there is a pending layer flush in-flight and waiting
1512         for completion message from UI process. Layer flush also flushes pending editor state so that doesn't get done either.
1513         This may cause randomness in test results.
1514
1515         In this case the randomness is the switch between simple and complex line layout, triggered by editor state flush. The results
1516         between line layout paths are observably identical but produce slightly different render tree dumps.
1517
1518         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1519         (WKBundlePageFlushPendingEditorStateUpdate):
1520         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
1521
1522         Add a function for forcing editor state flush, called from the test runner dump() function.
1523
1524 2019-11-06  Chris Dumez  <cdumez@apple.com>
1525
1526         Unreviewed, fix watchOS build after r252011.
1527
1528         * UIProcess/WebProcessProxy.cpp:
1529         (WebKit::WebProcessProxy::startBackgroundActivityForFullscreenInput):
1530
1531 2019-11-06  Fujii Hironori  <Hironori.Fujii@sony.com>
1532
1533         WEBCORE_TESTSUPPORT_EXPORT should be used only for WebCoreTestSupport, not for WebCore
1534         https://bugs.webkit.org/show_bug.cgi?id=203876
1535
1536         Reviewed by Ross Kirsling.
1537
1538         * config.h: Removed WEBCORE_TESTSUPPORT_EXPORT definition because it shouldn't be used in WebKit.
1539
1540 2019-11-06  Chris Dumez  <cdumez@apple.com>
1541
1542         Unreviewed, rolling out r251907.
1543
1544         Causes white flashing in some cases <rdar://problem/56957850>
1545
1546         Reverted changeset:
1547
1548         "Take down the gesture snapshot early when the back/forward
1549         cache is not leveraged"
1550         https://bugs.webkit.org/show_bug.cgi?id=203713
1551         https://trac.webkit.org/changeset/251907
1552
1553 2019-11-06  Chris Dumez  <cdumez@apple.com>
1554
1555         Make sure we never end up with NetworkDataTaskCocoa TaskIdentifier conflicts
1556         https://bugs.webkit.org/show_bug.cgi?id=203902
1557
1558         Reviewed by Antti Koivisto.
1559
1560         Consolidate the all the code related to data task registration / lookup / unregistration
1561         in NetworkSessionCocoa and add a utility method (dataTaskMap()) to decide which data
1562         task map to use. This makes it less error-prone and unlikely that someone would update
1563         part of the code and fail to update the rest accordingly.
1564
1565         I also converted the debug assertions into release ones so that we crash in case of
1566         id confusion instead of having a very bad and hard to diagnose bug like Bug 201822.
1567
1568         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1569         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1570         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1571         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
1572         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1573         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1574         (WebKit::NetworkSessionCocoa::dataTaskForIdentifier):
1575         (WebKit::NetworkSessionCocoa::registerDataTask):
1576         (WebKit::NetworkSessionCocoa::unregisterDataTask):
1577
1578 2019-11-06  Carlos Garcia Campos  <cgarcia@igalia.com>
1579
1580         [GTK] Implement support for Pointer Lock API
1581         https://bugs.webkit.org/show_bug.cgi?id=202956
1582
1583         Reviewed by Carlos Alberto Lopez Perez.
1584
1585         Add platform specific implementation of Pointer Lock for the GTK port.
1586
1587         * PlatformGTK.cmake: Generate code for pointer-constraints and relative-pointer Wayland protocols.
1588         * Shared/NativeWebMouseEvent.h: Add optional mouse movement delta.
1589         * Shared/gtk/NativeWebMouseEventGtk.cpp:
1590         (WebKit::NativeWebMouseEvent::NativeWebMouseEvent): Pass movement delta to WebEventFactory::createWebMouseEvent().
1591         * Shared/gtk/WebEventFactory.cpp:
1592         (WebKit::WebEventFactory::createWebMouseEvent): Initialize deltaX and deltaY for motion events using the received delta.
1593         * Shared/gtk/WebEventFactory.h: Add optional mouse movement delta.
1594         * SourcesGTK.txt: Add new files to compilation.
1595         * UIProcess/API/glib/WebKitUIClient.cpp: Add implementation for requestPointerLock and didLosePointerLock.
1596         * UIProcess/API/glib/WebKitWebView.cpp:
1597         (webkitWebViewRequestPointerLock): Call webkitWebViewBaseRequestPointerLock().
1598         (webkitWebViewDidLosePointerLock): Call webkitWebViewBaseDidLosePointerLock().
1599         * UIProcess/API/glib/WebKitWebViewPrivate.h:
1600         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1601         (webkitWebViewBaseDispose): Unlock the pointer and release the PointerLockManager.
1602         (webkitWebViewBaseHandleMouseEvent): Initialize the mouse movement delta for motion events and save the current event.
1603         (webkitWebViewBaseMotionNotifyEvent): Let PointerLockManager handle motion events while pointer is locked.
1604         (webkitWebViewBaseRequestPointerLock): Create a PointerLockManager and request it to lock the pointer.
1605         (webkitWebViewBaseDidLosePointerLock): Request PointerLockManager to unlock the pointer.
1606         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
1607         * UIProcess/gtk/PointerLockManager.cpp: Added.
1608         (WebKit::PointerLockManager::create):
1609         (WebKit::PointerLockManager::PointerLockManager):
1610         (WebKit::PointerLockManager::~PointerLockManager):
1611         (WebKit::PointerLockManager::lock):
1612         (WebKit::PointerLockManager::unlock):
1613         (WebKit::PointerLockManager::handleMotion):
1614         * UIProcess/gtk/PointerLockManager.h: Added.
1615         (WebKit::PointerLockManager::didReceiveMotionEvent):
1616         * UIProcess/gtk/PointerLockManagerWayland.cpp: Added.
1617         (WebKit::PointerLockManagerWayland::PointerLockManagerWayland):
1618         (WebKit::PointerLockManagerWayland::~PointerLockManagerWayland):
1619         (WebKit::PointerLockManagerWayland::lock):
1620         (WebKit::PointerLockManagerWayland::unlock):
1621         * UIProcess/gtk/PointerLockManagerWayland.h: Added.
1622         * UIProcess/gtk/PointerLockManagerX11.cpp: Added.
1623         (WebKit::PointerLockManagerX11::PointerLockManagerX11):
1624         (WebKit::PointerLockManagerX11::didReceiveMotionEvent):
1625         * UIProcess/gtk/PointerLockManagerX11.h: Added.
1626
1627 2019-11-05  Chris Dumez  <cdumez@apple.com>
1628
1629         [iOS] Scroll position does not get restored when doing a history navigation while the reader view is shown
1630         https://bugs.webkit.org/show_bug.cgi?id=203871
1631         <rdar://problem/56564603>
1632
1633         Reviewed by Tim Horton.
1634
1635         Previously, attempts to restore the scroll position on the web view while it is being dynamically resized
1636         would get ignored. Instead, we now delay restoring the scroll position until after the view is resized.
1637
1638         * UIProcess/API/Cocoa/WKWebView.mm:
1639         (-[WKWebView _restorePageScrollPosition:scrollOrigin:previousObscuredInset:scale:]):
1640         (-[WKWebView _restorePageStateToUnobscuredCenter:scale:]):
1641
1642 2019-11-05  Kate Cheney  <katherine_cheney@apple.com>
1643
1644         Layout test website-data-removal-for-site-navigated-to-with-link-decoration.html is a flaky failure
1645         https://bugs.webkit.org/show_bug.cgi?id=203706
1646         <rdar://problem/56801615>
1647
1648         Reviewed by Chris Dumez. 
1649
1650         No new tests, this change is tested by the existing resourceLoadStatistics
1651         tests.
1652
1653         This test started flaking when a new memory store was being created
1654         between tests to maintain consistency. The call to grandfatherExistingWebsiteData
1655         from populateMemoryStoreFromDisk in the persistent storage was
1656         async, causing a race condition that led to occasional failures.
1657         Adding a completion handler and changing the callsite of
1658         populateMemoryStoreFromDisk should fix this problem.
1659
1660         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp:
1661         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
1662         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.h:
1663         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1664         (WebKit::WebResourceLoadStatisticsStore::populateMemoryStoreFromDisk):
1665
1666 2019-11-05  John Wilander  <wilander@apple.com>
1667
1668         Temporarily turn off NSURLSession isolation
1669         https://bugs.webkit.org/show_bug.cgi?id=201822
1670
1671         Reviewed by Chris Dumez.
1672
1673         Existing tests skipped.
1674
1675         Re-enabling it is tracked in rdar://problem/56921584.
1676
1677         * NetworkProcess/cache/NetworkCacheStorage.h:
1678             Bumps the version to force a clean cache.
1679         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1680         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1681             Skips setting needsIsolatedSession.
1682
1683 2019-11-05  Per Arne Vollan  <pvollan@apple.com>
1684
1685         Eliminate mach lookup to cfprefsd on process startup
1686         https://bugs.webkit.org/show_bug.cgi?id=202866
1687
1688         Reviewed by Geoffrey Garen.
1689
1690         Currently, the WebContent and Networking process is calling CFBundleGetValueForInfoDictionaryKey on startup
1691         to get the entry point function name into the WebKit bundle. This causes a mach lookup to cfprefsd which
1692         should be avoided. Instead, we can send the service name as part of the bootstrap message when the UI process
1693         is starting the process, and have the new process read this value from the message on startup to determine
1694         the name of the entry point. This is possibly also an improvement in launch time, since we avoid reading a
1695         value from Info.plist.
1696
1697         * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-OSX.plist:
1698         * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-iOS.plist:
1699         * PluginProcess/EntryPoint/Cocoa/XPCService/PluginService.64.Info.plist:
1700         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
1701         (WebKit::XPCServiceEventHandler):
1702         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1703         (WebKit::ProcessLauncher::launchProcess):
1704         * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-OSX.plist:
1705         * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist:
1706
1707 2019-11-05  Per Arne Vollan  <pvollan@apple.com>
1708
1709         [iOS] Add logging and telemetry to mach services believed to be unused
1710         https://bugs.webkit.org/show_bug.cgi?id=203831
1711
1712         Reviewed by Geoffrey Garen.
1713
1714         The sandbox rules for mach services believed to be unused should have logging and telemetry added to confirm
1715         whether the assumption is correct.
1716
1717         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1718
1719 2019-11-05  Tuomas Karkkainen  <tuomas.webkit@apple.com>
1720
1721         move CrashReporterClientSPI.h and parts of WKCrashReporter to WTF so it can be used in JavaScriptCore
1722         https://bugs.webkit.org/show_bug.cgi?id=203803
1723
1724         Reviewed by Saam Barati.
1725
1726         No new tests added because functionality is not changing, code is only
1727         moved from WebKit to WTF.
1728
1729         * Platform/cocoa/WKCrashReporter.mm:
1730         (WebKit::setCrashReportApplicationSpecificInformation):
1731         (WebKit::setCrashLogMessage): Deleted.
1732         * WebKit.xcodeproj/project.pbxproj:
1733
1734 2019-11-05  Wenson Hsieh  <wenson_hsieh@apple.com>
1735
1736         Native text substitutions interfere with HTML <datalist> options resulting in crash
1737         https://bugs.webkit.org/show_bug.cgi?id=203116
1738         <rdar://problem/49875932>
1739
1740         Reviewed by Tim Horton.
1741
1742         On macOS, an NSTableView inside a separate window is used to render suggestions when showing a datalist. The
1743         crash happens when this table view is reloaded while clicking a datalist suggestion; that is, if -[NSTableView
1744         reloadData] is invoked after the user sends a platform MouseDown event on the table view cell but before the
1745         MouseUp is received, the selected row of the table view will be -1 when the action, `-selectedRow:`, is invoked.
1746
1747         In this particular case, the table view reload is triggered as a result of hiding the autocorrection bubble on
1748         macOS, thereby committing the alternative text suggestion and changing the value of the text field via an
1749         editing command.
1750
1751         To avoid crashing, we simply make `-selectedRow:` robust in the case where the index is invalid.
1752
1753         Test: fast/forms/datalist/datalist-click-crash.html
1754
1755         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
1756         (-[WKDataListSuggestionsController selectedRow:]):
1757
1758 2019-11-05  Sihui Liu  <sihui_liu@apple.com>
1759
1760         REGRESSION (r250754): web page using IDBIndex doesn't load occasionally
1761         https://bugs.webkit.org/show_bug.cgi?id=203431
1762
1763         Reviewed by Brady Eidson.
1764
1765         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
1766         (WebKit::WebIDBConnectionToClient::didFireVersionChangeEvent):
1767         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
1768         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.messages.in:
1769         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1770         (WebKit::WebIDBConnectionToServer::didFireVersionChangeEvent):
1771         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
1772
1773 2019-11-05  Fujii Hironori  <Hironori.Fujii@sony.com>
1774
1775         Unreviewed build fix for !ENABLE(MEDIA_STREAM) builds
1776         https://bugs.webkit.org/show_bug.cgi?id=203362
1777         <rdar://problem/56648232>
1778
1779         * UIProcess/UserMediaPermissionRequestProxy.h: Enclosed isUserGesturePriviledged with #if ENABLE(MEDIA_STREAM).
1780
1781 2019-11-05  youenn fablet  <youenn@apple.com>
1782
1783         mp4 video element broken with service worker
1784         https://bugs.webkit.org/show_bug.cgi?id=184447
1785         <rdar://problem/39313155>
1786
1787         Reviewed by Chris Dumez.
1788
1789         Make a response as range-requested as per https://fetch.spec.whatwg.org/#http-network-or-cache-fetch step 15.
1790
1791         * NetworkProcess/NetworkLoadChecker.cpp:
1792         (WebKit::NetworkLoadChecker::checkRedirection):
1793         (WebKit::NetworkLoadChecker::validateResponse):
1794         * NetworkProcess/NetworkLoadChecker.h:
1795         * NetworkProcess/NetworkResourceLoader.cpp:
1796         (WebKit::NetworkResourceLoader::didReceiveResponse):
1797         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
1798
1799 2019-11-05  youenn fablet  <youenn@apple.com>
1800
1801         Enforce user gesture for getUserMedia in case a previous getUserMedia call was denied
1802         https://bugs.webkit.org/show_bug.cgi?id=203362
1803
1804         Reviewed by Eric Carlson.
1805
1806         In case the request has user gesture priviledge, do not look at denied request history.
1807
1808         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1809         (WebKit::UserMediaPermissionRequestManagerProxy::getRequestAction):
1810         * UIProcess/UserMediaPermissionRequestProxy.h:
1811         (WebKit::UserMediaPermissionRequestProxy::isUserGesturePriviledged const):
1812
1813 2019-11-04  Jiewen Tan  <jiewen_tan@apple.com>
1814
1815         [WebAuthn] Guard against unexpected -[_WKWebAuthenticationPanel cancel]
1816         https://bugs.webkit.org/show_bug.cgi?id=203830
1817         <rdar://problem/56797134>
1818
1819         Reviewed by Brent Fulgham .
1820
1821         -[_WKWebAuthenticationPanel cancel] was only expected to be called on behalf of an
1822         explicit user cancel from the UI. However, clients may call it in different other
1823         unexpected scenarios as well. We should guard against that.
1824
1825         To do so, two counter ways are implemented:
1826         1) AuthenticatorManager::cancelRequest is changed to invoke the pending request if there
1827         is no GlobalFrameID. This case can only be reached via calling -[_WKWebAuthenticationPanel cancel]
1828         before AuthenticatorManager::cancelRequest.
1829         2) WebAuthenticationPanelClient::updatePanel and WebAuthenticationPanelClient::dismissPanel
1830         will call delegate methods in the next run loop to prevent -[_WKWebAuthenticationPanel cancel]
1831         being called in the delegates.
1832
1833         Covered by new API tests.
1834
1835         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1836         (WebKit::AuthenticatorManager::cancelRequest):
1837         (WebKit::AuthenticatorManager::createService const):
1838         (WebKit::AuthenticatorManager::invokePendingCompletionHandler):
1839         * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm:
1840         (WebKit::WebAuthenticationPanelClient::updatePanel const):
1841         (WebKit::WebAuthenticationPanelClient::dismissPanel const):
1842
1843 2019-11-04  Ross Kirsling  <ross.kirsling@sony.com>
1844
1845         Unreviewed fix for non-unified build.
1846
1847         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1848         * NetworkProcess/NetworkResourceLoader.cpp:
1849         * Shared/ServiceWorkerInitializationData.cpp:
1850         * UIProcess/API/APIAttachment.cpp:
1851         * WebProcess/Storage/WebServiceWorkerProvider.h:
1852         Add missing includes.
1853
1854 2019-11-04  Per Arne Vollan  <pvollan@apple.com>
1855
1856         Fix crash caused by syscall sandbox violation
1857         https://bugs.webkit.org/show_bug.cgi?id=203826
1858         <rdar://problem/56332491>
1859
1860         Reviewed by Brent Fulgham.
1861
1862         A new syscall needs to be allowed in the WebContent process' sandbox.
1863
1864         * WebProcess/com.apple.WebProcess.sb.in:
1865
1866 2019-11-04  John Wilander  <wilander@apple.com>
1867
1868         Resource Load Statistics: Flush the shared ResourceLoadObserver when the webpage is closed by JavaScript
1869         https://bugs.webkit.org/show_bug.cgi?id=203623
1870         <rdar://problem/56756427>
1871
1872         Reviewed by Alex Christensen.
1873
1874         This patch adds flushing of pending statistics when a window is closed by JavaScript,
1875         when a webpage is removed from the web process, and when the web process prepares to
1876         suspend.
1877
1878         New API test added.
1879
1880         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1881         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
1882             Now calls logTestingEvent() so that the test infrastructure can wait for updates.
1883         * UIProcess/API/Cocoa/WKProcessPool.mm:
1884         (-[WKProcessPool _seedResourceLoadStatisticsForTestingWithFirstParty:thirdParty:shouldScheduleNotification:completionHandler:]):
1885             Test infrastructure to seed every web process' WebCore::ResourceLoadObserver with test data.
1886         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1887         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1888         (-[WKWebsiteDataStore _clearResourceLoadStatistics:]):
1889         (-[WKWebsiteDataStore _isRegisteredAsSubresourceUnderFirstParty:thirdParty:completionHandler:]):
1890             Test infrastructure.
1891         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1892         * UIProcess/WebProcessPool.cpp:
1893         (WebKit::WebProcessPool::seedResourceLoadStatisticsForTesting):
1894             Test infrastructure.
1895         * UIProcess/WebProcessPool.h:
1896         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1897         (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder):
1898             Made sure the completion handler is called even if there is no network process.
1899         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
1900             Now tells all web processes to turn ITP on or off.
1901         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
1902         (WebKit::WebResourceLoadObserver::~WebResourceLoadObserver):
1903         (WebKit::WebResourceLoadObserver::logSubresourceLoadingForTesting):
1904             Test infrastructure to seed the observer with test data.
1905         * WebProcess/WebCoreSupport/WebResourceLoadObserver.h:
1906         * WebProcess/WebProcess.cpp:
1907         (WebKit::WebProcess::setWebsiteDataStoreParameters):
1908             Now checks whether a shared observer already exists before setting one.
1909         (WebKit::WebProcess::removeWebPage):
1910         (WebKit::WebProcess::prepareToSuspend):
1911             These two functions now call WebProcess::flushResourceLoadStatistics().
1912         (WebKit::WebProcess::setResourceLoadStatisticsEnabled):
1913             This function now sets the process' shared WebCore::ResourceLoadObserver if none exists.
1914         (WebKit::WebProcess::flushResourceLoadStatistics):
1915             This function tells the shared WebCore::ResourceLoadObserver to send any pending
1916             statistics to the central ITP store.
1917         (WebKit::WebProcess::seedResourceLoadStatisticsForTesting):
1918             Test infrastructure to seed the shared observer with test data.
1919         * WebProcess/WebProcess.h:
1920         * WebProcess/WebProcess.messages.in:
1921
1922 2019-11-04  Chris Dumez  <cdumez@apple.com>
1923
1924         [iOS][WK2] Simplify process assertion handling for the network process and service worker processes
1925         https://bugs.webkit.org/show_bug.cgi?id=203633
1926
1927         Reviewed by Alex Christensen.
1928
1929         Simplify process assertion handling for the network process and service worker processes.
1930         In particular, the following changes were made:
1931         1. Put the NetworkProcessProxy in charge of keeping the network process runnable instead
1932            of relying on the WebProcessPool to do it.
1933         2. Put the WebProcessProxy in charge of keeping the web process runnable due to service
1934            worker activity, instead of relying on the WebProcessPool to do it.
1935         3. Introduce a new Variant data type which can store a foreground activity, a background
1936            activity or no activity. This avoid having 2 separate and mutually-exclusive data
1937            members for foreground and background activities.
1938         4. The new code is a bit more correct because it makes sure the the activity we're holding
1939            is valid, instead of simply checking that it has an activity. This means that if the
1940            process assertion was previously invalidated, we will now properly take a new activity,
1941            which will re-take a process assertion.
1942
1943         This patch also reduces the #ifdefing for IOS_FAMILY, since ProcessThrottler and
1944         ProcessAssertion exist on all platforms.
1945
1946         * UIProcess/Network/NetworkProcessProxy.cpp:
1947         (WebKit::NetworkProcessProxy::updateProcessAssertion):
1948         * UIProcess/Network/NetworkProcessProxy.h:
1949         * UIProcess/ProcessThrottler.cpp:
1950         (WebKit::ProcessThrottler::isValidBackgroundActivity):
1951         (WebKit::ProcessThrottler::isValidForegroundActivity):
1952         * UIProcess/ProcessThrottler.h:
1953         * UIProcess/WebProcessPool.cpp:
1954         (WebKit::m_backgroundWebProcessCounter):
1955         (WebKit::WebProcessPool::ensureNetworkProcess):
1956         (WebKit::WebProcessPool::networkProcessCrashed):
1957         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
1958         (WebKit::WebProcessPool::disconnectProcess):
1959         (WebKit::WebProcessPool::terminateNetworkProcess):
1960         (WebKit::WebProcessPool::updateProcessAssertions):
1961         * UIProcess/WebProcessPool.h:
1962         * UIProcess/WebProcessProxy.cpp:
1963         (WebKit::WebProcessProxy::didSetAssertionState):
1964         (WebKit::WebProcessProxy::updateServiceWorkerProcessAssertion):
1965         (WebKit::WebProcessProxy::enableServiceWorkers):
1966         * UIProcess/WebProcessProxy.h:
1967         (WebKit::WebProcessProxy::isStandaloneServiceWorkerProcess const):
1968
1969 2019-11-03  Jiewen Tan  <jiewen_tan@apple.com>
1970
1971         [WebAuthn] CtapAuthenticator::tryDowngrade should distinguish requestData().options
1972         https://bugs.webkit.org/show_bug.cgi?id=203771
1973         <rdar://problem/56832618>
1974
1975         Reviewed by Brent Fulgham.
1976
1977         CtapAuthenticator::tryDowngrade assumes the request is a getAssertion request. This is true
1978         for most cases but not for Google's registration. For Google's registration, a quirk is
1979         implemented to use U2F commands for registration if GoogleLegacyAppIdSupportExtension asks
1980         us to do so.
1981
1982         No tests given there is no way to simulate google.com in our test infrastructures.
1983
1984         * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
1985         (WebKit::CtapAuthenticator::tryDowngrade):
1986
1987 2019-11-03  Tim Horton  <timothy_horton@apple.com>
1988
1989         WKWebView can get stuck blank (Web Content process thinks the app is backgrounded)
1990         https://bugs.webkit.org/show_bug.cgi?id=203774
1991         <rdar://problem/53399054>
1992
1993         Reviewed by Chris Dumez.
1994
1995         With careful timing, if a WKWebView swaps out its content view in the
1996         background, the incoming view can fail to inform the Web Content process
1997         when the app comes to the foreground, leaving the layer tree frozen.
1998
1999         This occurs because the last-sent state is stored per-WKApplicationStateTrackingView,
2000         and the content view is the WKApplicationStateTrackingView, so it is possible
2001         for e.g. a WKPDFView to be in the hierarchy, keeping the correct state,
2002         with an initialized-but-never-parented WKContentView hanging off the WKWebView.
2003
2004         If it is never parented, WKContentView will think that the current application
2005         state is foreground (_lastObservedStateWasBackground is initialized to NO).
2006
2007         If you go into the background with a WKPDFView as the current content view,
2008         it will inform the Web Content process that the application has backgrounded.
2009
2010         If, still in the background, WKWebView swaps from the WKPDFView to
2011         the WKContentView, and then comes into the foreground, when we get the
2012         notification that the app came to the foreground, we will not forward it
2013         to the Web Content process, because WKContentView's _lastObservedStateWasBackground
2014         remains NO.
2015
2016         To fix this, move _lastObservedStateWasBackground to WebPageProxy, so that
2017         it always tracks the most recently sent state, regardless of which content view
2018         is active.
2019
2020         * UIProcess/WebPageProxy.cpp:
2021         (WebKit::WebPageProxy::resetState):
2022         * UIProcess/WebPageProxy.h:
2023         (WebKit::WebPageProxy::lastObservedStateWasBackground const):
2024         * UIProcess/ios/WKApplicationStateTrackingView.mm:
2025         (-[WKApplicationStateTrackingView willMoveToWindow:]):
2026         (-[WKApplicationStateTrackingView didMoveToWindow]):
2027         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]):
2028         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]):
2029         * UIProcess/ios/WebPageProxyIOS.mm:
2030         (WebKit::WebPageProxy::applicationDidEnterBackground):
2031         (WebKit::WebPageProxy::applicationWillEnterForeground):
2032
2033 2019-11-02  Devin Rousso  <drousso@apple.com>
2034
2035         Web Inspector: Add diagnostic logging for frontend feature usage
2036         https://bugs.webkit.org/show_bug.cgi?id=203579
2037         <rdar://problem/56717410>
2038
2039         Reviewed by Brian Burg.
2040
2041         This patch enables diagnostic logging for the Web Inspector web process
2042         and adds the necessary `InspectorFrontendClient` plumbing to `WebInspectorUI`.
2043
2044         Original patch by Matt Baker <mattbaker@apple.com>.
2045
2046         * WebProcess/WebPage/WebInspectorUI.h:
2047         * WebProcess/WebPage/WebInspectorUI.cpp:
2048         (WebKit::WebInspectorUI::supportsDiagnosticLogging): Added.
2049         (WebKit::WebInspectorUI::logDagnosticEvent): Added.
2050         * WebProcess/WebPage/RemoteWebInspectorUI.h:
2051         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
2052         (WebKit::RemoteWebInspectorUI::supportsDiagnosticLogging): Added.
2053         (WebKit::RemoteWebInspectorUI::logDiagnosticEvent): Added.
2054
2055         * UIProcess/mac/WKInspectorViewController.mm:
2056         (-[WKInspectorViewController configuration]):
2057         Default to enabling diagnostic logging for the Web Inspector frontend window.
2058
2059         * Configurations/FeatureDefines.xcconfig:
2060         Add `ENABLE_INSPECTOR_TELEMETRY`, which is only enabled for macOS.
2061
2062 2019-11-01  Brady Eidson  <beidson@apple.com>
2063
2064         Promote "_getWebArchive" to API.
2065         <rdar://problem/17317547> and https://bugs.webkit.org/show_bug.cgi?id=203767
2066
2067         Reviewed by Andy Estes.
2068
2069         * UIProcess/API/Cocoa/WKWebView.h:
2070         * UIProcess/API/Cocoa/WKWebView.mm:
2071         (-[WKWebView createWebArchiveDataWithCompletionHandler:]):
2072         (-[WKWebView _getWebArchiveDataWithCompletionHandler:]):
2073
2074 2019-11-01  Brady Eidson  <beidson@apple.com>
2075
2076         Rejigger WKWebArchive headers.
2077         https://bugs.webkit.org/show_bug.cgi?id=203648
2078
2079         Reviewed by Andy Estes.
2080
2081         * Shared/API/c/mac/WKWebArchiveRef.cpp: Renamed from Source/WebKit/Shared/API/c/mac/WKWebArchive.cpp.
2082         (WKWebArchiveGetTypeID):
2083         (WKWebArchiveCreate):
2084         (WKWebArchiveCreateWithData):
2085         (WKWebArchiveCreateFromRange):
2086         (WKWebArchiveCopyMainResource):
2087         (WKWebArchiveCopySubresources):
2088         (WKWebArchiveCopySubframeArchives):
2089         (WKWebArchiveCopyData):
2090         * Shared/API/c/mac/WKWebArchiveRef.h: Copied from Source/WebKit/Shared/API/c/mac/WKWebArchive.h.
2091         * SourcesCocoa.txt:
2092         * UIProcess/API/Cocoa/WKWebArchive.h: Renamed from Source/WebKit/Shared/API/c/mac/WKWebArchive.h.
2093         * WebKit.xcodeproj/project.pbxproj:
2094
2095 2019-11-01  Eric Carlson  <eric.carlson@apple.com>
2096
2097         Add experimental TextTrackCue API
2098         https://bugs.webkit.org/show_bug.cgi?id=203649
2099         <rdar://problem/55675172>
2100
2101         Reviewed by Jer Noble.
2102
2103         * Shared/WebPreferences.yaml:
2104
2105 2019-11-01  Brian Burg  <bburg@apple.com>
2106
2107         REGRESSION(r248696): Element Click on Mac is adding an extra page topContentInsets to y-coordinate
2108         https://bugs.webkit.org/show_bug.cgi?id=203765
2109         <rdar://problem/56014369>
2110
2111         Reviewed by Devin Rousso.
2112
2113         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
2114         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
2115         The topContentInsets is accounted for by rootViewToWindow(), so don't add it in manually.
2116
2117 2019-11-01  Per Arne Vollan  <pvollan@apple.com>
2118
2119         Investigate if mach lookup access to *.apple-extension-service, *.viewservice, and com.apple.uikit.viewservice.* can be denied
2120         https://bugs.webkit.org/show_bug.cgi?id=203626
2121
2122         Reviewed by Alexey Proskuryakov.
2123
2124         Modify the allow rule for these services to include the telemetry option.
2125
2126         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2127
2128 2019-11-01  Peng Liu  <peng.liu6@apple.com>
2129
2130         Turn on the Picture-in-Picture API feature by default
2131         https://bugs.webkit.org/show_bug.cgi?id=203725
2132
2133         Reviewed by Jer Noble.
2134
2135         * Shared/WebPreferences.yaml:
2136
2137 2019-10-31  Chris Dumez  <cdumez@apple.com>
2138
2139         Take down the gesture snapshot early when the back/forward cache is not leveraged
2140         https://bugs.webkit.org/show_bug.cgi?id=203713
2141         <rdar://problem/56803910>
2142
2143         Reviewed by Tim Horton.
2144
2145         Take down the gesture snapshot as soon as the gesture is done when the back/forward cache
2146         is not leveraged. Otherwise, the snapshot may stay up for a long time (while we load, parse
2147         and restore scroll position) and it would look to the user as if the view was unresponsive.
2148         Showing the page slowly loading in such cases is less confusing as the user knows what's
2149         going on and is even able to interact with the partially loaded page.
2150
2151         * Shared/WebBackForwardListItem.cpp:
2152         (WebKit::WebBackForwardListItem::hasCachedWebPage const):
2153         * Shared/WebBackForwardListItem.h:
2154         * UIProcess/ViewGestureController.cpp:
2155         (WebKit::ViewGestureController::endSwipeGesture):
2156         * UIProcess/ViewGestureController.h:
2157         * UIProcess/ios/ViewGestureControllerIOS.mm:
2158         (WebKit::ViewGestureController::makeSnapshotBlank):
2159         (WebKit::ViewGestureController::endSwipeGesture):
2160         * UIProcess/mac/ViewGestureControllerMac.mm:
2161         (WebKit::ViewGestureController::makeSnapshotBlank):
2162
2163 2019-10-31  Per Arne Vollan  <pvollan@apple.com>
2164
2165         [iOS] Fix mach lookup sandbox violations in the Mail app
2166         https://bugs.webkit.org/show_bug.cgi?id=203697
2167
2168         Reviewed by Alexey Proskuryakov.
2169
2170         Allow mach lookup to the services "com.apple.logd.events" and "com.apple.distributed_notifications@1v3",
2171         which are seen when running the Mail application. Also allow "com.apple.aggregated", which was previously
2172         allowed, and is showing up in reports.
2173
2174         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2175
2176 2019-10-31  Tim Horton  <timothy_horton@apple.com>
2177
2178         Turn on IOSurface support in the iOS Simulator
2179         https://bugs.webkit.org/show_bug.cgi?id=203026
2180         <rdar://problem/56320993>
2181
2182         Reviewed by Simon Fraser.
2183
2184         * Configurations/WebKit.xcconfig:
2185         Always link IOSurface now that we always have it.
2186
2187         * Shared/WebPreferences.yaml:
2188         * Shared/WebPreferencesDefaultValues.h:
2189         Turn on Accelerated Drawing and Accelerated Drawing for Canvas by default.
2190
2191         * UIProcess/API/Cocoa/WKWebView.mm:
2192         (-[WKWebView _takeViewSnapshot]):
2193         Don't use RGB10 if we don't have it.
2194
2195         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
2196         Don't use render server snapshotting in hidden windows, because it
2197         (correctly, but unhelpfully) cannot capture contents in that case.
2198
2199 2019-10-31  Dean Jackson  <dino@apple.com>
2200
2201         REGRESSION (r251215): Mail failed to build
2202         https://bugs.webkit.org/show_bug.cgi?id=203700
2203         <rdar://problem/56787012>
2204
2205         Reviewed by Antoine Quint.
2206
2207         Revert the private modulemap. It didn't include enough things
2208         and caused some internal builds to fail.
2209
2210         We'll put it back with everything included sometime soon.
2211
2212         * Configurations/WebKit.xcconfig:
2213         * Modules/OSX.modulemap: Renamed from Source/WebKit/Modules/macOS.modulemap.
2214         * Modules/iOS.private.modulemap: Removed.
2215         * Modules/macOS.private.modulemap: Removed.
2216         * Shared/API/Cocoa/WebKitPrivate.h:
2217
2218 2019-10-31  Alex Christensen  <achristensen@apple.com>
2219
2220         Enable more features in Mac CMake build
2221         https://bugs.webkit.org/show_bug.cgi?id=203699
2222
2223         Rubber-stamped by Tim Horton.
2224
2225         * PlatformMac.cmake:
2226         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2227         (WebKit::UserMediaCaptureManager::createCaptureSource):
2228
2229 2019-10-31  Russell Epstein  <repstein@apple.com>
2230
2231         Unreviewed, rolling out r251861.
2232
2233         Caused 50+ Layout Test Crashes
2234
2235         Reverted changeset:
2236
2237         "Use SecurityOriginData in NetworkProcess where possible
2238         without other changes"
2239         https://bugs.webkit.org/show_bug.cgi?id=203615
2240         https://trac.webkit.org/changeset/251861
2241
2242 2019-10-31  Truitt Savell  <tsavell@apple.com>
2243
2244         Unreviewed, rolling out r251854.
2245
2246         Broke iOS build
2247
2248         Reverted changeset:
2249
2250         "Rejigger WKWebArchive headers."
2251         https://bugs.webkit.org/show_bug.cgi?id=203648
2252         https://trac.webkit.org/changeset/251854
2253
2254 2019-10-31  Alex Christensen  <achristensen@webkit.org>
2255
2256         Remove unneeded HAVE_TIMINGDATAOPTIONS
2257         https://bugs.webkit.org/show_bug.cgi?id=202990
2258
2259         Reviewed by Brady Eidson.
2260
2261         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2262         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2263
2264 2019-10-31  Alex Christensen  <achristensen@webkit.org>
2265
2266         Use SecurityOriginData in NetworkProcess where possible without other changes
2267         https://bugs.webkit.org/show_bug.cgi?id=203615
2268
2269         Reviewed by Brady Eidson.
2270
2271         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2272         (WebKit::NetworkResourceLoadParameters::encode const):
2273         * NetworkProcess/NetworkResourceLoadParameters.h:
2274         * NetworkProcess/NetworkResourceLoader.cpp:
2275         (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions):
2276         * WebProcess/Network/WebLoaderStrategy.cpp:
2277         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2278
2279 2019-10-31  Alex Christensen  <achristensen@webkit.org>
2280
2281         Expose more WKPreferences SPI
2282         https://bugs.webkit.org/show_bug.cgi?id=203631
2283         <rdar://problem/56717160>
2284
2285         Reviewed by Brady Eidson.
2286
2287         I added a unit test for the one that can be easily tested.
2288
2289         * UIProcess/API/Cocoa/WKPreferences.mm:
2290         (-[WKPreferences _setWebAudioEnabled:]):
2291         (-[WKPreferences _webAudioEnabled]):
2292         (-[WKPreferences _setAcceleratedCompositingEnabled:]):
2293         (-[WKPreferences _acceleratedCompositingEnabled]):
2294         (-[WKPreferences _setRequestAnimationFrameEnabled:]):
2295         (-[WKPreferences _requestAnimationFrameEnabled]):
2296         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2297
2298 2019-10-31  Alex Christensen  <achristensen@webkit.org>
2299
2300         CMake build should make WebKit framework able to be used by Safari
2301         https://bugs.webkit.org/show_bug.cgi?id=203685
2302
2303         Rubber-stamped by Tim Horton.
2304
2305         * PlatformMac.cmake:
2306
2307 2019-10-31  Brady Eidson  <beidson@apple.com>
2308
2309         Rejigger WKWebArchive headers.
2310         https://bugs.webkit.org/show_bug.cgi?id=203648
2311
2312         Reviewed by Andy Estes.
2313
2314         * Shared/API/c/mac/WKWebArchiveRef.cpp: Renamed from Source/WebKit/Shared/API/c/mac/WKWebArchive.cpp.
2315         (WKWebArchiveGetTypeID):
2316         (WKWebArchiveCreate):
2317         (WKWebArchiveCreateWithData):
2318         (WKWebArchiveCreateFromRange):
2319         (WKWebArchiveCopyMainResource):
2320         (WKWebArchiveCopySubresources):
2321         (WKWebArchiveCopySubframeArchives):
2322         (WKWebArchiveCopyData):
2323         * Shared/API/c/mac/WKWebArchiveRef.h: Copied from Source/WebKit/Shared/API/c/mac/WKWebArchive.h.
2324         * SourcesCocoa.txt:
2325         * UIProcess/API/Cocoa/WKWebArchive.h: Renamed from Source/WebKit/Shared/API/c/mac/WKWebArchive.h.
2326         * WebKit.xcodeproj/project.pbxproj:
2327
2328 2019-10-31  Wenson Hsieh  <wenson_hsieh@apple.com>
2329
2330         Add telemetry to test a potential cause of crashes under -[WKContentView _interpretKeyEvent:isCharEvent:]
2331         https://bugs.webkit.org/show_bug.cgi?id=203630
2332         <rdar://problem/56769229>
2333
2334         Reviewed by Simon Fraser.
2335
2336         This iOS-specific crash occurs under `-_interpretKeyEvent:isCharEvent:`, when we first try to access WebEvent's
2337         properties with `event.keyboardFlags`. This suggests that between storing the WebEvent in WebPageProxy's
2338         m_keyEventQueue, and later receiving an InterpretKeyEvent sync IPC message in the UI process, something ends up
2339         overreleasing (or otherwise writing over or corrupting) the WebEvent.
2340
2341         However, from code inspection, nothing appears to overrelease the WebEvent; an alternate possibility is that the
2342         API is somehow being invoked from a background thread, which would explain why the WebEvent may sometimes get
2343         destroyed too early.
2344
2345         To try and detect this scenario (and avoid keeping any strong references to WebEvent at all), add an
2346         `os_log_fault` in case the API is being called on a background thread, and bail immediately.
2347
2348         * UIProcess/ios/WKContentViewInteraction.mm:
2349         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
2350
2351 2019-10-31  Miguel Gomez  <magomez@igalia.com>
2352
2353         [CoordGraphics] Avoid painting backing stores for zero-opacity layers
2354         https://bugs.webkit.org/show_bug.cgi?id=184143
2355
2356         Reviewed by Žan Doberšek.
2357
2358         Do not check whether a backingStore is required by a layer inside CoordinatedGraphicsScene. This
2359         decision is made by the appropriate CoordinatedGraphicsLayer and propagated to the scene by
2360         sending a valid or null Nicosia::BackingStore instance through the state.
2361
2362         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2363         (WebKit::updateBackingStore):
2364         (WebKit::layerShouldHaveBackingStore): Deleted.
2365
2366 2019-10-30  Peng Liu  <peng.liu6@apple.com>
2367
2368         [Picture-in-Picture Web API] Enable the support for iOS
2369         https://bugs.webkit.org/show_bug.cgi?id=202618
2370
2371         Reviewed by Jer Noble.
2372
2373         Enable the Picture-in-Picture API support for iOS (iPad only).
2374
2375         * Configurations/FeatureDefines.xcconfig:
2376         * WebProcess/cocoa/VideoFullscreenManager.mm:
2377
2378 2019-10-30  Alex Christensen  <achristensen@webkit.org>
2379
2380         Prevent Mac CMake build from bit rotting
2381         https://bugs.webkit.org/show_bug.cgi?id=203647
2382
2383         Rubber-stamped by Tim Horton.
2384
2385         * NetworkProcess/NetworkProcess.cpp:
2386         (WebKit::m_messagePortChannelRegistry):
2387         * PlatformMac.cmake:
2388         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
2389         (-[_WKWebAuthenticationPanel delegate]):
2390         (-[_WKWebAuthenticationPanel setDelegate:]):
2391         * UIProcess/WebProcessProxy.cpp:
2392
2393 2019-10-30  Per Arne Vollan  <pvollan@apple.com>
2394
2395         It should be possible to create a mach sandbox extension for the WebContent process before the audit token is known
2396         https://bugs.webkit.org/show_bug.cgi?id=203618
2397
2398         Reviewed by Brent Fulgham.
2399
2400         Currently, we are only able to create a mach sandbox extension for the WebContent process if we know its
2401         audit token. It should be possible to create a mach extension without the audit token, since this is
2402         needed when we want to create extensions before the PID or audit token is known. These extensions are
2403         typically sent in the WebProcess creation parameters.
2404         
2405         No new tests, this is not a behavior change, but a patch in preparation for future patches.
2406
2407         * Shared/Cocoa/SandboxExtensionCocoa.mm:
2408         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
2409         (WebKit::SandboxExtension::createHandleForMachLookup):
2410         (WebKit::SandboxExtension::createHandleForMachLookupByAuditToken): Deleted.
2411         * Shared/SandboxExtension.h:
2412         * UIProcess/ios/WebProcessProxyIOS.mm:
2413         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
2414
2415 2019-10-30  Per Arne Vollan  <pvollan@apple.com>
2416
2417         Fix some sysctl read violations in the WebContent process
2418         https://bugs.webkit.org/show_bug.cgi?id=203632
2419
2420         Reviewed by Brent Fulgham.
2421
2422         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2423
2424 2019-10-30  Dean Jackson  <dino@apple.com>
2425
2426         REGRESSION(r251568) If we didn't start a Service Worker, don't try talking to it
2427         https://bugs.webkit.org/show_bug.cgi?id=203639
2428         <rdar://problem/56762071>
2429
2430         Reviewed by Chris Dumez.
2431
2432         Similar to the fix that introduced this regression, if the UI process does
2433         not have the entitlement to start a service worker, we should not try
2434         to load with one.
2435
2436         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2437         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad): If the
2438         parent process doesn't have a service worker, use the regular load path.
2439
2440 2019-10-30  Simon Fraser  <simon.fraser@apple.com>
2441
2442         Turn Resize Observer on by default
2443         https://bugs.webkit.org/show_bug.cgi?id=203644
2444         rdar://problem/56026799
2445
2446         Reviewed by Tim Horton.
2447
2448         Change the defaultValue of Resize Observer to true.
2449
2450         * Shared/WebPreferences.yaml:
2451
2452 2019-10-30  Per Arne Vollan  <pvollan@apple.com>
2453
2454         Lookup to mach services with the WebKit extension should list the allowed services
2455         https://bugs.webkit.org/show_bug.cgi?id=203619
2456
2457         Reviewed by Alexey Proskuryakov.
2458
2459         To tighten the mach lookup rule which allows lookup to services with the "com.apple.webkit.extension.mach"
2460         extension, all allowed services should be listed. Currently, we are only creating mach lookup extensions to
2461         "com.apple.iphone.axserver-systemwide", but more will come in the future.
2462
2463         No new tests. Testing this requires UI interaction on the device to enable Accessibility.
2464
2465         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2466
2467 2019-10-30  Alex Christensen  <achristensen@webkit.org>
2468
2469         WKContentRuleLists should block requests from service workers
2470         https://bugs.webkit.org/show_bug.cgi?id=201980
2471         <rdar://problem/55516735>
2472
2473         Reviewed by Chris Dumez.
2474
2475         Test: http/tests/contentextensions/service-worker.https.html
2476
2477         Also covered by an API test.
2478
2479         * Shared/ServiceWorkerInitializationData.cpp: Added.
2480         (WebKit::ServiceWorkerInitializationData::encode const):
2481         (WebKit::ServiceWorkerInitializationData::decode):
2482         * Shared/ServiceWorkerInitializationData.h: Added.
2483         * Sources.txt:
2484         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2485         (WebKit::WebUserContentControllerProxy::addProcess):
2486         (WebKit::WebUserContentControllerProxy::contentRuleListData):
2487         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2488         * UIProcess/WebProcessPool.cpp:
2489         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
2490         (WebKit::WebProcessPool::createWebPage):
2491         * UIProcess/WebProcessPool.h:
2492         * UIProcess/WebProcessProxy.cpp:
2493         (WebKit::WebProcessProxy::createForServiceWorkers):
2494         (WebKit::WebProcessProxy::establishServiceWorkerContext):
2495         (WebKit::contentRuleListsFromIdentifier):
2496         (WebKit::WebProcessProxy::enableServiceWorkers):
2497         * UIProcess/WebProcessProxy.h:
2498         * WebKit.xcodeproj/project.pbxproj:
2499         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2500         (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
2501         (WebKit::m_userAgent):
2502         (WebKit::WebSWContextManagerConnection::installServiceWorker):
2503         * WebProcess/Storage/WebSWContextManagerConnection.h:
2504         * WebProcess/WebProcess.cpp:
2505         (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess):
2506         * WebProcess/WebProcess.h:
2507         * WebProcess/WebProcess.messages.in:
2508
2509 2019-10-30  Andres Gonzalez  <andresg_22@apple.com>
2510
2511         Create base class common to AccessibilityObject and AXIsolatedTreeNode.
2512         https://bugs.webkit.org/show_bug.cgi?id=203408
2513
2514         Reviewed by Chris Fleizach.
2515
2516         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2517         (WKAccessibilityRootObject):
2518         (WKAccessibilityFocusedObject):
2519
2520 2019-10-30  Chris Dumez  <cdumez@apple.com>
2521
2522         Unreviewed, fix reversed assertion landed in r251778.
2523
2524         * UIProcess/ProcessThrottler.h:
2525         (WebKit::ProcessThrottler::Activity::invalidate):
2526
2527 2019-10-30  Chris Dumez  <cdumez@apple.com>
2528
2529         Unreviewed, fix WatchOS build after r251778.
2530
2531         * UIProcess/WebProcessProxy.h:
2532
2533 2019-10-30  Chris Dumez  <cdumez@apple.com>
2534
2535         WKFrameIsDisplayingMarkupDocument() should return true after a window.open/document.write
2536         https://bugs.webkit.org/show_bug.cgi?id=203587
2537         <rdar://problem/56717726>
2538
2539         Reviewed by Alex Christensen.
2540
2541         When doing a document.open(), we were propagating the document's URL to the UIProcess but not its
2542         MIME type. WKFrameIsDisplayingMarkupDocument() was relying on this MIME type.
2543
2544         * UIProcess/WebFrameProxy.cpp:
2545         (WebKit::WebFrameProxy::didExplicitOpen):
2546         * UIProcess/WebFrameProxy.h:
2547         * UIProcess/WebPageProxy.cpp:
2548         (WebKit::WebPageProxy::didExplicitOpenForFrame):
2549         * UIProcess/WebPageProxy.h:
2550         * UIProcess/WebPageProxy.messages.in:
2551         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2552         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
2553         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2554
2555 2019-10-30  Chris Dumez  <cdumez@apple.com>
2556
2557         REGRESSION (r238252): HTTP POST is losing application/x-www-form-urlencoded body if there's a redirect to different host
2558         https://bugs.webkit.org/show_bug.cgi?id=201950
2559         <rdar://problem/55577782>
2560
2561         Reviewed by Alex Christensen.
2562
2563         The resource request body was getting lost on cross-site redirects. This was caused by the fact that a cross-site
2564         redirect would cause a process-swap and the request to start again from a new process. This would work fine if
2565         the request does not have a body. However, we have an optimization in place which avoids encoding the request body
2566         whenever it is sent over IPC. Because the WebResourceLoader::WillSendRequest IPC would not encode the request body,
2567         any decision to process swap as a result of this IPC (i.e. redirect) would cause the new request in the new process
2568         to be missing its body. To address the issue, we now make sure to pass the request body in the WillSendRequest IPC
2569         and reconsile the request with its body on the recipient side.
2570
2571         Test: http/tests/misc/form-submit-file-cross-site-redirect.html
2572
2573         * NetworkProcess/NetworkResourceLoader.cpp:
2574         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
2575         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
2576         (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse):
2577         * WebProcess/Network/WebResourceLoader.cpp:
2578         (WebKit::WebResourceLoader::willSendRequest):
2579         * WebProcess/Network/WebResourceLoader.h:
2580         * WebProcess/Network/WebResourceLoader.messages.in:
2581
2582 2019-10-30  Jer Noble  <jer.noble@apple.com>
2583
2584         Enable Remote Playback API by default
2585         https://bugs.webkit.org/show_bug.cgi?id=203595
2586
2587         Reviewed by Eric Carlson.
2588
2589         * Shared/WebPreferences.yaml:
2590
2591 2019-10-30  Chris Dumez  <cdumez@apple.com>
2592
2593         [iOS] [WK2] Improve process assertion-related logging to help identify causes of leaked assertions
2594         https://bugs.webkit.org/show_bug.cgi?id=203438
2595
2596         Reviewed by Antti Koivisto.
2597
2598         Improve process assertion-related logging to help identify causes of leaked assertions. Previously,
2599         whenever our code needed to prevent suspension of a child process due to some kind of activity, it
2600         would simply grab a "token" from the child process' ProcessThrottler. This, in-turn, would cause
2601         the ProcessThrottler to take the right kind of ProcessAssertion or release it when nobody holds
2602         any tokens any more.
2603
2604         We frequently have issues where the UIProcess keeps its assertions around for too long after getting
2605         backgrounding. This causes the assertions to get invalidated and the UIProcess will usually suspend
2606         (albeit with a delay, which is bad for power). Sometimes though, we get killed because our invalidation
2607         handler does not get a chance to release the assertion in time.
2608
2609         Finding out why we're keeping around assertions is currently very difficult because we cannot easily
2610         see in the logs who is still holding ProcessThrottler tokens. To make such debugging easier, clients
2611         now notify the ProcessThrottler when they start some activity and provide a user-readable description
2612         of the activity. The client then gets a ForegroundActivity or BackgroundActivity object instead of
2613         simply a token. As a result, we are now able to log when a given activity that prevents suspension
2614         begins and ends, with a user-friendly string. Also, when the assertion gets invalidated, it will
2615         invalidate all these pending activities and we'll see in the logs the name of the activities that
2616         were still going on upon invalidation.
2617
2618         * Shared/API/Cocoa/RemoteObjectRegistry.h:
2619         (WebKit::RemoteObjectRegistry::backgroundActivity):
2620         * Shared/API/Cocoa/RemoteObjectRegistry.mm:
2621         (WebKit::RemoteObjectRegistry::sendInvocation):
2622         * UIProcess/Cocoa/DownloadClient.h:
2623         * UIProcess/Cocoa/DownloadClient.mm:
2624         (WebKit::DownloadClient::takeActivityToken):
2625         (WebKit::DownloadClient::releaseActivityTokenIfNecessary):
2626         * UIProcess/Cocoa/NavigationState.h:
2627         * UIProcess/Cocoa/NavigationState.mm:
2628         (WebKit::NavigationState::NavigationState):
2629         (WebKit::NavigationState::releaseNetworkActivity):
2630         (WebKit::NavigationState::didChangeIsLoading):
2631         (WebKit::NavigationState::didSwapWebProcesses):
2632         * UIProcess/Cocoa/UIRemoteObjectRegistry.cpp:
2633         (WebKit::UIRemoteObjectRegistry::backgroundActivity):
2634         * UIProcess/Cocoa/UIRemoteObjectRegistry.h:
2635         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2636         (WebKit::WebProcessProxy::processWasResumed):
2637         * UIProcess/GenericCallback.h:
2638         (WebKit::CallbackBase::CallbackBase):
2639         (WebKit::GenericCallback::create):
2640         (WebKit::GenericCallback::GenericCallback):
2641         (WebKit::CallbackMap::put):
2642         * UIProcess/Network/NetworkProcessProxy.cpp:
2643         (WebKit::NetworkProcessProxy::fetchWebsiteData):
2644         (WebKit::NetworkProcessProxy::deleteWebsiteData):
2645         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
2646         (WebKit::NetworkProcessProxy::didClose):
2647         (WebKit::NetworkProcessProxy::setIsHoldingLockedFiles):
2648         (WebKit::NetworkProcessProxy::syncAllCookies):
2649         (WebKit::NetworkProcessProxy::didSyncAllCookies):
2650         * UIProcess/Network/NetworkProcessProxy.h:
2651         * UIProcess/ProcessThrottler.cpp:
2652         (WebKit::ProcessThrottler::ProcessThrottler):
2653         (WebKit::ProcessThrottler::~ProcessThrottler):
2654         (WebKit::ProcessThrottler::addActivity):
2655         (WebKit::ProcessThrottler::removeActivity):
2656         (WebKit::ProcessThrottler::invalidateAllActivities):
2657         (WebKit::ProcessThrottler::expectedAssertionState):
2658         (WebKit::ProcessThrottler::setAssertionState):
2659         (WebKit::ProcessThrottler::uiAssertionWillExpireImminently):
2660         * UIProcess/ProcessThrottler.h:
2661         (WebKit::ProcessThrottler::Activity::Activity):
2662         (WebKit::ProcessThrottler::Activity::~Activity):
2663         (WebKit::ProcessThrottler::Activity::isValid const):
2664         (WebKit::ProcessThrottler::Activity::invalidate):
2665         (WebKit::ProcessThrottler::shouldBeRunnable const):
2666         (WebKit::ProcessThrottler::foregroundActivity):
2667         (WebKit::ProcessThrottler::backgroundActivity):
2668         * UIProcess/ProvisionalPageProxy.cpp:
2669         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
2670         * UIProcess/ProvisionalPageProxy.h:
2671         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2672         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
2673         * UIProcess/SuspendedPageProxy.cpp:
2674         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
2675         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
2676         * UIProcess/SuspendedPageProxy.h:
2677         * UIProcess/WebBackForwardCacheEntry.cpp:
2678         (WebKit::WebBackForwardCacheEntry::~WebBackForwardCacheEntry):
2679         * UIProcess/WebCookieManagerProxy.cpp:
2680         (WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
2681         (WebKit::WebCookieManagerProxy::deleteCookie):
2682         (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
2683         (WebKit::WebCookieManagerProxy::setCookies):
2684         (WebKit::WebCookieManagerProxy::getAllCookies):
2685         (WebKit::WebCookieManagerProxy::getCookies):
2686         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
2687         (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
2688         * UIProcess/WebPageProxy.cpp:
2689         (WebKit::WebPageProxy::close):
2690         (WebKit::WebPageProxy::updateThrottleState):
2691         (WebKit::WebPageProxy::waitForDidUpdateActivityState):
2692         (WebKit::WebPageProxy::setInitialFocus):
2693         (WebKit::WebPageProxy::validateCommand):
2694         (WebKit::WebPageProxy::executeEditCommand):
2695         (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart):
2696         (WebKit::WebPageProxy::replaceMatches):
2697         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
2698         (WebKit::WebPageProxy::runJavaScriptInFrame):
2699         (WebKit::WebPageProxy::getRenderTreeExternalRepresentation):
2700         (WebKit::WebPageProxy::getSourceForFrame):
2701         (WebKit::WebPageProxy::getContentsAsString):
2702         (WebKit::WebPageProxy::getBytecodeProfile):
2703         (WebKit::WebPageProxy::getSamplingProfilerOutput):
2704         (WebKit::WebPageProxy::getContentsAsMHTMLData):
2705         (WebKit::WebPageProxy::getSelectionOrContentsAsString):
2706         (WebKit::WebPageProxy::getSelectionAsWebArchiveData):
2707         (WebKit::WebPageProxy::getMainResourceDataOfFrame):
2708         (WebKit::WebPageProxy::getResourceDataFromFrame):
2709         (WebKit::WebPageProxy::getWebArchiveOfFrame):
2710         (WebKit::WebPageProxy::forceRepaint):
2711         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2712         (WebKit::WebPageProxy::drawToPDF):
2713         (WebKit::WebPageProxy::getMarkedRangeAsync):
2714         (WebKit::WebPageProxy::getSelectedRangeAsync):
2715         (WebKit::WebPageProxy::characterIndexForPointAsync):
2716         (WebKit::WebPageProxy::firstRectForCharacterRangeAsync):
2717         (WebKit::WebPageProxy::takeSnapshot):
2718         (WebKit::WebPageProxy::installActivityStateChangeCompletionHandler):
2719         (WebKit::WebPageProxy::getLoadDecisionForIcon):
2720         (WebKit::WebPageProxy::insertAttachment):
2721         (WebKit::WebPageProxy::updateAttachmentAttributes):
2722         (WebKit::WebPageProxy::getApplicationManifest):
2723         * UIProcess/WebPageProxy.h:
2724         * UIProcess/WebProcessPool.cpp:
2725         (WebKit::WebProcessPool::initializeNewWebProcess):
2726         (WebKit::WebProcessPool::updateProcessAssertions):
2727         (WebKit::WebProcessPool::reinstateNetworkProcessAssertionState):
2728         * UIProcess/WebProcessPool.h:
2729         * UIProcess/WebProcessProxy.cpp:
2730         (WebKit::WebProcessProxy::shutDown):
2731         (WebKit::WebProcessProxy::fetchWebsiteData):
2732         (WebKit::WebProcessProxy::deleteWebsiteData):
2733         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
2734         (WebKit::WebProcessProxy::setIsHoldingLockedFiles):
2735         (WebKit::WebProcessProxy::startBackgroundActivityForFullscreenInput):
2736         (WebKit::WebProcessProxy::endBackgroundActivityForFullscreenInput):
2737         * UIProcess/WebProcessProxy.h:
2738         * UIProcess/ios/WKContentViewInteraction.mm:
2739         (-[WKContentView presentViewControllerForCurrentFocusedElement]):
2740         (-[WKContentView dismissAllInputViewControllers:]):
2741         * UIProcess/ios/WebPageProxyIOS.mm:
2742         (WebKit::WebPageProxy::requestFocusedElementInformation):
2743         (WebKit::WebPageProxy::selectWithGesture):
2744         (WebKit::WebPageProxy::updateSelectionWithTouches):
2745         (WebKit::WebPageProxy::applyAutocorrection):
2746         (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
2747         (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
2748         (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection):
2749         (WebKit::WebPageProxy::selectPositionAtPoint):
2750         (WebKit::WebPageProxy::beginSelectionInDirection):
2751         (WebKit::WebPageProxy::updateSelectionWithExtentPoint):
2752         (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
2753         (WebKit::WebPageProxy::requestDictationContext):
2754         (WebKit::WebPageProxy::getSelectionContext):
2755         (WebKit::WebPageProxy::selectWithTwoTouches):
2756         (WebKit::WebPageProxy::applicationDidEnterBackground):
2757         (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
2758         (WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText):
2759         (WebKit::WebPageProxy::moveSelectionByOffset):
2760         (WebKit::WebPageProxy::focusNextFocusedElement):
2761         (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
2762
2763 2019-10-30  Carlos Garcia Campos  <cgarcia@igalia.com>
2764
2765         REGRESSION(2.27.2): [GTK] Overview item remove button broken
2766         https://bugs.webkit.org/show_bug.cgi?id=203461
2767
2768         Reviewed by Adrian Perez de Castro.
2769
2770         This is a regression of the switch to new custom protocols implementation. Epiphany is passing NULL as content
2771         type of ephy-resource requests, in which case we should try to guess the mime type, but we are not doing it.
2772
2773         * UIProcess/API/glib/WebKitURISchemeRequest.cpp:
2774         (webkitURISchemeRequestReadCallback): Use MIMETypeRegistry to guess the mime type when content type is nullptr,
2775         like NetworkDataTask does.
2776
2777 2019-10-29  Andy Estes  <aestes@apple.com>
2778
2779         [Quick Look] Clean up LegacyPreviewLoaderClients
2780         https://bugs.webkit.org/show_bug.cgi?id=203472
2781
2782         Reviewed by Brady Eidson.
2783
2784         Replaced QuickLookDocumentData with ShareableResource.
2785
2786         Removed messages WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame and
2787         WebPage::DidReceivePasswordForQuickLookDocument, replacing them with async message
2788         WebPageProxy::RequestPasswordForQuickLookDocumentInMainFrame.
2789
2790         * Shared/ios/QuickLookDocumentData.cpp: Removed.
2791         * Shared/ios/QuickLookDocumentData.h: Removed.
2792         * SourcesCocoa.txt:
2793         * UIProcess/API/APILoaderClient.h:
2794         * UIProcess/API/APINavigationClient.h:
2795         (API::NavigationClient::didFinishLoadForQuickLookDocumentInMainFrame):
2796         * UIProcess/Cocoa/NavigationState.h:
2797         * UIProcess/Cocoa/NavigationState.mm:
2798         (WebKit::NavigationState::NavigationClient::didFinishLoadForQuickLookDocumentInMainFrame):
2799         * UIProcess/ProvisionalPageProxy.cpp:
2800         (WebKit::ProvisionalPageProxy::requestPasswordForQuickLookDocumentInMainFrame):
2801         (WebKit::ProvisionalPageProxy::didReceiveMessage):
2802         (WebKit::ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame): Deleted.
2803         * UIProcess/ProvisionalPageProxy.h:
2804         * UIProcess/WebPageProxy.h:
2805         * UIProcess/WebPageProxy.messages.in:
2806         * UIProcess/ios/WebPageProxyIOS.mm:
2807         (WebKit::WebPageProxy::didFinishLoadForQuickLookDocumentInMainFrame):
2808         (WebKit::WebPageProxy::requestPasswordForQuickLookDocumentInMainFrame):
2809         (WebKit::WebPageProxy::requestPasswordForQuickLookDocumentInMainFrameShared):
2810         (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame): Deleted.
2811         (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrameShared): Deleted.
2812         * WebKit.xcodeproj/project.pbxproj:
2813         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp:
2814         (WebKit::WebPreviewLoaderClient::WebPreviewLoaderClient):
2815         (WebKit::WebPreviewLoaderClient::didReceiveBuffer):
2816         (WebKit::WebPreviewLoaderClient::didFinishLoading):
2817         (WebKit::WebPreviewLoaderClient::didFail):
2818         (WebKit::WebPreviewLoaderClient::didRequestPassword):
2819         (WebKit::passwordCallbacks): Deleted.
2820         (WebKit::WebPreviewLoaderClient::~WebPreviewLoaderClient): Deleted.
2821         (WebKit::WebPreviewLoaderClient::didReceiveDataArray): Deleted.
2822         (WebKit::WebPreviewLoaderClient::didReceivePassword): Deleted.
2823         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.h:
2824         * WebProcess/WebPage/WebPage.h:
2825         * WebProcess/WebPage/WebPage.messages.in:
2826         * WebProcess/WebPage/ios/WebPageIOS.mm:
2827         (WebKit::WebPage::didStartLoadForQuickLookDocumentInMainFrame):
2828         (WebKit::WebPage::didFinishLoadForQuickLookDocumentInMainFrame):
2829         (WebKit::WebPage::requestPasswordForQuickLookDocumentInMainFrame):
2830         (WebKit::WebPage::didReceivePasswordForQuickLookDocument): Deleted.
2831
2832 2019-10-29  Jiewen Tan  <jiewen_tan@apple.com>
2833
2834         [WebAuthn] Add more information to _WKWebAuthenticationPanel
2835         https://bugs.webkit.org/show_bug.cgi?id=202561
2836         <rdar://problem/55973910>
2837
2838         Reviewed by Youenn Fablet and Brent Fulgham.
2839
2840         This change adds transports and type to _WKWebAuthenticationPanel such that
2841         clients can know what transport the current ceremony demands and the type of
2842         the current ceremony. These extra information allow clients to give users
2843         more specific instructions to interact with authenticators.
2844
2845         To pass transports to client, the way how them is collected is changed significantly:
2846         1) The timing is moved to runPanel before the client delegate call.
2847         2) NfcService::isAvailable is added for AuthenticatorManager to determine if NFC
2848         is available in the current device.
2849         3) AuthenticatorManager::filterTransports is added to filter transports requested
2850         by RP to ones that are available. This process is handled by each service naturally
2851         before.
2852         4) AuthenticatorManager::startRequest is now being splitted into AuthenticatorManager::handleRequest,
2853         AuthenticatorManager::runPanel and AuthenticatorManager::getTransports.
2854
2855         To pass type to _WKWebAuthenticationPanel, ClientDataType is moved from
2856         WebCore::AuthenticatorCoordinator to WebCore::WebAuthenticationConstants in
2857         order to be reused to indicate the ceremony type.
2858
2859         * UIProcess/API/APIWebAuthenticationPanel.cpp:
2860         (API::WebAuthenticationPanel::create):
2861         (API::WebAuthenticationPanel::WebAuthenticationPanel):
2862         * UIProcess/API/APIWebAuthenticationPanel.h:
2863         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
2864         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
2865         (-[_WKWebAuthenticationPanel relyingPartyID]):
2866         (wkWebAuthenticationTransport):
2867         (-[_WKWebAuthenticationPanel transports]):
2868         (wkWebAuthenticationType):
2869         (-[_WKWebAuthenticationPanel type]):
2870         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2871         (WebKit::WebCore::collectTransports):
2872         (WebKit::WebCore::getClientDataType):
2873         (WebKit::AuthenticatorManager::handleRequest):
2874         (WebKit::AuthenticatorManager::filterTransports const):
2875         (WebKit::AuthenticatorManager::startDiscovery):
2876         (WebKit::AuthenticatorManager::initTimeOutTimer):
2877         (WebKit::AuthenticatorManager::runPanel):
2878         (WebKit::AuthenticatorManager::getTransports const):
2879         (WebKit::AuthenticatorManager::respondReceivedInternal): Deleted.
2880         (WebKit::AuthenticatorManager::startRequest): Deleted.
2881         * UIProcess/WebAuthentication/AuthenticatorManager.h:
2882         (WebKit::AuthenticatorManager::respondReceivedInternal):
2883         * UIProcess/WebAuthentication/Cocoa/NfcService.h:
2884         * UIProcess/WebAuthentication/Cocoa/NfcService.mm:
2885         (WebKit::NfcService::isAvailable):
2886         (WebKit::NfcService::platformStartDiscovery):
2887         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
2888         (WebKit::MockAuthenticatorManager::filterTransports const):
2889         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h:
2890
2891 2019-10-29  Wenson Hsieh  <wenson_hsieh@apple.com>
2892
2893         REGRESSION (r251693): [iOS] Unable to change selection in a focused element if the element's bounds change
2894         https://bugs.webkit.org/show_bug.cgi?id=203582
2895
2896         Reviewed by Tim Horton.
2897
2898         The refactoring in r251693 broke the ability to change selection in an editable area by tapping in iOS Safari,
2899         in the case where the editable element's bounds change after focus. This is because the aforementioned change
2900         now compares position informations' element context against the focused element information's element context to
2901         check whether or not the position information request was inside the focused element. However, if the bounds of
2902         the focused element change in between the position information request and when the element is initially
2903         focused, the `operator==` comparison will fail, causing us to prevent text selection.
2904
2905         To fix this, only check whether or not the two element contexts refer to the same element in the DOM by
2906         comparing page, document and element identifiers, but not the element's bounding rect.
2907
2908         * UIProcess/ios/WKContentViewInteraction.mm:
2909         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:nodeHasBuiltInClickHandling:]):
2910         (-[WKContentView gestureRecognizerShouldBegin:]):
2911         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
2912
2913 2019-10-07  Jer Noble  <jer.noble@apple.com>
2914
2915         Implement the Remote Playback API.
2916         https://bugs.webkit.org/show_bug.cgi?id=162971
2917
2918         Reviewed by Youenn Fablet.
2919
2920         Add a preference to enable the Remote Playback API. Pass the playbackTargetPickerWasDismissed()
2921         notification on to Page.
2922
2923         * Shared/WebPreferencesDefinitions.h:
2924         * UIProcess/API/C/WKPreferences.cpp:
2925         (WKPreferencesGetRemotePlaybackEnabled):
2926         (WKPreferencesSetRemotePlaybackEnabled):
2927         * UIProcess/API/C/WKPreferencesRef.h:
2928         * UIProcess/WebPageProxy.cpp:
2929         (WebKit::WebPageProxy::playbackTargetPickerWasDismissed):
2930         * UIProcess/WebPageProxy.h:
2931         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2932         (WebKit::WebChromeClient::mockMediaPlaybackTargetPickerDismissPopup):
2933         * WebProcess/WebCoreSupport/WebChromeClient.h:
2934         * WebProcess/WebPage/WebPage.cpp:
2935         (WebKit::WebPage::updatePreferences):
2936         * WebProcess/WebPage/WebPage.h:
2937         * WebProcess/WebPage/WebPage.messages.in:
2938         * WebProcess/WebPage/mac/WebPageMac.mm:
2939         (WebKit::WebPage::playbackTargetPickerWasDismissed):
2940
2941 2019-10-29  Per Arne Vollan  <pvollan@apple.com>
2942
2943         REGRESSION: WebContent getting killed due to syscall filter violation
2944         https://bugs.webkit.org/show_bug.cgi?id=203575
2945
2946         Reviewed by Alexey Proskuryakov.
2947
2948         The sandbox profile on macOS needs to open up for a syscall.
2949
2950         No new tests, covered by existing tests.
2951
2952         * WebProcess/com.apple.WebProcess.sb.in:
2953
2954 2019-10-29  Brent Fulgham  <bfulgham@apple.com>
2955
2956         [iOS] Clean up sandbox to group similar rules together 
2957         https://bugs.webkit.org/show_bug.cgi?id=203525
2958         <rdar://problem/56686416>
2959
2960         Reviewed by Per Arne Vollan.
2961
2962         Clean up the sandbox rules by grouping rules by feature areas to make future editing easier.
2963         This change should have no impact on behavior.
2964
2965         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2966
2967 2019-10-29  Myles C. Maxfield  <mmaxfield@apple.com>
2968
2969         REGRESSION (r251413): Nightly build crashes on launch due to -[WKPreferences _setShouldAllowDesignSystemUIFonts:]: unrecognized selector
2970         https://bugs.webkit.org/show_bug.cgi?id=203549
2971
2972         Reviewed by Simon Fraser.
2973
2974         r251413 deleted an SPI that new Safari stopped calling. However,
2975         old Safari continues to call it. The solution is just to add stub
2976         implementations so old Safari doesn't fail to link at runtime.
2977
2978         * UIProcess/API/Cocoa/WKPreferences.mm:
2979         (-[WKPreferences _shouldAllowDesignSystemUIFonts]):
2980         (-[WKPreferences _setShouldAllowDesignSystemUIFonts:]):
2981         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2982
2983 2019-10-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2984
2985         Add enterkeyhint support
2986         https://bugs.webkit.org/show_bug.cgi?id=189546
2987         <rdar://problem/51021148>
2988
2989         Reviewed by Tim Horton.
2990
2991         This patch adds support for the enterkeyhint HTML attribute on iOS.
2992
2993         Tests:  EnterKeyHintTests.EnterKeyHintInContentEditableElement
2994                 EnterKeyHintTests.EnterKeyHintInTextInput
2995                 EnterKeyHintTests.EnterKeyHintInTextArea
2996
2997         * Shared/FocusedElementInformation.cpp:
2998         (WebKit::FocusedElementInformation::encode const):
2999         (WebKit::FocusedElementInformation::decode):
3000         * Shared/FocusedElementInformation.h:
3001
3002         Add a new flag to FocusedElementInformation to indicate the EnterKeyHint type that should be used when bringing
3003         up an input view for the focused element.
3004
3005         * UIProcess/ios/WKContentViewInteraction.mm:
3006         (-[WKContentView textInputTraits]):
3007
3008         Map the given EnterKeyHint type to a UIReturnKeyType. If an unsupported (i.e. "previous") or default
3009         EnterKeyHint value is used, then we fall back to existing behavior which deduces the default enterkeyhint value
3010         from the input type if the focused element is inside an actionable form; otherwise, we avoid setting any value
3011         for the `returnKeyType`, defaulting to `UIReturnKeyDefault`.
3012
3013         * WebProcess/WebPage/ios/WebPageIOS.mm:
3014         (WebKit::WebPage::getFocusedElementInformation):
3015
3016 2019-10-29  Kate Cheney  <katherine_cheney@apple.com>
3017
3018         Layout Test http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-database.html is a flaky failure
3019         https://bugs.webkit.org/show_bug.cgi?id=203542#add_comment
3020         <rdar://problem/56689764>
3021
3022         Reviewed by John Wilander.
3023
3024         This test was a flaky failure due to its calling
3025         scheduleStatisticsProcessingRequestIfNecessary() after logging a cross
3026         site load with link decoration. This call is currently unecessary
3027         because this function is not yet used to classify resources, and is
3028         causing the test to execute a callback before it is ready.
3029
3030         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3031
3032 2019-10-29  Truitt Savell  <tsavell@apple.com>
3033
3034         Unreviewed, rolling out r251639.
3035
3036         Caused flakey API failures for GetDisplayMediaTest.Constraints
3037
3038         Reverted changeset:
3039
3040         "Enforce user gesture for getUserMedia in case a previous
3041         getUserMedia call was denied"
3042         https://bugs.webkit.org/show_bug.cgi?id=203362
3043         https://trac.webkit.org/changeset/251639
3044
3045 2019-10-29  Truitt Savell  <tsavell@apple.com>
3046
3047         Unreviewed, rolling out r251646.
3048
3049         Caused flakey API failures for GetDisplayMediaTest.Constraints
3050
3051         Reverted changeset:
3052
3053         "Unreviewed build fix for !ENABLE(MEDIA_STREAM) builds"
3054         https://bugs.webkit.org/show_bug.cgi?id=203362
3055         https://trac.webkit.org/changeset/251646
3056
3057 2019-10-29  Chris Dumez  <cdumez@apple.com>
3058
3059         Unreviewed, rolling out r251594.
3060
3061         Caused an API test failure
3062
3063         Reverted changeset:
3064
3065         "mp4 video element broken with service worker"
3066         https://bugs.webkit.org/show_bug.cgi?id=184447
3067         https://trac.webkit.org/changeset/251594        
3068
3069 2019-10-29  Chris Dumez  <cdumez@apple.com>
3070
3071         Notification permissions are not remembered for origins without port
3072         https://bugs.webkit.org/show_bug.cgi?id=203537
3073         <rdar://problem/55281080>
3074
3075         Reviewed by Brady Eidson.
3076
3077         When WKSecurityOriginCreate() gets called with a port that is invalid, then pass
3078         WTF::nullopt to construct the security origin instead of the invalid port.
3079
3080         The issue is that the port for security origins is optional internally. However,
3081         our API (WKSecurityOriginGetPort() & WKSecurityOrigin.port) will return 0 when
3082         there is no port. As a result, clients such as Safari sometimes pass 0 as port to construct
3083         a new WKSecurityOriginRef().
3084
3085         This was causing issues with regards to notifications because Safari would construct
3086         origins whose string representation looks like "https://www.apple.com:0" and it would
3087         not match the "https://www.apple.com" we expect internally.
3088
3089         * Shared/API/c/WKSecurityOriginRef.cpp:
3090         (WKSecurityOriginCreate):
3091
3092 2019-10-29  Adrian Perez de Castro  <aperez@igalia.com>
3093
3094         Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.27.2 release
3095
3096         * wpe/NEWS: Add release notes for 2.27.2.
3097
3098 2019-10-28  Wenson Hsieh  <wenson_hsieh@apple.com>
3099
3100         Replace InteractionInformationAtPosition.nodeAtPositionIsFocusedElement with an element context
3101         https://bugs.webkit.org/show_bug.cgi?id=203498
3102
3103         Reviewed by Tim Horton.
3104
3105         Refactors InteractionInformationAtPosition, such that it doesn't need a special flag to indicate whether there
3106         is a focused element at the position. This is a followup to webkit.org/b/203264; no new tests, as there should
3107         be no change in behavior.
3108
3109         * Shared/FocusedElementInformation.cpp:
3110         (WebKit::FocusedElementInformation::encode const):
3111         (WebKit::FocusedElementInformation::decode):
3112         * Shared/FocusedElementInformation.h:
3113
3114         Add an elementContext to FocusedElementInformation to represent the focused element; then, instead of checking
3115         whether there is a focused element underneath the request position, simply check that the position information's
3116         element context matches the FocusedElementInformation's element context.
3117
3118         Additionally, rename elementRect in FocusedElementInformation to interactionRect, to draw a distinction between
3119         this rect and the new ElementContext's boundingRect.
3120
3121         * Shared/ios/InteractionInformationAtPosition.h:
3122         * Shared/ios/InteractionInformationAtPosition.mm:
3123         (WebKit::InteractionInformationAtPosition::encode const):
3124         (WebKit::InteractionInformationAtPosition::decode):
3125
3126         Remove the nodeAtPositionIsFocusedElement flag.
3127
3128         * UIProcess/ios/WKContentViewInteraction.mm:
3129         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:nodeHasBuiltInClickHandling:]):
3130         (-[WKContentView _zoomToRevealFocusedElement]):
3131         (-[WKContentView _selectionClipRect]):
3132         (-[WKContentView gestureRecognizerShouldBegin:]):
3133         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
3134
3135         In various places that consult nodeAtPositionIsFocusedElement, instead check that the position information's
3136         hit-tested element context is the same as the focused element, via FocusedElementInformation.
3137
3138         (-[WKContentView _didCommitLoadForMainFrame]):
3139
3140         Nuke the cached position information data upon navigation; without this tweak, we will fail when running several
3141         iOS layout tests back-to-back, that tap in exactly the same location.
3142
3143         (rectToRevealWhenZoomingToFocusedElement):
3144         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
3145         (-[WKContentView _elementDidBlur]):
3146         (-[WKContentView rectForFocusedFormControlView:]):
3147         (-[WKContentView _didChangeFocusedElementRect:toRect:]): Deleted.
3148
3149         Remove code to invalidate cached position information when changing the focused element rect.
3150
3151         * UIProcess/ios/forms/WKFormPopover.mm:
3152         (-[WKRotatingPopover presentPopoverAnimated:]):
3153         * WebProcess/WebPage/ios/WebPageIOS.mm:
3154         (WebKit::WebPage::positionInformation):
3155         (WebKit::WebPage::getFocusedElementInformation):
3156
3157 2019-10-28  Adrian Perez de Castro  <aperez@igalia.com>
3158
3159         [GTK][WPE] Fix various non-unified build issues introduced since r251436
3160         https://bugs.webkit.org/show_bug.cgi?id=203492
3161
3162         Reviewed by Alex Christensen and Mark Lam.
3163
3164         * UIProcess/InspectorTargetProxy.h: Add forward declaration of ProvisionalPageProxy.
3165         * UIProcess/Plugins/PluginProcessProxy.cpp: Add missin inclusion of
3166         WebProcessProxyMessages.h
3167         * UIProcess/ProcessThrottler.cpp: Add missing inclusion of wtf/CompletionHandler.h
3168         * UIProcess/ProvisionalPageProxy.h: Add missing inclusion of WebCore/FrameIdentifier.h
3169         * UIProcess/WebPageInspectorController.h: Add missing inclusion of WebCore/PageIdentifier.h
3170         * WebProcess/WebPage/WebPageInspectorTargetController.cpp: Add missing inclusion of
3171         WebPageInspectorTargetFrontendChannel.h
3172
3173 2019-10-28  Per Arne Vollan  <pvollan@apple.com>
3174
3175         [iOS] Fix sandbox violations
3176         https://bugs.webkit.org/show_bug.cgi?id=203505
3177
3178         Reviewed by Brent Fulgham.
3179
3180         Running layout tests shows that allowing mach lookup is needed for a set of services which was previously denied.
3181         This patch add rules for allowing these services again. The service 'com.apple.logd.events' is still denied, since
3182         it has not been observed to be in use.
3183
3184         No new tests, covered by existing tests.
3185
3186         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3187
3188 2019-10-28  Alex Christensen  <achristensen@webkit.org>
3189
3190         Unreviewed, rolling out r251675.
3191
3192         Broke some builds
3193
3194         Reverted changeset:
3195
3196         "Remove unused WKWebsiteDataStore setter SPI"
3197         https://bugs.webkit.org/show_bug.cgi?id=203114
3198         https://trac.webkit.org/changeset/251675
3199
3200 2019-10-28  Wenson Hsieh  <wenson_hsieh@apple.com>
3201
3202         Add bindings support for the enterkeyhint HTML attribute
3203         https://bugs.webkit.org/show_bug.cgi?id=203440
3204
3205         Reviewed by Ryosuke Niwa.
3206
3207         Add a new runtime switch for the enterkeyhint attribute, and enable it by default on macOS and iOS.
3208
3209         * Shared/WebPreferences.yaml:
3210         * Shared/WebPreferencesDefaultValues.h:
3211
3212 2019-10-28  Alex Christensen  <achristensen@webkit.org>
3213
3214         Remove unused _WKProcessPoolConfiguration SPI
3215         https://bugs.webkit.org/show_bug.cgi?id=203066
3216
3217         Reviewed by Youenn Fablet.
3218
3219         After rdar://problem/56260478 this is not used, so away it goes!
3220
3221         * NetworkProcess/NetworkProcess.h:
3222         (WebKit::NetworkProcess::suppressesConnectionTerminationOnSystemChange const): Deleted.
3223         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3224         (WebKit::NetworkProcessCreationParameters::encode const):
3225         (WebKit::NetworkProcessCreationParameters::decode):
3226         * NetworkProcess/NetworkProcessCreationParameters.h:
3227         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3228         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3229         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
3230         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3231         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3232         (WebKit::globalCTDataConnectionServiceType): Deleted.
3233         (WebKit::NetworkSessionCocoa::ctDataConnectionServiceType const): Deleted.
3234         (WebKit::NetworkSessionCocoa::setCTDataConnectionServiceType): Deleted.
3235         * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm:
3236         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType):
3237         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3238         (API::ProcessPoolConfiguration::copy):
3239         * UIProcess/API/APIProcessPoolConfiguration.h:
3240         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3241         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3242         (-[_WKProcessPoolConfiguration suppressesConnectionTerminationOnSystemChange]): Deleted.
3243         (-[_WKProcessPoolConfiguration setSuppressesConnectionTerminationOnSystemChange:]): Deleted.
3244         (-[_WKProcessPoolConfiguration CTDataConnectionServiceType]): Deleted.
3245         (-[_WKProcessPoolConfiguration setCTDataConnectionServiceType:]): Deleted.
3246         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3247         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3248         * UIProcess/ios/WebPageProxyIOS.mm:
3249         (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType):
3250
3251 2019-10-28  Alex Christensen  <achristensen@webkit.org>
3252
3253         Remove unused WKWebsiteDataStore setter SPI
3254         https://bugs.webkit.org/show_bug.cgi?id=203114
3255
3256         Reviewed by Anders Carlsson.
3257
3258         They have been replaced by _WKWebsiteDataStoreConfiguration SPI which was adopted in rdar://problem/56349165
3259
3260         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3261         (-[WKWebsiteDataStore _setBoundInterfaceIdentifier:]): Deleted.
3262         (-[WKWebsiteDataStore _boundInterfaceIdentifier]): Deleted.
3263         (-[WKWebsiteDataStore _setAllowsCellularAccess:]): Deleted.
3264         (-[WKWebsiteDataStore _allowsCellularAccess]): Deleted.
3265         (-[WKWebsiteDataStore _setProxyConfiguration:]): Deleted.
3266         (-[WKWebsiteDataStore _proxyConfiguration]): Deleted.
3267         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3268         * UIProcess/WebsiteData/WebsiteDataStore.h:
3269         (WebKit::WebsiteDataStore::setBoundInterfaceIdentifier): Deleted.
3270         (WebKit::WebsiteDataStore::setAllowsCellularAccess): Deleted.
3271         (WebKit::WebsiteDataStore::setProxyConfiguration): Deleted.
3272
3273 2019-10-28  Brady Eidson  <beidson@apple.com>
3274
3275         Expose _printOperationWithPrintInfo: SPI as API
3276         <rdar://problem/36557179> and https://bugs.webkit.org/show_bug.cgi?id=203496
3277
3278         Reviewed by Andy Estes.
3279
3280         * UIProcess/API/Cocoa/WKWebView.h:
3281         * UIProcess/API/Cocoa/WKWebView.mm:
3282         (-[WKWebView printOperationWithPrintInfo:]):
3283         (-[WKWebView _printOperationWithPrintInfo:]):
3284
3285 2019-10-28  Kate Cheney  <katherine_cheney@apple.com>
3286
3287         Layout Test http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html is a flaky failure
3288         https://bugs.webkit.org/show_bug.cgi?id=203491
3289         <rdar://problem/56674176>
3290
3291         Reviewed by Chris Dumez.
3292
3293         No new tests, this change is tested by the existing resourceLoadStatistics
3294         tests.
3295
3296         This test started flaking when a new memory store was being created
3297         between tests to maintain consistency. The call to grandfatherExistingWebsiteData
3298         from populateMemoryStoreFromDisk in the persistent storage was
3299         async, causing a race condition that led to occasional failures.
3300         Adding a completion handler and changing the callsite of
3301         populateMemoryStoreFromDisk should fix this problem.
3302
3303         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp:
3304         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
3305         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.h:
3306         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3307         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3308         The persistent store in the databaseEnabled case was never being used
3309         and is unnecessary.
3310
3311         (WebKit::WebResourceLoadStatisticsStore::populateMemoryStoreFromDisk):
3312         Since persistent storage only exists when using the memory store,
3313         populateMemoryStoreFromDisk should check if
3314         m_persistentStorage has been initialized.
3315
3316         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3317         * NetworkProcess/NetworkProcess.cpp:
3318         (WebKit::NetworkProcess::setUseITPDatabase):
3319         * NetworkProcess/NetworkSession.cpp:
3320         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
3321         (WebKit::NetworkSession::recreateResourceLoadStatisticStore):
3322         * NetworkProcess/NetworkSession.h:
3323
3324 2019-10-28  Wenson Hsieh  <wenson_hsieh@apple.com>
3325
3326         [iOS] 3 editing/pasteboard/smart-paste-paragraph-* tests are flaky
3327         https://bugs.webkit.org/show_bug.cgi?id=203264
3328         <rdar://problem/56512107>
3329
3330         Reviewed by Tim Horton.
3331
3332         Fixes several flaky layout tests that exercise a corner case in our logic for caching position information
3333         responses in the UI process. When focusing an element via a tap, we send a position information request for the
3334         tap location in -_webTouchEventsRecognized:. After the web process computes the information and hands it back to
3335         the UI process, we cache this in WKContentView's _positionInformation.
3336
3337         However, at the time of computing the request, the tapped element has not been focused yet, so the value of the
3338         position information's nodeAtPositionIsFocusedElement flag is false. After the tap is recognized, we'll then
3339         focus the element, such that if a subsequent position information request were to arrive at the same location,
3340         it would have a nodeAtPositionIsFocusedElement flag set to true.
3341
3342         In this state, if the user taps _exactly_ at the same location again, UIKit (through text interaction gestures)
3343         will ask us for information at the same point; we will end up using the cached information, for which
3344         nodeAtPositionIsFocusedElement is false, causing us to incorrectly prevent the text interaction. In this
3345         particular case, we fail to select text via a double tap gesture.
3346
3347         To address this, we invalidate the cached position information in the UI process whenever the focused element
3348         rect changes (e.g. when the focused element changes); the only exception to this is when the previously cached
3349         position information was not over the focused element, and the new focused element rect is empty, in which case
3350         the value of nodeAtPositionIsFocusedElement is guaranteed to have not changed.
3351
3352         While this may potentially leads to an additional synchronous position information request when tapping at the
3353         same location after focusing an element, this is very difficult to achieve in practice, since the tap location
3354         would need to be _exactly_ at the same location.
3355
3356         No new test, since this is exercised by existing flaky layout tests.
3357
3358         * UIProcess/ios/WKContentViewInteraction.mm:
3359         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
3360         (-[WKContentView _elementDidBlur]):
3361
3362         Also, add a FIXME about how we clear out surprisingly little of _focusedElementInformation when blurring the
3363         focused element.
3364
3365         (-[WKContentView _didChangeFocusedElementRect:toRect:]):
3366
3367 2019-10-28  John Wilander  <wilander@apple.com>
3368
3369         Storage Access API: Make the API work with the experimental 3rd-party cookie blocking
3370         https://bugs.webkit.org/show_bug.cgi?id=203428
3371         <rdar://problem/56626949>
3372
3373         Reviewed by Alex Christensen.
3374
3375         Tests: http/tests/storageAccess/deny-due-to-no-interaction-under-general-third-party-cookie-blocking.html
3376                http/tests/storageAccess/grant-with-prompt-under-general-third-party-cookie-blocking.html
3377                http/tests/storageAccess/has-storage-access-under-general-third-party-cookie-blocking-with-cookie.html
3378                http/tests/storageAccess/has-storage-access-under-general-third-party-cookie-blocking-without-cookie.html
3379
3380         This patch adds Storage Access API support for the experimental 3rd-party cookie blocking that
3381         landed in <https://trac.webkit.org/changeset/251467>.
3382
3383         There are three policies at play because it can be changed with the experimental setting:
3384         1. The underlying cookie policy.
3385         2. Shipping ITP.
3386         3. The off by default, experimental 3rd-party cookie blocking.
3387
3388         To support them all, a CookieAccess enum was added to encode how the API should respond.
3389         The enum has these values:
3390         CannotRequest - This third-party cannot request storage access based on the current policy.
3391         BasedOnCookiePolicy – This third-party should be treated according to the underlying cookie policy.
3392         OnlyIfGranted – This third-party can and must get access through the Storage Access API.
3393
3394         Here's the truth table I used to work through the logic for both
3395         document.hasStorageAccess() and document.requestStorageAccess():
3396
3397         Access  | Is        | User        | Has    | 3rd-party    |        |
3398         granted | prevalent | interaction | cookie | cookie block | RESULT |
3399         -------------------------------------------------------------------
3400         |       |           |             |        |              | false  |
3401         -------------------------------------------------------------------
3402         |       |           |             |        | true         | false  |
3403         -------------------------------------------------------------------
3404         |       |           |             | true   |              | true   |
3405         -------------------------------------------------------------------
3406         |       |           |             | true   | true         | false  |
3407         -------------------------------------------------------------------
3408         |       |           | true        |        |              | false  |
3409         -------------------------------------------------------------------
3410         |       |           | true        |        | true         | false  |
3411         -------------------------------------------------------------------
3412         |       |           | true        | true   |              | true   |
3413         -------------------------------------------------------------------
3414         |       |           | true        | true   | true         | false  |
3415         -------------------------------------------------------------------
3416         |       | true      | !care       | !care  | !care        | false  |
3417         -------------------------------------------------------------------
3418         | true  | !care     | !care       | !care  | !care        | true   |
3419         -------------------------------------------------------------------
3420
3421         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3422         (WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess const):
3423         (WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess):
3424         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
3425         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):