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