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