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