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