Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
4         https://bugs.webkit.org/show_bug.cgi?id=193109
5         <rdar://problem/44807048>
6
7         Reviewed by Ryosuke Niwa.
8
9         Add a new SPI configuration flag to enable the UndoManager API. This is off by default.
10
11         * Shared/WebPreferences.yaml:
12         * UIProcess/API/Cocoa/WKWebView.mm:
13         (-[WKWebView _initializeWithConfiguration:]):
14         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
15         (-[WKWebViewConfiguration init]):
16         (-[WKWebViewConfiguration copyWithZone:]):
17         (-[WKWebViewConfiguration _setUndoManagerAPIEnabled:]):
18         (-[WKWebViewConfiguration _undoManagerAPIEnabled]):
19         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
20
21 2019-01-10  Jiewen Tan  <jiewen_tan@apple.com>
22
23         [WebAuthN] Change the nonce in the CTAP kInit command to weak random values
24         https://bugs.webkit.org/show_bug.cgi?id=192061
25         <rdar://problem/46471091>
26
27         Reviewed by Chris Dumez.
28
29         Change the nonce in the CTAP kInit command to weak random values as the nonce is mainly
30         for being a probabilistically unique global identifier for hand shakes, instead of
31         preventing replay attacks. Otherwise, it might exhaust system entropy unnecessarily.
32
33         The patch also removes all logging when debugging the test case flakiness.
34
35         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
36         (WebKit::AuthenticatorManager::respondReceived):
37         (WebKit::AuthenticatorManager::initTimeOutTimer):
38         (WebKit::AuthenticatorManager::timeOutTimerFired):
39         * UIProcess/WebAuthentication/Cocoa/HidService.mm:
40         (WebKit::HidService::deviceAdded):
41         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
42         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
43         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
44         (WebKit::MockHidConnection::send):
45         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp:
46         (WebKit::CtapHidAuthenticator::makeCredential):
47         (WebKit::CtapHidAuthenticator::getAssertion):
48         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
49         (WebKit::CtapHidDriver::Worker::write):
50         (WebKit::CtapHidDriver::Worker::read):
51         (WebKit::CtapHidDriver::Worker::returnMessage):
52         (WebKit::CtapHidDriver::transact):
53         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
54         (WebKit::CtapHidDriver::continueAfterResponseReceived):
55
56 2019-01-10  Timothy Hatcher  <timothy@apple.com>
57
58         Add WKBundlePage SPI to temporarily force light or dark appearance on a page.
59         https://bugs.webkit.org/show_bug.cgi?id=193327
60         rdar://problem/47093222
61
62         Reviewed by Tim Horton.
63
64         Tests: WebKit.ForceLightAppearanceInBundle API Test
65
66         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
67         (WKBundlePageSetUseDarkAppearance): Added.
68         (WKBundlePageIsUsingDarkAppearance): Added.
69         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
70
71 2019-01-10  Eric Carlson  <eric.carlson@apple.com>
72
73         DeviceID hash salt manager can be NULL
74         https://bugs.webkit.org/show_bug.cgi?id=193334
75         <rdar://problem/47179650>
76
77         Reviewed by Youenn Fablet.
78
79         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
80         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): No need to
81         NULL-check websiteDataStore.deviceIdHashSaltStorage, it is a Ref.
82         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): Ditto.
83         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo): Ditto.
84         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): Ditto.
85
86         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
87         (WebKit::WebsiteDataStore::WebsiteDataStore): m_deviceIdHashSaltStorage is a Ref.
88         (WebKit::WebsiteDataStore::fetchDataAndApply): Ditto.
89         (WebKit::WebsiteDataStore::removeData): Ditto.
90         * UIProcess/WebsiteData/WebsiteDataStore.h:
91         (WebKit::WebsiteDataStore::deviceIdHashSaltStorage): Ditto.
92
93 2019-01-10  Per Arne Vollan  <pvollan@apple.com>
94
95         [macOS] Add name of IORegistry key in sandbox.
96         https://bugs.webkit.org/show_bug.cgi?id=193335
97         <rdar://problem/47184951>
98
99         Reviewed by Alexey Proskuryakov.
100
101         The property IOGVAHEVCDecodeCapabilities was added in https://bugs.webkit.org/show_bug.cgi?id=193324.
102         Also, the property IOGVAHEVCEncodeCapabilities needs to be added.
103
104         * WebProcess/com.apple.WebProcess.sb.in:
105
106 2019-01-10  Zalan Bujtas  <zalan@apple.com>
107
108         REGRESSION (r237658): Tap highlight limits cause the highlight to no longer show with legitimate button sizes
109         https://bugs.webkit.org/show_bug.cgi?id=193294
110         <rdar://problem/46006678>
111
112         Reviewed by Simon Fraser.
113
114         Input type elements should always paint tap highlight (ignore size heuristic). 
115
116         * UIProcess/PageClient.h:
117         * UIProcess/WebPageProxy.h:
118         * UIProcess/WebPageProxy.messages.in:
119         * UIProcess/ios/PageClientImplIOS.h:
120         * UIProcess/ios/PageClientImplIOS.mm:
121         (WebKit::PageClientImpl::didGetTapHighlightGeometries):
122         * UIProcess/ios/WKContentViewInteraction.h:
123         * UIProcess/ios/WKContentViewInteraction.mm:
124         (-[WKContentView _showTapHighlight]):
125         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:nodeHasBuiltInClickHandling:]):
126         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]): Deleted.
127         * UIProcess/ios/WebPageProxyIOS.mm:
128         (WebKit::WebPageProxy::didGetTapHighlightGeometries):
129         * WebProcess/WebPage/ios/WebPageIOS.mm:
130         (WebKit::WebPage::sendTapHighlightForNodeIfNecessary):
131
132 2019-01-10  Alexey Proskuryakov  <ap@apple.com>
133
134         Remove unneeded XPCService variant for plugin service
135         https://bugs.webkit.org/show_bug.cgi?id=193326
136
137         Reviewed by Tim Horton.
138
139         * Configurations/PluginService.32.xcconfig: Removed.
140         * Configurations/PluginService.64.xcconfig:
141         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist: Removed.
142         * PluginProcess/EntryPoint/mac/XPCService/PluginService.64.Info.plist: Copied from Source/WebKit/PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist.
143         * WebKit.xcodeproj/project.pbxproj:
144
145 2019-01-10  Eric Carlson  <eric.carlson@apple.com>
146
147         Define page media state flags for display capture.
148         https://bugs.webkit.org/show_bug.cgi?id=193230
149         <rdar://problem/47095142>
150
151         Reviewed by Youenn Fablet.
152
153         * UIProcess/API/C/WKPage.cpp:
154         (WKPageGetMediaState):
155         * UIProcess/API/C/WKPagePrivate.h:
156         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
157         (WebKit::UserMediaCaptureManager::Source::Source):
158         (WebKit::UserMediaCaptureManager::createCaptureSource):
159
160 2019-01-10  Alex Christensen  <achristensen@webkit.org>
161
162         REGRESSION(r239815) http/tests/workers/service/serviceworker-private-browsing.https.html test times out
163         https://bugs.webkit.org/show_bug.cgi?id=193325
164
165         Reviewed by Joseph Pecoraro.
166
167         InjectedBundle::setPrivateBrowsingEnabled effectively didn't do anything when enabled was false.
168         I made it destroy the legacy private browsing session in the NetworkProcess, which caused a test to time out.
169         This functionality is only used for testing, so it's no big deal to revert that part of the patch.
170
171         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
172         (WebKit::NetworkConnectionToWebProcess::destroyLegacyPrivateBrowsingSession): Deleted.
173         * NetworkProcess/NetworkConnectionToWebProcess.h:
174         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
175         * WebProcess/InjectedBundle/InjectedBundle.cpp:
176         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
177         * WebProcess/WebProcess.cpp:
178         (WebKit::WebProcess::destroyLegacyPrivateBrowsingSessionInNetworkProcess): Deleted.
179         * WebProcess/WebProcess.h:
180
181 2019-01-10  Per Arne Vollan  <pvollan@apple.com>
182
183         [macOS] Add name of IORegistry key in sandbox.
184         https://bugs.webkit.org/show_bug.cgi?id=193324
185
186         Reviewed by Brent Fulgham.
187
188         IOGVAVTCapabilities key has been changed to IOGVAHEVCDecodeCapabilities.
189
190         * WebProcess/com.apple.WebProcess.sb.in:
191
192 2019-01-10  John Wilander  <wilander@apple.com>
193
194         Override the session configuration for cookieAcceptPolicy
195         https://bugs.webkit.org/show_bug.cgi?id=190925
196         <rdar://problem/45497382>
197
198         Reviewed by Alexey Proskuryakov and Alex Christensen.
199
200         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
201         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
202             Now sets cookieStorage._overrideSessionCookieAcceptPolicy to YES.
203
204 2019-01-09  Matt Rajca  <mrajca@apple.com>
205
206         Put per-document autoplay behavior behind runtime website policies quirk instead of a compile time flag
207         https://bugs.webkit.org/show_bug.cgi?id=193301
208
209         Reviewed by Jer Noble.
210
211         Register a new quirk that can be configured per-load for per-document media
212         autoplay behaviors.
213
214         * Shared/WebsiteAutoplayQuirk.h:
215         * Shared/WebsitePoliciesData.cpp:
216         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
217         * UIProcess/API/C/WKWebsitePolicies.cpp:
218         (WKWebsitePoliciesSetAllowedAutoplayQuirks):
219         (WKWebsitePoliciesGetAllowedAutoplayQuirks):
220         * UIProcess/API/C/WKWebsitePolicies.h:
221         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
222         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
223         (-[_WKWebsitePolicies setAllowedAutoplayQuirks:]):
224         (-[_WKWebsitePolicies allowedAutoplayQuirks]):
225
226 2019-01-10  Tim Horton  <timothy_horton@apple.com>
227
228         Rename some entitlements files to be more clear about their target platform
229         https://bugs.webkit.org/show_bug.cgi?id=193311
230
231         Reviewed by Alexey Proskuryakov.
232
233         * Configurations/Network-iOSMac.entitlements: Renamed from Source/WebKit/Configurations/Network-iOS-minimalsimulator.entitlements.
234         * Configurations/NetworkService.xcconfig:
235         * Configurations/WebContent-iOSMac.entitlements: Renamed from Source/WebKit/Configurations/WebContent-iOS-minimalsimulator.entitlements.
236         * Configurations/WebContentService.xcconfig:
237         * WebKit.xcodeproj/project.pbxproj:
238
239 2019-01-09  Brent Fulgham  <bfulgham@apple.com>
240
241         Unreviewed build fix after r239816.
242
243         Although EWS had no problem with the patch, I'm seeing build errors on the actual bots.
244         This patch corrects the problem.
245
246         * NetworkProcess/NetworkProcess.cpp:
247         (WebKit::NetworkProcess::logFrameNavigation):
248         (WebKit::NetworkProcess::logUserInteraction):
249
250 2019-01-09  Brent Fulgham  <bfulgham@apple.com>
251
252         Create a WebResourceLoadStatisticsStore attached to the NetworkSession
253         https://bugs.webkit.org/show_bug.cgi?id=193261
254         <rdar://problem/47158616>
255
256         Reviewed by Alex Christensen.
257
258         This patch modifies NetworkSession so that it owns a WebResourceLoadStatisticsStore
259         object. This object is only created if the ResourceLoadStatistics feature is turned on.
260
261         The patch also modifies WebResourceLoadStatisticsStore so that it can be constructed
262         with an owning NetworkSession as an alternative to the current practice of using a
263         WebsiteDataStore object.
264
265         Two initial messages from the WebContent process are added (logFrameNavigation and
266         logUserNavigation) that notify the network process of these actions. Currently they
267         are called in addition the calls to the WebsiteDataStore object. These redundant calls
268         will be removed in a future patch.
269
270         This patch forces the ResourceLoadStatistics code in the NetworkSession to be off by
271         default, so there should be no change in behavior with this patch.
272
273         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
274         (WebKit::ResourceLoadStatisticsMemoryStore::updateClientSideCookiesAgeCap):
275         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
276         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
277         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccessForFrame):
278         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
279         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
280         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
281         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
282         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
283         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
284         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCapForPrevalentResources):
285         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
286         (WebKit::WebResourceLoadStatisticsStore::updatePrevalentDomainsToBlockCookiesFor):
287         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
288         (WebKit::WebResourceLoadStatisticsStore::removePrevalentDomains):
289         (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler):
290         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
291         * NetworkProcess/NetworkProcess.cpp:
292         (WebKit::NetworkProcess::initializeNetworkProcess):
293         (WebKit::NetworkProcess::logFrameNavigation):
294         (WebKit::NetworkProcess::logUserInteraction):
295         * NetworkProcess/NetworkProcess.h:
296         * NetworkProcess/NetworkProcess.messages.in:
297         * NetworkProcess/NetworkSession.cpp:
298         (WebKit::NetworkSession::enableResourceLoadStatistics):
299         * NetworkProcess/NetworkSession.h:
300         (WebKit::NetworkSession::resourceLoadStatistics const):
301         * NetworkProcess/NetworkSessionCreationParameters.cpp:
302         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
303         (WebKit::NetworkSessionCreationParameters::encode const):
304         (WebKit::NetworkSessionCreationParameters::decode):
305         * NetworkProcess/NetworkSessionCreationParameters.h:
306         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
307         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
308         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
309         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
310         * UIProcess/Network/NetworkProcessProxy.cpp:
311         (WebKit::NetworkProcessProxy::didLogUserInteraction):
312         * UIProcess/Network/NetworkProcessProxy.h:
313         * UIProcess/Network/NetworkProcessProxy.messages.in:
314         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
315         (WebsiteDataStore::parameters):
316         * UIProcess/WebPageProxy.cpp:
317         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
318         (WebKit::WebPageProxy::logFrameNavigation):
319         * UIProcess/WebPageProxy.h:
320         * UIProcess/WebProcessPool.cpp:
321         (WebKit::WebProcessPool::ensureNetworkProcess):
322         (WebKit::WebProcessPool::initializeNewWebProcess):
323
324 2019-01-09  Alex Christensen  <achristensen@webkit.org>
325
326         Replace SessionTracker with HashMap member of NetworkProcess
327         https://bugs.webkit.org/show_bug.cgi?id=193266
328
329         Reviewed by Joseph Pecoraro.
330
331         * NetworkProcess/Downloads/DownloadManager.cpp:
332         (WebKit::DownloadManager::startDownload):
333         * NetworkProcess/Downloads/DownloadManager.h:
334         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
335         (WebKit::Download::resume):
336         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
337         (WebKit::NetworkCORSPreflightChecker::startPreflight):
338         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
339         (WebKit::NetworkConnectionToWebProcess::preconnectTo):
340         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
341         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
342         (WebKit::NetworkConnectionToWebProcess::destroyLegacyPrivateBrowsingSession):
343         * NetworkProcess/NetworkConnectionToWebProcess.h:
344         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
345         * NetworkProcess/NetworkProcess.cpp:
346         (WebKit::NetworkProcess::initializeNetworkProcess):
347         (WebKit::NetworkProcess::clearCachedCredentials):
348         (WebKit::NetworkProcess::networkSession):
349         (WebKit::NetworkProcess::setSession):
350         (WebKit::NetworkProcess::destroySession):
351         (WebKit::NetworkProcess::preconnectTo):
352         * NetworkProcess/NetworkProcess.h:
353         * NetworkProcess/NetworkResourceLoader.cpp:
354         (WebKit::NetworkResourceLoader::startNetworkLoad):
355         (WebKit::NetworkResourceLoader::didFinishLoading):
356         (WebKit::NetworkResourceLoader::sendResultForCacheEntry):
357         (WebKit::NetworkResourceLoader::shouldLogCookieInformation):
358         (WebKit::NetworkResourceLoader::logCookieInformation const):
359         (WebKit::logBlockedCookieInformation):
360         (WebKit::logCookieInformationInternal):
361         (WebKit::NetworkResourceLoader::logCookieInformation):
362         * NetworkProcess/NetworkResourceLoader.h:
363         * NetworkProcess/PingLoad.cpp:
364         (WebKit::PingLoad::loadRequest):
365         * NetworkProcess/PingLoad.h:
366         * NetworkProcess/PreconnectTask.cpp:
367         (WebKit::PreconnectTask::PreconnectTask):
368         * NetworkProcess/PreconnectTask.h:
369         * NetworkProcess/RemoteNetworkingContext.h:
370         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
371         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
372         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
373         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
374         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
375         * NetworkProcess/mac/RemoteNetworkingContext.mm:
376         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
377         * Shared/SessionTracker.cpp: Removed.
378         * Shared/SessionTracker.h: Removed.
379         * Sources.txt:
380         * WebKit.xcodeproj/project.pbxproj:
381         * WebProcess/InjectedBundle/InjectedBundle.cpp:
382         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
383         * WebProcess/Network/WebLoaderStrategy.cpp:
384         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
385         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
386         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
387         * WebProcess/WebPage/WebPage.cpp:
388         * WebProcess/WebProcess.cpp:
389         (WebKit::WebProcess::destroyLegacyPrivateBrowsingSessionInNetworkProcess):
390         * WebProcess/WebProcess.h:
391         * WebProcess/cocoa/WebProcessCocoa.mm:
392
393 2019-01-09  Alex Christensen  <achristensen@webkit.org>
394
395         Expand use of sourceApplicationAuditData
396         https://bugs.webkit.org/show_bug.cgi?id=192995
397         <rdar://problem/46627875>
398
399         Reviewed by Brady Eidson.
400
401         sourceApplicationAuditData has been used for a long time on iOS, but it's needed on more platforms.
402         I also made it return an Optional instead of a bool and returning by reference. Ahhh. So much nicer.
403         The NetworkProcess needed an additional entitlement on Mac to continue to load anything, which is desirable.
404
405         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
406         (WebKit::NetworkProcess::sourceApplicationAuditData const):
407         * Platform/IPC/Connection.h:
408         * Platform/IPC/mac/ConnectionMac.mm:
409         (IPC::Connection::getAuditToken):
410         * WebProcess/WebProcess.cpp:
411         (WebKit::WebProcess::initializeWebProcess):
412         * WebProcess/cocoa/WebProcessCocoa.mm:
413         (WebKit::WebProcess::sourceApplicationAuditData const):
414
415 2019-01-09  Brent Fulgham  <bfulgham@apple.com>
416
417         [iOS] Update sandbox profile to use iconservices instead of lsdiconservice
418         https://bugs.webkit.org/show_bug.cgi?id=193115
419         <rdar://problem/44867379>
420
421         Reviewed by Eric Carlson.
422
423         Add access to the 'com.apple.iconservices' endpoint. We will remove access to
424         the older name ('com.apple.lsdiconservices') once existing clients have completed
425         the switch.
426
427         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
428
429 2019-01-09  Antti Koivisto  <antti@apple.com>
430
431         [PSON] Flash of blank content while transitioning from page A to page B.
432         https://bugs.webkit.org/show_bug.cgi?id=193283
433
434         Reviewed by Chris Dumez.
435
436         Layer tree is not frozen during WebPage construction. If the flush timer (started for the initial
437         empty document) manages to run before the actual page load starts, we'll get a flash.
438
439         * Shared/WebPageCreationParameters.cpp:
440         (WebKit::WebPageCreationParameters::encode const):
441         (WebKit::WebPageCreationParameters::decode):
442         * Shared/WebPageCreationParameters.h:
443
444         Rename shouldDelayAttachingDrawingArea bit to isSwapFromSuspended and make it available on all platforms.
445
446         * UIProcess/RemoteLayerTree/mac/ScrollerMac.h: Removed.
447         * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: Removed.
448         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.h: Removed.
449         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: Removed.
450         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp: Removed.
451         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h: Removed.
452         * UIProcess/WebPageProxy.cpp:
453         (WebKit::WebPageProxy::swapToWebProcess):
454         (WebKit::WebPageProxy::finishAttachingToWebProcess):
455         (WebKit::WebPageProxy::initializeWebPage):
456         (WebKit::WebPageProxy::continueNavigationInNewProcess):
457         * UIProcess/WebPageProxy.h:
458         * WebProcess/WebPage/WebPage.cpp:
459         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
460
461         Freeze the layer tree in WebPage constructor if this is a swap from a suspended process.
462
463         (WebKit::WebPage::reinitializeWebPage):
464         (WebKit::WebPage::didCompletePageTransition):
465
466         Unfreeze on first non-initial empty document page transition.
467
468         * WebProcess/WebPage/WebPage.h:
469         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
470         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
471
472 2019-01-09  Chris Dumez  <cdumez@apple.com>
473
474         WebKit Networking process crashes if the HTTPSUpgradeList is not found in the bundle
475         https://bugs.webkit.org/show_bug.cgi?id=193285
476         <rdar://problem/47147610>
477
478         Reviewed by Geoffrey Garen.
479
480         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
481         (WebKit::networkHTTPSUpgradeCheckerDatabasePath):
482         (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker):
483
484 2019-01-09  Michael Catanzaro  <mcatanzaro@igalia.com>
485
486         [GTK] Add missing autocleanups
487         https://bugs.webkit.org/show_bug.cgi?id=193068
488
489         Reviewed by Carlos Garcia Campos.
490
491         * UIProcess/API/gtk/WebKitAutocleanups.h:
492
493 2019-01-08  Alex Christensen  <achristensen@webkit.org>
494
495         Fix CompletionHandler assertions introduced today.
496         https://bugs.webkit.org/show_bug.cgi?id=193237
497
498         This reverts part of r239710 and all of r239725, r239738, and r239748 which unsuccessfully tried to fix all the assertions.
499         This code is a mess that will have to be cleaned up later.
500
501         * NetworkProcess/NetworkResourceLoader.cpp:
502         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
503         * NetworkProcess/cache/CacheStorageEngine.cpp:
504         (WebKit::CacheStorage::Engine::from):
505         * NetworkProcess/cache/CacheStorageEngine.h:
506         * NetworkProcess/cache/NetworkCache.cpp:
507         (WebKit::NetworkCache::Cache::store):
508         (WebKit::NetworkCache::Cache::remove):
509         (WebKit::NetworkCache::Cache::traverse):
510         (WebKit::NetworkCache::Cache::clear):
511         (WebKit::NetworkCache::Cache::retrieveData):
512         * NetworkProcess/cache/NetworkCache.h:
513         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
514         (WebKit::NetworkCache::SpeculativeLoad::didFinishLoading):
515         * NetworkProcess/cache/NetworkCacheStorage.cpp:
516         (WebKit::NetworkCache::Storage::store):
517         (WebKit::NetworkCache::Storage::WriteOperation::~WriteOperation): Deleted.
518         * NetworkProcess/cache/NetworkCacheStorage.h:
519         (WebKit::NetworkCache::Storage::store):
520
521 2019-01-08  Jiewen Tan  <jiewen_tan@apple.com>
522
523         [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky
524         https://bugs.webkit.org/show_bug.cgi?id=192061
525
526         Reviewed by Dewei Zhu.
527
528         Part 6.
529
530         Add some additional temporary logging info to determine if data is actually sent.
531         Once the bug is determined and fixed, we should remove all logging added in this patch.
532
533         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
534         (WebKit::MockHidConnection::send):
535
536 2019-01-08  Jiewen Tan  <jiewen_tan@apple.com>
537
538         [WebAuthN] Support U2F HID Authenticators on macOS
539         https://bugs.webkit.org/show_bug.cgi?id=191535
540         <rdar://problem/47102027>
541
542         Reviewed by Brent Fulgham.
543
544         This patch implements the support for U2F authenticators, and enables it for hid devices.
545         It follows the CTAP spec to map WebAuthN requests to U2F commands and return the responses:
546         https://fidoalliance.org/specs/fido-v2.0-id-20180227/fido-client-to-authenticator-protocol-v2.0-id-20180227.html#u2f-interoperability
547         Most of the parts are done before this patch, this patch focues on: 7.2.2 and 7.3.2.
548
549         Besides implementing the U2fHidAuthenticator, this patch also adds support in the mocking
550         environment for U2F authenticators. It is done by extending the stages in MockHidConnection
551         from 4 to indefinite as multi-round communications are expected to map WebAuthN requests
552         to U2F requests.
553
554         * Sources.txt:
555         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
556         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
557         * UIProcess/WebAuthentication/Cocoa/HidService.mm:
558         (WebKit::HidService::continueAddDeviceAfterGetInfo):
559         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
560         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
561         * UIProcess/WebAuthentication/fido/CtapHidDriver.h:
562         (WebKit::CtapHidDriver::setProtocol):
563         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp: Added.
564         (WebKit::U2fHidAuthenticator::U2fHidAuthenticator):
565         (WebKit::U2fHidAuthenticator::makeCredential):
566         (WebKit::U2fHidAuthenticator::checkExcludeList):
567         (WebKit::U2fHidAuthenticator::issueRegisterCommand):
568         (WebKit::U2fHidAuthenticator::getAssertion):
569         (WebKit::U2fHidAuthenticator::issueSignCommand):
570         (WebKit::U2fHidAuthenticator::issueNewCommand):
571         (WebKit::U2fHidAuthenticator::issueCommand):
572         (WebKit::U2fHidAuthenticator::responseReceived):
573         (WebKit::U2fHidAuthenticator::continueRegisterCommandAfterResponseReceived):
574         (WebKit::U2fHidAuthenticator::continueCheckOnlyCommandAfterResponseReceived):
575         (WebKit::U2fHidAuthenticator::continueBogusCommandAfterResponseReceived):
576         (WebKit::U2fHidAuthenticator::continueSignCommandAfterResponseReceived):
577         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h: Added.
578         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
579         (WebKit::MockHidConnection::parseRequest):
580         (WebKit::MockHidConnection::feedReports):
581         * UIProcess/WebAuthentication/Mock/MockHidConnection.h:
582         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
583         * WebKit.xcodeproj/project.pbxproj:
584
585 2019-01-08  Youenn Fablet  <youenn@apple.com>
586
587         service worker fetch handler results in bad referrer
588         https://bugs.webkit.org/show_bug.cgi?id=188248
589         <rdar://problem/47050478>
590
591         Reviewed by Alex Christensen.
592
593         NetworkDataTaskCocoa is sometimes updating the referrer on its own.
594         Instead of updating the referrer when sending the request to WebProcess for evaluation,
595         Update the referrer once the web process decides to follow the redirection.
596         This ensures that any referrer that the WebProcess will set will be updated by NetworkDataTaskCocoa.
597
598         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
599         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
600         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
601         (WebKit::NetworkDataTaskCocoa::restrictRequestReferrerToOriginIfNeeded):
602         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
603
604 2019-01-08  Alex Christensen  <achristensen@webkit.org>
605
606         Fix more assertions after r239710
607         https://bugs.webkit.org/show_bug.cgi?id=193237
608
609         * NetworkProcess/cache/NetworkCacheStorage.h:
610         (WebKit::NetworkCache::Storage::store):
611         Make default parameter an empty lambda instead of a null CompletionHandler.
612         This way it can be called once instead of thinking it has already been called.
613
614 2019-01-08  Brent Fulgham  <bfulgham@apple.com>
615
616         Move ResourceLoadStatistics files from UIProcess to NetworkProcess
617         https://bugs.webkit.org/show_bug.cgi?id=193252
618         <rdar://problem/47125401>
619
620         Reviewed by Alex Christensen.
621
622         This patch is the first part of a refactoring to move the ResourceLoadStatistics logic from the UIProcess to the NetworkProcess.
623
624         This patch moves code into different folders and adjusts necessary build files, but does not change where the code executes. These
625         changes have no impact on behavior or test results.
626
627         I also modified a few files to add missing include files uncovered by the unified build system.
628
629         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: Renamed from Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp.
630         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: Renamed from Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h.
631         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp: Renamed from Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp.
632         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.h: Renamed from Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.h.
633         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: Renamed from Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp.
634         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: Renamed from Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h.
635         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp: Renamed from Source/WebKit/UIProcess/WebResourceLoadStatisticsTelemetry.cpp.
636         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.h: Renamed from Source/WebKit/UIProcess/WebResourceLoadStatisticsTelemetry.h.
637         * NetworkProcess/Downloads/PendingDownload.cpp:
638         * NetworkProcess/Downloads/PendingDownload.h:
639         * CMakeLists.txt:
640         * PlatformMac.cmake:
641         * PlatformWin.cmake:
642         * Shared/PersistencyUtils.cpp: Renamed from Source/WebKit/UIProcess/PersistencyUtils.cpp.
643         * Shared/PersistencyUtils.h: Renamed from Source/WebKit/UIProcess/PersistencyUtils.h.
644         * Sources.txt:
645         * SourcesCocoa.txt:
646         * SourcesGTK.txt:
647         * SourcesWPE.txt:
648         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
649         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): Add missing WebKit:: scope.
650         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: Add missing include.
651         * UIProcess/WebDataListSuggestionsDropdown.cpp: Ditto.
652         * UIProcess/mac/DisplayLink.cpp:
653         * UnifiedSources-input.xcfilelist:
654         * WebKit.xcodeproj/project.pbxproj:
655
656 2019-01-08  Chris Dumez  <cdumez@apple.com>
657
658         Mark SuspendedPageProxy as fast allocated
659         https://bugs.webkit.org/show_bug.cgi?id=193248
660
661         Reviewed by Alex Christensen.
662
663         * UIProcess/SuspendedPageProxy.h:
664
665 2019-01-08  Chris Dumez  <cdumez@apple.com>
666
667         Prevent cross-site top-level navigations from third-party iframes
668         https://bugs.webkit.org/show_bug.cgi?id=193076
669         <rdar://problem/36074736>
670
671         Reviewed by Alex Christensen.
672
673         Add experimental feature flag, on by default.
674
675         * Shared/WebPreferences.yaml:
676
677 2019-01-08  Alex Christensen  <achristensen@webkit.org>
678
679         Remove more use of NetworkProcess::singleton
680         https://bugs.webkit.org/show_bug.cgi?id=193244
681
682         Reviewed by Brent Fulgham.
683
684         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
685         (WebKit::NetworkCORSPreflightChecker::NetworkCORSPreflightChecker):
686         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
687         * NetworkProcess/NetworkCORSPreflightChecker.h:
688         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
689         (WebKit::NetworkConnectionToWebProcess::loadPing):
690         * NetworkProcess/NetworkContentRuleListManager.cpp:
691         (WebKit::NetworkContentRuleListManager::NetworkContentRuleListManager):
692         (WebKit::NetworkContentRuleListManager::contentExtensionsBackend):
693         * NetworkProcess/NetworkContentRuleListManager.h:
694         * NetworkProcess/NetworkLoadChecker.cpp:
695         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
696         (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded const):
697         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
698         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
699         * NetworkProcess/NetworkLoadChecker.h:
700         * NetworkProcess/NetworkProcess.cpp:
701         (WebKit::NetworkProcess::NetworkProcess):
702         (WebKit::NetworkProcess::didReceiveMessage):
703         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
704         * NetworkProcess/NetworkProcess.h:
705         (WebKit::NetworkProcess::networkContentRuleListManager):
706         * NetworkProcess/NetworkResourceLoader.cpp:
707         * NetworkProcess/PingLoad.cpp:
708         (WebKit::PingLoad::PingLoad):
709         * NetworkProcess/PingLoad.h:
710         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
711         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
712         (WebKit::WebSWServerToContextConnection::connectionMayNoLongerBeNeeded):
713         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
714
715 2019-01-08  Alex Christensen  <achristensen@webkit.org>
716
717         Stop using NetworkProcess::singleton in NetworkCache code
718         https://bugs.webkit.org/show_bug.cgi?id=193243
719
720         Reviewed by Brent Fulgham.
721
722         * NetworkProcess/cache/NetworkCache.cpp:
723         (WebKit::NetworkCache::Cache::open):
724         (WebKit::NetworkCache::Cache::Cache):
725         * NetworkProcess/cache/NetworkCache.h:
726         (WebKit::NetworkCache::Cache::networkProcess):
727         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
728         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
729         (WebKit::NetworkCache::SpeculativeLoadManager::canRetrieve const):
730         (WebKit::NetworkCache::SpeculativeLoadManager::addPreloadedEntry):
731         (WebKit::NetworkCache::SpeculativeLoadManager::revalidateSubresource):
732         (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
733         (WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
734         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
735         (WebKit::NetworkCache::Statistics::recordRetrievalRequest):
736         (WebKit::NetworkCache::Statistics::recordNotUsingCacheForRequest):
737         (WebKit::NetworkCache::Statistics::recordRetrievalFailure):
738         (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry):
739         (WebKit::NetworkCache::Statistics::recordRevalidationSuccess):
740         * NetworkProcess/cache/NetworkCacheStorage.cpp:
741         (WebKit::NetworkCache::retrieveFromMemory):
742         * NetworkProcess/cache/NetworkCacheStorage.h:
743         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
744         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
745
746 2019-01-08  Alex Christensen  <achristensen@webkit.org>
747
748         Call CompletionHandler when destroying a NetworkCache::Storage::WriteOperation
749         https://bugs.webkit.org/show_bug.cgi?id=193251
750
751         Reviewed by Chris Dumez.
752
753         This fixes another assertion introduced in r239710.
754
755         * NetworkProcess/cache/NetworkCacheStorage.cpp:
756         (WebKit::NetworkCache::Storage::WriteOperation::~WriteOperation):
757
758 2019-01-08  Alex Christensen  <achristensen@webkit.org>
759
760         Stop using NetworkStorageSession in WebProcess
761         https://bugs.webkit.org/show_bug.cgi?id=193236
762
763         Reviewed by Don Olmstead.
764
765         * Shared/WebProcessCreationParameters.cpp:
766         (WebKit::WebProcessCreationParameters::encode const):
767         (WebKit::WebProcessCreationParameters::decode):
768         * Shared/WebProcessCreationParameters.h:
769         * Shared/WebsitePoliciesData.cpp:
770         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
771         * UIProcess/WebProcessPool.cpp:
772         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
773         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
774         (WebKit::WebProcessPool::initializeNewWebProcess):
775         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
776         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
777         (WebKit::WebProcessPool::processForNavigationInternal):
778         * WebProcess/InjectedBundle/InjectedBundle.cpp:
779         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
780         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
781         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
782         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession): Deleted.
783         (WebKit::WebFrameNetworkingContext::storageSession const): Deleted.
784         * WebProcess/WebPage/WebPage.cpp:
785         (WebKit::WebPage::setSessionID):
786         * WebProcess/WebProcess.cpp:
787         (WebKit::WebProcess::initializeWebProcess):
788         (WebKit::WebProcess::fetchWebsiteData):
789         (WebKit::WebProcess::addWebsiteDataStore): Deleted.
790         (WebKit::WebProcess::destroySession): Deleted.
791         * WebProcess/WebProcess.h:
792         * WebProcess/WebProcess.messages.in:
793
794 2019-01-08  Michael Catanzaro  <mcatanzaro@igalia.com>
795
796         Unreviewed, silence -Wformat warnings
797
798         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
799         (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker):
800         (WebKit::NetworkHTTPSUpgradeChecker::query):
801
802 2019-01-08  Alex Christensen  <achristensen@webkit.org>
803
804         Unreviewed, rolling out r239727.
805
806         Broke API tests
807
808         Reverted changeset:
809
810         "Stop using NetworkStorageSession in WebProcess"
811         https://bugs.webkit.org/show_bug.cgi?id=193236
812         https://trac.webkit.org/changeset/239727
813
814 2019-01-08  Brian Burg  <bburg@apple.com>
815
816         Remove WKPageRef-based SPI in _WKAutomationSessionDelegate
817         https://bugs.webkit.org/show_bug.cgi?id=193202
818         <rdar://problem/37408718>
819
820         Reviewed by Alex Christensen.
821
822         This code is no longer used, it should be deleted.
823
824         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
825         * UIProcess/Cocoa/AutomationSessionClient.h:
826         * UIProcess/Cocoa/AutomationSessionClient.mm:
827         (WebKit::AutomationSessionClient::AutomationSessionClient):
828         (WebKit::AutomationSessionClient::requestNewPageWithOptions):
829         (WebKit::AutomationSessionClient::requestSwitchToPage):
830         (WebKit::AutomationSessionClient::requestHideWindowOfPage):
831         (WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
832         (WebKit::AutomationSessionClient::requestMaximizeWindowOfPage):
833         (WebKit::AutomationSessionClient::isShowingJavaScriptDialogOnPage):
834         (WebKit::AutomationSessionClient::dismissCurrentJavaScriptDialogOnPage):
835         (WebKit::AutomationSessionClient::acceptCurrentJavaScriptDialogOnPage):
836         (WebKit::AutomationSessionClient::messageOfCurrentJavaScriptDialogOnPage):
837         (WebKit::AutomationSessionClient::setUserInputForCurrentJavaScriptPromptOnPage):
838         (WebKit::AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage):
839         Clean up the delegate bridging methods now that only one delegate implementation is possible.
840
841 2019-01-08  Patrick Griffis  <pgriffis@igalia.com>
842
843         [GTK][WPE] Remove DConf permissions from sandbox
844         https://bugs.webkit.org/show_bug.cgi?id=193021
845
846         Reviewed by Michael Catanzaro.
847
848         The latest development releases of xdg-desktop-portal and gtk3 use a
849         new portal for settings on Wayland org.freedesktop.portal.Settings.
850
851         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
852         (WebKit::bubblewrapSpawn):
853
854 2019-01-08  Alex Christensen  <achristensen@webkit.org>
855
856         Stop using NetworkStorageSession in WebProcess
857         https://bugs.webkit.org/show_bug.cgi?id=193236
858
859         Reviewed by Don Olmstead.
860
861         * Shared/WebProcessCreationParameters.cpp:
862         (WebKit::WebProcessCreationParameters::encode const):
863         (WebKit::WebProcessCreationParameters::decode):
864         * Shared/WebProcessCreationParameters.h:
865         * Shared/WebsitePoliciesData.cpp:
866         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
867         * UIProcess/WebProcessPool.cpp:
868         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
869         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
870         (WebKit::WebProcessPool::initializeNewWebProcess):
871         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
872         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
873         (WebKit::WebProcessPool::processForNavigationInternal):
874         * WebProcess/InjectedBundle/InjectedBundle.cpp:
875         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
876         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
877         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
878         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession): Deleted.
879         (WebKit::WebFrameNetworkingContext::storageSession const): Deleted.
880         * WebProcess/WebPage/WebPage.cpp:
881         (WebKit::WebPage::setSessionID):
882         * WebProcess/WebProcess.cpp:
883         (WebKit::WebProcess::initializeWebProcess):
884         (WebKit::WebProcess::fetchWebsiteData):
885         (WebKit::WebProcess::addWebsiteDataStore): Deleted.
886         (WebKit::WebProcess::destroySession): Deleted.
887         * WebProcess/WebProcess.h:
888         * WebProcess/WebProcess.messages.in:
889
890 2019-01-08  Alex Christensen  <achristensen@webkit.org>
891
892         Always call CompletionHandler in Cache::store
893         https://bugs.webkit.org/show_bug.cgi?id=193237
894
895         Reviewed by Chris Dumez.
896
897         No change in behavior. This just fixes an assertion introduced in r239710 when the speculative loader finishes.
898
899         * NetworkProcess/NetworkResourceLoader.cpp:
900         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
901         * NetworkProcess/cache/NetworkCache.cpp:
902         (WebKit::NetworkCache::Cache::store):
903         * NetworkProcess/cache/NetworkCache.h:
904         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
905         (WebKit::NetworkCache::SpeculativeLoad::didFinishLoading):
906
907 2019-01-08  Carlos Garcia Campos  <cgarcia@igalia.com>
908
909         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.23.2 release
910
911         * gtk/NEWS: Add release notes for 2.23.2.
912
913 2019-01-07  Chris Dumez  <cdumez@apple.com>
914
915         Cannot scoll for 5 seconds after swiping back on quoteunquoteapps.com
916         https://bugs.webkit.org/show_bug.cgi?id=193215
917         <rdar://problem/45108222>
918
919         Reviewed by Tim Horton.
920
921         When doing the history navigation, if the source and destination history
922         items are clones then we will not trigger a main frame load. We may
923         however trigger loads in subframes if needed. This was an issue for the
924         ViewGestureController because it was expecting a main frame load after
925         calling WebPageProxy::goToBackForwardItem() in order to determine when
926         taking down the view snapshot is appropriate.
927
928         To address the problem, the ViewGestureController now takes the snapshot
929         down as soon as the swipe gesture ends when the source and destination
930         items are clones.
931
932         * Shared/WebBackForwardListItem.cpp:
933         (WebKit::childItemWithTarget):
934         (WebKit::WebBackForwardListItem::itemIsInSameDocument const):
935         (WebKit::hasSameFrames):
936         (WebKit::WebBackForwardListItem::itemIsClone):
937         * Shared/WebBackForwardListItem.h:
938         * UIProcess/ios/ViewGestureControllerIOS.mm:
939         (WebKit::ViewGestureController::endSwipeGesture):
940         * UIProcess/mac/ViewGestureControllerMac.mm:
941         (WebKit::ViewGestureController::endSwipeGesture):
942
943 2019-01-07  David Kilzer  <ddkilzer@apple.com>
944
945         Leak of ScrollCompletionCallbackData (16 bytes) in com.apple.WebKit.WebContent running WebKit layout tests
946         <https://webkit.org/b/193222>
947         <rdar://problem/46862309>
948
949         Reviewed by Joseph Pecoraro.
950
951         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
952         (WKBundlePageRegisterScrollOperationCompletionCallback): Change
953         to return true if callback will be called, else false.
954         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
955         (WKBundlePageRegisterScrollOperationCompletionCallback): Change
956         to return `bool` value to denote whether callback will be called
957         (true) or not called (false).
958
959 2019-01-07  Alex Christensen  <achristensen@webkit.org>
960
961         Remove use of NetworkProcess::singleton from CacheStorage::Engine::from
962         https://bugs.webkit.org/show_bug.cgi?id=193220
963
964         Reviewed by Andy Estes.
965
966         This required passing the NetworkProcess& in from all its callers.
967         While I was at it, I made them use CompletionHandlers where appropriate.
968
969         * NetworkProcess/NetworkProcess.cpp:
970         (WebKit::NetworkProcess::destroySession):
971         (WebKit::NetworkProcess::fetchWebsiteData):
972         (WebKit::NetworkProcess::deleteWebsiteData):
973         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
974         (WebKit::NetworkProcess::findCacheEngine):
975         (WebKit::NetworkProcess::ensureCacheEngine):
976         (WebKit::NetworkProcess::removeCacheEngine):
977         * NetworkProcess/NetworkProcess.h:
978         * NetworkProcess/cache/CacheStorageEngine.cpp:
979         (WebKit::CacheStorage::Engine::from):
980         (WebKit::CacheStorage::Engine::destroyEngine):
981         (WebKit::CacheStorage::Engine::fetchEntries):
982         (WebKit::CacheStorage::Engine::open):
983         (WebKit::CacheStorage::Engine::remove):
984         (WebKit::CacheStorage::Engine::retrieveCaches):
985         (WebKit::CacheStorage::Engine::retrieveRecords):
986         (WebKit::CacheStorage::Engine::putRecords):
987         (WebKit::CacheStorage::Engine::deleteMatchingRecords):
988         (WebKit::CacheStorage::Engine::lock):
989         (WebKit::CacheStorage::Engine::unlock):
990         (WebKit::CacheStorage::Engine::clearMemoryRepresentation):
991         (WebKit::CacheStorage::Engine::representation):
992         (WebKit::CacheStorage::Engine::clearAllCaches):
993         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
994         (WebKit::CacheStorage::globalEngineMap): Deleted.
995         * NetworkProcess/cache/CacheStorageEngine.h:
996         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
997         (WebKit::CacheStorageEngineConnection::~CacheStorageEngineConnection):
998         (WebKit::CacheStorageEngineConnection::open):
999         (WebKit::CacheStorageEngineConnection::remove):
1000         (WebKit::CacheStorageEngineConnection::caches):
1001         (WebKit::CacheStorageEngineConnection::retrieveRecords):
1002         (WebKit::CacheStorageEngineConnection::deleteMatchingRecords):
1003         (WebKit::CacheStorageEngineConnection::putRecords):
1004         (WebKit::CacheStorageEngineConnection::reference):
1005         (WebKit::CacheStorageEngineConnection::dereference):
1006         (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation):
1007         (WebKit::CacheStorageEngineConnection::engineRepresentation):
1008         * NetworkProcess/cache/NetworkCache.cpp:
1009         (WebKit::NetworkCache::Cache::store):
1010         (WebKit::NetworkCache::Cache::remove):
1011         (WebKit::NetworkCache::Cache::traverse):
1012         (WebKit::NetworkCache::Cache::clear):
1013         (WebKit::NetworkCache::Cache::retrieveData):
1014         * NetworkProcess/cache/NetworkCache.h:
1015
1016 2019-01-07  David Kilzer  <ddkilzer@apple.com>
1017
1018         Prefer RetainPtr<NSObject> to RetainPtr<NSObject *>
1019         <https://webkit.org/b/193056>
1020
1021         Reviewed by Alex Christensen.
1022
1023         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
1024         (WebKit::XPCServiceMain):
1025         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
1026         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
1027         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
1028         * UIProcess/Plugins/PluginProcessProxy.h:
1029         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1030         (WebKit::RemoteLayerTreeHost::createEmbeddedView):
1031         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
1032         (WebKit::PlatformCALayerRemoteCustom::clone const):
1033         - Remove '*' from RetainPtr<> type.
1034
1035 2019-01-07  Dean Jackson  <dino@apple.com>
1036
1037         Turn on Pointer Events by default for iOS
1038         https://bugs.webkit.org/show_bug.cgi?id=193214
1039         <rdar://problem/46974878>
1040
1041         Reviewed by Wenson Hsieh.
1042
1043         Turn on Pointer Events.
1044
1045         * Shared/WebPreferences.yaml:
1046         * Shared/WebPreferencesDefaultValues.h: Make a new #define for iOS.
1047
1048 2019-01-07  Alex Christensen  <achristensen@webkit.org>
1049
1050         Remove use of NetworkProcess::singleton in ServiceWorker code
1051         https://bugs.webkit.org/show_bug.cgi?id=193209
1052
1053         Reviewed by Megan Gardner.
1054
1055         Use a member Ref<NetworkProcess> instead to avoid global singleton use.
1056
1057         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1058         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
1059         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1060         (WebKit::WebSWServerConnection::WebSWServerConnection):
1061         (WebKit::WebSWServerConnection::~WebSWServerConnection):
1062         (WebKit::WebSWServerConnection::startFetch):
1063         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
1064         (WebKit::WebSWServerConnection::scheduleJobInServer):
1065         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
1066
1067 2019-01-07  Alex Christensen  <achristensen@webkit.org>
1068
1069         Remove use of NetworkProcess::singleton in NetworkLoad/NetworkDataTask code
1070         https://bugs.webkit.org/show_bug.cgi?id=193212
1071
1072         Reviewed by Andy Estes.
1073
1074         * NetworkProcess/NetworkDataTaskBlob.cpp:
1075         (WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob):
1076         (WebKit::NetworkDataTaskBlob::download):
1077         (WebKit::NetworkDataTaskBlob::writeDownload):
1078         (WebKit::NetworkDataTaskBlob::didFailDownload):
1079         (WebKit::NetworkDataTaskBlob::didFinishDownload):
1080         * NetworkProcess/NetworkDataTaskBlob.h:
1081         * NetworkProcess/NetworkLoad.cpp:
1082         (WebKit::NetworkLoad::NetworkLoad):
1083         (WebKit::NetworkLoad::convertTaskToDownload):
1084         (WebKit::NetworkLoad::didReceiveChallenge):
1085         (WebKit::NetworkLoad::didReceiveResponse):
1086         * NetworkProcess/NetworkLoad.h:
1087
1088 2019-01-07  Alex Christensen  <achristensen@webkit.org>
1089
1090         Remove use of NetworkProcess::singleton for downloads
1091         https://bugs.webkit.org/show_bug.cgi?id=193207
1092
1093         Reviewed by Brady Eidson.
1094
1095         No change in behavior.  The DownloadManager is now a member of the NetworkProcess instead of a static singleton.
1096
1097         * NetworkProcess/Downloads/Download.cpp:
1098         (WebKit::Download::Download):
1099         (WebKit::Download::didReceiveChallenge):
1100         * NetworkProcess/Downloads/Download.h:
1101         * NetworkProcess/Downloads/DownloadManager.cpp:
1102         (WebKit::DownloadManager::startDownload):
1103         (WebKit::DownloadManager::convertNetworkLoadToDownload):
1104         * NetworkProcess/Downloads/DownloadManager.h:
1105         (WebKit::DownloadManager::client):
1106         * NetworkProcess/Downloads/PendingDownload.cpp:
1107         (WebKit::PendingDownload::PendingDownload):
1108         (WebKit::PendingDownload::messageSenderConnection):
1109         * NetworkProcess/Downloads/PendingDownload.h:
1110         * NetworkProcess/NetworkLoadChecker.cpp:
1111         * NetworkProcess/NetworkProcess.cpp:
1112         (WebKit::NetworkProcess::NetworkProcess):
1113         (WebKit::NetworkProcess::downloadManager):
1114         * NetworkProcess/NetworkProcess.h:
1115
1116 2019-01-07  Devin Rousso  <drousso@apple.com>
1117
1118         Web Inspector: Network: show secure connection details per-request
1119         https://bugs.webkit.org/show_bug.cgi?id=191539
1120         <rdar://problem/45979891>
1121
1122         Reviewed by Joseph Pecoraro.
1123
1124         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1125         (stringForSSLProtocol): Added.
1126         (stringForSSLCipher): Added.
1127         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
1128
1129 2019-01-07  Joseph Pecoraro  <pecoraro@apple.com>
1130
1131         Web Inspector: Remote inspector can crash if attempting to navigate inspector page
1132         https://bugs.webkit.org/show_bug.cgi?id=193204
1133         <rdar://problem/45550428>
1134
1135         Reviewed by Devin Rousso.
1136
1137         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
1138         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
1139         * UIProcess/mac/WKInspectorViewController.mm:
1140         (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]):
1141
1142 2019-01-07  Eric Carlson  <eric.carlson@apple.com>
1143
1144         Deactivate audio session whenever possible
1145         https://bugs.webkit.org/show_bug.cgi?id=193188
1146         <rdar://problem/42678977>
1147
1148         Reviewed by Jer Noble.
1149
1150         * WebProcess/WebPage/WebPage.cpp:
1151         (WebKit::WebPage::WebPage):
1152
1153 2019-01-07  Joseph Pecoraro  <pecoraro@apple.com>
1154
1155         [Cocoa] Add SPI to check if a WKWebView has an inspector frontend
1156         https://bugs.webkit.org/show_bug.cgi?id=193162
1157         <rdar://problem/24267143>
1158
1159         Reviewed by Alex Christensen.
1160
1161         * UIProcess/API/Cocoa/WKWebView.mm:
1162         (-[WKWebView _hasInspectorFrontend]):
1163         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1164         * UIProcess/WebPageProxy.h:
1165         (WebKit::WebPageProxy::hasInspectorFrontend const):
1166
1167 2019-01-07  Antti Koivisto  <antti@apple.com>
1168
1169         UI process side scrollbars for UI side compositing on Mac
1170         https://bugs.webkit.org/show_bug.cgi?id=193106
1171
1172         Reviewed by Tim Horton.
1173
1174         This patch implements Mac scrollbars on UI process side using the low level NSScrollerImp/NSScrollerPairImp
1175         SPIs. With this patch scrollbars mostly work for the main frame and also render (but can't be interacted with)
1176         for the subframes.
1177
1178         This is based on the similar code for web process side scrollbars in ScrollAnimatorMac. There is quite a bit of
1179         copy code as there is no way to share nicely. One of these will eventually go away anyway.
1180
1181         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1182         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
1183         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
1184         * Shared/WebCoreArgumentCoders.cpp:
1185         (IPC::ArgumentCoder<ScrollableAreaParameters>::encode):
1186         (IPC::ArgumentCoder<ScrollableAreaParameters>::decode):
1187         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
1188         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1189         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1190         (WebKit::RemoteScrollingCoordinatorProxy::handleMouseEvent):
1191         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
1192         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
1193         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
1194         (WebKit::RemoteScrollingTree::handleMouseEvent):
1195         * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
1196         * UIProcess/RemoteLayerTree/mac: Added.
1197         * UIProcess/RemoteLayerTree/mac/ScrollerMac.h: Added.
1198
1199         Wraps NSScrollerImp for vertical or horizontal scrollbar.
1200
1201         (WebKit::ScrollerMac::pair):
1202         (WebKit::ScrollerMac::orientation const):
1203         (WebKit::ScrollerMac::hostLayer const):
1204         (WebKit::ScrollerMac::scrollerImp):
1205         * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: Added.
1206         (-[WKScrollbarPartAnimation initWithScroller:featureToAnimate:animateFrom:animateTo:duration:]):
1207         (-[WKScrollbarPartAnimation startAnimation]):
1208         (-[WKScrollbarPartAnimation setStartValue:]):
1209         (-[WKScrollbarPartAnimation setEndValue:]):
1210         (-[WKScrollbarPartAnimation setCurrentProgress:]):
1211         (-[WKScrollbarPartAnimation invalidate]):
1212         (-[WKScrollerImpDelegate initWithScroller:]):
1213         (-[WKScrollerImpDelegate cancelAnimations]):
1214         (-[WKScrollerImpDelegate scrollerPair]):
1215         (-[WKScrollerImpDelegate convertRectToBacking:]):
1216         (-[WKScrollerImpDelegate convertRectFromBacking:]):
1217         (-[WKScrollerImpDelegate layer]):
1218         (-[WKScrollerImpDelegate mouseLocationInScrollerForScrollerImp:]):
1219         (-[WKScrollerImpDelegate convertRectToLayer:]):
1220         (-[WKScrollerImpDelegate shouldUseLayerPerPartForScrollerImp:]):
1221         (-[WKScrollerImpDelegate effectiveAppearanceForScrollerImp:]):
1222         (-[WKScrollerImpDelegate setUpAlphaAnimation:scrollerPainter:part:animateAlphaTo:duration:]):
1223         (-[WKScrollerImpDelegate scrollerImp:animateKnobAlphaTo:duration:]):
1224         (-[WKScrollerImpDelegate scrollerImp:animateTrackAlphaTo:duration:]):
1225         (-[WKScrollerImpDelegate scrollerImp:animateUIStateTransitionWithDuration:]):
1226         (-[WKScrollerImpDelegate scrollerImp:animateExpansionTransitionWithDuration:]):
1227         (-[WKScrollerImpDelegate scrollerImp:overlayScrollerStateChangedTo:]):
1228         (-[WKScrollerImpDelegate invalidate]):
1229         (WebKit::ScrollerMac::ScrollerMac):
1230         (WebKit::ScrollerMac::~ScrollerMac):
1231         (WebKit::ScrollerMac::attach):
1232         (WebKit::ScrollerMac::setHostLayer):
1233         (WebKit::ScrollerMac::updatePosition):
1234         (WebKit::ScrollerMac::convertFromContent const):
1235         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.h: Added.
1236         (WebKit::ScrollerPairMac::verticalScroller):
1237         (WebKit::ScrollerPairMac::horizontalScroller):
1238         (WebKit::ScrollerPairMac::scrollerImpPair):
1239         (WebKit::ScrollerPairMac::lastKnownMousePosition const):
1240         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: Added.
1241
1242         Wraps NSScrollerPairImp and owns the vertical and horizontal scrollers.
1243
1244         (-[WKScrollerImpPairDelegate initWithScrollerPair:]):
1245         (-[WKScrollerImpPairDelegate invalidate]):
1246         (-[WKScrollerImpPairDelegate contentAreaRectForScrollerImpPair:]):
1247         (-[WKScrollerImpPairDelegate inLiveResizeForScrollerImpPair:]):
1248         (-[WKScrollerImpPairDelegate mouseLocationInContentAreaForScrollerImpPair:]):
1249         (-[WKScrollerImpPairDelegate scrollerImpPair:convertContentPoint:toScrollerImp:]):
1250         (-[WKScrollerImpPairDelegate scrollerImpPair:setContentAreaNeedsDisplayInRect:]):
1251         (-[WKScrollerImpPairDelegate scrollerImpPair:updateScrollerStyleForNewRecommendedScrollerStyle:]):
1252         (WebKit::ScrollerPairMac::ScrollerPairMac):
1253         (WebKit::ScrollerPairMac::~ScrollerPairMac):
1254         (WebKit::ScrollerPairMac::handleWheelEvent):
1255         (WebKit::ScrollerPairMac::handleMouseEvent):
1256         (WebKit::ScrollerPairMac::updatePositions):
1257         (WebKit::ScrollerPairMac::contentsSize const):
1258         (WebKit::ScrollerPairMac::visibleContentsRect const):
1259         (WebKit::ScrollerPairMac::useDarkAppearance const):
1260         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp: Added.
1261
1262         Special node for UI side Mac scrolling. Owns ScrollerPairMac instance.
1263
1264         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::ScrollingTreeFrameScrollingNodeRemoteMac):
1265         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::~ScrollingTreeFrameScrollingNodeRemoteMac):
1266         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::create):
1267         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::commitStateBeforeChildren):
1268         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::setScrollLayerPosition):
1269         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleWheelEvent):
1270         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleMouseEvent):
1271         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::scrollingTree const):
1272         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h: Added.
1273         * UIProcess/WebPageProxy.cpp:
1274         (WebKit::WebPageProxy::handleMouseEvent):
1275         * WebKit.xcodeproj/project.pbxproj:
1276
1277 2019-01-07  Brian Burg  <bburg@apple.com>
1278
1279         Unwanted page navigation after showing & dismissing contextual menu with control-click
1280         https://bugs.webkit.org/show_bug.cgi?id=192912
1281         <rdar://problem/46318508>
1282
1283         Reviewed by Timothy Hatcher.
1284
1285         After the conversion to use a mouse event queue, this behavior was observed rarely, especially
1286         when CPU is under load and lots of things are going on in the page. In other words, it's racy.
1287
1288         Based on NSEvent logging, it seems that when the system is under load, we simply take too long
1289         to enter the nested runloop that AppKit uses to handle events when the context menu is present.
1290         AppKit doesn't care whether or not the MouseDown triggered a nested runloop; on my machine it delivers
1291         the MouseUp event about 130ms after the MouseDown event. If we haven't show the context menu in
1292         that time, then the MouseUp is enqueued as a normal mouse event. If the Ctrl-click is on a link,
1293         then the MouseUp will be interpreted by EventHandler as a click event, which in the simplest case
1294         will initiate a main frame navigation. When the context menu is dismissed and the nested runloop
1295         is torn down, the navigation IPC message is handled in UIProcess and the page navigates away.
1296
1297         We can't do much to change AppKit's inherently racy behavior, but we can avoid processing
1298         mouse events that are delivered whilst we are processing the context menu-initiating event.
1299         From the WebProcess point of view, there is no race anymore because it does not receive the
1300         MouseUp event.
1301
1302         * UIProcess/WebPageProxy.cpp:
1303         (WebKit::WebPageProxy::showContextMenu):
1304         If new events come in, drop them on the floor. Based on testing, the nested runloop will discard
1305         the unpaired MouseUp event anyway, so this does not cause a change in behavior.
1306
1307 2019-01-07  Wenson Hsieh  <wenson_hsieh@apple.com>
1308
1309         Native caret shows up alongside the page's caret when requesting desktop site on jsfiddle.net
1310         https://bugs.webkit.org/show_bug.cgi?id=193180
1311         <rdar://problem/45971041>
1312
1313         Reviewed by Tim Horton.
1314
1315         JSFiddle uses CodeMirror; CodeMirror's editor works by capturing keystrokes and input in a hidden textarea
1316         element, and then drawing its own selection caret using web content. This textarea is hidden by being placed
1317         underneath an empty div with `overflow: hidden;`.
1318
1319         When requesting desktop site on iOS, both CodeMirror's caret and the native iOS caret are shown because iOS
1320         selection UI consists of native views overlaid on the page, whereas on macOS, the entire textarea (along with
1321         the caret) are occluded by the hidden overflow container. Additionally, various iOS behaviors related to
1322         selection and editing, such as zooming to reveal the focused element and showing the platform callout bar, are
1323         active when focusing this hidden editable area; these don't work as intended, and just interfere with the page's
1324         custom editing UI.
1325
1326         To fix this, we augment the text interaction suppression mechanism added in r238146 to detect when the focused
1327         element is in an empty `overflow: hidden` container, and bail out of native text editing behaviors.
1328
1329         * Shared/EditorState.cpp:
1330         (WebKit::EditorState::PostLayoutData::encode const):
1331         (WebKit::EditorState::PostLayoutData::decode):
1332         * Shared/EditorState.h:
1333
1334         Rename elementIsTransparent to elementIsTransparentOrFullyClipped.
1335
1336         * Shared/FocusedElementInformation.cpp:
1337         (WebKit::FocusedElementInformation::encode const):
1338         (WebKit::FocusedElementInformation::decode):
1339         * Shared/FocusedElementInformation.h:
1340         * UIProcess/ios/WKContentViewInteraction.h:
1341
1342         Rename FocusedElementIsTransparent to FocusedElementIsTransparentOrFullyClipped.
1343
1344         * UIProcess/ios/WKContentViewInteraction.mm:
1345         (-[WKContentView _zoomToRevealFocusedElement]):
1346         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1347         (-[WKContentView _elementDidBlur]):
1348
1349         Make an additional tweak here to only stop suppressing text interaction assistant in `-_elementDidBlur` if we're
1350         not also in the middle of changing the focused element. Without this, focusing a hidden editable element while
1351         another hidden editable element is currently focused causes us to zoom to reveal the newly focused hidden
1352         editable element, when we should be avoiding this behavior.
1353
1354         (-[WKContentView _updateChangedSelection:]):
1355         * WebProcess/WebPage/ios/WebPageIOS.mm:
1356         (WebKit::WebPage::platformEditorState const):
1357         (WebKit::WebPage::getFocusedElementInformation):
1358
1359 2019-01-07  Alex Christensen  <achristensen@webkit.org>
1360
1361         Move identifierBase from SessionTracker to NetworkProcess/WebProcess
1362         https://bugs.webkit.org/show_bug.cgi?id=193201
1363
1364         Reviewed by Tim Horton.
1365
1366         No change in behavior.  This just reduces process-global state.
1367
1368         * NetworkProcess/NetworkProcess.h:
1369         (WebKit::NetworkProcess::uiProcessBundleIdentifier const):
1370         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1371         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1372         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1373         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
1374         * Shared/SessionTracker.cpp:
1375         (WebKit::identifierBase): Deleted.
1376         (WebKit::SessionTracker::getIdentifierBase): Deleted.
1377         (WebKit::SessionTracker::setIdentifierBase): Deleted.
1378         * Shared/SessionTracker.h:
1379         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
1380         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
1381         (WebKit::WebFrameNetworkingContext::sourceApplicationIdentifier const):
1382         * WebProcess/WebProcess.h:
1383         (WebKit::WebProcess::uiProcessBundleIdentifier const):
1384         * WebProcess/cocoa/WebProcessCocoa.mm:
1385         (WebKit::WebProcess::platformInitializeWebProcess):
1386
1387 2019-01-07  Alex Christensen  <achristensen@webkit.org>
1388
1389         Reduce use of NetworkProcess::singleton
1390         https://bugs.webkit.org/show_bug.cgi?id=193197
1391
1392         Reviewed by Brady Eidson.
1393
1394         Pass it around as a Ref<NetworkProcess> as a step towards reducing global state.
1395         Soup's WebFrameNetworkingContext no longer makes a NetworkSession like all other ports
1396         because networking is no longer done in the WebProcess.
1397
1398         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
1399         (WebKit::WebIDBConnectionToClient::create):
1400         (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient):
1401         (WebKit::WebIDBConnectionToClient::disconnectedFromWebProcess):
1402         (WebKit::WebIDBConnectionToClient::deleteDatabase):
1403         (WebKit::WebIDBConnectionToClient::openDatabase):
1404         (WebKit::WebIDBConnectionToClient::abortTransaction):
1405         (WebKit::WebIDBConnectionToClient::commitTransaction):
1406         (WebKit::WebIDBConnectionToClient::didFinishHandlingVersionChangeTransaction):
1407         (WebKit::WebIDBConnectionToClient::createObjectStore):
1408         (WebKit::WebIDBConnectionToClient::deleteObjectStore):
1409         (WebKit::WebIDBConnectionToClient::renameObjectStore):
1410         (WebKit::WebIDBConnectionToClient::clearObjectStore):
1411         (WebKit::WebIDBConnectionToClient::createIndex):
1412         (WebKit::WebIDBConnectionToClient::deleteIndex):
1413         (WebKit::WebIDBConnectionToClient::renameIndex):
1414         (WebKit::WebIDBConnectionToClient::putOrAdd):
1415         (WebKit::WebIDBConnectionToClient::getRecord):
1416         (WebKit::WebIDBConnectionToClient::getAllRecords):
1417         (WebKit::WebIDBConnectionToClient::getCount):
1418         (WebKit::WebIDBConnectionToClient::deleteRecord):
1419         (WebKit::WebIDBConnectionToClient::openCursor):
1420         (WebKit::WebIDBConnectionToClient::iterateCursor):
1421         (WebKit::WebIDBConnectionToClient::establishTransaction):
1422         (WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose):
1423         (WebKit::WebIDBConnectionToClient::databaseConnectionClosed):
1424         (WebKit::WebIDBConnectionToClient::abortOpenAndUpgradeNeeded):
1425         (WebKit::WebIDBConnectionToClient::didFireVersionChangeEvent):
1426         (WebKit::WebIDBConnectionToClient::openDBRequestCancelled):
1427         (WebKit::WebIDBConnectionToClient::confirmDidCloseFromServer):
1428         (WebKit::WebIDBConnectionToClient::getAllDatabaseNames):
1429         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
1430         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1431         (WebKit::NetworkConnectionToWebProcess::create):
1432         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
1433         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1434         (WebKit::NetworkConnectionToWebProcess::didClose):
1435         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
1436         (WebKit::NetworkConnectionToWebProcess::prefetchDNS):
1437         (WebKit::NetworkConnectionToWebProcess::startDownload):
1438         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
1439         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
1440         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
1441         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
1442         * NetworkProcess/NetworkConnectionToWebProcess.h:
1443         (WebKit::NetworkConnectionToWebProcess::networkProcess):
1444         * NetworkProcess/NetworkProcess.cpp:
1445         (WebKit::NetworkProcess::singleton):
1446         (WebKit::NetworkProcess::initializeNetworkProcess):
1447         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
1448         (WebKit::NetworkProcess::addWebsiteDataStore):
1449         (WebKit::fetchDiskCacheEntries):
1450         (WebKit::NetworkProcess::fetchWebsiteData):
1451         (WebKit::clearDiskCacheEntries):
1452         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1453         (WebKit::NetworkProcess::getNetworkProcessStatistics):
1454         (WebKit::NetworkProcess::idbServer):
1455         * NetworkProcess/NetworkProcess.h:
1456         * NetworkProcess/NetworkResourceLoader.cpp:
1457         (WebKit::NetworkResourceLoader::startNetworkLoad):
1458         (WebKit::NetworkResourceLoader::convertToDownload):
1459         (WebKit::NetworkResourceLoader::isAlwaysOnLoggingAllowed const):
1460         * NetworkProcess/NetworkSession.cpp:
1461         (WebKit::NetworkSession::create):
1462         (WebKit::NetworkSession::NetworkSession):
1463         * NetworkProcess/NetworkSession.h:
1464         (WebKit::NetworkSession::networkProcess):
1465         * NetworkProcess/RemoteNetworkingContext.h:
1466         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1467         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1468         (WebKit::NetworkDataTaskCocoa::isAlwaysOnLoggingAllowed const):
1469         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1470         (WebKit::NetworkProcess::clearDiskCache):
1471         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1472         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1473         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
1474         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
1475         (-[WKNetworkSessionDelegate URLSession:downloadTask:didFinishDownloadingToURL:]):
1476         (-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]):
1477         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
1478         (WebKit::NetworkSessionCocoa::create):
1479         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1480         * NetworkProcess/curl/NetworkSessionCurl.cpp:
1481         (WebKit::NetworkSessionCurl::NetworkSessionCurl):
1482         * NetworkProcess/curl/NetworkSessionCurl.h:
1483         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1484         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
1485         * NetworkProcess/soup/NetworkSessionSoup.cpp:
1486         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
1487         * NetworkProcess/soup/NetworkSessionSoup.h:
1488
1489 2019-01-07  Alex Christensen  <achristensen@webkit.org>
1490
1491         Modernize CacheModel and disk cache fetching and clearing
1492         https://bugs.webkit.org/show_bug.cgi?id=193164
1493
1494         Reviewed by Joseph Pecoraro.
1495
1496         fetchDiskCacheEntries and clearDiskCacheEntries now use an early-return model.
1497         CacheModel is now an enum class.
1498
1499         * NetworkProcess/NetworkProcess.cpp:
1500         (WebKit::NetworkProcess::NetworkProcess):
1501         (WebKit::NetworkProcess::initializeNetworkProcess):
1502         (WebKit::fetchDiskCacheEntries):
1503         (WebKit::NetworkProcess::fetchWebsiteData):
1504         (WebKit::clearDiskCacheEntries):
1505         (WebKit::NetworkProcess::setCacheModel):
1506         * NetworkProcess/NetworkProcess.h:
1507         * NetworkProcess/NetworkProcess.messages.in:
1508         * NetworkProcess/NetworkProcessCreationParameters.h:
1509         * NetworkProcess/cache/NetworkCacheEntry.cpp:
1510         (WebKit::NetworkCache::Entry::initializeShareableResourceHandleFromStorageRecord const):
1511         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1512         (WebKit::NetworkProcess::clearDiskCache):
1513         * Shared/CacheModel.cpp:
1514         (WebKit::calculateMemoryCacheSizes):
1515         (WebKit::calculateURLCacheSizes):
1516         * Shared/CacheModel.h:
1517         (): Deleted.
1518         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1519         (API::ProcessPoolConfiguration::createWithLegacyOptions):
1520         * UIProcess/API/APIProcessPoolConfiguration.h:
1521         * UIProcess/API/C/WKAPICast.h:
1522         (WebKit::toCacheModel):
1523         (WebKit::toAPI):
1524         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1525         (-[_WKProcessPoolConfiguration pageCacheEnabled]):
1526         (-[_WKProcessPoolConfiguration setPageCacheEnabled:]):
1527         * WebProcess/WebProcess.cpp:
1528         (WebKit::WebProcess::initializeWebProcess):
1529         (WebKit::WebProcess::setCacheModel):
1530         (WebKit::WebProcess::clearResourceCaches):
1531         * WebProcess/WebProcess.h:
1532         * WebProcess/WebProcess.messages.in:
1533
1534 2019-01-06  Jiewen Tan  <jiewen_tan@apple.com>
1535
1536         [WebAuthN] Import U2F command/response converters from Chromium
1537         https://bugs.webkit.org/show_bug.cgi?id=193150
1538         <rdar://problem/47054028>
1539
1540         Reviewed by Brent Fulgham.
1541
1542         Moves helper functions to WebAuthenticationUtils.
1543
1544         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
1545         (WebKit::LocalAuthenticatorInternal::produceHashSet):
1546         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
1547         (): Deleted.
1548         (WebKit::LocalAuthenticatorInternal::buildAuthData): Deleted.
1549         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
1550         (WebKit::MockHidConnection::feedReports):
1551
1552 2019-01-04  Joseph Pecoraro  <pecoraro@apple.com>
1553
1554         Web Inspector: Use save sheet instead of dialog where possible
1555         https://bugs.webkit.org/show_bug.cgi?id=193160
1556         <rdar://problem/37399759>
1557
1558         Reviewed by Devin Rousso.
1559
1560         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
1561         (WebKit::RemoteWebInspectorProxy::platformSave):
1562         * UIProcess/mac/WebInspectorProxyMac.mm:
1563         (WebKit::WebInspectorProxy::platformSave):
1564
1565 2019-01-04  Jer Noble  <jer.noble@apple.com>
1566
1567         [WebKitLegacy] Media playback pauses on scroll
1568         https://bugs.webkit.org/show_bug.cgi?id=192829
1569
1570         Reviewed by Eric Carlson.
1571
1572         Add a new WebPage, WebPageProxy, & WKWebView SPI to stop, suspend, and resume all
1573         existing media playback in the page.
1574
1575         * UIProcess/API/Cocoa/WKWebView.mm:
1576         (-[WKWebView _stopAllMediaPlayback]):
1577         (-[WKWebView _suspendAllMediaPlayback]):
1578         (-[WKWebView _resumeAllMediaPlayback]):
1579         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1580         * UIProcess/WebPageProxy.cpp:
1581         (WebKit::WebPageProxy::stopAllMediaPlayback):
1582         (WebKit::WebPageProxy::suspendAllMediaPlayback):
1583         (WebKit::WebPageProxy::resumeAllMediaPlayback):
1584         * UIProcess/WebPageProxy.h:
1585         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1586         (-[WKFullScreenViewController _showPhishingAlert]):
1587         * WebProcess/WebPage/WebPage.cpp:
1588         (WebKit::WebPage::stopAllMediaPlayback):
1589         (WebKit::WebPage::suspendAllMediaPlayback):
1590         (WebKit::WebPage::resumeAllMediaPlayback):
1591         * WebProcess/WebPage/WebPage.h:
1592         * WebProcess/WebPage/WebPage.messages.in:
1593
1594 2019-01-04  Chris Dumez  <cdumez@apple.com>
1595
1596         Add support for toggling device orientation API support per site
1597         https://bugs.webkit.org/show_bug.cgi?id=193143
1598         <rdar://problem/46605724>
1599
1600         Reviewed by Alex Christensen.
1601
1602         Add support for toggling device orientation API support per site via _WKWebsitePolicies.
1603
1604         * Shared/WebsitePoliciesData.cpp:
1605         (WebKit::WebsitePoliciesData::encode const):
1606         (WebKit::WebsitePoliciesData::decode):
1607         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
1608         * Shared/WebsitePoliciesData.h:
1609         * UIProcess/API/APIWebsitePolicies.cpp:
1610         (API::WebsitePolicies::data):
1611         * UIProcess/API/APIWebsitePolicies.h:
1612         * UIProcess/API/Cocoa/WKWebView.mm:
1613         (-[WKWebView _simulateDeviceOrientationChangeWithAlpha:beta:gamma:]):
1614         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1615         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
1616         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
1617         (-[_WKWebsitePolicies setDeviceOrientationEventEnabled:]):
1618         (-[_WKWebsitePolicies deviceOrientationEventEnabled]):
1619         * UIProcess/WebPageProxy.cpp:
1620         (WebKit::WebPageProxy::simulateDeviceOrientationChange):
1621         * UIProcess/WebPageProxy.h:
1622         * WebProcess/WebPage/WebPage.cpp:
1623         (WebKit::WebPage::simulateDeviceOrientationChange):
1624         * WebProcess/WebPage/WebPage.h:
1625         * WebProcess/WebPage/WebPage.messages.in:
1626
1627 2019-01-04  Chris Dumez  <cdumez@apple.com>
1628
1629         Crash under WebPageProxy::continueNavigationInNewProcess()
1630         https://bugs.webkit.org/show_bug.cgi?id=193113
1631         <rdar://problem/46938686>
1632
1633         Reviewed by Brady Eidson.
1634
1635         The crash was happening in continueNavigationInNewProcess() when dereferencing
1636         the Optional<> value returned by API::Navigation::backForwardFrameLoadType(), after verifying
1637         that API::Navigation::targetItem() is not null.
1638
1639         When constructing an API::Navigation object with a targetItem, you HAVE to pass
1640         in a backForwardFrameLoadType as well so this normally is not possible. However,
1641         it can happen because API::Navigation::setTargetItem() can get called later on and
1642         set a target item on a Navigation object which potentially does not have a
1643         backForwardFrameLoadType. This setter was only called in one place in
1644         decidePolicyForNavigationAction() to update an existing Navigation object using
1645         the targetItem provided by a NavigationAction. This logic was added with PSON
1646         support.
1647
1648         Because I was unable to write a test case reproducing this and because I do not know
1649         how it can happen in practice that we'd have a NavigationAction with a targetItem
1650         even though the Navigation object itself is not for a back/forward navigation, I have
1651         chosen to drop the unsafe API::Navigation::setTargetItem() setter and the call site.
1652         When the call site was added, with ProcessSwap.NavigateToDataURLThenBack API test,
1653         the intention was to create a back/forward navigation object instead of a standard load
1654         navigation one if there is currently no existing Navigation object in the UIProcess.
1655         This can happen when the back/forward navigation is triggered by the WebProcess via
1656         JS (e.g. history.back()) and this is what the API test covers. The part of the logic
1657         that updates an existing Navigation object with a targetItem coming from the
1658         NavigationAction is untested and I have no evidence it does anything useful. However,
1659         we DO have evidence that it can cause crashes.
1660
1661         * UIProcess/API/APINavigation.h:
1662         * UIProcess/WebPageProxy.cpp:
1663         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1664
1665 2019-01-04  Tim Horton  <timothy_horton@apple.com>
1666
1667         Remove some nonexistent files from the WebKit Xcode project
1668
1669         * WebKit.xcodeproj/project.pbxproj:
1670         r238468 and r237205 forgot to remove some files from the project.
1671
1672 2019-01-04  Youenn Fablet  <youenn@apple.com>
1673
1674         CSP violation reports should bypass CSP checks
1675         https://bugs.webkit.org/show_bug.cgi?id=192857
1676         <rdar://problem/46887236>
1677
1678         Reviewed by Chris Dumez.
1679
1680         * WebProcess/Network/WebLoaderStrategy.cpp:
1681         (WebKit::WebLoaderStrategy::startPingLoad):
1682         * WebProcess/Network/WebLoaderStrategy.h:
1683
1684 2019-01-04  Alex Christensen  <achristensen@webkit.org>
1685
1686         Use WebsiteDataStoreParameters instead of NetworkProcessCreationParameters for IndexedDB directories
1687         https://bugs.webkit.org/show_bug.cgi?id=193114
1688
1689         Reviewed by Brady Eidson.
1690
1691         * NetworkProcess/NetworkProcess.cpp:
1692         (WebKit::NetworkProcess::initializeNetworkProcess):
1693         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1694         (WebKit::NetworkProcessCreationParameters::encode const):
1695         (WebKit::NetworkProcessCreationParameters::decode):
1696         * NetworkProcess/NetworkProcessCreationParameters.h:
1697         * UIProcess/WebProcessPool.cpp:
1698         (WebKit::WebProcessPool::ensureNetworkProcess):
1699
1700 2019-01-04  Alex Christensen  <achristensen@webkit.org>
1701
1702         Deprecate WKContextCreate
1703         https://bugs.webkit.org/show_bug.cgi?id=193118
1704
1705         Reviewed by Brady Eidson.
1706
1707         It has only one use that is being removed in rdar://problem/47030792
1708         This is a step towards removing ProcessPoolConfiguration::createWithLegacyOptions.
1709         Also make WKContextCreateWithConfiguration accept a null configuration to make it easier to use.
1710
1711         * UIProcess/API/C/WKContext.cpp:
1712         (WKContextCreateWithConfiguration):
1713         * UIProcess/API/C/WKContext.h:
1714
1715 2019-01-04  Tim Horton  <timothy_horton@apple.com>
1716
1717         Fix the build
1718
1719         * UIProcess/ios/WKContentViewInteraction.mm:
1720         (-[WKContentView cleanupInteraction]):
1721
1722 2019-01-04  Tim Horton  <timothy_horton@apple.com>
1723
1724         Share ink choice and ruler between all editable images
1725         https://bugs.webkit.org/show_bug.cgi?id=193130
1726         <rdar://problem/46826491>
1727
1728         Reviewed by Wenson Hsieh.
1729
1730         * SourcesCocoa.txt:
1731         Add WKDrawingCoordinator, which maintains WKWebView-wide drawing state,
1732         and manages a single shared ink picker.
1733
1734         * UIProcess/PageClient.h:
1735         (WebKit::PageClient::createDrawingView):
1736         * UIProcess/ios/EditableImageController.mm:
1737         (WebKit::EditableImageController::ensureEditableImage):
1738         * UIProcess/ios/PageClientImplIOS.h:
1739         * UIProcess/ios/PageClientImplIOS.mm:
1740         (WebKit::PageClientImpl::createDrawingView):
1741         Plumb WKDrawingView creation through PageClient, so that it can be instantiated
1742         with knowledge of its owning WKContentView.
1743
1744         * UIProcess/ios/WKContentViewInteraction.h:
1745         * UIProcess/ios/WKContentViewInteraction.mm:
1746         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1747         (-[WKContentView _elementDidBlur]):
1748         (-[WKContentView _drawingCoordinator]):
1749         (-[WKContentView _installInkPickerForDrawingViewWithID:]): Deleted.
1750         (-[WKContentView _uninstallInkPicker]): Deleted.
1751         Move ink picker management into WKDrawingCoordinator.
1752
1753         * UIProcess/ios/WKDrawingView.h:
1754         * UIProcess/ios/WKDrawingView.mm:
1755         (-[WKDrawingView initWithEmbeddedViewID:contentView:]):
1756         (-[WKDrawingView _canvasViewWillBeginDrawing:]):
1757         (-[WKDrawingView invalidateAttachment]):
1758         (-[WKDrawingView didChangeRulerState:]):
1759         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]): Deleted.
1760         (-[WKDrawingView canvasView]): Deleted.
1761         Use a shared ruler, owned by WKDrawingCoordinator.
1762         Update the editable image's ink when drawing begins. This way, we don't have
1763         to push ink changes to all drawings as they happen.
1764
1765         * UIProcess/ios/WKInkPickerView.h:
1766         * UIProcess/ios/WKInkPickerView.mm:
1767         (-[WKInkPickerView initWithContentView:]):
1768         (-[WKInkPickerView inlineInkPickerDidToggleRuler:]):
1769         (-[WKInkPickerView viewControllerForPopoverPresentationFromInlineInkPicker:]):
1770         (-[WKInkPickerView setInk:]):
1771         (-[WKInkPickerView ink]):
1772         (-[WKInkPickerView initWithDrawingView:]): Deleted.
1773         (-[WKInkPickerView didPickInk]): Deleted.
1774         (-[WKInkPickerView inlineInkPicker:didSelectTool:]): Deleted.
1775         (-[WKInkPickerView inlineInkPicker:didSelectColor:]): Deleted.
1776         * WebKit.xcodeproj/project.pbxproj:
1777
1778 2019-01-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1779
1780         [Cocoa] Merge WebEditCommandProxy::nameForEditAction and undoNameForEditAction into a single function
1781         https://bugs.webkit.org/show_bug.cgi?id=193129
1782
1783         Reviewed by Tim Horton.
1784
1785         Remove WebEditCommandProxy::nameForEditAction and use WebCore::nameForUndoRedo instead.
1786
1787         * UIProcess/Cocoa/WebViewImpl.mm:
1788         (WebKit::WebViewImpl::registerEditCommand):
1789         * UIProcess/WebEditCommandProxy.cpp:
1790         (WebKit::WebEditCommandProxy::WebEditCommandProxy):
1791         (WebKit::WebEditCommandProxy::~WebEditCommandProxy):
1792         (WebKit::WebEditCommandProxy::nameForEditAction): Deleted.
1793         * UIProcess/WebEditCommandProxy.h:
1794         * UIProcess/WebPageProxy.cpp:
1795         (WebKit::WebPageProxy::addEditCommand):
1796         (WebKit::WebPageProxy::removeEditCommand):
1797         (WebKit::WebPageProxy::isValidEditCommand): Deleted.
1798
1799         Bit of drive-by refactoring: remove an unused function, and make addEditCommand and removeEditCommand take
1800         references instead of pointers, since these are assumed to be nonnull.
1801
1802         * UIProcess/WebPageProxy.h:
1803         * UIProcess/ios/PageClientImplIOS.mm:
1804         (WebKit::PageClientImpl::registerEditCommand):
1805
1806 2019-01-03  Matt Rajca  <mrajca@apple.com>
1807
1808         Make DidPlayMediaPreventedFromPlaying autoplay event more generic.
1809         https://bugs.webkit.org/show_bug.cgi?id=193128
1810         rdar://34554231
1811
1812         Reviewed by Jer Noble.
1813
1814         Today, the "DidPlayMediaPreventedFromPlaying" autoplay event is only sent for
1815         media prevented from autoplaying. It could be generalized to a "DidPlayMediaWithUserGesture"
1816         event along with a flag that indicates whether or not autoplay was actually prevented.
1817
1818         Tests: existing API tests were updated to reflect the new names. New API tests
1819         were added for the new case in which the "DidPlayMediaWithUserGesture" event is sent.
1820
1821         * Shared/WebCoreArgumentCoders.h: Take into account new flags.
1822         * UIProcess/API/C/WKPage.cpp: Ditto.
1823         (WKPageSetPageUIClient):
1824         * UIProcess/API/C/WKPageUIClient.h: Ditto.
1825         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Ditto.
1826         * UIProcess/Cocoa/UIDelegate.mm: Ditto.
1827         (WebKit::toWKAutoplayEventFlags):
1828         (WebKit::toWKAutoplayEvent):
1829
1830 2019-01-04  Fujii Hironori  <Hironori.Fujii@sony.com>
1831
1832         [curl] Move cookiePersistentStorageFile from NetworkProcessCreationParameters to NetworkSessionCreationParameters
1833         https://bugs.webkit.org/show_bug.cgi?id=192970
1834
1835         Reviewed by Alex Christensen.
1836
1837         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1838         (WebKit::NetworkProcessCreationParameters::encode const): Removed code for cookiePersistentStorageFile.
1839         (WebKit::NetworkProcessCreationParameters::decode): Ditto.
1840         * NetworkProcess/NetworkProcessCreationParameters.h: Ditto.
1841         * NetworkProcess/curl/NetworkProcessCurl.cpp:
1842         (WebKit::NetworkProcess::platformInitializeNetworkProcess): Ditto.
1843
1844         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1845         (WebKit::NetworkSessionCreationParameters::privateSessionParameters): Added code for cookiePersistentStorageFile.
1846         (WebKit::NetworkSessionCreationParameters::encode const): Ditto.
1847         (WebKit::NetworkSessionCreationParameters::decode): Ditto.
1848         * NetworkProcess/NetworkSessionCreationParameters.h: Ditto.
1849         * NetworkProcess/curl/NetworkSessionCurl.cpp:
1850         (WebKit::NetworkSessionCurl::NetworkSessionCurl): Ditto.
1851
1852         * NetworkProcess/Cookies/WebCookieManager.h: Removed setCookiePersistentStorage method of curl port extension.
1853         * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp:
1854         (WebKit::WebCookieManager::setCookiePersistentStorage): Deleted.
1855
1856 2019-01-04  Chris Dumez  <cdumez@apple.com>
1857
1858         [PSON] Calling history.back() from inside the load event handler prevents process-swapping
1859         https://bugs.webkit.org/show_bug.cgi?id=193120
1860
1861         Reviewed by Alex Christensen.
1862
1863         A HistoryItem is created only *after* we've fired the load event. As a result, if you call
1864         history.back() in JS from inside the load event handler, the current HistoryItem and and
1865         the target HistoryItem will be the same. This is normally not an issue. However, there was
1866         logic inside of WebProcessPool::processForNavigationInternal() which would compare the
1867         processID of the source and destination BackForwardListItems and which would force a process
1868         reuse if both BackForwardListItems came from the same WebContent process. So even though
1869         we swapped when doing a standard load from site A to site B, we would fail to swap if site
1870         B called history.back() from inside its load event handler.
1871
1872         To address the issue, stop relying on the source backforward item's processID. Instead, just
1873         use the WebContent process matching the destination backforward item's processID if it still
1874         exists.
1875
1876         * UIProcess/WebProcessPool.cpp:
1877         (WebKit::WebProcessPool::processForNavigationInternal):
1878
1879 2019-01-04  Keith Rollin  <krollin@apple.com>
1880
1881         Bring back parent processID for logging
1882         https://bugs.webkit.org/show_bug.cgi?id=193121
1883         <rdar://problem/47031634>
1884
1885         Reviewed by Alex Christensen.
1886
1887         Bug 192961 removes presentingApplicationPID from
1888         NetworkProcessCreationParameters because it was (a) stored in some
1889         global state, the use of which is being minimized, and (b) it was
1890         largely unused. However, it was actually still being used in some
1891         useful logging in order to tie together child processes with their
1892         parent process. Re-introduce this value in NetworkLoadParameters so
1893         that we can log it.
1894
1895         * NetworkProcess/NetworkLoadParameters.h:
1896         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1897         (WebKit::NetworkResourceLoadParameters::encode const):
1898         (WebKit::NetworkResourceLoadParameters::decode):
1899         * NetworkProcess/NetworkResourceLoader.cpp:
1900         (WebKit::NetworkResourceLoader::start):
1901         * WebProcess/Network/WebLoaderStrategy.cpp:
1902         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1903         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1904         (WebKit::WebLoaderStrategy::startPingLoad):
1905         (WebKit::WebLoaderStrategy::preconnectTo):
1906
1907 2019-01-04  Youenn Fablet  <youenn@apple.com>
1908
1909         Make RestrictedHTTPResponseAccess an internal flag
1910         https://bugs.webkit.org/show_bug.cgi?id=193145
1911
1912         Reviewed by Chris Dumez.
1913
1914         * Shared/WebPreferences.yaml: This will ease debugging.
1915
1916 2019-01-04  Per Arne Vollan  <pvollan@apple.com>
1917
1918         [iOS] Enable logging for services in sandbox
1919         https://bugs.webkit.org/show_bug.cgi?id=192705
1920
1921         Reviewed by Brent Fulgham.
1922
1923         When running layout tests, we didn’t see 107 services being looked up through launchd. We should
1924         add logging to these services to determine which services we actually need in the sandbox.
1925
1926         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1927
1928 2019-01-04  Commit Queue  <commit-queue@webkit.org>
1929
1930         Unreviewed, rolling out r239603.
1931         https://bugs.webkit.org/show_bug.cgi?id=193146
1932
1933         Breaks shipping tests (Requested by bfulgha__ on #webkit).
1934
1935         Reverted changeset:
1936
1937         "[iOS] Update sandbox profile to use iconservices instead of
1938         lsdiconservice"
1939         https://bugs.webkit.org/show_bug.cgi?id=193115
1940         https://trac.webkit.org/changeset/239603
1941
1942 2019-01-04  Chris Dumez  <cdumez@apple.com>
1943
1944         Crash under WebProcessPool::addSuspendedPage()
1945         https://bugs.webkit.org/show_bug.cgi?id=193110
1946
1947         Reviewed by Youenn Fablet.
1948
1949         When PageCache is disabled, WebProcessPool::m_maxSuspendedPageCount is 0 and WebProcessPool::addSuspendedPage()
1950         would call m_suspendedPages.removeFirst() even though m_suspendedPages is empty, causing a crash.
1951         Do an early return when m_maxSuspendedPageCount is 0 since we do not want to add any suspended page in this
1952         case.
1953
1954         * UIProcess/WebProcessPool.cpp:
1955         (WebKit::WebProcessPool::addSuspendedPage):
1956
1957 2019-01-03  Brent Fulgham  <bfulgham@apple.com>
1958
1959         [iOS] Silently deny access to mail settings triggered by MessageUI framework
1960         https://bugs.webkit.org/show_bug.cgi?id=193123
1961         <rdar://problem/42485581>
1962
1963         Reviewed by Alexey Proskuryakov.
1964
1965         Remove unhelpful logging generated when we block access to non-WebKit preferences. These
1966         invalid checks are done by an system framework that we cannot modify.
1967
1968         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1969
1970 2019-01-03  Brent Fulgham  <bfulgham@apple.com>
1971
1972         [iOS] Update sandbox profile to use iconservices instead of lsdiconservice
1973         https://bugs.webkit.org/show_bug.cgi?id=193115
1974         <rdar://problem/44867379>
1975
1976         Reviewed by Eric Carlson.
1977
1978         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1979
1980 2019-01-03  Brent Fulgham  <bfulgham@apple.com>
1981
1982         Remove logic handling DNT header during redirects
1983         https://bugs.webkit.org/show_bug.cgi?id=193082
1984         <rdar://problem/45555965>
1985
1986         Reviewed by Chris Dumez.
1987
1988         Test: http/wpt/fetch/dnt-header-after-redirection.html.
1989
1990         Don't bother looking for (or passing along) DNT headers during redirects.
1991
1992         * NetworkProcess/NetworkLoadChecker.cpp:
1993         (WebKit::NetworkLoadChecker::check):
1994         (WebKit::NetworkLoadChecker::prepareRedirectedRequest): Deleted.
1995         * NetworkProcess/NetworkLoadChecker.h:
1996         * NetworkProcess/NetworkResourceLoader.cpp:
1997         (WebKit::NetworkResourceLoader::restartNetworkLoad):
1998         (WebKit::NetworkResourceLoader::continueWillSendRequest):
1999         * NetworkProcess/PingLoad.cpp:
2000         (WebKit::PingLoad::willPerformHTTPRedirection):
2001
2002 2019-01-03  Chris Dumez  <cdumez@apple.com>
2003
2004         Add release logging to help debug HTTPS upgrade issues
2005         https://bugs.webkit.org/show_bug.cgi?id=193075
2006
2007         Reviewed by Alex Christensen.
2008
2009         Add release logging to help debug HTTPS upgrade issues like Bug 193026.
2010
2011         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
2012         (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker):
2013         (WebKit::NetworkHTTPSUpgradeChecker::query):
2014
2015 2019-01-03  Alex Christensen  <achristensen@webkit.org>
2016
2017         NetworkProcess should initialize its default NetworkSession with parameters from the UIProcess
2018         https://bugs.webkit.org/show_bug.cgi?id=192967
2019
2020         Reviewed by Brent Fulgham.
2021
2022         I moved 3 of the NetworkProcessCreationParameters to use corresponding values of a WebsiteDataStoreParameters.
2023         More will be moved in the near future, like indexedDatabaseDirectory.
2024
2025         * NetworkProcess/NetworkProcess.cpp:
2026         (WebKit::NetworkProcess::initializeNetworkProcess):
2027         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2028         (WebKit::NetworkProcessCreationParameters::encode const):
2029         (WebKit::NetworkProcessCreationParameters::decode):
2030         * NetworkProcess/NetworkProcessCreationParameters.h:
2031         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2032         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2033         * UIProcess/WebProcessPool.cpp:
2034         (WebKit::WebProcessPool::ensureNetworkProcess):
2035
2036 2019-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2037
2038         [iOS] REGRESSION (r239441): Tab cycling to offscreen <select> may not scroll it into view
2039         https://bugs.webkit.org/show_bug.cgi?id=193084
2040         <rdar://problem/47006882>
2041
2042         Reviewed by Simon Fraser.
2043
2044         In `WKWebView.mm`, `-_zoomToFocusRect:` will ignore the given selection rect if it is of size `{ 0, 0 }` and at
2045         the origin. Prior to r239441, when using the tab key to move focus between non-editable form controls (or any
2046         other method that doesn't involve tapping on the focused select element, with the exception of the next and
2047         previous buttons in the input accessory view), we would compute a selection rect of `{{ 0, 0 }, { 0, 0 }}`, and
2048         subsequently try to scroll the focused element to the center of the visible area, without taking the selection
2049         rect into account.
2050
2051         However, after r239441, the web process sends the element interaction location to the UI process, which then
2052         computes the selection rect by taking this location and adding a size of `{ 1, 1 }` (before r239441, this was
2053         done in `WebPage::getAssistedNodeInformation`). However, our new implementation doesn't take into account the
2054         case where the element interaction rect is null, which happens when the last interaction location is outside of
2055         the bounding rect of the element. In this case, we set the element interaction location to { 0, 0 } and end up
2056         computing a selection rect of `{{ 0, 0 }, { 1, 1 }}` instead of `{{ 0, 0 }, { 0, 0 }}` as we would have
2057         previously done. This causes us to scroll up to the origin, instead of revealing the focused element.
2058
2059         To fix this, we restore the pre-r239441 behavior. See additional comments below for details.
2060
2061         Test: fast/forms/ios/scroll-to-reveal-focused-select.html
2062
2063         * Shared/FocusedElementInformation.cpp:
2064         (WebKit::FocusedElementInformation::encode const):
2065         (WebKit::FocusedElementInformation::decode):
2066         * Shared/FocusedElementInformation.h:
2067
2068         Rename `elementInteractionLocation` to `lastInteractionLocation`. This was previously
2069         `elementInteractionLocation` due to existing logic that tries to move the interaction location into the bounding
2070         rect of the element in the case where visual viewports are disabled; however, since this feature has long been
2071         enabled by default for all modern WebKit clients (internal and external), it's simpler to just use always send
2072         the last interaction location over to the UI process, and have the UI process use `{{ 0, 0 }, { 0, 0 }}` if
2073         the interaction location is outside of the element rect.
2074
2075         In the very unlikely event that any modern WebKit client disables visual viewports, this will still behave
2076         reasonably, since we'll just use `{{ 0, 0 }, { 0, 0 }}` as the target rect and scroll to reveal the entire
2077         element rather than the top left corner of the element.
2078
2079         * UIProcess/ios/WKContentViewInteraction.mm:
2080         (rectToRevealWhenZoomingToFocusedElement):
2081         * WebProcess/WebPage/ios/WebPageIOS.mm:
2082
2083         Move the check for whether the interaction location is inside the element's bounding rect from the web process
2084         to the UI process. This relocates the logic to determine whether the selection rect should be a 1 by 1 fallback
2085         interaction rect or the zero rect (`{{ 0, 0 }, { 0, 0 }}`) closer to the code that actually uses this rect.
2086
2087         (WebKit::WebPage::getFocusedElementInformation):
2088
2089 2019-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2090
2091         WebUndoStep's monotonically increasing identifier should be a WebUndoStepID instead of uint64_t
2092         https://bugs.webkit.org/show_bug.cgi?id=193100
2093
2094         Reviewed by Simon Fraser.
2095
2096         Add a type alias, WebUndoStepID, to represent the monotonically increasing undo step ID for each undoable
2097         editing command, and use this type alias in lieu of `uint64_t`. No change in behavior.
2098
2099         * UIProcess/WebEditCommandProxy.cpp:
2100         (WebKit::WebEditCommandProxy::WebEditCommandProxy):
2101         * UIProcess/WebEditCommandProxy.h:
2102         (WebKit::WebEditCommandProxy::create):
2103         (WebKit::WebEditCommandProxy::commandID const):
2104         * UIProcess/WebPageProxy.cpp:
2105         (WebKit::WebPageProxy::registerEditCommandForUndo):
2106         * UIProcess/WebPageProxy.h:
2107         * WebKit.xcodeproj/project.pbxproj:
2108         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
2109         (WebKit::WebEditorClient::registerUndoStep):
2110
2111         Store the step ID in a temporary variable, since `webUndoStep` is now moved when calling `addWebUndoStep`.
2112
2113         * WebProcess/WebPage/WebPage.cpp:
2114         (WebKit::WebPage::webUndoStep):
2115         (WebKit::WebPage::addWebUndoStep):
2116
2117         Make this take a `Ref<WebUndoStep>&&` instead of a `WebUndoStep*`, and use move semantics to transfer the
2118         given `Ref` to the table.
2119
2120         (WebKit::WebPage::removeWebEditCommand):
2121         (WebKit::WebPage::unapplyEditCommand):
2122         (WebKit::WebPage::reapplyEditCommand):
2123
2124         Use `auto*` in a couple of places.
2125
2126         (WebKit::WebPage::didRemoveEditCommand):
2127         * WebProcess/WebPage/WebPage.h:
2128         * WebProcess/WebPage/WebUndoStep.cpp:
2129         (WebKit::generateUndoStep):
2130         * WebProcess/WebPage/WebUndoStep.h:
2131         (WebKit::WebUndoStep::stepID const):
2132         (WebKit::WebUndoStep::WebUndoStep):
2133         * WebProcess/WebPage/WebUndoStepID.h: Copied from Source/WebKit/WebProcess/WebPage/WebUndoStep.cpp.
2134
2135 2019-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2136
2137         Add support for using the current text selection as the find string on iOS
2138         https://bugs.webkit.org/show_bug.cgi?id=193034
2139         <rdar://problem/45138739>
2140
2141         Reviewed by Tim Horton.
2142
2143         * SourcesCocoa.txt:
2144         * UIProcess/API/Cocoa/WKWebView.mm:
2145         (-[WKWebView _takeFindStringFromSelection:]):
2146
2147         Provides a way to set the find string on iOS and macOS (an aside: takeFindStringFromSelection: already exists on
2148         macOS, but there is no equivalent protocol method on iOS, so this new SPI acts as a cross-platform way for
2149         WebKit clients to take the find string from the selection across all Cocoa platforms).
2150
2151         (+[WKWebView _stringForFind]):
2152         (+[WKWebView _setStringForFind:]):
2153
2154         Call into find-in-page helper functions.
2155
2156         (-[WKWebView _findString:options:maxCount:]):
2157
2158         On iOS, additionally update the find-in-page string when exercising the _findString:options:maxCount: SPI. This
2159         mirrors macOS behavior of updating the find pasteboard every time the find string changes; however, on macOS,
2160         this is implemented by the platform (in AppKit), whereas there's no platform find pasteboard on iOS, let alone
2161         logic to update it in UIKit. As such, we directly drive updates to the find string within WebKit.
2162
2163         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2164
2165         Add some new cross-platform find-in-page SPI. See above for more details.
2166
2167         * UIProcess/Cocoa/GlobalFindInPageState.h: Added.
2168         * UIProcess/Cocoa/GlobalFindInPageState.mm: Added.
2169         (WebKit::findPasteboard):
2170         (WebKit::globalStringForFind):
2171
2172         Fetch the string to use when finding text in the page. On macOS, this accesses the AppKit find pasteboard; on
2173         iOS, this instead returns the current global find string.
2174
2175         (WebKit::updateStringForFind):
2176
2177         Sets the global find string. Uses the find pasteboard on macOS, and sets the global find string on iOS.
2178
2179         (WebKit::stringForFind):
2180         * UIProcess/WebPageProxy.h:
2181         * UIProcess/WebPageProxy.messages.in:
2182
2183         Add plumbing to allow WebEditorClient to deliver the update the global find string in the UI process.
2184
2185         * UIProcess/ios/WebPageProxyIOS.mm:
2186         (WebKit::WebPageProxy::updateStringForFind):
2187         * WebKit.xcodeproj/project.pbxproj:
2188         * WebProcess/WebCoreSupport/WebEditorClient.h:
2189         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
2190         (WebKit::WebEditorClient::updateStringForFind):
2191         * WebProcess/WebPage/WebPage.h:
2192         * WebProcess/WebPage/ios/WebPageIOS.mm:
2193         (WebKit::WebPage::updateStringForFind):
2194
2195 2019-01-02  Brent Fulgham  <bfulgham@apple.com>
2196
2197         Allow WebContent process access to some drawing-related IOKit properties
2198         https://bugs.webkit.org/show_bug.cgi?id=193086
2199         <rdar://problem/46568088>
2200
2201         Reviewed by Eric Carlson.
2202
2203         Update the iOS WebContent process sandbox to allow access to some IOKit properties
2204         that are needed for drawing and media playback operations.
2205
2206         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2207         * WebProcess/com.apple.WebKit.WebContent.sb.in:
2208
2209 2019-01-02  Brent Fulgham  <bfulgham@apple.com>
2210
2211         Remove unused logging service 
2212         https://bugs.webkit.org/show_bug.cgi?id=193081
2213         <rdar://problem/40414815>
2214
2215         Reviewed by Alexey Proskuryakov.
2216
2217         We don't use this logging service, so don't open an exception for it.
2218
2219         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2220
2221 2019-01-02  Brent Fulgham  <bfulgham@apple.com>
2222
2223         Remove temporary workaround for CVMS code signing objects
2224         https://bugs.webkit.org/show_bug.cgi?id=193079
2225         <rdar://problem/40139202>
2226
2227         Reviewed by Alexey Proskuryakov.
2228
2229         * WebProcess/com.apple.WebProcess.sb.in:
2230
2231 2019-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2232
2233         REGRESSION (r239441): [iOS] Selection UI sometimes doesn't change after tapping "select all" in the callout bar
2234         https://bugs.webkit.org/show_bug.cgi?id=193070
2235         <rdar://problem/46921508>
2236
2237         Reviewed by Tim Horton.
2238
2239         r239441 added logic to include an EditorState in the next layer tree commit when refocusing an element; this was
2240         done to ensure that after tapping an element that has already been programmatically focused, we still send up-
2241         to-date editor information to the UI process for the purposes of zooming to the selection rect, even if the
2242         selection in the DOM is unchanged, since other aspects of the editor state may have changed since the element
2243         was initially focused.
2244
2245         We currently try to flag the next layer tree commit by setting `m_hasPendingEditorStateUpdate` to `true`.
2246         However, this is problematic since we aren't guaranteed in all cases that a compositing flush has been
2247         scheduled. In the case where it hasn't, we'll end up in a state where the editor state update flag has been set,
2248         yet the update will not make it over to the UI process until something happens that forces a layer tree commit
2249         (e.g. scrolling, pinch zooming). Worse still, if the selection is then programmatically changed from the web
2250         process, we will bail from sending a subsequent editor state update to the UI process because `WebPage` thinks
2251         that a pending editor state has already been scheduled. This manifests in selection UI not updating after
2252         tapping "Select All" in the callout bar, if the callout bar was brought up by tapping near the selection (since
2253         this refocuses the element).
2254
2255         To fix this, we adjust this logic in `WebPage::elementDidRefocus` so that it sets the flag and then schedules a
2256         compositing flush, but only if the user is actually interacting with the focused element (i.e., if the page
2257         calls `focus` repeatedly, we won't continue to schedule compositing flushes).
2258
2259         Test: editing/selection/ios/change-selection-after-tapping-focused-element.html
2260
2261         * WebProcess/WebPage/WebPage.cpp:
2262         (WebKit::WebPage::elementDidRefocus):
2263         (WebKit::WebPage::sendEditorStateUpdate):
2264         (WebKit::WebPage::scheduleFullEditorStateUpdate):
2265
2266         Add a private helper method to schedule an editor state update by setting `m_hasPendingEditorStateUpdate` to
2267         `true` and then scheduling a compositing layer flush. Also, add a FIXME aluding to the fact that scheduling an
2268         entire compositing layer flush to send an editor state update is somewhat wasteful, and should be replaced by
2269         just scheduling this work to be done before the next frame (see: <rdar://problem/36523583> for more detail).
2270
2271         We also use this helper method in a few places where we currently turn on the editor state flag and schedule a
2272         subsequent compositing flush.
2273
2274         (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate):
2275         * WebProcess/WebPage/WebPage.h:
2276
2277 2019-01-02  Commit Queue  <commit-queue@webkit.org>
2278
2279         Unreviewed, rolling out r239524.
2280         https://bugs.webkit.org/show_bug.cgi?id=193083
2281
2282         basic browsing seems not to work (Requested by thorton on
2283         #webkit).
2284
2285         Reverted changeset:
2286
2287         "Expand use of sourceApplicationAuditData"
2288         https://bugs.webkit.org/show_bug.cgi?id=192995
2289         https://trac.webkit.org/changeset/239524
2290
2291 2019-01-01  Jeff Miller  <jeffm@apple.com>
2292
2293         Update user-visible copyright strings to include 2019
2294         https://bugs.webkit.org/show_bug.cgi?id=192811
2295
2296         Reviewed by Mark Lam.
2297
2298         * Info.plist:
2299         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX.plist:
2300         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-iOS.plist:
2301         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist:
2302         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist:
2303         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist:
2304
2305 2018-12-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2306
2307         Move WKEditCommandObjC and WKEditorUndoTargetObjC into a separate file
2308         https://bugs.webkit.org/show_bug.cgi?id=193049
2309
2310         Reviewed by Sam Weinig.
2311
2312         Pull common code (WKEditCommandObjC and WKEditorUndoTargetObjC) on iOS and macOS out into a separate file. No
2313         change in behavior.
2314
2315         * SourcesCocoa.txt:
2316         * UIProcess/Cocoa/WKEditCommand.h: Added.
2317         * UIProcess/Cocoa/WKEditCommand.mm: Added.
2318
2319         Rename WKEditCommandObjC to WKEditCommand, and WKEditorUndoTargetObjC to WKEditorUndoTarget. The ObjC suffix in
2320         the name seems to diverge from the common naming scheme in other parts of WebKit, where most WK- and _WK-
2321         prefixed names already refer to Objective-C objects. Additionally, mark -[WKEditCommand init] as unavailable.
2322
2323         (-[WKEditCommand initWithWebEditCommandProxy:]):
2324
2325         Make the return type instancetype instead of id, and also make this take a Ref<WebEditCommandProxy>&& instead
2326         of a RefPtr.
2327
2328         (-[WKEditCommand command]):
2329
2330         Make this return a reference to the WebEditCommandProxy, rather than a pointer, since the WebEditCommandProxy
2331         should always be non-null.
2332
2333         (-[WKEditorUndoTarget undoEditing:]):
2334         (-[WKEditorUndoTarget redoEditing:]):
2335         * UIProcess/Cocoa/WebViewImpl.h:
2336         * UIProcess/Cocoa/WebViewImpl.mm:
2337         (WebKit::WebViewImpl::WebViewImpl):
2338         (WebKit::WebViewImpl::registerEditCommand):
2339
2340         Use WTFMove instead of copying the Ref when creating a WKEditCommand.
2341
2342         (-[WKEditCommandObjC initWithWebEditCommandProxy:]): Deleted.
2343         (-[WKEditCommandObjC command]): Deleted.
2344         (-[WKEditorUndoTargetObjC undoEditing:]): Deleted.
2345         (-[WKEditorUndoTargetObjC redoEditing:]): Deleted.
2346         * UIProcess/ios/PageClientImplIOS.h:
2347         * UIProcess/ios/PageClientImplIOS.mm:
2348         (WebKit::PageClientImpl::PageClientImpl):
2349         (WebKit::PageClientImpl::registerEditCommand):
2350
2351         Use WTFMove instead of creating a new RefPtr when creating a WKEditCommand.
2352
2353         (-[WKEditCommandObjC initWithWebEditCommandProxy:]): Deleted.
2354         (-[WKEditCommandObjC command]): Deleted.
2355         (-[WKEditorUndoTargetObjC undoEditing:]): Deleted.
2356         (-[WKEditorUndoTargetObjC redoEditing:]): Deleted.
2357         * UIProcess/mac/PageClientImplMac.h:
2358         * WebKit.xcodeproj/project.pbxproj:
2359
2360 2018-12-27  Alex Christensen  <achristensen@webkit.org>
2361
2362         Resurrect Mac CMake build
2363         https://bugs.webkit.org/show_bug.cgi?id=192658
2364
2365         Reviewed by Yusuke Suzuki.
2366
2367         * PlatformMac.cmake:
2368
2369 2018-12-26  Fujii Hironori  <Hironori.Fujii@sony.com>
2370
2371         [MSVC] error C2381: 'WebKit::NetworkHTTPSUpgradeChecker::~NetworkHTTPSUpgradeChecker': redefinition; '__declspec(noreturn)' or '[[noreturn]]' differs
2372         https://bugs.webkit.org/show_bug.cgi?id=193030
2373
2374         Reviewed by Ross Kirsling.
2375
2376         Windows Debug builds are failing to compile due to
2377         NO_RETURN_DUE_TO_ASSERT inconsistency of
2378         NetworkHTTPSUpgradeChecker destructor's definition and
2379         declaration.
2380
2381         * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Added
2382         NO_RETURN_DUE_TO_ASSERT to NetworkHTTPSUpgradeChecker destructor
2383         declaration.
2384         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp: Removed
2385         NO_RETURN_DUE_TO_ASSERT from the definition.
2386
2387 2018-12-24  Fujii Hironori  <Hironori.Fujii@sony.com>
2388
2389         [WebKit][Win] Remove using namespace in the global scope
2390         https://bugs.webkit.org/show_bug.cgi?id=192968
2391
2392         Reviewed by Alex Christensen.
2393
2394         Moved using namespace statements in the global scope to inside
2395         namespaces.
2396         <https://webkit.org/code-style-guidelines/#using-position>
2397
2398         * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp:
2399         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2400         * NetworkProcess/curl/NetworkProcessCurl.cpp:
2401         * NetworkProcess/curl/NetworkSessionCurl.cpp:
2402         * NetworkProcess/curl/RemoteNetworkingContextCurl.cpp:
2403         * Shared/Plugins/Netscape/NetscapePluginModuleNone.cpp:
2404         * Shared/WebWheelEvent.cpp:
2405         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
2406         * Shared/win/NativeWebKeyboardEventWin.cpp:
2407         * Shared/win/WebEventFactory.cpp:
2408         * UIProcess/Automation/WebAutomationSession.cpp:
2409
2410 2018-12-24  Fujii Hironori  <Hironori.Fujii@sony.com>
2411
2412         Remove "using namespace std;"
2413         https://bugs.webkit.org/show_bug.cgi?id=192973
2414
2415         Reviewed by Alex Christensen.
2416
2417         * Platform/IPC/win/ConnectionWin.cpp:
2418
2419 2018-12-24  Simon Fraser  <simon.fraser@apple.com>
2420
2421         Change ScrollingNodeType to an enum class
2422         https://bugs.webkit.org/show_bug.cgi?id=193009
2423
2424         Reviewed by Zalan Bujtas.
2425
2426         Change the ScrollingNodeType enum to an enum class.
2427         
2428         No behavior change.
2429
2430         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2431         (WebKit::encodeNodeAndDescendants):
2432         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
2433         (WebKit::dump):
2434         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2435         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2436         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
2437         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
2438         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2439         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2440         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
2441         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll):
2442
2443 2018-12-23  Wenson Hsieh  <wenson_hsieh@apple.com>
2444
2445         [iOS] Remove some unnecessary editing SPI after <rdar://problem/46047546>
2446         https://bugs.webkit.org/show_bug.cgi?id=193019
2447
2448         Reviewed by Dan Bernstein.
2449
2450         Remove these SPI method declarations, as well as method forwarding in WKContentView. Mail was the only adoptee
2451         of these methods; after <rdar://problem/46047546>, they have moved to the underscore-prefixed versions, so we
2452         we have no need for these erroneously-named SPI methods anymore. There is no change in behavior; verified this
2453         through existing API tests (WKWebViewEditActions), as well as building iOS Mail against WebKit with these
2454         changes to WKWebViewPrivate.h.
2455
2456         * UIProcess/API/Cocoa/WKWebView.mm:
2457         (-[WKWebView canPerformAction:withSender:]):
2458         (-[WKWebView targetForAction:withSender:]):
2459         (-[WKWebView _setFont:sender:]):
2460         (-[WKWebView _setFontSize:sender:]):
2461         (-[WKWebView _setTextColor:sender:]):
2462         (-[WKWebView setFont:sender:]): Deleted.
2463         (-[WKWebView setTextColor:sender:]): Deleted.
2464         (-[WKWebView setFontSize:sender:]): Deleted.
2465         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2466         * UIProcess/ios/WKContentViewInteraction.h:
2467         * UIProcess/ios/WKContentViewInteraction.mm:
2468         (-[WKContentView canPerformActionForWebView:withSender:]):
2469         (-[WKContentView setFontForWebView:sender:]): Deleted.
2470         (-[WKContentView setFontSizeForWebView:sender:]): Deleted.
2471         (-[WKContentView setTextColorForWebView:sender:]): Deleted.
2472
2473 2018-12-23  Wenson Hsieh  <wenson_hsieh@apple.com>
2474
2475         Fix fast/ruby/ruby-base-merge-block-children-crash-2.html after r239543
2476         https://bugs.webkit.org/show_bug.cgi?id=193015
2477         <rdar://problem/46583527>
2478
2479         Reviewed by Tim Horton.
2480
2481         Fix the crash by gracefully handling integer overflow when computing the area of a very large editable element.
2482
2483         * UIProcess/ios/WKContentViewInteraction.mm:
2484         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2485         (-[WKContentView _updateChangedSelection:]):
2486
2487 2018-12-22  Wenson Hsieh  <wenson_hsieh@apple.com>
2488
2489         [iOS] Suppress native selection behaviors when focusing a very small editable element
2490         https://bugs.webkit.org/show_bug.cgi?id=193005
2491         <rdar://problem/46583527>
2492
2493         Reviewed by Tim Horton.
2494
2495         In r238146, I added a mechanism to detect when the selection is hidden within transparent editable elements, and
2496         used this to suppress native selection on iOS (such as selection handles, highlight, callout bar, etc.) to avoid
2497         conflicts between the page's editing UI and the platform.
2498
2499         However, one additional technique observed on some websites involves hiding the selection by moving it into a
2500         tiny (1x1) editable element. Here, we currently still present a callout bar with editing actions, as well as
2501         show a selection caret or handles on iOS. To fix this, we extend the mechanism added in r238146 by also
2502         suppressing the selection assistant in the case where the editable element's area is beneath a tiny minimum
2503         threshold.
2504
2505         Test: editing/selection/ios/hide-selection-in-tiny-contenteditable.html
2506
2507         * Shared/EditorState.cpp:
2508         (WebKit::EditorState::PostLayoutData::encode const):
2509         (WebKit::EditorState::PostLayoutData::decode):
2510         (WebKit::operator<<):
2511         * Shared/EditorState.h:
2512
2513         Rename selectionClipRect to focusedElementRect. We currently propagate the bounds of the focused element to the
2514         UI process through EditorState updates, but only for the purpose of returning it in the computed selection clip
2515         rect; instead, rename this member to something more general-purpose, so we can also use it when determining
2516         whether to suppress the selection assistant.
2517
2518         * UIProcess/API/Cocoa/WKWebView.mm:
2519         (-[WKWebView _candidateRect]):
2520         * UIProcess/Cocoa/WebViewImpl.mm:
2521         (WebKit::WebViewImpl::handleRequestedCandidates):
2522         * UIProcess/ios/WKContentViewInteraction.h:
2523
2524         Add a new SuppressSelectionAssistantReason that corresponds to focusing tiny editable elements.
2525
2526         * UIProcess/ios/WKContentViewInteraction.mm:
2527         (-[WKContentView _zoomToRevealFocusedElement]):
2528         (-[WKContentView _selectionClipRect]):
2529         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2530         (-[WKContentView _updateChangedSelection:]):
2531
2532         Check the size of the focused element, and begin or stop suppressing the selection assistant accordingly.
2533
2534         * WebProcess/WebPage/ios/WebPageIOS.mm:
2535         (WebKit::WebPage::platformEditorState const):
2536         * WebProcess/WebPage/mac/WebPageMac.mm:
2537         (WebKit::WebPage::platformEditorState const):
2538
2539 2018-12-20  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
2540
2541         Use Ref<> as much as possible
2542         https://bugs.webkit.org/show_bug.cgi?id=192808
2543
2544         Reviewed by Alex Christensen.
2545
2546         * PluginProcess/WebProcessConnection.cpp:
2547         (WebKit::WebProcessConnection::create):
2548         * PluginProcess/WebProcessConnection.h:
2549         * UIProcess/API/Cocoa/WKConnection.mm:
2550         (-[WKConnection sendMessageWithName:body:]):
2551         * UIProcess/API/Cocoa/WKWebView.mm:
2552         (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
2553         (-[WKWebView _takeViewSnapshot]):
2554         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
2555         * UIProcess/API/glib/WebKitGeolocationProvider.cpp:
2556         (WebKit::WebKitGeolocationProvider::notifyPositionChanged):
2557         * UIProcess/API/glib/WebKitWebContext.cpp:
2558         (webkit_web_context_allow_tls_certificate_for_host):
2559         * UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp:
2560         (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData):
2561         * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
2562         (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData):
2563         * UIProcess/BackingStore.cpp:
2564         (WebKit::BackingStore::incorporateUpdate):
2565         * UIProcess/Cocoa/NavigationState.mm:
2566         (WebKit::createErrorWithRecoveryAttempter):
2567         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
2568         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
2569         (WebKit::PlaybackSessionManagerProxy::create):
2570         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
2571         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2572         (WebKit::VideoFullscreenManagerProxy::create):
2573         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
2574         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
2575         * UIProcess/Cocoa/WebViewImpl.mm:
2576         (WebKit::WebViewImpl::takeViewSnapshot):
2577         * UIProcess/Downloads/DownloadProxyMap.cpp:
2578         (WebKit::DownloadProxyMap::createDownloadProxy):
2579         * UIProcess/Notifications/WebNotificationManagerProxy.cpp:
2580         (WebKit::WebNotificationManagerProxy::show):
2581         * UIProcess/WebPageProxy.cpp:
2582         (WebKit::WebPageProxy::didCreateSubframe):
2583         * UIProcess/WebProcessPool.cpp:
2584         (WebKit::WebProcessPool::getStatistics):
2585         (WebKit::WebProcessPool::requestWebContentStatistics):
2586         (WebKit::WebProcessPool::requestNetworkingStatistics):
2587         * UIProcess/WebProcessPool.h:
2588         * UIProcess/gstreamer/WebPageProxyGStreamer.cpp:
2589         (WebKit::WebPageProxy::requestInstallMissingMediaPlugins):
2590         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
2591         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
2592         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
2593         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
2594         * UIProcess/ios/WKGeolocationProviderIOS.mm:
2595         (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
2596         * UIProcess/mac/PageClientImplMac.mm:
2597         (WebKit::PageClientImpl::setPromisedDataForImage):
2598         * UIProcess/win/WebInspectorProxyWin.cpp:
2599         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
2600         * WebProcess/InjectedBundle/API/mac/WKDOMRange.mm:
2601         (-[WKDOMRange initWithDocument:]):
2602         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
2603         (WebKit::InjectedBundleRangeHandle::renderedImage):
2604         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
2605         (WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange):
2606         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
2607         (WebKit::InjectedBundlePageUIClient::mouseDidMoveOverElement):
2608         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
2609         (WebKit::NetscapePlugin::snapshot):
2610         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2611         (WebKit::PDFPlugin::addArchiveResource):
2612         (WebKit::PDFPlugin::snapshot):
2613         (WebKit::PDFPlugin::writeItemsToPasteboard):
2614         * WebProcess/Plugins/PluginProcessConnectionManager.cpp:
2615         (WebKit::PluginProcessConnectionManager::getPluginProcessConnection):
2616         * WebProcess/Plugins/PluginProxy.cpp:
2617         (WebKit::PluginProxy::snapshot):
2618         * WebProcess/Plugins/PluginView.cpp:
2619         (WebKit::PluginView::performURLRequest):
2620         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2621         (WebKit::WebChromeClient::exceededDatabaseQuota):
2622         (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
2623         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2624         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
2625         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2626         (WebKit::WebPlatformStrategies::getPathnamesForType):
2627         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
2628         (WebKit::convertCairoSurfaceToShareableBitmap):
2629         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
2630         (WebKit::WebDragClient::declareAndWriteDragImage):
2631         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
2632         (WebKit::WebPage::dictionaryPopupInfoForRange):
2633         * WebProcess/WebPage/DrawingAreaImpl.cpp:
2634         (WebKit::DrawingAreaImpl::display):
2635         * WebProcess/WebPage/FindController.cpp:
2636         (WebKit::FindController::updateFindIndicator):
2637         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2638         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2639         * WebProcess/WebPage/WebFrame.cpp:
2640         (WebKit::WebFrame::webArchiveData):
2641         * WebProcess/WebPage/WebPage.cpp:
2642         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
2643         (WebKit::WebPage::performDragControllerAction):
2644         * WebProcess/WebPage/ios/FindControllerIOS.mm:
2645         (WebKit::FindController::updateFindIndicator):
2646         * WebProcess/WebPage/ios/WebPageIOS.mm:
2647         (WebKit::WebPage::replaceDictatedText):
2648         (WebKit::WebPage::getPositionInformation):
2649         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2650         (WebKit::TiledCoreAnimationDrawingArea::commitTransientZoom):
2651         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
2652         (WebKit::StorageNamespaceImpl::createSessionStorageNamespace):
2653         (WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace):
2654         (WebKit::StorageNamespaceImpl::createLocalStorageNamespace):
2655         (WebKit::StorageNamespaceImpl::createTransientLocalStorageNamespace):
2656         (WebKit::StorageNamespaceImpl::storageArea):
2657         (WebKit::StorageNamespaceImpl::ephemeralLocalStorageArea):
2658         (WebKit::StorageNamespaceImpl::copy):
2659         * WebProcess/WebStorage/StorageNamespaceImpl.h:
2660         * WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:
2661         (WebKit::WebStorageNamespaceProvider::getOrCreate):
2662         (WebKit::WebStorageNamespaceProvider::createSessionStorageNamespace):
2663         (WebKit::WebStorageNamespaceProvider::createEphemeralLocalStorageNamespace):
2664         (WebKit::WebStorageNamespaceProvider::createLocalStorageNamespace):
2665         (WebKit::WebStorageNamespaceProvider::createTransientLocalStorageNamespace):
2666         * WebProcess/WebStorage/WebStorageNamespaceProvider.h:
2667         * WebProcess/cocoa/PlaybackSessionManager.mm:
2668         (WebKit::PlaybackSessionManager::createModelAndInterface):
2669         * WebProcess/cocoa/VideoFullscreenManager.mm:
2670         (WebKit::VideoFullscreenManager::createModelAndInterface):
2671
2672 2018-12-21  Chris Dumez  <cdumez@apple.com>
2673
2674         navigator.userAgent in service workers does not reflect customUserAgent set by client
2675         https://bugs.webkit.org/show_bug.cgi?id=192951
2676
2677         Reviewed by Youenn Fablet.
2678
2679         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
2680         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
2681         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
2682         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
2683         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2684         (WebKit::WebSWServerToContextConnection::installServiceWorkerContext):
2685         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
2686         * WebProcess/Storage/WebSWClientConnection.cpp:
2687         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
2688         * WebProcess/Storage/WebSWClientConnection.h:
2689         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2690         (WebKit::WebSWContextManagerConnection::installServiceWorker):
2691         * WebProcess/Storage/WebSWContextManagerConnection.h:
2692         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2693
2694 2018-12-21  Alex Christensen  <achristensen@webkit.org>
2695
2696         Expand use of sourceApplicationAuditData
2697         https://bugs.webkit.org/show_bug.cgi?id=192995
2698         <rdar://problem/46627875>
2699
2700         Reviewed by Brady Eidson.
2701
2702         sourceApplicationAuditData has been used for a long time on iOS, but it's needed on more platforms.
2703         I also made it return an Optional instead of a bool and returning by reference. Ahhh. So much nicer.
2704
2705         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2706         (WebKit::NetworkProcess::sourceApplicationAuditData const):
2707         * Platform/IPC/Connection.h:
2708         * Platform/IPC/mac/ConnectionMac.mm:
2709         (IPC::Connection::getAuditToken):
2710         * WebProcess/WebProcess.cpp:
2711         (WebKit::WebProcess::initializeWebProcess):
2712         * WebProcess/cocoa/WebProcessCocoa.mm:
2713         (WebKit::WebProcess::sourceApplicationAuditData const):
2714
2715 2018-12-21  Jiewen Tan  <jiewen_tan@apple.com>
2716
2717         [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky
2718         https://bugs.webkit.org/show_bug.cgi?id=192061
2719
2720         Reviewed by Dewei Zhu.
2721
2722         Part 5.
2723
2724         Add some additional temporary logging info to determine if the time out value passed to the timer is respected.
2725         Once the bug is determined and fixed, we should remove all logging added in this patch.
2726
2727         Reviewed by Dewei Zhu.
2728
2729         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2730         (WebKit::AuthenticatorManager::initTimeOutTimer):
2731         (WebKit::AuthenticatorManager::timeOutTimerFired):
2732
2733 2018-12-21  Keith Rollin  <krollin@apple.com>
2734
2735         Crash in com.apple.WebKit: WebKit::WebResourceLoader::willSendRequest + 223
2736         https://bugs.webkit.org/show_bug.cgi?id=192989
2737
2738         Reviewed by Chris Dumez.
2739
2740         willSendRequest is calling maybeLoadFallbackForRedirect, which can
2741         delete “this”. After that, some new logging code tries to access
2742         “this” and causes the crash. Fix this by adjusting the scope of a
2743         "protectedThis".
2744
2745         * WebProcess/Network/WebResourceLoader.cpp:
2746         (WebKit::WebResourceLoader::willSendRequest):
2747
2748 2018-12-21  Alejandro G. Castro  <alex@igalia.com>
2749
2750         [GTK][WPE] Add DeviceIdHashSaltStorage disk persistence
2751         https://bugs.webkit.org/show_bug.cgi?id=190466
2752
2753         Reviewed by Youenn Fablet.
2754
2755         Added persistency to the DeviceIdHashSaltStorage. Implemented a
2756         decoder and an encoder for the HashSaltForOrigin struct to store
2757         it in a file, this allows us to save the lastTimeUsed, the origin
2758         and the hash salt. It uses a new directory where it creates a file
2759         per hash salt, the name of the file is the hash salt to avoid
2760         leaking information in the system. The last time used and the
2761         origin are stored inside the file, it also adds a version
2762         directory used to change the structure of the file in the future,
2763         if we need to do it. In the DeviceIdHashSaltStorage class the disk
2764         operations happen in a WorkQueue, but all interactions go in the
2765         main thread. We added code to handle the operations when the load
2766         still did not finish.
2767
2768         * Platform/Logging.h:
2769         Added channel DiskPersistency..
2770         * Sources.txt: Added new files.
2771         * UIProcess/API/APIProcessPoolConfiguration.cpp: Added code to set
2772         the directory for the deviceIdHashSalts. That way we can use the
2773         configuration when creating the DeviceIdHashSaltStorage.
2774         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
2775         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
2776         (API::ProcessPoolConfiguration::copy):
2777         * UIProcess/API/APIProcessPoolConfiguration.h:
2778         * UIProcess/API/APIWebsiteDataStore.cpp:
2779         (API::WebsiteDataStore::legacyDefaultDataStoreConfiguration):
2780         Added code to set the directory in the disk used to store the
2781         information.
2782         * UIProcess/API/APIWebsiteDataStore.h: Ditto.
2783         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm: Added dummy
2784         implementation to get the directory in cocoa.
2785         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
2786         (API::WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory):
2787         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp: Defined the
2788         default directories used to store the information in the disk.
2789         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
2790         (API::WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory):
2791         (API::WebsiteDataStore::defaultDataStoreConfiguration):
2792         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
2793         (webkitWebsiteDataManagerGetDataStore): Added the directory used
2794         to store the information.
2795         (webkit_website_data_manager_remove): Modified the way we use to
2796         make sure when we remove the cookies we also remove the hash salts.
2797         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp: Added dummy
2798         implementations to get the directory in windows platform.
2799         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
2800         (API::WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory):
2801         * UIProcess/API/C/WKBackForwardListItemRef.cpp: Add namespace, it
2802         seems some unified build compilation issue.
2803         * UIProcess/DeviceIdHashSaltStorage.cpp:
2804         (WebKit::DeviceIdHashSaltStorage::create): Added a create method
2805         used to pass the directory and the persistency status of the websitedatastore.
2806         (WebKit::DeviceIdHashSaltStorage::completeHandler): Added to share
2807         the code copying the origins to complete the get handler.
2808         (WebKit::DeviceIdHashSaltStorage::completeDeviceIdHashSaltForOriginCall):
2809         Added to share the code when completing the task of getting a new
2810         hash salt.
2811         (WebKit::DeviceIdHashSaltStorage::DeviceIdHashSaltStorage): Added
2812         a new constructor for the create method.
2813         (WebKit::getSecurityOriginData): Added to get the
2814         SecurityOriginData from a field in the decoder and do all the
2815         checks.
2816         (WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk): Open the
2817         directory and restore all the hash salts from disk to the memory
2818         structure.
2819         (WebKit::DeviceIdHashSaltStorage::createEncoderFromData const):
2820         Creates the decoder to store the HashSaltForOrigin structure.
2821         (WebKit::DeviceIdHashSaltStorage::storeHashSaltToDisk): Write to
2822         disk a decoder object created from a HashSaltForOrigin
2823         structure. It uses the writeEncoderToDisk function.
2824         (WebKit::DeviceIdHashSaltStorage::deviceIdHashSaltForOrigin): Make
2825         sure we store in disk a new hash salt when it is generated and the
2826         WebsiteDataStore is persistent. Add a completionHandler to return
2827         the value found or generated, this way we can control if the
2828         HashMap is already loaded from disk.
2829         (WebKit::DeviceIdHashSaltStorage::getDeviceIdHashSaltOrigins):
2830         Make sure we run the get in a queue now that we store information
2831         in disk.
2832         (WebKit::DeviceIdHashSaltStorage::deleteHashSaltFromDiskIfNeeded):
2833         Added code to make sure we remove the files in disk.
2834         (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltForOrigins):
2835         Added code to use the deleteHashSaltFromDiskIfNeeded and remove the files in disk.
2836         (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltOriginsModifiedSince):
2837         Added code to use the deleteHashSaltFromDiskIfNeeded and remove the files in disk.
2838         * UIProcess/DeviceIdHashSaltStorage.h: Ditto.
2839         * UIProcess/PersistencyUtils.cpp: Added file to share the
2840         persistency code with the ResourceLoadStatisticsPersistentStorage class.
2841         (WebKit::createDecoderForFile): Ditto.
2842         (WebKit::writeEncoderToDisk): Ditto.
2843         * UIProcess/PersistencyUtils.h: Ditto.
2844         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp: Use the
2845         new PersistencyUtils functions shared with the
2846         DeviceIdHashSaltStorage class.
2847         (WebKit::ResourceLoadStatisticsPersistentStorage::refreshMemoryStoreFromDisk):
2848         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
2849         (WebKit::ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk):
2850         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: After
2851         changing the API of the deviceIdHashSaltForOrigin we now use a
2852         completionHandler because it could happen the HashMap is not still
2853         loaded and we would have to wait for it. We refactored the calls
2854         to the method to use this new completionHandler.
2855         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
2856         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2857         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
2858         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2859         (WebKit::WebsiteDataStore::WebsiteDataStore): Create the
2860         DeviceIdHashSaltStorage class with the persistency information.
2861         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary): Make
2862         sure we have the directory to store the information.
2863         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: Add get
2864         and set functions for the deviceHashSaltStorageDirectory.
2865         * WebKit.xcodeproj/project.pbxproj: Added PersistencyUtils file to
2866         the xcode compilation.
2867
2868 2018-12-20  Alex Christensen  <achristensen@webkit.org>
2869
2870         Remove unused NetworkProcessCreationParameters
2871         https://bugs.webkit.org/show_bug.cgi?id=192961
2872
2873         Reviewed by Andy Estes.
2874
2875         loadThrottleLatency isn't used since I replaced it with NetworkSessionCreationParameters.loadThrottleLatency in r238654
2876         presentingApplicationPID has no effect because that value is only used in the WebProcess in NetworkExtensionContentFilter::initialize
2877
2878         * NetworkProcess/NetworkProcess.cpp:
2879         (WebKit::NetworkProcess::initializeNetworkProcess):
2880         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2881         (WebKit::NetworkProcessCreationParameters::encode const):
2882         (WebKit::NetworkProcessCreationParameters::decode):
2883         * NetworkProcess/NetworkProcessCreationParameters.h:
2884         * UIProcess/WebProcessPool.cpp:
2885         (WebKit::WebProcessPool::ensureNetworkProcess):
2886
2887 2018-12-20  Chris Dumez  <cdumez@apple.com>
2888
2889         Use Optional::hasValue() instead of Optional::has_value()
2890         https://bugs.webkit.org/show_bug.cgi?id=192948
2891
2892         Reviewed by Tim Horton.
2893
2894         * UIProcess/Automation/WebAutomationSession.cpp:
2895         (WebKit::AutomationCommandError::toProtocolString):
2896         (WebKit::WebAutomationSession::willClosePage):
2897         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2898         (WebKit::WebAutomationSessionProxy::computeElementLayout):
2899
2900 2018-12-20  Jeremy Jones  <jeremyj@apple.com>
2901
2902         Flicker when exiting element fullscreen.
2903         https://bugs.webkit.org/show_bug.cgi?id=192774
2904         rdar://problem/33088878
2905
2906         Reviewed by Jer Noble.
2907
2908         Fixes an issue where the web page would flicker upon exiting element fullscreen.
2909
2910         Replace WebView with a snapshot while the WebView is restyled and resized for inline.
2911
2912         * UIProcess/mac/WKFullScreenWindowController.h:
2913         * UIProcess/mac/WKFullScreenWindowController.mm:
2914         (-[WKFullScreenWindowController initWithWindow:webView:page:]):
2915         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
2916         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
2917
2918 2018-12-20  Chris Dumez  <cdumez@apple.com>
2919
2920         Move HTTPS_UPGRADE code behind a runtime flag, off by default
2921         https://bugs.webkit.org/show_bug.cgi?id=192937
2922
2923         Reviewed by Youenn Fablet.
2924
2925         Move HTTPS_UPGRADE code behind a runtime flag, off by default and drop the build time flag.
2926
2927         * Configurations/WebKit.xcconfig:
2928         * DerivedSources.make:
2929         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
2930         * NetworkProcess/NetworkHTTPSUpgradeChecker.h:
2931         * NetworkProcess/NetworkLoadChecker.cpp:
2932         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
2933         (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded const):
2934         (WebKit::NetworkLoadChecker::checkRequest):
2935         * NetworkProcess/NetworkLoadChecker.h:
2936         * NetworkProcess/NetworkProcess.h:
2937         (WebKit::NetworkProcess::networkHTTPSUpgradeChecker):
2938         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2939         (WebKit::NetworkResourceLoadParameters::encode const):
2940         (WebKit::NetworkResourceLoadParameters::decode):
2941         * NetworkProcess/NetworkResourceLoadParameters.h:
2942         * NetworkProcess/NetworkResourceLoader.cpp:
2943         * NetworkProcess/PingLoad.cpp:
2944         (WebKit::PingLoad::PingLoad):
2945         * Shared/WebPreferences.yaml:
2946         * WebProcess/Network/WebLoaderStrategy.cpp:
2947         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2948         * config.h:
2949
2950 2018-12-20  Jiewen Tan  <jiewen_tan@apple.com>
2951
2952         [WebAuthN] Add a runtime flag for local authenticator
2953         https://bugs.webkit.org/show_bug.cgi?id=192792
2954         <rdar://problem/46798738>
2955
2956         Reviewed by Brent Fulgham.
2957
2958         * Shared/WebPreferences.yaml:
2959         * UIProcess/API/C/WKPreferences.cpp:
2960         (WKPreferencesSetWebAuthenticationLocalAuthenticatorEnabled):
2961         (WKPreferencesGetWebAuthenticationLocalAuthenticatorEnabled):
2962         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2963         * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
2964         (WebKit::LocalService::isAvailable):
2965
2966 2018-12-20  Chris Dumez  <cdumez@apple.com>
2967
2968         Use Optional::valueOr() instead of Optional::value_or()
2969         https://bugs.webkit.org/show_bug.cgi?id=192933
2970
2971         Reviewed by Geoffrey Garen.
2972
2973         * Shared/API/c/WKSecurityOriginRef.cpp:
2974         (WKSecurityOriginGetPort):
2975         * UIProcess/API/APIProcessPoolConfiguration.h:
2976         * UIProcess/API/Cocoa/WKSecurityOrigin.mm:
2977         (-[WKSecurityOrigin port]):
2978         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2979         (-[WKWebViewConfiguration _cpuLimit]):
2980         * UIProcess/API/glib/WebKitSecurityOrigin.cpp:
2981         (webkit_security_origin_get_port):
2982         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2983         (webkitWebViewBaseHandleWheelEvent):
2984         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
2985         (WebKit::SimulatedInputKeyFrame::maximumDuration const):
2986         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
2987         * UIProcess/Automation/WebAutomationSession.cpp:
2988         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext):
2989         (WebKit::WebAutomationSession::performInteractionSequence):
2990         * UIProcess/Automation/WebAutomationSessionMacros.h:
2991         * UIProcess/ServiceWorkerProcessProxy.cpp:
2992         (WebKit::ServiceWorkerProcessProxy::start):
2993         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2994         (WebKit::AuthenticatorManager::initTimeOutTimer):
2995         * UIProcess/WebPageProxy.cpp:
2996         (WebKit::WebPageProxy::deviceScaleFactor const):
2997         * UIProcess/WebPageProxy.h:
2998         (WebKit::WebPageProxy::viewportSizeForCSSViewportUnits const):
2999         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
3000         (WebKit::WebPopupMenuProxyGtk::activateItem):
3001         * UIProcess/mac/LegacySessionStateCoding.cpp:
3002         (WebKit::encodeFormDataElement):
3003         * WebProcess/Network/WebLoaderStrategy.cpp:
3004         (WebKit::WebLoaderStrategy::scheduleLoad):
3005         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3006         (WebKit::PDFPlugin::convertFromPDFViewToRootView const):
3007         (WebKit::PDFPlugin::boundsOnScreen const):
3008         (WebKit::PDFPlugin::geometryDidChange):
3009         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
3010         (WebKit::toFormData):
3011         * WebProcess/WebPage/ios/WebPageIOS.mm:
3012         (WebKit::WebPage::updateVisibleContentRects):
3013         * WebProcess/WebPage/wpe/CompositingManager.cpp:
3014         (WebKit::CompositingManager::releaseConnectionFd):
3015
3016 2018-12-20  Keith Rollin  <krollin@apple.com>
3017
3018         Improve release-level page-load logging
3019         https://bugs.webkit.org/show_bug.cgi?id=192872
3020         <rdar://problem/46850309>
3021
3022         Reviewed by Chris Dumez.
3023
3024         There are a number of reported bugs that are difficult or impossible
3025         to track down with our current level of logging. Additionally, some
3026         software groups lower in the page-loading stack have requested logging
3027         sufficient for tracking a user-visible error message down to the
3028         requested resource that caused the message. Add more-comprehensive
3029         logging to address these issues/requests.
3030
3031         * UIProcess/WebPageProxy.cpp:
3032         (WebKit::m_editableImageController):
3033         (WebKit::WebPageProxy::~WebPageProxy):
3034         (WebKit::WebPageProxy::reattachToWebProcess):
3035         (WebKit::WebPageProxy::swapToWebProcess):
3036         (WebKit::WebPageProxy::reattachToWebProcessForReload):
3037         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
3038         (WebKit::WebPageProxy::close):
3039         (WebKit::WebPageProxy::tryClose):
3040         (WebKit::WebPageProxy::loadRequest):
3041         (WebKit::WebPageProxy::loadRequestWithNavigation):
3042         (WebKit::WebPageProxy::loadFile):
3043         (WebKit::WebPageProxy::loadData):
3044         (WebKit::WebPageProxy::loadDataWithNavigation):
3045         (WebKit::WebPageProxy::loadAlternateHTML):
3046         (WebKit::WebPageProxy::loadWebArchiveData):
3047         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
3048         (WebKit::WebPageProxy::stopLoading):
3049         (WebKit::WebPageProxy::reload):
3050         (WebKit::WebPageProxy::goToBackForwardItem):
3051         (WebKit::WebPageProxy::tryRestoreScrollPosition):
3052         (WebKit::WebPageProxy::updateThrottleState):
3053         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3054         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3055         (WebKit::WebPageProxy::restoreFromSessionState):
3056         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
3057         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
3058         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
3059         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
3060         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
3061         (WebKit::WebPageProxy::didCommitLoadForFrame):
3062         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
3063         (WebKit::WebPageProxy::didFinishLoadForFrame):
3064         (WebKit::WebPageProxy::didFailLoadForFrame):
3065         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
3066         (WebKit::WebPageProxy::didNavigateWithNavigationData):
3067         (WebKit::WebPageProxy::didPerformClientRedirect):
3068         (WebKit::WebPageProxy::didPerformServerRedirect):
3069         (WebKit::WebPageProxy::processDidBecomeUnresponsive):
3070         (WebKit::WebPageProxy::processDidBecomeResponsive):
3071         (WebKit::WebPageProxy::processDidTerminate):
3072         (WebKit::WebPageProxy::dispatchProcessDidTerminate):
3073         (WebKit::WebPageProxy::tryReloadAfterProcessTermination):
3074         (WebKit::WebPageProxy::didExceedInactiveMemoryLimitWhileActive):
3075         (WebKit::WebPageProxy::didExceedBackgroundCPULimitWhileInForeground):
3076         * WebProcess/Network/WebLoaderStrategy.cpp:
3077         (WebKit::WebLoaderStrategy::scheduleLoad):
3078         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3079         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
3080         * WebProcess/Network/WebResourceLoader.cpp:
3081         (WebKit::WebResourceLoader::willSendRequest):
3082         (WebKit::WebResourceLoader::didReceiveResponse):
3083         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3084         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
3085         (WebKit::WebFrameLoaderClient::dispatchDidFailLoad):
3086
3087 2018-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
3088
3089         [iOS] Replace "node assistance" terminology in WebKit with "focused element"
3090         https://bugs.webkit.org/show_bug.cgi?id=192936
3091
3092         Reviewed by Tim Horton.
3093
3094         Renames a few methods and data structures in WebKit, to refer to "focused elements" rather than "assisted nodes";
3095         see below for more details. No new tests, because there should be no change in behavior.
3096
3097         * Shared/FocusedElementInformation.cpp: Renamed from Source/WebKit/Shared/AssistedNodeInformation.cpp.
3098         (WebKit::OptionItem::encode const):
3099         (WebKit::OptionItem::decode):
3100         (WebKit::FocusedElementInformation::encode const):
3101         (WebKit::FocusedElementInformation::decode):
3102         * Shared/FocusedElementInformation.h: Renamed from Source/WebKit/Shared/AssistedNodeInformation.h.
3103
3104         Rename AssistedNodeInformation to FocusedElementInformation. Additionally, introduce a named type for the
3105         focusedElementIdentifier (which is currently just a `uint64_t`).
3106
3107         (WebKit::OptionItem::OptionItem):
3108         * Shared/ios/InteractionInformationAtPosition.h:
3109         * Shared/ios/InteractionInformationAtPosition.mm:
3110         (WebKit::InteractionInformationAtPosition::encode const):
3111         (WebKit::InteractionInformationAtPosition::decode):
3112         * SourcesCocoa.txt:
3113         * UIProcess/API/Cocoa/WKWebView.mm:
3114         (-[WKWebView _shouldUpdateKeyboardWithInfo:]):
3115         * UIProcess/PageClient.h:
3116         * UIProcess/WebPageProxy.cpp:
3117         (WebKit::WebPageProxy::resetStateAfterProcessExited):
3118         * UIProcess/WebPageProxy.h:
3119
3120         Rename NodeAssistanceArguments to ElementDidFocusArguments (and also add a FIXME for removing this mechanism
3121         eventually).
3122
3123         (WebKit::WebPageProxy::focusNextFocusedElement):
3124         (WebKit::WebPageProxy::focusNextAssistedNode): Deleted.
3125         * UIProcess/WebPageProxy.messages.in:
3126
3127         Rename StartAssistingNode to ElementDidFocus, and StopAssistingNode to ElementDidBlur.
3128
3129         * UIProcess/ios/PageClientImplIOS.h:
3130         * UIProcess/ios/PageClientImplIOS.mm:
3131         (WebKit::PageClientImpl::elementDidFocus):
3132         (WebKit::PageClientImpl::isFocusingElement):
3133         (WebKit::PageClientImpl::elementDidBlur):
3134         (WebKit::PageClientImpl::startAssistingNode): Deleted.
3135         (WebKit::PageClientImpl::isAssistingNode): Deleted.
3136         (WebKit::PageClientImpl::stopAssistingNode): Deleted.
3137         * UIProcess/ios/WKContentView.h:
3138         * UIProcess/ios/WKContentView.mm:
3139         (-[WKContentView isFocusingElement]):
3140         (-[WKContentView _didCommitLoadForMainFrame]):
3141         (-[WKContentView isAssistingNode]): Deleted.
3142         * UIProcess/ios/WKContentViewInteraction.h:
3143         * UIProcess/ios/WKContentViewInteraction.mm:
3144         (-[WKFocusedElementInfo initWithFocusedElementInformation:isUserInitiated:userObject:]):
3145         (hasFocusedElement):
3146         (-[WKContentView cleanupInteraction]):
3147         (-[WKContentView shouldHideSelectionWhenScrolling]):
3148         (-[WKContentView resignFirstResponderForWebView]):
3149         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]):
3150         (-[WKContentView _requiresKeyboardWhenFirstResponder]):
3151         (-[WKContentView _zoomToRevealFocusedElement]):
3152         (-[WKContentView inputView]):
3153         (-[WKContentView _selectionClipRect]):
3154         (-[WKContentView gestureRecognizerShouldBegin:]):
3155         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
3156         (-[WKContentView clearSelection]):
3157         (-[WKContentView requiresAccessoryView]):
3158         (-[WKContentView canPerformActionForWebView:withSender:]):
3159         (-[WKContentView _isInteractingWithFocusedElement]):
3160         (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:withFlags:]):
3161         (-[WKContentView selectPositionAtPoint:completionHandler:]):
3162         (-[WKContentView selectPositionAtBoundary:inDirection:fromPoint:completionHandler:]):
3163         (-[WKContentView selectTextWithGranularity:atPoint:completionHandler:]):
3164         (-[WKContentView updateSelectionWithExtentPoint:completionHandler:]):
3165         (-[WKContentView updateSelectionWithExtentPoint:withBoundary:completionHandler:]):
3166         (-[WKContentView accessoryTab:]):
3167         (-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]):
3168         (-[WKContentView accessoryClear]):
3169         (-[WKContentView _updateAccessory]):
3170         (-[WKContentView insertTextSuggestion:]):
3171         (-[WKContentView setSelectedTextRange:]):
3172         (-[WKContentView textInputTraits]):
3173         (-[WKContentView isScrollableForKeyboardScrollViewAnimator:]):
3174         (-[WKContentView focusedElementInformation]):
3175         (-[WKContentView focusedSelectElementOptions]):
3176         (rectToRevealWhenZoomingToFocusedElement):
3177         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3178         (-[WKContentView _elementDidBlur]):
3179         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
3180         (-[WKContentView updateCurrentFocusedElementInformation:]):
3181         (-[WKContentView presentViewControllerForCurrentFocusedElement]):
3182         (-[WKContentView focusedFormControlViewDidSubmit:]):
3183         (-[WKContentView focusedFormControlViewDidCancel:]):
3184         (-[WKContentView focusedFormControlViewDidBeginEditing:]):
3185         (-[WKContentView rectForFocusedFormControlView:]):
3186         (-[WKContentView nextRectForFocusedFormControlView:]):
3187         (-[WKContentView previousRectForFocusedFormControlView:]):
3188         (-[WKContentView actionNameForFocusedFormControlView:]):
3189         (-[WKContentView focusedFormControlViewDidRequestNextNode:]):
3190         (-[WKContentView focusedFormControlViewDidRequestPreviousNode:]):
3191         (-[WKContentView hasNextNodeForFocusedFormControlView:]):
3192         (-[WKContentView hasPreviousNodeForFocusedFormControlView:]):
3193         (-[WKContentView selectMenu:didSelectItemAtIndex:]):
3194         (-[WKContentView numberOfItemsInSelectMenu:]):
3195         (-[WKContentView selectMenu:displayTextForItemAtIndex:]):
3196         (-[WKContentView selectMenu:didCheckItemAtIndex:checked:]):
3197         (-[WKContentView selectMenuUsesMultipleSelection:]):
3198         (-[WKContentView selectMenu:hasSelectedOptionAtIndex:]):
3199         (-[WKContentView _updateChangedSelection:]):
3200         (-[WKContentView _autofillContext]):
3201         (-[WKContentView dismissQuickboardViewControllerAndRevealFocusedFormOverlayIfNecessary:]):
3202         (-[WKContentView allowsLanguageSelectionMenuForListViewController:]):
3203         (-[WKContentView inputLabelTextForViewController:]):
3204         (-[WKContentView initialValueForViewController:]):
3205         (-[WKContentView shouldDisplayInputContextViewForListViewController:]):
3206         (-[WKContentView numericInputModeForListViewController:]):
3207         (-[WKContentView textContentTypeForListViewController:]):
3208         (-[WKContentView allowsDictationInputForListViewController:]):
3209         (-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]): Deleted.
3210         (hasAssistedNode): Deleted.
3211
3212         Replaced with hasFocusedElement.
3213
3214         (-[WKContentView _isInteractingWithAssistedNode]): Deleted.
3215         (-[WKContentView assistedNodeInformation]): Deleted.
3216         (-[WKContentView assistedNodeSelectOptions]): Deleted.
3217         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): Deleted.
3218         (-[WKContentView _stopAssistingNode]): Deleted.
3219         (-[WKContentView updateCurrentAssistedNodeInformation:]): Deleted.
3220         (-[WKContentView presentViewControllerForCurrentAssistedNode]): Deleted.
3221         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
3222         (-[WKDataListSuggestionsControl textAlignment]):
3223         * UIProcess/ios/WebPageProxyIOS.mm:
3224         (WebKit::WebPageProxy::focusedElementInformationCallback):
3225         (WebKit::WebPageProxy::requestFocusedElementInformation):
3226         (WebKit::WebPageProxy::computeCustomFixedPositionRect const):
3227         (WebKit::WebPageProxy::didCommitLayerTree):
3228         (WebKit::WebPageProxy::selectWithGesture):
3229         (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
3230         (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
3231         (WebKit::WebPageProxy::selectPositionAtPoint):
3232         (WebKit::WebPageProxy::updateSelectionWithExtentPoint):
3233         (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
3234         (WebKit::WebPageProxy::blurFocusedElement):
3235         (WebKit::WebPageProxy::elementDidFocus):
3236         (WebKit::WebPageProxy::elementDidBlur):
3237         (WebKit::WebPageProxy::focusNextFocusedElement):
3238         (WebKit::WebPageProxy::setFocusedElementValue):
3239         (WebKit::WebPageProxy::setFocusedElementValueAsNumber):
3240         (WebKit::WebPageProxy::setFocusedElementSelectedIndex):
3241         (WebKit::WebPageProxy::assistedNodeInformationCallback): Deleted.
3242         (WebKit::WebPageProxy::requestAssistedNodeInformation): Deleted.
3243         (WebKit::WebPageProxy::blurAssistedNode): Deleted.
3244         (WebKit::WebPageProxy::startAssistingNode): Deleted.
3245         (WebKit::WebPageProxy::stopAssistingNode): Deleted.
3246         (WebKit::WebPageProxy::focusNextAssistedNode): Deleted.
3247         (WebKit::WebPageProxy::setAssistedNodeValue): Deleted.
3248         (WebKit::WebPageProxy::setAssistedNodeValueAsNumber): Deleted.
3249         (WebKit::WebPageProxy::setAssistedNodeSelectedIndex): Deleted.
3250         * UIProcess/ios/forms/WKFormColorPicker.mm:
3251         (-[WKColorPicker initWithView:]):
3252         (-[WKColorPicker setControlValueFromUIColor:]):
3253         * UIProcess/ios/forms/WKFormInputControl.mm:
3254         (-[WKDateTimePicker initWithView:datePickerMode:]):
3255         (-[WKDateTimePicker shouldPresentGregorianCalendar:]):
3256         (-[WKDateTimePicker _dateChangedSetAsNumber]):
3257         (-[WKDateTimePicker _dateChangedSetAsString]):
3258         (-[WKDateTimePicker controlBeginEditing]):
3259         (-[WKFormInputControl initWithView:]):
3260         (-[WKDateTimePopover clear:]):
3261         (-[WKDateTimePopover initWithView:datePickerMode:]):
3262         * UIProcess/ios/forms/WKFormPopover.mm:
3263         (-[WKRotatingPopover presentPopoverAnimated:]):
3264         * UIProcess/ios/forms/WKFormSelectControl.h:
3265         * UIProcess/ios/forms/WKFormSelectControl.mm:
3266         (-[WKFormSelectControl initWithView:]):
3267         * UIProcess/ios/forms/WKFormSelectPicker.mm:
3268         (-[WKMultipleSelectPicker initWithView:]):
3269         (-[WKMultipleSelectPicker pickerView:viewForRow:forComponent:reusingView:]):
3270         (-[WKMultipleSelectPicker pickerView:numberOfRowsInComponent:]):
3271         (-[WKMultipleSelectPicker findItemIndexAt:]):
3272         (-[WKMultipleSelectPicker pickerView:row:column:checked:]):
3273         (-[WKSelectSinglePicker initWithView:]):
3274         (-[WKSelectSinglePicker controlEndEditing]):
3275         (-[WKSelectSinglePicker pickerView:numberOfRowsInComponent:]):
3276         (-[WKSelectSinglePicker pickerView:attributedTitleForRow:forComponent:]):
3277         (-[WKSelectSinglePicker pickerView:didSelectRow:inComponent:]):
3278         * UIProcess/ios/forms/WKFormSelectPopover.mm:
3279         (-[WKSelectTableViewController initWithView:hasGroups:]):
3280         (-[WKSelectTableViewController tableView:numberOfRowsInSection:]):
3281         (-[WKSelectTableViewController tableView:titleForHeaderInSection:]):
3282         (-[WKSelectTableViewController findItemIndexAt:]):
3283         (-[WKSelectTableViewController findItemAt:]):
3284         (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
3285         (-[WKSelectTableViewController tableView:didSelectRowAtIndexPath:]):
3286         (-[WKSelectPopover initWithView:hasGroups:]):
3287         * WebKit.xcodeproj/project.pbxproj:
3288         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3289         (WebKit::WebChromeClient::elementDidFocus):
3290         (WebKit::WebChromeClient::elementDidRefocus):
3291         (WebKit::WebChromeClient::elementDidBlur):
3292         * WebProcess/WebPage/WebPage.cpp:
3293         (WebKit::WebPage::didStartPageTransition):
3294         (WebKit::WebPage::setTextAsync):
3295         (WebKit::WebPage::resetFocusedElementForFrame):
3296         (WebKit::WebPage::elementDidRefocus):
3297         (WebKit::WebPage::elementDidFocus):
3298         (WebKit::WebPage::elementDidBlur):
3299         (WebKit::WebPage::didCommitLoad):
3300         (WebKit::WebPage::resetAssistedNodeForFrame): Deleted.
3301         * WebProcess/WebPage/WebPage.h:
3302
3303         Refactor elementDid{Refocus|Focus|Blur} to take `Element&` rather than `Node*`.
3304
3305         * WebProcess/WebPage/WebPage.messages.in:
3306         * WebProcess/WebPage/ios/WebPageIOS.mm:
3307
3308         Replace m_assistedNode (a `RefPtr<Node>`) with m_focusedElement (a `RefPtr<Element>`).
3309
3310         (WebKit::WebPage::platformEditorState const):
3311         (WebKit::WebPage::completeSyntheticClick):
3312         (WebKit::WebPage::requestFocusedElementInformation):
3313         (WebKit::WebPage::blurFocusedElement):
3314         (WebKit::WebPage::setFocusedElementValue):
3315         (WebKit::WebPage::setFocusedElementValueAsNumber):
3316         (WebKit::WebPage::setFocusedElementSelectedIndex):
3317         (WebKit::innerFrameQuad):
3318         (WebKit::constrainPoint):
3319         (WebKit::WebPage::selectWithGesture):
3320         (WebKit::WebPage::startAutoscrollAtPosition):
3321         (WebKit::WebPage::visiblePositionInFocusedNodeForPoint):
3322         (WebKit::WebPage::selectPositionAtPoint):
3323         (WebKit::WebPage::selectPositionAtBoundaryWithDirection):
3324         (WebKit::WebPage::rangeForGranularityAtPoint):
3325         (WebKit::WebPage::selectTextWithGranularityAtPoint):
3326         (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
3327         (WebKit::WebPage::updateSelectionWithExtentPoint):
3328         (WebKit::WebPage::getPositionInformation):
3329         (WebKit::WebPage::focusNextFocusedElement):
3330         (WebKit::WebPage::getFocusedElementInformation):
3331         (WebKit::WebPage::autofillLoginCredentials):
3332         (WebKit::WebPage::requestAssistedNodeInformation): Deleted.
3333         (WebKit::WebPage::blurAssistedNode): Deleted.
3334         (WebKit::WebPage::setAssistedNodeValue): Deleted.
3335         (WebKit::WebPage::setAssistedNodeValueAsNumber): Deleted.
3336         (WebKit::WebPage::setAssistedNodeSelectedIndex): Deleted.
3337         (WebKit::WebPage::focusNextAssistedNode): Deleted.
3338         (WebKit::WebPage::getAssistedNodeInformation): Deleted.
3339
3340 2018-12-20  Brent Fulgham  <bfulgham@apple.com>
3341
3342         WKWebView default UA doesn't freeze the build number
3343         https://bugs.webkit.org/show_bug.cgi?id=192809
3344         <rdar://problem/44687185>
3345
3346         Reviewed by Andy Estes.
3347
3348         Always reports the frozen build number.
3349
3350         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3351         (defaultApplicationNameForUserAgent): Do not expose the actual build number through this API.
3352
3353 2018-12-20  Jer Noble  <jer.noble@apple.com>
3354
3355         Enable MediaCapabilities by default.
3356         https://bugs.webkit.org/show_bug.cgi?id=192340
3357         <rdar://problem/46435149>
3358
3359         Reviewed by Dean Jackson.
3360
3361         * Shared/WebPreferences.yaml:
3362
3363 2018-12-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3364
3365         [GTK] WebDriver: tests in imported/w3c/webdriver/tests/element_clear/user_prompts.py are failing
3366         https://bugs.webkit.org/show_bug.cgi?id=192927
3367
3368         Reviewed by Michael Catanzaro.
3369
3370         Give the focus back to the web view when a dialog is dismissed.
3371
3372         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3373         (webkitWebViewBaseContainerRemove):
3374
3375 2018-12-20  Tim Horton  <timothy_horton@apple.com>
3376
3377         Unparented WKWebView can't retrieve main resource data for a main frame plugin
3378         https://bugs.webkit.org/show_bug.cgi?id=192923
3379         <rdar://problem/46859068>
3380
3381         Reviewed by Wenson Hsieh.
3382
3383         * WebProcess/Plugins/PluginView.cpp:
3384         (WebKit::PluginView::liveResourceData const):
3385         If the WKWebView is unparented, we may not immediately initialize the plugin.
3386         In that case, PluginView holds on to the backing data until the plugin
3387         is initialized. If a WKWebView API client asks for the backing data
3388         for the plugin during this time, we should return it, instead of bailing.
3389
3390 2018-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
3391
3392         [iOS] Focusing an editable element should scroll to reveal the selection
3393         https://bugs.webkit.org/show_bug.cgi?id=192802
3394         <rdar://problem/46781759>
3395
3396         Reviewed by Tim Horton.
3397
3398         Currently, when tapping on an editable element, logic in -[WKWebView _zoomToFocusRect:…:] attempts to adjust the
3399         visible viewport such that the rect containing the selection is visible. However, AssistedNodeInformation's
3400         selectionRect is used here, which (as the FIXME in WebPage::getAssistedNodeInformation notes) is either the last
3401         touch location, or the top left of the element if the touch location is outside of the element's bounding rect.
3402         This leads to confusing and undesirable behavior when tapping near the bottom of a large contenteditable element
3403         to focus it, since the actual selection will end up near the top of the element, yet we'll try to scroll to
3404         reveal the bottom of the element, which causes the visible selection to scroll offscreen. Notably, this affects
3405         scenarios involving editable web views embedded in apps, such as Mail compose.
3406
3407         Right now, we use the last touch location as an approximation for the selection rect because the selection may