1f67344d7ffab1e1cbd121bc8d772df7c72f105b
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-03-21  Per Arne Vollan  <pvollan@apple.com>
2
3         [iOS][macOS] Fix sandbox call violations
4         https://bugs.webkit.org/show_bug.cgi?id=195809
5         <rdar://problem/48829655>
6
7         Reviewed by Brent Fulgham.
8
9         An additional syscall needs to be added to the sandbox allow list.
10
11         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
12         * WebProcess/com.apple.WebProcess.sb.in:
13
14 2019-03-21  Eric Carlson  <eric.carlson@apple.com>
15
16         Add UI process WebRTC runtime logging.
17         https://bugs.webkit.org/show_bug.cgi?id=196020
18         <rdar://problem/49071443>
19
20         Reviewed by Youenn Fablet.
21
22         * Platform/Logging.cpp:
23         (WebKit::getLogChannel): New.
24         * Platform/Logging.h:
25         * Shared/WebCoreArgumentCoders.h: Add coders for WTFLogChannelState and WTFLogLevel.
26
27         Add runtime logging.
28         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
29         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy):
30         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture):
31         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
32         (WebKit::UserMediaPermissionRequestManagerProxy::clearCachedState):
33         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
34         (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest):
35         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
36         (WebKit::UserMediaPermissionRequestManagerProxy::resetAccess):
37         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess):
38         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
39         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
40         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest):
41         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest):
42         (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
43         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
44         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
45         (WebKit::UserMediaPermissionRequestManagerProxy::watchdogTimerFired):
46         (WebKit::UserMediaPermissionRequestManagerProxy::logChannel const):
47         (WebKit::convertEnumerationToString):
48
49         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
50         (WTF::LogArgument<WebKit::UserMediaPermissionRequestManagerProxy::RequestAction>::toString):
51         * UIProcess/UserMediaPermissionRequestProxy.cpp:
52         (WebKit::convertEnumerationToString): Add an enum specialization for logging.
53
54         * UIProcess/UserMediaPermissionRequestProxy.h:
55         (WTF::LogArgument<WebKit::UserMediaPermissionRequestProxy::UserMediaAccessDenialReason>::toString): Ditto.
56
57         * UIProcess/WebPageProxy.cpp:
58         (WebKit::WebPageProxy::logger):
59         (WebKit::WebPageProxy::configureLoggingChannel):
60         * UIProcess/WebPageProxy.h:
61         * UIProcess/WebPageProxy.messages.in:
62
63         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
64         (WebKit::WebChromeClient::configureLoggingChannel):
65         * WebProcess/WebCoreSupport/WebChromeClient.h:
66         * WebProcess/WebPage/WebPage.cpp:
67         (WebKit::WebPage::configureLoggingChannel):
68         * WebProcess/WebPage/WebPage.h:
69
70 2019-03-21  Alex Christensen  <achristensen@webkit.org>
71
72         Stop using LegacySync messages in WebPageProxy
73         https://bugs.webkit.org/show_bug.cgi?id=196056
74
75         Reviewed by Chris Dumez.
76
77         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
78         (WebKit::WebPageProxy::loadRecentSearches):
79         * UIProcess/ProvisionalPageProxy.cpp:
80         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
81         (WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
82         * UIProcess/ProvisionalPageProxy.h:
83         * UIProcess/WebPageProxy.cpp:
84         (WebKit::WebPageProxy::handleSynchronousMessage):
85         (WebKit::WebPageProxy::hasInsecureContent):
86         (WebKit::WebPageProxy::accessibilityScreenToRootView):
87         (WebKit::WebPageProxy::rootViewToAccessibilityScreen):
88         (WebKit::WebPageProxy::printFrame):
89         (WebKit::WebPageProxy::backForwardGoToItem):
90         (WebKit::WebPageProxy::backForwardGoToItemShared):
91         (WebKit::WebPageProxy::backForwardItemAtIndex):
92         (WebKit::WebPageProxy::backForwardBackListCount):
93         (WebKit::WebPageProxy::backForwardForwardListCount):
94         (WebKit::WebPageProxy::canUndoRedo):
95         (WebKit::WebPageProxy::executeUndoRedo):
96         (WebKit::WebPageProxy::checkTextOfParagraph):
97         (WebKit::WebPageProxy::checkSpellingOfString):
98         (WebKit::WebPageProxy::checkGrammarOfString):
99         (WebKit::WebPageProxy::spellingUIIsShowing):
100         (WebKit::WebPageProxy::getGuessesForWord):
101         (WebKit::WebPageProxy::substitutionsPanelIsShowing):
102         (WebKit::WebPageProxy::showCorrectionPanel):
103         (WebKit::WebPageProxy::dismissCorrectionPanel):
104         (WebKit::WebPageProxy::dismissCorrectionPanelSoon):
105         (WebKit::WebPageProxy::recordAutocorrectionResponse):
106         (WebKit::WebPageProxy::dictationAlternatives):
107         (WebKit::WebPageProxy::wrapCryptoKey):
108         (WebKit::WebPageProxy::unwrapCryptoKey):
109         (WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
110         (WebKit::WebPageProxy::serializedAttachmentDataForIdentifiers):
111         (WebKit::WebPageProxy::speechSynthesisVoiceList):
112         (WebKit::WebPageProxy::printMainFrame): Deleted.
113         * UIProcess/WebPageProxy.h:
114         * UIProcess/WebPageProxy.messages.in:
115         * UIProcess/gtk/WebPageProxyGtk.cpp:
116         (WebKit::WebPageProxy::createPluginContainer):
117         * UIProcess/ios/WebPageProxyIOS.mm:
118         (WebKit::WebPageProxy::interpretKeyEvent):
119         * UIProcess/mac/WebPageProxyMac.mm:
120         (WebKit::WebPageProxy::getIsSpeaking):
121         (WebKit::WebPageProxy::executeSavedCommandBySelector):
122         (WebKit::WebPageProxy::showPDFContextMenu):
123
124 2019-03-21  Alex Christensen  <achristensen@webkit.org>
125
126         Stop using LegacySync messages in WebPage
127         https://bugs.webkit.org/show_bug.cgi?id=196057
128
129         Reviewed by Chris Dumez.
130
131         * WebProcess/WebPage/WebPage.h:
132         (WebKit::WebPage::markLayersVolatile):
133         * WebProcess/WebPage/WebPage.messages.in:
134         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
135         (WebKit::WebPage::getCenterForZoomGesture):
136         * WebProcess/WebPage/ios/WebPageIOS.mm:
137         (WebKit::WebPage::readSelectionFromPasteboard):
138         (WebKit::WebPage::getStringSelectionForPasteboard):
139         (WebKit::WebPage::getDataSelectionForPasteboard):
140         (WebKit::WebPage::shouldDelayWindowOrderingEvent):
141         (WebKit::WebPage::acceptsFirstMouse):
142         * WebProcess/WebPage/mac/WebPageMac.mm:
143         (WebKit::WebPage::replaceSelectionWithPasteboardData):
144         (WebKit::WebPage::readSelectionFromPasteboard):
145         (WebKit::WebPage::getStringSelectionForPasteboard):
146         (WebKit::WebPage::getDataSelectionForPasteboard):
147         (WebKit::WebPage::shouldDelayWindowOrderingEvent):
148         (WebKit::WebPage::acceptsFirstMouse):
149
150 2019-03-21  Alex Christensen  <achristensen@webkit.org>
151
152         Stop using LegacySync messages in WebPasteboardProxy
153         https://bugs.webkit.org/show_bug.cgi?id=196060
154
155         Reviewed by Chris Dumez.
156
157         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
158         (WebKit::WebPasteboardProxy::getPasteboardTypes):
159         (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType):
160         (WebKit::WebPasteboardProxy::getPasteboardStringForType):
161         (WebKit::WebPasteboardProxy::getPasteboardStringsForType):
162         (WebKit::WebPasteboardProxy::getPasteboardBufferForType):
163         (WebKit::WebPasteboardProxy::pasteboardCopy):
164         (WebKit::WebPasteboardProxy::getPasteboardChangeCount):
165         (WebKit::WebPasteboardProxy::getPasteboardUniqueName):
166         (WebKit::WebPasteboardProxy::getPasteboardColor):
167         (WebKit::WebPasteboardProxy::getPasteboardURL):
168         (WebKit::WebPasteboardProxy::addPasteboardTypes):
169         (WebKit::WebPasteboardProxy::setPasteboardTypes):
170         (WebKit::WebPasteboardProxy::setPasteboardURL):
171         (WebKit::WebPasteboardProxy::setPasteboardColor):
172         (WebKit::WebPasteboardProxy::setPasteboardStringForType):
173         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
174         (WebKit::WebPasteboardProxy::getNumberOfFiles):
175         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
176         (WebKit::WebPasteboardProxy::writeCustomData):
177         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
178         (WebKit::WebPasteboardProxy::readURLFromPasteboard):
179         (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
180         (WebKit::WebPasteboardProxy::getPasteboardItemsCount):
181         (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
182         (WebKit::WebPasteboardProxy::informationForItemAtIndex):
183         * UIProcess/WebPasteboardProxy.cpp:
184         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
185         (WebKit::WebPasteboardProxy::writeCustomData):
186         * UIProcess/WebPasteboardProxy.h:
187         * UIProcess/WebPasteboardProxy.messages.in:
188         * UIProcess/gtk/WebPasteboardProxyGtk.cpp:
189         (WebKit::WebPasteboardProxy::writeToClipboard):
190         (WebKit::WebPasteboardProxy::readFromClipboard):
191         * UIProcess/wpe/WebPasteboardProxyWPE.cpp:
192         (WebKit::WebPasteboardProxy::getPasteboardTypes):
193         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
194         (WebKit::WebPasteboardProxy::writeWebContentToPasteboard):
195         (WebKit::WebPasteboardProxy::writeStringToPasteboard):
196
197 2019-03-21  Andy Estes  <aestes@apple.com>
198
199         [iOS] Apple Pay should be available in documents with no user agent scripts
200         https://bugs.webkit.org/show_bug.cgi?id=196061
201         <rdar://problem/48649391>
202
203         Reviewed by Brady Eidson.
204
205         * Shared/AuxiliaryProcess.h:
206         * Shared/Cocoa/AuxiliaryProcessCocoa.mm:
207         (WebKit::AuxiliaryProcess::parentProcessHasEntitlement):
208
209         Added a convenience function for checking parent process entitlements.
210
211         * Shared/WebPreferences.yaml:
212         * Shared/WebPreferencesDefaultValues.h:
213         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
214         (-[WKWebViewConfiguration init]):
215
216         Enabled Apple Pay by default on platforms that enable APPLE_PAY_REMOTE_UI.
217
218         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
219         (WebKit::WebPaymentCoordinator::supportsUnrestrictedApplePay const):
220         * WebProcess/ApplePay/WebPaymentCoordinator.h:
221
222         Implemented supportsUnrestrictedApplePay by checking for the
223         com.apple.private.WebKit.UnrestrictedApplePay entitlement on platforms that enable
224         APPLE_PAY_REMOTE_UI.
225
226         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
227         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
228         (didClearWindowObjectForFrame):
229         (setUpPageLoaderClient):
230
231         Added injected bundle SPI that TestWebKitAPI uses to inject the WebCore Internals interface.
232
233         * WebProcess/WebPage/WebPage.cpp:
234         (WebKit::WebPage::runJavaScript):
235
236         Changed to call ScriptController::executeUserAgentScriptInWorld.
237
238 2019-03-21  Chris Dumez  <cdumez@apple.com>
239
240         WebKit should throw when trying to create a WKWebView with a related view that is using a different data store
241         https://bugs.webkit.org/show_bug.cgi?id=196041
242         <rdar://problem/49083230>
243
244         Reviewed by Alex Christensen.
245
246         WebKit should throw when trying to create a WKWebView with a related view that is using a different data store.
247         We do not support having several WebsiteDataStores sharing the same WebProcess.
248
249         * UIProcess/API/Cocoa/WKWebView.mm:
250         (-[WKWebView _initializeWithConfiguration:]):
251         * UIProcess/WebProcessPool.cpp:
252         (WebKit::WebProcessPool::createWebPage):
253
254 2019-03-21  Alex Christensen  <achristensen@webkit.org>
255
256         Add SPI to inform applications of WKContentRuleList actions
257         https://bugs.webkit.org/show_bug.cgi?id=195965
258         <rdar://problem/42664365>
259
260         Reviewed by Geoff Garen.
261
262         * NetworkProcess/NetworkLoadChecker.cpp:
263         (WebKit::NetworkLoadChecker::checkRequest):
264         (WebKit::NetworkLoadChecker::processContentRuleListsForLoad):
265         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad): Deleted.
266         * NetworkProcess/NetworkLoadChecker.h:
267         * UIProcess/API/APINavigationClient.h:
268         (API::NavigationClient::contentRuleListNotification):
269         * UIProcess/API/C/WKPage.cpp:
270         (WKPageSetPageNavigationClient):
271         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
272         * UIProcess/Cocoa/NavigationState.h:
273         * UIProcess/Cocoa/NavigationState.mm:
274         (WebKit::NavigationState::setNavigationDelegate):
275         (WebKit::NavigationState::NavigationClient::contentRuleListNotification):
276         * UIProcess/WebPageProxy.cpp:
277         (WebKit::WebPageProxy::contentRuleListNotification):
278         * UIProcess/WebPageProxy.h:
279         * UIProcess/WebPageProxy.messages.in:
280         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
281         (WebKit::WebChromeClient::contentRuleListNotification):
282         * WebProcess/WebCoreSupport/WebChromeClient.h:
283
284 2019-03-21  Simon Fraser  <simon.fraser@apple.com>
285
286         Add an internal feature flag to disable the -webkit-overflow-scrolling CSS property
287         https://bugs.webkit.org/show_bug.cgi?id=196058
288         rdar://problem/49078202
289
290         Reviewed by Antti Koivisto.
291
292         Add an internal feature flag called "LegacyOverflowScrollingTouchEnabled", initially
293         on by default.
294
295         * Shared/WebPreferences.yaml:
296
297 2019-03-21  Antti Koivisto  <antti@apple.com>
298
299         UI-process hit-testing needs to know about containing block relationships
300         https://bugs.webkit.org/show_bug.cgi?id=195845
301         <rdar://problem/48949633>
302
303         Reviewed by Simon Fraser.
304
305         Test: fast/scrolling/ios/overflow-scroll-overlap-5.html
306
307         When an overflow scroller contains a positioned element the element may not be on a descendant layer of the scroller,
308         yet should move along with it. This needs to be taken into account in UI-side hit testing.
309
310         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
311         (WebKit::RemoteLayerTreeNode::nonAncestorScrollContainerIDs const):
312         (WebKit::RemoteLayerTreeNode::addNonAncestorScrollContainerID):
313         (WebKit::RemoteLayerTreeNode::clearNonAncestorScrollContainerIDs):
314
315         Maintain non-ancestor scrolling relationships for layers.
316
317         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
318         (WebKit::RemoteScrollingCoordinatorProxy::commitScrollingTreeState):
319         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
320         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
321         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
322         (WebKit::isScrolledBy):
323
324         Helper to figure out who scrolls who.
325
326         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
327         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
328         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
329
330         After commit, pull the non-ancestor scrolling relationships from the scrolling tree and update the layer tree.
331
332 2019-03-21  Daniel Bates  <dabates@apple.com>
333
334         [iOS] Inline -_ensureFormAccessoryView into -formAccessoryView and have -_updateAccessory ensure we have a form accessory
335         https://bugs.webkit.org/show_bug.cgi?id=196021
336
337         Reviewed by Wenson Hsieh.
338
339         Every caller of -_ensureFormAccessoryView, except -formAccessoryView, immediately follows the call
340         with a call to -_updateAccessory. Let's just have -_updateAccessory ensure we have a form accessory
341         view and inline the implementation of -_ensureFormAccessoryView into -formAccessoryView so we can
342         remove one method.
343
344         * UIProcess/ios/WKContentViewInteraction.mm:
345         (-[WKContentView inputView]): Remove call to -_ensureFormAccessoryView, -_updateAccessory will do
346         the equivalent work for us.
347         (-[WKContentView formAccessoryView]): Moved implementation of -_ensureFormAccessoryView into here.
348         (-[WKContentView _updateAccessory]): Call self.formAccessoryView to ensure we have a form accessory view.
349         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
350         Remove call to -_ensureFormAccessoryView, -_updateAccessory will do
351         the equivalent work for us.
352         (-[WKContentView _ensureFormAccessoryView]): Deleted.
353
354 2019-03-21  Shawn Roberts  <sroberts@apple.com>
355
356         Unreviewed, rolling out r243250.
357
358         Causing 109 Failures and 2 crashes on iOS Sim Debug
359         OpenSource/Internal queues
360
361         Reverted changeset:
362
363         "[iOS WK2] Turn on async overflow scrolling by default"
364         https://bugs.webkit.org/show_bug.cgi?id=196011
365         https://trac.webkit.org/changeset/243250
366
367 2019-03-21  Brent Fulgham  <bfulgham@apple.com>
368
369         Fix possible memory leak when dismissing a color picker
370         https://bugs.webkit.org/show_bug.cgi?id=196026
371         <rdar://problem/48778568>
372
373         Reviewed by Wenson Hsieh.
374
375         Fix a problem with WebPageProxy::endColorPicker where an early return could leave a color picker
376         with a +1 reference count after dismissing it.
377
378         * UIProcess/WebColorPicker.cpp:
379         (WebKit::WebColorPicker::endPicker):
380         * UIProcess/WebPageProxy.cpp:
381         (WebKit::WebPageProxy::endColorPicker):
382         (WebKit::WebPageProxy::didEndColorPicker):
383
384 2019-03-21  Carlos Garcia Campos  <cgarcia@igalia.com>
385
386         [GTK][WPE] Add API to provide geolocation information
387         https://bugs.webkit.org/show_bug.cgi?id=195940
388
389         Reviewed by Michael Catanzaro.
390
391         Add WebKitGeolocationManager public class to handle geolocation position updates. WebKitGeolocationProvider has
392         been removed and the default implementation based on GeoClue is done by WebKitGeolocationManager.
393
394         * PlatformGTK.cmake:
395         * PlatformWPE.cmake:
396         * SourcesGTK.txt:
397         * SourcesWPE.txt:
398         * UIProcess/API/glib/WebKitGeolocationManager.cpp: Added.
399         (_WebKitGeolocationPosition::_WebKitGeolocationPosition):
400         (webkit_geolocation_position_new):
401         (webkit_geolocation_position_copy):
402         (webkit_geolocation_position_free):
403         (webkit_geolocation_position_set_timestamp):
404         (webkit_geolocation_position_set_altitude):
405         (webkit_geolocation_position_set_altitude_accuracy):
406         (webkit_geolocation_position_set_heading):
407         (webkit_geolocation_position_set_speed):
408         (webkitGeolocationManagerStop):
409         (webkitGeolocationManagerSetEnableHighAccuracy):
410         (webkitGeolocationManagerCreate):
411         (webkitGeolocationManagerGetProperty):
412         (webkit_geolocation_manager_class_init):
413         (webkit_gelocation_manager_update_position):
414         (webkit_gelocation_manager_failed):
415         (webkit_geolocation_manager_get_enable_high_accuracy):
416         * UIProcess/API/glib/WebKitGeolocationManagerPrivate.h: Copied from Source/WebCore/platform/geoclue/GeolocationProviderGeoclueClient.h.
417         * UIProcess/API/glib/WebKitGeolocationProvider.cpp: Removed.
418         * UIProcess/API/glib/WebKitGeolocationProvider.h: Removed.
419         * UIProcess/API/glib/WebKitWebContext.cpp:
420         (webkitWebContextConstructed): Create a WebKitGeolocationManager instead of a WebKitGeolocationProvider.
421         (webkit_web_context_get_geolocation_manager): Get the WebKitGeolocationManager.
422         * UIProcess/API/gtk/WebKitGeolocationManager.h: Added.
423         * UIProcess/API/gtk/WebKitWebContext.h:
424         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
425         * UIProcess/API/gtk/docs/webkit2gtk-4.0.types:
426         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
427         * UIProcess/API/gtk/webkit2.h:
428         * UIProcess/API/wpe/WebKitGeolocationManager.h: Added.
429         * UIProcess/API/wpe/WebKitWebContext.h:
430         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
431         * UIProcess/API/wpe/docs/wpe-docs.sgml:
432         * UIProcess/API/wpe/webkit.h:
433
434 2019-03-20  Youenn Fablet  <youenn@apple.com>
435
436         Compute quota after network process restart based on default quota and space used
437         https://bugs.webkit.org/show_bug.cgi?id=195804
438
439         Reviewed by Chris Dumez.
440
441         Make sure that Cache Storage quota user waits to declare as initialized to its manager
442         until all data is loaded so that it can report a valid space used from the start.
443
444         Add test API to reset the quota to its default value and compute it according current space use.
445
446         * NetworkProcess/NetworkProcess.cpp:
447         (WebKit::NetworkProcess::updateQuotaBasedOnSpaceUsageForTesting):
448         * NetworkProcess/NetworkProcess.h:
449         * NetworkProcess/NetworkProcess.messages.in:
450         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
451         (WebKit::CacheStorage::Caches::create):
452         (WebKit::CacheStorage::Caches::Caches):
453         (WebKit::CacheStorage::Caches::whenInitialized):
454         * NetworkProcess/cache/CacheStorageEngineCaches.h:
455         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
456         (WebKit::CacheStorageEngineConnection::dereference):
457         * WebProcess/Cache/WebCacheStorageConnection.cpp:
458         (WebKit::WebCacheStorageConnection::setQuotaBasedOnSpaceUsage):
459         * WebProcess/Cache/WebCacheStorageConnection.h:
460
461 2019-03-20  Simon Fraser  <simon.fraser@apple.com>
462
463         Rename ENABLE_ACCELERATED_OVERFLOW_SCROLLING macro to ENABLE_OVERFLOW_SCROLLING_TOUCH
464         https://bugs.webkit.org/show_bug.cgi?id=196049
465
466         Reviewed by Tim Horton.
467
468         This macro is about the -webkit-overflow-scrolling CSS property, not accelerated
469         overflow scrolling in general, so rename it.
470
471         * Configurations/FeatureDefines.xcconfig:
472
473 2019-03-20  Jiewen Tan  <jiewen_tan@apple.com>
474
475         Extend Networking Process sandbox for some system frameworks
476         https://bugs.webkit.org/show_bug.cgi?id=196036
477         <rdar://problem/47594150>
478
479         Reviewed by Brent Fulgham.
480
481         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
482         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
483
484 2019-03-20  Alex Christensen  <achristensen@webkit.org>
485
486         Reduce use of LegacySync IPC message type
487         https://bugs.webkit.org/show_bug.cgi?id=194835
488
489         Reviewed by Darin Adler.
490
491         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
492         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
493         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
494         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
495         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
496         (WebKit::NetworkConnectionToWebProcess::blobSize):
497         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
498         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
499         * NetworkProcess/NetworkConnectionToWebProcess.h:
500         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadInformationRequest):
501         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadInformationResponse):
502         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadIntermediateInformation):
503         (WebKit::NetworkConnectionToWebProcess::takeNetworkLoadInformationMetrics):
504         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
505         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
506         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
507         (WebKit::UserMediaCaptureManagerProxy::capabilities):
508         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
509         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
510         * UIProcess/Plugins/PluginProcessProxy.h:
511         * UIProcess/Plugins/PluginProcessProxy.messages.in:
512         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
513         (WebKit::PluginProcessProxy::launchProcess):
514         (WebKit::PluginProcessProxy::launchApplicationAtURL):
515         (WebKit::PluginProcessProxy::openURL):
516         (WebKit::PluginProcessProxy::openFile):
517         * UIProcess/WebFullScreenManagerProxy.cpp:
518         (WebKit::WebFullScreenManagerProxy::supportsFullScreen):
519         * UIProcess/WebFullScreenManagerProxy.h:
520         * UIProcess/WebFullScreenManagerProxy.messages.in:
521         * WebProcess/WebProcess.cpp:
522         (WebKit::WebProcess::fetchWebsiteData):
523         (WebKit::WebProcess::deleteWebsiteData):
524         (WebKit::WebProcess::deleteWebsiteDataForOrigins):
525         (WebKit::WebProcess::processWillSuspendImminently):
526         * WebProcess/WebProcess.h:
527         * WebProcess/WebProcess.messages.in:
528
529 2019-03-20  Keith Rollin  <krollin@apple.com>
530
531         Update checks that determine if WebKit is system WebKit
532         https://bugs.webkit.org/show_bug.cgi?id=195756
533
534         Unreviewed tweak of r243251 after unreviewed build fix after r243230.
535
536         * Shared/mac/AuxiliaryProcessMac.mm:
537         (WebKit::AuxiliaryProcess::isSystemWebKit):
538
539 2019-03-20  Keith Rollin  <krollin@apple.com>
540
541         Update checks that determine if WebKit is system WebKit
542         https://bugs.webkit.org/show_bug.cgi?id=195756
543
544         Unreviewed build fix after r243230.
545
546         * Shared/mac/AuxiliaryProcessMac.mm:
547         (WebKit::AuxiliaryProcess::isSystemWebKit):
548
549 2019-03-20  Simon Fraser  <simon.fraser@apple.com>
550
551         [iOS WK2] Turn on async overflow scrolling by default
552         https://bugs.webkit.org/show_bug.cgi?id=196011
553         rdar://problem/48453859
554
555         Reviewed by Antti Koivisto.
556
557         Turn async overflow scroll on by default for iOS WK2.
558
559         * Shared/WebPreferences.yaml:
560         * Shared/WebPreferencesDefaultValues.h:
561
562 2019-03-20  Youenn Fablet  <youenn@apple.com>
563
564         Have smaller default quotas for third party frames
565         https://bugs.webkit.org/show_bug.cgi?id=195841
566
567         Reviewed by Geoffrey Garen.
568
569         * NetworkProcess/NetworkProcess.cpp:
570         (WebKit::NetworkProcess::storageQuotaManager):
571         For third party iframes, use the default quota divided by 10.
572
573 2019-03-20  Dean Jackson  <dino@apple.com>
574
575         [iOS] Enable fast clicking everywhere
576         https://bugs.webkit.org/show_bug.cgi?id=196023
577         <rdar://problem/49073589>
578
579         Reviewed by Wenson Hsieh.
580
581         Set FastClicksEverywhere to on by default for iPhone & iPad.
582
583         * Shared/WebPreferences.yaml:
584         * Shared/WebPreferencesDefaultValues.h:
585
586 2019-03-20  Chris Dumez  <cdumez@apple.com>
587
588         Regression(PSON): ViewGestureController is not properly notified of process swaps on iOS
589         https://bugs.webkit.org/show_bug.cgi?id=196029
590         <rdar://problem/48954651>
591
592         Reviewed by Tim Horton.
593
594         If there is a ViewGestureController when process swapping, make sure we disconnect it
595         from the old process and reconnect it to the new one. This matches what is done in
596         WebViewImpl for macOS (see r238356).
597
598         * UIProcess/API/Cocoa/WKWebView.mm:
599         (-[WKWebView _processWillSwap]):
600         (-[WKWebView _processDidExit]):
601         (-[WKWebView _didRelaunchProcess]):
602
603 2019-03-20  Carlos Garcia Campos  <cgarcia@igalia.com>
604
605         [GTK] REGRESSION(r243094): crash when launching minibrowser
606         https://bugs.webkit.org/show_bug.cgi?id=195951
607
608         Reviewed by Joseph Pecoraro.
609
610         Always return the inspector from WebPageProxy::inspector() when the page hasn't been closed. The inspector is
611         created in WebPageProxy constructor and it's safe to use even before a process has been launched, because
612         m_inspectedPage is null-checked everywhere.
613
614         * UIProcess/WebPageProxy.cpp:
615         (WebKit::WebPageProxy::inspector const):
616
617 2019-03-20  Keith Rollin  <krollin@apple.com>
618
619         Update checks that determine if WebKit is system WebKit
620         https://bugs.webkit.org/show_bug.cgi?id=195756
621
622         Reviewed by Alexey Proskuryakov.
623
624         The system WebKit can be installed in additional locations, so check
625         for and allow those, too.
626
627         * Shared/mac/AuxiliaryProcessMac.mm:
628         (WebKit::AuxiliaryProcess::isSystemWebKit):
629
630 2019-03-20  Per Arne Vollan  <pvollan@apple.com>
631
632         [iOS] Unable to PiP web videos in Safari due to sandbox violation
633         https://bugs.webkit.org/show_bug.cgi?id=196015
634         <rdar://problem/48867037>
635
636         Reviewed by Brent Fulgham.
637
638         The sandbox should allow getting the iokit property 'ui-pip'.
639
640         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
641
642 2019-03-20  John Wilander  <wilander@apple.com>
643
644         (Test fix) Override minimumTimeBetweenDataRecordsRemoval in ResourceLoadStatisticsStore::shouldRemoveDataRecord() during layout tests
645         https://bugs.webkit.org/show_bug.cgi?id=196017
646
647         Unreviewed test fix.
648
649         This patch adds a check of parameters().isRunningTest to the return of
650         ResourceLoadStatisticsStore::shouldRemoveDataRecord() to allow successive
651         layout tests to remove website data, effectively overriding the
652         minimumTimeBetweenDataRecordsRemoval setting.
653
654         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
655         (WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords const):
656
657 2019-03-20  Daniel Bates  <dabates@apple.com>
658
659         [iOS] Group UIWebFormAccessoryDelegate-related code and tighten it up a bit
660         https://bugs.webkit.org/show_bug.cgi?id=196018
661
662         Reviewed by Wenson Hsieh.
663
664         * UIProcess/ios/WKContentViewInteraction.mm:
665         (-[WKContentView accessoryClear]): Use uniform initializer syntax. Code could send the empty
666         string, but I resisted since null string, as we do now, likely encodes more compactly and we
667         avoid a per-process alloc.
668         (-[WKContentView accessoryTab:]): Fix style nit; missing space between capture list and arguments
669         in lambda. Also use lamdba capture initializer syntax and remove a local.
670         (-[WKContentView _updateAccessory]): Remove a FIXME as it can't be satified with the current
671         design without more bookkeeping. The design for showing and hiding an AutoFill button added in
672         r166933 requires knowing the title for the button when showing it via -setAccessoryViewCustomButtonTitle.
673         We could re-implement such that -setAccessoryViewCustomButtonTitle: stores the title and calls
674         -_updateAccessory, but that has the disadvantage of increasing the memory footprint of WKContentView
675         for the stored title and that seems worse than centralizing the logic in _updateAccessory. So,
676         let's not fix this FIXME. Now that we are removing the FIXME, change to use an early return style.
677         (-[WKContentView _hideKeyboard]): Micro optimization; only call _updateAccessory if we have
678         a form accessory view. This method is called everytime we load a page (more precisely when we
679         commit the load for a page) in addition to everytime we blur (defocus) an element. No need to
680         update an accessory if we don't have one.
681  
682 2019-03-20  Olivier Robin  <olivierrobin@chromium.org>
683
684         Fix _getContentsAsAttributedStringWithCompletionHandler availability for iOS.
685         https://bugs.webkit.org/show_bug.cgi?id=195999
686
687         Reviewed by Tim Horton.
688
689         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
690
691 2019-03-20  Brent Fulgham  <bfulgham@apple.com>
692
693         Adopt RegistrableDomain in the Storage Access API prompt code paths
694         https://bugs.webkit.org/show_bug.cgi?id=195957
695         <rdar://problem/49048028>
696
697         Reviewed by Chris Dumez.
698
699         While making the code changes in Bug 195866 we noticed that strings were being
700         used to pass the origins for the API calls. We should adopt the RegistrableDomain
701         class to improve type safety and avoid introducing bugs in the future.
702
703         * UIProcess/API/APIUIClient.h:
704         (API::UIClient::requestStorageAccessConfirm):
705         * UIProcess/API/C/WKPage.cpp:
706         (WKPageSetPageUIClient):
707         * UIProcess/Cocoa/UIDelegate.h:
708         * UIProcess/Cocoa/UIDelegate.mm:
709         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
710         * UIProcess/Cocoa/WKStorageAccessAlert.h:
711         * UIProcess/Cocoa/WKStorageAccessAlert.mm:
712         (WebKit::presentStorageAccessAlert):
713         * UIProcess/WebPageProxy.cpp:
714         (WebKit::WebPageProxy::requestStorageAccessConfirm):
715
716 2019-03-20  Chris Dumez  <cdumez@apple.com>
717
718         Unreviewed, fix typo in comment added in r243156.
719
720         * UIProcess/WebPageProxy.cpp:
721         (WebKit::WebPageProxy::postMessageToInjectedBundle):
722
723 2019-03-20  Chris Dumez  <cdumez@apple.com>
724
725         Unreviewed, drop invalid assertions landed in r243163.
726
727         Those assertions were causing some API tests to crash.
728         Also include some post-review suggestions from Darin.
729
730         * Shared/CallbackID.h:
731         (WebKit::CallbackID::operator=):
732         * Shared/OptionalCallbackID.h:
733         (WebKit::OptionalCallbackID::operator=):
734
735 2019-03-20  Chris Dumez  <cdumez@apple.com>
736
737         Unreviewed, fix assertion failures in API tests after r243159.
738
739         * UIProcess/VisitedLinkStore.cpp:
740         (WebKit::VisitedLinkStore::removeProcess):
741
742 2019-03-20  Tim Horton  <timothy_horton@apple.com>
743
744         Add an platform-driven spell-checking mechanism
745         https://bugs.webkit.org/show_bug.cgi?id=195795
746
747         Reviewed by Ryosuke Niwa.
748
749         * DerivedSources-input.xcfilelist:
750         * DerivedSources-output.xcfilelist:
751         * DerivedSources.make:
752         * SourcesCocoa.txt:
753         * UIProcess/Cocoa/TextCheckingController.h: Added.
754         * UIProcess/Cocoa/TextCheckingController.mm: Added.
755         (WebKit::TextCheckingController::TextCheckingController):
756         (WebKit::TextCheckingController::replaceRelativeToSelection):
757         (WebKit::TextCheckingController::removeAnnotationRelativeToSelection):
758         * UIProcess/ios/WKContentViewInteraction.h:
759         * UIProcess/ios/WKContentViewInteraction.mm:
760         (-[WKContentView setupInteraction]):
761         (-[WKContentView replaceSelectionOffset:length:withAnnotatedString:relativeReplacementRange:]):
762         (-[WKContentView removeAnnotation:forSelectionOffset:length:]):
763         * WebKit.xcodeproj/project.pbxproj:
764         * WebProcess/WebPage/WebPage.cpp:
765         * WebProcess/WebPage/WebPage.h:
766         (WebKit::WebPage::textCheckingController):
767         Plumb two UITextInput methods through to the Web Content process.
768         I added a new object instead of just sticking things on WebPage
769         because there are quite a few more related ones coming down the pipeline,
770         and will also end up being messages going in the opposite direction.
771
772         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h: Added.
773         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.messages.in: Added.
774         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm: Added.
775         (WebKit::TextCheckingControllerProxy::TextCheckingControllerProxy):
776         (WebKit::TextCheckingControllerProxy::~TextCheckingControllerProxy):
777         (WebKit::relevantMarkerTypes):
778         (WebKit::TextCheckingControllerProxy::rangeAndOffsetRelativeToSelection):
779         (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection):
780         (WebKit::TextCheckingControllerProxy::removeAnnotationRelativeToSelection):
781         Make it possible for the platform to maintain arbitrary key-value pairs
782         attached to document ranges, as a way for it to keep track of various
783         text checking context (e.g. if something has been checked, replaced,
784         what language it might be, ...).
785
786         Allow it to replace the text of a range and the annotations in that range,
787         or remove annotations in a range. Ranges are specified relative to
788         the selection.
789
790         One large missing piece is giving the platform the ability to retrieve
791         annotations in a range; that is coming in a future patch.
792
793         We translate certain annotations into traditional WebCore spelling
794         and grammar document markers, for normal display-time treatment.
795
796         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
797         (-[WKAccessibilityWebPageObject convertScreenPointToRootView:]):
798         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
799         Unified sources fixes.
800
801 2019-03-19  Jiewen Tan  <jiewen_tan@apple.com>
802
803         [WebAuthN] Implement FIDO AppID extension
804         https://bugs.webkit.org/show_bug.cgi?id=143491
805         <rdar://problem/48298273>
806
807         Reviewed by Brent Fulgham.
808
809         In U2fHidAuthenticator::continueSignCommandAfterResponseReceived, it will retry the current command
810         with the AppID if it exists when SW_WRONG_DATA is received from devices. Noted, it will not set
811         the AuthenticationExtensionsClientOutputs::appid to false in any circumstances. In other words, the
812         field will be empty if AppID is supplied in AuthenticationExtensionsClientInputs and not used.
813
814         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
815         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
816         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
817         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp:
818         (WebKit::U2fHidAuthenticator::issueSignCommand):
819         (WebKit::U2fHidAuthenticator::continueSignCommandAfterResponseReceived):
820         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h:
821
822 2019-03-19  Ross Kirsling  <ross.kirsling@sony.com>
823
824         Unreviewed adjustment to r242842 per Darin's request.
825
826         * Platform/win/LoggingWin.cpp:
827         (WebKit::logLevelString):
828
829 2019-03-19  Gyuyoung Kim  <gyuyoung.kim@lge.com>
830
831         [WPE] Fix build warnings because of missing an argument when initializing wpe_input_axis_event
832         https://bugs.webkit.org/show_bug.cgi?id=195931
833
834         Reviewed by Michael Catanzaro.
835
836         There are still build warnings when building wpe port. It looks like
837         these build warnings have been caused by missing to set an argument
838         for the modifier parameter of wpe_input_axis_event. This patch sets 0
839         for the modifier argument to avoid the build warnings.
840
841         * UIProcess/API/wpe/ScrollGestureController.cpp:
842         (WebKit::ScrollGestureController::handleEvent):
843
844 2019-03-19  John Wilander  <wilander@apple.com>
845
846         Resource Load Statistics (experimental): Clear non-cookie website data for sites that have been navigated to, with link decoration, by a prevalent resource
847         https://bugs.webkit.org/show_bug.cgi?id=195923
848         <rdar://problem/49001272>
849
850         Reviewed by Alex Christensen.
851
852         Cross-site trackers abuse link query parameters to transport user identifiers and then store
853         them in first-party storage space. To address this, we've done three things:
854         - r236448 capped all persistent client-side cookies to seven days of storage.
855         - r242288 further capped persistent client-side cookies for navigations with link decoration from prevalent resources.
856         - r242603 added logging of navigations with link decoration from prevalent resources.
857
858         This patch introduces an experimental feature that removes non-cookie website data for sites
859         that have been navigated to, with link decoration, by a prevalent resource.
860
861         To achieve this, resource domains to remove website data for are now marked with an enum called
862         WebsiteDataToRemove with values All, AllButHttpOnlyCookies, AllButCookies. As resources are
863         iterated, they are marked for either of these values and the new function
864         ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor() leads to the marking with
865         WebsiteDataToRemove::AllButCookies.
866
867         Then NetworkProcess::deleteWebsiteDataForRegistrableDomains() looks at this setting and removes
868         website data accordingly.
869
870         The thinking behind this is that the lifetime cap applied in r236448 and r242288 take care of
871         script writable cookies, and this patch takes care of all other script writable storage.
872
873         The infrastructure to handle user interaction expiration is now parameterized so that multiple
874         expiries can be applied. In this particular case, seven days of browser use.
875
876         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
877         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
878         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
879         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
880         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllWebsiteDataFor const):
881         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllButCookiesFor const):
882         (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor):
883         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
884         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
885         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUserInteraction):
886         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUnexpiredRecentUserInteraction const):
887         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllWebsiteDataFor const):
888         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor const):
889         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor):
890         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
891         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
892         (WebKit::domainsToString):
893         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
894         (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const):
895         (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates):
896         (WebKit::ResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
897         (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const):
898         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
899         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
900         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
901         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomains):
902         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
903            Renamed to reflect that it actually takes a parameter for which types of data to remove.
904         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
905         * NetworkProcess/NetworkProcess.cpp:
906         (WebKit::NetworkProcess::initializeNetworkProcess):
907         (WebKit::NetworkProcess::setCrossSiteLoadWithLinkDecorationForTesting):
908         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
909         (WebKit::NetworkProcess::deleteCookiesForTesting):
910         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
911            Renamed to reflect that it actually takes a parameter for which types of data to remove.
912         * NetworkProcess/NetworkProcess.h:
913         * NetworkProcess/NetworkProcess.messages.in:
914         * NetworkProcess/NetworkProcessCreationParameters.cpp:
915         (WebKit::NetworkProcessCreationParameters::encode const):
916         (WebKit::NetworkProcessCreationParameters::decode):
917         * NetworkProcess/NetworkProcessCreationParameters.h:
918         * NetworkProcess/NetworkSession.cpp:
919         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomains):
920         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
921            Renamed to reflect that it actually takes a parameter for which types of data to remove.
922         * NetworkProcess/NetworkSession.h:
923         * Shared/WebPreferences.yaml:
924         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
925         (WKWebsiteDataStoreSetStatisticsCrossSiteLoadWithLinkDecoration):
926         (WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction):
927         (WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords):
928         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
929         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
930         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
931         * UIProcess/Network/NetworkProcessProxy.cpp:
932         (WebKit::NetworkProcessProxy::setCrossSiteLoadWithLinkDecorationForTesting):
933         * UIProcess/Network/NetworkProcessProxy.h:
934         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
935         (WebKit::WebsiteDataStore::setCrossSiteLoadWithLinkDecorationForTesting):
936         * UIProcess/WebsiteData/WebsiteDataStore.h:
937
938 2019-03-19  Chris Dumez  <cdumez@apple.com>
939
940         Unreviewed build fix after r243173.
941
942         * UIProcess/Cocoa/UIDelegate.mm:
943         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
944
945 2019-03-19  Brent Fulgham  <bfulgham@apple.com>
946
947         Add default prompt implementation for the Storage Access API
948         https://bugs.webkit.org/show_bug.cgi?id=195866
949         <rdar://problem/45150009>
950
951         Reviewed by Chris Dumez.
952
953         This patch revises the UIDelegate implementation with a default permission dialog
954         for the Storage Access API. This allows us to use and test the API in MiniBrowser,
955         rather than requiring a full-fledged web browser to drive testing.
956  
957         * UIProcess/Cocoa/UIDelegate.h:
958         * UIProcess/Cocoa/UIDelegate.mm:
959         (WebKit::UIDelegate::UIClient::presentStorageAccessConfirmDialog): Added.
960         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): Modify to call new default
961         implementation if the WKWebVIew client doesn't implement the necessary SPI.
962         * UIProcess/Cocoa/WKStorageAccessAlert.h: Added.
963         * UIProcess/Cocoa/WKStorageAccessAlert.mm: Added.
964         (WebKit::presentStorageAccessAlert):
965         * WebKit.xcodeproj/project.pbxproj:
966
967 2019-03-19  Conrad Shultz  <conrad_shultz@apple.com>
968
969         REGRESSION (r242369): Only use picker-supported UTIs when creating image picker
970         https://bugs.webkit.org/show_bug.cgi?id=195955
971
972         Reviewed by Chris Dumez and Wenson Hsieh.
973
974         r242369 started passing UTIs to -[UIImagePickerController setMediaTypes:] that correspond to types accepted by the
975         file input element. However, UIImagePickerController expects a specific subset of UTIs. In the worst case, if no
976         expected types are passed, this can cause a crash.
977
978         * UIProcess/ios/forms/WKFileUploadPanel.mm:
979         (UTIsForMIMETypes):
980         Return a set rather than an array.
981         (-[WKFileUploadPanel _mediaTypesForPickerSourceType:]):
982         Rather than hardcode specific UTIs, ask UIImagePickerController for its available types. If an accepted type
983         is in the list of available types, use it. Otherwise, if an accepted type conforms to an available type,
984         use the available type. This is an O(n^2) process, but there typically are only a handful of types, so
985         this seems acceptable.
986         (-[WKFileUploadPanel _showDocumentPickerMenu]):
987         Convert the set from UTIsForMIMETypes() to an array.
988
989 2019-03-19  Michael Catanzaro  <mcatanzaro@igalia.com>
990
991         Build cleanly with GCC 9
992         https://bugs.webkit.org/show_bug.cgi?id=195920
993
994         Reviewed by Chris Dumez.
995
996         WebKit triggers three new GCC 9 warnings:
997
998         """
999         -Wdeprecated-copy, implied by -Wextra, warns about the C++11 deprecation of implicitly
1000         declared copy constructor and assignment operator if one of them is user-provided.
1001         """
1002
1003         Solution is to either add a copy constructor or copy assignment operator, if required, or
1004         else remove one if it is redundant.
1005
1006         """
1007         -Wredundant-move, implied by -Wextra, warns about redundant calls to std::move.
1008         -Wpessimizing-move, implied by -Wall, warns when a call to std::move prevents copy elision.
1009         """
1010
1011         These account for most of this patch. Solution is to just remove the bad WTFMove().
1012
1013         Additionally, -Wclass-memaccess has been enhanced to catch a few cases that GCC 8 didn't.
1014         These are solved by casting nontrivial types to void* before using memcpy. (Of course, it
1015         would be safer to not use memcpy on nontrivial types, but that's too complex for this
1016         patch. Searching for memcpy used with static_cast<void*> will reveal other cases to fix.)
1017
1018         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1019         (WebKit::CacheStorage::Cache::decode):
1020         * Platform/IPC/ArgumentCoders.h:
1021         * Shared/CallbackID.h:
1022         (WebKit::CallbackID::operator=):
1023         * Shared/OptionalCallbackID.h:
1024         (WebKit::OptionalCallbackID::operator=):
1025         * Shared/Plugins/NPIdentifierData.cpp:
1026         (WebKit::NPIdentifierData::decode):
1027         * Shared/Plugins/NPVariantData.cpp:
1028         (WebKit::NPVariantData::decode):
1029         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
1030         (WebKit::NetscapePluginModule::getOrCreate):
1031         * Shared/RTCNetwork.cpp:
1032         (WebKit::RTCNetwork::IPAddress::decode):
1033         * Shared/SessionState.cpp:
1034         (WebKit::HTTPBody::Element::decode):
1035         (WebKit::FrameState::decode):
1036         (WebKit::BackForwardListItemState::decode):
1037         * Shared/WebCompiledContentRuleListData.cpp:
1038         (WebKit::WebCompiledContentRuleListData::decode):
1039         * Shared/WebCoreArgumentCoders.cpp:
1040         (IPC::ArgumentCoder<FloatPoint>::decode):
1041         (IPC::ArgumentCoder<FloatRect>::decode):
1042         (IPC::ArgumentCoder<FloatQuad>::decode):
1043         (IPC::ArgumentCoder<ViewportArguments>::decode):
1044         (IPC::ArgumentCoder<IntPoint>::decode):
1045         (IPC::ArgumentCoder<IntRect>::decode):
1046         (IPC::ArgumentCoder<IntSize>::decode):
1047         (IPC::ArgumentCoder<MimeClassInfo>::decode):
1048         (IPC::ArgumentCoder<PluginInfo>::decode):
1049         (IPC::ArgumentCoder<SelectionRect>::decode):
1050         (IPC::ArgumentCoder<CompositionUnderline>::decode):
1051         (IPC::ArgumentCoder<BlobPart>::decode):
1052         (IPC::ArgumentCoder<TextIndicatorData>::decode):
1053         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
1054         (IPC::ArgumentCoder<ScrollOffsetRange<float>>::decode):
1055         * Shared/WebPageCreationParameters.cpp:
1056         (WebKit::WebPageCreationParameters::decode):
1057         * Shared/WebPlatformTouchPoint.cpp:
1058         (WebKit::WebPlatformTouchPoint::decode):
1059         * Shared/WebsiteData/WebsiteData.cpp:
1060         (WebKit::WebsiteData::Entry::decode):
1061         * Shared/WebsiteDataStoreParameters.cpp:
1062         (WebKit::WebsiteDataStoreParameters::decode):
1063         * UIProcess/API/APIContentRuleListStore.cpp:
1064         (API::decodeContentRuleListMetaData):
1065         * UIProcess/WebPageProxy.cpp:
1066         (WebKit::WebPageProxy::launchProcessForReload):
1067         (WebKit::WebPageProxy::launchProcessWithItem):
1068         (WebKit::WebPageProxy::loadRequest):
1069         (WebKit::WebPageProxy::loadFile):
1070         (WebKit::WebPageProxy::loadData):
1071         (WebKit::WebPageProxy::reload):
1072         * UIProcess/WebProcessCache.cpp:
1073         (WebKit::WebProcessCache::takeProcess):
1074         * UIProcess/WebProcessPool.cpp:
1075         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
1076         * WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp:
1077         (WebKit::InjectedBundleCSSStyleDeclarationHandle::getOrCreate):
1078         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
1079         (WebKit::InjectedBundleRangeHandle::getOrCreate):
1080         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1081         (WebKit::InjectedBundle::create):
1082         * WebProcess/Network/WebLoaderStrategy.cpp:
1083         (WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
1084         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1085         (WebKit::CompositingCoordinator::createGraphicsLayer):
1086         * WebProcess/WebPage/WebPage.cpp:
1087         (WebKit::WebPage::pdfSnapshotAtSize):
1088         (WebKit::WebPage::createDocumentLoader):
1089         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
1090         (WebKit::StorageNamespaceImpl::copy):
1091
1092 2019-03-19  Chris Dumez  <cdumez@apple.com>
1093
1094         Spew: Unhandled web process message 'VisitedLinkTableController:VisitedLinkStateChanged'
1095         https://bugs.webkit.org/show_bug.cgi?id=194787
1096         <rdar://problem/48175520>
1097
1098         Reviewed by Geoff Garen.
1099
1100         The unhandled 'VisitedLinkTableController:VisitedLinkStateChanged' message logging happens
1101         when IPC is sent to a WebProcess which does not have a VisitedLinkTableController with the
1102         given identifier. VisitedLinkTableController are kept alive by the WebPage in the WebProcess
1103         side so this indicates that there is no WebPage using this VisitedLinkTableController anymore.
1104
1105         In the UIProcess side, our tracking of who is using which VisitedLinkStore was very poor.
1106         WebPageProxy objects would ask their process to register itself with the page's visitedLinkStore
1107         as soon as the WebPage object has been created on the WebProcess side. This part was fine.
1108         However, unregistration from the visitedLinkStores would only happen when either the
1109         visitedLinkStore would get destroyed or when the WebProcess would shutdown. This means that
1110         WebProcess could stay registered with a visitedLinkStore even after the page that was using it
1111         has been closed, which would lead to such logging.
1112
1113         To address the issue, the WebProcessProxy now keeps track for which pages are using which
1114         visitedLinkStore. When a visitedLinkStore is used by a page for the first time, the
1115         WebProcessProxy will register itself with the visitedLinkStore. Similarly, when the last page
1116         using a given visitedLinkStore is closed, the process unregisters itself from the
1117         visitedLinkStore, thus avoiding the bug.
1118
1119         I also simplified a lot the logic for having a page telling the WebProcessProxy it started
1120         using a visitedLinkStore. Previously, it would have to wait until the process is done launching
1121         before notifying the WebProcessProxy. Now, the WebPageProxy merely tells the WebProcessProxy
1122         that it is starting to use a visitedLinkStore as soon as it sent the CreateWebPage IPC to the
1123         WebProcess (no matter if the process is still launching or not). At this point, the
1124         WebProcessProxy registers the page as a user of the visitedLinkStore and takes care of waiting
1125         until it is done launching before registering itself with the visitedLinkStore.
1126
1127         * UIProcess/ProvisionalPageProxy.cpp:
1128         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
1129         (WebKit::ProvisionalPageProxy::initializeWebPage):
1130         (WebKit::ProvisionalPageProxy::processDidFinishLaunching): Deleted.
1131         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
1132         * UIProcess/ProvisionalPageProxy.h:
1133         * UIProcess/VisitedLinkStore.cpp:
1134         (WebKit::VisitedLinkStore::~VisitedLinkStore):
1135         (WebKit::VisitedLinkStore::addProcess):
1136         * UIProcess/WebPageProxy.cpp:
1137         (WebKit::WebPageProxy::finishAttachingToWebProcess):
1138         (WebKit::WebPageProxy::initializeWebPage):
1139         (WebKit::WebPageProxy::resetStateAfterProcessExited):
1140         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
1141         (WebKit::WebPageProxy::processDidFinishLaunching): Deleted.
1142         * UIProcess/WebPageProxy.h:
1143         * UIProcess/WebProcessProxy.cpp:
1144         (WebKit::WebProcessProxy::shutDown):
1145         (WebKit::WebProcessProxy::removeWebPage):
1146         (WebKit::WebProcessProxy::addVisitedLinkStoreUser):
1147         (WebKit::WebProcessProxy::removeVisitedLinkStoreUser):
1148         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
1149         (WebKit::WebProcessProxy::didFinishLaunching):
1150         (WebKit::WebProcessProxy::addVisitedLinkStore): Deleted.
1151         (WebKit::WebProcessProxy::didDestroyVisitedLinkStore): Deleted.
1152         * UIProcess/WebProcessProxy.h:
1153
1154 2019-03-19  Chris Dumez  <cdumez@apple.com>
1155
1156         REGRESSION (r243094): internal media test fairplay-hls-error.html is failing
1157         https://bugs.webkit.org/show_bug.cgi?id=195954
1158         <rdar://problem/49005981>
1159
1160         Reviewed by Geoffrey Garen.
1161
1162         TestController::resetStateToConsistentValues() tries to send a "reset" message to its
1163         injected bundle. Part of the "reset" message sets the external hosts that we're allowed
1164         to load. If there is no WebProcess yet when WKPagePostMessageToInjectedBundle() is called,
1165         then this message does not get sent and the allowed hosts do not get set, causing this
1166         test failure.
1167
1168         To address the issue, make sure we launch the initial process if necessary when
1169         WebPageProxy::postMessageToInjectedBundle() is called, in order to maintain backward
1170         compatibility.
1171
1172         * UIProcess/WebPageProxy.cpp:
1173         (WebKit::WebPageProxy::postMessageToInjectedBundle):
1174
1175 2019-03-19  Chris Dumez  <cdumez@apple.com>
1176
1177         Unreviewed, rolling out r243142.
1178
1179         Caused assertion hits in WK2 Debug
1180
1181         Reverted changeset:
1182
1183         "Spew: Unhandled web process message
1184         'VisitedLinkTableController:VisitedLinkStateChanged'"
1185         https://bugs.webkit.org/show_bug.cgi?id=194787
1186         https://trac.webkit.org/changeset/243142
1187
1188 2019-03-19  Daniel Bates  <dabates@apple.com>
1189
1190         [iOS] Focus not preserved when switching between tabs
1191         https://bugs.webkit.org/show_bug.cgi?id=195820
1192         <rdar://problem/43614450>
1193
1194         Reviewed by Brent Fulgham.
1195
1196         Fixes a usability annoyance when using a hardware keyboard; focus is not preserved when switching between tabs.
1197         Do not unconditionally tell the WebProcess to blur the currently focused element when the content view (WKContentView)
1198         resigns first responder. Instead only tell it to blur when the content view is resigning because either the
1199         accessory view was dismissed (Done button was pressed) or the keyboard was dismissed (the hide keyboard button
1200         was pressed).
1201
1202         * UIProcess/ios/WKContentViewInteraction.h:
1203         * UIProcess/ios/WKContentViewInteraction.mm: Add new ivar to track whether the content view is resigning
1204         first responder status because the accessory view is being dismissed.
1205         (-[WKContentView resignFirstResponderForWebView]): Only tell WebKit to blur the focused element if we are
1206         resigning because the accessory view is being dismissed or the keyboard was hidden. We continue to do all
1207         other steps when resigning, including hiding the keyboard. Note that by not telling WebKit to blur the
1208         focused element we let it's focus controller manage the focused element with respect to the current
1209         page activation state (i.e. whether the content view is first responder or not). When the content view
1210         becomes the first responder then WebKit's focus controller will be told that the page has become activated
1211         and will tell the UIProcess to focus the currently focused element, which will bring up the keyboard.
1212         (-[WKContentView accessoryDone]): Update state so we know that a subsequent call to resign first responder
1213         was due to the accessory view being dismissed.
1214
1215 2019-03-19  Per Arne Vollan  <pvollan@apple.com>
1216
1217         [iOS] Remove overridden rules in sandbox
1218         https://bugs.webkit.org/show_bug.cgi?id=193840
1219         <rdar://problem/47558526>
1220
1221         Reviewed by Brent Fulgham.
1222
1223         On iOS, there are some rules overridden in the same sandbox file. The overridden rules
1224         should be removed.
1225
1226         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1227
1228 2019-03-19  Timothy Hatcher  <timothy@apple.com>
1229
1230         Make WebKit/NSAttributedString.h a public header.
1231         https://bugs.webkit.org/show_bug.cgi?id=195944
1232
1233         Reviewed by Dean Jackson.
1234
1235         * WebKit.xcodeproj/project.pbxproj:
1236
1237 2019-03-19  Chris Dumez  <cdumez@apple.com>
1238
1239         Drop NetworkCacheStatistics code
1240         https://bugs.webkit.org/show_bug.cgi?id=195910
1241
1242         Reviewed by Antti Koivisto.
1243
1244         Drop NetworkCacheStatistics code. It was a temporary experiment and has not been used in a long time.
1245
1246         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1247         (WebKit::NetworkProcessCreationParameters::encode const):
1248         (WebKit::NetworkProcessCreationParameters::decode):
1249         * NetworkProcess/NetworkProcessCreationParameters.h:
1250         * NetworkProcess/cache/NetworkCache.cpp:
1251         (WebKit::NetworkCache::Cache::Cache):
1252         (WebKit::NetworkCache::Cache::retrieve):
1253         (WebKit::NetworkCache::Cache::store):
1254         (WebKit::NetworkCache::Cache::storeRedirect):
1255         (WebKit::NetworkCache::Cache::update):
1256         (WebKit::NetworkCache::Cache::clear):
1257         * NetworkProcess/cache/NetworkCache.h:
1258         * NetworkProcess/cache/NetworkCacheStatistics.cpp: Removed.
1259         * NetworkProcess/cache/NetworkCacheStatistics.h: Removed.
1260         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1261         (WebKit::NetworkCache::traverseRecordsFiles):
1262         * NetworkProcess/cache/NetworkCacheStorage.h:
1263         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1264         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1265         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1266         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
1267         * Sources.txt:
1268         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1269         (WebKit::registerUserDefaultsIfNeeded):
1270         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1271         * UIProcess/soup/WebProcessPoolSoup.cpp:
1272         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1273         * WebKit.xcodeproj/project.pbxproj:
1274
1275 2019-03-19  Chris Dumez  <cdumez@apple.com>
1276
1277         Spew: Unhandled web process message 'VisitedLinkTableController:VisitedLinkStateChanged'
1278         https://bugs.webkit.org/show_bug.cgi?id=194787
1279         <rdar://problem/48175520>
1280
1281         Reviewed by Geoffrey Garen.
1282
1283         The unhandled 'VisitedLinkTableController:VisitedLinkStateChanged' message logging happens
1284         when IPC is sent to a WebProcess which does not have a VisitedLinkTableController with the
1285         given identifier. VisitedLinkTableController are kept alive by the WebPage in the WebProcess
1286         side so this indicates that there is no WebPage using this VisitedLinkTableController anymore.
1287
1288         In the UIProcess side, our tracking of who is using which VisitedLinkStore was very poor.
1289         WebPageProxy objects would ask their process to register itself with the page's visitedLinkStore
1290         as soon as the WebPage object has been created on the WebProcess side. This part was fine.
1291         However, unregistration from the visitedLinkStores would only happen when either the
1292         visitedLinkStore would get destroyed or when the WebProcess would shutdown. This means that
1293         WebProcess could stay registered with a visitedLinkStore even after the page that was using it
1294         has been closed, which would lead to such logging.
1295
1296         To address the issue, the WebProcessProxy now keeps track for which pages are using which
1297         visitedLinkStore. When a visitedLinkStore is used by a page for the first time, the
1298         WebProcessProxy will register itself with the visitedLinkStore. Similarly, when the last page
1299         using a given visitedLinkStore is closed, the process unregisters itself from the
1300         visitedLinkStore, thus avoiding the bug.
1301
1302         I also simplified a lot the logic for having a page telling the WebProcessProxy it started
1303         using a visitedLinkStore. Previously, it would have to wait until the process is done launching
1304         before notifying the WebProcessProxy. Now, the WebPageProxy merely tells the WebProcessProxy
1305         that it is starting to use a visitedLinkStore as soon as it sent the CreateWebPage IPC to the
1306         WebProcess (no matter if the process is still launching or not). At this point, the
1307         WebProcessProxy registers the page as a user of the visitedLinkStore and takes care of waiting
1308         until it is done launching before registering itself with the visitedLinkStore.
1309
1310         * UIProcess/ProvisionalPageProxy.cpp:
1311         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
1312         (WebKit::ProvisionalPageProxy::initializeWebPage):
1313         (WebKit::ProvisionalPageProxy::processDidFinishLaunching): Deleted.
1314         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
1315         * UIProcess/ProvisionalPageProxy.h:
1316         * UIProcess/VisitedLinkStore.cpp:
1317         (WebKit::VisitedLinkStore::~VisitedLinkStore):
1318         (WebKit::VisitedLinkStore::addProcess):
1319         * UIProcess/WebPageProxy.cpp:
1320         (WebKit::WebPageProxy::finishAttachingToWebProcess):
1321         (WebKit::WebPageProxy::initializeWebPage):
1322         (WebKit::WebPageProxy::resetStateAfterProcessExited):
1323         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
1324         (WebKit::WebPageProxy::processDidFinishLaunching): Deleted.
1325         * UIProcess/WebPageProxy.h:
1326         * UIProcess/WebProcessProxy.cpp:
1327         (WebKit::WebProcessProxy::shutDown):
1328         (WebKit::WebProcessProxy::removeWebPage):
1329         (WebKit::WebProcessProxy::addVisitedLinkStoreUser):
1330         (WebKit::WebProcessProxy::removeVisitedLinkStoreUser):
1331         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
1332         (WebKit::WebProcessProxy::didFinishLaunching):
1333         (WebKit::WebProcessProxy::addVisitedLinkStore): Deleted.
1334         (WebKit::WebProcessProxy::didDestroyVisitedLinkStore): Deleted.
1335         * UIProcess/WebProcessProxy.h:
1336
1337 2019-03-19  Alex Christensen  <achristensen@webkit.org>
1338
1339         Make WTFLogChannelState and WTFLogLevel enum classes
1340         https://bugs.webkit.org/show_bug.cgi?id=195904
1341
1342         Reviewed by Eric Carlson.
1343
1344         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
1345         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
1346         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
1347         (WebKit::NetworkRTCProvider::NetworkRTCProvider):
1348
1349 2019-03-19  Michael Catanzaro  <mcatanzaro@igalia.com>
1350
1351         Unreviewed, rolling out r243132.
1352
1353         Broke GTK build
1354
1355         Reverted changeset:
1356
1357         "Make WTFLogChannelState and WTFLogLevel enum classes"
1358         https://bugs.webkit.org/show_bug.cgi?id=195904
1359         https://trac.webkit.org/changeset/243132
1360
1361 2019-03-19  Antti Koivisto  <antti@apple.com>
1362
1363         Layer with no backing store should still hit-test over a scroller
1364         https://bugs.webkit.org/show_bug.cgi?id=195378
1365         <rdar://problem/48652078>
1366
1367         Reviewed by Simon Fraser.
1368
1369         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1370         (WebKit::RemoteLayerTreeHost::makeNode):
1371         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
1372         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1373         (WebKit::collectDescendantViewsAtPoint):
1374
1375         No need for special WKTiledBackingView, tiled views now have correct event regions.
1376
1377 2019-03-18  Alex Christensen  <achristensen@webkit.org>
1378
1379         Make WTFLogChannelState and WTFLogLevel enum classes
1380         https://bugs.webkit.org/show_bug.cgi?id=195904
1381
1382         Reviewed by Eric Carlson.
1383
1384         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
1385         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
1386         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
1387         (WebKit::NetworkRTCProvider::NetworkRTCProvider):
1388
1389 2019-03-18  Commit Queue  <commit-queue@webkit.org>
1390
1391         Unreviewed, rolling out r243092 and r243096.
1392         https://bugs.webkit.org/show_bug.cgi?id=195926
1393
1394         Caused assertions in tests (Requested by smfr on #webkit).
1395
1396         Reverted changesets:
1397
1398         "Layer with no backing store should still hit-test over a
1399         scroller"
1400         https://bugs.webkit.org/show_bug.cgi?id=195378
1401         https://trac.webkit.org/changeset/243092
1402
1403         "Try to fix Windows build."
1404         https://trac.webkit.org/changeset/243096
1405
1406 2019-03-18  Timothy Hatcher  <timothy@apple.com>
1407
1408         WKWebView.GetContentsShouldReturnAttributedString is crashing on iOS Simulator.
1409         https://bugs.webkit.org/show_bug.cgi?id=195916
1410
1411         Reviewed by Tim Horton.
1412
1413         Add direct support for UIColor so it does not try to use the NSSecureCoding path.
1414         This avoids needs to list the classes when decoding the attributes NSDictionary
1415         and matches the macOS NSColor encoder/decoder.
1416
1417         * Shared/Cocoa/ArgumentCodersCocoa.mm:
1418         (IPC::typeFromObject):
1419         (IPC::encodeColorInternal):
1420         (IPC::decodeColorInternal):
1421         (IPC::encodeObject):
1422         (IPC::decodeObject):
1423
1424 2019-03-18  Timothy Hatcher  <timothy@apple.com>
1425
1426         Add new NSAttributedString API for converting HTML.
1427         https://bugs.webkit.org/show_bug.cgi?id=195636
1428         rdar://problem/45055697
1429
1430         Reviewed by Tim Horton.
1431
1432         * Platform/spi/ios/UIKitSPI.h:
1433         * SourcesCocoa.txt:
1434         * UIProcess/API/Cocoa/NSAttributedString.h: Added.
1435         * UIProcess/API/Cocoa/NSAttributedString.mm: Added.
1436         (-[_WKAttributedStringNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
1437         (-[_WKAttributedStringNavigationDelegate webView:didFailProvisionalNavigation:withError:]):
1438         (-[_WKAttributedStringNavigationDelegate webView:didFailNavigation:withError:]):
1439         (-[_WKAttributedStringNavigationDelegate webView:didFinishNavigation:]):
1440         (+[_WKAttributedStringWebViewCache cache]):
1441         (+[_WKAttributedStringWebViewCache configuration]):
1442         (+[_WKAttributedStringWebViewCache clearConfiguration]):
1443         (+[_WKAttributedStringWebViewCache retrieveOrCreateWebView]):
1444         (+[_WKAttributedStringWebViewCache cacheWebView:]):
1445         (+[_WKAttributedStringWebViewCache resetPurgeDelay]):
1446         (+[_WKAttributedStringWebViewCache purgeSingleWebView]):
1447         (+[_WKAttributedStringWebViewCache purgeAllWebViews]):
1448         (+[NSAttributedString _loadFromHTMLWithOptions:contentLoader:completionHandler:]):
1449         (+[NSAttributedString loadFromHTMLWithRequest:options:completionHandler:]):
1450         (+[NSAttributedString loadFromHTMLWithFileURL:options:completionHandler:]):
1451         (+[NSAttributedString loadFromHTMLWithString:options:completionHandler:]):
1452         (+[NSAttributedString loadFromHTMLWithData:options:completionHandler:]):
1453         * UIProcess/API/Cocoa/NSAttributedStringPrivate.h: Copied from Source/WebKit/UIProcess/API/Cocoa/WKErrorInternal.h.
1454         * UIProcess/API/Cocoa/WKError.h:
1455         * UIProcess/API/Cocoa/WKError.mm:
1456         (localizedDescriptionForErrorCode):
1457         (createNSError):
1458         * UIProcess/API/Cocoa/WKErrorInternal.h:
1459         * WebKit.xcodeproj/project.pbxproj:
1460         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1461         (WebKit::WebPage::getContentsAsAttributedString):
1462
1463 2019-03-18  Alex Christensen  <achristensen@webkit.org>
1464
1465         Implement DownloadMonitor to prevent long-running slow downloads from background apps
1466         https://bugs.webkit.org/show_bug.cgi?id=195785
1467
1468         Reviewed by Geoffrey Garen.
1469
1470         This is similar to what was updated in <rdar://problem/42677685> but for WebKit Downloads.
1471         To test it I implemented a throttled TCP server, SPI to speed up DownloadMonitor's timer,
1472         and SPI to synthesize the application going into the background and foreground, which
1473         NSNotificationCenter does on iOS.
1474
1475         * NetworkProcess/Downloads/Download.cpp:
1476         (WebKit::Download::didReceiveData):
1477         (WebKit::Download::didFinish):
1478         (WebKit::Download::didFail):
1479         (WebKit::Download::didCancel):
1480         * NetworkProcess/Downloads/Download.h:
1481         (WebKit::Download::applicationEnteredBackground):
1482         (WebKit::Download::applicationEnteredForeground):
1483         (WebKit::Download::manager const):
1484         * NetworkProcess/Downloads/DownloadManager.cpp:
1485         (WebKit::DownloadManager::downloadFinished):
1486         (WebKit::DownloadManager::applicationDidEnterBackground):
1487         (WebKit::DownloadManager::applicationWillEnterForeground):
1488         * NetworkProcess/Downloads/DownloadManager.h:
1489         * NetworkProcess/Downloads/DownloadMap.cpp:
1490         (WebKit::DownloadMap::values):
1491         * NetworkProcess/Downloads/DownloadMap.h:
1492         * NetworkProcess/Downloads/DownloadMonitor.cpp: Added.
1493         (WebKit::operator _kbps):
1494         (WebKit::timeUntilNextInterval):
1495         (WebKit::DownloadMonitor::DownloadMonitor):
1496         (WebKit::DownloadMonitor::measuredThroughputRate const):
1497         (WebKit::DownloadMonitor::downloadReceivedBytes):
1498         (WebKit::DownloadMonitor::applicationEnteredForeground):
1499         (WebKit::DownloadMonitor::applicationEnteredBackground):
1500         (WebKit::DownloadMonitor::speedMultiplier const):
1501         (WebKit::DownloadMonitor::timerFired):
1502         * NetworkProcess/Downloads/DownloadMonitor.h: Added.
1503         * NetworkProcess/NetworkProcess.cpp:
1504         (WebKit::NetworkProcess::initializeNetworkProcess):
1505         (WebKit::NetworkProcess::applicationDidEnterBackground):
1506         (WebKit::NetworkProcess::applicationWillEnterForeground):
1507         * NetworkProcess/NetworkProcess.h:
1508         * NetworkProcess/NetworkProcess.messages.in:
1509         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1510         (WebKit::NetworkProcessCreationParameters::encode const):
1511         (WebKit::NetworkProcessCreationParameters::decode):
1512         * NetworkProcess/NetworkProcessCreationParameters.h:
1513         * Sources.txt:
1514         * SourcesCocoa.txt:
1515         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1516         (API::ProcessPoolConfiguration::copy):
1517         * UIProcess/API/APIProcessPoolConfiguration.h:
1518         * UIProcess/API/C/WKContext.cpp:
1519         (WKContextDownloadURLRequest):
1520         (WKContextResumeDownload):
1521         * UIProcess/API/Cocoa/WKProcessPool.mm:
1522         (-[WKProcessPool _synthesizeAppIsBackground:]):
1523         (-[WKProcessPool _downloadURLRequest:originatingWebView:]):
1524         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1525         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1526         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1527         (-[_WKProcessPoolConfiguration downloadMonitorSpeedMultiplier]):
1528         (-[_WKProcessPoolConfiguration setDownloadMonitorSpeedMultiplier:]):
1529         * UIProcess/Cocoa/DownloadProxyMapCocoa.mm: Added.
1530         (WebKit::DownloadProxyMap::platformCreate):
1531         (WebKit::DownloadProxyMap::platformDestroy):
1532         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1533         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1534         * UIProcess/Downloads/DownloadProxy.cpp:
1535         (WebKit::DownloadProxy::didFinish):
1536         (WebKit::DownloadProxy::didFail):
1537         (WebKit::DownloadProxy::didCancel):
1538         * UIProcess/Downloads/DownloadProxyMap.cpp:
1539         (WebKit::DownloadProxyMap::DownloadProxyMap):
1540         (WebKit::DownloadProxyMap::~DownloadProxyMap):
1541         (WebKit::DownloadProxyMap::platformCreate):
1542         (WebKit::DownloadProxyMap::platformDestroy):
1543         (WebKit::DownloadProxyMap::applicationDidEnterBackground):
1544         (WebKit::DownloadProxyMap::applicationWillEnterForeground):
1545         (WebKit::DownloadProxyMap::createDownloadProxy):
1546         (WebKit::DownloadProxyMap::downloadFinished):
1547         * UIProcess/Downloads/DownloadProxyMap.h:
1548         * UIProcess/Network/NetworkProcessProxy.cpp:
1549         (WebKit::NetworkProcessProxy::synthesizeAppIsBackground):
1550         (WebKit::NetworkProcessProxy::createDownloadProxy):
1551         * UIProcess/Network/NetworkProcessProxy.h:
1552         * UIProcess/PageClient.h:
1553         * UIProcess/WebPageProxy.cpp:
1554         (WebKit::WebPageProxy::receivedPolicyDecision):
1555         (WebKit::WebPageProxy::handleDownloadRequest):
1556         * UIProcess/WebPageProxy.h:
1557         * UIProcess/WebProcessPool.cpp:
1558         (WebKit::WebProcessPool::download):
1559         (WebKit::WebProcessPool::resumeDownload):
1560         (WebKit::WebProcessPool::createDownloadProxy):
1561         (WebKit::WebProcessPool::synthesizeAppIsBackground):
1562         * UIProcess/WebProcessPool.h:
1563         * UIProcess/ios/PageClientImplIOS.h:
1564         * UIProcess/ios/PageClientImplIOS.mm:
1565         (WebKit::PageClientImpl::handleDownloadRequest):
1566         * UIProcess/mac/PageClientImplMac.h:
1567         * UIProcess/mac/PageClientImplMac.mm:
1568         (WebKit::PageClientImpl::handleDownloadRequest):
1569         * WebKit.xcodeproj/project.pbxproj:
1570
1571 2019-03-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1572
1573         [iOS] Native selection views sometimes appear in hidden editable areas after losing focus
1574         https://bugs.webkit.org/show_bug.cgi?id=195894
1575         <rdar://problem/48849989>
1576
1577         Reviewed by Tim Horton.
1578
1579         On certain websites, focus is moved away from an editable element while maintaining a selection inside the
1580         editable element. In the case where the editable element is hidden, this currently breaks our text interaction
1581         suppression heuristics, which suppress text selection gestures and overlays inside focused hidden editable
1582         elements. To fix this, we refactor our text interaction suppression heuristics, such that they are not dependent
1583         on an editable element being focused. See changes below for more details.
1584
1585         Test: editing/selection/ios/hide-selection-in-non-focused-element.html
1586
1587         * Shared/EditorState.cpp:
1588         (WebKit::EditorState::PostLayoutData::encode const):
1589         (WebKit::EditorState::PostLayoutData::decode):
1590         * Shared/EditorState.h:
1591
1592         Rename elementIsTransparentOrFullyClipped to editableRootIsTransparentOrFullyClipped, and additionally compute
1593         this flag by checking whether the root editable element containing the selection is transparent or clipped,
1594         instead of using the currently focused element.
1595
1596         * Shared/FocusedElementInformation.cpp:
1597         (WebKit::FocusedElementInformation::encode const):
1598         (WebKit::FocusedElementInformation::decode):
1599         * Shared/FocusedElementInformation.h:
1600
1601         Remove the elementIsTransparentOrFullyClipped flag from FocusedElementInformation (see below for more detail).
1602
1603         * UIProcess/ios/WKContentViewInteraction.h:
1604
1605         Rename FocusedElementIsTransparentOrFullyClipped to EditableRootIsTransparentOrFullyClipped.
1606
1607         * UIProcess/ios/WKContentViewInteraction.mm:
1608         (-[WKContentView _zoomToRevealFocusedElement]):
1609         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1610
1611         Remove logic that currently uses state on FocusedElementInformation to determine whether to suppress platform
1612         text interactions; instead, only use EditorState to make this determination. This logic was originally added in
1613         the initial implementation of the text interaction suppression heuristic as a way to begin suppressing text
1614         selection state before zooming to reveal the focused element; however, since we now zoom to reveal the text
1615         selection when focusing editable elements, zooming is deferred until the next complete EditorState update
1616         arrives in the UI process so we don't need to worry about beginning to suppress text interactions prior to this
1617         initial editor state update.
1618
1619         (-[WKContentView _elementDidBlur]):
1620         (-[WKContentView _updateSelectionAssistantSuppressionState]):
1621
1622         Add a helper method that updates text selection suppression state using the current EditorState.
1623
1624         (-[WKContentView _selectionChanged]):
1625         (-[WKContentView _updateChangedSelection:]):
1626
1627         Always update text suppression state when receiving an EditorState, instead of only doing so when processing a
1628         text selection gesture.
1629
1630         (-[WKContentView _startSuppressingSelectionAssistantForReason:]):
1631
1632         Renamed from _beginSuppressingSelectionAssistantForReason:, to better match "start/end" terminology of
1633         _endSuppressingSelectionAssistantForReason:.
1634
1635         (-[WKContentView dropInteraction:performDrop:]):
1636         (-[WKContentView _beginSuppressingSelectionAssistantForReason:]): Deleted.
1637         * UIProcess/ios/WebPageProxyIOS.mm:
1638         (WebKit::WebPageProxy::editorStateChanged):
1639
1640         Ensure that we run logic to zoom to the focused element *after* updating text selection suppression state, so we
1641         don't erroneously zoom to reveal hidden editable elements.
1642
1643         * WebProcess/WebPage/ios/WebPageIOS.mm:
1644         (WebKit::WebPage::platformEditorState const):
1645         (WebKit::WebPage::getFocusedElementInformation):
1646
1647 2019-03-18  Chris Dumez  <cdumez@apple.com>
1648
1649         Delay WebProcess launch until a load is triggered in a Web view
1650         https://bugs.webkit.org/show_bug.cgi?id=195758
1651         <rdar://problem/48126013>
1652
1653         Reviewed by Geoff Garen.
1654
1655         This is achieved by constructing WebPageProxy objects with a WebProcessProxy that is in
1656         terminated state (because it never launched its process). This is convenient because
1657         it is a state that the WebPageProxy supports, which normally happened by the WebProcess
1658         crashes. When trying to do a load, we were already checking if the WebPageProxy's process
1659         was running (via an isValid() check) and we would re-launch the WebProcess if necessary
1660         by calling reattachToWebProcess(). For clarity, given that this state is no longer
1661         indicating that the WebProcess crashed, I renamed isValid() to hasRunningProcess() and
1662         reattachToWebProcess() to launchProcess().
1663
1664         The reason delaying the WebProcess launch until the first load is useful is because it
1665         allows us to leverage the WebProcessCache given that we now know which registrable
1666         domain is going to be loaded in the process.
1667
1668         This is a progression from a power usage standpoint. When it comes to page load time,
1669         it would be a progression if we found a suitable process in the cache. I do not expect
1670         a performance hit when no process is found in the cache because of process prewarming.
1671
1672         * Shared/API/Cocoa/RemoteObjectRegistry.h:
1673         * Shared/API/Cocoa/RemoteObjectRegistry.mm:
1674         (WebKit::m_launchInitialProcessIfNecessary):
1675         (WebKit::RemoteObjectRegistry::sendInvocation):
1676         * UIProcess/API/Cocoa/WKProcessPool.mm:
1677         (-[WKProcessPool _processCacheSize]):
1678         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1679         * UIProcess/API/Cocoa/WKWebView.mm:
1680         (-[WKWebView _isValid]):
1681         * UIProcess/Automation/WebAutomationSession.cpp:
1682         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
1683         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1684         (WebKit::WebPageProxy::performDictionaryLookupAtLocation):
1685         (WebKit::WebPageProxy::performDictionaryLookupOfCurrentSelection):
1686         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
1687         (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState):
1688         (WebKit::DrawingAreaProxyCoordinatedGraphics::waitForAndDispatchDidUpdateBackingStoreState):
1689         (WebKit::DrawingAreaProxyCoordinatedGraphics::dispatchAfterEnsuringDrawing):
1690         * UIProcess/DrawingAreaProxy.cpp:
1691         (WebKit::DrawingAreaProxy::setViewExposedRect):
1692         (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired):
1693         * UIProcess/GeolocationPermissionRequestManagerProxy.cpp:
1694         (WebKit::GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision):
1695         * UIProcess/InspectorTargetProxy.cpp:
1696         (WebKit::InspectorTargetProxy::connect):
1697         (WebKit::InspectorTargetProxy::disconnect):
1698         (WebKit::InspectorTargetProxy::sendMessageToTargetBackend):
1699         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1700         (WebKit::RemoteLayerTreeDrawingAreaProxy::sizeDidChange):
1701         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
1702         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
1703         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1704         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
1705         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
1706         (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest):
1707         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
1708         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
1709         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
1710         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
1711         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
1712         * UIProcess/ViewGestureController.cpp:
1713         (WebKit::ViewGestureController::ViewGestureController):
1714         * UIProcess/WebBackForwardList.cpp:
1715         (WebKit::WebBackForwardList::~WebBackForwardList):
1716         * UIProcess/WebCookieManagerProxy.cpp:
1717         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
1718         * UIProcess/WebEditCommandProxy.cpp:
1719         (WebKit::WebEditCommandProxy::unapply):
1720         (WebKit::WebEditCommandProxy::reapply):
1721         * UIProcess/WebFrameProxy.cpp:
1722         (WebKit::WebFrameProxy::stopLoading const):
1723         * UIProcess/WebInspectorProxy.cpp:
1724         (WebKit::WebInspectorProxy::WebInspectorProxy):
1725         * UIProcess/WebPageProxy.cpp:
1726         (WebKit::m_resetRecentCrashCountTimer):
1727         (WebKit::WebPageProxy::hasRunningProcess const):
1728         (WebKit::WebPageProxy::setUIClient):
1729         (WebKit::WebPageProxy::setIconLoadingClient):
1730         (WebKit::WebPageProxy::launchProcess):
1731         (WebKit::WebPageProxy::swapToWebProcess):
1732         (WebKit::WebPageProxy::finishAttachingToWebProcess):
1733         (WebKit::WebPageProxy::didAttachToRunningProcess):
1734         (WebKit::WebPageProxy::launchProcessForReload):
1735         (WebKit::WebPageProxy::launchProcessWithItem):
1736         (WebKit::WebPageProxy::initializeWebPage):
1737         (WebKit::WebPageProxy::tryClose):
1738         (WebKit::WebPageProxy::loadRequest):
1739         (WebKit::WebPageProxy::loadFile):
1740         (WebKit::WebPageProxy::loadData):
1741         (WebKit::WebPageProxy::loadAlternateHTML):
1742         (WebKit::WebPageProxy::loadWebArchiveData):
1743         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
1744         (WebKit::WebPageProxy::stopLoading):
1745         (WebKit::WebPageProxy::reload):
1746         (WebKit::WebPageProxy::goToBackForwardItem):
1747         (WebKit::WebPageProxy::tryRestoreScrollPosition):
1748         (WebKit::WebPageProxy::setControlledByAutomation):
1749         (WebKit::WebPageProxy::setIndicating):
1750         (WebKit::WebPageProxy::setBackgroundColor):
1751         (WebKit::WebPageProxy::setTopContentInset):
1752         (WebKit::WebPageProxy::setUnderlayColor):
1753         (WebKit::WebPageProxy::viewWillStartLiveResize):
1754         (WebKit::WebPageProxy::viewWillEndLiveResize):
1755         (WebKit::WebPageProxy::dispatchActivityStateChange):
1756         (WebKit::WebPageProxy::layerHostingModeDidChange):
1757         (WebKit::WebPageProxy::waitForDidUpdateActivityState):
1758         (WebKit::WebPageProxy::setInitialFocus):
1759         (WebKit::WebPageProxy::clearSelection):
1760         (WebKit::WebPageProxy::restoreSelectionInFocusedEditableElement):
1761         (WebKit::WebPageProxy::validateCommand):
1762         (WebKit::WebPageProxy::increaseListLevel):
1763         (WebKit::WebPageProxy::decreaseListLevel):
1764         (WebKit::WebPageProxy::changeListType):
1765         (WebKit::WebPageProxy::setBaseWritingDirection):
1766         (WebKit::WebPageProxy::setNeedsFontAttributes):
1767         (WebKit::WebPageProxy::executeEditCommand):
1768         (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart):
1769         (WebKit::WebPageProxy::setEditable):
1770         (WebKit::WebPageProxy::performDragControllerAction):
1771         (WebKit::WebPageProxy::dragEnded):
1772         (WebKit::WebPageProxy::didStartDrag):
1773         (WebKit::WebPageProxy::dragCancelled):
1774         (WebKit::WebPageProxy::handleMouseEvent):
1775         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
1776         (WebKit::WebPageProxy::handleWheelEvent):
1777         (WebKit::WebPageProxy::handleKeyboardEvent):
1778         (WebKit::WebPageProxy::handleGestureEvent):
1779         (WebKit::WebPageProxy::handleTouchEventSynchronously):
1780         (WebKit::WebPageProxy::handleTouchEventAsynchronously):
1781         (WebKit::WebPageProxy::handleTouchEvent):
1782         (WebKit::WebPageProxy::scrollBy):
1783         (WebKit::WebPageProxy::centerSelectionInVisibleArea):
1784         (WebKit::WebPageProxy::receivedPolicyDecision):
1785         (WebKit::WebPageProxy::setUserAgent):
1786         (WebKit::WebPageProxy::resumeActiveDOMObjectsAndAnimations):
1787         (WebKit::WebPageProxy::suspendActiveDOMObjectsAndAnimations):
1788         (WebKit::WebPageProxy::setCustomTextEncodingName):
1789         (WebKit::WebPageProxy::setTextZoomFactor):
1790         (WebKit::WebPageProxy::setPageZoomFactor):
1791         (WebKit::WebPageProxy::setPageAndTextZoomFactors):
1792         (WebKit::WebPageProxy::scalePage):
1793         (WebKit::WebPageProxy::scalePageInViewCoordinates):
1794         (WebKit::WebPageProxy::scaleView):
1795         (WebKit::WebPageProxy::windowScreenDidChange):
1796         (WebKit::WebPageProxy::setCustomDeviceScaleFactor):
1797         (WebKit::WebPageProxy::accessibilitySettingsDidChange):
1798         (WebKit::WebPageProxy::updateAccessibilityEventsEnabled):
1799         (WebKit::WebPageProxy::setUseFixedLayout):
1800         (WebKit::WebPageProxy::setFixedLayoutSize):
1801         (WebKit::WebPageProxy::setAlwaysShowsHorizontalScroller):
1802         (WebKit::WebPageProxy::setAlwaysShowsVerticalScroller):
1803         (WebKit::WebPageProxy::listenForLayoutMilestones):
1804         (WebKit::WebPageProxy::setSuppressScrollbarAnimations):
1805         (WebKit::WebPageProxy::setEnableVerticalRubberBanding):
1806         (WebKit::WebPageProxy::setEnableHorizontalRubberBanding):
1807         (WebKit::WebPageProxy::setBackgroundExtendsBeyondPage):
1808         (WebKit::WebPageProxy::setPaginationMode):
1809         (WebKit::WebPageProxy::setPaginationBehavesLikeColumns):
1810         (WebKit::WebPageProxy::setPageLength):
1811         (WebKit::WebPageProxy::setGapBetweenPages):
1812         (WebKit::WebPageProxy::setPaginationLineGridEnabled):
1813         (WebKit::WebPageProxy::countStringMatches):
1814         (WebKit::WebPageProxy::replaceMatches):
1815         (WebKit::WebPageProxy::launchInitialProcessIfNecessary):
1816         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
1817         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
1818         (WebKit::WebPageProxy::getRenderTreeExternalRepresentation):
1819         (WebKit::WebPageProxy::getSourceForFrame):
1820         (WebKit::WebPageProxy::getContentsAsString):
1821         (WebKit::WebPageProxy::getContentsAsAttributedString):
1822         (WebKit::WebPageProxy::getBytecodeProfile):
1823         (WebKit::WebPageProxy::getSamplingProfilerOutput):
1824         (WebKit::WebPageProxy::getContentsAsMHTMLData):
1825         (WebKit::WebPageProxy::getSelectionOrContentsAsString):
1826         (WebKit::WebPageProxy::getSelectionAsWebArchiveData):
1827         (WebKit::WebPageProxy::getMainResourceDataOfFrame):
1828         (WebKit::WebPageProxy::getResourceDataFromFrame):
1829         (WebKit::WebPageProxy::getWebArchiveOfFrame):
1830         (WebKit::WebPageProxy::forceRepaint):
1831         (WebKit::WebPageProxy::preferencesDidChange):
1832         (WebKit::WebPageProxy::setMediaVolume):
1833         (WebKit::WebPageProxy::setMuted):
1834         (WebKit::WebPageProxy::setMediaCaptureEnabled):
1835         (WebKit::WebPageProxy::stopMediaCapture):
1836         (WebKit::WebPageProxy::stopAllMediaPlayback):
1837         (WebKit::WebPageProxy::suspendAllMediaPlayback):
1838         (WebKit::WebPageProxy::resumeAllMediaPlayback):
1839         (WebKit::WebPageProxy::handleMediaEvent):
1840         (WebKit::WebPageProxy::setVolumeOfMediaElement):
1841         (WebKit::WebPageProxy::setMayStartMediaWhenInWindow):
1842         (WebKit::WebPageProxy::didChooseColor):
1843         (WebKit::WebPageProxy::didEndColorPicker):
1844         (WebKit::WebPageProxy::didSelectOption):
1845         (WebKit::WebPageProxy::inspector const):
1846         (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
1847         (WebKit::WebPageProxy::didChooseFilesForOpenPanel):
1848         (WebKit::WebPageProxy::didCancelForOpenPanel):
1849         (WebKit::WebPageProxy::removeEditCommand):
1850         (WebKit::WebPageProxy::processDidBecomeUnresponsive):
1851         (WebKit::WebPageProxy::processDidBecomeResponsive):
1852         (WebKit::WebPageProxy::processDidTerminate):
1853         (WebKit::WebPageProxy::processWillBecomeSuspended):
1854         (WebKit::WebPageProxy::processWillBecomeForeground):
1855         (WebKit::WebPageProxy::resetStateAfterProcessExited):
1856         (WebKit::WebPageProxy::setCanRunModal):
1857         (WebKit::WebPageProxy::canRunModal):
1858         (WebKit::WebPageProxy::computePagesForPrinting):
1859         (WebKit::WebPageProxy::drawRectToImage):
1860         (WebKit::WebPageProxy::drawPagesToPDF):
1861         (WebKit::WebPageProxy::drawPagesForPrinting):
1862         (WebKit::WebPageProxy::updateBackingStoreDiscardableState):
1863         (WebKit::WebPageProxy::setViewLayoutSize):
1864         (WebKit::WebPageProxy::setAutoSizingShouldExpandToViewHeight):
1865         (WebKit::WebPageProxy::setViewportSizeForCSSViewportUnits):
1866         (WebKit::WebPageProxy::setComposition):
1867         (WebKit::WebPageProxy::confirmComposition):
1868         (WebKit::WebPageProxy::cancelComposition):
1869         (WebKit::WebPageProxy::setScrollPinningBehavior):
1870         (WebKit::WebPageProxy::setOverlayScrollbarStyle):
1871         (WebKit::WebPageProxy::changeFontAttributes):
1872         (WebKit::WebPageProxy::changeFont):
1873         (WebKit::WebPageProxy::setTextAsync):
1874         (WebKit::WebPageProxy::insertTextAsync):
1875         (WebKit::WebPageProxy::getMarkedRangeAsync):
1876         (WebKit::WebPageProxy::getSelectedRangeAsync):
1877         (WebKit::WebPageProxy::characterIndexForPointAsync):
1878         (WebKit::WebPageProxy::firstRectForCharacterRangeAsync):
1879         (WebKit::WebPageProxy::setCompositionAsync):
1880         (WebKit::WebPageProxy::confirmCompositionAsync):
1881         (WebKit::WebPageProxy::takeSnapshot):
1882         (WebKit::WebPageProxy::requestActiveNowPlayingSessionInfo):
1883         (WebKit::WebPageProxy::setUseSystemAppearance):
1884         (WebKit::WebPageProxy::installActivityStateChangeCompletionHandler):
1885         (WebKit::WebPageProxy::setPlaybackTarget):
1886         (WebKit::WebPageProxy::externalOutputDeviceAvailableDidChange):
1887         (WebKit::WebPageProxy::setShouldPlayToPlaybackTarget):
1888         (WebKit::WebPageProxy::clearWheelEventTestTrigger):
1889         (WebKit::WebPageProxy::callAfterNextPresentationUpdate):
1890         (WebKit::WebPageProxy::setShouldScaleViewToFitDocument):
1891         (WebKit::WebPageProxy::getLoadDecisionForIcon):
1892         (WebKit::WebPageProxy::setResourceCachingDisabled):
1893         (WebKit::WebPageProxy::setUserInterfaceLayoutDirection):
1894         (WebKit::WebPageProxy::effectiveAppearanceDidChange):
1895         (WebKit::WebPageProxy::insertAttachment):
1896         (WebKit::WebPageProxy::updateAttachmentAttributes):
1897         (WebKit::WebPageProxy::getApplicationManifest):
1898         (WebKit::WebPageProxy::textInputContextsInRect):
1899         (WebKit::WebPageProxy::focusTextInputContext):
1900         * UIProcess/WebPageProxy.h:
1901         * UIProcess/WebProcessPool.cpp:
1902         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
1903         (WebKit::WebProcessPool::initializeNewWebProcess):
1904         (WebKit::WebProcessPool::disconnectProcess):
1905         (WebKit::WebProcessPool::createWebPage):
1906         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
1907         * UIProcess/WebProcessPool.h:
1908         * UIProcess/WebProcessProxy.cpp:
1909         (WebKit::WebProcessProxy::create):
1910         (WebKit::WebProcessProxy::addExistingWebPage):
1911         (WebKit::WebProcessProxy::maybeShutDown):
1912         * UIProcess/WebProcessProxy.h:
1913         * UIProcess/gstreamer/InstallMissingMediaPluginsPermissionRequest.cpp:
1914         (WebKit::InstallMissingMediaPluginsPermissionRequest::allow):
1915         (WebKit::InstallMissingMediaPluginsPermissionRequest::didEndRequestInstallMissingMediaPlugins):
1916         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
1917         (WebKit::WebInspectorProxy::platformDetach):
1918         * UIProcess/ios/WKContentViewInteraction.mm:
1919         (-[WKContentView setupInteraction]):
1920         (-[WKContentView _webTouchEventsRecognized:]):
1921         (-[WKContentView _hoverGestureRecognizerChanged:]):
1922         * UIProcess/ios/WebPageProxyIOS.mm:
1923         (WebKit::WebPageProxy::requestFocusedElementInformation):
1924         (WebKit::WebPageProxy::updateVisibleContentRects):
1925         (WebKit::WebPageProxy::updateStringForFind):
1926         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
1927         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize):
1928         (WebKit::WebPageProxy::setForceAlwaysUserScalable):
1929         (WebKit::WebPageProxy::setMaximumUnobscuredSize):
1930         (WebKit::WebPageProxy::setDeviceOrientation):
1931         (WebKit::WebPageProxy::setOverrideViewportArguments):
1932         (WebKit::WebPageProxy::selectWithGesture):
1933         (WebKit::WebPageProxy::updateSelectionWithTouches):
1934         (WebKit::WebPageProxy::requestAutocorrectionData):
1935         (WebKit::WebPageProxy::applyAutocorrection):
1936         (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
1937         (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
1938         (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection):
1939         (WebKit::WebPageProxy::selectPositionAtPoint):
1940         (WebKit::WebPageProxy::beginSelectionInDirection):
1941         (WebKit::WebPageProxy::updateSelectionWithExtentPoint):
1942         (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
1943         (WebKit::WebPageProxy::requestDictationContext):
1944         (WebKit::WebPageProxy::getSelectionContext):
1945         (WebKit::WebPageProxy::selectWithTwoTouches):
1946         (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
1947         (WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText):
1948         (WebKit::WebPageProxy::moveSelectionByOffset):
1949         (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens):
1950         (WebKit::WebPageProxy::focusNextFocusedElement):
1951         (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
1952         (WebKit::WebPageProxy::requestEvasionRectsAboveSelection):
1953         (WebKit::WebPageProxy::requestDragStart):
1954         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
1955         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1956         (WebKit::TiledCoreAnimationDrawingAreaProxy::sizeDidChange):
1957         (WebKit::TiledCoreAnimationDrawingAreaProxy::viewLayoutSizeDidChange):
1958         (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence):
1959         (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing):
1960         * UIProcess/mac/WebPageProxyMac.mm:
1961         (WebKit::WebPageProxy::windowAndViewFramesChanged):
1962         (WebKit::WebPageProxy::setMainFrameIsScrollable):
1963         (WebKit::WebPageProxy::insertDictatedTextAsync):
1964         (WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync):
1965         (WebKit::WebPageProxy::fontAtSelection):
1966         (WebKit::WebPageProxy::stringSelectionForPasteboard):
1967         (WebKit::WebPageProxy::dataSelectionForPasteboard):
1968         (WebKit::WebPageProxy::readSelectionFromPasteboard):
1969         (WebKit::WebPageProxy::sendComplexTextInputToPlugin):
1970         (WebKit::WebPageProxy::registerWebProcessAccessibilityToken):
1971         (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens):
1972         (WebKit::WebPageProxy::acceptsFirstMouse):
1973         * UIProcess/win/WebInspectorProxyWin.cpp:
1974         (WebKit::WebInspectorProxy::platformDetach):
1975         * UIProcess/win/WebView.cpp:
1976         (WebKit::WebView::cursorToShow const):
1977         * WebProcess/WebPage/WebPage.cpp:
1978         (WebKit::m_hostFileDescriptor):
1979
1980 2019-03-18  Antti Koivisto  <antti@apple.com>
1981
1982         Layer with no backing store should still hit-test over a scroller
1983         https://bugs.webkit.org/show_bug.cgi?id=195378
1984         <rdar://problem/48652078>
1985
1986         Reviewed by Simon Fraser.
1987
1988         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1989         (WebKit::RemoteLayerTreeHost::makeNode):
1990         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
1991         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1992         (WebKit::collectDescendantViewsAtPoint):
1993
1994         No need for special WKTiledBackingView, tiled views now have correct event regions.
1995
1996 2019-03-18  Daniel Bates  <dabates@apple.com>
1997
1998         [iOS] No DOM keypress event emitted for cursor key commands when non-editable element is focused
1999         https://bugs.webkit.org/show_bug.cgi?id=195626
2000         <rdar://problem/48810626>
2001
2002         Reviewed by Wenson Hsieh.
2003
2004         Following the UIKit fix <rdar://problem/47333786> WebKit will be asked whether it can perform some
2005         more actions, including cursor movements and more editing actions. All such actions are only applicable
2006         to editable elements. By responding NO to UIKit for such actions when we are not in an editable element
2007         we avoid the need to do such bookkeeping ourselves as UIKit will forward our response back to us
2008         on return from -handleKeyTextCommandForCurrentEvent, called from -[WKContentView _interpretKeyEvent].
2009         WebKit is then in a position to try to handle the event or in the case of all standard text editing
2010         key commands at the time of writing (e.g. Control + a) tell WebCore that it did not handle the event
2011         so that WebCore can continue the DOM key event dispatch algorithm. For standard text editing key
2012         commands, such as Control + a, we will emit a DOM keypress event for the 'a'.
2013
2014         * UIProcess/ios/WKContentViewInteraction.mm:
2015         (-[WKContentView canPerformAction:withSender:]):
2016
2017 2019-03-18  Adrian Perez de Castro  <aperez@igalia.com>
2018
2019         [WPE] Bump public API to wpe-1.0
2020         https://bugs.webkit.org/show_bug.cgi?id=195887
2021
2022         Reviewed by Philippe Normand.
2023
2024         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: Renamed from Source/WebKit/UIProcess/API/wpe/docs/wpe-0.1-sections.txt.
2025         * WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-1.0-sections.txt: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-0.1-sections.txt.
2026
2027 2019-03-18  Adrian Perez de Castro  <aperez@igalia.com>
2028
2029         [WPE] Bump dependencies to wpe-1.0 and wpebackend-fdo-1.0
2030         https://bugs.webkit.org/show_bug.cgi?id=195786
2031
2032         Reviewed by Philippe Normand.
2033
2034         * wpe/wpe-web-extension.pc.in: Change dependency to wpe-1.0
2035         * wpe/wpe-webkit.pc.in: Ditto.
2036
2037 2019-03-17  Fujii Hironori  <Hironori.Fujii@sony.com>
2038
2039         [iOS] Block the accessibility server when accessibility is not enabled.
2040         https://bugs.webkit.org/show_bug.cgi?id=195342
2041         <rdar://problem/48615720>
2042
2043         Unreviewed build fix for WinCairo.
2044
2045         * Shared/SandboxExtension.h: Use ProcessID instead of pid_t.
2046
2047 2019-03-16  Dean Jackson  <dino@apple.com>
2048
2049         ASSERT(gestureRecognizer == _doubleTapGestureRecognizer) in _doubleTapDidFail:
2050         https://bugs.webkit.org/show_bug.cgi?id=195857
2051         <rdar://problem/48954679>
2052
2053         Reviewed by Wenson Hsieh.
2054
2055         Reset an existing gesture recognizer before creating a new one.
2056
2057         * UIProcess/ios/WKContentViewInteraction.mm:
2058         (-[WKContentView _createAndConfigureDoubleTapGestureRecognizer]):
2059         (-[WKContentView _setDoubleTapGesturesEnabled:]):
2060
2061 2019-03-16  Jer Noble  <jer.noble@apple.com>
2062
2063         Add a new MediaCapabilitiesExtensionsEnabled setting
2064         https://bugs.webkit.org/show_bug.cgi?id=195843
2065
2066         Reviewed by Geoffrey Garen.
2067
2068         * Shared/WebPreferences.yaml:
2069
2070 2019-03-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2071
2072         [iOS] Software keyboard never appears when editing on some websites
2073         https://bugs.webkit.org/show_bug.cgi?id=195824
2074         <rdar://problem/48020610>
2075
2076         Reviewed by Ryosuke Niwa.
2077
2078         In the scenario where an element has already been programmatically focused but the UI process isn't showing an
2079         input view for it, there are a couple of different ways in which an input view may still be shown for that
2080         element:
2081
2082         1. If the page attempts to programmatically focus the element, we'll invoke elementDidRefocus to recompute
2083         information about the focused element and propagate it to the UI process. By default, if programmatic focus was
2084         triggered under the scope of user interaction, we'll allow the input view to appear.
2085
2086         2. In the case where page does not attempt to programmatically focus the element but a click is dispatched,
2087         there is logic in WebPage::completeSyntheticClick to send information about the already-focused element.
2088
2089         On the web page relevant to this bug, focus is programmatically moved to hidden contenteditable areas upon page
2090         load, and touchstart is also prevented; furthermore, the page does not attempt to programmatically refocus the
2091         hidden editable area upon receiving touchstart. This means that the user will never be able to bring up the
2092         keyboard, since the editable area is already programmatically focused and subsequent attempts to tap in the
2093         page do nothing, because the page has already focused the hidden editable area (with the expectation that the
2094         software keyboard should already be present).
2095
2096         To fix this, we bring some of the same logic in completeSyntheticClick over to dispatchTouchEvent, by sending
2097         focused element information to the UI process if the focused element did not change over the course of
2098         dispatching the touch event. Similar code was introduced in r167774 to fix the same type of issue (i.e.
2099         inability to bring up the software keyboard), but this was later reverted in r188405 due to causing bugs such as
2100         <rdar://problem/22204108>, wherein this logic to bring up the keyboard in dispatchTouchEvent would scroll and
2101         zoom the page, such that the click event fired after touchend would be dispatched in the wrong location and (in
2102         the case of <rdar://problem/22204108>) caused the focused element to immediately blur again.
2103
2104         To mitigate this issue, we add the additional constraint that we only send focused element info in the case
2105         where the touch won't also generate a click later down the road, by requiring that the dispatched event was
2106         handled by the page (i.e. prevented).
2107
2108         Test: fast/events/touch/ios/show-keyboard-after-preventing-touchstart.html
2109
2110         * WebProcess/WebPage/WebPage.cpp:
2111         (WebKit::WebPage::dispatchTouchEvent):
2112
2113 2019-03-16  Zalan Bujtas  <zalan@apple.com>
2114
2115         Unable to close trending window on naver.com.
2116         https://bugs.webkit.org/show_bug.cgi?id=195842
2117         <rdar://problem/48067338>
2118
2119         Reviewed by Simon Fraser.
2120
2121         * WebProcess/WebPage/ios/WebPageIOS.mm:
2122         (WebKit::dispatchSyntheticMouseMove):
2123         (WebKit::WebPage::handleSyntheticClick):
2124         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
2125
2126 2019-03-16  Timothy Hatcher  <timothy@apple.com>
2127
2128         REGRESSION (r242807): Unified sources build failure from missing imports.
2129         https://bugs.webkit.org/show_bug.cgi?id=195852
2130
2131         Unreviewed speculative build fix.
2132
2133         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2134         Include <wtf/SoftLinking.h> and "UIKitSPI.h" on iOS.
2135
2136 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
2137
2138         [iOS] Block the accessibility server when accessibility is not enabled.
2139         https://bugs.webkit.org/show_bug.cgi?id=195342
2140
2141         Reviewed by Brent Fulgham.
2142
2143         By default, block the iOS accessibility server in the sandbox. If accessibility is enabled,
2144         let the UI process issue a mach extension to the WebContent process. The UI process will
2145         issue the mach extension the the WebContent process by its process identifier. The sandbox
2146         extension handle is sent to the WebContent process to be consumed. The message will be sent
2147         when the WebProcess has finished launching, and also when accessibility is turned on.
2148
2149         * Platform/spi/ios/AccessibilitySupportSPI.h:
2150         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2151         * Shared/SandboxExtension.h:
2152         * Shared/mac/SandboxExtensionMac.mm:
2153         (WebKit::SandboxExtensionImpl::create):
2154         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
2155         (WebKit::SandboxExtensionImpl::SandboxExtensionImpl):
2156         (WebKit::SandboxExtension::createHandleForMachLookupByPid):
2157         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2158         (WebKit::WebProcessPool::registerNotificationObservers):
2159         (WebKit::WebProcessPool::unregisterNotificationObservers):
2160         * UIProcess/WebProcessPool.h:
2161         * UIProcess/WebProcessProxy.cpp:
2162         (WebKit::WebProcessProxy::didFinishLaunching):
2163         * UIProcess/WebProcessProxy.h:
2164         * UIProcess/ios/WebProcessProxyIOS.mm:
2165         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
2166         * WebProcess/WebProcess.cpp:
2167         (WebKit::WebProcess::unblockAccessibilityServer):
2168         * WebProcess/WebProcess.h:
2169         * WebProcess/WebProcess.messages.in:
2170
2171 2019-03-15  Timothy Hatcher  <timothy@apple.com>
2172
2173         Unreviewed speculative build fix for non-Cocoa ports after r243012.
2174
2175         * UIProcess/WebPageProxy.cpp:
2176         (WebKit::WebPageProxy::getContentsAsAttributedString):
2177         * UIProcess/WebPageProxy.h:
2178
2179 2019-03-15  Truitt Savell  <tsavell@apple.com>
2180
2181         Unreviewed, rolling out r243008.
2182
2183         This revision broke High Sierra builders
2184
2185         Reverted changeset:
2186
2187         "[iOS] Block the accessibility server when accessibility is
2188         not enabled."
2189         https://bugs.webkit.org/show_bug.cgi?id=195342
2190         https://trac.webkit.org/changeset/243008
2191
2192 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
2193
2194         All networking from WebKit.Networking fails when Network Extension content filter is enabled
2195         https://bugs.webkit.org/show_bug.cgi?id=195815
2196         <rdar://problem/47598758>
2197
2198         Reviewed by Brent Fulgham.
2199
2200         The sandbox needs to allow an associated mach lookup.
2201
2202         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2203         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2204
2205 2019-03-15  Sihui Liu  <sihui_liu@apple.com>
2206
2207         [ Mojave WK1 ] Layout Test storage/indexeddb/database-odd-names.html is failing
2208         https://bugs.webkit.org/show_bug.cgi?id=190350
2209         <rdar://problem/45089503>
2210
2211         Reviewed by Geoffrey Garen.
2212
2213         * NetworkProcess/NetworkProcess.cpp:
2214         (WebKit::NetworkProcess::collectIndexedDatabaseOriginsForVersion):
2215         (WebKit::NetworkProcess::indexedDatabaseOrigins):
2216         * NetworkProcess/NetworkProcess.h:
2217         * UIProcess/Network/NetworkProcessProxy.cpp:
2218         (WebKit::NetworkProcessProxy::addSession):
2219         (WebKit::NetworkProcessProxy::createSymLinkForFileUpgrade): For efficientcy and atomicity, we choose to use
2220         symlink to create v0 folder. Because network process does not have the permission to create a symlink, we need 
2221         to do this in UI process. UI process would create v0 folder inside the IndexedDB directory if there isn't one.
2222         Also if there is a v0 directory but it doesn't have content, it means it's not a correct symlink and we need to 
2223         delete it and create again.
2224
2225         * UIProcess/Network/NetworkProcessProxy.h:
2226         * UIProcess/WebProcessPool.cpp:
2227         (WebKit::WebProcessPool::ensureNetworkProcess):
2228
2229 2019-03-15  Sihui Liu  <sihui_liu@apple.com>
2230
2231         [ Mojave WK1 ] Layout Test storage/indexeddb/database-odd-names.html is failing
2232         https://bugs.webkit.org/show_bug.cgi?id=190350
2233         <rdar://problem/45089503>
2234
2235         Reviewed by Geoffrey Garen.
2236
2237         * NetworkProcess/NetworkProcess.cpp:
2238         (WebKit::NetworkProcess::collectIndexedDatabaseOriginsForVersion):
2239         (WebKit::NetworkProcess::indexedDatabaseOrigins):
2240         * NetworkProcess/NetworkProcess.h:
2241         * UIProcess/Network/NetworkProcessProxy.cpp:
2242         (WebKit::NetworkProcessProxy::addSession):
2243         (WebKit::NetworkProcessProxy::createSymLinkForFileUpgrade):
2244         * UIProcess/Network/NetworkProcessProxy.h:
2245         * UIProcess/WebProcessPool.cpp:
2246         (WebKit::WebProcessPool::ensureNetworkProcess):
2247
2248 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
2249
2250         [iOS] Restrict iokit-user-client-class "IOHIDLibUserClient" from WebKit
2251         https://bugs.webkit.org/show_bug.cgi?id=195821
2252         <rdar://problem/47606250>
2253
2254         Reviewed by Brent Fulgham.
2255
2256         This should be removed from the WebContent sandbox on iOS.
2257
2258         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2259
2260 2019-03-15  Alex Christensen  <achristensen@webkit.org>
2261
2262         _WKDownload should conform to NSCopying protocol
2263         https://bugs.webkit.org/show_bug.cgi?id=195718
2264
2265         Reviewed by Tim Horton.
2266
2267         This will allow us to use it as keys in NSMutableDictionaries, which Safari already kind of does.
2268
2269         * UIProcess/API/Cocoa/_WKDownload.h:
2270         * UIProcess/API/Cocoa/_WKDownload.mm:
2271         (-[_WKDownload copyWithZone:]):
2272
2273 2019-03-15  Dean Jackson  <dino@apple.com>
2274
2275         Provide an option for an always-on fast click mode in iOS
2276         https://bugs.webkit.org/show_bug.cgi?id=195822
2277         <rdar://problem/48939357>
2278
2279         Reviewed by Sam Weinig.
2280
2281         Add an option that will always trigger a click and never
2282         wait for a double tap to zoom. It is disabled by default.
2283
2284         * Shared/WebPreferences.yaml:
2285         * UIProcess/ios/WKContentViewInteraction.mm:
2286         (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:]):
2287
2288 2019-03-15  Timothy Hatcher  <timothy@apple.com>
2289
2290         Add support to WebPage for getting the contents as an attributed string.
2291         https://bugs.webkit.org/show_bug.cgi?id=195636
2292         rdar://problem/45055697
2293
2294         Reviewed by Tim Horton.
2295
2296         * Shared/mac/AttributedString.h:
2297         (WebKit::AttributedString::AttributedString):
2298         * Shared/mac/AttributedString.mm:
2299         (IPC::ArgumentCoder<WebKit::AttributedString>::encode):
2300         (IPC::ArgumentCoder<WebKit::AttributedString>::decode):
2301         * UIProcess/API/Cocoa/WKWebView.mm:
2302         (-[WKWebView _getContentsAsAttributedStringWithCompletionHandler:]):
2303         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2304         * UIProcess/WebPageProxy.cpp:
2305         (WebKit::WebPageProxy::getContentsAsAttributedString):
2306         * UIProcess/WebPageProxy.h:
2307         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
2308         (WebKit::WebPage::getContentsAsAttributedString):
2309         * WebProcess/WebPage/WebPage.h:
2310         * WebProcess/WebPage/WebPage.messages.in:
2311
2312 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
2313
2314         [iOS] Fix sandbox violation
2315         https://bugs.webkit.org/show_bug.cgi?id=195387
2316         <rdar://problem/48442387>
2317
2318         Reviewed by Brent Fulgham.
2319
2320         The sandbox on iOS and macOS needs to allow mach lookup to the "com.apple.nesessionmanager.content-filter"
2321         mach service. Also, mach lookups to "com.apple.nehelper" should be allowed.
2322
2323         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2324         * WebProcess/com.apple.WebProcess.sb.in:
2325
2326 2019-03-15  Chris Dumez  <cdumez@apple.com>
2327
2328         [PSON] Make sure the WebProcessCache is leverage when relaunching a process after termination
2329         https://bugs.webkit.org/show_bug.cgi?id=195747
2330
2331         Reviewed by Geoff Garen.
2332
2333         Make sure the WebProcessCache and the prewarmed process are used when relaunching a process
2334         after termination (e.g. crash).
2335
2336         * UIProcess/WebPageProxy.cpp:
2337         (WebKit::WebPageProxy::reattachToWebProcess):
2338         (WebKit::WebPageProxy::reattachToWebProcessForReload):
2339         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
2340         (WebKit::WebPageProxy::loadRequest):
2341         (WebKit::WebPageProxy::loadFile):
2342         (WebKit::WebPageProxy::loadData):
2343         (WebKit::WebPageProxy::loadAlternateHTML):
2344         (WebKit::WebPageProxy::loadWebArchiveData):
2345         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
2346         * UIProcess/WebPageProxy.h:
2347         * UIProcess/WebProcessPool.cpp:
2348         (WebKit::WebProcessPool::processForRegistrableDomain):
2349         (WebKit::WebProcessPool::createWebPage):
2350         (WebKit::WebProcessPool::processForNavigationInternal):
2351         (WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
2352         * UIProcess/WebProcessPool.h:
2353
2354 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
2355
2356         [iOS] Block the accessibility server when accessibility is not enabled.
2357         https://bugs.webkit.org/show_bug.cgi?id=195342
2358
2359         Reviewed by Brent Fulgham.
2360
2361         By default, block the iOS accessibility server in the sandbox. If accessibility is enabled,
2362         let the UI process issue a mach extension to the WebContent process. The UI process will
2363         issue the mach extension the the WebContent process by its process identifier. The sandbox
2364         extension handle is sent to the WebContent process to be consumed. The message will be sent
2365         when the WebProcess has finished launching, and also when accessibility is turned on.
2366
2367         * Platform/spi/ios/AccessibilitySupportSPI.h:
2368         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2369         * Shared/SandboxExtension.h:
2370         * Shared/mac/SandboxExtensionMac.mm:
2371         (WebKit::SandboxExtensionImpl::create):
2372         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
2373         (WebKit::SandboxExtensionImpl::SandboxExtensionImpl):
2374         (WebKit::SandboxExtension::createHandleForMachLookupByPid):
2375         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2376         (WebKit::WebProcessPool::registerNotificationObservers):
2377         (WebKit::WebProcessPool::unregisterNotificationObservers):
2378         * UIProcess/WebProcessPool.h:
2379         * UIProcess/WebProcessProxy.cpp:
2380         (WebKit::WebProcessProxy::didFinishLaunching):
2381         * UIProcess/WebProcessProxy.h:
2382         * UIProcess/ios/WebProcessProxyIOS.mm:
2383         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
2384         * WebProcess/WebProcess.cpp:
2385         (WebKit::WebProcess::unblockAccessibilityServer):
2386         * WebProcess/WebProcess.h:
2387         * WebProcess/WebProcess.messages.in:
2388
2389 2019-03-15  Antti Koivisto  <antti@apple.com>
2390
2391         Use Region for event region even when it is a rectangle
2392         https://bugs.webkit.org/show_bug.cgi?id=195803
2393
2394         Reviewed by Simon Fraser.
2395
2396         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
2397         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
2398         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
2399         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2400         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
2401         (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const):
2402         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
2403         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
2404         (WebKit::RemoteLayerTreeNode::eventRegion const):
2405         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
2406         (WebKit::RemoteLayerTreeNode::setEventRegion):
2407         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
2408         (WebKit::collectDescendantViewsAtPoint):
2409         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
2410         (WebKit::PlatformCALayerRemote::setEventRegion):
2411         (WebKit::PlatformCALayerRemote::eventRegion const): Deleted.
2412         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
2413
2414 2019-03-15  Shawn Roberts  <sroberts@apple.com>
2415
2416         Unreviewed, rolling out r242952.
2417
2418         Causing API failures on iOS Simulator
2419
2420         Reverted changeset:
2421
2422         "[PSON] Make sure the WebProcessCache is leverage when
2423         relaunching a process after termination"
2424         https://bugs.webkit.org/show_bug.cgi?id=195747
2425         https://trac.webkit.org/changeset/242952
2426
2427 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
2428
2429         [macOS] Broker access to Speech Synthesis
2430         https://bugs.webkit.org/show_bug.cgi?id=195645
2431         <rdar://problem/35369026>
2432
2433         Reviewed by Brent Fulgham.
2434
2435         To be able to close the connection to the speech synthesis daemon in the WebContent process,
2436         speech synthesis should be performed in the UI process. This patch forwards speech synthesis
2437         requests to the UI process by sending messages. On the UI process side, the speech synthesis
2438         is performed by simply using the existing platform speech synthesizer. Speech synthesis
2439         events are sent back to the WebContent process. All messages are async, except for the
2440         message to get the list of available voices.
2441
2442         * Sources.txt:
2443         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2444         (WebKit::WebPageProxy::didStartSpeaking):
2445         (WebKit::WebPageProxy::didFinishSpeaking):
2446         (WebKit::WebPageProxy::didPauseSpeaking):
2447         (WebKit::WebPageProxy::didResumeSpeaking):
2448         (WebKit::WebPageProxy::speakingErrorOccurred):
2449         (WebKit::WebPageProxy::boundaryEventOccurred):
2450         (WebKit::WebPageProxy::voicesDidChange):
2451         * UIProcess/WebPageProxy.cpp:
2452         (WebKit::WebPageProxy::ensureSpeechSynthesisData):
2453         (WebKit::WebPageProxy::speechSynthesisVoiceList):
2454         (WebKit::WebPageProxy::speechSynthesisSpeak):
2455         (WebKit::WebPageProxy::speechSynthesisCancel):
2456         (WebKit::WebPageProxy::speechSynthesisPause):
2457         (WebKit::WebPageProxy::speechSynthesisResume):
2458         * UIProcess/WebPageProxy.h:
2459         * UIProcess/WebPageProxy.messages.in:
2460         * WebKit.xcodeproj/project.pbxproj:
2461         * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp: Added.
2462         (WebKit::WebSpeechSynthesisClient::voiceList):
2463         (WebKit::WebSpeechSynthesisClient::speak):
2464         (WebKit::WebSpeechSynthesisClient::cancel):
2465         (WebKit::WebSpeechSynthesisClient::pause):
2466         (WebKit::WebSpeechSynthesisClient::resume):
2467         * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.h: Added.
2468         (WebKit::WebSpeechSynthesisClient::WebSpeechSynthesisClient):
2469         (WebKit::WebSpeechSynthesisClient::~WebSpeechSynthesisClient):
2470         * WebProcess/WebCoreSupport/WebSpeechSynthesisVoice.h: Added.
2471         (WebKit::WebSpeechSynthesisVoice::encode const):
2472         (WebKit::WebSpeechSynthesisVoice::decode):
2473         * WebProcess/WebPage/WebPage.cpp:
2474         (WebKit::m_hostFileDescriptor):
2475         (WebKit::WebPage::speakingErrorOccurred):
2476         (WebKit::WebPage::boundaryEventOccurred):
2477         (WebKit::WebPage::voicesDidChange):
2478         * WebProcess/WebPage/WebPage.h:
2479         * WebProcess/WebPage/WebPage.messages.in:
2480         * WebProcess/com.apple.WebProcess.sb.in:
2481         * WebProcess/glib/WebProcessGLib.cpp:
2482
2483 2019-03-15  Antti Koivisto  <antti@apple.com>
2484
2485         Optimize Region for single rectangle case
2486         https://bugs.webkit.org/show_bug.cgi?id=195743
2487
2488         Reviewed by Simon Fraser.
2489
2490         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2491         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
2492         * Shared/WebCoreArgumentCoders.cpp:
2493         (IPC::ArgumentCoder<EventTrackingRegions>::decode):
2494         (IPC::ArgumentCoder<Region::Span>::encode): Deleted.
2495         (IPC::ArgumentCoder<Region::Span>::decode): Deleted.
2496         (IPC::ArgumentCoder<Region>::encode): Deleted.
2497         (IPC::ArgumentCoder<Region>::decode): Deleted.
2498         * Shared/WebCoreArgumentCoders.h:
2499
2500 2019-03-14  Per Arne Vollan  <pvollan@apple.com>
2501
2502         [iOS] WebKit crashes when opening pages documents
2503         https://bugs.webkit.org/show_bug.cgi?id=195784
2504         <rdar://problem/48904334>
2505
2506         Reviewed by Brent Fulgham.
2507
2508         The sandbox needs to allow additional syscalls.
2509
2510         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2511
2512 2019-03-14  Simon Fraser  <simon.fraser@apple.com>
2513
2514         Make it possible to test scrolling tree layer manipulation more easily
2515         https://bugs.webkit.org/show_bug.cgi?id=195780
2516
2517         Reviewed by Tim Horton.
2518
2519         Add a boolean attribute 'scrollUpdatesDisabled' on UIScriptController that
2520         cuts off communication of scrolling tree scrolls back to the web process
2521         (in RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll()). This
2522         allows tests to trigger scrolls which run the scrolling tree layer positioning
2523         logic, but never get another commit from the web process that might mask
2524         scrolling tree bugs.
2525         
2526         WKWebView's testing protocol get @property _scrollingUpdatesDisabledForTesting,
2527         whose getters and setters are overridden by TestRunnerWKWebView. Plumbing
2528         via PageClient and WebPageProxy makes this flag reachable by RemoteScrollingCoordinatorProxy.
2529
2530         * UIProcess/API/Cocoa/WKWebView.mm:
2531         (-[WKWebView _scrollingUpdatesDisabledForTesting]):
2532         (-[WKWebView _setScrollingUpdatesDisabledForTesting:]):
2533         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2534         * UIProcess/Cocoa/PageClientImplCocoa.h:
2535         * UIProcess/Cocoa/PageClientImplCocoa.mm:
2536         (WebKit::PageClientImplCocoa::scrollingUpdatesDisabledForTesting):
2537         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2538         (WebKit::WebPageProxy::scrollingUpdatesDisabledForTesting):
2539         * UIProcess/PageClient.h:
2540         (WebKit::PageClient::scrollingUpdatesDisabledForTesting):
2541         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2542         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
2543         * UIProcess/WebPageProxy.h:
2544
2545 2019-03-14  Youenn Fablet  <youenn@apple.com>
2546
2547         Move IDB storage in private browsing mode to NetworkProcess
2548         https://bugs.webkit.org/show_bug.cgi?id=195602
2549
2550         Reviewed by Brady Eidson.
2551
2552         Covered by existing IDB tests and added API test.
2553
2554         * NetworkProcess/NetworkProcess.cpp:
2555         (WebKit::NetworkProcess::createIDBServer):
2556         Make sure that path is empty for private sessions.
2557         This will make IDB use a memory backing store.
2558         * WebProcess/Databases/WebDatabaseProvider.cpp:
2559         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
2560         Use NetworkProcess IDB server instead of InProcessIDBServer.
2561
2562 2019-03-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2563
2564         REGRESSION (r242801): [iOS] preventDefault() on touchstart in a subframe does not prevent focusing the subframe
2565         https://bugs.webkit.org/show_bug.cgi?id=195749
2566         <rdar://problem/48892367>
2567
2568         Reviewed by Tim Horton.
2569
2570         r242801 added logic to fetch interaction information at the touch location upon touch start. However this,
2571         combined with an existing behavior where the process of computing InteractionInformationAtPosition in WebPage
2572         moves focus into the frame of the hit-tested node below the touch location, means that we'll always trigger a
2573         blur event on the window and move focus into the subframe when performing a touch inside a subframe, even if the
2574         page prevents default on touchstart.
2575
2576         To fix this, add a "readonly" flag to InteractionInformationRequest, and only change focus when requesting
2577         position information in the case where the request is not readonly. For now, this readonly flag is false by
2578         default; in a future patch, we should identify the (hopefully few) places that rely on position information
2579         requests to move focus, explicitly turn this bit off in those places, and otherwise send readonly position
2580         information requests by default.
2581
2582         * Shared/ios/InteractionInformationRequest.cpp:
2583         (WebKit::InteractionInformationRequest::encode const):
2584         (WebKit::InteractionInformationRequest::decode):
2585         (WebKit::InteractionInformationRequest::isValidForRequest):
2586         (WebKit::InteractionInformationRequest::isApproximatelyValidForRequest):
2587
2588         Ensure that a readonly request is not valid for a non-readonly request.
2589
2590         * Shared/ios/InteractionInformationRequest.h:
2591         * UIProcess/API/Cocoa/WKWebView.mm:
2592         (-[WKWebView _requestActivatedElementAtPosition:completionBlock:]):
2593
2594         Send a readonly position information request in the case where a WebKit SPI client is querying for element
2595         information at the given location.
2596
2597         * UIProcess/ios/WKContentViewInteraction.mm:
2598         (-[WKContentView _webTouchEventsRecognized:]):
2599
2600         Send a readonly position information request on touchstart.
2601
2602         * WebProcess/WebPage/ios/WebPageIOS.mm:
2603         (WebKit::WebPage::positionInformation):
2604
2605 2019-03-14  Chris Dumez  <cdumez@apple.com>
2606
2607         Add WebsitePolicy for the client to specify the device orientation & motion access policy
2608         https://bugs.webkit.org/show_bug.cgi?id=195750
2609
2610         Reviewed by Geoffrey Garen.
2611
2612         Add WebsitePolicy for the client to specify the device orientation & motion access policy. If
2613         the client already knows access to the device motion & orientation API will be granted / denied,
2614         it can let WebKit know via WebsitePolicies so that WebKit will not ask the client when the
2615         permission is requested by JS.
2616
2617         * Shared/WebsitePoliciesData.cpp:
2618         (WebKit::WebsitePoliciesData::encode const):
2619         (WebKit::WebsitePoliciesData::decode):
2620         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2621         * Shared/WebsitePoliciesData.h:
2622         * UIProcess/API/APIWebsitePolicies.cpp:
2623         (API::WebsitePolicies::data):
2624         * UIProcess/API/APIWebsitePolicies.h:
2625         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2626         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2627         (-[_WKWebsitePolicies setDeviceOrientationAndMotionAccessPolicy:]):
2628         (-[_WKWebsitePolicies deviceOrientationAndMotionAccessPolicy]):
2629
2630 2019-03-14  Timothy Hatcher  <timothy@apple.com>
2631
2632         REGRESSION (r242908): TestWebKitAPI.WebKit.AddAndRemoveDataDetectors Crashed
2633         https://bugs.webkit.org/show_bug.cgi?id=195751
2634
2635         Reviewed by Wenson Hsieh.
2636
2637         * Shared/Cocoa/ArgumentCodersCocoa.mm:
2638         (IPC::decodeArrayInternal): Added allowedClasses, pass to internal decodeObject for values.
2639         (IPC::decodeDictionaryInternal): Ditto for keys and values.
2640         (IPC::decodeObject): Pass allowedClasses to array and dictionary decoders.
2641
2642 2019-03-14  Chris Dumez  <cdumez@apple.com>
2643
2644         [PSON] Make sure the WebProcessCache is leverage when relaunching a process after termination
2645         https://bugs.webkit.org/show_bug.cgi?id=195747
2646
2647         Reviewed by Geoff Garen.
2648
2649         Make sure the WebProcessCache and the prewarmed process are used when relaunching a process
2650         after termination (e.g. crash).
2651
2652         * UIProcess/WebPageProxy.cpp:
2653         (WebKit::WebPageProxy::reattachToWebProcess):
2654         (WebKit::WebPageProxy::reattachToWebProcessForReload):
2655         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
2656         (WebKit::WebPageProxy::loadRequest):
2657         (WebKit::WebPageProxy::loadFile):
2658         (WebKit::WebPageProxy::loadData):
2659         (WebKit::WebPageProxy::loadAlternateHTML):
2660         (WebKit::WebPageProxy::loadWebArchiveData):
2661         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
2662         * UIProcess/WebPageProxy.h:
2663         * UIProcess/WebProcessPool.cpp:
2664         (WebKit::WebProcessPool::processForRegistrableDomain):
2665         (WebKit::WebProcessPool::createWebPage):
2666         (WebKit::WebProcessPool::processForNavigationInternal):
2667         (WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
2668         * UIProcess/WebProcessPool.h:
2669
2670 2019-03-14  Timothy Hatcher  <timothy@apple.com>
2671
2672         Unreviewed speculative build fix for watchOS after r242908.
2673
2674         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
2675
2676 2019-03-14  Youenn Fablet  <youenn@apple.com>
2677
2678         Reset storage quota when clearing IDB/Cache API entries
2679         https://bugs.webkit.org/show_bug.cgi?id=195716
2680
2681         Reviewed by Chris Dumez.
2682
2683         On clearing DOMCache or IDB data, reset quota value to the default value.
2684         This ensures consistent layout test runs.
2685
2686         * NetworkProcess/NetworkProcess.cpp:
2687         (WebKit::NetworkProcess::deleteWebsiteData):
2688         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2689         (WebKit::NetworkProcess::clearStorageQuota):
2690         * NetworkProcess/NetworkProcess.h:
2691
2692 2019-03-13  Zalan Bujtas  <zalan@apple.com>
2693
2694         [ContentChangeObserver] Stop content observation when content calls preventDefault() on touch events
2695         https://bugs.webkit.org/show_bug.cgi?id=195724
2696         <rdar://problem/48873456>
2697
2698         Reviewed by Simon Fraser.
2699
2700         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
2701         (WebKit::WebChromeClient::didPreventDefaultForEvent):
2702
2703 2019-03-13  Wenson Hsieh  <wenson_hsieh@apple.com>
2704
2705         Make -[_WKAttachment setFileWrapper:contentType:completion:] robust when given a nil completion handler
2706         https://bugs.webkit.org/show_bug.cgi?id=195725
2707         <rdar://problem/48545062>
2708
2709         Reviewed by Tim Horton.
2710
2711         Add a missing nil check before invoking the given completionHandler in the case where the attachment is invalid.
2712         Tested by augmenting WKAttachmentTests.SetFileWrapperForPDFImageAttachment to exercise this scenario.
2713
2714         * UIProcess/API/APIAttachment.cpp:
2715         (API::Attachment::invalidate):
2716
2717         Additionally make sure that an invalidated _WKAttachment is also considered to be disconnected.
2718
2719         * UIProcess/API/Cocoa/_WKAttachment.mm:
2720         (-[_WKAttachment setFileWrapper:contentType:completion:]):
2721
2722 2019-03-13  Timothy Hatcher  <timothy@apple.com>
2723
2724         REGRESSION (r242908):  'NSInvalidArgumentException', reason: '+[PKPaymentMerchantSession count]: unrecognized selector sent to class 0x1c0fae060'
2725         https://bugs.webkit.org/show_bug.cgi?id=195720
2726
2727         Reviewed by Andy Estes.
2728
2729         Add back decode(Decoder& decoder, Class allowedClass) for Apple Pay code.
2730
2731         * Shared/Cocoa/ArgumentCodersCocoa.h:
2732         (IPC::decode): Added.
2733
2734 2019-03-13  Tim Horton  <timothy_horton@apple.com>
2735
2736         Stop using some deprecated SPI in WKDrawingView
2737         https://bugs.webkit.org/show_bug.cgi?id=195706
2738         <rdar://problem/48062599>
2739
2740         Reviewed by Wenson Hsieh.
2741
2742         * UIProcess/ios/WKDrawingView.mm:
2743         (-[WKDrawingView renderedDrawing]):
2744         (-[WKDrawingView PNGRepresentation]):
2745         (-[WKDrawingView loadDrawingFromPNGRepresentation:]):
2746
2747 2019-03-13  Timothy Hatcher  <timothy@apple.com>
2748
2749         Unreviewed speculative build fix for watchOS after r242908.
2750
2751         * Shared/Cocoa/ArgumentCodersCocoa.mm:
2752         (IPC::decodeObject):
2753
2754 2019-03-13  Dean Jackson  <dino@apple.com>
2755
2756         Block all plugins smaller than 5x5px
2757         https://bugs.webkit.org/show_bug.cgi?id=195702
2758         <rdar://problem/28435204>
2759
2760         Reviewed by Sam Weinig.
2761
2762         Block all plugins that are smaller than a threshold, in this case
2763         5x5px. Other browsers have implemented this for a while, and now
2764         that we have Intersection Observers, small plugins are no longer
2765         necessary.
2766
2767         * Shared/WebPreferences.yaml: New setting for this feature.
2768
2769         * UIProcess/WebPageProxy.cpp: Handle new unavailability type.
2770         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
2771         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2772         (WebKit::WebChromeClient::shouldUnavailablePluginMessageBeButton const):
2773
2774         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: Removed this function
2775         as it was never being called.
2776         (WebKit::WebFrameLoaderClient::recreatePlugin): Deleted.
2777         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2778
2779         * WebProcess/WebPage/WebPage.cpp:
2780         (WebKit::pluginIsSmall): Checks the size of the plugin.
2781         (WebKit::WebPage::createPlugin): If the plugin is too small, stop it from
2782         launching.
2783
2784 2019-03-13  Keith Rollin  <krollin@apple.com>
2785
2786         Add support for new StagedFrameworks layout
2787         https://bugs.webkit.org/show_bug.cgi?id=195543
2788
2789         Reviewed by Alexey Proskuryakov.
2790
2791         When creating the WebKit layout for out-of-band Safari/WebKit updates,
2792         use an optional path prefix when called for.
2793
2794         Update the dyld_env path in OTHER_LDFLAGS_VERSIONED_FRAMEWORK_PATH to
2795         also understand about this layout.
2796
2797         * Configurations/BaseTarget.xcconfig:
2798
2799 2019-03-13  Simon Fraser  <simon.fraser@apple.com>
2800
2801         Scrolling tree should reposition non-stacking order descendents of overflow:scroll.
2802         https://bugs.webkit.org/show_bug.cgi?id=195608
2803
2804         Reviewed by Zalan Bujtas.
2805
2806         Step 1: add scrolling tree positioning nodes classes (but don't create them yet).
2807
2808         Add Scrolling{State,Tree}PositionedNode to track composited layers that have to be repositioned when
2809         an async overflow:scroll scrolls. There are two instances in which this is necessary, reflected by
2810         the values of ScrollPositioningBehavior:
2811
2812         ScrollPositioningBehavior::Moves - a composited layer whose containing block chain includes an
2813             async overflow scroller, but whose composited (i.e. z-order) parent is outside of the overflow.
2814             When the overflow scrolls, this layer has to move along with the overflow.
2815
2816         ScrollPositioningBehavior::Stationary - a composited layer whose containing block chain skips the
2817             overflow scroller, but whose compositing (z-order) parent is the scroller, or inside the scroller.
2818             This only applies to position:absolute, on, for example, an overflow:scroll ith opacity.
2819
2820         PositionedNodes are modeled after Fixed/Sticky nodes, with a new type of layout constraint just called LayoutConstraints.
2821         
2822         This patch adds support for PositionedNodes in the scrolling trees, but RenderLayerCompositor::computeCoordinatedPositioningForLayer()
2823         is just a stub so the new node types aren't created yet.
2824         
2825         RenderLayerBacking stores a ScrollingNodeID for the positioning role (just like the other roles). Since the Positioning
2826         role is about position relative to ancestors, a node with both Positioning and FrameHosting or Scrolling roles treats
2827         the Positioning node as the parent of the other types. A node should never have both Positioning and ViewportConstrained roles.
2828
2829         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2830         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
2831         (ArgumentCoder<ScrollingStatePositionedNode>::encode):
2832         (ArgumentCoder<ScrollingStatePositionedNode>::decode):
2833         (WebKit::encodeNodeAndDescendants):
2834         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
2835         (WebKit::dump):
2836         * Shared/WebCoreArgumentCoders.cpp:
2837         (IPC::ArgumentCoder<LayoutConstraints>::encode):
2838         (IPC::ArgumentCoder<LayoutConstraints>::decode):
2839         (IPC::ArgumentCoder<StickyPositionViewportConstraints>::decode):
2840         * Shared/WebCoreArgumentCoders.h:
2841         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2842         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2843         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
2844         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
2845         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2846         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2847
2848 2019-03-13  Youenn Fablet  <youenn@apple.com>
2849
2850         Check IDB quota usage through QuotaManager
2851         https://bugs.webkit.org/show_bug.cgi?id=195302
2852
2853         Reviewed by Chris Dumez.
2854
2855         Set the quota manager getter for IDBServer at creation time.
2856
2857         * NetworkProcess/NetworkProcess.cpp:
2858         (WebKit::NetworkProcess::createIDBServer):
2859         (WebKit::NetworkProcess::idbServer):
2860         * NetworkProcess/NetworkProcess.h:
2861         * WebProcess/Databases/WebDatabaseProvider.cpp:
2862         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
2863
2864 2019-03-13  Timothy Hatcher  <timothy@apple.com>
2865
2866         Consolidate ArgumentCodersMac and ArgumentCodersCocoa.
2867         https://bugs.webkit.org/show_bug.cgi?id=195636
2868         rdar://problem/45055697
2869
2870         Reviewed by Ryosuke Niwa.
2871
2872         Merge the two similar encoders and decoders. This avoids issues where
2873         one encoder could be used and the other decoder, which caused a crash.
2874         It also stops handling NSAttributedString specifically and just uses
2875         the NSSecureCoding path to handle more complex attributes.
2876
2877         Some WebCore encoders code needed to move to platform files, since
2878         ArgumentCodersCocoa.h requires an ObjectiveC++ implementation to work.
2879
2880         * Shared/Cocoa/ArgumentCodersCocoa.h:
2881         (IPC::encode):
2882         (IPC::decode):
2883         (IPC::ArgumentCoder<RetainPtr<T>>::encode):
2884         (IPC::ArgumentCoder<RetainPtr<T>>::decode):
2885         * Shared/Cocoa/ArgumentCodersCocoa.mm:
2886         (IPC::typeFromObject):
2887         (IPC::isSerializableFont):
2888         (IPC::isSerializableValue):
2889         (IPC::encodeObject):
2890         (IPC::decodeObject):
2891         * Shared/Cocoa/LoadParametersCocoa.mm:
2892         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
2893         (IPC::ArgumentCoder<WebCore::DictionaryPopupInfo>::encodePlatformData):
2894         (IPC::ArgumentCoder<WebCore::DictionaryPopupInfo>::decodePlatformData):
2895         (IPC::ArgumentCoder<WebCore::FontAttributes>::encodePlatformData):
2896         (IPC::ArgumentCoder<WebCore::FontAttributes>::decodePlatformData):
2897         * Shared/WebCoreArgumentCoders.cpp:
2898         (IPC::ArgumentCoder<DictionaryPopupInfo>::encode):
2899         (IPC::ArgumentCoder<DictionaryPopupInfo>::decode):
2900         (IPC::ArgumentCoder<FontAttributes>::encode):
2901         (IPC::ArgumentCoder<FontAttributes>::decode):
2902         * Shared/WebCoreArgumentCoders.h:
2903         * Shared/mac/ArgumentCodersMac.h: Removed.
2904         * Shared/mac/ArgumentCodersMac.mm: Removed.
2905         * Shared/mac/AttributedString.mm:
2906         (WebKit::AttributedString::encode const):
2907         * Shared/mac/ObjCObjectGraph.mm:
2908         * SourcesCocoa.txt:
2909         * WebKit.xcodeproj/project.pbxproj:
2910
2911 2019-03-13  Chris Dumez  <cdumez@apple.com>
2912
2913         Use a ServiceWorker process per registrable domain
2914         https://bugs.webkit.org/show_bug.cgi?id=195649
2915
2916         Reviewed by Youenn Fablet.
2917
2918         Use a ServiceWorker process per registrable domain instead of one per security origin. This is
2919         more in line with PSON and avoids launching too many processes.
2920
2921         * NetworkProcess/NetworkProcess.cpp:
2922         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
2923         (WebKit::NetworkProcess::connectionToContextProcessWasClosed):
2924         (WebKit::NetworkProcess::needsServerToContextConnectionForRegistrableDomain const):
2925         (WebKit::NetworkProcess::serverToContextConnectionForRegistrableDomain):
2926         (WebKit::NetworkProcess::createServerToContextConnection):
2927         (WebKit::NetworkProcess::swContextConnectionMayNoLongerBeNeeded):
2928         * NetworkProcess/NetworkProcess.h:
2929         * NetworkProcess/NetworkProcess.messages.in:
2930         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
2931         (WebKit::WebSWServerConnection::scheduleJobInServer):
2932         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2933         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
2934         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
2935         * UIProcess/Network/NetworkProcessProxy.cpp:
2936         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
2937         (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess):
2938         (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcessForExplicitSession):
2939         * UIProcess/Network/NetworkProcessProxy.h:
2940         * UIProcess/Network/NetworkProcessProxy.messages.in:
2941         * UIProcess/ServiceWorkerProcessProxy.cpp:
2942         (WebKit::ServiceWorkerProcessProxy::create):
2943         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
2944         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
2945         * UIProcess/ServiceWorkerProcessProxy.h:
2946         * UIProcess/WebProcessPool.cpp:
2947         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
2948         (WebKit::WebProcessPool::disconnectProcess):
2949         (WebKit::WebProcessPool::updateProcessAssertions):
2950         * UIProcess/WebProcessPool.h:
2951
2952 2019-03-13  Chris Dumez  <cdumez@apple.com>
2953
2954         REGRESSION(PSON, r240660): Navigation over process boundary is flashy when using Cmd-left/right arrow to navigate
2955         https://bugs.webkit.org/show_bug.cgi?id=195684
2956         <rdar://problem/48294714>
2957
2958         Reviewed by Antti Koivisto.
2959
2960         * Shared/NavigationActionData.cpp:
2961         (WebKit::NavigationActionData::encode const):
2962         (WebKit::NavigationActionData::decode):
2963         * Shared/NavigationActionData.h:
2964         * UIProcess/WebPageProxy.cpp:
2965         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2966         (WebKit::WebPageProxy::backForwardAddItem):
2967         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2968         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2969
2970 2019-03-13  Chris Dumez  <cdumez@apple.com>
2971
2972         Drop legacy WebCore::toRegistrableDomain() utility function
2973         https://bugs.webkit.org/show_bug.cgi?id=195637
2974
2975         Reviewed by Geoffrey Garen.
2976
2977         Drop legacy toRegistrableDomain() / registrableDomainAreEqual() utility functions.
2978         Update call sites to use modern RegistrableDomain type instead.
2979
2980         * UIProcess/WebProcessPool.cpp:
2981         (WebKit::WebProcessPool::processForNavigationInternal):
2982
2983 2019-03-12  Brady Eidson  <beidson@apple.com>
2984
2985         Take UnboundedNetworking assertion when a file upload is in progress.
2986         https://bugs.webkit.org/show_bug.cgi?id=195497
2987
2988         Reviewed by Geoff Garen.
2989
2990         This patch implements whole bunch of bookkeeping in both the Networking and UI processes.
2991
2992         The TLDR of that bookkeeping is:
2993         - Whenever any uploads are in progress, take an assertion for both Networking and UI processes.
2994         - Whenever a particular WebProcess has an upload in progress, take an assertion for it.
2995
2996         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2997         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
2998         (WebKit::NetworkConnectionToWebProcess::setProcessIdentifier):
2999         (WebKit::NetworkConnectionToWebProcess::setConnectionHasUploads):
3000         (WebKit::NetworkConnectionToWebProcess::clearConnectionHasUploads):
3001         * NetworkProcess/NetworkConnectionToWebProcess.h:
3002         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3003
3004         * NetworkProcess/NetworkResourceLoadMap.cpp: Added.
3005         (WebKit::NetworkResourceLoadMap::add):
3006         (WebKit::NetworkResourceLoadMap::remove):
3007         (WebKit::NetworkResourceLoadMap::get const):
3008         * NetworkProcess/NetworkResourceLoadMap.h: Added.
3009         (WebKit::NetworkResourceLoadMap::NetworkResourceLoadMap):
3010         (WebKit::NetworkResourceLoadMap::isEmpty const):
3011         (WebKit::NetworkResourceLoadMap::contains const):
3012         (WebKit::NetworkResourceLoadMap::begin):
3013         (WebKit::NetworkResourceLoadMap::values):
3014
3015         * NetworkProcess/NetworkSession.cpp:
3016  
3017        * Scripts/webkit/messages.py:
3018
3019         * Sources.txt:
3020
3021         * UIProcess/Network/NetworkProcessProxy.cpp:
3022         (WebKit::NetworkProcessProxy::takeUploadAssertion):
3023         (WebKit::NetworkProcessProxy::clearUploadAssertion):
3024         * UIProcess/Network/NetworkProcessProxy.h:
3025
3026         * UIProcess/WebProcessPool.cpp:
3027         (WebKit::WebProcessPool::setWebProcessHasUploads):
3028         (WebKit::WebProcessPool::clearWebProcessHasUploads):
3029         * UIProcess/WebProcessPool.h:
3030         * UIProcess/WebProcessPool.messages.in:
3031  
3032        * WebKit.xcodeproj/project.pbxproj:
3033
3034         * WebProcess/WebProcess.cpp:
3035         (WebKit::WebProcess::ensureNetworkProcessConnection):
3036
3037 2019-03-13  Chris Dumez  <cdumez@apple.com>
3038
3039         Use new RegistrableDomain type in PSON code
3040         https://bugs.webkit.org/show_bug.cgi?id=195634
3041
3042         Reviewed by Youenn Fablet.
3043
3044         Use new RegistrableDomain type in PSON code instead of more error-prone String type.
3045
3046         * UIProcess/SuspendedPageProxy.cpp:
3047         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
3048         * UIProcess/SuspendedPageProxy.h:
3049         * UIProcess/WebProcessCache.cpp:
3050         (WebKit::WebProcessCache::canCacheProcess const):
3051         (WebKit::WebProcessCache::addProcessIfPossible):
3052         (WebKit::WebProcessCache::takeProcess):
3053         (WebKit::WebProcessCache::clearAllProcessesForSession):
3054         * UIProcess/WebProcessCache.h:
3055         * UIProcess/WebProcessPool.cpp:
3056         (WebKit::WebProcessPool::addProcessToOriginCacheSet):
3057         (WebKit::WebProcessPool::removeProcessFromOriginCacheSet):
3058         (WebKit::WebProcessPool::processForNavigationInternal):
3059         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
3060         (WebKit::WebProcessPool::didCollectPrewarmInformation):
3061         (WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
3062         * UIProcess/WebProcessPool.h:
3063         * UIProcess/WebProcessProxy.cpp:
3064         (WebKit::WebProcessProxy::canBeAddedToWebProcessCache const):
3065         (WebKit::WebProcessProxy::maybeShutDown):
3066         (WebKit::WebProcessProxy::didCollectPrewarmInformation):
3067         (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
3068         * UIProcess/WebProcessProxy.h:
3069         (WebKit::WebProcessProxy::registrableDomain const):
3070         * UIProcess/WebProcessProxy.messages.in:
3071         * WebProcess/WebProcess.cpp:
3072         (WebKit::WebProcess::sendPrewarmInformation):
3073
3074 2019-03-13  Fujii Hironori  <Hironori.Fujii@sony.com>
3075
3076         [Win][PlayStation] Remove WebCore::standardUserAgentForURL
3077         https://bugs.webkit.org/show_bug.cgi?id=195662
3078
3079         Reviewed by Ryosuke Niwa.
3080
3081         * WebProcess/WebPage/win/WebPageWin.cpp:
3082         (WebKit::WebPage::platformUserAgent const): Return an empty string as well as mac/ios ports.
3083
3084 2019-03-12  Ross Kirsling  <ross.kirsling@sony.com>
3085
3086         [Win] Fix a slew of simple clang-cl warnings.
3087         https://bugs.webkit.org/show_bug.cgi?id=195652
3088
3089         Reviewed by Don Olmstead.
3090
3091         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3092         (WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse): -Wswitch
3093         * Platform/IPC/win/ConnectionWin.cpp:
3094         (IPC::Connection::readEventHandler): -Wunused-variable
3095         * Platform/win/LoggingWin.cpp:
3096         (WebKit::logLevelString): -Wwritable-strings
3097         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
3098         (WebKit::ProcessLauncher::launchProcess): -Wunused-variable
3099
3100 2019-03-12  Ryosuke Niwa  <rniwa@webkit.org>
3101
3102         Move the code for determining the need for touch bar quirks to Quirks class
3103         https://bugs.webkit.org/show_bug.cgi?id=195654
3104
3105         Reviewed by Brent Fulgham.
3106
3107         Moved the code to determine whether touch bar quirks are needed or not to WebCore.
3108
3109         Also renamed HiddenContentEditableQuirk to IsTouchBarUpdateSupressedForHiddenContentEditable
3110         and PlainTextQuirk to NeverRichlyEditableForTouchBar.
3111
3112         * UIProcess/Cocoa/WebViewImpl.h:
3113         (WebKit::WebViewImpl::isRichlyEditableForTouchBar): Renamed.
3114         * UIProcess/Cocoa/WebViewImpl.mm:
3115         (WebKit::WebViewImpl::updateTouchBar):
3116         (WebKit::WebViewImpl::candidateListTouchBarItem const):
3117         (WebKit::WebViewImpl::isRichlyEditableForTouchBar const): Renamed from isRichlyEditable.
3118         (WebKit::WebViewImpl::textTouchBar const):
3119         (WebKit::WebViewImpl::updateTextTouchBar):
3120         * UIProcess/WebPageProxy.cpp:
3121         (WebKit::WebPageProxy::setIsTouchBarUpdateSupressedForHiddenContentEditable): Renamed from
3122         setNeedsHiddenContentEditableQuirk.
3123         (WebKit::WebPageProxy::setIsNeverRichlyEditableForTouchBar): Renamed from setNeedsPlainTextQuirk.
3124         * UIProcess/WebPageProxy.h:
3125         (WebKit::WebPageProxy::isTouchBarUpdateSupressedForHiddenContentEditable const): Renamed from
3126         needsHiddenContentEditableQuirk.
3127         (WebKit::WebPageProxy::isNeverRichlyEditableForTouchBar const): Renamed from needsPlainTextQuirk.
3128         * UIProcess/WebPageProxy.messages.in: Renamed the IPC messages.
3129         * WebProcess/WebPage/WebPage.cpp:
3130         (WebKit::needsHiddenContentEditableQuirk): Deleted. Moved to WebCore.
3131         (WebKit::needsPlainTextQuirk): Deleted. Moved to WebCore.
3132         (WebKit::WebPage::didStartPageTransition):
3133         (WebKit::WebPage::didChangeSelection):
3134         * WebProcess/WebPage/WebPage.h:
3135         (WebKit::WebPage):
3136
3137 2019-03-12  Jiewen Tan  <jiewen_tan@apple.com>
3138
3139         Add WebFrameProxy::loadData
3140         https://bugs.webkit.org/show_bug.cgi?id=195647
3141         <rdar://problem/48826856>
3142
3143         Reviewed by Youenn Fablet.
3144
3145         This patch adds WebFrameProxy::loadData which is a simplified version of WebPageProxy::loadData that
3146         loads substitute data to an iframe. This is needed by the Load Optimizer.
3147
3148         * UIProcess/WebFrameProxy.cpp:
3149         (WebKit::WebFrameProxy::loadData):
3150         * UIProcess/WebFrameProxy.h:
3151         * WebProcess/WebPage/WebPage.cpp:
3152         (WebKit::WebPage::loadDataInFrame):
3153         * WebProcess/WebPage/WebPage.h:
3154         * WebProcess/WebPage/WebPage.messages.in:
3155
3156 2019-03-12  Wenson Hsieh  <wenson_hsieh@apple.com>
3157
3158         [iOS] Input view sometimes flickers when blurring and refocusing an element
3159         https://bugs.webkit.org/show_bug.cgi?id=195639
3160         <rdar://problem/48735337>
3161
3162         Reviewed by Tim Horton.
3163
3164         On iOS, if a focused element is blurred and immediately refocused in the scope of user interaction, we will end
3165         up reloading interaction state (input views, autocorrection contexts, etc.) in the UI process. On certain well-
3166         trafficked websites, this results in the input view and input accessory view flickering (or more egregiously,
3167         scrolling to re-reveal the focused element) when changing selection.
3168
3169         To fix the issue, this patch refactors some focus management logic to suppress sending focused element updates
3170         to the UI process in the case where the same element is being blurred and immediately refocused. To do this, we
3171         track the most recently blurred element and bail when the recently blurred element is identical to the newly
3172         focused element. See below for more detail.
3173
3174         Test: fast/forms/ios/keyboard-stability-when-refocusing-element.html
3175
3176         * UIProcess/WebPageProxy.h:
3177         * UIProcess/ios/WKContentViewInteraction.mm:
3178         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3179         (-[WKContentView _elementDidBlur]):
3180
3181         Update the web process' notion of whether an input view is showing. Importantly, this accounts for decisions
3182         made by _WKUIDelegate. See below for more details.
3183
3184         (isAssistableInputType): Deleted.
3185
3186         Removed this helper function; this was only used in one place as a sanity check that the focused element's type
3187         is not none, right before attempting to show an input view. Instead, we can just check the focused element's
3188         type directly against InputType::None in the if statement of the early return.
3189
3190         * UIProcess/ios/WebPageProxyIOS.mm:
3191         (WebKit::WebPageProxy::setIsShowingInputViewForFocusedElement):
3192
3193         Add a hook to notify the web process when an input view is showing or not (see below for more detail).
3194
3195         * WebProcess/WebPage/WebPage.cpp:
3196         (WebKit::WebPage::didStartPageTransition):
3197         (WebKit::WebPage::elementDidRefocus):
3198         (WebKit::WebPage::shouldDispatchUpdateAfterFocusingElement const):
3199
3200         Add a helper to determine whether we notify the UI process about a newly focused element. On macOS, this is true
3201         only when the new focused element is neither the currently focused element, nor the focused element that was
3202         just blurred. On iOS, we have an additional constraint that when the input view is not showing, we still need to
3203         notify the UI process, since the UI process might want to begin showing the keyboard for an element that has
3204         only been programmatically focused, for which we aren't currently showing the input view.
3205
3206         (WebKit::WebPage::elementDidFocus):
3207         (WebKit::WebPage::elementDidBlur):
3208
3209         Replace a couple of existing member variables in WebPage used for focus management:
3210         -   Replace m_hasPendingBlurNotification with m_recentlyBlurredElement, a RefPtr to the Element that is being
3211             blurred. Behavior here is the same as before (i.e. having a pending blur notification is equivalent to
3212             having recently blurred a focused element). However, this allows us to check newly focused elements against
3213             the recently blurred element in WebPage::elementDidFocus().
3214         -   Replace m_isFocusingElementDueToUserInteraction with m_isShowingInputViewForFocusedElement. The flag
3215             m_isFocusingElementDueToUserInteraction was originally added to fix <webkit.org/b/146735>, by ensuring that
3216             we don't send redundant ElementDidFocus (formerly, StartAssistingNode) messages to the UI process even when
3217             the keyboard is already up. In these simpler times, user interaction when focusing an element was equivalent
3218             to showing an input view for the focused element. However, in today's world, there are a variety of reasons
3219             why we might or might not show an input view for a given element (including, but not limited to activity
3220             state changes and decisions made by _WKInputDelegate). As such, it doesn't make sense to continue relying on
3221             m_isFocusingElementDueToUserInteraction in this early return. Instead, have the UI process propagate a
3222             message back to the web process, to let it know whether there is a keyboard showing, and use this flag
3223             instead.
3224
3225         * WebProcess/WebPage/WebPage.h:
3226         * WebProcess/WebPage/WebPage.messages.in:
3227         * WebProcess/WebPage/ios/WebPageIOS.mm:
3228         (WebKit::WebPage::setIsShowingInputViewForFocusedElement):
3229
3230 2019-03-12  Tim Horton  <timothy_horton@apple.com>
3231
3232         More attempts at build fixing.
3233
3234         * UIProcess/ios/WKActionSheetAssistant.mm:
3235         Yet more.
3236
3237 2019-03-12  Chris Dumez  <cdumez@apple.com>
3238
3239         Device Orientation access permission should be denied unless explicitly granted by the client
3240         https://bugs.webkit.org/show_bug.cgi?id=195625
3241
3242         Reviewed by Youenn Fablet.
3243
3244         Device Orientation access permission should be denied unless explicitly granted by the client.
3245         Previously, it was granted by default.
3246
3247         * UIProcess/API/APIUIClient.h:
3248         (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
3249         * UIProcess/API/C/WKPage.cpp:
3250         (WKPageSetPageUIClient):
3251         * UIProcess/Cocoa/UIDelegate.mm:
3252         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
3253
3254 2019-03-12  Antti Koivisto  <antti@apple.com>
3255
3256         [iOS] Enable asynchronous frame scrolling by default
3257         https://bugs.webkit.org/show_bug.cgi?id=195622
3258         <rdar://problem/48658028>
3259
3260         Reviewed by Simon Fraser
3261
3262         * Shared/WebPreferences.yaml:
3263         * Shared/WebPreferencesDefaultValues.h:
3264
3265 2019-03-12  Per Arne Vollan  <pvollan@apple.com>
3266
3267         [iOS] Block access to backboardd service
3268         https://bugs.webkit.org/show_bug.cgi?id=195484
3269
3270         Reviewed by Brent Fulgham.
3271
3272         This patch is addressing blocking the backboardd service "com.apple.backboard.hid.services". Getting the
3273         backlight level in the WebContent process will initiate a connection with this service. To be able to
3274         block the service, the backlight level is queried in the UI process and sent to the WebContent process
3275         when the WebContent process is started, and when the backlight level is changed. On the WebContent side,
3276         the method getting the backlight level is swizzled to return the value sent from the UI process.
3277
3278         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3279         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3280         (WebKit::WebProcessPool::displayBrightness):
3281         (WebKit::WebProcessPool::backlightLevelDidChangeCallback):
3282         (WebKit::WebProcessPool::registerNotificationObservers):
3283         (WebKit::WebProcessPool::unregisterNotificationObservers):
3284         * UIProcess/WebProcessPool.cpp:
3285         (WebKit::WebProcessPool::initializeNewWebProcess):
3286         * UIProcess/WebProcessPool.h:
3287         * WebProcess/WebProcess.h:
3288         * WebProcess/WebProcess.messages.in:
3289         * WebProcess/cocoa/WebProcessCocoa.mm:
3290         (WebKit::currentBacklightLevel):
3291         (WebKit::WebProcess::backlightLevelDidChange):
3292
3293 2019-03-12  Tim Horton  <timothy_horton@apple.com>
3294
3295         Fix the build after 242801
3296
3297         * UIProcess/ios/WKActionSheetAssistant.mm:
3298         (-[WKActionSheetAssistant _elementActionForDDAction:]):
3299         More.
3300
3301 2019-03-12  Tim Horton  <timothy_horton@apple.com>
3302
3303         Fix the build after 242801
3304
3305         * UIProcess/ios/WKActionSheetAssistant.mm:
3306         (-[WKActionSheetAssistant _elementActionForDDAction:]):
3307
3308 2019-03-12  Eric Carlson  <eric.carlson@apple.com>
3309
3310         [iOS] Sandbox must allow mach lookup required to compress video
3311         https://bugs.webkit.org/show_bug.cgi?id=195627
3312         <rdar://problem/48811072>
3313
3314         Reviewed by Youenn Fablet.
3315
3316         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3317
3318 2019-03-12  Jennifer Moore  <jennifer.moore@apple.com>
3319
3320         Check whether to launch a default action instead of action sheet
3321         https://bugs.webkit.org/show_bug.cgi?id=195225
3322         <rdar://problem/47715544>
3323
3324         Reviewed by Daniel Bates and Tim Horton.
3325
3326         Notify DataDetectors at the start of a touch on a link, and check whether to immediately
3327         launch the default action instead of an action sheet.
3328
3329         * UIProcess/ios/WKActionSheetAssistant.h:
3330         * UIProcess/ios/WKActionSheetAssistant.mm:
3331         (-[WKActionSheetAssistant interactionDidStart]):
3332         (-[WKActionSheetAssistant _createSheetWithElementActions:defaultTitle:showLinkTitle:]):
3333         (-[WKActionSheetAssistant showImageSheet]):
3334         (-[WKActionSheetAssistant showLinkSheet]):
3335         (-[WKActionSheetAssistant showDataDetectorsSheet]):
3336         (-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]): Deleted.
3337         * UIProcess/ios/WKContentViewInteraction.mm:
3338         (-[WKContentView _webTouchEventsRecognized:]):
3339 :
3340 2019-03-12  Zalan Bujtas  <zalan@apple.com>
3341
3342         [Synthetic Click] Dispatch mouseout soon after mouseup
3343         https://bugs.webkit.org/show_bug.cgi?id=195575
3344         <rdar://problem/47093049>
3345
3346         Reviewed by Simon Fraser.
3347
3348         * WebProcess/WebPage/ios/WebPageIOS.mm:
3349         (WebKit::WebPage::completeSyntheticClick):
3350
3351 2019-03-12  Zalan Bujtas  <zalan@apple.com>
3352
3353         [ContentChangeObserver] Stop content change observation when the touch event turns into long press
3354         https://bugs.webkit.org/show_bug.cgi?id=195601
3355         <rdar://problem/48796324>
3356
3357         Reviewed by Wenson Hsieh.
3358
3359         Add didRecognizeLongPress() message to be able to cancel content observation (started at touchStart).
3360
3361         * UIProcess/WebPageProxy.h:
3362         * UIProcess/ios/WKContentViewInteraction.mm:
3363         (-[WKContentView _longPressRecognized:]):
3364         * UIProcess/ios/WebPageProxyIOS.mm:
3365         (WebKit::WebPageProxy::didRecognizeLongPress):
3366         * WebProcess/WebPage/WebPage.h:
3367         * WebProcess/WebPage/WebPage.messages.in:
3368         * WebProcess/WebPage/ios/WebPageIOS.mm:
3369         (WebKit::WebPage::didRecognizeLongPress):
3370
3371 2019-03-11  Andy Estes  <aestes@apple.com>
3372
3373         [Mac] Ensure Apple Pay is unavailable when PassKit.framework is missing
3374         https://bugs.webkit.org/show_bug.cgi?id=195583
3375         <rdar://problem/48420224>
3376
3377         Reviewed by Daniel Bates.
3378
3379         PassKit.framework is optionally soft-linked on Mac because it is missing from the Recovery
3380         Partition. We need to check if the framework is available before calling into it.
3381
3382         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3383         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
3384         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
3385         (WebKit::WebPaymentCoordinatorProxy::platformOpenPaymentSetup):
3386         (WebKit::WebPaymentCoordinatorProxy::platformAvailablePaymentNetworks):
3387         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
3388         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
3389
3390 2019-03-12  Antti Koivisto  <antti@apple.com>
3391
3392         Compositing layer that renders two positioned elements should not hit test
3393         https://bugs.webkit.org/show_bug.cgi?id=195371
3394         <rdar://problem/48649586>
3395
3396         Reviewed by Simon Fraser.
3397
3398         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
3399         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
3400         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
3401         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
3402         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
3403         (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const):
3404         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
3405
3406         Pass event region to UI process.
3407
3408         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
3409         (WebKit::RemoteLayerTreeNode::layerID const):
3410         (WebKit::RemoteLayerTreeNode::eventRegion const):
3411         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
3412         (WebKit::RemoteLayerTreeNode::RemoteLayerTreeNode):
3413         (WebKit::RemoteLayerTreeNode::~RemoteLayerTreeNode):
3414         (WebKit::RemoteLayerTreeNode::setEventRegion):
3415
3416         Maintain event region in RemoteLayerTreeNodes.
3417
3418         (WebKit::RemoteLayerTreeNode::initializeLayer):
3419         (WebKit::RemoteLayerTreeNode::layerID):
3420         (WebKit::RemoteLayerTreeNode::forCALayer):
3421
3422         Move layerID to RemoteLayerTreeNode and store RemoteLayerTreeNode pointer to CALayers instead.
3423         This makes it easy to find the matching RemoteLayerTreeNode from a layer, globally.
3424
3425         (WebKit::RemoteLayerTreeNode::setLayerID): Deleted.
3426         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
3427         (WebKit::collectDescendantViewsAtPoint):
3428
3429         If we have event region, use it for hit testing.
3430
3431         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
3432         (collectDescendantViewsAtPoint): Deleted.
3433         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
3434         (WebKit::PlatformCALayerRemote::eventRegion const):
3435         (WebKit::PlatformCALayerRemote::setEventRegion):
3436         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
3437
3438 2019-03-12  Carlos Garcia Campos  <cgarcia@igalia.com>
3439
3440         [WPE][GTK] Load events may occur in unexpected order when JS redirects page before subresource load finishes
3441         https://bugs.webkit.org/show_bug.cgi?id=194131
3442
3443         Reviewed by Michael Catanzaro.
3444
3445         Ensure we emit the load-failed and load-changed with finished event when there's still an ongoing load when a
3446         new provisional load strarts. Previous load fails with cancelled error.
3447
3448         * UIProcess/API/glib/WebKitWebView.cpp:
3449         (webkitWebViewWillStartLoad): Call webkitWebViewLoadFailed() if current page load state is not finished.
3450         * UIProcess/API/glib/WebKitWebViewPrivate.h:
3451         * UIProcess/API/gtk/PageClientImpl.cpp:
3452         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame): Call webkitWebViewWillStartLoad().
3453         * UIProcess/API/wpe/APIViewClient.h:
3454         (API::ViewClient::willStartLoad): Add willStartLoad() to API::ViewClient
3455         * UIProcess/API/wpe/PageClientImpl.cpp:
3456         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame): Call WPEView::willStartLoad().
3457         * UIProcess/API/wpe/PageClientImpl.h:
3458         * UIProcess/API/wpe/WPEView.cpp:
3459         (WKWPE::View::willStartLoad): Call API::ViewClient::willStartLoad().
3460         * UIProcess/API/wpe/WPEView.h:
3461         * UIProcess/PageLoadState.h:
3462         (WebKit::PageLoadState::isProvisional const):
3463         (WebKit::PageLoadState::isCommitted const):
3464         (WebKit::PageLoadState::isFinished const):
3465
3466 2019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
3467
3468         Unreviewed, rolling out r242763.
3469
3470         Causes layout test crashes on iOS simulator
3471
3472         Reverted changeset:
3473
3474         "[Synthetic Click] Dispatch mouseout soon after mouseup"
3475         https://bugs.webkit.org/show_bug.cgi?id=195575
3476         https://trac.webkit.org/changeset/242763
3477
3478 2019-03-11  Ross Kirsling  <ross.kirsling@sony.com>
3479
3480         Add Optional to Forward.h.
3481         https://bugs.webkit.org/show_bug.cgi?id=195586
3482
3483         Reviewed by Darin Adler.
3484
3485         * Shared/RTCNetwork.cpp:
3486         * Shared/RTCNetwork.h:
3487         * Shared/RTCPacketOptions.cpp:
3488         * Shared/RTCPacketOptions.h:
3489         * UIProcess/API/APIWebsitePolicies.h:
3490         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
3491         Remove unnecessary includes from headers.
3492
3493 2019-03-11  Commit Queue  <commit-queue@webkit.org>
3494
3495         Unreviewed, rolling out r242745 and r242756.
3496         https://bugs.webkit.org/show_bug.cgi?id=195606
3497
3498         Breaks internal builds (Requested by ryanhaddad on #webkit).
3499
3500         Reverted changesets:
3501
3502         "[iOS] Block access to backboardd service"
3503         https://bugs.webkit.org/show_bug.cgi?id=195484
3504         https://trac.webkit.org/changeset/242745
3505
3506         "Unreviewed build fix after r242745."
3507         https://trac.webkit.org/changeset/242756
3508
3509 2019-03-11  Fujii Hironori  <Hironori.Fujii@sony.com>
3510
3511         [CoordinatedGraphics] ASSERTION FAILED: !m_state.isSuspended
3512         https://bugs.webkit.org/show_bug.cgi?id=195550
3513
3514         Reviewed by Carlos Garcia Campos.
3515
3516         CompositingRunLoop::suspend() locks a mutex and stops the update
3517         timer. But, the timer can be fired after the lock was acquired and
3518         before the timer is stopped.
3519
3520         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
3521         (WebKit::CompositingRunLoop::updateTimerFired): Removed the
3522         assertion. Return early if m_state.isSuspended.
3523
3524 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
3525
3526         [macOS] Remove the Kerberos rules from the WebContent sandbox
3527         https://bugs.webkit.org/show_bug.cgi?id=195464
3528         <rdar://problem/35369230>
3529
3530         Reviewed by Brent Fulgham.
3531
3532         Kerberos auth is done in the UIProcess or NetworkProcess now.
3533
3534         * WebProcess/com.apple.WebProcess.sb.in:
3535
3536 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
3537
3538         [iOS] Add entitlement to enable use of graphics endpoint with limited capabilities
3539         https://bugs.webkit.org/show_bug.cgi?id=195582
3540         <rdar://problem/36082379>
3541
3542         Reviewed by Brent Fulgham.
3543
3544         This is a QuartzCore endpoint with a minimal set of capabilities.
3545
3546         * Configurations/WebContent-iOS.entitlements:
3547
3548 2019-03-11  John Wilander  <wilander@apple.com>
3549
3550         Move NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm functionality into UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
3551         https://bugs.webkit.org/show_bug.cgi?id=195117
3552         <rdar://problem/48448715>
3553
3554         Reviewed by Brent Fulgham.
3555
3556         Reading of user defaults on Cocoa platforms should be done in the UI process and
3557         forwarded to Resource Load Statistics in the network process through the
3558         WebKit::NetworkSessionCreationParameters struct.
3559
3560         This patch does away with some old user defaults we don't use anymore. It also
3561         changes the developer-facing default name to ITPManualPrevalentResource.
3562
3563         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3564         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
3565             Removed the call to the old registerUserDefaultsIfNeeded().
3566         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3567         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
3568             Removed the call to the old registerUserDefaultsIfNeeded().
3569         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
3570             Removed the declaration of the old registerUserDefaultsIfNeeded().
3571         * NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm: Removed.
3572         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3573             Added an enum class EnableResourceLoadStatisticsDebugMode.
3574         * NetworkProcess/NetworkSession.cpp:
3575         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
3576         * NetworkProcess/NetworkSession.h:
3577         * NetworkProcess/NetworkSessionCreationParameters.cpp:
3578         (WebKit::NetworkSessionCreationParameters::encode const):
3579         (WebKit::NetworkSessionCreationParameters::decode):
3580         * NetworkProcess/NetworkSessionCreationParameters.h:
3581            The struct now has two new fields:
3582            - enableResourceLoadStatisticsDebugMode
3583            - resourceLoadStatisticsManualPrevalentResource
3584         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3585         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3586             Forwarding of the parameters.
3587         * SourcesCocoa.txt:
3588         * UIProcess/WebProcessPool.cpp:
3589         (WebKit::WebProcessPool::ensureNetworkProcess):
3590             Forwarding of the parameters.
3591         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3592         (WebKit::WebsiteDataStore::parameters):
3593             This is where user defaults for Resource Load Statistics are now read.
3594         * WebKit.xcodeproj/project.pbxproj:
3595
3596 2019-03-11  Zalan Bujtas  <zalan@apple.com>
3597
3598         [Synthetic Click] Dispatch mouseout soon after mouseup
3599         https://bugs.webkit.org/show_bug.cgi?id=195575
3600         <rdar://problem/47093049>
3601
3602         Reviewed by Simon Fraser.
3603
3604         * WebProcess/WebPage/ios/WebPageIOS.mm:
3605         (WebKit::WebPage::completeSyntheticClick):
3606
3607 2019-03-11  Tim Horton  <timothy_horton@apple.com>
3608
3609         API test WebKit.RequestTextInputContext fails on iOS
3610         https://bugs.webkit.org/show_bug.cgi?id=195585
3611
3612         Reviewed by Wenson Hsieh and Simon Fraser.
3613
3614         * UIProcess/API/Cocoa/WKWebView.mm:
3615         (-[WKWebView _convertRectFromRootViewCoordinates:]):
3616         (-[WKWebView _convertRectToRootViewCoordinates:]):
3617         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
3618         (-[WKWebView _focusTextInputContext:completionHandler:]):
3619         * WebProcess/WebPage/WebPage.cpp:
3620         (WebKit::elementRectInRootViewCoordinates):
3621         (WebKit::WebPage::textInputContextsInRect):
3622         (WebKit::elementRectInWindowCoordinates): Deleted.
3623         Text input context SPI should be in terms of WKWebView coordinates,
3624         for consistency's sake. This is a bit irritating; WebPage(Proxy) continue
3625         to operate in "root view" coordinates, which means different things
3626         depending on if delegatesScrolling is true or not. So, WKWebView does
3627         the conversion, re-creating objects as needed.
3628
3629 2019-03-09  Jiewen Tan  <jiewen_tan@apple.com>
3630
3631         Optimizing loads when creating new pages
3632         https://bugs.webkit.org/show_bug.cgi?id=195516
3633         <rdar://problem/48738086>
3634
3635         Reviewed by Darin Adler.
3636
3637         This patch adds hooks in WebPageProxy::createNewPage to optimize loads, and moves the creationParameters
3638         of API::NavigationAction from UI clients to WebPageProxy::createNewPage. Also, we now pass the whole
3639         API::NavigationAction to the load optimizer instead of the request within.
3640
3641         * UIProcess/API/APINavigationAction.h:
3642         * UIProcess/API/APIUIClient.h:
3643         (API::UIClient::createNewPage):
3644         * UIProcess/API/C/WKPage.cpp:
3645         (WKPageSetPageUIClient):
3646         * UIProcess/API/glib/WebKitUIClient.cpp:
3647         * UIProcess/Cocoa/NavigationState.mm:
3648         (WebKit::tryOptimizingLoad):
3649         (WebKit::tryInterceptNavigation):
3650         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3651         * UIProcess/Cocoa/UIDelegate.h:
3652         * UIProcess/Cocoa/UIDelegate.mm:
3653         (WebKit::UIDelegate::UIClient::createNewPage):
3654         * UIProcess/WebPageProxy.cpp:
3655         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3656         (WebKit::tryOptimizingLoad):
3657         (WebKit::WebPageProxy::createNewPage):
3658         * UIProcess/WebPageProxy.h:
3659
3660 2019-03-11  Dean Jackson  <dino@apple.com>
3661
3662         [iOS] Implement a faster click detection that intercepts double-tap-to-zoom if possible
3663         https://bugs.webkit.org/show_bug.cgi?id=195473
3664         <rdar://problem/48718396>
3665
3666         Reviewed by Wenson Hsieh (with some help from Dan Bates).
3667
3668         Adds a new algorithm, behind a flag FasterClicksEnabled, that can trigger a click
3669         event without waiting to see if a double tap will occur. It does this by examining
3670         the amount of zoom that would be triggered if it was a double tap, and if that value
3671         doesn't exceed a set threshold, commits to the click event instead.
3672
3673         This is implemented by having the Web Process respond to the potential click with
3674         some geometry information. If the UI Process receives the information before the
3675         second tap in a double tap, it can decide to trigger a click.
3676
3677         * Shared/WebPreferences.yaml: New internal feature so this can be toggled in
3678             a UI for testing.
3679
3680         * SourcesCocoa.txt: Renamed WKSyntheticTapGestureRecognizer.
3681         * WebKit.xcodeproj/project.pbxproj: Ditto.
3682
3683         * UIProcess/ios/WKSyntheticTapGestureRecognizer.h:
3684         * UIProcess/ios/WKSyntheticTapGestureRecognizer.m:
3685         (-[WKSyntheticTapGestureRecognizer setGestureIdentifiedTarget:action:]):
3686         (-[WKSyntheticTapGestureRecognizer setGestureFailedTarget:action:]):
3687         (-[WKSyntheticTapGestureRecognizer setResetTarget:action:]):
3688         (-[WKSyntheticTapGestureRecognizer setState:]):
3689         (-[WKSyntheticTapGestureRecognizer reset]):  Renamed WKSyntheticClickTapGestureRecognizer to
3690             WKSyntheticTapGestureRecognizer, changed the signature of the main function to be a bit
3691             more clear about what it does, and added a gesture failed target.
3692
3693         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3694         * UIProcess/API/Cocoa/WKWebView.mm:
3695         (-[WKWebView _initialScaleFactor]):
3696         (-[WKWebView _contentZoomScale]):
3697         (-[WKWebView _targetContentZoomScaleForRect:currentScale:fitEntireRect:minimumScale:maximumScale:]):
3698             Exposed the initial content scale, the current scale and added a declaration that
3699             was missing from the .h.
3700
3701         * UIProcess/WebPageProxy.messages.in: Add a new message,
3702             HandleSmartMagnificationInformationForPotentialTap, to
3703             communicate the geometry of the clicked node to the UI Process.
3704
3705         * UIProcess/PageClient.h: Pure virtual function for the geometry message response.
3706         * UIProcess/WebPageProxy.h: Ditto.
3707
3708         * UIProcess/ios/PageClientImplIOS.h: Calls into the WKContentView.
3709         * UIProcess/ios/PageClientImplIOS.mm:
3710         (WebKit::PageClientImpl::handleSmartMagnificationInformationForPotentialTap):
3711
3712         * UIProcess/ios/SmartMagnificationController.h:
3713         * UIProcess/ios/SmartMagnificationController.mm:
3714         (WebKit::SmartMagnificationController::calculatePotentialZoomParameters): A new method that
3715             asks the WKContentView to work out what the zoom factor will be for a potential double
3716             tap at a location.
3717         (WebKit::SmartMagnificationController::smartMagnificationTargetRectAndZoomScales): New implementation
3718             of this function to avoid multiple out-arguments.
3719
3720         * UIProcess/ios/WKContentView.h:
3721         * UIProcess/ios/WKContentView.mm:
3722         (-[WKContentView _initialScaleFactor]):
3723         (-[WKContentView _contentZoomScale]):
3724         (-[WKContentView _targetContentZoomScaleForRect:currentScale:fitEntireRect:minimumScale:maximumScale:]):
3725             Exposed the initial content scale, the current scale and the target zoom scale. These
3726             all just call into the WKWebView implementation.
3727
3728         * UIProcess/ios/WKContentViewInteraction.h:
3729         * UIProcess/ios/WKContentViewInteraction.mm:
3730         (-[WKContentView _createAndConfigureDoubleTapGestureRecognizer]): Use a WKSyntheticTapGestureRecognizer instead
3731             of a generic one, so we can capture the failure.
3732         (-[WKContentView setupInteraction]):
3733         (-[WKContentView cleanupInteraction]):
3734         (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:origin:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:]):
3735             New method that responds to the incoming Web Process message, and decides if any
3736             potential zoom would be "significant".
3737         (-[WKContentView _singleTapIdentified:]):
3738         (-[WKContentView _doubleTapDidFail:]):
3739         (-[WKContentView _didCompleteSyntheticClick]):
3740         (-[WKContentView _singleTapRecognized:]):
3741         (-[WKContentView _doubleTapRecognized:]):
3742             Add some release logging.
3743         (-[WKContentView _singleTapCommited:]): Deleted.
3744
3745         * UIProcess/ios/WebPageProxyIOS.mm:
3746         (WebKit::WebPageProxy::potentialTapAtPosition):
3747         (WebKit::WebPageProxy::handleSmartMagnificationInformationForPotentialTap):
3748         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
3749         * WebProcess/WebPage/WebPage.h:
3750         * WebProcess/WebPage/WebPage.messages.in:
3751             Removed an unused parameter from the existing message.
3752
3753         * WebProcess/WebPage/ios/WebPageIOS.mm:
3754         (WebKit::WebPage::potentialTapAtPosition): Calculates the geometry of the element
3755         if requested, and sends it to the UIProcess.
3756
3757 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
3758
3759         Unreviewed build fix after r242745.
3760
3761         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3762         (WebKit::WebProcessPool::registerNotificationObservers):
3763         (WebKit::WebProcessPool::unregisterNotificationObservers):
3764
3765 2019-03-11  Chris Dumez  <cdumez@apple.com>
3766
3767         Assert in WebPageProxy::suspendCurrentPageIfPossible()
3768         https://bugs.webkit.org/show_bug.cgi?id=195506
3769         <rdar://problem/48733477>
3770
3771         Reviewed by Alex Christensen.
3772
3773         The crash was caused by the top-hit preloading logic in MobileSafari which creates a new Web view that is *related*
3774         to the previous one, restores the session state onto it and then triggers a load in this new Web view.
3775
3776         Initially, the 2 Web views use the same process as they are related. However, if the new load's URL is cross-site
3777         with regards to the first view's URL, then we decide to process swap in the new view. This process swap makes
3778         sense from a security standpoint. However, when we commit the load in the new process and call
3779         suspendCurrentPageIfPossible() we end up in an unexpected state because we have a fromItem (due to the session
3780         state having been restored on the new view) but we haven't committed any load yet in this new view.
3781
3782         To address the issue, suspendCurrentPageIfPossible() now returns early and does not attempt to suspend anything
3783         if we have not committed any load yet.
3784
3785         * UIProcess/WebPageProxy.cpp:
3786         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
3787         Do not attempt to suspend to current page if we have not committed any provisional load yet.
3788
3789 2019-03-11  Chris Dumez  <cdumez@apple.com>
3790
3791         Update device orientation & motion permission native SPI as per latest proposal
3792         https://bugs.webkit.org/show_bug.cgi?id=195567
3793
3794         Reviewed by Youenn Fablet.
3795
3796         The native SPI is now:
3797         +- (void)_webView:(WKWebView *)webView shouldAllowDeviceOrientationAndMotionAccessRequestedByFrame:(WKFrameInfo *)frameInfo decisionHandler:(void (^)(BOOL))decisionHandler;
3798
3799         * UIProcess/API/APIUIClient.h:
3800         (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
3801         * UIProcess/API/C/WKPage.cpp:
3802         (WKPageSetPageUIClient):
3803         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3804         * UIProcess/Cocoa/UIDelegate.h:
3805         * UIProcess/Cocoa/UIDelegate.mm:
3806         (WebKit::UIDelegate::setDelegate):
3807         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
3808         * UIProcess/WebPageProxy.cpp:
3809         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
3810         * UIProcess/WebPageProxy.h:
3811         * UIProcess/WebPageProxy.messages.in:
3812         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3813         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
3814         * WebProcess/WebCoreSupport/WebChromeClient.h:
3815         * WebProcess/WebPage/WebPage.cpp:
3816         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
3817         * WebProcess/WebPage/WebPage.h:
3818
3819 2019-03-11  Andy Estes  <aestes@apple.com>
3820
3821         [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
3822         https://bugs.webkit.org/show_bug.cgi?id=195530
3823         <rdar://problem/48747164>
3824
3825         Reviewed by Alex Christensen.
3826
3827         * Configurations/Network-iOS.entitlements: Added the 'com.apple.payment.all-access'
3828         entitlement and reordered the others.
3829
3830         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3831         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): Forwarded
3832         WebPaymentCoordinatorProxy messages to the payment coordinator.
3833         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): Ditto.
3834         (WebKit::NetworkConnectionToWebProcess::didClose): Set m_paymentCoordinator to nullptr.
3835         * NetworkProcess/NetworkConnectionToWebProcess.h: Inherited from
3836         WebPaymentCoordinatorProxy::Client and added a unique_ptr<WebPaymentCoordinatorProxy> member.
3837
3838         * NetworkProcess/cocoa/NetworkSessionCocoa.h: Declared getters for source application bundle
3839         and secondary identifiers, and CTDataConnectionServiceType on iOS.
3840         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3841         (WebKit::NetworkSessionCocoa::sourceApplicationBundleIdentifier const): Defined getter.
3842         (WebKit::NetworkSessionCocoa::sourceApplicationSecondaryIdentifier const): Ditto.
3843         (WebKit::NetworkSessionCocoa::ctDataConnectionServiceType const): Ditto.
3844         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Initialized
3845         m_sourceApplicationBundleIdentifier and m_sourceApplicationSecondaryIdentifier with
3846         corresponding NetworkSessionCreationParameters.
3847
3848         * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm: Added.
3849         (WebKit::NetworkConnectionToWebProcess::paymentCoordinator): Added. Returns
3850         m_paymentCoordinator after lazily initializing it.
3851         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorConnection): Added. Returns the
3852         connection to the web process.
3853         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorPresentingViewController): Added.
3854         Returns nil.
3855         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType):
3856         Added. Returns the value from the network session identified by sessionID.
3857         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationBundleIdentifier):
3858         Ditto.
3859         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationSecondaryIdentifier):
3860         Ditto.
3861         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAuthorizationPresenter): Added.
3862         Returns a new PaymentAuthorizationController.
3863         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAddMessageReceiver): Added empty
3864         definition. NetworkConnectionToWebProcess explicitly forwards WebPaymentCoordinatorProxy
3865         messages to its payment coordinator, so there's no need to register with a MessageReceiverMap.
3866         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorRemoveMessageReceiver): Ditto.
3867
3868         * Platform/ios/PaymentAuthorizationController.h: Added. Declares a
3869         PaymentAuthorizationPresenter subclass based on PKPaymentAuthorizationController.
3870         * Platform/ios/PaymentAuthorizationController.mm: Added.
3871         (-[WKPaymentAuthorizationControllerDelegate initWithRequest:presenter:]):
3872         Initialized WKPaymentAuthorizationDelegate with request and presenter.
3873         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationControllerDidFinish:]):
3874         Forwarded call to WKPaymentAuthorizationDelegate.
3875         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didAuthorizePayment:handler:]):
3876         Ditto.
3877         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingMethod:handler:]):
3878         Ditto.
3879         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingContact:handler:]):
3880         Ditto.
3881         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectPaymentMethod:handler:]):
3882         Ditto.
3883         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:willFinishWithError:]):
3884         Ditto.
3885         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didRequestMerchantSession:]):
3886         Ditto.
3887         (WebKit::PaymentAuthorizationController::PaymentAuthorizationController):
3888         Initialized m_controller with a new PKPaymentAuthorizationController and m_delegate with a
3889         new WKPaymentAuthorizationControllerDelegate.
3890         (WebKit::PaymentAuthorizationController::platformDelegate): Returned m_delegate.
3891         (WebKit::PaymentAuthorizationController::dismiss): Dismissed the controller, set its
3892         delegates to nil, set m_controller to nil, invalidated the delegate, and set m_delegate to
3893         nil.
3894         (WebKit::PaymentAuthorizationController::present): Called -presentWithCompletion: on the
3895         controller, forwarding the passed-in completion handler.
3896         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Allowed PassKit to look up
3897         the "com.apple.passd.in-app-payment" and "com.apple.passd.library" service endpoints.
3898
3899         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
3900         (WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy): Changed to call
3901         paymentCoordinatorAddMessageReceiver.
3902         (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): Changed to call
3903         paymentCoordinatorRemoveMessageReceiver.
3904         (WebKit::WebPaymentCoordinatorProxy::messageSenderDestinationID const): Deleted.
3905         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard): Passed sessionID to
3906         platformCanMakePaymentsWithActiveCard.
3907         (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): Stored destinationID and passed
3908         sessionID to platformShowPaymentUI.
3909         (WebKit::WebPaymentCoordinatorProxy::cancelPaymentSession): Changed to account for new
3910         behavior of didCancelPaymentSession.
3911         (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Changed to call hidePaymentUI.
3912         (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Changed to only call hidePaymentUI
3913         when didReachFinalState is true, since didCancelPaymentSession is called otherwise.
3914         (WebKit::WebPaymentCoordinatorProxy::didReachFinalState): Cleared m_destinationID.
3915         * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Added m_destionationID member.
3916         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: Changed
3917         CanMakePaymentsWithActiveCard and ShowPaymentUI messages to take destinationID and sessionID
3918         arguments.
3919
3920         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3921         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard): Passed
3922         sessionID to paymentCoordinatorSourceApplicationSecondaryIdentifier.
3923         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Passed sessionID to various
3924         m_client call sites.
3925
3926         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
3927         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
3928         platformPaymentRequest.
3929         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
3930         before calling dismiss.
3931
3932         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
3933         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
3934         platformPaymentRequest.
3935         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
3936         before calling dismiss.
3937
3938         * Shared/WebPreferences.yaml: Added ApplePayRemoteUIEnabled as an internal preference.
3939
3940         * SourcesCocoa.txt: Added NetworkConnectionToWebProcessIOS.mm and
3941         PaymentAuthorizationController.mm.
3942
3943         * UIProcess/AuxiliaryProcessProxy.h:
3944         (WebKit::AuxiliaryProcessProxy::messageReceiverMap): Deleted.
3945
3946         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3947         (WebKit::WebPageProxy::paymentCoordinatorConnection): Moved from WebPageProxy.cpp.
3948         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
3949         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
3950         (WebKit::WebPageProxy::paymentCoordinatorAddMessageReceiver): Ditto.
3951         (WebKit::WebPageProxy::paymentCoordinatorRemoveMessageReceiver): Ditto.
3952
3953         * UIProcess/WebPageProxy.cpp:
3954         (WebKit::WebPageProxy::paymentCoordinatorConnection): Moved to WebPageProxyCocoa.mm.
3955         (WebKit::WebPageProxy::paymentCoordinatorMessageReceiver): Ditto.
3956         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
3957         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
3958         (WebKit::WebPageProxy::paymentCoordinatorDestinationID): Ditto.
3959         * UIProcess/WebPageProxy.h:
3960
3961         * UIProcess/ios/WebPageProxyIOS.mm:
3962         (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType): Asserted that
3963         sessionID equals the website data store's sessionID.
3964
3965         * WebKit.xcodeproj/project.pbxproj:
3966
3967         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
3968         (WebKit::WebPaymentCoordinator::networkProcessConnectionClosed): Added. Cancels the current
3969         session if Apple Pay Remote UI is enabled and the network process connection closes.
3970         (WebKit::WebPaymentCoordinator::availablePaymentNetworks): Changed to account for
3971         WebPaymentCoordinator being an IPC::MessageSender.
3972         (WebKit::WebPaymentCoordinator::canMakePayments): Ditto.
3973     &n