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