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