Update device orientation & motion permission native SPI as per latest proposal
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-03-11  Chris Dumez  <cdumez@apple.com>
2
3         Update device orientation & motion permission native SPI as per latest proposal
4         https://bugs.webkit.org/show_bug.cgi?id=195567
5
6         Reviewed by Youenn Fablet.
7
8         The native SPI is now:
9         +- (void)_webView:(WKWebView *)webView shouldAllowDeviceOrientationAndMotionAccessRequestedByFrame:(WKFrameInfo *)frameInfo decisionHandler:(void (^)(BOOL))decisionHandler;
10
11         * UIProcess/API/APIUIClient.h:
12         (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
13         * UIProcess/API/C/WKPage.cpp:
14         (WKPageSetPageUIClient):
15         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
16         * UIProcess/Cocoa/UIDelegate.h:
17         * UIProcess/Cocoa/UIDelegate.mm:
18         (WebKit::UIDelegate::setDelegate):
19         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
20         * UIProcess/WebPageProxy.cpp:
21         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
22         * UIProcess/WebPageProxy.h:
23         * UIProcess/WebPageProxy.messages.in:
24         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
25         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
26         * WebProcess/WebCoreSupport/WebChromeClient.h:
27         * WebProcess/WebPage/WebPage.cpp:
28         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
29         * WebProcess/WebPage/WebPage.h:
30
31 2019-03-11  Andy Estes  <aestes@apple.com>
32
33         [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
34         https://bugs.webkit.org/show_bug.cgi?id=195530
35         <rdar://problem/48747164>
36
37         Reviewed by Alex Christensen.
38
39         * Configurations/Network-iOS.entitlements: Added the 'com.apple.payment.all-access'
40         entitlement and reordered the others.
41
42         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
43         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): Forwarded
44         WebPaymentCoordinatorProxy messages to the payment coordinator.
45         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): Ditto.
46         (WebKit::NetworkConnectionToWebProcess::didClose): Set m_paymentCoordinator to nullptr.
47         * NetworkProcess/NetworkConnectionToWebProcess.h: Inherited from
48         WebPaymentCoordinatorProxy::Client and added a unique_ptr<WebPaymentCoordinatorProxy> member.
49
50         * NetworkProcess/cocoa/NetworkSessionCocoa.h: Declared getters for source application bundle
51         and secondary identifiers, and CTDataConnectionServiceType on iOS.
52         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
53         (WebKit::NetworkSessionCocoa::sourceApplicationBundleIdentifier const): Defined getter.
54         (WebKit::NetworkSessionCocoa::sourceApplicationSecondaryIdentifier const): Ditto.
55         (WebKit::NetworkSessionCocoa::ctDataConnectionServiceType const): Ditto.
56         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Initialized
57         m_sourceApplicationBundleIdentifier and m_sourceApplicationSecondaryIdentifier with
58         corresponding NetworkSessionCreationParameters.
59
60         * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm: Added.
61         (WebKit::NetworkConnectionToWebProcess::paymentCoordinator): Added. Returns
62         m_paymentCoordinator after lazily initializing it.
63         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorConnection): Added. Returns the
64         connection to the web process.
65         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorPresentingViewController): Added.
66         Returns nil.
67         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType):
68         Added. Returns the value from the network session identified by sessionID.
69         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationBundleIdentifier):
70         Ditto.
71         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationSecondaryIdentifier):
72         Ditto.
73         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAuthorizationPresenter): Added.
74         Returns a new PaymentAuthorizationController.
75         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAddMessageReceiver): Added empty
76         definition. NetworkConnectionToWebProcess explicitly forwards WebPaymentCoordinatorProxy
77         messages to its payment coordinator, so there's no need to register with a MessageReceiverMap.
78         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorRemoveMessageReceiver): Ditto.
79
80         * Platform/ios/PaymentAuthorizationController.h: Added. Declares a
81         PaymentAuthorizationPresenter subclass based on PKPaymentAuthorizationController.
82         * Platform/ios/PaymentAuthorizationController.mm: Added.
83         (-[WKPaymentAuthorizationControllerDelegate initWithRequest:presenter:]):
84         Initialized WKPaymentAuthorizationDelegate with request and presenter.
85         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationControllerDidFinish:]):
86         Forwarded call to WKPaymentAuthorizationDelegate.
87         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didAuthorizePayment:handler:]):
88         Ditto.
89         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingMethod:handler:]):
90         Ditto.
91         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingContact:handler:]):
92         Ditto.
93         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectPaymentMethod:handler:]):
94         Ditto.
95         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:willFinishWithError:]):
96         Ditto.
97         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didRequestMerchantSession:]):
98         Ditto.
99         (WebKit::PaymentAuthorizationController::PaymentAuthorizationController):
100         Initialized m_controller with a new PKPaymentAuthorizationController and m_delegate with a
101         new WKPaymentAuthorizationControllerDelegate.
102         (WebKit::PaymentAuthorizationController::platformDelegate): Returned m_delegate.
103         (WebKit::PaymentAuthorizationController::dismiss): Dismissed the controller, set its
104         delegates to nil, set m_controller to nil, invalidated the delegate, and set m_delegate to
105         nil.
106         (WebKit::PaymentAuthorizationController::present): Called -presentWithCompletion: on the
107         controller, forwarding the passed-in completion handler.
108         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Allowed PassKit to look up
109         the "com.apple.passd.in-app-payment" and "com.apple.passd.library" service endpoints.
110
111         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
112         (WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy): Changed to call
113         paymentCoordinatorAddMessageReceiver.
114         (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): Changed to call
115         paymentCoordinatorRemoveMessageReceiver.
116         (WebKit::WebPaymentCoordinatorProxy::messageSenderDestinationID const): Deleted.
117         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard): Passed sessionID to
118         platformCanMakePaymentsWithActiveCard.
119         (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): Stored destinationID and passed
120         sessionID to platformShowPaymentUI.
121         (WebKit::WebPaymentCoordinatorProxy::cancelPaymentSession): Changed to account for new
122         behavior of didCancelPaymentSession.
123         (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Changed to call hidePaymentUI.
124         (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Changed to only call hidePaymentUI
125         when didReachFinalState is true, since didCancelPaymentSession is called otherwise.
126         (WebKit::WebPaymentCoordinatorProxy::didReachFinalState): Cleared m_destinationID.
127         * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Added m_destionationID member.
128         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: Changed
129         CanMakePaymentsWithActiveCard and ShowPaymentUI messages to take destinationID and sessionID
130         arguments.
131
132         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
133         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard): Passed
134         sessionID to paymentCoordinatorSourceApplicationSecondaryIdentifier.
135         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Passed sessionID to various
136         m_client call sites.
137
138         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
139         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
140         platformPaymentRequest.
141         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
142         before calling dismiss.
143
144         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
145         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
146         platformPaymentRequest.
147         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
148         before calling dismiss.
149
150         * Shared/WebPreferences.yaml: Added ApplePayRemoteUIEnabled as an internal preference.
151
152         * SourcesCocoa.txt: Added NetworkConnectionToWebProcessIOS.mm and
153         PaymentAuthorizationController.mm.
154
155         * UIProcess/AuxiliaryProcessProxy.h:
156         (WebKit::AuxiliaryProcessProxy::messageReceiverMap): Deleted.
157
158         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
159         (WebKit::WebPageProxy::paymentCoordinatorConnection): Moved from WebPageProxy.cpp.
160         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
161         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
162         (WebKit::WebPageProxy::paymentCoordinatorAddMessageReceiver): Ditto.
163         (WebKit::WebPageProxy::paymentCoordinatorRemoveMessageReceiver): Ditto.
164
165         * UIProcess/WebPageProxy.cpp:
166         (WebKit::WebPageProxy::paymentCoordinatorConnection): Moved to WebPageProxyCocoa.mm.
167         (WebKit::WebPageProxy::paymentCoordinatorMessageReceiver): Ditto.
168         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
169         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
170         (WebKit::WebPageProxy::paymentCoordinatorDestinationID): Ditto.
171         * UIProcess/WebPageProxy.h:
172
173         * UIProcess/ios/WebPageProxyIOS.mm:
174         (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType): Asserted that
175         sessionID equals the website data store's sessionID.
176
177         * WebKit.xcodeproj/project.pbxproj:
178
179         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
180         (WebKit::WebPaymentCoordinator::networkProcessConnectionClosed): Added. Cancels the current
181         session if Apple Pay Remote UI is enabled and the network process connection closes.
182         (WebKit::WebPaymentCoordinator::availablePaymentNetworks): Changed to account for
183         WebPaymentCoordinator being an IPC::MessageSender.
184         (WebKit::WebPaymentCoordinator::canMakePayments): Ditto.
185         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard): Ditto.
186         (WebKit::WebPaymentCoordinator::openPaymentSetup): Ditto.
187         (WebKit::WebPaymentCoordinator::showPaymentUI): Ditto.
188         (WebKit::WebPaymentCoordinator::completeMerchantValidation): Ditto.
189         (WebKit::WebPaymentCoordinator::completeShippingMethodSelection): Ditto.
190         (WebKit::WebPaymentCoordinator::completeShippingContactSelection): Ditto.
191         (WebKit::WebPaymentCoordinator::completePaymentMethodSelection): Ditto.
192         (WebKit::WebPaymentCoordinator::completePaymentSession): Ditto.
193         (WebKit::WebPaymentCoordinator::abortPaymentSession): Ditto.
194         (WebKit::WebPaymentCoordinator::cancelPaymentSession): Ditto.
195         (WebKit::WebPaymentCoordinator::messageSenderConnection const): Added. Returns a connection
196         to the network process if Apple Pay Remote UI is enabled. Otherwise, returned the web
197         process's parent connection.
198         (WebKit::WebPaymentCoordinator::messageSenderDestinationID const): Added. Returns the web
199         page's ID.
200         (WebKit::WebPaymentCoordinator::remoteUIEnabled const): Added. Calls Settings::applePayRemoteUIEnabled.
201         * WebProcess/ApplePay/WebPaymentCoordinator.h: Inherited from IPC::MessageSender.
202
203         * WebProcess/Network/NetworkProcessConnection.cpp:
204         (WebKit::NetworkProcessConnection::didReceiveMessage): Forwarded WebPaymentCoordinator
205         messages to the payment coordinator of the web page matching the decoder's destination ID.
206         (WebKit::NetworkProcessConnection::didReceiveSyncMessage): Ditto for sync messages.
207
208         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
209         (WebKit::WebPage::paymentCoordinator): Added a payment coordinator getter.
210         * WebProcess/WebPage/WebPage.h: Ditto.
211
212         * WebProcess/WebProcess.cpp:
213         (WebKit::WebProcess::networkProcessConnectionClosed): Called
214         WebPaymentCoordinator::networkProcessConnectionClosed when the network process connection
215         closes.
216
217 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
218
219         [iOS] Block access to backboardd service
220         https://bugs.webkit.org/show_bug.cgi?id=195484
221
222         Reviewed by Brent Fulgham.
223
224         This patch is addressing blocking the backboardd service "com.apple.backboard.hid.services". Getting the
225         backlight level in the WebContent process will initiate a connection with this service. To be able to
226         block the service, the backlight level is queried in the UI process and sent to the WebContent process
227         when the WebContent process is started, and when the backlight level is changed. On the WebContent side,
228         the method getting the backlight level is swizzled to return the value sent from the UI process.
229
230         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
231         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
232         (WebKit::WebProcessPool::displayBrightness):
233         (WebKit::WebProcessPool::backlightLevelDidChangeCallback):
234         (WebKit::WebProcessPool::registerNotificationObservers):
235         (WebKit::WebProcessPool::unregisterNotificationObservers):
236         * UIProcess/WebProcessPool.cpp:
237         (WebKit::WebProcessPool::initializeNewWebProcess):
238         * UIProcess/WebProcessPool.h:
239         * WebProcess/WebProcess.h:
240         * WebProcess/WebProcess.messages.in:
241         * WebProcess/cocoa/WebProcessCocoa.mm:
242         (WebKit::currentBacklightLevel):
243         (WebKit::WebProcess::backlightLevelDidChange):
244
245 2019-03-11  Brent Fulgham  <bfulgham@apple.com>
246
247         Remove obsolete runtime flag for StorageAccess API Prompt
248         https://bugs.webkit.org/show_bug.cgi?id=195564
249         <rdar://problem/37279014>
250
251         Reviewed by Chris Dumez.
252
253         This bug tracks the work of removing the obsolete flag that had been used to optionally
254         prevent display of the StorageAccess API prompt. We have since shipped the final version
255         of this feature with an always-on prompt, and should have removed this runtime flag.
256
257         No test changes because this has no change in behavior. Tests already assume the prompt
258         behavior, and did not test turning the flag off.
259
260         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
261         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
262         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
263         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
264         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
265         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
266         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
267         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
268         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
269         (WebKit::ResourceLoadStatisticsStore::debugModeEnabled const):
270         (WebKit::ResourceLoadStatisticsStore::storageAccessPromptsEnabled const): Deleted.
271         (WebKit::ResourceLoadStatisticsStore::setStorageAccessPromptsEnabled): Deleted.
272         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
273         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted):
274         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
275         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
276         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
277         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
278         * NetworkProcess/NetworkConnectionToWebProcess.h:
279         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
280         * NetworkProcess/NetworkProcess.cpp:
281         (WebKit::NetworkProcess::requestStorageAccess):
282         (WebKit::NetworkProcess::requestStorageAccessGranted):
283         * NetworkProcess/NetworkProcess.h:
284         * NetworkProcess/NetworkProcess.messages.in:
285         * Shared/WebPreferences.yaml:
286         * UIProcess/API/C/WKPreferences.cpp:
287         (WKPreferencesSetStorageAccessPromptsEnabled): Deleted.
288         (WKPreferencesGetStorageAccessPromptsEnabled): Deleted.
289         * UIProcess/API/C/WKPreferencesRef.h:
290         * UIProcess/API/Cocoa/WKPreferences.mm:
291         (-[WKPreferences _storageAccessPromptsEnabled]): Deleted.
292         (-[WKPreferences _setStorageAccessPromptsEnabled:]): Deleted.
293         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
294         * UIProcess/Network/NetworkProcessProxy.cpp:
295         (WebKit::NetworkProcessProxy::requestStorageAccess):
296         * UIProcess/Network/NetworkProcessProxy.h:
297         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
298         (WebKit::WebsiteDataStore::requestStorageAccess):
299         * UIProcess/WebsiteData/WebsiteDataStore.h:
300         * WebProcess/WebPage/WebPage.cpp:
301         (WebKit::WebPage::requestStorageAccess):
302
303 2019-03-11  Alex Christensen  <achristensen@webkit.org>
304
305         Add a WKContentRuleList variant that uses copied memory instead of mmap'd shared memory for class A containerized apps
306         https://bugs.webkit.org/show_bug.cgi?id=195511
307         <rdar://problem/44873269>
308
309         Reviewed by Darin Adler.
310
311         * NetworkProcess/NetworkContentRuleListManager.cpp:
312         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
313         * NetworkProcess/NetworkContentRuleListManager.h:
314         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
315         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting):
316         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting):
317         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
318         * NetworkProcess/cache/NetworkCacheFileSystem.h:
319         * Shared/WebCompiledContentRuleList.cpp:
320         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const):
321         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
322         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
323         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
324         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
325         (WebKit::WebCompiledContentRuleList::actions const):
326         * Shared/WebCompiledContentRuleList.h:
327         * Shared/WebCompiledContentRuleListData.cpp:
328         (WebKit::WebCompiledContentRuleListData::size const):
329         (WebKit::WebCompiledContentRuleListData::dataPointer const):
330         (WebKit::WebCompiledContentRuleListData::encode const):
331         (WebKit::WebCompiledContentRuleListData::decode):
332         * Shared/WebCompiledContentRuleListData.h:
333         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
334         * UIProcess/API/APIContentRuleList.cpp:
335         (API::ContentRuleList::usesCopiedMemory const):
336         * UIProcess/API/APIContentRuleList.h:
337         * UIProcess/API/APIContentRuleListStore.cpp:
338         (API::getData):
339         (API::decodeContentRuleListMetaData):
340         (API::ContentRuleListStore::readContentsOfFile):
341         (API::MappedOrCopiedData::dataPointer const):
342         (API::openAndMapOrCopyContentRuleList):
343         (API::compiledToFile):
344         (API::createExtension):
345         (API::ContentRuleListStore::lookupContentRuleList):
346         (API::ContentRuleListStore::compileContentRuleList):
347         (API::ContentRuleListStore::getContentRuleListSource):
348         (API::openAndMapContentRuleList): Deleted.
349         * UIProcess/API/APIContentRuleListStore.h:
350         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
351         (API::ContentRuleListStore::readContentsOfFile):
352         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
353         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]):
354         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
355         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
356         (-[_WKUserContentFilter usesCopiedMemory]):
357         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
358         * WebProcess/UserContent/WebUserContentController.cpp:
359         (WebKit::WebUserContentController::addContentRuleLists):
360         * WebProcess/UserContent/WebUserContentController.h:
361         * WebProcess/WebPage/WebPage.cpp:
362         (WebKit::m_hostFileDescriptor):
363
364 2019-03-11  Chris Dumez  <cdumez@apple.com>
365
366         Unreviewed, fix assertions in layout tests on iOS Simulator after r242666.
367
368         Log an error but do not crash if we fail to acquire a ProcessAssertion.
369
370         * UIProcess/ios/ProcessAssertionIOS.mm:
371         (WebKit::ProcessAssertion::ProcessAssertion):
372
373 2019-03-11  Chris Dumez  <cdumez@apple.com>
374
375         WebProcessCache should keep track of processes being added
376         https://bugs.webkit.org/show_bug.cgi?id=195538
377
378         Reviewed by Geoffrey Garen.
379
380         WebProcessCache should keep track of processes being added, while they are being
381         checked for responsiveness. This is useful so that:
382         - Requests to clear the cache also clear processes being added
383         - Requests to remove a given process from the cache (either because it crashed
384           or because it is being used for a history navigation) actually remove the
385           process if it is still being checked for responsiveness.
386         - The cached process eviction timer applies to such processes in case something
387           goes wrong with the code and the pending request does not get processed.
388
389         * UIProcess/WebProcessCache.cpp:
390         (WebKit::generateAddRequestIdentifier):
391         (WebKit::WebProcessCache::addProcessIfPossible):
392         (WebKit::WebProcessCache::addProcess):
393         (WebKit::WebProcessCache::clear):
394         (WebKit::WebProcessCache::clearAllProcessesForSession):
395         (WebKit::WebProcessCache::removeProcess):
396         (WebKit::WebProcessCache::CachedProcess::evictionTimerFired):
397         (WebKit::WebProcessCache::evictProcess): Deleted.
398         * UIProcess/WebProcessCache.h:
399         (WebKit::WebProcessCache::size const):
400         * UIProcess/WebProcessPool.cpp:
401         (WebKit::WebProcessPool::processForNavigationInternal):
402         * UIProcess/WebProcessProxy.cpp:
403         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
404
405 2019-03-11  Alex Christensen  <achristensen@webkit.org>
406
407         REGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm is crashing
408         https://bugs.webkit.org/show_bug.cgi?id=194523
409
410         Reviewed by Alexey Proskuryakov.
411
412         Attempt another workaround to prevent crashes.
413
414         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
415         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
416         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
417         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
418         (-[WKNetworkSessionDelegate URLSession:task:needNewBodyStream:]):
419
420 2019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
421
422         Unreviewed, rolling out r242688, r242643, r242624.
423
424         Caused multiple layout test failures and crashes on iOS and macOS.
425
426         Reverted changeset:
427
428         "requestAnimationFrame should execute before the next frame"
429         https://bugs.webkit.org/show_bug.cgi?id=177484
430         https://trac.webkit.org/changeset/242624/webkit
431
432         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
433         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
434         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
435         (WebKit::DrawingAreaCoordinatedGraphics::display):
436         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
437         (WebKit::LayerTreeHost::layerFlushTimerFired):
438         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
439         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
440         * WebProcess/WebPage/WebPage.cpp:
441         (WebKit::WebPage::layoutIfNeeded):
442         (WebKit::WebPage::willDisplayPage):
443         (WebKit::WebPage::renderingUpdate): Deleted.
444         * WebProcess/WebPage/WebPage.h:
445         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
446         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
447
448 2019-03-11  Darin Adler  <darin@apple.com>
449
450         Specify fixed precision explicitly to prepare to change String::number and StringBuilder::appendNumber floating point behavior
451         https://bugs.webkit.org/show_bug.cgi?id=195533
452
453         Reviewed by Brent Fulgham.
454
455         * NetworkProcess/cache/NetworkCache.cpp:
456         (WebKit::NetworkCache::Cache::dumpContentsToFile): Use appendFixedPrecisionNumber.
457         * NetworkProcess/cache/NetworkCacheEntry.cpp:
458         (WebKit::NetworkCache::Entry::asJSON const): Ditto.
459         * Shared/Gamepad/GamepadData.cpp:
460         (WebKit::GamepadData::loggingString const): Ditto.
461         * UIProcess/WebPageProxy.cpp:
462         (WebKit::WebPageProxy::logDiagnosticMessageWithValue): Use numberToStringFixedPrecision.
463
464 2019-03-11  John Wilander  <wilander@apple.com>
465
466         Resource Load Statistics: Make it possible exclude localhost from classification
467         https://bugs.webkit.org/show_bug.cgi?id=195474
468         <rdar://problem/47520577>
469
470         Reviewed by Brent Fulgham.
471
472         This patch allows for localhost to be excluded from classification and
473         treatment as a prevalent resource.
474
475         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
476         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
477         (WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
478             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
479         (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
480             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
481         (WebKit::ResourceLoadStatisticsDatabaseStore::isPrevalentResource const):
482             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
483         (WebKit::ResourceLoadStatisticsDatabaseStore::isVeryPrevalentResource const):
484             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
485         (WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource):
486             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
487         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
488         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
489         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
490         (WebKit::ResourceLoadStatisticsMemoryStore::classifyPrevalentResources):
491             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
492         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResource):
493             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
494         (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentResource const):
495             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
496         (WebKit::ResourceLoadStatisticsMemoryStore::isVeryPrevalentResource const):
497             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
498         (WebKit::ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource):
499             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
500         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
501         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
502         (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
503             Now takes a ShouldIncludeLocalhost parameter.
504         (WebKit::ResourceLoadStatisticsStore::shouldSkip const):
505             Convenience function, currently supporting the localhost exclusion.
506         (WebKit::ResourceLoadStatisticsStore::setIsRunningTest):
507             Test infrastructure.
508         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
509         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
510         (WebKit::WebResourceLoadStatisticsStore::setIsRunningTest):
511             Test infrastructure.
512         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
513             Now takes a ShouldIncludeLocalhost parameter.
514         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
515             Defines the new ShouldIncludeLocalhost boolean enum.
516         * NetworkProcess/NetworkProcess.cpp:
517         (WebKit::NetworkProcess::setIsRunningResourceLoadStatisticsTest):
518             Test infrastructure.
519         * NetworkProcess/NetworkProcess.h:
520         * NetworkProcess/NetworkProcess.messages.in:
521         * NetworkProcess/NetworkSession.cpp:
522         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
523             Forwards the localhost setting to the create function.
524         * NetworkProcess/NetworkSession.h:
525         * NetworkProcess/NetworkSessionCreationParameters.cpp:
526         (WebKit::NetworkSessionCreationParameters::encode const):
527         (WebKit::NetworkSessionCreationParameters::decode):
528         * NetworkProcess/NetworkSessionCreationParameters.h:
529             New parameter called shouldIncludeLocalhostInResourceLoadStatistics.
530         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
531         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
532             Picks up the localhost setting from the parameters.
533         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
534         (WKWebsiteDataStoreSetStatisticsIsRunningTest):
535             Test infrastructure.
536         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
537         * UIProcess/Network/NetworkProcessProxy.cpp:
538         (WebKit::NetworkProcessProxy::setIsRunningResourceLoadStatisticsTest):
539             Test infrastructure.
540         * UIProcess/Network/NetworkProcessProxy.h:
541         * UIProcess/WebProcessPool.cpp:
542         (WebKit::WebProcessPool::ensureNetworkProcess):
543             Picks up the localhost setting from the WebsiteDataStore parameters.
544         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
545         (WebKit::WebsiteDataStore::parameters):
546             Makes sure Safari does not exclude localhost.
547         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
548         (WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest):
549             Test infrastructure.
550         * UIProcess/WebsiteData/WebsiteDataStore.h:
551
552 2019-03-11  Alex Christensen  <achristensen@webkit.org>
553
554         Unreviewed, rolling out r242698.
555
556         API test crashes on bots.
557
558         Reverted changeset:
559
560         "Add a WKContentRuleList variant that uses copied memory
561         instead of mmap'd shared memory for class A containerized
562         apps"
563         https://bugs.webkit.org/show_bug.cgi?id=195511
564         https://trac.webkit.org/changeset/242698
565
566 2019-03-11  Michael Catanzaro  <mcatanzaro@igalia.com>
567
568         [WPE] Enable web process sandbox
569         https://bugs.webkit.org/show_bug.cgi?id=195169
570
571         Reviewed by Daniel Bates.
572
573         * PlatformWPE.cmake:
574         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
575         (WebKit::bubblewrapSpawn):
576
577 2019-03-11  Truitt Savell  <tsavell@apple.com>
578
579         Unreviewed, rolling out r242697.
580
581         Broke internal builders.
582
583         Reverted changeset:
584
585         "Optimizing loads when creating new pages"
586         https://bugs.webkit.org/show_bug.cgi?id=195516
587         https://trac.webkit.org/changeset/242697
588
589 2019-03-10  Alex Christensen  <achristensen@webkit.org>
590
591         Add a WKContentRuleList variant that uses copied memory instead of mmap'd shared memory for class A containerized apps
592         https://bugs.webkit.org/show_bug.cgi?id=195511
593         <rdar://problem/44873269>
594
595         Reviewed by Darin Adler.
596
597         * NetworkProcess/NetworkContentRuleListManager.cpp:
598         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
599         * NetworkProcess/NetworkContentRuleListManager.h:
600         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
601         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting):
602         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting):
603         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
604         * NetworkProcess/cache/NetworkCacheFileSystem.h:
605         * Shared/WebCompiledContentRuleList.cpp:
606         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const):
607         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
608         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
609         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
610         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
611         (WebKit::WebCompiledContentRuleList::actions const):
612         * Shared/WebCompiledContentRuleList.h:
613         * Shared/WebCompiledContentRuleListData.cpp:
614         (WebKit::WebCompiledContentRuleListData::size const):
615         (WebKit::WebCompiledContentRuleListData::dataPointer const):
616         (WebKit::WebCompiledContentRuleListData::encode const):
617         (WebKit::WebCompiledContentRuleListData::decode):
618         * Shared/WebCompiledContentRuleListData.h:
619         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
620         * UIProcess/API/APIContentRuleList.cpp:
621         (API::ContentRuleList::usesCopiedMemory const):
622         * UIProcess/API/APIContentRuleList.h:
623         * UIProcess/API/APIContentRuleListStore.cpp:
624         (API::getData):
625         (API::decodeContentRuleListMetaData):
626         (API::ContentRuleListStore::readContentsOfFile):
627         (API::MappedOrCopiedData::dataPointer const):
628         (API::openAndMapOrCopyContentRuleList):
629         (API::compiledToFile):
630         (API::createExtension):
631         (API::ContentRuleListStore::lookupContentRuleList):
632         (API::ContentRuleListStore::compileContentRuleList):
633         (API::ContentRuleListStore::getContentRuleListSource):
634         (API::openAndMapContentRuleList): Deleted.
635         * UIProcess/API/APIContentRuleListStore.h:
636         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
637         (API::ContentRuleListStore::readContentsOfFile):
638         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
639         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]):
640         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
641         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
642         (-[_WKUserContentFilter usesCopiedMemory]):
643         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
644         * WebProcess/UserContent/WebUserContentController.cpp:
645         (WebKit::WebUserContentController::addContentRuleLists):
646         * WebProcess/UserContent/WebUserContentController.h:
647         * WebProcess/WebPage/WebPage.cpp:
648         (WebKit::m_hostFileDescriptor):
649
650 2019-03-10  Jiewen Tan  <jiewen_tan@apple.com>
651
652         Optimizing loads when creating new pages
653         https://bugs.webkit.org/show_bug.cgi?id=195516
654         <rdar://problem/48738086>
655
656         Reviewed by Darin Adler.
657
658         This patch adds hooks in WebPageProxy::createNewPage to optimize loads, and moves the creationParameters
659         of API::NavigationAction from UI clients to WebPageProxy::createNewPage. Also, we now pass the whole
660         API::NavigationAction to the load optimizer instead of the request within.
661
662         * UIProcess/API/APINavigationAction.h:
663         * UIProcess/API/APIUIClient.h:
664         (API::UIClient::createNewPage):
665         * UIProcess/API/C/WKPage.cpp:
666         (WKPageSetPageUIClient):
667         * UIProcess/API/glib/WebKitUIClient.cpp:
668         * UIProcess/Cocoa/NavigationState.mm:
669         (WebKit::tryOptimizingLoad):
670         (WebKit::tryInterceptNavigation):
671         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
672         * UIProcess/Cocoa/UIDelegate.h:
673         * UIProcess/Cocoa/UIDelegate.mm:
674         (WebKit::UIDelegate::UIClient::createNewPage):
675         * UIProcess/WebPageProxy.cpp:
676         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
677         (WebKit::tryOptimizingLoad):
678         (WebKit::WebPageProxy::createNewPage):
679         * UIProcess/WebPageProxy.h:
680
681 2019-03-10  Tim Horton  <timothy_horton@apple.com>
682
683         Add SPI to retrieve the set of text inputs in a given rect, and later focus one
684         https://bugs.webkit.org/show_bug.cgi?id=195499
685
686         Reviewed by Darin Adler.
687
688         * Scripts/webkit/messages.py:
689         * Shared/TextInputContext.cpp: Added.
690         (IPC::ArgumentCoder<WebKit::TextInputContext>::encode):
691         (IPC::ArgumentCoder<WebKit::TextInputContext>::decode):
692         * Shared/TextInputContext.h: Added.
693         (WebKit::TextInputContext::operator== const):
694         Add TextInputContext, which represents a minimal set of information
695         about a text field.
696
697         * Sources.txt:
698         * SourcesCocoa.txt:
699         * UIProcess/API/Cocoa/WKWebView.mm:
700         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
701         (-[WKWebView _focusTextInputContext:completionHandler:]):
702         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
703         Add SPI that allows clients to asynchronously request text input
704         contexts for a given rect, and later focus a given context.
705
706         * UIProcess/API/Cocoa/_WKTextInputContext.h: Added.
707         * UIProcess/API/Cocoa/_WKTextInputContext.mm: Added.
708         (-[_WKTextInputContext _initWithTextInputContext:]):
709         (-[_WKTextInputContext boundingRect]):
710         (-[_WKTextInputContext _textInputContext]):
711         (-[_WKTextInputContext isEqual:]):
712         (-[_WKTextInputContext hash]):
713         (-[_WKTextInputContext copyWithZone:]):
714         * UIProcess/API/Cocoa/_WKTextInputContextInternal.h: Added.
715         Add an SPI object that exposes a read-only window on a TextInputContext to clients.
716
717         * UIProcess/WebPageProxy.cpp:
718         (WebKit::WebPageProxy::textInputContextsInRect):
719         (WebKit::WebPageProxy::focusTextInputContext):
720         * UIProcess/WebPageProxy.h:
721         Plumbing from WKWebView<->WebPage.
722
723         * WebKit.xcodeproj/project.pbxproj:
724         * WebProcess/WebPage/WebPage.cpp:
725         (WebKit::elementRectInWindowCoordinates):
726         (WebKit::isEditableTextInputElement):
727         (WebKit::WebPage::textInputContextsInRect):
728         Search the DOM for text input contexts: <input type='text'> (or other
729         form fields that fall back on text field behavior), <textarea>, and
730         contenteditable roots. Store the WebPage, Document, and Element identifiers
731         so that we can find the element again later.
732
733         (WebKit::WebPage::focusTextInputContext):
734         Find the element for a given (web page, document, element) triple and focus it,
735         if it's still available.
736
737         * WebProcess/WebPage/WebPage.h:
738         * WebProcess/WebPage/WebPage.messages.in:
739
740 2019-03-10  Tim Horton  <timothy_horton@apple.com>
741
742         iOS: Using ⌥ to scroll horizontally is no different than arrow key
743         https://bugs.webkit.org/show_bug.cgi?id=195268
744         <rdar://problem/48326682>
745
746         Reviewed by Brent Fulgham.
747
748         * UIProcess/ios/WKContentViewInteraction.mm:
749         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:inDirection:]):
750         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:]): Deleted.
751         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
752         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
753         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
754         (-[WKKeyboardScrollViewAnimator setDelegate:]):
755         (-[WKKeyboardScrollViewAnimator distanceForIncrement:inDirection:]):
756         (-[WKKeyboardScrollViewAnimator distanceForIncrement:]): Deleted.
757         Add a direction parameter to -distanceForIncrement:, so the client
758         can return a different page/document size based on the scrolling axis.
759         Adopt it both in the default implementation and in WKContentViewInteraction.
760         Make the option key scroll by page when scrolling horizontally, like it
761         does when scrolling vertically.
762
763 2019-03-10  David Quesada  <david_quesada@apple.com>
764
765         ASSERT(m_downloads.isEmpty()) fails in DownloadProxyMap::~DownloadProxyMap()
766         https://bugs.webkit.org/show_bug.cgi?id=152480
767
768         Reviewed by Chris Dumez.
769
770         * UIProcess/Downloads/DownloadProxyMap.cpp:
771         (WebKit::DownloadProxyMap::downloadFinished):
772             If the DownloadProxy is holding the last reference to the process pool, then
773             invalidating the proxy will cause the process pool, the network process proxy,
774             and this DownloadProxyMap to deallocate. Ensure that doesn't happen until this
775             method has done everything it wants to do to clean up.
776
777 2019-03-10  Wenson Hsieh  <wenson_hsieh@apple.com>
778
779         Fix some misleading function and variable names in WKContentViewInteraction.mm
780         https://bugs.webkit.org/show_bug.cgi?id=195536
781
782         Reviewed by Tim Horton.
783
784         * UIProcess/ios/WKContentViewInteraction.mm:
785         (shouldDeferZoomingToSelectionWhenRevealingFocusedElement):
786
787         Rename shouldZoomToRevealSelectionRect to shouldDeferZoomingToSelectionWhenRevealingFocusedElement; this
788         function is used to determine whether we should zoom to the selection rect when revealing the focused element,
789         and therefore affects whether we need to defer zooming until we get selection information.
790
791         (rectToRevealWhenZoomingToFocusedElement):
792         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
793
794         Rename shouldShowKeyboard to shouldShowInputView; this boolean indicates whether we should show not only the
795         keyboard, but other UI for user input such as date and select pickers.
796
797         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
798         (shouldZoomToRevealSelectionRect): Deleted.
799
800 2019-03-10  Simon Fraser  <simon.fraser@apple.com>
801
802         ScrollingTree should have the final say on where layers go
803         https://bugs.webkit.org/show_bug.cgi?id=195507
804
805         Reviewed by Antti Koivisto.
806
807         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
808         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
809         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
810         (WebKit::RemoteScrollingCoordinatorProxy::applyScrollingTreeLayerPositions):
811         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
812         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
813         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
814
815 2019-03-09  Darin Adler  <darin@apple.com>
816
817         [Cocoa] Code signing fails because services are copied into XPCServices after the framework is signed
818         https://bugs.webkit.org/show_bug.cgi?id=195523
819
820         Reviewed by Dan Bernstein.
821
822         * WebKit.xcodeproj/project.pbxproj: Make symbolic links while building the WebKit
823         framework instead of copying in the services after the framework is built.
824
825 2019-03-09  Wenson Hsieh  <wenson_hsieh@apple.com>
826
827         REGRESSION (r242551): Sporadic hangs when tapping to change selection on iOS
828         https://bugs.webkit.org/show_bug.cgi?id=195475
829         <rdar://problem/48721153>
830
831         Reviewed by Chris Dumez.
832
833         r242551 refactored synchronous autocorrection context requests to send an async IPC message and then use
834         waitForAndDispatchImmediately, instead of calling sendSync. However, this exposes a couple of existing issues in
835         the implementation of waitForAndDispatchImmediately that causes sporadic IPC deadlocks when changing selection.
836
837         First, passing in InterruptWaitingIfSyncMessageArrives when synchronously waiting for an IPC message currently
838         does not fulfill its intended behavior of interrupting waiting when a sync message arrives. This is because sync
839         IPC messages, by default, may be dispatched while the receiver is waiting for a sync reply. This means that the
840         logic in Connection::SyncMessageState::processIncomingMessage to dispatch an incoming sync message on the main
841         thread will attempt to handle the incoming message by enqueueing it on the main thread, and then waking up the
842         client runloop (i.e. signaling m_waitForSyncReplySemaphore). This works in the case of sendSync since the sync
843         reply semaphore is used to block the main thread, but in the case of waitForAndDispatchImmediately, a different
844         m_waitForMessageCondition is used instead, so SyncMessageState::processIncomingMessage will only enqueue the
845         incoming sync message on the main thread, and not actually invoke it.
846
847         To fix this first issue, observe that there is pre-existing logic to enqueue the incoming message and signal
848         m_waitForMessageCondition in Connection::processIncomingMessage. This codepath is currently not taken because we
849         end up bailing early in the call to SyncMessageState::processIncomingMessage. Instead, we can move this early
850         return further down in the function, such that if there is an incoming sync message and we're waiting with the
851         InterruptWaitingIfSyncMessageArrives option, we will correctly enqueue the incoming message, wake the runloop,
852         and proceed to handle the incoming message.
853
854         The second issue is more subtle; consider the scenario in which we send a sync message A from the web process to
855         the UI process, and simultaneously, in the UI process, we schedule some work to be done on the main thread.
856         Let's additionally suppose that this scheduled work will send an IPC message B to the web process and
857         synchronously wait for a reply (in the case of this particular bug, this is the sync autocorrection context
858         request). What happens upon receiving sync message A is that the IPC thread in the UI process will schedule A on
859         the main thread; however, before the scheduled response to A is invoked, we will first invoke previously
860         scheduled work that attempts to block synchronously until a message B is received. In summary:
861
862         1. (Web process)    sends sync IPC message A to UI process.
863         2. (UI process)     schedules some main runloop task that will block synchronously on IPC message B.
864         3. (UI process)     receives sync IPC message A and schedules A on the main runloop.
865         4. (UI process)     carry out the task scheduled in (2) and block on B.
866
867         ...and then, the UI process and web process are now deadlocked because the UI process is waiting for B to
868         arrive, but the web process can't send B because it's waiting for a reply for IPC message A! To fix this second
869         deadlock, we first make an important observation: when using sendSync, we don't run into this problem because
870         immediately before sending sync IPC, we will attempt to handle any incoming sync IPC messages that have been
871         queued up. However, when calling waitForAndDispatchImmediately, we don't have this extra step, so a deadlock may
872         occur in the manner described above. To fix this, we make waitForAndDispatchImmediately behave more like
873         sendSync, by handling all incoming sync messages prior to blocking on an IPC response.
874
875         Test: editing/selection/ios/change-selection-by-tapping.html
876
877         * Platform/IPC/Connection.cpp:
878         (IPC::Connection::waitForMessage):
879         (IPC::Connection::processIncomingMessage):
880
881 2019-03-09  Andy Estes  <aestes@apple.com>
882
883         [Apple Pay] CanMakePaymentsWithActiveCard and OpenPaymentSetup should be async messages
884         https://bugs.webkit.org/show_bug.cgi?id=195526
885         <rdar://problem/48745636>
886
887         Reviewed by Chris Dumez.
888
889         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
890         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard):
891         (WebKit::WebPaymentCoordinatorProxy::openPaymentSetup):
892         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
893         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
894         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
895         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard):
896         (WebKit::WebPaymentCoordinator::openPaymentSetup):
897         (WebKit::generateCanMakePaymentsWithActiveCardReplyID): Deleted.
898         (WebKit::generateOpenPaymentSetupReplyID): Deleted.
899         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCardReply): Deleted.
900         (WebKit::WebPaymentCoordinator::openPaymentSetupReply): Deleted.
901         * WebProcess/ApplePay/WebPaymentCoordinator.h:
902         * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
903
904 2019-03-09  Andy Estes  <aestes@apple.com>
905
906         [iOS] Remove unneeded entitlements and sandbox allowances from the Networking service
907         https://bugs.webkit.org/show_bug.cgi?id=195527
908
909         Reviewed by Eric Carlson.
910
911         * Configurations/Network-iOS.entitlements:
912         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
913
914 2019-03-09  Chris Dumez  <cdumez@apple.com>
915
916         Use modern async IPC with reply for device orientation permission
917         https://bugs.webkit.org/show_bug.cgi?id=195529
918
919         Reviewed by Ryosuke Niwa.
920
921         * UIProcess/WebPageProxy.cpp:
922         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
923         * UIProcess/WebPageProxy.h:
924         * UIProcess/WebPageProxy.messages.in:
925         * WebProcess/WebPage/WebPage.cpp:
926         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
927         (WebKit::nextDeviceOrientationAndMotionPermissionCallbackID): Deleted.
928         (WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision): Deleted.
929         * WebProcess/WebPage/WebPage.h:
930         * WebProcess/WebPage/WebPage.messages.in:
931
932 2019-03-09  Zalan Bujtas  <zalan@apple.com>
933
934         [ContentChangeObserver] Start observing for content change between touchEnd and mouseMoved start
935         https://bugs.webkit.org/show_bug.cgi?id=195510
936         <rdar://problem/48735695>
937
938         Reviewed by Simon Fraser.
939
940         * WebProcess/WebPage/ios/WebPageIOS.mm:
941         (WebKit::WebPage::cancelPotentialTapInFrame):
942
943 2019-03-08  Chris Dumez  <cdumez@apple.com>
944
945         Enable ProcessAssertions on iOS Simulator
946         https://bugs.webkit.org/show_bug.cgi?id=195479
947
948         Reviewed by Alexey Proskuryakov.
949
950         Enable ProcessAssertions on iOS Simulator. We have some layout tests timing out in the
951         iOS Simulator due to the WebContent process suspending. Turning on ProcessAssertions in
952         the iOS Simulator seems to make those tests pass.
953
954         * UIProcess/ProcessAssertion.cpp:
955         * UIProcess/ProcessAssertion.h:
956         * UIProcess/ios/ProcessAssertionIOS.mm:
957
958 2019-03-08  Chris Dumez  <cdumez@apple.com>
959
960         Add support for Device Orientation / Motion permission API
961         https://bugs.webkit.org/show_bug.cgi?id=195329
962         <rdar://problem/47645367>
963
964         Reviewed by Geoffrey Garen.
965
966         Add support for Device Orientation / Motion permission API:
967         - https://github.com/w3c/deviceorientation/issues/57
968
969         This adds new SPI to WKUIDelegatePrivate, until we can make this API.
970
971         * Shared/WebPreferences.yaml:
972         * UIProcess/API/APIUIClient.h:
973         (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
974         * UIProcess/API/C/WKPage.cpp:
975         (WKPageSetPageUIClient):
976         * UIProcess/API/C/WKPageUIClient.h:
977         * UIProcess/API/Cocoa/WKUIDelegate.h:
978         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
979         * UIProcess/Cocoa/UIDelegate.h:
980         * UIProcess/Cocoa/UIDelegate.mm:
981         (WebKit::UIDelegate::setDelegate):
982         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
983         * UIProcess/WebPageProxy.cpp:
984         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
985         * UIProcess/WebPageProxy.h:
986         * UIProcess/WebPageProxy.messages.in:
987         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
988         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
989         * WebProcess/WebCoreSupport/WebChromeClient.h:
990         * WebProcess/WebPage/WebPage.cpp:
991         (WebKit::nextDeviceOrientationAndMotionPermissionCallbackID):
992         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
993         (WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision):
994         * WebProcess/WebPage/WebPage.h:
995         * WebProcess/WebPage/WebPage.messages.in:
996
997 2019-03-08  Brady Eidson  <beidson@apple.com>
998
999         Have the UIProcess take the UnboundedNetworking assertion when downloads are in progress.
1000         https://bugs.webkit.org/show_bug.cgi?id=195468
1001
1002         Reviewed by Andy Estes.
1003
1004         * UIProcess/Downloads/DownloadProxyMap.cpp:
1005         (WebKit::DownloadProxyMap::DownloadProxyMap):
1006         (WebKit::DownloadProxyMap::createDownloadProxy): If this is the first download, and the process has the entitlement,
1007           take the assertion.
1008         (WebKit::DownloadProxyMap::downloadFinished):
1009         (WebKit::DownloadProxyMap::processDidClose):
1010         * UIProcess/Downloads/DownloadProxyMap.h:
1011
1012 2019-03-08  Chris Dumez  <cdumez@apple.com>
1013
1014         Add assertions to help debug a WebProcessCache crash
1015         https://bugs.webkit.org/show_bug.cgi?id=195469
1016
1017         Reviewed by Brady Eidson.
1018
1019         I suspect the process's registrableDomain in null when evictProcess() gets
1020         called, thus crashing when lookup it up in the HashMap. Confirm this and
1021         how this could happen via assertions.
1022
1023         * UIProcess/WebProcessCache.cpp:
1024         (WebKit::WebProcessCache::evictProcess):
1025         * UIProcess/WebProcessProxy.cpp:
1026         (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
1027
1028 2019-03-08  Brady Eidson  <beidson@apple.com>
1029
1030         Rename AssertionState::Download.
1031         https://bugs.webkit.org/show_bug.cgi?id=195465
1032
1033         Reviewed by Andy Estes.
1034
1035         It's (currently) about uploads and downloads.
1036         Let's call it "UnboundedNetworking"
1037
1038         * NetworkProcess/Downloads/DownloadMap.cpp:
1039         (WebKit::DownloadMap::add):
1040
1041         * UIProcess/ProcessAssertion.h:
1042
1043         * UIProcess/WebProcessProxy.cpp:
1044         (WebKit::WebProcessProxy::didSetAssertionState):
1045
1046         * UIProcess/ios/ProcessAssertionIOS.mm:
1047         (WebKit::flagsForState):
1048         (WebKit::reasonForState):
1049
1050 2019-03-08  Simon Fraser  <simon.fraser@apple.com>
1051
1052         [macOS UI-side compositing] Mouse handling can trigger a crash before we have a scrolling tree root
1053         https://bugs.webkit.org/show_bug.cgi?id=195467
1054
1055         Reviewed by Antti Koivisto.
1056         
1057         When launching MiniBrowser with UI-side compositing enabled in a state where the window
1058         appears under the mouse, we can hit RemoteScrollingTree::handleMouseEvent() for a mouseEnter
1059         event before we have a scrolling tree root node, so add a null check.
1060
1061         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
1062         (WebKit::RemoteScrollingTree::handleMouseEvent):
1063
1064 2019-03-08  Carlos Garcia Campos  <cgarcia@igalia.com>
1065
1066         REGRESSION(r242624): [GTK] New rAF code path assumes AC mode
1067         https://bugs.webkit.org/show_bug.cgi?id=195459
1068
1069         Reviewed by Žan Doberšek.
1070
1071         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
1072         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
1073         The refresh monitor now calls scheduleLayerFlush() but when AC
1074         mode is disabled this method does nothing, so setNeedsDisplay()
1075         needs to be called instead.
1076
1077 2019-03-07  Tim Horton  <timothy_horton@apple.com>
1078
1079         Crash under RemoteLayerTreePropertyApplier::applyProperties
1080         https://bugs.webkit.org/show_bug.cgi?id=195448
1081         <rdar://problem/48588226>
1082
1083         Reviewed by Simon Fraser.
1084
1085         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1086         (WebKit::RemoteLayerTreeHost::updateLayerTree):
1087         Under some currently-unknown circumstances, the UI process is receiving
1088         commits referring to layers that it does not know about.
1089         One understood case of this was fixed in r241899, but there seem to be
1090         cases remaining that are not understood.
1091         Also, add a release log so that we can identify any downstream effects.
1092
1093 2019-03-07  Zalan Bujtas  <zalan@apple.com>
1094
1095         [ContentChangeObserver] Introduce fixed duration content observation
1096         https://bugs.webkit.org/show_bug.cgi?id=195295
1097         <rdar://problem/48579913>
1098
1099         Reviewed by Simon Fraser.
1100
1101         * WebProcess/WebPage/ios/WebPageIOS.mm:
1102         (WebKit::WebPage::handleSyntheticClick):
1103         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
1104
1105 2019-03-07  Fujii Hironori  <Hironori.Fujii@sony.com>
1106
1107         [WinCairo][WebKit] Nothing is drawn after Web process crashed
1108         https://bugs.webkit.org/show_bug.cgi?id=195399
1109
1110         Reviewed by Alex Christensen.
1111
1112         PageClientImpl::viewSize returned 0x0 size after Web process
1113         crashed. Restored the original implementation using GetClientRect
1114         (Bug 52175).
1115
1116         * UIProcess/win/PageClientImpl.cpp:
1117         (WebKit::PageClientImpl::viewSize):
1118
1119 2019-03-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
1120
1121         requestAnimationFrame should execute before the next frame
1122         https://bugs.webkit.org/show_bug.cgi?id=177484
1123
1124         Reviewed by Simon Fraser.
1125
1126         Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
1127         a single call to Page::renderingUpdate(). This new function implements 
1128         "Update the rendering" step of the HTML Event Loop specification
1129         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
1130
1131         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1132         (WebKit::AcceleratedDrawingArea::updateBackingStoreState):
1133         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
1134         (WebKit::LayerTreeHost::layerFlushTimerFired):
1135         * WebProcess/WebPage/DrawingAreaImpl.cpp:
1136         (WebKit::DrawingAreaImpl::display):
1137         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1138         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1139         * WebProcess/WebPage/WebPage.cpp:
1140         (WebKit::WebPage::layoutIfNeeded):
1141         (WebKit::WebPage::renderingUpdate):
1142         (WebKit::WebPage::willDisplayPage): Deleted.
1143         * WebProcess/WebPage/WebPage.h:
1144         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1145         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1146
1147 2019-03-07  Zalan Bujtas  <zalan@apple.com>
1148
1149         [ContentChangeObserver] Add a setting to be able to turn content change observation on/off
1150         https://bugs.webkit.org/show_bug.cgi?id=195353
1151         <rdar://problem/48626394>
1152
1153         Reviewed by Simon Fraser.
1154
1155         * Shared/WebPreferences.yaml:
1156         * UIProcess/API/C/WKPreferences.cpp:
1157         (WKPreferencesSetContentChangeObserverEnabled):
1158         (WKPreferencesGetContentChangeObserverEnabled):
1159         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1160         * UIProcess/API/Cocoa/WKPreferences.mm:
1161         (-[WKPreferences _contentChangeObserverEnabled]):
1162         (-[WKPreferences _setContentChangeObserverEnabled:]):
1163         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1164         * WebProcess/WebPage/ios/WebPageIOS.mm:
1165         (WebKit::WebPage::handleSyntheticClick):
1166
1167 2019-03-07  Andy Estes  <aestes@apple.com>
1168
1169         [Apple Pay] Untangle PKPaymentAuthorizationViewController from WebPaymentCoordinatorProxy
1170         https://bugs.webkit.org/show_bug.cgi?id=195349
1171         <rdar://problem/48625510>
1172
1173         Reviewed by Alex Christensen.
1174
1175         Introduced PaymentAuthorizationPresenter and WKPaymentAuthorizationDelegate to encapsulate
1176         PKPaymentAuthorizationViewController and its delegate. Taught WebPaymentCoordinatorProxy to
1177         interact with PaymentAuthorizationPresenter rather than PKPAVC directly.
1178
1179         These changes will allow us to swap out PKPaymentAuthorizationViewController with PKPaymentAuthorizationController in a follow-on patch.
1180
1181         * Platform/cocoa/PaymentAuthorizationPresenter.h: Added. Defined the abstract interface for
1182         payment authorization presenters that use PKPA(V)C.
1183         * Platform/cocoa/PaymentAuthorizationPresenter.mm: Added.
1184         (WebKit::toPKPaymentAuthorizationStatus): Moved from WebPaymentCoordinatorProxyCocoa.mm.
1185         (WebKit::toPKPaymentErrorCode): Ditto.
1186         (WebKit::toNSError): Ditto.
1187         (WebKit::toNSErrors): Ditto.
1188         (WebKit::toPKShippingMethods): Ditto.
1189         (WebKit::PaymentAuthorizationPresenter::completeMerchantValidation): Added. Implements the
1190         logic previously in WebPaymentCoordinatorProxy::platformCompleteMerchantValidation.
1191         (WebKit::PaymentAuthorizationPresenter::completePaymentMethodSelection): Ditto for
1192         WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection.
1193         (WebKit::PaymentAuthorizationPresenter::completePaymentSession): Ditto for 
1194         (WebKit::PaymentAuthorizationPresenter::completeShippingContactSelection): Ditto for
1195         WebPaymentCoordinatorProxy::platformCompletePaymentSession.
1196         (WebKit::PaymentAuthorizationPresenter::completeShippingMethodSelection): Ditto for
1197         WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection.
1198         * Platform/cocoa/PaymentAuthorizationViewController.h: Added. Defined a subclass of PaymentAuthorizationPresenter for PKPaymentAuthorizationViewController.
1199         * Platform/cocoa/PaymentAuthorizationViewController.mm: Added.
1200         (-[WKPaymentAuthorizationViewControllerDelegate initWithPresenter:]): Added a PKPAVC
1201         delegate that's a subclass of WKPaymentAuthorizationDelegate.
1202         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]):
1203         Called -[WKPaymentAuthorizationDelegate _didFinish].
1204         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]): Called
1205         -[WKPaymentAuthorizationDelegate _didAuthorizePayment:completion:].
1206         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]): Called
1207         -[WKPaymentAuthorizationDelegate _didSelectShippingMethod:completion:].
1208         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]): Called
1209         -[WKPaymentAuthorizationDelegate _didSelectShippingContact:completion:].
1210         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]): Called
1211         -[WKPaymentAuthorizationDelegate _didSelectPaymentMethod:completion:].
1212         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:willFinishWithError:]):
1213         Called -[WKPaymentAuthorizationDelegate _willFinishWithError:].
1214         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didRequestMerchantSession:]): Called
1215         -[WKPaymentAuthorizationDelegate _didRequestMerchantSession:].
1216         * Platform/cocoa/WKPaymentAuthorizationDelegate.h: Added.
1217         * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: Added.
1218         (-[WKPaymentAuthorizationDelegate summaryItems]): Added a summaryItems getter.
1219         (-[WKPaymentAuthorizationDelegate shippingMethods]): Ditto for shippingMethods.
1220         (-[WKPaymentAuthorizationDelegate completeMerchantValidation:error:]): Called
1221         _didRequestMerchantSessionCompletion then set it to nil.
1222         (-[WKPaymentAuthorizationDelegate completePaymentMethodSelection:]): Ditto for
1223         _didSelectPaymentMethodCompletion.
1224         (-[WKPaymentAuthorizationDelegate completePaymentSession:errors:didReachFinalState:]): Ditto
1225         for _didAuthorizePaymentCompletion.
1226         (-[WKPaymentAuthorizationDelegate completeShippingContactSelection:summaryItems:shippingMethods:errors:]):
1227         Ditto for _didSelectShippingContactCompletion.
1228         (-[WKPaymentAuthorizationDelegate completeShippingMethodSelection:]): Ditto for
1229         _didSelectShippingMethodCompletion.
1230         (-[WKPaymentAuthorizationDelegate invalidate]): If there's an outstanding authorization
1231         callback, called -completePaymentSession:errors:didReachFinalState: with a state of
1232         PKPaymentAuthorizationStatusFailure.
1233         (-[WKPaymentAuthorizationDelegate _initWithPresenter:]):
1234         (-[WKPaymentAuthorizationDelegate _didAuthorizePayment:completion:]): Added. Implements the
1235         logic previously in WKPaymentAuthorizationViewControllerDelegate.
1236         (-[WKPaymentAuthorizationDelegate _didFinish]): Ditto.
1237         (-[WKPaymentAuthorizationDelegate _didRequestMerchantSession:]): Ditto.
1238         (-[WKPaymentAuthorizationDelegate _didSelectPaymentMethod:completion:]): Ditto.
1239         (-[WKPaymentAuthorizationDelegate _didSelectShippingContact:completion:]): Ditto.
1240         (toShippingMethod): Moved from WebPaymentCoordinatorProxyCocoa.mm.
1241         (-[WKPaymentAuthorizationDelegate _didSelectShippingMethod:completion:]): Added. Implements
1242         the logic previously in WKPaymentAuthorizationViewControllerDelegate.
1243         (-[WKPaymentAuthorizationDelegate _willFinishWithError:]): Ditto.
1244         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
1245         (WebKit::WebPaymentCoordinatorProxy::presenterWillValidateMerchant): To conform to
1246         PaymentAuthorizationPresenter::Client, renamed from validateMerchant.
1247         (WebKit::WebPaymentCoordinatorProxy::presenterDidAuthorizePayment): Renamed from
1248         didAuthorizePayment.
1249         (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Moved logic here that previously
1250         existed in WKPaymentAuthorizationViewControllerDelegate.
1251         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectShippingMethod): Renamed from
1252         didSelectShippingMethod.
1253         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectShippingContact): Renamed from
1254         didSelectShippingContact.
1255         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectPaymentMethod): Renamed from
1256         didSelectPaymentMethod.
1257         (WebKit::WebPaymentCoordinatorProxy::validateMerchant): Renamed to
1258         presenterWillValidateMerchant.
1259         (WebKit::WebPaymentCoordinatorProxy::didAuthorizePayment): Renamed to
1260         presenterDidAuthorizePayment.
1261         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingMethod): Renamed to
1262         presenterDidSelectShippingMethod.
1263         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingContact): Renamed to
1264         presenterDidSelectShippingContact.
1265         (WebKit::WebPaymentCoordinatorProxy::didSelectPaymentMethod): Renamed to
1266         didSelectPaymentMethod.
1267         * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Changed WebPaymentCoordinatorProxy to
1268         subclass PaymentAuthorizationPresenter::Client.
1269         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: Removed WKPaymentAuthorizationViewControllerDelegate interface and declared some helper functions
1270         needed by PaymentAuthorizationPresenter.
1271         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1272         (WebKit::toPKPaymentSummaryItemType): Removed static keyword.
1273         (WebKit::toDecimalNumber): Ditto.
1274         (WebKit::toPKPaymentSummaryItem): Ditto.
1275         (WebKit::toPKPaymentSummaryItems): Ditto.
1276         (WebKit::toPKShippingMethod): Ditto.
1277         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Changed to call
1278         m_authorizationPresenter.
1279         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession): Ditto.
1280         (WebKit::WebPaymentCoordinatorProxy::platformCompleteMerchantValidation): Ditto.
1281         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection): Ditto.
1282         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection): Ditto.
1283         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection): Ditto.
1284         (-[WKPaymentAuthorizationViewControllerDelegate initWithPaymentCoordinatorProxy:]): Deleted.
1285         (-[WKPaymentAuthorizationViewControllerDelegate invalidate]): Deleted.
1286         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:willFinishWithError:]): Deleted.
1287         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didRequestMerchantSession:]): Deleted.
1288         (toShippingMethod): Deleted.
1289         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]): Deleted.
1290         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]): Deleted.
1291         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]): Deleted.
1292         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]): Deleted.
1293         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:completion:]): Deleted.
1294         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:completion:]): Deleted.
1295         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:completion:]): Deleted.
1296         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:completion:]): Deleted.
1297         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]): Deleted.
1298         (WebKit::toPKPaymentAuthorizationStatus): Moved to PaymentAuthorizationPresenter.mm.
1299         (WebKit::toPKPaymentErrorCode): Ditto.
1300         (WebKit::toNSError): Ditto.
1301         (WebKit::toNSErrors): Ditto.
1302         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
1303         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Changed to present a
1304         PaymentAuthorizationPresenter rather than a PKPAVC.
1305         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Changed to dismiss a
1306         PaymentAuthorizationPresenter rather than a PKPAVC.
1307         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
1308         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Ditto.
1309         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Ditto.
1310         * SourcesCocoa.txt:
1311         * UIProcess/WebPageProxy.h:
1312         * UIProcess/ios/WebPageProxyIOS.mm:
1313         (WebKit::WebPageProxy::paymentCoordinatorAuthorizationPresenter): Added. Returns a new
1314         PaymentAuthorizationViewController.
1315         * WebKit.xcodeproj/project.pbxproj:
1316
1317 2019-03-07  Chris Dumez  <cdumez@apple.com>
1318
1319         Regression(r242580) WebKit.NetworkProcessCrashWithPendingConnection API is crashing on iOS debug
1320         https://bugs.webkit.org/show_bug.cgi?id=195416
1321
1322         Reviewed by Antti Koivisto.
1323
1324         Drop ASSERT_NOT_REACHED() in WebPage::didCompletePageTransition() when the tree is still frozen due to
1325         LayerTreeFreezeReason::ProcessSuspended. As demonstrated by this API test, nothing prevents a load from
1326         completing and WebPage::didCompletePageTransition() to get called *after* WebProcess::prepareToSuspend()
1327         has been called. From the logging during the test, I can tell that WebProcess::processDidResume() gets
1328         called later on and the LayerTreeFreezeReason::ProcessSuspended freezing reason gets dropped, as expected.
1329
1330         * WebProcess/WebPage/WebPage.cpp:
1331         (WebKit::WebPage::didCompletePageTransition):
1332
1333 2019-03-07  Chris Dumez  <cdumez@apple.com>
1334
1335         Clean up / simplify ProcessAssertion code
1336         https://bugs.webkit.org/show_bug.cgi?id=195394
1337
1338         Reviewed by Geoffrey Garen.
1339
1340         Clean up / simplify ProcessAssertion code to facilitate its maintenance and make it
1341         less error-prone.
1342
1343         * Platform/IPC/mac/ConnectionMac.mm:
1344         (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
1345         * UIProcess/ProcessAssertion.cpp:
1346         (WebKit::ProcessAssertion::ProcessAssertion):
1347         (WebKit::ProcessAssertion::setState):
1348         * UIProcess/ProcessAssertion.h:
1349         (WebKit::ProcessAssertion::Client::~Client):
1350         (WebKit::ProcessAssertion::setClient):
1351         (WebKit::ProcessAssertion::client):
1352         * UIProcess/ProcessThrottler.cpp:
1353         (WebKit::ProcessThrottler::didConnectToProcess):
1354         * UIProcess/ProcessThrottler.h:
1355         * UIProcess/ios/ProcessAssertionIOS.mm:
1356         (-[WKProcessAssertionBackgroundTaskManager dealloc]):
1357         (-[WKProcessAssertionBackgroundTaskManager addAssertionNeedingBackgroundTask:]):
1358         (-[WKProcessAssertionBackgroundTaskManager removeAssertionNeedingBackgroundTask:]):
1359         (-[WKProcessAssertionBackgroundTaskManager _notifyAssertionsOfImminentSuspension]):
1360         (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]):
1361         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
1362         (WebKit::ProcessAssertion::ProcessAssertion):
1363         (WebKit::ProcessAssertion::processAssertionWasInvalidated):
1364         (WebKit::ProcessAssertion::setState):
1365         (WebKit::ProcessAndUIAssertion::updateRunInBackgroundCount):
1366         (WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
1367         (WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
1368         (WebKit::ProcessAndUIAssertion::processAssertionWasInvalidated):
1369         (WebKit::ProcessAndUIAssertion::setState):
1370         (WebKit::ProcessAndUIAssertion::uiAssertionWillExpireImminently):
1371
1372 2019-03-07  Commit Queue  <commit-queue@webkit.org>
1373
1374         Unreviewed, rolling out r242297.
1375         https://bugs.webkit.org/show_bug.cgi?id=195430
1376
1377         Broke Microsoft Visio. (Requested by dydz on #webkit).
1378
1379         Reverted changeset:
1380
1381         "[iOS] Turn mouse event simulation on by default"
1382         https://bugs.webkit.org/show_bug.cgi?id=195218
1383         https://trac.webkit.org/changeset/242297
1384
1385 2019-03-07  John Wilander  <wilander@apple.com>
1386
1387         Resource Load Statistics: Log first-party navigations with link decoration
1388         https://bugs.webkit.org/show_bug.cgi?id=195301
1389         <rdar://problem/48569971>
1390
1391         Reviewed by Brent Fulgham.
1392
1393         This patch adds a call to the network process' resource load statistics to
1394         log cross-site navigations with link decoration. The logging checks if the
1395         source of the navigation is a prevalent resource and if so, sets the
1396         appropriate flag for the destination.
1397
1398         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1399         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
1400         (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
1401         (WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceRedirect):
1402         (WebKit::ResourceLoadStatisticsDatabaseStore::logCrossSiteLoadWithLinkDecoration):
1403         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1404         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1405         (WebKit::ResourceLoadStatisticsMemoryStore::logCrossSiteLoadWithLinkDecoration):
1406         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
1407         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
1408         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1409         (WebKit::WebResourceLoadStatisticsStore::logCrossSiteLoadWithLinkDecoration):
1410         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1411         * NetworkProcess/NetworkProcess.cpp:
1412         (WebKit::NetworkProcess::committedCrossSiteLoadWithLinkDecoration):
1413             This now receives a completion handler. This is in preparation for
1414             test cases where we need to log such an event and wait for it to
1415             finish before continuing.
1416         * NetworkProcess/NetworkProcess.h:
1417         * NetworkProcess/NetworkProcess.messages.in:
1418         * UIProcess/Network/NetworkProcessProxy.cpp:
1419         (WebKit::NetworkProcessProxy::committedCrossSiteLoadWithLinkDecoration):
1420         * UIProcess/Network/NetworkProcessProxy.h:
1421         * UIProcess/WebPageProxy.cpp:
1422         (WebKit::WebPageProxy::didCommitLoadForFrame):
1423         * UIProcess/WebProcessPool.cpp:
1424         (WebKit::WebProcessPool::committedCrossSiteLoadWithLinkDecoration):
1425         * UIProcess/WebProcessPool.h:
1426
1427 2019-03-07  Per Arne Vollan  <pvollan@apple.com>
1428
1429         [iOS] Disable permissive call logging in sandbox
1430         https://bugs.webkit.org/show_bug.cgi?id=195288
1431         <rdar://problem/47683804>
1432
1433         Reviewed by Brent Fulgham.
1434
1435         As on macOS, we should enable strict call filtering in sandbox on iOS.
1436
1437         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1438
1439 2019-03-07  Youenn Fablet  <youenn@apple.com>
1440
1441         Introduce a quota manager for Cache API/Service Worker/IDB storage
1442         https://bugs.webkit.org/show_bug.cgi?id=195283
1443
1444         Reviewed by Chris Dumez.
1445
1446         Remove quota handling from Cache API storage and use StorageQuotaManager/StorageQuotaUser.
1447         CacheStorage::Caches becomes a quota user and has a StorageQuotaManager to check for space for any cache API write task.
1448         NetworkProcess is responsible to manage the quota managers.
1449         Quota managers will go through network process to ask UIProcess for quota extension.
1450
1451         Remove pending callback handling from CacheStorage since they are queued in QuotaManager now.
1452
1453         * NetworkProcess/NetworkProcess.cpp:
1454         (WebKit::NetworkProcess::~NetworkProcess):
1455         (WebKit::NetworkProcess::destroySession):
1456         (WebKit::NetworkProcess::cacheStorageRootPath):
1457         (WebKit::NetworkProcess::setCacheStorageParameters):
1458         (WebKit::NetworkProcess::storageQuotaManager):
1459         * NetworkProcess/NetworkProcess.h:
1460         * NetworkProcess/cache/CacheStorageEngine.cpp:
1461         (WebKit::CacheStorage::Engine::from):
1462         (WebKit::CacheStorage::Engine::Engine):
1463         (WebKit::CacheStorage::Engine::readCachesFromDisk):
1464         * NetworkProcess/cache/CacheStorageEngine.h:
1465         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1466         (WebKit::CacheStorage::Cache::put):
1467         * NetworkProcess/cache/CacheStorageEngineCache.h:
1468         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1469         (WebKit::CacheStorage::Caches::Caches):
1470         (WebKit::CacheStorage::Caches::~Caches):
1471         (WebKit::CacheStorage::Caches::requestSpace):
1472         (WebKit::CacheStorage::Caches::writeRecord):
1473         * NetworkProcess/cache/CacheStorageEngineCaches.h:
1474
1475 2019-03-07  John Wilander  <wilander@apple.com>
1476
1477         Resource Load Statistics: Make it possible to purge only script-accessible cookies
1478         https://bugs.webkit.org/show_bug.cgi?id=195383
1479         <rdar://problem/48570136>
1480
1481         Reviewed by Brent Fulgham.
1482
1483         This patch provides the ability to purge all script-accessible cookies while leaving
1484         HttpOnly cookies in place.
1485
1486         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
1487         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
1488         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1489         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
1490             Support for a new boolean flag on whether or not to include HttpOnly Cookies.
1491         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1492         * NetworkProcess/NetworkProcess.cpp:
1493         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
1494             Support for a new boolean flag on whether or not to include HttpOnly Cookies.
1495         (WebKit::NetworkProcess::deleteCookiesForTesting):
1496             Test infrastructure.
1497         * NetworkProcess/NetworkProcess.h:
1498         * NetworkProcess/NetworkProcess.messages.in:
1499         * NetworkProcess/NetworkSession.cpp:
1500         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
1501             Support for a new boolean flag on whether or not to include HttpOnly Cookies.
1502         * NetworkProcess/NetworkSession.h:
1503         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1504         (WKWebsiteDataStoreStatisticsDeleteCookiesForTesting):
1505             Test infrastructure.
1506         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1507         * UIProcess/Network/NetworkProcessProxy.cpp:
1508         (WebKit::NetworkProcessProxy::deleteCookiesForTesting):
1509             Test infrastructure.
1510         * UIProcess/Network/NetworkProcessProxy.h:
1511         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1512         (WebKit::WebsiteDataStore::deleteCookiesForTesting):
1513             Test infrastructure.
1514         * UIProcess/WebsiteData/WebsiteDataStore.h:
1515
1516 2019-03-07  Carlos Garcia Campos  <cgarcia@igalia.com>
1517
1518         REGRESSION(r242364): [WPE] Do not stop the compositing run loop update timer on suspend
1519         https://bugs.webkit.org/show_bug.cgi?id=195410
1520
1521         Reviewed by Žan Doberšek.
1522
1523         Calling CompositingRunLoop::stopUpdates() on suspend is leaving the threaded compositor in an inconsistent
1524         state, failing to resume and stopping the updates forever. This is causing timeouts in WPE layout tests. Instead
1525         of calling stopUpdates(), a new suspend() is called, that stops the update timer, without changing the current
1526         updae tha compositing state. A new method resume() is also added to schedule an update if needed.
1527
1528         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
1529         (WebKit::CompositingRunLoop::suspend): Set state as suspended and stop the update timer.
1530         (WebKit::CompositingRunLoop::resume): Set state as not suspended and start the update timer if it was scheduled
1531         while suspended.
1532         (WebKit::CompositingRunLoop::scheduleUpdate): Do not start the update timer when suspended.
1533         (WebKit::CompositingRunLoop::compositionCompleted): Ditto.
1534         (WebKit::CompositingRunLoop::updateCompleted): Ditto.
1535         (WebKit::CompositingRunLoop::updateTimerFired): Add an assert to ensure the update timer is not fired while suspended.
1536         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
1537         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1538         (WebKit::ThreadedCompositor::suspend): Call CompositingRunLoop::suspend() instead of stopUpdates().
1539         (WebKit::ThreadedCompositor::resume): Call CompositingRunLoop::resume().
1540
1541 2019-03-06  Mark Lam  <mark.lam@apple.com>
1542
1543         Exception is a JSCell, not a JSObject.
1544         https://bugs.webkit.org/show_bug.cgi?id=195392
1545
1546         Reviewed by Saam Barati.
1547
1548         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
1549         (WebKit::JSNPObject::throwInvalidAccessError):
1550         * WebProcess/Plugins/Netscape/JSNPObject.h:
1551
1552 2019-03-07  Commit Queue  <commit-queue@webkit.org>
1553
1554         Unreviewed, rolling out r242354.
1555         https://bugs.webkit.org/show_bug.cgi?id=195402
1556
1557         breaks layout tests in all configurations (Requested by
1558         zdobersek on #webkit).
1559
1560         Reverted changeset:
1561
1562         "[WPE] Enable web process sandbox"
1563         https://bugs.webkit.org/show_bug.cgi?id=195169
1564         https://trac.webkit.org/changeset/242354
1565
1566 2019-03-06  Ross Kirsling  <ross.kirsling@sony.com>
1567
1568         [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
1569         https://bugs.webkit.org/show_bug.cgi?id=195346
1570
1571         Reviewed by Fujii Hironori.
1572
1573         * Platform/IPC/win/ConnectionWin.cpp:
1574         (IPC::Connection::createServerAndClientIdentifiers):
1575         * Platform/win/ModuleWin.cpp:
1576         (WebKit::Module::load):
1577         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
1578         (WebKit::ProcessLauncher::launchProcess):
1579         * UIProcess/win/WebContextMenuProxyWin.cpp:
1580         (WebKit::createMenuItem):
1581         * UIProcess/win/WebView.cpp:
1582         (WebKit::WebView::setToolTip):
1583         * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp:
1584         (WebKit::InjectedBundle::initialize):
1585         Use wchar helpers as needed.
1586
1587 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1588
1589         Crash when attempting to change input type while dismissing datalist suggestions
1590         https://bugs.webkit.org/show_bug.cgi?id=195384
1591         <rdar://problem/48563718>
1592
1593         Reviewed by Brent Fulgham.
1594
1595         See WebCore ChangeLog for more details.
1596
1597         * WebProcess/WebPage/WebPage.cpp:
1598         (WebKit::WebPage::setActiveDataListSuggestionPicker):
1599         (WebKit::WebPage::didSelectDataListOption):
1600         (WebKit::WebPage::didCloseSuggestions):
1601         * WebProcess/WebPage/WebPage.h:
1602
1603         Turn m_activeDataListSuggestionPicker from a raw pointer into a WeakPtr.
1604
1605 2019-03-06  Chris Dumez  <cdumez@apple.com>
1606
1607         [iOS] ProcessDidResume() IPC should be sent upon resuming when ProcessWillSuspendImminently() IPC was sent
1608         https://bugs.webkit.org/show_bug.cgi?id=195382
1609         <rdar://problem/48642739>
1610
1611         Reviewed by Geoffrey Garen.
1612
1613         ProcessDidResume() IPC should be sent upon resuming when ProcessWillSuspendImminently() IPC was sent. Previously,
1614         we only send ProcessDidResume() to the WebProcess if PrepareToSuspend() was sent, not when the more urgent
1615         ProcessWillSuspendImminently() IPC was sent.
1616
1617         This mismatch has lead to bugs because the WebProcess does not know it got resumed and failed to unfreeze the
1618         layers it froze upon suspension.
1619
1620         * UIProcess/ProcessAssertion.h:
1621         (WebKit::ProcessAssertionClient::~ProcessAssertionClient):
1622
1623         * UIProcess/ProcessThrottler.cpp:
1624         (WebKit::ProcessThrottler::updateAssertion):
1625         (WebKit::ProcessThrottler::uiAssertionWillExpireImminently):
1626         (WebKit::ProcessThrottler::assertionWillExpireImminently): Deleted.
1627
1628         * UIProcess/ProcessThrottler.h:
1629         * UIProcess/ios/ProcessAssertionIOS.mm:
1630         (-[WKProcessAssertionBackgroundTaskManager _notifyClientsOfImminentSuspension]):
1631         (WebKit::ProcessAssertion::~ProcessAssertion):
1632         (WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
1633         (WebKit::ProcessAndUIAssertion::setClient):
1634
1635         * WebProcess/WebPage/WebPage.cpp:
1636         (WebKit::WebPage::didCompletePageTransition):
1637         Revert change that was landed in r242098 to work around this ProcessThrottler bug.
1638
1639         * WebProcess/WebPage/ios/WebPageIOS.mm:
1640         (WebKit::WebPage::applicationWillEnterForeground):
1641         Revert change that was landed in r242554 to work around this ProcessThrottler bug.
1642
1643 2019-03-06  Alex Christensen  <achristensen@webkit.org>
1644
1645         Add gettid to allowed syscalls on Mac
1646         https://bugs.webkit.org/show_bug.cgi?id=195386
1647         <rdar://problem/48651255>
1648
1649         Reviewed by Brent Fulgham.
1650
1651         * WebProcess/com.apple.WebProcess.sb.in:
1652
1653 2019-03-06  Per Arne Vollan  <pvollan@apple.com>
1654
1655         [macOS] Sandbox call violation causes WebContent process to crash
1656         https://bugs.webkit.org/show_bug.cgi?id=195379
1657         <rdar://problem/48647263>
1658
1659         Reviewed by Brent Fulgham.
1660
1661         A new call needs to be added to the allow list in the WebContent process' sandbox.
1662
1663         * WebProcess/com.apple.WebProcess.sb.in:
1664
1665 2019-03-06  Antti Koivisto  <antti@apple.com>
1666
1667         [iOS] Basic hit testing for content overlapping fast-scrollable overflow
1668         https://bugs.webkit.org/show_bug.cgi?id=195360
1669
1670         Reviewed by Simon Fraser.
1671
1672         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1673         (WebKit::RemoteLayerTreeHost::makeNode):
1674
1675         Use new UIView subclass for tiled layer hosting (so we know they have content even when contents property is nil).
1676
1677         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
1678         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1679         (collectDescendantViewsAtPoint):
1680
1681         Factor collection step into a function.
1682         Do basic skipping of event-transparent layers.
1683
1684         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
1685
1686         To handle overlap cases, find the scroll view that has the deepest non-transparent view hit as its descendant.
1687
1688         (-[UIView _web_recursiveFindDescendantInteractibleViewAtPoint:withEvent:]): Deleted.
1689
1690 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1691
1692         Move RenderObject::isTransparentOrFullyClippedRespectingParentFrames() to RenderLayer
1693         https://bugs.webkit.org/show_bug.cgi?id=195300
1694
1695         Reviewed by Simon Fraser.
1696
1697         Refactor some logic to use isTransparentOrFullyClippedRespectingParentFrames on RenderLayer rather than
1698         RenderObject; introduce a helper method to ask whether the enclosing layer of a renderer is transparent or
1699         clipped.
1700
1701         * WebProcess/WebPage/ios/WebPageIOS.mm:
1702         (WebKit::enclosingLayerIsTransparentOrFullyClipped):
1703         (WebKit::WebPage::platformEditorState const):
1704         (WebKit::WebPage::requestEvasionRectsAboveSelection):
1705         (WebKit::WebPage::getFocusedElementInformation):
1706
1707 2019-03-06  Chris Dumez  <cdumez@apple.com>
1708
1709         REGRESSION (r238490): YouTube.com: Returning PiP to Safari after sleeping device loses page
1710         https://bugs.webkit.org/show_bug.cgi?id=195364
1711         <rdar://problem/48538837>
1712
1713         Reviewed by Geoffrey Garen.
1714
1715         Make sure we unset the LayerTreeFreezeReason::ProcessSuspended layer tree freeze reason
1716         when WebPage::applicationWillEnterForeground() is called. This restores pre-r238490
1717         behavior and addresses the issue with PiP on youtube.com.
1718
1719         * WebProcess/WebPage/ios/WebPageIOS.mm:
1720         (WebKit::WebPage::applicationWillEnterForeground):
1721
1722 2019-03-05  Dean Jackson  <dino@apple.com>
1723
1724         Fix WKPasswordView compilation on iOS
1725         https://bugs.webkit.org/show_bug.cgi?id=195344
1726         <rdar://problem/48620066>
1727
1728         Reviewed by Dan Bates.
1729
1730         Use WebKitAdditions.
1731
1732         * UIProcess/ios/WKPasswordView.mm:
1733         (-[WKPasswordView showInScrollView:]):
1734
1735 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1736
1737         [iOS] Frequent 1 second IPC deadlocks when showing a paste callout
1738         https://bugs.webkit.org/show_bug.cgi?id=195354
1739         <rdar://problem/48624675>
1740
1741         Reviewed by Tim Horton.
1742
1743         When triggering programmatic paste, we frequently hit deadlocks due to sync IPC going from the UI process to the
1744         web process and vice versa. What happens in this scenario is that prior to triggering programmatic paste, the
1745         page may try to move focus to a different element (e.g. a hidden editable area) before calling `execCommand`.
1746         This causes us to send an ElementDidFocus message to the UI process, followed by RequestDOMPasteAccess.
1747
1748         However, upon receiving ElementDidFocus, we reload input views and (in the process) UIKit requests the
1749         autocorrection context, which we implement in WebKit using a sync message to the web process due to
1750         <rdar://problem/16207002> and its blocking bug <rdar://problem/48383001>. This means we'll end up in a state
1751         where both the UI process and web process are blocked on each other waiting for a sync IPC response, and the UI
1752         process is hung for a second until the IPC message times out.
1753
1754         Ideally, we should fix this by addressing <rdar://problem/16207002>. However, this requires potentially large
1755         changes in UIKit (<rdar://problem/48383001>); for the time being, work around this deadlock by refactoring
1756         synchronous autocorrection context requests such that they can be resolved by an out-of-band IPC response
1757         (HandleAutocorrectionContext). Then prior to requesting DOM paste access, preemptively send a
1758         HandleAutocorrectionContext message to the UI process to unblock any pending synchronous autocorrection context
1759         requests.
1760
1761         * UIProcess/PageClient.h:
1762         * UIProcess/WebPageProxy.h:
1763         * UIProcess/WebPageProxy.messages.in:
1764         * UIProcess/ios/PageClientImplIOS.h:
1765         * UIProcess/ios/PageClientImplIOS.mm:
1766         (WebKit::PageClientImpl::handleAutocorrectionContext):
1767         * UIProcess/ios/WKContentViewInteraction.h:
1768
1769         Make it possible for WKContentView to remember its current pending autocorrection context completion handler.
1770         This is invoked and cleared out in `-_invokePendingAutocorrectionContextHandler:`.
1771
1772         * UIProcess/ios/WKContentViewInteraction.mm:
1773         (-[WKContentView _invokePendingAutocorrectionContextHandler:]):
1774         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
1775         (-[WKContentView _handleAutocorrectionContext:]):
1776
1777         Handle an autocorrection context response. This is invoked when the web process either handles an autocorrection
1778         context message, or when it preemptively sends an autocorrection context before requesting DOM paste access.
1779
1780         (+[WKAutocorrectionContext emptyAutocorrectionContext]):
1781
1782         Add a helper to create an empty autocorrection context.
1783
1784         * UIProcess/ios/WebPageProxyIOS.mm:
1785         (WebKit::WebPageProxy::requestAutocorrectionContext):
1786         (WebKit::WebPageProxy::handleAutocorrectionContext):
1787         (WebKit::WebPageProxy::autocorrectionContextSync): Deleted.
1788
1789         Removed this sync version, since we now only have requestAutocorrectionContext.
1790
1791         * WebProcess/WebPage/WebPage.cpp:
1792         (WebKit::WebPage::requestDOMPasteAccess):
1793
1794         Send WebPageProxy::HandleAutocorrectionContext, and add a FIXME referencing <rdar://problem/16207002>.
1795
1796         * WebProcess/WebPage/WebPage.h:
1797         * WebProcess/WebPage/WebPage.messages.in:
1798
1799         Split AutocorrectionContextSync into RequestAutocorrectionContext and HandleAutocorrectionContext; additionally,
1800         remove the existing RequestAutocorrectionContext message.
1801
1802         * WebProcess/WebPage/ios/WebPageIOS.mm:
1803         (WebKit::WebPage::requestAutocorrectionContext):
1804         (WebKit::WebPage::autocorrectionContextSync): Deleted.
1805
1806 2019-03-06  Rob Buis  <rbuis@igalia.com>
1807
1808         Consider supporting the `referrerpolicy` attribute.
1809         https://bugs.webkit.org/show_bug.cgi?id=179053
1810
1811         Reviewed by Darin Adler.
1812
1813         Add a runtime flag for referrerpolicy attribute.
1814
1815         * Shared/WebPreferences.yaml:
1816         * UIProcess/API/C/WKPreferences.cpp:
1817         (WKPreferencesSetReferrerPolicyAttributeEnabled):
1818         (WKPreferencesGetReferrerPolicyAttributeEnabled):
1819         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1820         * WebProcess/Network/WebLoaderStrategy.cpp:
1821         (WebKit::WebLoaderStrategy::loadResource): do not hardcode choosing
1822         the document referrer policy.
1823
1824 2019-03-06  Philippe Normand  <pnormand@igalia.com>
1825
1826         Unreviewed, WPE build fix after r242503
1827
1828         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
1829         ServiceWorker messages moved from network process to another
1830         header, so it needs to be included.
1831
1832 2019-03-05  David Quesada  <david_quesada@apple.com>
1833
1834         [WK2] It should be possible to follow links with 'download' attributes
1835         https://bugs.webkit.org/show_bug.cgi?id=195145
1836         rdar://problem/48462642
1837
1838         Reviewed by Alex Christensen.
1839
1840         When a link with a 'download' attribute is clicked and the navigation client
1841         says to allow the navigation (i.e. provides PolicyAction::Use),
1842         WebPageProxy::receivedNavigationPolicyDecision() should stop overriding this
1843         decision and downloading the link instead. Instead, web view should honor the
1844         policy chosen by the navigation delegate. This supports clients that want to
1845         offer the user the ability to view, rather than download, the contents of
1846         such links, which is permitted per the HTML spec.
1847
1848         This change is only made on Cocoa platforms for now since no other ports
1849         expose an API on their navigation action to express whether the page intends
1850         to download the linked resource.
1851
1852         * UIProcess/API/APINavigation.h:
1853         (API::Navigation::shouldPerformDownload const):
1854             Rename this to be in line with APINavigationAction's shouldPerformDownload()
1855             for consistency. 'Force' seems like too strong of a word for this property
1856             considering that 'forcing' the download isn't really an attribute inherent
1857             to the navigation, but a behavior implemented by the web page proxy.
1858         (API::Navigation::shouldForceDownload const): Deleted.
1859         * UIProcess/Cocoa/VersionChecks.h:
1860         * UIProcess/WebPageProxy.cpp:
1861         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1862
1863 2019-03-05  Takashi Komori  <Takashi.Komori@sony.com>
1864
1865         [Curl] Implement Cookie Accept Policy.
1866         https://bugs.webkit.org/show_bug.cgi?id=191645
1867
1868         Reviewed by Fujii Hironori.
1869
1870         * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp:
1871         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
1872         (WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy):
1873         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1874         (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
1875         (WebKit::NetworkDataTaskCurl::handleCookieHeaders):
1876         * NetworkProcess/curl/NetworkDataTaskCurl.h:
1877
1878 2019-03-05  Youenn Fablet  <youenn@apple.com>
1879
1880         Introduce ServiceWorkerFetchTask
1881         https://bugs.webkit.org/show_bug.cgi?id=195130
1882
1883         Reviewed by Chris Dumez.
1884
1885         ServiceWorkerFetchTask is added to represent NetworkProcess side of an ongoing fetch intercepted by service worker.
1886         This patch should not change existing behavior.
1887
1888         * CMakeLists.txt:
1889         * DerivedSources-input.xcfilelist:
1890         * DerivedSources-output.xcfilelist:
1891         * DerivedSources.make:
1892         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1893         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1894         * NetworkProcess/NetworkProcess.cpp:
1895         (WebKit::NetworkProcess::didFailFetch): Deleted.
1896         (WebKit::NetworkProcess::didNotHandleFetch): Deleted.
1897         (WebKit::NetworkProcess::didReceiveFetchRedirectResponse): Deleted.
1898         (WebKit::NetworkProcess::didReceiveFetchResponse): Deleted.
1899         (WebKit::NetworkProcess::didReceiveFetchData): Deleted.
1900         (WebKit::NetworkProcess::didReceiveFetchFormData): Deleted.
1901         (WebKit::NetworkProcess::didFinishFetch): Deleted.
1902         * NetworkProcess/NetworkProcess.h:
1903         * NetworkProcess/NetworkProcess.messages.in:
1904         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1905         (WebKit::WebSWServerConnection::cancelFetch):
1906         (WebKit::WebSWServerConnection::continueDidReceiveFetchResponse):
1907         (WebKit::WebSWServerConnection::startFetch):
1908         (WebKit::WebSWServerConnection::didReceiveFetchRedirectResponse): Deleted.
1909         (WebKit::WebSWServerConnection::didReceiveFetchResponse): Deleted.
1910         (WebKit::WebSWServerConnection::didReceiveFetchData): Deleted.
1911         (WebKit::WebSWServerConnection::didReceiveFetchFormData): Deleted.
1912         (WebKit::WebSWServerConnection::didFinishFetch): Deleted.
1913         (WebKit::WebSWServerConnection::didFailFetch): Deleted.
1914         (WebKit::WebSWServerConnection::didNotHandleFetch): Deleted.
1915         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
1916         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1917         (WebKit::WebSWServerToContextConnection::connectionClosed):
1918         (WebKit::WebSWServerToContextConnection::startFetch):
1919         (WebKit::WebSWServerToContextConnection::cancelFetch):
1920         (WebKit::WebSWServerToContextConnection::continueDidReceiveFetchResponse):
1921         (WebKit::WebSWServerToContextConnection::didReceiveFetchTaskMessage):
1922         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
1923         * SourcesCocoa.txt:
1924         * WebKit.xcodeproj/project.pbxproj:
1925         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1926         (WebKit::WebSWContextManagerConnection::startFetch):
1927         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
1928         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveRedirection):
1929         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
1930         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
1931         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish):
1932         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveBlobChunk):
1933         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
1934         (WebKit::WebServiceWorkerFetchTaskClient::didFinish):
1935         (WebKit::WebServiceWorkerFetchTaskClient::didNotHandle):
1936         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: Added.
1937         (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse):
1938         (WebKit::ServiceWorkerFetchTask::didReceiveResponse):
1939         (WebKit::ServiceWorkerFetchTask::didReceiveData):
1940         (WebKit::ServiceWorkerFetchTask::didReceiveFormData):
1941         (WebKit::ServiceWorkerFetchTask::didFinish):
1942         (WebKit::ServiceWorkerFetchTask::didFail):
1943         (WebKit::ServiceWorkerFetchTask::didNotHandle):
1944         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h: Added.
1945         (WebKit::ServiceWorkerFetchTask::create):
1946         (WebKit::ServiceWorkerFetchTask::Identifier::hash const):
1947         (WebKit::ServiceWorkerFetchTask::identifier const):
1948         (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):
1949         (WebKit::operator==):
1950         (WTF::ServiceWorkerFetchTaskIdentifierHash::hash):
1951         (WTF::ServiceWorkerFetchTaskIdentifierHash::equal):
1952         (WTF::HashTraits<WebKit::ServiceWorkerFetchTask::Identifier>::emptyValue):
1953         (WTF::HashTraits<WebKit::ServiceWorkerFetchTask::Identifier>::constructDeletedValue):
1954         (WTF::HashTraits<WebKit::ServiceWorkerFetchTask::Identifier>::isDeletedValue):
1955         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.messages.in: Added.
1956
1957 2019-03-05  Youenn Fablet  <youenn@apple.com>
1958
1959         Rename requestCacheStorageSpace to requestStorageSpace
1960         https://bugs.webkit.org/show_bug.cgi?id=195282
1961
1962         Reviewed by Chris Dumez.
1963
1964         Make the name more abstract as it might be used in the future for other storage
1965         like IDB or service worker registrations.
1966
1967         * NetworkProcess/NetworkProcess.cpp:
1968         (WebKit::NetworkProcess::requestStorageSpace):
1969         (WebKit::NetworkProcess::requestCacheStorageSpace): Deleted.
1970         * NetworkProcess/NetworkProcess.h:
1971         * NetworkProcess/cache/CacheStorageEngine.cpp:
1972         (WebKit::CacheStorage::Engine::requestSpace):
1973         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1974         (WebsiteDataStoreClient::WebsiteDataStoreClient):
1975         * UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h:
1976         * UIProcess/Network/NetworkProcessProxy.cpp:
1977         (WebKit::NetworkProcessProxy::requestStorageSpace):
1978         (WebKit::NetworkProcessProxy::requestCacheStorageSpace): Deleted.
1979         * UIProcess/Network/NetworkProcessProxy.h:
1980         * UIProcess/Network/NetworkProcessProxy.messages.in:
1981         * UIProcess/WebsiteData/WebsiteDataStoreClient.h:
1982         (WebKit::WebsiteDataStoreClient::requestStorageSpace):
1983         (WebKit::WebsiteDataStoreClient::requestCacheStorageSpace): Deleted.
1984
1985 2019-03-05  Chris Dumez  <cdumez@apple.com>
1986
1987         Drop cached WebProcesses for a given session when this session is destroyed
1988         https://bugs.webkit.org/show_bug.cgi?id=195212
1989         <rdar://problem/48301483>
1990
1991         Reviewed by Geoffrey Garen.
1992
1993         Drop cached WebProcesses for a give session when this session is destroyed. This way, when you close
1994         your private browsing window, all the processes it used get cleared and it cannot leave any state
1995         behind.
1996
1997         * UIProcess/WebProcessCache.cpp:
1998         (WebKit::WebProcessCache::canCacheProcess const):
1999         (WebKit::WebProcessCache::addProcessIfPossible):
2000         (WebKit::WebProcessCache::addProcess):
2001         (WebKit::WebProcessCache::clearAllProcessesForSession):
2002         * UIProcess/WebProcessCache.h:
2003         (WebKit::WebProcessCache::capacity const):
2004         * UIProcess/WebProcessPool.cpp:
2005         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
2006         (WebKit::WebProcessPool::hasPagesUsingWebsiteDataStore const):
2007         * UIProcess/WebProcessPool.h:
2008
2009 2019-03-05  Brady Eidson  <beidson@apple.com>
2010
2011         Correctly handle sandbox extensions when the same WKWebView loads multiple file:// URLs.
2012         <rdar://problem/47820581> and https://bugs.webkit.org/show_bug.cgi?id=195291
2013
2014         Reviewed by Tim Horton.
2015
2016         * WebProcess/WebPage/WebPage.cpp:
2017         (WebKit::WebPage::SandboxExtensionTracker::shouldReuseCommittedSandboxExtension): If there is a pendingProvisionalSandboxExtension
2018           then its existence should override our willingness to reuse the existing committed extension.
2019         (WebKit::shouldReuseCommittedSandboxExtension): Deleted.
2020         * WebProcess/WebPage/WebPage.h:
2021
2022 2019-03-05  Ryan Haddad  <ryanhaddad@apple.com>
2023
2024         Unreviewed, rolling out r242403.
2025
2026         Caused layout test crashes on iOS simulator.
2027
2028         Reverted changeset:
2029
2030         "[ContentChangeObserver] Introduce fixed duration content
2031         observation"
2032         https://bugs.webkit.org/show_bug.cgi?id=195295
2033         https://trac.webkit.org/changeset/242403
2034
2035 2019-03-05  Loïc Yhuel  <loic.yhuel@softathome.com>
2036
2037         [WPE] Do not create a PlatformDisplay in the Service Worker process
2038         https://bugs.webkit.org/show_bug.cgi?id=194830
2039
2040         Reviewed by Žan Doberšek.
2041
2042         It avoids opening the Wayland socket in this WPEWebProcess, which might cause issues
2043         depending on the platform, and allocates unneeded resources.
2044
2045         * Shared/WebProcessCreationParameters.cpp:
2046         (WebKit::WebProcessCreationParameters::encode const):
2047         (WebKit::WebProcessCreationParameters::decode):
2048         * Shared/WebProcessCreationParameters.h: Add new isServiceWorkerProcess parameter.
2049         * UIProcess/WebProcessPool.cpp:
2050         (WebKit::WebProcessPool::initializeNewWebProcess): Set isServiceWorkerProcess parameter.
2051         * UIProcess/glib/WebProcessPoolGLib.cpp:
2052         (WebKit::WebProcessPool::platformInitializeWebProcess): No implementationLibraryName and hostClientFileDescriptor for Service Worker.
2053         * WebProcess/glib/WebProcessGLib.cpp:
2054         (WebKit::WebProcess::platformInitializeWebProcess): No wpe_loader_init nor PlatformDisplayLibWPE for Service Worker.
2055
2056 2019-03-04  Brady Eidson  <beidson@apple.com>
2057
2058         Unreviewed, rolling out r242376.
2059
2060         Broke some tests
2061
2062         Reverted changeset:
2063
2064         "Correctly handle sandbox extensions when the same WKWebView
2065         loads multiple file:// URLs."
2066         https://bugs.webkit.org/show_bug.cgi?id=195291
2067         https://trac.webkit.org/changeset/242376
2068
2069 2019-03-04  Fujii Hironori  <Hironori.Fujii@sony.com>
2070
2071         Use a SQLite database to hold the ResourceLoadStatistics data
2072         https://bugs.webkit.org/show_bug.cgi?id=194867
2073         <rdar://problem/24240854>
2074
2075         Unreviewed build fix for WinCairo.
2076
2077         ResourceLoadStatisticsDebug and RELEASE_LOG_INFO_IF are not
2078         defined because WinCairo port defines RELEASE_LOG_DISABLED.
2079
2080         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2081         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess): Enclosed RELEASE_LOG_INFO_IF with #if !RELEASE_LOG_DISABLED.
2082         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener): Ditto.
2083         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking): Ditto.
2084
2085 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
2086
2087         Use a SQLite database to hold the ResourceLoadStatistics data
2088         https://bugs.webkit.org/show_bug.cgi?id=194867
2089         <rdar://problem/24240854>
2090
2091         Reviewed by Chris Dumez.
2092
2093         The ResourceLoadStatistics database plist is inefficient. It requires more memory use
2094         than it needs, and forces lots of looping and string comparisons to find information.
2095
2096         This problem has already been solved in the form of relational databases. We use them
2097         elsewhere in WebKit, and should do so for this storage as well.
2098
2099         This patch creates an optional SQLite database to handle ITP operations.
2100
2101         1. It adds a new internal experimental feature flag to activate it. It requires the user
2102            exit and restart the process to take effect.
2103         2. It populates itself from the existing plist file (if it exists).
2104         3. It stops using the plist in favor of the database.
2105         4. It does queries and other operations using the database instead of the old hash table
2106            implementation.
2107
2108         This patch refactors the exisiting ResourceLoadStatisticsMemoryStore class into a base
2109         ResourceLoadStatisticsStore class, which ResourceLoadStatisticsMemoryStore is based on.
2110         It adds a new ResourceLoadStatisticsDatabaseStore that is implemented in terms of SQL
2111         operations.
2112
2113         These code changes should not have any impact on existing operations, and when enabled
2114         should produce the same test results.
2115
2116         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: Added.
2117         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
2118         (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
2119         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements):
2120         (WebKit::ResourceLoadStatisticsDatabaseStore::insertObservedDomain):
2121         (WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const):
2122         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationship):
2123         (WebKit::ResourceLoadStatisticsDatabaseStore::confirmDomainDoesNotExist const):
2124         (WebKit::ResourceLoadStatisticsDatabaseStore::domainIDFromString const):
2125         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
2126         (WebKit::ResourceLoadStatisticsDatabaseStore::databaseIsEmpty const):
2127         (WebKit::ResourceLoadStatisticsDatabaseStore::populateFromMemoryStore):
2128         (WebKit::ResourceLoadStatisticsDatabaseStore::calculateAndSubmitTelemetry const):
2129         (WebKit::ResourceLoadStatisticsDatabaseStore::incrementRecordsDeletedCountForDomains):
2130         (WebKit::ResourceLoadStatisticsDatabaseStore::recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain):
2131         (WebKit::buildList):
2132         (WebKit::ResourceLoadStatisticsDatabaseStore::markAsPrevalentIfHasRedirectedToPrevalent):
2133         (WebKit::listToString):
2134         (WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources):
2135         (WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
2136         (WebKit::ResourceLoadStatisticsDatabaseStore::classifyPrevalentResources):
2137         (WebKit::ResourceLoadStatisticsDatabaseStore::syncStorageIfNeeded):
2138         (WebKit::ResourceLoadStatisticsDatabaseStore::syncStorageImmediately):
2139         (WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess):
2140         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
2141         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
2142         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
2143         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
2144         (WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
2145         (WebKit::ResourceLoadStatisticsDatabaseStore::ensurePrevalentResourcesForDebugMode):
2146         (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation):
2147         (WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceLoading):
2148         (WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceRedirect):
2149         (WebKit::ResourceLoadStatisticsDatabaseStore::setUserInteraction):
2150         (WebKit::ResourceLoadStatisticsDatabaseStore::logUserInteraction):
2151         (WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction):
2152         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
2153         (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
2154         (WebKit::ResourceLoadStatisticsDatabaseStore::setDomainsAsPrevalent):
2155         (WebKit::ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics const):
2156         (WebKit::ResourceLoadStatisticsDatabaseStore::predicateValueForDomain const):
2157         (WebKit::ResourceLoadStatisticsDatabaseStore::isPrevalentResource const):
2158         (WebKit::ResourceLoadStatisticsDatabaseStore::isVeryPrevalentResource const):
2159         (WebKit::ResourceLoadStatisticsDatabaseStore::isRegisteredAsSubresourceUnder const):
2160         (WebKit::ResourceLoadStatisticsDatabaseStore::isRegisteredAsSubFrameUnder const):
2161         (WebKit::ResourceLoadStatisticsDatabaseStore::isRegisteredAsRedirectingTo const):
2162         (WebKit::ResourceLoadStatisticsDatabaseStore::clearPrevalentResource):
2163         (WebKit::ResourceLoadStatisticsDatabaseStore::setGrandfathered):
2164         (WebKit::ResourceLoadStatisticsDatabaseStore::isGrandfathered const):
2165         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubframeUnderTopFrameOrigin):
2166         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUnderTopFrameOrigin):
2167         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectTo):
2168         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectFrom):
2169         (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectTo):
2170         (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectFrom):
2171         (WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForPrimaryDomain):
2172         (WebKit::ResourceLoadStatisticsDatabaseStore::clear):
2173         (WebKit::ResourceLoadStatisticsDatabaseStore::cookieTreatmentForOrigin const):
2174         (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt):
2175         (WebKit::ResourceLoadStatisticsDatabaseStore::domainsToBlock const):
2176         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking):
2177         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlockingForDomains):
2178         (WebKit::ResourceLoadStatisticsDatabaseStore::clearBlockingStateForDomains):
2179         (WebKit::ResourceLoadStatisticsDatabaseStore::processStatistics const):
2180         (WebKit::ResourceLoadStatisticsDatabaseStore::prevalentDomains const):
2181         (WebKit::ResourceLoadStatisticsDatabaseStore::findExpiredUserInteractions const):
2182         (WebKit::ResourceLoadStatisticsDatabaseStore::clearExpiredUserInteractions):
2183         (WebKit::ResourceLoadStatisticsDatabaseStore::clearGrandfathering):
2184         (WebKit::ResourceLoadStatisticsDatabaseStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
2185         (WebKit::ResourceLoadStatisticsDatabaseStore::pruneStatisticsIfNeeded):
2186         (WebKit::ResourceLoadStatisticsDatabaseStore::updateLastSeen):
2187         (WebKit::ResourceLoadStatisticsDatabaseStore::setLastSeen):
2188         (WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource):
2189         (WebKit::ResourceLoadStatisticsDatabaseStore::removeAllStorageAccess):
2190         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: Added.
2191         (WebKit::ResourceLoadStatisticsDatabaseStore::isEmpty const):
2192         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2193         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
2194         (WebKit::ResourceLoadStatisticsMemoryStore::incrementRecordsDeletedCountForDomains):
2195         (WebKit::ResourceLoadStatisticsMemoryStore::classifyPrevalentResources):
2196         (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageIfNeeded):
2197         (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageImmediately):
2198         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherDataForDomains):
2199         (WebKit::domainsToString): Deleted.
2200         (WebKit::OperatingDate::fromWallTime): Deleted.
2201         (WebKit::OperatingDate::today): Deleted.
2202         (WebKit::OperatingDate::secondsSinceEpoch const): Deleted.
2203         (WebKit::OperatingDate::operator== const): Deleted.
2204         (WebKit::OperatingDate::operator< const): Deleted.
2205         (WebKit::OperatingDate::operator<= const): Deleted.
2206         (WebKit::OperatingDate::OperatingDate): Deleted.
2207         (WebKit::mergeOperatingDates): Deleted.
2208         (WebKit::computeImportance): Deleted.
2209         (WebKit::ResourceLoadStatisticsMemoryStore::~ResourceLoadStatisticsMemoryStore): Deleted.
2210         (WebKit::ResourceLoadStatisticsMemoryStore::setNotifyPagesWhenDataRecordsWereScanned): Deleted.
2211         (WebKit::ResourceLoadStatisticsMemoryStore::setShouldClassifyResourcesBeforeDataRecordsRemoval): Deleted.
2212         (WebKit::ResourceLoadStatisticsMemoryStore::setShouldSubmitTelemetry): Deleted.
2213         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords): Deleted.
2214         (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords): Deleted.
2215         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData): Deleted.
2216         (WebKit::ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode): Deleted.
2217         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode): Deleted.
2218         (WebKit::ResourceLoadStatisticsMemoryStore::scheduleStatisticsProcessingRequestIfNecessary): Deleted.
2219         (WebKit::ResourceLoadStatisticsMemoryStore::cancelPendingStatisticsProcessingRequest): Deleted.
2220         (WebKit::ResourceLoadStatisticsMemoryStore::setTimeToLiveUserInteraction): Deleted.
2221         (WebKit::ResourceLoadStatisticsMemoryStore::setMinimumTimeBetweenDataRecordsRemoval): Deleted.
2222         (WebKit::ResourceLoadStatisticsMemoryStore::setGrandfatheringTime): Deleted.
2223         (WebKit::ResourceLoadStatisticsMemoryStore::setCacheMaxAgeCap): Deleted.
2224         (WebKit::ResourceLoadStatisticsMemoryStore::updateCacheMaxAgeCap): Deleted.
2225         (WebKit::ResourceLoadStatisticsMemoryStore::setAgeCapForClientSideCookies): Deleted.
2226         (WebKit::ResourceLoadStatisticsMemoryStore::updateClientSideCookiesAgeCap): Deleted.
2227         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveDataRecords const): Deleted.
2228         (WebKit::ResourceLoadStatisticsMemoryStore::setDataRecordsBeingRemoved): Deleted.
2229         (WebKit::debugLogDomainsInBatches): Deleted.
2230         (WebKit::ResourceLoadStatisticsMemoryStore::includeTodayAsOperatingDateIfNecessary): Deleted.
2231         (WebKit::ResourceLoadStatisticsMemoryStore::hasStatisticsExpired const): Deleted.
2232         (WebKit::ResourceLoadStatisticsMemoryStore::setMaxStatisticsEntries): Deleted.
2233         (WebKit::ResourceLoadStatisticsMemoryStore::setPruneEntriesDownTo): Deleted.
2234         (WebKit::ResourceLoadStatisticsMemoryStore::resetParametersToDefaultValues): Deleted.
2235         (WebKit::ResourceLoadStatisticsMemoryStore::logTestingEvent): Deleted.
2236         (WebKit::ResourceLoadStatisticsMemoryStore::didCreateNetworkProcess): Deleted.
2237         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
2238         (WebKit::ResourceLoadStatisticsMemoryStore::data const):
2239         (WebKit::ResourceLoadStatisticsMemoryStore::isDebugModeEnabled const): Deleted.
2240         (WebKit::ResourceLoadStatisticsMemoryStore::store const): Deleted.
2241         (WebKit::ResourceLoadStatisticsMemoryStore::setStorageAccessPromptsEnabled): Deleted.
2242         (WebKit::ResourceLoadStatisticsMemoryStore::setDebugLogggingEnabled): Deleted.
2243         (): Deleted.
2244         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: Added.
2245         (WebKit::domainsToString):
2246         (WebKit::OperatingDate::fromWallTime):
2247         (WebKit::OperatingDate::today):
2248         (WebKit::OperatingDate::secondsSinceEpoch const):
2249         (WebKit::OperatingDate::operator== const):
2250         (WebKit::OperatingDate::operator< const):
2251         (WebKit::OperatingDate::operator<= const):
2252         (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
2253         (WebKit::ResourceLoadStatisticsStore::~ResourceLoadStatisticsStore):
2254         (WebKit::ResourceLoadStatisticsStore::calculateAndSubmitTelemetry const):
2255         (WebKit::ResourceLoadStatisticsStore::computeImportance):
2256         (WebKit::ResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
2257         (WebKit::ResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2258         (WebKit::ResourceLoadStatisticsStore::setShouldSubmitTelemetry):
2259         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
2260         (WebKit::ResourceLoadStatisticsStore::processStatisticsAndDataRecords):
2261         (WebKit::ResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
2262         (WebKit::ResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
2263         (WebKit::ResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
2264         (WebKit::ResourceLoadStatisticsStore::scheduleStatisticsProcessingRequestIfNecessary):
2265         (WebKit::ResourceLoadStatisticsStore::cancelPendingStatisticsProcessingRequest):
2266         (WebKit::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
2267         (WebKit::ResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
2268         (WebKit::ResourceLoadStatisticsStore::setGrandfatheringTime):
2269         (WebKit::ResourceLoadStatisticsStore::setCacheMaxAgeCap):
2270         (WebKit::ResourceLoadStatisticsStore::updateCacheMaxAgeCap):
2271         (WebKit::ResourceLoadStatisticsStore::setAgeCapForClientSideCookies):
2272         (WebKit::ResourceLoadStatisticsStore::updateClientSideCookiesAgeCap):
2273         (WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords const):
2274         (WebKit::ResourceLoadStatisticsStore::setDataRecordsBeingRemoved):
2275         (WebKit::ResourceLoadStatisticsStore::updateCookieBlockingForDomains):
2276         (WebKit::ResourceLoadStatisticsStore::clearBlockingStateForDomains):
2277         (WebKit::ResourceLoadStatisticsStore::processStatistics const):
2278         (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const):
2279         (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates):
2280         (WebKit::ResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
2281         (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const):
2282         (WebKit::ResourceLoadStatisticsStore::setMaxStatisticsEntries):
2283         (WebKit::ResourceLoadStatisticsStore::setPruneEntriesDownTo):
2284         (WebKit::ResourceLoadStatisticsStore::resetParametersToDefaultValues):
2285         (WebKit::ResourceLoadStatisticsStore::logTestingEvent):
2286         (WebKit::ResourceLoadStatisticsStore::removeAllStorageAccess):
2287         (WebKit::ResourceLoadStatisticsStore::didCreateNetworkProcess):
2288         (WebKit::ResourceLoadStatisticsStore::debugLogDomainsInBatches):
2289         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: Copied from Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h.
2290         (WebKit::OperatingDate::OperatingDate):
2291         (WebKit::ResourceLoadStatisticsStore::isEmpty const):
2292         (WebKit::ResourceLoadStatisticsStore::data const):
2293         (WebKit::ResourceLoadStatisticsStore::isDebugModeEnabled const):
2294         (WebKit::ResourceLoadStatisticsStore::store const):
2295         (WebKit::ResourceLoadStatisticsStore::setStorageAccessPromptsEnabled):
2296         (WebKit::ResourceLoadStatisticsStore::setDebugLogggingEnabled):
2297         * NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm: Renamed from Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm.
2298         (WebKit::ResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
2299         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2300         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
2301         (WebKit::WebResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2302         (WebKit::WebResourceLoadStatisticsStore::setShouldSubmitTelemetry):
2303         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2304         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
2305         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
2306         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
2307         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
2308         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
2309         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
2310         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
2311         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
2312         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
2313         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
2314         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading):
2315         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading):
2316         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect):
2317         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
2318         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
2319         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
2320         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
2321         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
2322         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
2323         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
2324         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
2325         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder):
2326         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
2327         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
2328         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
2329         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
2330         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
2331         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
2332         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
2333         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
2334         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
2335         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
2336         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
2337         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdate):
2338         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains):
2339         (WebKit::WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains):
2340         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
2341         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
2342         (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
2343         (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
2344         (WebKit::WebResourceLoadStatisticsStore::setMaxStatisticsEntries):
2345         (WebKit::WebResourceLoadStatisticsStore::setPruneEntriesDownTo):
2346         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
2347         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2348         * NetworkProcess/NetworkProcess.cpp:
2349         (WebKit::NetworkProcess::initializeNetworkProcess):
2350         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2351         (WebKit::NetworkProcessCreationParameters::encode const):
2352         (WebKit::NetworkProcessCreationParameters::decode):
2353         * NetworkProcess/NetworkProcessCreationParameters.h:
2354         * Platform/classifier/ResourceLoadStatisticsClassifier.cpp:
2355         (WebKit::ResourceLoadStatisticsClassifier::calculateResourcePrevalence):
2356         * Platform/classifier/ResourceLoadStatisticsClassifier.h:
2357         * Shared/WebPreferences.yaml:
2358         * Sources.txt:
2359         * SourcesCocoa.txt:
2360         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2361         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2362         * UIProcess/WebProcessPool.cpp:
2363         * WebKit.xcodeproj/project.pbxproj:
2364
2365 2019-03-04  Zalan Bujtas  <zalan@apple.com>
2366
2367         [ContentChangeObserver] Introduce fixed duration content observation
2368         https://bugs.webkit.org/show_bug.cgi?id=195295
2369         <rdar://problem/48579913>
2370
2371         Reviewed by Simon Fraser.
2372
2373         * WebProcess/WebPage/ios/WebPageIOS.mm:
2374         (WebKit::WebPage::handleSyntheticClick):
2375
2376 2019-03-04  Truitt Savell  <tsavell@apple.com>
2377
2378         Unreviewed, rolling out r242396.
2379
2380         Found issue to be unrelated. reverting my rollout.
2381
2382         Reverted changeset:
2383
2384         "Unreviewed, rolling out r242222."
2385         https://bugs.webkit.org/show_bug.cgi?id=193683
2386         https://trac.webkit.org/changeset/242396
2387
2388 2019-03-04  Jiewen Tan  <jiewen_tan@apple.com>
2389
2390         Unreviewed, a followup after r242336
2391
2392         * UIProcess/WebPageProxy.cpp:
2393         (WebKit::WebPageProxy::webViewDidMoveToWindow):
2394         Copy the list of observers before iterating it to avoid observers modifying the list.
2395
2396 2019-03-04  Truitt Savell  <tsavell@apple.com>
2397
2398         Unreviewed, rolling out r242222.
2399
2400         Broke internal debug testing
2401
2402         Reverted changeset:
2403
2404         "[iOS] Move calls to [UIKeyboard isInHardwareKeyboardMode] to
2405         the UI process."
2406         https://bugs.webkit.org/show_bug.cgi?id=193683
2407         https://trac.webkit.org/changeset/242222
2408
2409 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
2410
2411         Unreviewed build fix after r242378
2412
2413         * UIProcess/ios/EditableImageController.mm:
2414         (WebKit::EditableImageController::associateWithAttachment):
2415
2416 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
2417
2418         Check contextIDs when handling WebContent messages
2419         https://bugs.webkit.org/show_bug.cgi?id=195289
2420         <rdar://problem/48475870>
2421
2422         Reviewed by Alex Christensen.
2423
2424         The WebContent process is untrusted because it handles arbitrary markup and javascript from untrusted sources.
2425         We should handle its messages with suspicion, and make sure the arguments are valid and usable before honoring them.
2426
2427         This patch hardens the message passing layer by performing MESSAGE_CHECK in places that had been overlooked.
2428
2429         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
2430         (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID):
2431         (WebKit::PlaybackSessionManagerProxy::currentTimeChanged):
2432         (WebKit::PlaybackSessionManagerProxy::bufferedTimeChanged):
2433         (WebKit::PlaybackSessionManagerProxy::seekableRangesVectorChanged):
2434         (WebKit::PlaybackSessionManagerProxy::canPlayFastReverseChanged):
2435         (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionOptionsChanged):
2436         (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionOptionsChanged):
2437         (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionIndexChanged):
2438         (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionIndexChanged):
2439         (WebKit::PlaybackSessionManagerProxy::externalPlaybackPropertiesChanged):
2440         (WebKit::PlaybackSessionManagerProxy::wirelessVideoPlaybackDisabledChanged):
2441         (WebKit::PlaybackSessionManagerProxy::mutedChanged):
2442         (WebKit::PlaybackSessionManagerProxy::volumeChanged):
2443         (WebKit::PlaybackSessionManagerProxy::durationChanged):
2444         (WebKit::PlaybackSessionManagerProxy::playbackStartedTimeChanged):
2445         (WebKit::PlaybackSessionManagerProxy::rateChanged):
2446         (WebKit::PlaybackSessionManagerProxy::pictureInPictureSupportedChanged):
2447         (WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged):
2448         (WebKit::PlaybackSessionManagerProxy::handleControlledElementIDResponse const):
2449         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2450         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
2451         (WebKit::UserMediaCaptureManagerProxy::startProducingData):
2452         (WebKit::UserMediaCaptureManagerProxy::stopProducingData):
2453         (WebKit::UserMediaCaptureManagerProxy::end):
2454         (WebKit::UserMediaCaptureManagerProxy::capabilities):
2455         (WebKit::UserMediaCaptureManagerProxy::setMuted):
2456         (WebKit::UserMediaCaptureManagerProxy::applyConstraints):
2457         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2458         (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
2459         (WebKit::VideoFullscreenManagerProxy::setHasVideo):
2460         (WebKit::VideoFullscreenManagerProxy::setVideoDimensions):
2461         (WebKit::VideoFullscreenManagerProxy::enterFullscreen):
2462         (WebKit::VideoFullscreenManagerProxy::exitFullscreen):
2463         (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode):
2464         (WebKit::VideoFullscreenManagerProxy::setInlineRect):
2465         (WebKit::VideoFullscreenManagerProxy::setHasVideoContentLayer):
2466         (WebKit::VideoFullscreenManagerProxy::cleanupFullscreen):
2467         (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline):
2468         (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen):
2469         * UIProcess/ios/EditableImageController.mm:
2470         (WebKit::EditableImageController::didCreateEditableImage):
2471         (WebKit::EditableImageController::didDestroyEditableImage):
2472         (WebKit::EditableImageController::associateWithAttachment):
2473
2474 2019-03-04  Alex Christensen  <achristensen@webkit.org>
2475
2476         Fix crashes when NetworkResourceLoader/NetworkLoadChecker are destroyed during HTTPS upgrade check
2477         https://bugs.webkit.org/show_bug.cgi?id=195238
2478         <rdar://problem/47598656>
2479
2480         Reviewed by Chris Dumez.
2481
2482         * NetworkProcess/NetworkLoadChecker.cpp:
2483         (WebKit::NetworkLoadChecker::checkRequest):
2484
2485 2019-03-04  Brady Eidson  <beidson@apple.com>
2486
2487         Correctly handle sandbox extensions when the same WKWebView loads multiple file:// URLs.
2488         <rdar://problem/47820581> and https://bugs.webkit.org/show_bug.cgi?id=195291
2489
2490         Reviewed by Andy Estes.
2491
2492         * WebProcess/WebPage/WebPage.cpp:
2493         (WebKit::shouldReuseCommittedSandboxExtension): Only retain the previous sandbox extension if the file URL
2494           we're currently loading is functionally equivalent to the previous one.
2495
2496 2019-03-04  Chris Dumez  <cdumez@apple.com>
2497
2498         Drop legacy userAgentForURL injected bundle SPI
2499         https://bugs.webkit.org/show_bug.cgi?id=195222
2500         <rdar://problem/46734147>
2501
2502         Reviewed by Darin Adler.
2503
2504         Drop legacy userAgentForURL injected bundle SPI. There are no longer any clients, and using
2505         WebsitePolicies.customUserAgent is the way to go nowadays.
2506
2507         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
2508         (API::InjectedBundle::PageLoaderClient::willDestroyFrame):
2509         (API::InjectedBundle::PageLoaderClient::userAgentForURL const): Deleted.
2510         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
2511         * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
2512         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2513         (setUpPageLoaderClient):
2514         (userAgentForURL): Deleted.
2515         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
2516         (WebKit::InjectedBundlePageLoaderClient::userAgentForURL const): Deleted.
2517         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
2518         * WebProcess/WebPage/WebPage.cpp:
2519         (WebKit::WebPage::userAgent const):
2520
2521 2019-03-04  Chris Dumez  <cdumez@apple.com>
2522
2523         Do not share WebProcesses between private and regular sessions
2524         https://bugs.webkit.org/show_bug.cgi?id=195189
2525         <rdar://problem/48421064>
2526
2527         Reviewed by Alex Christensen.
2528
2529         Do not share WebProcesses between private and regular sessions. There are some privacy concerns.
2530         Also, some of the WebsiteDataStore informations are passed via WebProcessCreationParameters (e.g.
2531         ApplicationCache path) and cannot be updated later.
2532
2533         There were 2 cases where this could happen and that are fixed in the patch:
2534         - A process may be prewarmed with a given website data store and then later on used for a page
2535           associated with a different data store. We now prevent this. While this is not necessary for
2536           privacy reasons, it is still useful because our code currently does not support well uses
2537           different sessions inside a single WebProcess, as mentioned above.
2538         - The client can force a WebsiteDataStore swap when responding to the decidePolicyForNavigationAction,
2539           via the WebsitePolicies. To address the issue, we now force a process swap whenever the client
2540           makes such a change.
2541
2542         As a result, WebProcessProxy::websiteDataStore() now makes sense and is always correct. It can
2543         also only contains pages whose WebPageProxy::websiteDataStore() returns the same store.
2544
2545         * UIProcess/API/C/WKContext.cpp:
2546         (WKContextWarmInitialProcess):
2547         * UIProcess/API/Cocoa/WKProcessPool.mm:
2548         (-[WKProcessPool _warmInitialProcess]):
2549         * UIProcess/ProvisionalPageProxy.cpp:
2550         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
2551         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
2552         * UIProcess/WebPageProxy.cpp:
2553         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
2554         (WebKit::WebPageProxy::reattachToWebProcess):
2555         (WebKit::WebPageProxy::swapToWebProcess):
2556         (WebKit::WebPageProxy::close):
2557         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2558         (WebKit::WebPageProxy::commitProvisionalPage):
2559         (WebKit::WebPageProxy::creationParameters):
2560         * UIProcess/WebPageProxy.h:
2561         (WebKit::WebPageProxy::websiteDataStore):
2562         * UIProcess/WebProcessPool.cpp:
2563         (WebKit::WebProcessPool::ensureNetworkProcess):
2564         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
2565         (WebKit::WebProcessPool::prewarmProcess):
2566         (WebKit::WebProcessPool::createWebPage):
2567         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
2568         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
2569         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
2570         (WebKit::WebProcessPool::processForNavigation):
2571         (WebKit::WebProcessPool::processForNavigationInternal):
2572         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
2573         * UIProcess/WebProcessPool.h:
2574         (WebKit::WebProcessPool::sendToOneProcess):
2575         * UIProcess/WebProcessProxy.cpp:
2576         (WebKit::WebProcessProxy::createWebPage):
2577         (WebKit::WebProcessProxy::addExistingWebPage):
2578         (WebKit::WebProcessProxy::removeWebPage):
2579         * UIProcess/WebProcessProxy.h:
2580
2581 2019-03-04  Chris Dumez  <cdumez@apple.com>
2582
2583         [iOS] Improve our file picker
2584         https://bugs.webkit.org/show_bug.cgi?id=195284
2585         <rdar://problem/45655856>
2586
2587         Reviewed by Tim Horton and Wenson Hsieh.
2588
2589         Improve our file picker on iOS so that:
2590         - Accepted file extensions specified in the HTML (e.g. <input type="file"> accept=".pdf">) are now
2591           properly reflected in the file picker. Previously, we only we only supported MIME types in the
2592           accept attribute that only Image / Video ones.
2593         - If accepted types are specified in the HTML and not of them are Video or Image types, then bypass
2594           the UIDocumentMenuViewController and show the file picker directly (as if the user had tapped on
2595           "Browse..." on that menu). Other menu items such as "Take Photo or Video" and "Photo Library" do
2596           not make sense if the page only accepts PDF files for example.
2597
2598         Things that we should do but are not fixed in this patch:
2599         - Stop using UIDocumentMenuViewController entirely since it was deprecated in favor of using
2600           UIDocumentPickerViewController directly.
2601         - Add multiple selection support, which is supported both on the HTML side and in the
2602           UIDocumentPickerViewController API.
2603
2604         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2605         (arrayContainsUTIThatConformsTo):
2606         (-[WKFileUploadPanel dealloc]):
2607         (-[WKFileUploadPanel presentWithParameters:resultListener:]):
2608         (UTIsForMIMETypes):
2609         (-[WKFileUploadPanel _mediaTypesForPickerSourceType:]):
2610         (-[WKFileUploadPanel _cameraButtonLabelAllowingPhoto:allowingVideo:]):
2611         (-[WKFileUploadPanel _showDocumentPickerMenu]):
2612
2613 2019-03-04  Alex Christensen  <achristensen@webkit.org>
2614
2615         REGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm is crashing
2616         https://bugs.webkit.org/show_bug.cgi?id=194523
2617
2618         Reviewed by Ryosuke Niwa.
2619
2620         Attempt to work around a CFNetwork bug in the timing of tearing down tasks with upload streams.
2621         See rdar://problem/28233746.
2622
2623         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2624         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2625         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
2626         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2627         (-[WKNetworkSessionDelegate URLSession:task:needNewBodyStream:]):
2628
2629 2019-03-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2630
2631         [CoordinatedGraphics] The compositing loop is still running even after exiting AC mode
2632         https://bugs.webkit.org/show_bug.cgi?id=195270
2633
2634         Reviewed by Don Olmstead.
2635
2636         Suspend the threaded compositor when the painting is paused or layer flush disabled, and resume it again when
2637         painting is resumed and layer flush enabled.
2638
2639         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2640         (WebKit::ThreadedCompositor::suspend): Increment the suspend counter and mark the scene as inactive if it was suspended.
2641         (WebKit::ThreadedCompositor::resume): Decrement the suspend counter and mark the scene as active if it's now resumed.
2642         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2643         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
2644         (WebKit::DrawingAreaCoordinatedGraphics::forceRepaint): Return early if layer tree state is frozen.
2645         (WebKit::DrawingAreaCoordinatedGraphics::forceRepaintAsync): Ditto.
2646         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
2647         (WebKit::LayerTreeHost::setLayerFlushSchedulingEnabled): Call ThreadedCompositor::suspend()/resume().
2648         (WebKit::LayerTreeHost::pauseRendering): Call ThreadedCompositor::suspend.
2649         (WebKit::LayerTreeHost::resumeRendering): Call ThreadedCompositor::resume().
2650
2651 2019-03-04  Simon Fraser  <simon.fraser@apple.com>
2652
2653         Share more code between overflow and frame scrolling nodes, fixing overflow scrollbar display
2654         https://bugs.webkit.org/show_bug.cgi?id=195258
2655
2656         Reviewed by Antti Koivisto.
2657
2658         This patch moves management of scrollbar layers and scrollbar painters ("NSScrollerImp") down to
2659         ScrollingStateScrollingNode to be shared between frame and overflow nodes, allowing for
2660         scrolling thread updates of overflow scrollbars. It also moves some scrolling tree-side code
2661         to ScrollingTreeScrollingNodeDelegateMac to be shared between the "tree" nodes for overflow and frames.
2662
2663         Layers for scrollbars are given to scrolling state nodes via setNodeLayers() now, and
2664         RenderLayerCompositor::updateScrollingNodeLayers() is added to provide a bottleneck to call that.
2665         At some point AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() should be relieved
2666         of the responsibility of pushing scrollbar layers (but the scrolling state tree needs to hold
2667         references to GraphicsLayers before that becomes safe).
2668         
2669         The actual fix that allows overflow scrollbars to show is the change in
2670         AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() that calls scrollableArea.*ScrollbarLayerDidChange()
2671         for all ScrollableAreas. This ensures that the CALayer is pushed onto the NSScrollerImp.
2672
2673         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2674         (ArgumentCoder<ScrollingStateScrollingNode>::encode):
2675         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
2676         (ArgumentCoder<ScrollingStateScrollingNode>::decode):
2677         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
2678         * SourcesCocoa.txt:
2679         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2680         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2681         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
2682         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
2683         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp:
2684         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::commitStateBeforeChildren):
2685         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::repositionRelatedLayers):
2686         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleMouseEvent):
2687         * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp: Copied from Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp.
2688         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::create):
2689         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::ScrollingTreeOverflowScrollingNodeRemoteMac):
2690         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::~ScrollingTreeOverflowScrollingNodeRemoteMac):
2691         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::commitStateBeforeChildren):
2692         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::repositionRelatedLayers):
2693         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::handleWheelEvent):
2694         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::handleMouseEvent):
2695         * WebKit.xcodeproj/project.pbxproj:
2696
2697 2019-03-04  Andy Estes  <aestes@apple.com>
2698
2699         [Apple Pay] Move WebPaymentCoordinatorProxy from Source/WebKit/UIProcess to Source/WebKit/Shared
2700         https://bugs.webkit.org/show_bug.cgi?id=195080
2701         <rdar://problem/48421558>
2702
2703         Reviewed by Antti Koivisto.
2704
2705         * CMakeLists.txt:
2706         * DerivedSources-input.xcfilelist:
2707         * DerivedSources.make:
2708         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp: Renamed from Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp.
2709         * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Renamed from Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h.
2710         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: Renamed from Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in.
2711         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: Renamed from Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h.
2712         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: Renamed from Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm.
2713         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: Renamed from Source/WebKit/UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm.
2714         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: Renamed from Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm.
2715         * Shared/mac/WebHitTestResultData.mm:
2716         * SourcesCocoa.txt:
2717         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
2718         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
2719         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
2720         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
2721         * WebKit.xcodeproj/project.pbxproj:
2722
2723 2019-03-04  Jer Noble  <jer.noble@apple.com>
2724
2725         [iOS] Fullscreen "stay in page" option breaks video playback
2726         https://bugs.webkit.org/show_bug.cgi?id=195277
2727         <rdar://problem/48537317>
2728
2729         Reviewed by Eric Carlson.
2730
2731         Make sure we resume media playback when the user chooses "stay in page" from the deceptive
2732         website warning dialog.
2733
2734         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
2735         (-[WKFullScreenViewController _showPhishingAlert]):
2736
2737 2019-03-04  Michael Catanzaro  <mcatanzaro@igalia.com>
2738
2739         [WPE] Enable web process sandbox
2740         https://bugs.webkit.org/show_bug.cgi?id=195169
2741
2742         Reviewed by Daniel Bates.
2743
2744         * PlatformWPE.cmake:
2745         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2746         (WebKit::bubblewrapSpawn):
2747         * UIProcess/glib/WebProcessPoolGLib.cpp:
2748         (WebKit::WebProcessPool::platformInitialize):
2749
2750 2019-03-04  Adrian Perez de Castro  <aperez@igalia.com>
2751
2752         [GTK][WPE] Wrong license header in WebKit{,WebExtension}Autocleanups.h
2753         https://bugs.webkit.org/show_bug.cgi?id=195245
2754
2755         Reviewed by Carlos Garcia Campos.
2756
2757         Changed license headers to contain the LGPL, which is the correct one for the GTK
2758         and WPE ports. The change was agreed by the contributors to the files involved.
2759
2760         * UIProcess/API/gtk/WebKitAutocleanups.h:
2761         * UIProcess/API/wpe/WebKitAutocleanups.h:
2762         * WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionAutocleanups.h:
2763         * WebProcess/InjectedBundle/API/wpe/WebKitWebExtensionAutocleanups.h:
2764
2765 2019-03-04  Commit Queue  <commit-queue@webkit.org>
2766
2767         Unreviewed, rolling out r242045.
2768         https://bugs.webkit.org/show_bug.cgi?id=195273
2769
2770         WE not ready to enable PSON yet (Requested by KaL on #webkit).
2771
2772         Reverted changeset:
2773
2774         "[GTK] Enable PSON"
2775         https://bugs.webkit.org/show_bug.cgi?id=194979
2776         https://trac.webkit.org/changeset/242045
2777
2778 2019-03-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2779
2780         [CoordinatedGraphics] Unify DrawingArea classes
2781         https://bugs.webkit.org/show_bug.cgi?id=195167
2782
2783         Reviewed by Žan Doberšek.
2784
2785         Add DrawingAreaProxyCoordinatedGraphics and DrawingAreaCoordinatedGraphics.
2786
2787         * PlatformGTK.cmake:
2788         * PlatformWPE.cmake:
2789         * PlatformWin.cmake:
2790         * Shared/DrawingAreaInfo.h:
2791         * SourcesGTK.txt:
2792         * SourcesWPE.txt:
2793         * UIProcess/API/gtk/PageClientImpl.cpp:
2794         (WebKit::PageClientImpl::createDrawingAreaProxy):
2795         (WebKit::PageClientImpl::viewSize):
2796         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2797         (webkitWebViewBaseRealize):
2798         (webkitWebViewBaseUnrealize):
2799         (webkitWebViewBaseDraw):
2800         (webkitWebViewBaseSizeAllocate):
2801         (webkitWebViewBaseDidRelaunchWebProcess):
2802         (webkitWebViewBasePageClosed):
2803         * UIProcess/API/wpe/PageClientImpl.cpp:
2804         (WebKit::PageClientImpl::createDrawingAreaProxy):
2805         * UIProcess/AcceleratedDrawingAreaProxy.cpp: Removed.
2806         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp: Added.
2807         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingAreaProxyCoordinatedGraphics):
2808         (WebKit::DrawingAreaProxyCoordinatedGraphics::~DrawingAreaProxyCoordinatedGraphics):
2809         (WebKit::DrawingAreaProxyCoordinatedGraphics::paint):
2810         (WebKit::DrawingAreaProxyCoordinatedGraphics::sizeDidChange):
2811         (WebKit::DrawingAreaProxyCoordinatedGraphics::deviceScaleFactorDidChange):
2812         (WebKit::DrawingAreaProxyCoordinatedGraphics::waitForBackingStoreUpdateOnNextPaint):
2813         (WebKit::DrawingAreaProxyCoordinatedGraphics::setBackingStoreIsDiscardable):
2814         (WebKit::DrawingAreaProxyCoordinatedGraphics::update):
2815         (WebKit::DrawingAreaProxyCoordinatedGraphics::didUpdateBackingStoreState):
2816         (WebKit::DrawingAreaProxyCoordinatedGraphics::enterAcceleratedCompositingMode):
2817         (WebKit::DrawingAreaProxyCoordinatedGraphics::exitAcceleratedCompositingMode):
2818         (WebKit::DrawingAreaProxyCoordinatedGraphics::updateAcceleratedCompositingMode):
2819         (WebKit::DrawingAreaProxyCoordinatedGraphics::incorporateUpdate):
2820         (WebKit::DrawingAreaProxyCoordinatedGraphics::alwaysUseCompositing const):
2821         (WebKit::DrawingAreaProxyCoordinatedGraphics::backingStoreStateDidChange):
2822         (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState):
2823         (WebKit::DrawingAreaProxyCoordinatedGraphics::waitForAndDispatchDidUpdateBackingStoreState):
2824         (WebKit::DrawingAreaProxyCoordinatedGraphics::discardBackingStoreSoon):
2825         (WebKit::DrawingAreaProxyCoordinatedGraphics::discardBackingStore):
2826         (WebKit::DrawingAreaProxyCoordinatedGraphics::setNativeSurfaceHandleForCompositing):
2827         (WebKit::DrawingAreaProxyCoordinatedGraphics::destroyNativeSurfaceHandleForCompositing):
2828         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::DrawingMonitor):
2829         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::~DrawingMonitor):
2830         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::webViewDrawCallback):
2831         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::start):
2832         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::stop):
2833         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::didDraw):
2834         (WebKit::DrawingAreaProxyCoordinatedGraphics::dispatchAfterEnsuringDrawing):
2835         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h: Renamed from Source/WebKit/UIProcess/AcceleratedDrawingAreaProxy.h.
2836         * UIProcess/DrawingAreaProxyImpl.cpp: Removed.
2837         * UIProcess/DrawingAreaProxyImpl.h: Removed.
2838         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
2839         (WebKit::AcceleratedBackingStoreX11::update):
2840         * UIProcess/win/PageClientImpl.cpp:
2841         (WebKit::PageClientImpl::createDrawingAreaProxy):
2842         * UIProcess/win/WebView.cpp:
2843         (WebKit::WebView::paint):
2844         * WebProcess/WebPage/AcceleratedDrawingArea.cpp: Removed.
2845         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: Added.
2846         (WebKit::DrawingAreaCoordinatedGraphics::DrawingAreaCoordinatedGraphics):
2847         (WebKit::DrawingAreaCoordinatedGraphics::~DrawingAreaCoordinatedGraphics):
2848         (WebKit::DrawingAreaCoordinatedGraphics::setNeedsDisplay):
2849         (WebKit::DrawingAreaCoordinatedGraphics::setNeedsDisplayInRect):
2850         (WebKit::DrawingAreaCoordinatedGraphics::scroll):
2851         (WebKit::DrawingAreaCoordinatedGraphics::forceRepaint):
2852         (WebKit::DrawingAreaCoordinatedGraphics::forceRepaintAsync):
2853         (WebKit::DrawingAreaCoordinatedGraphics::setLayerTreeStateIsFrozen):
2854         (WebKit::DrawingAreaCoordinatedGraphics::updatePreferences):
2855         (WebKit::DrawingAreaCoordinatedGraphics::mainFrameContentSizeChanged):
2856         (WebKit::DrawingAreaCoordinatedGraphics::deviceOrPageScaleFactorChanged):
2857         (WebKit::DrawingAreaCoordinatedGraphics::didChangeViewportAttributes):
2858         (WebKit::DrawingAreaCoordinatedGraphics::graphicsLayerFactory):
2859         (WebKit::DrawingAreaCoordinatedGraphics::setRootCompositingLayer):
2860         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
2861         (WebKit::DrawingAreaCoordinatedGraphics::layerHostDidFlushLayers):
2862         (WebKit::DrawingAreaCoordinatedGraphics::createDisplayRefreshMonitor):
2863         (WebKit::DrawingAreaCoordinatedGraphics::setNativeSurfaceHandleForCompositing):
2864         (WebKit::DrawingAreaCoordinatedGraphics::destroyNativeSurfaceHandleForCompositing):
2865         (WebKit::DrawingAreaCoordinatedGraphics::activityStateDidChange):
2866         (WebKit::DrawingAreaCoordinatedGraphics::attachViewOverlayGraphicsLayer):
2867         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
2868         (WebKit::DrawingAreaCoordinatedGraphics::didUpdate):
2869         (WebKit::DrawingAreaCoordinatedGraphics::sendDidUpdateBackingStoreState):
2870         (WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingModeSoon):
2871         (WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingModeNow):
2872         (WebKit::DrawingAreaCoordinatedGraphics::discardPreviousLayerTreeHost):
2873         (WebKit::DrawingAreaCoordinatedGraphics::suspendPainting):
2874         (WebKit::DrawingAreaCoordinatedGraphics::resumePainting):
2875         (WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode):
2876         (WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingMode):
2877         (WebKit::DrawingAreaCoordinatedGraphics::scheduleDisplay):
2878         (WebKit::DrawingAreaCoordinatedGraphics::displayTimerFired):
2879         (WebKit::DrawingAreaCoordinatedGraphics::display):
2880         (WebKit::shouldPaintBoundsRect):
2881         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h: Renamed from Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h.
2882         * WebProcess/WebPage/DrawingArea.cpp:
2883         (WebKit::DrawingArea::create):
2884         * WebProcess/WebPage/DrawingArea.h:
2885         (WebKit::DrawingArea::layerFlushThrottlingIsActive const):
2886         * WebProcess/WebPage/DrawingAreaImpl.cpp: Removed.
2887         * WebProcess/WebPage/DrawingAreaImpl.h: Removed.
2888
2889 2019-03-03  Zalan Bujtas  <zalan@apple.com>
2890
2891         [ContentChangeObserver] Content observation should be limited to the current document.
2892         https://bugs.webkit.org/show_bug.cgi?id=195256
2893         <rdar://problem/48544402>
2894
2895         Reviewed by Simon Fraser.
2896
2897         * WebProcess/WebPage/WebPage.h:
2898         * WebProcess/WebPage/ios/WebPageIOS.mm:
2899         (WebKit::WebPage::handleSyntheticClick):
2900         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
2901         (WebKit::WebPage::completeSyntheticClick):
2902         (WebKit::WebPage::handleTap):
2903         (WebKit::WebPage::handleTwoFingerTapAtPoint):
2904         (WebKit::WebPage::commitPotentialTap):
2905
2906 2019-03-03  Tim Horton  <timothy_horton@apple.com>
2907
2908         Rid the world of WK_API_ENABLED
2909         https://bugs.webkit.org/show_bug.cgi?id=195263
2910
2911         Reviewed by Dan Bernstein.
2912
2913         List of changed files elided because it's useless.
2914
2915 2019-03-03  Jiewen Tan  <jiewen_tan@apple.com>
2916
2917         Add a WebViewDidMoveToWindowObserver for WKWebView
2918         https://bugs.webkit.org/show_bug.cgi?id=195223
2919         <rdar://problem/48520161>
2920
2921         Reviewed by Darin Adler.
2922
2923         The load optimizer would only allow itself to optimize loads whenever the web view
2924         who owns the page is (visible && focused), otherwises it will wait until the web view
2925         becomes (visible && focused). Therefore, we need a way to notify the load optimizer
2926         changes of statuses.
2927
2928         * UIProcess/API/Cocoa/WKWebView.mm:
2929         (-[WKWebView didMoveToWindow]):
2930         * UIProcess/Cocoa/WebViewImpl.mm:
2931         (WebKit::WebViewImpl::viewDidMoveToWindow):
2932         * UIProcess/WebPageProxy.cpp:
2933         (WebKit::WebPageProxy::addWebViewDidMoveToWindowObserver):
2934         (WebKit::WebPageProxy::removeWebViewDidMoveToWindowObserver):
2935         (WebKit::WebPageProxy::webViewDidMoveToWindow):
2936         * UIProcess/WebPageProxy.h:
2937         * UIProcess/WebViewDidMoveToWindowObserver.h: Added.
2938         * WebKit.xcodeproj/project.pbxproj:
2939
2940 2019-03-03  Andy Estes  <aestes@apple.com>
2941
2942         [Apple Pay] Untangle WebPageProxy and WebPaymentCoordinatorProxy
2943         https://bugs.webkit.org/show_bug.cgi?id=195219
2944         <rdar://problem/48518082>
2945
2946         Reviewed by Darin Adler.
2947
2948         Rather than having WebPaymentCoordinatorProxy know about WebPageProxy, give
2949         WebPaymentCoordinatorProxy a client interface that WebPageProxy conforms to.
2950
2951         In a follow-on patch, WebPaymentCoordinatorProxy will have a non-WebPageProxy client.
2952
2953         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
2954         (WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy): Replaced use of
2955         m_webPageProxy with m_client.
2956         (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): Ditto.
2957         (WebKit::WebPaymentCoordinatorProxy::messageSenderConnection const): Implemented
2958         IPC::MessageSender via m_client.
2959         (WebKit::WebPaymentCoordinatorProxy::messageSenderDestinationID const): Ditto.
2960         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard): Replaced use of
2961         m_webPageProxy with m_client.
2962         (WebKit::WebPaymentCoordinatorProxy::openPaymentSetup): Ditto.
2963         (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Called our own
2964         MessageSender::send rather than going through m_webPageProxy.
2965         (WebKit::WebPaymentCoordinatorProxy::validateMerchant): Ditto.
2966         (WebKit::WebPaymentCoordinatorProxy::didAuthorizePayment): Ditto.
2967         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingMethod): Ditto.
2968         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingContact): Ditto.
2969         (WebKit::WebPaymentCoordinatorProxy::didSelectPaymentMethod): Ditto.
2970         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h: Defined the Client abstract class and
2971         changed m_webPageProxy to m_client.
2972         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
2973         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2974         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard): Replaced use of
2975         m_webPageProxy with m_client.
2976         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Renamed from toPKPaymentRequest.
2977         (WebKit::toPKPaymentRequest): Renamed to WebPaymentCoordinatorProxy::platformPaymentRequest.
2978         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
2979         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Replaced use of m_webPageProxy
2980         with m_client.
2981         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
2982         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Ditto.
2983         * UIProcess/AuxiliaryProcessProxy.h:
2984         (WebKit::AuxiliaryProcessProxy::messageReceiverMap): Added.
2985         * UIProcess/WebPageProxy.cpp:
2986         (WebKit::WebPageProxy::paymentCoordinatorConnection): Implemented WebPaymentCoordinatorProxy::Client.
2987         (WebKit::WebPageProxy::paymentCoordinatorMessageReceiver): Ditto.
2988         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
2989         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
2990         (WebKit::WebPageProxy::paymentCoordinatorDestinationID): Ditto.
2991         * UIProcess/WebPageProxy.h: Made WebPageProxy derive from WebPaymentCoordinatorProxy::Client.
2992         * UIProcess/ios/WebPageProxyIOS.mm:
2993         (WebKit::WebPageProxy::paymentCoordinatorPresentingViewController): Implemented WebPaymentCoordinatorProxy::Client.
2994         (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType): Ditto.
2995         * UIProcess/mac/WebPageProxyMac.mm:
2996         (WebKit::WebPageProxy::paymentCoordinatorPresentingWindow): Ditto.
2997         * WebKit.xcodeproj/project.pbxproj:
2998
2999 2019-03-03  Tim Horton  <timothy_horton@apple.com>
3000
3001         Remove some more unused 32-bit code
3002         https://bugs.webkit.org/show_bug.cgi?id=195255
3003
3004         Reviewed by Darin Adler.
3005
3006         * Platform/Module.cpp:
3007         (WebKit::Module::Module):
3008         * Platform/Module.h:
3009         * Platform/cf/ModuleCF.cpp:
3010         (WebKit::Module::unload):
3011         (WebKit::Module::bundleResourceMap): Deleted.
3012         * PluginProcess/mac/PluginProcessMac.mm:
3013         (WebKit::initializeShim):
3014         (WebKit::PluginProcess::platformInitializeProcess):
3015         (WebKit::shouldCallRealDebugger): Deleted.
3016         (WebKit::isWindowActive): Deleted.
3017         (WebKit::getCurrentEventButtonState): Deleted.
3018         (WebKit::carbonWindowShown): Deleted.
3019         (WebKit::carbonWindowHidden): Deleted.
3020         (WebKit::openCFURLRef): Deleted.
3021         (WebKit::isMallocTinyMemoryTag): Deleted.
3022         (WebKit::shouldMapMemoryExecutable): Deleted.
3023         * PluginProcess/mac/PluginProcessShim.h:
3024         * PluginProcess/mac/PluginProcessShim.mm:
3025         (WebKit::shimDebugger): Deleted.
3026         (WebKit::shimGetCurrentEventButtonState): Deleted.
3027         (WebKit::shimIsWindowActive): Deleted.
3028         (WebKit::shimModalDialog): Deleted.
3029         (WebKit::shimAlert): Deleted.
3030         (WebKit::shimShowWindow): Deleted.
3031         (WebKit::shimHideWindow): Deleted.
3032         (WebKit::shimLSOpenCFURLRef): Deleted.
3033         (WebKit::shimMachVMMap): Deleted.
3034         * Shared/API/Cocoa/WKFoundation.h:
3035         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
3036         (WebKit::XPCServiceMain):
3037         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
3038         (WebKit::NetscapePluginModule::tryLoad):
3039         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
3040         (WebKit::getPluginArchitecture):
3041         (WebKit::NetscapePluginModule::determineQuirks):
3042         * Shared/Plugins/PluginQuirks.h:
3043         * Shared/cf/ArgumentCodersCF.cpp:
3044         (IPC::sizeForNumberType):
3045         * Shared/mac/WebEventFactory.mm:
3046         (WebKit::mouseButtonForEvent):
3047         (WebKit::globalPointForEvent):
3048         (WebKit::pointForEvent):
3049         (WebKit::WebEventFactory::createWebMouseEvent):
3050         * UIProcess/API/C/mac/WKPagePrivateMac.h:
3051         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
3052         (WKPageLoadFileReturningNavigation):
3053         * UIProcess/Cocoa/WebViewImpl.mm:
3054         (WebKit::WebViewImpl::pressureChangeWithEvent):
3055         * UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm:
3056         (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider):
3057         * UIProcess/mac/ServicesController.mm:
3058         (WebKit::ServicesController::ServicesController):
3059         * UIProcess/mac/WebContextMenuProxyMac.mm:
3060         (WebKit::WebContextMenuProxyMac::setupServicesMenu):
3061         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
3062         (WebKit::NPN_GetValue):
3063         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
3064         (WebKit::NetscapePlugin::NetscapePlugin):
3065         * WebProcess/Plugins/Netscape/NetscapePlugin.h:
3066         (WebKit::NetscapePlugin::isWindowActive const): Deleted.
3067         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
3068         (WebKit::NetscapePlugin::setDrawingModel):
3069         (WebKit::NetscapePlugin::setEventModel):
3070         (WebKit::NetscapePlugin::platformPostInitialize):
3071         (WebKit::NetscapePlugin::platformDestroy):
3072         (WebKit::NetscapePlugin::platformGeometryDidChange):
3073         (WebKit::NetscapePlugin::platformPaint):
3074         (WebKit::NetscapePlugin::platformHandleMouseEvent):
3075         (WebKit::NetscapePlugin::platformHandleWheelEvent):
3076         (WebKit::NetscapePlugin::platformHandleMouseEnterEvent):
3077         (WebKit::NetscapePlugin::platformHandleMouseLeaveEvent):
3078         (WebKit::NetscapePlugin::platformHandleKeyboardEvent):
3079         (WebKit::NetscapePlugin::platformSetFocus):
3080         (WebKit::NetscapePlugin::windowFocusChanged):
3081         (WebKit::NetscapePlugin::windowAndViewFramesChanged):
3082         (WebKit::NetscapePlugin::sendComplexTextInput):
3083         (): Deleted.
3084         (WebKit::windowMap): Deleted.
3085         (WebKit::NetscapePlugin::netscapePluginFromWindow): Deleted.
3086         (WebKit::NetscapePlugin::windowRef const): Deleted.
3087         (WebKit::NetscapePlugin::updateFakeWindowBounds): Deleted.
3088         (WebKit::NetscapePlugin::buttonState): Deleted.
3089         (WebKit::initializeEventRecord): Deleted.
3090         (WebKit::anyMouseButtonIsDown): Deleted.
3091         (WebKit::rightMouseButtonIsDown): Deleted.
3092         (WebKit::modifiersForEvent): Deleted.
3093         (WebKit::convertStringToKeyCodes): Deleted.
3094         (WebKit::scriptCodeFromCurrentKeyboardInputSource): Deleted.
3095         (WebKit::NetscapePlugin::nullEventTimerFired): Deleted.
3096
3097 2019-03-02  Zalan Bujtas  <zalan@apple.com>
3098
3099         [ContentChangeObserver] Introduce ContentChangeObserver::MouseMovedScope
3100         https://bugs.webkit.org/show_bug.cgi?id=195252
3101         <rdar://problem/48539446>
3102
3103         Reviewed by Simon Fraser.
3104
3105         * WebProcess/WebPage/ios/WebPageIOS.mm:
3106         (WebKit::WebPage::handleSyntheticClick):
3107
3108 2019-03-02  Tim Horton  <timothy_horton@apple.com>
3109
3110         Move EditingRange <-> Range methods to EditingRange instead of WebPage
3111         https://bugs.webkit.org/show_bug.cgi?id=195201
3112
3113         Reviewed by Sam Weinig.
3114
3115         * Shared/EditingRange.h:
3116         * Shared/EditingRange.cpp:
3117         Also, modernize the coders.
3118
3119         * Sources.txt:
3120         * WebKit.xcodeproj/project.pbxproj:
3121         * WebProcess/WebPage/WebPage.cpp:
3122         (WebKit::WebPage::insertTextAsync):
3123         (WebKit::WebPage::getMarkedRangeAsync):
3124         (WebKit::WebPage::getSelectedRangeAsync):
3125         (WebKit::WebPage::characterIndexForPointAsync):
3126         (WebKit::WebPage::firstRectForCharacterRangeAsync):
3127         (WebKit::WebPage::setCompositionAsync):
3128         (WebKit::WebPage::rangeFromEditingRange): Deleted.
3129         * WebProcess/WebPage/mac/WebPageMac.mm:
3130         (WebKit::WebPage::insertDictatedTextAsync):
3131         (WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
3132
3133 2019-03-02  Wenson Hsieh  <wenson_hsieh@apple.com>
3134
3135         [iOS] Programmatic paste access should be granted when copying and pasting within the same origin
3136         https://bugs.webkit.org/show_bug.cgi?id=195053
3137         <rdar://problem/48134710>
3138
3139         Reviewed by Ryosuke Niwa.
3140
3141         Add support for automatically granting programmatic pasteboard access when the pasteboard identifier of the
3142         document requesting programmatic paste matches the identifier in the custom pasteboard data blob in the
3143         UIPasteboard. To do this, we send the pasteboard identifier of the document requesting the DOM paste to the UI
3144         process, and check this against the pasteboard identifiers for each item on the platform pasteboard. If all
3145         items in the platform pasteboard match the given pasteboard identifier (since we don't support writing multiple
3146         pasteboard items via bindings, this should only be a single item), we skip showing the paste callout and
3147         immediately invoke the programmatic paste handler.
3148
3149         * Scripts/webkit/messages.py:
3150         * UIProcess/API/gtk/PageClientImpl.cpp:
3151         (WebKit::PageClientImpl::requestDOMPasteAccess):
3152         * UIProcess/API/gtk/PageClientImpl.h:
3153         * UIProcess/API/wpe/PageClientImpl.cpp:
3154         (WebKit::PageClientImpl::requestDOMPasteAccess):
3155         * UIProcess/API/wpe/PageClientImpl.h:
3156         * UIProcess/PageClient.h:
3157         * UIProcess/WebPageProxy.cpp:
3158         (WebKit::WebPageProxy::requestDOMPasteAccess):
3159         * UIProcess/WebPageProxy.h:
3160         * UIProcess/WebPageProxy.messages.in:
3161
3162         Add plumbing to deliver the pasteboard identifier to the client when requesting DOM paste.
3163
3164         * UIProcess/ios/PageClientImplIOS.h:
3165         * UIProcess/ios/PageClientImplIOS.mm:
3166         (WebKit::PageClientImpl::requestDOMPasteAccess):
3167         * UIProcess/ios/WKContentViewInteraction.h:
3168         * UIProcess/ios/WKContentViewInteraction.mm:
3169         (-[WKContentView cleanupInteraction]):
3170         (-[WKContentView resignFirstResponderForWebView]):
3171         (-[WKContentView _webTouchEventsRecognized:]):
3172         (-[WKContentView _willHideMenu:]):
3173         (-[WKContentView pasteForWebView:]):
3174         (-[WKContentView _handleDOMPasteRequestWithResult:]):
3175         (-[WKContentView _willPerformAction:sender:]):
3176         (-[WKContentView _didPerformAction:sender:]):
3177         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
3178         (allPasteboardItemOriginsMatchOrigin):
3179         (-[WKContentView _requestDOMPasteAccessWithElementRect:originIdentifier:completionHandler:]):
3180         (-[WKContentView _requestDOMPasteAccessWithElementRect:completionHandler:]): Deleted.
3181
3182         Bail early in the case where all items' pasteboard identifiers (read via custom pasteboard data) match. When
3183         this happens, we only grant access for the current paste command, rather than granting access for the user
3184         gesture token.
3185
3186         * UIProcess/mac/PageClientImplMac.h:
3187         * UIProcess/win/PageClientImpl.cpp:
3188         (WebKit::PageClientImpl::requestDOMPasteAccess):
3189         * UIProcess/win/PageClientImpl.h:
3190         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
3191         (WebKit::WebEditorClient::requestDOMPasteAccess):
3192         * WebProcess/WebCoreSupport/WebEditorClient.h:
3193         * WebProcess/WebPage/WebPage.cpp:
3194         (WebKit::WebPage::requestDOMPasteAccess):
3195         * WebProcess/WebPage/WebPage.h:
3196
3197 2019-02-27  Darin Adler  <darin@apple.com>
3198
3199         Fixed makeString(float) to do shortest-form serialization without first converting to double
3200         https://bugs.webkit.org/show_bug.cgi?id=195142
3201
3202         Reviewed by Daniel Bates.
3203
3204         * UIProcess/PerActivityStateCPUUsageSampler.cpp: Removed unneeded include of DecimalNumber.h.
3205
3206 2019-03-02  Adrian Perez de Castro  <aperez@igalia.com>
3207
3208         [WPE] Public API headers are missing autocleanup definitions
3209         https://bugs.webkit.org/show_bug.cgi?id=195211
3210
3211         Reviewed by Philippe Normand.
3212
3213         * PlatformWPE.cmake: List new API headers as installable.
3214         * UIProcess/API/wpe/WebKitAutocleanups.h: Added. This is a copy of the header from the GTK
3215         port, adapted to fit the WPE port.
3216         * UIProcess/API/wpe/webkit.h: Add inclusion of WebKitAutocleanups.h
3217         * WebProcess/InjectedBundle/API/wpe/WebKitWebExtensionAutocleanups.h: Added. Also adapted
3218         from the equivalent header of the GTK port.
3219         * WebProcess/InjectedBundle/API/wpe/webkit-web-extension.h: Add inclusion of
3220         WebKitWebExtensionAutocleanups.h
3221
3222 2019-03-02  Michael Catanzaro  <mcatanzaro@igalia.com>
3223
3224         Remove unused WebPageProxy::m_navigationID
3225         https://bugs.webkit.org/show_bug.cgi?id=195209
3226
3227         Reviewed by Darin Adler.
3228
3229         WebPageProxy::m_navigationID is never assigned to and is only used once by mistake in a
3230         debug LOG(). It must be a refactoring mistake.
3231
3232         * UIProcess/WebPageProxy.cpp:
3233         (WebKit::WebPageProxy::didCommitLoadForFrame):
3234         * UIProcess/WebPageProxy.h:
3235
3236 2019-03-01  Darin Adler  <darin@apple.com>
3237
3238         Finish removing String::format
3239         https://bugs.webkit.org/show_bug.cgi?id=194893
3240
3241         Reviewed by Daniel Bates.
3242
3243         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
3244         (WebKit::LocalAuthenticator::getAssertion): Use makeString, attempting to fix
3245         a problem where we passed an NSData * to format with a "%s"."
3246
3247 2019-03-01  Chris Dumez  <cdumez@apple.com>
3248
3249         Unreviewed Windows build fix after r242302.
3250
3251         * UIProcess/WebProcessPool.cpp:
3252         (WebKit::WebProcessPool::ensureNetworkProcess):
3253
3254 2019-03-01  Alex Christensen  <achristensen@webkit.org>
3255
3256         NetworkDataTask redirection should not keep alive its NetworkSession
3257         https://bugs.webkit.org/show_bug.cgi?id=194927
3258
3259         Reviewed by Darin Adler.
3260
3261         This should fix rdar://problem/47580502
3262
3263         * NetworkProcess/NetworkDataTask.h:
3264         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3265         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
3266
3267 2019-03-01  Alex Christensen  <achristensen@webkit.org>
3268
3269         Revert r241223, r241235, and r241287
3270         https://bugs.webkit.org/show_bug.cgi?id=194427
3271         <rdar://48045861>
3272
3273         This caused crashes, and feature design has evolved away from needing the daemon in this form.
3274
3275         * NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm:
3276         (WebKit::DaemonMain):
3277         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
3278         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
3279         (WebKit::XPCServiceEventHandler):
3280         (WebKit::XPCServiceMain):
3281         (WebKit::XPCEventHandler): Deleted.
3282         (WebKit::XPCInitializationHandler): Deleted.
3283         * UIProcess/API/APIProcessPoolConfiguration.h:
3284         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3285         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3286         (-[_WKProcessPoolConfiguration usesNetworkingDaemon]): Deleted.
3287         (-[_WKProcessPoolConfiguration setUsesNetworkingDaemon:]): Deleted.
3288         * UIProcess/AuxiliaryProcessProxy.cpp:
3289         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
3290         * UIProcess/Launcher/ProcessLauncher.h:
3291         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
3292         (WebKit::serviceName):
3293         (WebKit::ProcessLauncher::launchProcess):
3294         * UIProcess/Network/NetworkProcessProxy.cpp:
3295         (WebKit::NetworkProcessProxy::getLaunchOptions):
3296         * UIProcess/WebProcessPool.cpp:
3297         (WebKit::WebProcessPool::usesNetworkingDaemon const): Deleted.
3298         * UIProcess/WebProcessPool.h:
3299
3300 2019-03-01  Alex Christensen  <achristensen@webkit.org>
3301
3302         Add setters on WKWebsiteDataStore for sourceApplicationBundleIdentifier and sourceApplicationSecondaryIdentifier
3303         https://bugs.webkit.org/show_bug.cgi?id=195229
3304         <rdar://problem/48520362>
3305
3306         Reviewed by Chris Dumez.
3307
3308         Just like _setBoundInterfaceIdentifier, we need a way to set these properties after instantiation of a WKWebsiteDataStore,
3309         but we need to make sure we don't set it after the parameters have been copied to the NetworkProcess.
3310
3311         Functionality verified by manual testing.  See radar.
3312         Added an API test that verifies the setter restrictions work as expected.
3313
3314         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3315         (-[WKWebsiteDataStore _sourceApplicationBundleIdentifier]):
3316         (-[WKWebsiteDataStore _setSourceApplicationBundleIdentifier:]):
3317         (-[WKWebsiteDataStore _sourceApplicationSecondaryIdentifier]):
3318         (-[WKWebsiteDataStore _setSourceApplicationSecondaryIdentifier:]):
3319         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3320         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3321         (WebKit::toPKPaymentRequest):
3322         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3323         (WebKit::WebsiteDataStore::parameters):
3324         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3325         (WebKit::WebsiteDataStore::WebsiteDataStore):
3326         (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
3327         (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
3328         * UIProcess/WebsiteData/WebsiteDataStore.h:
3329         (WebKit::WebsiteDataStore::sourceApplicationBundleIdentifier):
3330         (WebKit::WebsiteDataStore::sourceApplicationSecondaryIdentifier):
3331
3332 2019-03-01  Antoine Quint  <graouts@apple.com>
3333
3334         [iOS] Turn mouse event simulation on by default
3335         https://bugs.webkit.org/show_bug.cgi?id=195218
3336         <rdar://problem/48516794>
3337
3338         Reviewed by Dean Jackson.
3339
3340         * Shared/WebPreferences.yaml:
3341
3342 2019-03-01  Ross Kirsling  <ross.kirsling@sony.com>
3343
3344         EnvironmentUtilities::stripValuesEndingWithString isn't thread-safe
3345         https://bugs.webkit.org/show_bug.cgi?id=194612
3346
3347         Reviewed by Alex Christensen.
3348
3349         This API test really shouldn't be verifying that the actual environment was successfully modified.
3350
3351         At its core, stripValuesEndingWithString is really just split-filter-join. By replacing it with a pair of
3352         simple functions -- one for string processing, one for environment processing -- the API test only needs to