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