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