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