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