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