2020-04-30 Russell Epstein <repstein@apple.com> Apply patch. rdar://problem/62623152 2020-04-30 Alex Christensen <achristensen@webkit.org> Revert most of r260370 and all of r260795 <rdar://problem/62623152> r260370 not only fixed client certificate authentication when using non-persistent WKWebsiteDataStores, but it also removed a strong reference to the WebsiteDataStores, which changed their lifetime and caused their destructor to be called more often in SafariViewController, which caused hangs because of a deadlock in the destruction code I tried to fix in r260795, which introduced suspension hangs. This keeps only the part of r260370 that is necessary to fix client certificate authentication (as verified by the Challenge.ClientCertificateNonPersistentDataStore unit test from r260370 that continues to pass) but reverts the part of that change that changed the lifetime of the WebsiteDataStore, restoring behavior to how the safari-609-branch was without hangs in SafariViewController or in suspension, but with client certificate authentication working in non-persistent WKWebsiteDataStores. This patch applies to the safari-609.2.9.0-branch. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): (WebKit::WebResourceLoadStatisticsStore::didDestroyNetworkSession): (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore): (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate): (WebKit::sharedStatisticsQueue): Deleted. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didClose): * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::~NetworkSession): (WebKit::NetworkSession::destroyResourceLoadStatistics): (WebKit::NetworkSession::setResourceLoadStatisticsEnabled): (WebKit::NetworkSession::recreateResourceLoadStatisticStore): * NetworkProcess/NetworkSession.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::NetworkProcessProxy): (WebKit::NetworkProcessProxy::addSession): (WebKit::NetworkProcessProxy::removeSession): * UIProcess/Network/NetworkProcessProxy.h: 2020-04-27 Russell Epstein <repstein@apple.com> Apply patch. rdar://problem/62377357 2020-04-27 Alex Christensen <achristensen@webkit.org> Stop waiting for a BinarySemaphore on the main thread in the NetworkProcess https://bugs.webkit.org/show_bug.cgi?id=211080 <rdar://problem/62377357> Reviewed by Darin Adler and Chris Dumez. There was an out-of-date comment suggesting we needed to use a semaphore, but we've since added these in the destructor: RELEASE_ASSERT(!m_statisticsStore); RELEASE_ASSERT(!m_persistentStorage); This indicates that flushAndDestroyPersistentStore is called before the destructor, at which time it is safe to add a reference to keep it alive. WebResourceLoadStatisticsStore is also marked as WTF::DestructionThread::Main so this should do everything we need. We also flush these databases to disk before closing like we did cookies. In order to keep tests working as they are, I needed to make recreateResourceLoadStatisticStore have a CompletionHandler and have all WebResourceLoadStatisticsStores share the same queue to serialize background tasks between WebResourceLoadStatisticsStores with and without database stores sequentially to avoid opening a SQLiteDatabase before the previous WebResourceLoadStatisticsStore had closed it. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::sharedStatisticsQueue): (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): (WebKit::WebResourceLoadStatisticsStore::didDestroyNetworkSession): (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore): (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate): Deleted. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didClose): * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::~NetworkSession): (WebKit::NetworkSession::destroyResourceLoadStatistics): (WebKit::NetworkSession::setResourceLoadStatisticsEnabled): (WebKit::NetworkSession::recreateResourceLoadStatisticStore): * NetworkProcess/NetworkSession.h: 2020-04-23 Russell Epstein <repstein@apple.com> Apply patch. rdar://problem/62272256 2020-04-23 Per Arne Vollan <pvollan@apple.com> Only hearing audio with black screen when playing video <rdar://problem/59464464> [contentsScale = 0] PUBLIC SEED ☂: Only hearing audio with black screen when playing video Reviewed by Brent Fulgham. Add mach-lookup access to MobileGestalt service. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-04-22 Russell Epstein <repstein@apple.com> Cherry-pick r260474. rdar://problem/62083321. 2020-04-21 Jer Noble <jer.noble@apple.com> PiP buttons shows up in element fullscreen when PiP is disabled in WKWebViewConfiguration https://bugs.webkit.org/show_bug.cgi?id=210813 Not currently testable; entering fullscreen never completes in the iOS TestWebKitAPI app because that process is not a UI Application. * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: (-[WKFullScreenViewController videoControlsManagerDidChange]): 2020-04-21 Alan Coon <alancoon@apple.com> Apply patch. rdar://problem/62083319 2020-04-21 Alex Christensen <achristensen@webkit.org> NetworkSessionCocoa should request client certificate only once per host/port https://bugs.webkit.org/show_bug.cgi?id=210626 <rdar://problem/60340449> Reviewed by Geoffrey Garen. NSURLSession creates more than one TCP connection to a server when using HTTP 1.1. Each TCP connection with TLS generates a didReceiveChallenge to do the server trust evaluation of the certificate chain. If the server requests a client certificate in the TLS handshake, it also generates a didReceiveChallenge to request client certificates as well. This is an implementation detail of our networking. We should not actually ask the WKNavigationDelegate for client certificates more than once per host/port. We should remember the credential and give it to NSURLSession immediately if we have used this credential in the past for a task that has received bytes (either a response or a redirect). If the TLS handshake fails, we should not reuse that same certificate automatically. * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]): (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): (WebKit::NetworkSessionCocoa::clientCertificateSuggestedForHost): (WebKit::NetworkSessionCocoa::taskReceivedBytes): (WebKit::NetworkSessionCocoa::taskFailed): (WebKit::NetworkSessionCocoa::successfulClientCertificateForHost const): 2020-04-20 Alan Coon <alancoon@apple.com> Apply patch. rdar://problem/61950472 2020-04-20 Brady Eidson <beidson@apple.com> Pass sandbox extensions for back/forward list navigations after the policy is decided at process-swap time. <rdar://problem/59535167> and https://bugs.webkit.org/show_bug.cgi?id=210623 Reviewed by Geoff Garen. Covered by almost all existing tests, and a new API test. Instead of granting a sandbox extension when updating the back/forward cursor for a pending back/forward list traversal, do so after the client decides the policy. (Which is also along with a process swap in interesting cases) * Shared/PolicyDecision.h: (WebKit::PolicyDecision::encode const): (WebKit::PolicyDecision::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/APINavigation.cpp: (API::Navigation::Navigation): * UIProcess/API/APINavigation.h: (API::Navigation::create): (API::Navigation::reloadItem const): * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::backForwardGoToItem): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebNavigationState.cpp: (WebKit::WebNavigationState::createReloadNavigation): * UIProcess/WebNavigationState.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::launchProcessForReload): (WebKit::WebPageProxy::reload): (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::receivedPolicyDecision): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::receivedPolicyDecision): * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/WebBackForwardListProxy.cpp: (WebKit::WebBackForwardListProxy::goToItem): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::didReceivePolicyDecision): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::SandboxExtensionTracker::didStartProvisionalLoad): 2020-04-17 Alan Coon <alancoon@apple.com> Cherry-pick r260278. rdar://problem/61950220 Bring Fullscreen API + alert() behavior from iOS to macOS https://bugs.webkit.org/show_bug.cgi?id=210662 Reviewed by Eric Carlson. Source/WebKit: When a page is showing an alert(), all non-synchronous messages will be blocked until the sync XPC for alert() ends. And when exiting fullscreen, we block completing the fullscreen exit animation until a repaint XPC completes. So a page that is showing an alert() will never fully exit element fullscreen mode. On iOS, we fixed this behavior by exiting fullscreen mode whenever the page shows an alert() or prompt(). We should bring this behavior to macOS as well. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): Tools: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKitCocoa/FullscreenAlert.mm: Added. (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260278 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-04-17 Jer Noble <jer.noble@apple.com> Bring Fullscreen API + alert() behavior from iOS to macOS https://bugs.webkit.org/show_bug.cgi?id=210662 Reviewed by Eric Carlson. When a page is showing an alert(), all non-synchronous messages will be blocked until the sync XPC for alert() ends. And when exiting fullscreen, we block completing the fullscreen exit animation until a repaint XPC completes. So a page that is showing an alert() will never fully exit element fullscreen mode. On iOS, we fixed this behavior by exiting fullscreen mode whenever the page shows an alert() or prompt(). We should bring this behavior to macOS as well. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): 2020-04-16 Alan Coon <alancoon@apple.com> Cherry-pick r259814. rdar://problem/61888315 WTF::Persistence::Coder and WTF::Persistence::Decoder should use WARN_UNUSED_RETURN <https://webkit.org/b/210238> <rdar://problem/61491575> Reviewed by Darin Adler. Source/WebKit: * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::decodeStorageRecord): - Add missing return value check for decode.decode(). Source/WTF: * wtf/persistence/PersistentCoders.cpp: (WTF::Persistence::decodeStringText): - Add WARN_UNUSED_RETURN. * wtf/persistence/PersistentCoders.h: (WTF::Persistence::Coder<Optional<T>>::decode): (WTF::Persistence::Coder<Seconds>::decode): (WTF::Persistence::Coder<WallTime>::decode): - Add WARN_UNUSED_RETURN. - Add missing return value check for decode.decodeFixedLengthData(). * wtf/persistence/PersistentDecoder.h: (WTF::Persistence::Decoder::decode): (WTF::Persistence::Decoder::decodeEnum): (WTF::Persistence::Decoder::bufferIsLargeEnoughToContain const): - Add WARN_UNUSED_RETURN. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259814 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-04-09 David Kilzer <ddkilzer@apple.com> WTF::Persistence::Coder and WTF::Persistence::Decoder should use WARN_UNUSED_RETURN <https://webkit.org/b/210238> <rdar://problem/61491575> Reviewed by Darin Adler. * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::decodeStorageRecord): - Add missing return value check for decode.decode(). 2020-04-15 Russell Epstein <repstein@apple.com> Cherry-pick r260101. rdar://problem/61853298 createArchiveList() in WebCoreArgumentCodersMac.mm should do more validity checks <https://webkit.org/b/210448> <rdar://problem/61677029> Reviewed by Darin Adler. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::createArchiveList): Add more validity checks. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260101 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-04-14 David Kilzer <ddkilzer@apple.com> createArchiveList() in WebCoreArgumentCodersMac.mm should do more validity checks <https://webkit.org/b/210448> <rdar://problem/61677029> Reviewed by Darin Adler. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::createArchiveList): Add more validity checks. 2020-04-12 Alan Coon <alancoon@apple.com> Cherry-pick r259316. rdar://problem/61269751 IndexedDB: destroy WebIDBServer when session is removed in network process https://bugs.webkit.org/show_bug.cgi?id=209606 <rdar://problem/59310081> Reviewed by Geoffrey Garen. Source/WebCore: Rename immediateCloseForUserDelete to immediateClose as we now use it in destructor of IDBServer to make sure everything in database finishes correctly. * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::~IDBServer): (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince): (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesForOrigins): * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::immediateClose): (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete): Deleted. * Modules/indexeddb/server/UniqueIDBDatabase.h: Source/WebKit: Tested manually to verify WebIDBServer is removed and its thread ends when session is removed. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::~WebIDBServer): (WebKit::WebIDBServer::addConnection): (WebKit::WebIDBServer::removeConnection): (WebKit::WebIDBServer::close): * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::destroySession): (WebKit::NetworkProcess::connectionToWebProcessClosed): Source/WTF: Add function to kill CrossThreadTaskHandler and make thread finish. Also add a callback to be called before thread finishes. * wtf/CrossThreadTaskHandler.cpp: (WTF::CrossThreadTaskHandler::CrossThreadTaskHandler): (WTF::CrossThreadTaskHandler::setCompletionCallback): (WTF::CrossThreadTaskHandler::kill): * wtf/CrossThreadTaskHandler.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259316 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-03-31 Sihui Liu <sihui_liu@apple.com> IndexedDB: destroy WebIDBServer when session is removed in network process https://bugs.webkit.org/show_bug.cgi?id=209606 <rdar://problem/59310081> Reviewed by Geoffrey Garen. Tested manually to verify WebIDBServer is removed and its thread ends when session is removed. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::~WebIDBServer): (WebKit::WebIDBServer::addConnection): (WebKit::WebIDBServer::removeConnection): (WebKit::WebIDBServer::close): * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::destroySession): (WebKit::NetworkProcess::connectionToWebProcessClosed): 2020-04-10 Alan Coon <alancoon@apple.com> Cherry-pick r259802. rdar://problem/61477495 Source/WebKit: [MacOS] REGRESSION (r253275): Stopping a cloned audio capture track should not stop the original audio track https://bugs.webkit.org/show_bug.cgi?id=210259 <rdar://problem/61466486> Reviewed by Eric Carlson. We changed video track cloning so that each cloned track would get its own source. The source is getting video sample from the real capture source. The real capture source will get stopped if all its client sources are stopped. For audio, we are still using the same audio source for each track. We should thus not close the source until all its tracks are stopped. To do so, we reuse RealtimeMediaSource::requestToEnd instead of directly sending the order to stop observing the remote audio source. Test: fast/mediastream/mediastreamtrack-audio-clone.html * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::Source::requestToEnd): (WebKit::UserMediaCaptureManager::Source::stopBeingObserved): Deleted. LayoutTests: [MacOS] Stopping a cloned audio capture track should not stop the original audio track https://bugs.webkit.org/show_bug.cgi?id=210259 <rdar://problem/61466486> Reviewed by Eric Carlson. * fast/mediastream/mediastreamtrack-audio-clone-expected.txt: Added. * fast/mediastream/mediastreamtrack-audio-clone.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259802 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-04-09 Youenn Fablet <youenn@apple.com> [MacOS] REGRESSION (r253275): Stopping a cloned audio capture track should not stop the original audio track https://bugs.webkit.org/show_bug.cgi?id=210259 <rdar://problem/61466486> Reviewed by Eric Carlson. We changed video track cloning so that each cloned track would get its own source. The source is getting video sample from the real capture source. The real capture source will get stopped if all its client sources are stopped. For audio, we are still using the same audio source for each track. We should thus not close the source until all its tracks are stopped. To do so, we reuse RealtimeMediaSource::requestToEnd instead of directly sending the order to stop observing the remote audio source. Test: fast/mediastream/mediastreamtrack-audio-clone.html * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::Source::requestToEnd): (WebKit::UserMediaCaptureManager::Source::stopBeingObserved): Deleted. 2020-04-09 Alan Coon <alancoon@apple.com> Revert r259689. rdar://problem/61269751 2020-04-07 Russell Epstein <repstein@apple.com> Cherry-pick r259338. rdar://problem/61269727 Support resolution of IPv6 STUN/TURN addresses https://bugs.webkit.org/show_bug.cgi?id=209808 Reviewed by Eric Carlson. Source/WebCore: Add family access to IPAddress to support both IPv4 and IPv6. Store IPAddress internal value as IPv6 and cast them to IPv4 on demand. * platform/network/DNS.h: * platform/network/soup/DNSResolveQueueSoup.cpp: (WebCore::resolvedWithObserverCallback): Source/WebKit: Update code to support IPv6 addresses when doing DNS resolution of TURN/STUN servers. Refactor code to share more code between Cocoa ports and non Cocoa ports. Manually tested with external IPv6 TURN servers. * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::createResolver): * NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp: (WebKit::resolvedName): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259338 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-04-01 youenn fablet <youenn@apple.com> Support resolution of IPv6 STUN/TURN addresses https://bugs.webkit.org/show_bug.cgi?id=209808 Reviewed by Eric Carlson. Update code to support IPv6 addresses when doing DNS resolution of TURN/STUN servers. Refactor code to share more code between Cocoa ports and non Cocoa ports. Manually tested with external IPv6 TURN servers. * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::createResolver): * NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp: (WebKit::resolvedName): 2020-04-07 Russell Epstein <repstein@apple.com> Cherry-pick r259316. rdar://problem/61269751 IndexedDB: destroy WebIDBServer when session is removed in network process https://bugs.webkit.org/show_bug.cgi?id=209606 <rdar://problem/59310081> Reviewed by Geoffrey Garen. Source/WebCore: Rename immediateCloseForUserDelete to immediateClose as we now use it in destructor of IDBServer to make sure everything in database finishes correctly. * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::~IDBServer): (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince): (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesForOrigins): * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::immediateClose): (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete): Deleted. * Modules/indexeddb/server/UniqueIDBDatabase.h: Source/WebKit: Tested manually to verify WebIDBServer is removed and its thread ends when session is removed. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::~WebIDBServer): (WebKit::WebIDBServer::addConnection): (WebKit::WebIDBServer::removeConnection): (WebKit::WebIDBServer::close): * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::destroySession): (WebKit::NetworkProcess::connectionToWebProcessClosed): Source/WTF: Add function to kill CrossThreadTaskHandler and make thread finish. Also add a callback to be called before thread finishes. * wtf/CrossThreadTaskHandler.cpp: (WTF::CrossThreadTaskHandler::CrossThreadTaskHandler): (WTF::CrossThreadTaskHandler::setCompletionCallback): (WTF::CrossThreadTaskHandler::kill): * wtf/CrossThreadTaskHandler.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259316 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-03-31 Sihui Liu <sihui_liu@apple.com> IndexedDB: destroy WebIDBServer when session is removed in network process https://bugs.webkit.org/show_bug.cgi?id=209606 <rdar://problem/59310081> Reviewed by Geoffrey Garen. Tested manually to verify WebIDBServer is removed and its thread ends when session is removed. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::~WebIDBServer): (WebKit::WebIDBServer::addConnection): (WebKit::WebIDBServer::removeConnection): (WebKit::WebIDBServer::close): * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::destroySession): (WebKit::NetworkProcess::connectionToWebProcessClosed): 2020-04-07 Russell Epstein <repstein@apple.com> Cherry-pick r257222. rdar://problem/61414891 Protect WebProcessPool from null weak pointers in m_serviceWorkerProcesses map https://bugs.webkit.org/show_bug.cgi?id=208143 rdar://problem/58285589 Reviewed by Alex Christensen. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::createWebPage): (WebKit::WebProcessPool::updateServiceWorkerUserAgent): (WebKit::WebProcessPool::updateProcessAssertions): When iterating through the map, make sure it does not have a null entry. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@257222 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-24 Youenn Fablet <youenn@apple.com> Protect WebProcessPool from null weak pointers in m_serviceWorkerProcesses map https://bugs.webkit.org/show_bug.cgi?id=208143 rdar://problem/58285589 Reviewed by Alex Christensen. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::createWebPage): (WebKit::WebProcessPool::updateServiceWorkerUserAgent): (WebKit::WebProcessPool::updateProcessAssertions): When iterating through the map, make sure it does not have a null entry. 2020-04-06 Alan Coon <alancoon@apple.com> Cherry-pick r259580. rdar://problem/61352477 CrashTracer: MobileSafari at WebKit: WebKit::SystemPreviewController::updateProgress https://bugs.webkit.org/show_bug.cgi?id=210040 rdar://51410841 Reviewed by Darin Adler. It appears that the SystemPreviewController on WebPageProxy can become null causing a call to an in-progress download to crash as it tries to talk to the QuickLook delegate. Guard against this by checking the SystemPreviewController each time. * UIProcess/Cocoa/DownloadClient.mm: (WebKit::systemPreviewController): (WebKit::DownloadClient::didReceiveResponse): (WebKit::DownloadClient::didReceiveData): (WebKit::DownloadClient::processDidCrash): (WebKit::DownloadClient::didFinish): (WebKit::DownloadClient::didFail): (WebKit::DownloadClient::didCancel): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259580 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-04-06 Dean Jackson <dino@apple.com> CrashTracer: MobileSafari at WebKit: WebKit::SystemPreviewController::updateProgress https://bugs.webkit.org/show_bug.cgi?id=210040 rdar://51410841 Reviewed by Darin Adler. It appears that the SystemPreviewController on WebPageProxy can become null causing a call to an in-progress download to crash as it tries to talk to the QuickLook delegate. Guard against this by checking the SystemPreviewController each time. * UIProcess/Cocoa/DownloadClient.mm: (WebKit::systemPreviewController): (WebKit::DownloadClient::didReceiveResponse): (WebKit::DownloadClient::didReceiveData): (WebKit::DownloadClient::processDidCrash): (WebKit::DownloadClient::didFinish): (WebKit::DownloadClient::didFail): (WebKit::DownloadClient::didCancel): 2020-04-06 Alan Coon <alancoon@apple.com> Cherry-pick r259315. rdar://problem/61352448 Regression(r253357) DeviceMotionEvent acceleration and rotationRate are null https://bugs.webkit.org/show_bug.cgi?id=209831 <rdar://problem/60720953> Reviewed by Darin Adler. Source/WebCore: The issue was that DeviceMotionClientIOS::motionChanged() would only initialize the acceleration and rotationRate if [m_motionManager gyroAvailable] returned YES. After r253357, m_motionManager is nil because we get motion data from the UIProcess so [m_motionManager gyroAvailable] would always resolve to NO. To address the issue, I made the rotationRate parameters to motionChanged() optional and we rely on them being set to know if gyro data is available. Note that I did not make the acceleration optional because according to [1], all devices have an accelerometer. [1] https://developer.apple.com/documentation/coremotion/cmmotionmanager/1616094-devicemotionavailable?language=objc * platform/ios/DeviceMotionClientIOS.h: * platform/ios/DeviceMotionClientIOS.mm: (WebCore::DeviceMotionClientIOS::motionChanged): * platform/ios/DeviceOrientationUpdateProvider.h: * platform/ios/MotionManagerClient.h: (WebCore::MotionManagerClient::motionChanged): * platform/ios/WebCoreMotionManager.mm: (-[WebCoreMotionManager sendAccelerometerData:]): Source/WebKit: * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h: * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.mm: (WebKit::WebDeviceOrientationUpdateProviderProxy::motionChanged): * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp: (WebKit::WebDeviceOrientationUpdateProvider::deviceMotionChanged): * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h: * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.messages.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259315 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-03-31 Chris Dumez <cdumez@apple.com> Regression(r253357) DeviceMotionEvent acceleration and rotationRate are null https://bugs.webkit.org/show_bug.cgi?id=209831 <rdar://problem/60720953> Reviewed by Darin Adler. * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h: * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.mm: (WebKit::WebDeviceOrientationUpdateProviderProxy::motionChanged): * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp: (WebKit::WebDeviceOrientationUpdateProvider::deviceMotionChanged): * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h: * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.messages.in: 2020-04-03 Alan Coon <alancoon@apple.com> Cherry-pick r257209. rdar://problem/61269710 Protect from null session in NetworkDataTaskCocoa::restrictRequestReferrerToOriginIfNeeded https://bugs.webkit.org/show_bug.cgi?id=208127 rdar://problem/57937917 Reviewed by Chris Dumez. In case of a data task whose session is destroyed, do not follow redirection early on. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@257209 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-24 Youenn Fablet <youenn@apple.com> Protect from null session in NetworkDataTaskCocoa::restrictRequestReferrerToOriginIfNeeded https://bugs.webkit.org/show_bug.cgi?id=208127 rdar://problem/57937917 Reviewed by Chris Dumez. In case of a data task whose session is destroyed, do not follow redirection early on. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): 2020-04-03 Alan Coon <alancoon@apple.com> Cherry-pick r256900. rdar://problem/61269733 SWServer::claim should check for the service worker to be active https://bugs.webkit.org/show_bug.cgi?id=207739 <rdar://problem/45441129> Reviewed by Alex Christensen. Source/WebCore: claim is only working for service workers that are active. But there might be a time when a service worker is active in its web process but redundant in networking process. Thus, we need to move the check from WebProcess to NetworkProcess. * workers/service/ServiceWorkerClients.cpp: (WebCore::ServiceWorkerClients::claim): * workers/service/context/SWContextManager.h: * workers/service/server/SWServer.cpp: (WebCore::SWServer::claim): * workers/service/server/SWServer.h: * workers/service/server/SWServerToContextConnection.cpp: (WebCore::SWServerToContextConnection::claim): * workers/service/server/SWServerToContextConnection.h: * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::claim): Deleted. * workers/service/server/SWServerWorker.h: (WebCore::SWServerWorker::isActive const): Source/WebKit: Use Async Reply to remove the need for a map and passing integers around. * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: (WebKit::WebSWServerToContextConnection::claimCompleted): Deleted. * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::claim): (WebKit::WebSWContextManagerConnection::claimCompleted): Deleted. * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/Storage/WebSWContextManagerConnection.messages.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256900 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-18 Youenn Fablet <youenn@apple.com> SWServer::claim should check for the service worker to be active https://bugs.webkit.org/show_bug.cgi?id=207739 <rdar://problem/45441129> Reviewed by Alex Christensen. Use Async Reply to remove the need for a map and passing integers around. * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: (WebKit::WebSWServerToContextConnection::claimCompleted): Deleted. * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::claim): (WebKit::WebSWContextManagerConnection::claimCompleted): Deleted. * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/Storage/WebSWContextManagerConnection.messages.in: 2020-03-30 Alan Coon <alancoon@apple.com> Cherry-pick r259056. rdar://problem/61064876 Force Touch preview on file:/// URL works while clicking on the URL is blocked https://bugs.webkit.org/show_bug.cgi?id=209589 <rdar://57687893> Reviewed by Antoine Quint. The immediate action for links should never trigger on file: URLs. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _defaultAnimationController]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259056 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-03-26 Dean Jackson <dino@apple.com> Force Touch preview on file:/// URL works while clicking on the URL is blocked https://bugs.webkit.org/show_bug.cgi?id=209589 <rdar://57687893> Reviewed by Antoine Quint. The immediate action for links should never trigger on file: URLs. * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _defaultAnimationController]): 2020-03-30 Alan Coon <alancoon@apple.com> Cherry-pick r258902. rdar://problem/61064808 IPC::Decoder::decodeFixedLengthData() should be marked WARN_UNUSED_RETURN <https://webkit.org/b/209448> <rdar://problem/60797998> Reviewed by Chris Dumez. * Platform/IPC/ArgumentCoders.h: (struct VectorArgumentCoder::decode): - Check the return value of Decoder::decodeFixedLengthData(). * Platform/IPC/Decoder.h: (IPC::Decoder::decodeFixedLengthData): Add WARN_UNUSED_RETURN. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258902 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-03-23 David Kilzer <ddkilzer@apple.com> IPC::Decoder::decodeFixedLengthData() should be marked WARN_UNUSED_RETURN <https://webkit.org/b/209448> <rdar://problem/60797998> Reviewed by Chris Dumez. * Platform/IPC/ArgumentCoders.h: (struct VectorArgumentCoder::decode): - Check the return value of Decoder::decodeFixedLengthData(). * Platform/IPC/Decoder.h: (IPC::Decoder::decodeFixedLengthData): Add WARN_UNUSED_RETURN. b'2020-03-24 Russell Epstein <repstein@apple.com>\n\n Cherry-pick r258814. rdar://problem/60827019\n\n decodeSharedBuffer() in WebCoreArgumentCoders.cpp should validate `bufferSize`\n <https://webkit.org/b/209373>\n <rdar://problem/60610919>\n \n Reviewed by Darin Adler.\n \n * Shared/WebCoreArgumentCoders.cpp:\n (IPC::decodeSharedBuffer):\n - Return early if `bufferSize` is too big.\n \n \n git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258814 268f45cc-cd09-0410-ab3c-d52691b4dbfc\n\n 2020-03-21 David Kilzer <ddkilzer@apple.com>\n\n decodeSharedBuffer() in WebCoreArgumentCoders.cpp should validate `bufferSize`\n <https://webkit.org/b/209373>\n <rdar://problem/60610919>\n\n Reviewed by Darin Adler.\n\n * Shared/WebCoreArgumentCoders.cpp:\n (IPC::decodeSharedBuffer):\n - Return early if `bufferSize` is too big.\n\n b\'2020-03-24 Russell Epstein <repstein@apple.com>\\n\\n Cherry-pick r258180. rdar://problem/60827009\\n\\n [iOS] Replace "unexpectedly resumed" observer with RunningBoard suspendible assertions\\n https://bugs.webkit.org/show_bug.cgi?id=205687\\n <rdar://problem/57890246>\\n \\n Reviewed by Tim Horton.\\n \\n Adopt new RunningBoard process assertion to indicate that WebContent processes depend on their\\n UIProcess (and therefore, the UIProcess must be running if the WebContent process is). This\\n replaces our "Unexpectedly resumed" assertion which was causing unexpected terminations in some\\n cases.\\n \\n * Configurations/WebKit.xcconfig:\\n * Platform/spi/ios/RunningBoardServicesSPI.h: Added.\\n * Scripts/process-entitlements.sh:\\n * Shared/DependencyProcessAssertion.cpp: Added.\\n (WebKit::DependencyProcessAssertion::DependencyProcessAssertion):\\n (WebKit::DependencyProcessAssertion::~DependencyProcessAssertion):\\n * Shared/DependencyProcessAssertion.h: Added.\\n * Shared/ios/DependencyProcessAssertionIOS.mm: Added.\\n (WebKit::DependencyProcessAssertion::DependencyProcessAssertion):\\n (WebKit::DependencyProcessAssertion::~DependencyProcessAssertion):\\n * Sources.txt:\\n * SourcesCocoa.txt:\\n * UIProcess/Cocoa/WebProcessProxyCocoa.mm:\\n * UIProcess/WebProcessProxy.h:\\n * UIProcess/WebProcessProxy.messages.in:\\n * WebKit.xcodeproj/project.pbxproj:\\n * WebProcess/WebProcess.cpp:\\n (WebKit::WebProcess::initializeConnection):\\n * WebProcess/WebProcess.h:\\n * WebProcess/cocoa/WebProcessCocoa.mm:\\n \\n git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258180 268f45cc-cd09-0410-ab3c-d52691b4dbfc\\n\\n 2020-03-09 Chris Dumez <cdumez@apple.com>\\n\\n [iOS] Replace "unexpectedly resumed" observer with RunningBoard suspendible assertions\\n https://bugs.webkit.org/show_bug.cgi?id=205687\\n <rdar://problem/57890246>\\n\\n Reviewed by Tim Horton.\\n\\n Adopt new RunningBoard process assertion to indicate that WebContent processes depend on their\\n UIProcess (and therefore, the UIProcess must be running if the WebContent process is). This\\n replaces our "Unexpectedly resumed" assertion which was causing unexpected terminations in some\\n cases.\\n\\n * Configurations/WebKit.xcconfig:\\n * Platform/spi/ios/RunningBoardServicesSPI.h: Added.\\n * Scripts/process-entitlements.sh:\\n * Shared/DependencyProcessAssertion.cpp: Added.\\n (WebKit::DependencyProcessAssertion::DependencyProcessAssertion):\\n (WebKit::DependencyProcessAssertion::~DependencyProcessAssertion):\\n * Shared/DependencyProcessAssertion.h: Added.\\n * Shared/ios/DependencyProcessAssertionIOS.mm: Added.\\n (WebKit::DependencyProcessAssertion::DependencyProcessAssertion):\\n (WebKit::DependencyProcessAssertion::~DependencyProcessAssertion):\\n * Sources.txt:\\n * SourcesCocoa.txt:\\n * UIProcess/Cocoa/WebProcessProxyCocoa.mm:\\n * UIProcess/WebProcessProxy.h:\\n * UIProcess/WebProcessProxy.messages.in:\\n * WebKit.xcodeproj/project.pbxproj:\\n * WebProcess/WebProcess.cpp:\\n (WebKit::WebProcess::initializeConnection):\\n * WebProcess/WebProcess.h:\\n * WebProcess/cocoa/WebProcessCocoa.mm:\\n\\n b\\\'2020-03-23 Russell Epstein <repstein@apple.com>\\\\n\\\\n Cherry-pick r258741. rdar://problem/60756641\\\\n\\\\n Sanitize suggested download filename received from web process\\\\n https://bugs.webkit.org/show_bug.cgi?id=209300\\\\n <rdar://problem/59487723>\\\\n \\\\n Patch by Alex Christensen <achristensen@webkit.org> on 2020-03-19\\\\n Reviewed by Chris Dumez.\\\\n \\\\n Source/WebKit:\\\\n \\\\n * UIProcess/Downloads/DownloadProxy.cpp:\\\\n (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):\\\\n \\\\n LayoutTests:\\\\n \\\\n * fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash-expected.txt:\\\\n * fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html:\\\\n \\\\n git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258741 268f45cc-cd09-0410-ab3c-d52691b4dbfc\\\\n\\\\n 2020-03-19 Alex Christensen <achristensen@webkit.org>\\\\n\\\\n Sanitize suggested download filename received from web process\\\\n https://bugs.webkit.org/show_bug.cgi?id=209300\\\\n <rdar://problem/59487723>\\\\n\\\\n Reviewed by Chris Dumez.\\\\n\\\\n * UIProcess/Downloads/DownloadProxy.cpp:\\\\n (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):\\\\n\\\\n\\\'2020-03-23 Russell Epstein <repstein@apple.com>\\n\\n Apply patch. rdar://problem/60756683\\n 2020-03-23 John Wilander <wilander@apple.com>\\n Cherry-pick r258599. rdar://problem/60089022\\n 2020-03-17 John Wilander <wilander@apple.com>\\n Add quirk for cookie blocking latch mode ymail.com redirecting to yahoo.com under yahoo.com\\n https://bugs.webkit.org/show_bug.cgi?id=209193\\n <rdar://problem/60089022>\\n\\n Reviewed by Brent Fulgham.\\n\\n No new tests. Site-specific quirk tested manually on the site in question.\\n * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:\\n * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:\\n (WebKit::NetworkDataTaskCocoa::unblockCookies):\\n (WebKit::NetworkDataTaskCocoa::needsFirstPartyCookieBlockingLatchModeQuirk const):\\n (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):\\n\\n Apply patch. rdar://problem/60363244\\n\\n Crash in com.apple.WebKit.WebContent at WebKit::WebSWClientConnection::scheduleJobInServer <rdar://problem/60363244>\\n\\n Patch by Youenn Fablet <youenn@apple.com> on 2020-03-13\\n Reviewed by David Kilzer.\\n\\n * WebProcess/Storage/WebSWClientConnection.cpp:\\n (WebKit::WebSWClientConnection::scheduleJobInServer):\\n - Revert branch commit r256687. This RELEASE_ASSERT() was\\n removed on trunk as part of r256578 (which was merged to this\\n branch in r256680, then added back in r256687).\\n\\n 2020-03-13 Youenn Fablet <youenn@apple.com>\\n\\n Crash in com.apple.WebKit.WebContent at WebKit::WebSWClientConnection::scheduleJobInServer\\n <rdar://problem/60363244>\\n\\n Reviewed by David Kilzer.\\n\\n * WebProcess/Storage/WebSWClientConnection.cpp:\\n (WebKit::WebSWClientConnection::scheduleJobInServer):\\n - Revert branch commit r256687. This RELEASE_ASSERT() was\\n removed on trunk as part of r256578 (which was merged to this\\n branch in r256680, then added back in r256687).\\n\\n\'2020-03-17 Kocsen Chung <kocsen_chung@apple.com>\n\n Apply patch. rdar://problem/60500511\n\n 2020-03-17 David Kilzer <ddkilzer@apple.com>\n\n Cherry-pick r258507. rdar://problem/60500511\n\n 2020-03-16 David Kilzer <ddkilzer@apple.com>\n\n WebPage::GetDataSelectionForPasteboard should validate its `size` variable\n <https://webkit.org/b/209092>\n <rdar://problem/60181345>\n\n Reviewed by Brent Fulgham.\n\n * Platform/IPC/Connection.h:\n (MESSAGE_CHECK_WITH_RETURN_VALUE_BASE): Add.\n - Variant of MESSAGE_CHECK_BASE() that takes a return value.\n * UIProcess/mac/WebPageProxyMac.mm:\n (MESSAGE_CHECK_WITH_RETURN_VALUE): Add.\n (WebKit::WebPageProxy::dataSelectionForPasteboard):\n - Use new MESSAGE_CHECK_WITH_RETURN_VALUE() macro to update\n check for handle.isNull() and to add check for `size`\n variable.\n - Add static_cast<size_t>() to `size` variable to denote type\n change.\n\n'2020-03-17 Alan Coon <alancoon@apple.com> Apply patch. rdar://problem/60433244 2020-03-17 David Kilzer <ddkilzer@apple.com> Cherry-pick r258401. rdar://problem/60433244 2020-03-13 David Kilzer <ddkilzer@apple.com> WebPageProxy::SetPromisedDataForImage should validate its `imageSize` and `archiveSize` parameters <https://webkit.org/b/209029> <rdar://problem/60181394> Reviewed by Youenn Fablet. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::setPromisedDataForImage): - Validate `imageSize` and `archiveSize` using MESSAGE_CHECK(). - Add static_cast<size_t>() to `imageSize` and `archiveSize` parameters to denote type change. - Add nullptr check for SharedMemory::map() result with `archiveHandle`. 2020-03-17 Alan Coon <alancoon@apple.com> Apply patch. rdar://problem/60436975 2020-03-17 David Kilzer <ddkilzer@apple.com> Cherry-pick r254724. rdar://problem/60436975 2020-01-16 Chris Dumez <cdumez@apple.com> IPC hardening for WebPageProxy::SetPromisedDataForImage message https://bugs.webkit.org/show_bug.cgi?id=206380 <rdar://problem/58625196> Reviewed by Geoffrey Garen. IPC hardening for WebPageProxy::SetPromisedDataForImage message. Make sure the shared memory handle sent over IPC is not null and null check the SharedMemory object after calling SharedMemory::map(). * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::setPromisedDataForImage): 2020-03-17 Kocsen Chung <kocsen_chung@apple.com> Apply patch. rdar://problem/60396281 2020-03-17 David Kilzer <ddkilzer@apple.com> Cherry-pick r258374. rdar://problem/60396281 2020-03-12 David Kilzer <ddkilzer@apple.com> WebPageProxy::SaveImageToLibrary should validate its `imageSize` parameter <https://webkit.org/b/209012> <rdar://problem/60181295> Reviewed by Chris Dumez. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::saveImageToLibrary): - Validate upper bound of `imageSize` parameter. - Add static_cast<size_t>() to `imageSize` parameter to denote type change. 2020-03-17 Alan Coon <alancoon@apple.com> Apply patch. rdar://problem/60396294 2020-03-17 David Kilzer <ddkilzer@apple.com> Cherry-pick r258334. rdar://problem/60396294 2020-03-12 David Kilzer <ddkilzer@apple.com> WebPasteboardProxy::SetPasteboardBufferForType should validate its `size` parameter <https://webkit.org/b/208902> <rdar://problem/60181117> Reviewed by Chris Dumez. * Platform/IPC/Connection.h: (MESSAGE_CHECK_BASE): - Define in terms of MESSAGE_CHECK_COMPLETION_BASE() with a no-op completion handler. (MESSAGE_CHECK_COMPLETION_BASE): - Rename from MESSAGE_CHECK_BASE() and add completion handler parameter. * Platform/SharedMemory.h: (WebKit::SharedMemory::Handle::size const): Add. * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: (MESSAGE_CHECK): - Define macro to use in WebPasteboardProxy::setPasteboardBufferForType(). - Undefine macro at end of source file due to unified sources. (WebKit::WebPasteboardProxy::setPasteboardBufferForType): - Add IPC::Connection& parameter after change to WebPasteboardProxy.messages.in. Use with MESSAGE_CHECK(). - Validate `size` parameter using MESSAGE_CHECK(). Because SharedMemory::Handle::size() returns a size_t value, we do not need to check `size <= std::numeric_limits<size_t>::max()`. - Add static_cast<size_t>() to size parameter to denote type change. * UIProcess/WebPasteboardProxy.h: (WebKit::WebPasteboardProxy::setPasteboardBufferForType): - Add IPC::Connection& parameter after change to WebPasteboardProxy.messages.in. * UIProcess/WebPasteboardProxy.messages.in: (SetPasteboardBufferForType): - Add 'WantsConnection' attribute to add IPC::Connection& parameter to WebPasteboardProxy::setPasteboardBufferForType(). 2020-03-17 Alan Coon <alancoon@apple.com> Apply patch. rdar://problem/60430195 2020-03-17 David Kilzer <ddkilzer@apple.com> Cherry-pick r258053. rdar://problem/60430195 2020-03-06 David Kilzer <ddkilzer@apple.com> IPC hardening for WebPageProxy::SaveImageToLibrary message <https://webkit.org/b/208730> <rdar://problem/58700693> Reviewed by Chris Dumez. * UIProcess/ios/WebPageProxyIOS.mm: (MESSAGE_CHECK): Define macro only for methods in this source file. (WebKit::WebPageProxy::saveImageToLibrary): - Make sure the shared memory handle sent over IPC is not null. - Make sure the image size sent over IPC is not zero. - Null check the SharedMemory object after calling SharedMemory::map(). 2020-03-09 Alan Coon <alancoon@apple.com> Cherry-pick r257659. rdar://problem/60183766 macCatalyst: 'Open' context menu item doesn't work https://bugs.webkit.org/show_bug.cgi?id=208388 <rdar://problem/59820273> Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanupInteraction]): (-[WKContentView _webTouchEventsRecognized:]): (-[WKContentView _doubleTapRecognizedForDoubleClick:]): (-[WKContentView _singleTapRecognized:]): (-[WKContentView _attemptClickAtLocation:modifierFlags:]): (-[WKContentView _mouseGestureRecognizerChanged:]): In r178980, a mechanism was introduced to ensure that synthetic clicks are only dispatched to the page that the user originally touched. macCatalyst's WKMouseGestureRecognizer unintentionally entirely bypassed this mechanism, never setting _layerTreeTransactionIdAtLastTouchStart, because the touch event gesture recognizer is disabled. This was generally fine because in this case, we don't need to send synthetic clicks, instead sending proper mouse events. However, the "Open" context menu item works by sending a synthetic click at the original interaction location. Since we did not set _layerTreeTransactionIdAtLastTouchStart, the Web Content process will ignore the click, and perform no action. Fix this by also setting _layerTreeTransactionIdAtLastTouchStart on mouseDown. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@257659 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-28 Tim Horton <timothy_horton@apple.com> macCatalyst: 'Open' context menu item doesn't work https://bugs.webkit.org/show_bug.cgi?id=208388 <rdar://problem/59820273> Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanupInteraction]): (-[WKContentView _webTouchEventsRecognized:]): (-[WKContentView _doubleTapRecognizedForDoubleClick:]): (-[WKContentView _singleTapRecognized:]): (-[WKContentView _attemptClickAtLocation:modifierFlags:]): (-[WKContentView _mouseGestureRecognizerChanged:]): In r178980, a mechanism was introduced to ensure that synthetic clicks are only dispatched to the page that the user originally touched. macCatalyst's WKMouseGestureRecognizer unintentionally entirely bypassed this mechanism, never setting _layerTreeTransactionIdAtLastTouchStart, because the touch event gesture recognizer is disabled. This was generally fine because in this case, we don't need to send synthetic clicks, instead sending proper mouse events. However, the "Open" context menu item works by sending a synthetic click at the original interaction location. Since we did not set _layerTreeTransactionIdAtLastTouchStart, the Web Content process will ignore the click, and perform no action. Fix this by also setting _layerTreeTransactionIdAtLastTouchStart on mouseDown. 2020-03-09 Alan Coon <alancoon@apple.com> Cherry-pick r256789. rdar://problem/60183772 macCatalyst: I-beam is still too aggressive in non-editable content, shows up beyond the end of text https://bugs.webkit.org/show_bug.cgi?id=207867 <rdar://problem/59528927> Reviewed by Wenson Hsieh. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::populateCaretContext): Only expand the I-beam region to the end of the line in editable text. This better matches the macOS behavior. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256789 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-17 Tim Horton <timothy_horton@apple.com> macCatalyst: I-beam is still too aggressive in non-editable content, shows up beyond the end of text https://bugs.webkit.org/show_bug.cgi?id=207867 <rdar://problem/59528927> Reviewed by Wenson Hsieh. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::populateCaretContext): Only expand the I-beam region to the end of the line in editable text. This better matches the macOS behavior. 2020-02-21 Russell Epstein <repstein@apple.com> Apply patch. rdar://problem/59680475 2020-02-21 Chris Dumez <cdumez@apple.com> REGRESSION (r255533) Null Deref of _sessionWrapper under [WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:] https://bugs.webkit.org/show_bug.cgi?id=208029 <rdar://problem/59404381> Reviewed by Tim Horton. r255533 started dereferencing _sessionWrapper without null check in didReceiveChallenge. All other delegates in this file null check _sessionWrapper before using it because it is a weak pointer. Add a null check to avoid crashing. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): 2020-02-21 Russell Epstein <repstein@apple.com> Cherry-pick r257106. rdar://problem/59676866 Add fidelity.com to the desktop class quirks list https://bugs.webkit.org/show_bug.cgi?id=208037 <rdar://problem/59480381> Reviewed by Brent Fulgham. No new tests. This patch just adds a domain name to a quirks function. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::desktopClassBrowsingRecommendedForRequest): fidelity.com and its subdomains now return false. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@257106 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-20 John Wilander <wilander@apple.com> Add fidelity.com to the desktop class quirks list https://bugs.webkit.org/show_bug.cgi?id=208037 <rdar://problem/59480381> Reviewed by Brent Fulgham. No new tests. This patch just adds a domain name to a quirks function. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::desktopClassBrowsingRecommendedForRequest): fidelity.com and its subdomains now return false. 2020-02-21 Russell Epstein <repstein@apple.com> Cherry-pick r257103. rdar://problem/59676889 WebIDBServer resume should return early if suspend does not happen https://bugs.webkit.org/show_bug.cgi?id=208027 <rdar://problem/59617654> Reviewed by Geoffrey Garen. We should not try releasing a lock that is not held. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::resume): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@257103 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-20 Sihui Liu <sihui_liu@apple.com> WebIDBServer resume should return early if suspend does not happen https://bugs.webkit.org/show_bug.cgi?id=208027 <rdar://problem/59617654> Reviewed by Geoffrey Garen. We should not try releasing a lock that is not held. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::resume): 2020-02-21 Russell Epstein <repstein@apple.com> Cherry-pick r257089. rdar://problem/59676923 NetworkCache should use 4KB threshold for mmap-ed files instead of 16KB https://bugs.webkit.org/show_bug.cgi?id=207882 Reviewed by Alex Christensen. Source/WebKit: We found that a lot of Vectors in Membuster is holding resource content. This is because we have 16KB threshold for mmap-ed files. If a file is smaller than 16KB, it is copied to Vector instead. But this is costly in terms of memory. If we use mmap-ed files, it becomes named-pages instead of anonymous-pages. File-backed non-dirty named-pages have a lot of benefit. 1. The application is offering a hint that pages are file-backed. This means that OS can purge them at any time since the content can be recovered from the disk. This is cheaper than swapping / compressing anonymous pages since just discarding works. 2. The application is offering a hint that pages have spatial locality. Purging pages in one named-pages region is better compared to purging the same # of anonymous pages randomly. Anonymous pages are split by malloc implementation and access pattern of pages in one VA is random. On the other hand, named-pages are accessed together because it is file, and file typically has sequential locality. And recovery of named pages are also cheap compared to anonymous pages since OS can prefetch pages once access happens because of sequential locality of files. This tendency makes OS like purging named pages instead of anonymous pages. In WebKit use case, this works perfectly. CachedResource typically has decoded content. So typically WebProcess does not access SharedBuffer after the content is decoded. This patch reduces the threshold from 16KB to page size (4KB in macOS, 16KB in iOS). This is pre-2015 behavior. This offers 2.56% progression with 98% probability in Membuster. * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::maximumInlineBodySize): (WebKit::NetworkCache::estimateRecordsSize): (WebKit::NetworkCache::Storage::shouldStoreBodyAsBlob): LayoutTests: The test is assuming that 12KB file is served via non-mmap-file. This assumption is flaky and broken by this change. For now, we pick smaller file to meet this assumption. * http/tests/inspector/network/resource-sizes-disk-cache-expected.txt: * http/tests/inspector/network/resource-sizes-disk-cache.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@257089 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-20 Yusuke Suzuki <ysuzuki@apple.com> NetworkCache should use 4KB threshold for mmap-ed files instead of 16KB https://bugs.webkit.org/show_bug.cgi?id=207882 Reviewed by Alex Christensen. We found that a lot of Vectors in Membuster is holding resource content. This is because we have 16KB threshold for mmap-ed files. If a file is smaller than 16KB, it is copied to Vector instead. But this is costly in terms of memory. If we use mmap-ed files, it becomes named-pages instead of anonymous-pages. File-backed non-dirty named-pages have a lot of benefit. 1. The application is offering a hint that pages are file-backed. This means that OS can purge them at any time since the content can be recovered from the disk. This is cheaper than swapping / compressing anonymous pages since just discarding works. 2. The application is offering a hint that pages have spatial locality. Purging pages in one named-pages region is better compared to purging the same # of anonymous pages randomly. Anonymous pages are split by malloc implementation and access pattern of pages in one VA is random. On the other hand, named-pages are accessed together because it is file, and file typically has sequential locality. And recovery of named pages are also cheap compared to anonymous pages since OS can prefetch pages once access happens because of sequential locality of files. This tendency makes OS like purging named pages instead of anonymous pages. In WebKit use case, this works perfectly. CachedResource typically has decoded content. So typically WebProcess does not access SharedBuffer after the content is decoded. This patch reduces the threshold from 16KB to page size (4KB in macOS, 16KB in iOS). This is pre-2015 behavior. This offers 2.56% progression with 98% probability in Membuster. * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::maximumInlineBodySize): (WebKit::NetworkCache::estimateRecordsSize): (WebKit::NetworkCache::Storage::shouldStoreBodyAsBlob): 2020-02-21 Russell Epstein <repstein@apple.com> Cherry-pick r257077. rdar://problem/59676879 REGRESSION (r255677): Reloading tab with beforeunload prompt closes tab when asking to stay on page https://bugs.webkit.org/show_bug.cgi?id=208015 <rdar://problem/59591630> Reviewed by Geoffrey Garen. Source/WebKit: Make sure we only restart the tryClose timer after the beforeunload prompt if the timer was actually active before the prompt (i.e. tryClose was actually called). On Reload, tryClose is not called but beforeunload prompt may still happen. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ModalAlerts.mm: (TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@257077 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-20 Chris Dumez <cdumez@apple.com> REGRESSION (r255677): Reloading tab with beforeunload prompt closes tab when asking to stay on page https://bugs.webkit.org/show_bug.cgi?id=208015 <rdar://problem/59591630> Reviewed by Geoffrey Garen. Make sure we only restart the tryClose timer after the beforeunload prompt if the timer was actually active before the prompt (i.e. tryClose was actually called). On Reload, tryClose is not called but beforeunload prompt may still happen. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): 2020-02-21 Russell Epstein <repstein@apple.com> Cherry-pick r256967. rdar://problem/59654609 Regression(r247567) HTTP Disk cache capacity is no longer set https://bugs.webkit.org/show_bug.cgi?id=207959 <rdar://problem/59603972> Reviewed by Alex Christensen. NetworkProcess::initializeNetworkProcess() was setting the cache model, which would iterate over all network sessions to update their network cache capacity. The issue was that network sessions were not constructed yet at this point. When the network session(s) would get created later on, they would construct their NetworkCache and it would use the default capacity (i.e. std::numeric_limits<size_t>::max()). To make this safer, I have moved the capacity computation to the Cache::open() method and now pass the capacity when constructing the network cache storage. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::setCacheModelSynchronouslyForTesting): (WebKit::NetworkProcess::setCacheModel): * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::cacheModel const): * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::initialize): * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::computeCapacity): (WebKit::NetworkCache::Cache::open): (WebKit::NetworkCache::Cache::capacity const): (WebKit::NetworkCache::Cache::updateCapacity): (WebKit::NetworkCache::Cache::setCapacity): Deleted. * NetworkProcess/cache/NetworkCache.h: * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::open): (WebKit::NetworkCache::Storage::Storage): (WebKit::NetworkCache::Storage::setCapacity): * NetworkProcess/cache/NetworkCacheStorage.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::setCacheModel): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256967 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-19 Chris Dumez <cdumez@apple.com> Regression(r247567) HTTP Disk cache capacity is no longer set https://bugs.webkit.org/show_bug.cgi?id=207959 <rdar://problem/59603972> Reviewed by Alex Christensen. NetworkProcess::initializeNetworkProcess() was setting the cache model, which would iterate over all network sessions to update their network cache capacity. The issue was that network sessions were not constructed yet at this point. When the network session(s) would get created later on, they would construct their NetworkCache and it would use the default capacity (i.e. std::numeric_limits<size_t>::max()). To make this safer, I have moved the capacity computation to the Cache::open() method and now pass the capacity when constructing the network cache storage. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::setCacheModelSynchronouslyForTesting): (WebKit::NetworkProcess::setCacheModel): * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::cacheModel const): * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::initialize): * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::computeCapacity): (WebKit::NetworkCache::Cache::open): (WebKit::NetworkCache::Cache::capacity const): (WebKit::NetworkCache::Cache::updateCapacity): (WebKit::NetworkCache::Cache::setCapacity): Deleted. * NetworkProcess/cache/NetworkCache.h: * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::open): (WebKit::NetworkCache::Storage::Storage): (WebKit::NetworkCache::Storage::setCapacity): * NetworkProcess/cache/NetworkCacheStorage.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::setCacheModel): 2020-02-21 Russell Epstein <repstein@apple.com> Cherry-pick r256881. rdar://problem/59654577 Drop getSandboxExtensionsForBlobFiles() as it is dead code https://bugs.webkit.org/show_bug.cgi?id=207909 <rdar://problem/59562180> Reviewed by Per Arne Vollan. * NetworkProcess/NetworkProcess.cpp: * NetworkProcess/NetworkProcess.h: * UIProcess/Network/NetworkProcessProxy.cpp: * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256881 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-18 Chris Dumez <cdumez@apple.com> Drop getSandboxExtensionsForBlobFiles() as it is dead code https://bugs.webkit.org/show_bug.cgi?id=207909 <rdar://problem/59562180> Reviewed by Per Arne Vollan. * NetworkProcess/NetworkProcess.cpp: * NetworkProcess/NetworkProcess.h: * UIProcess/Network/NetworkProcessProxy.cpp: * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: 2020-02-21 Russell Epstein <repstein@apple.com> Cherry-pick r256857. rdar://problem/59654279 NetworkDataTask should not expect its session wrapper to be always live https://bugs.webkit.org/show_bug.cgi?id=207903 rdar://problem/59291486 Reviewed by Alex Christensen. NetworkDataTaskCocoa should take a weak pointer to its session wrapper. If the session wrapper is still valid, then we can remove the task from the session wrapper map. We cannot guarantee session wrapper is valid since NetworkDataTask is ref counted. * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256857 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-18 Youenn Fablet <youenn@apple.com> NetworkDataTask should not expect its session wrapper to be always live https://bugs.webkit.org/show_bug.cgi?id=207903 rdar://problem/59291486 Reviewed by Alex Christensen. NetworkDataTaskCocoa should take a weak pointer to its session wrapper. If the session wrapper is still valid, then we can remove the task from the session wrapper map. We cannot guarantee session wrapper is valid since NetworkDataTask is ref counted. * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa): 2020-02-20 Alan Coon <alancoon@apple.com> Cherry-pick r256933. rdar://problem/59618836 [iOS] Safari sometimes crashes under ViewGestureController::beginSwipeGesture https://bugs.webkit.org/show_bug.cgi?id=207929 <rdar://problem/59493326> Reviewed by Tim Horton. Make ViewGestureController::beginSwipeGesture robust in the case where the target back/forward item no longer exists. This means that a back/forward target item existed when UIKit called into us in canSwipeInDirection, but this item was removed by the time beginSwipeGesture is called. A couple of conditions could make this possible, such as handling incoming synchronous IPC in the UI process that could change the back/forward list before sending outgoing IPC to the web process; alternately, an SPI client could be overriding -_webViewDidBeginNavigationGesture: to run some logic that removes the would-be target back/forward item. To protect against these scenarios, null-check targetItem before attempting to dereference it; if it is null, then reset some state that might've been set as a result of beginning the swipe (that is, m_activeGestureType and m_currentGestureID) and then immediately bail before attempting to install the snapshot view and proceed with the swipe. * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::beginSwipeGesture): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256933 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-18 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Safari sometimes crashes under ViewGestureController::beginSwipeGesture https://bugs.webkit.org/show_bug.cgi?id=207929 <rdar://problem/59493326> Reviewed by Tim Horton. Make ViewGestureController::beginSwipeGesture robust in the case where the target back/forward item no longer exists. This means that a back/forward target item existed when UIKit called into us in canSwipeInDirection, but this item was removed by the time beginSwipeGesture is called. A couple of conditions could make this possible, such as handling incoming synchronous IPC in the UI process that could change the back/forward list before sending outgoing IPC to the web process; alternately, an SPI client could be overriding -_webViewDidBeginNavigationGesture: to run some logic that removes the would-be target back/forward item. To protect against these scenarios, null-check targetItem before attempting to dereference it; if it is null, then reset some state that might've been set as a result of beginning the swipe (that is, m_activeGestureType and m_currentGestureID) and then immediately bail before attempting to install the snapshot view and proceed with the swipe. * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::beginSwipeGesture): 2020-02-20 Alan Coon <alancoon@apple.com> Cherry-pick r256932. rdar://problem/59618845 Disable the process cache when process-per-tab is disabled in the debug menu https://bugs.webkit.org/show_bug.cgi?id=207949 <rdar://problem/57094837> Reviewed by Geoffrey Garen. Disable the process cache when process-per-tab is disabled in the debug menu. The process cache is a process-swap-on-navigation optimization and process-swap-on-navigation is already disabled when process-per-tab is disabled. The process cache is not useful with such configuration and actually leads to crashes too. * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::updateCapacity): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256932 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-19 Chris Dumez <cdumez@apple.com> Disable the process cache when process-per-tab is disabled in the debug menu https://bugs.webkit.org/show_bug.cgi?id=207949 <rdar://problem/57094837> Reviewed by Geoffrey Garen. Disable the process cache when process-per-tab is disabled in the debug menu. The process cache is a process-swap-on-navigation optimization and process-swap-on-navigation is already disabled when process-per-tab is disabled. The process cache is not useful with such configuration and actually leads to crashes too. * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::updateCapacity): 2020-02-20 Russell Epstein <repstein@apple.com> Cherry-pick r256806. rdar://problem/59576023 Add and adopt HAVE(LOOKUP_GESTURE_RECOGNIZER) https://bugs.webkit.org/show_bug.cgi?id=207876 Reviewed by Wenson Hsieh. * wtf/Platform.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): (-[WKContentView cleanupInteraction]): (-[WKContentView _removeDefaultGestureRecognizers]): (-[WKContentView _addDefaultGestureRecognizers]): (-[WKContentView gestureRecognizer:shouldReceiveTouch:]): For symmetry's sake, introduce a HAVE for this gesture. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256806 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-17 Tim Horton <timothy_horton@apple.com> Add and adopt HAVE(LOOKUP_GESTURE_RECOGNIZER) https://bugs.webkit.org/show_bug.cgi?id=207876 Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): (-[WKContentView cleanupInteraction]): (-[WKContentView _removeDefaultGestureRecognizers]): (-[WKContentView _addDefaultGestureRecognizers]): (-[WKContentView gestureRecognizer:shouldReceiveTouch:]): For symmetry's sake, introduce a HAVE for this gesture. 2020-02-19 Russell Epstein <repstein@apple.com> Cherry-pick r257013. rdar://problem/59614282 Crash in WebPageProxy::didStartProvisionalLoadForFrameShared https://bugs.webkit.org/show_bug.cgi?id=207973 Reviewed by Chris Dumez. Use RefPtr to store Frame*. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@257013 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-19 Ryosuke Niwa <rniwa@webkit.org> Crash in WebPageProxy::didStartProvisionalLoadForFrameShared https://bugs.webkit.org/show_bug.cgi?id=207973 Reviewed by Chris Dumez. Use RefPtr to store Frame*. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): 2020-02-19 Russell Epstein <repstein@apple.com> Cherry-pick r256859. rdar://problem/59576018 [macOS] Web process may crash under ServicesOverlayController::buildPotentialHighlightsIfNeeded https://bugs.webkit.org/show_bug.cgi?id=207899 <rdar://problem/55658207> Reviewed by Tim Horton and Simon Fraser. Source/WebCore: Mitigates a null pointer crash in ServicesOverlayController::buildPotentialHighlightsIfNeeded(), wherein the focused frame may not have a FrameView when the ServicesOverlayController's selection invalidation timer fires. This is possible if, while being focused, the newly focused subframe is unparented and reparented, which causes it to momentarily have a null view. During this time, if a selection change had occurred earlier in the runloop, it will schedule the page overlay controller invalidation timer, which will fire and discover that the currently focused frame no longer has a FrameView. Test: editing/selection/selection-change-in-disconnected-frame-crash.html * page/mac/ServicesOverlayController.mm: (WebCore::ServicesOverlayController::buildSelectionHighlight): Source/WebKit: Add another missing null check on iOS, for the case where FrameView is null. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::platformEditorState const): Tools: Make it possible to run tests on macOS with services controls enabled, via a new TestOptions flag. * WebKitTestRunner/TestController.cpp: (WTR::updateTestOptionsFromTestHeader): * WebKitTestRunner/TestOptions.h: (WTR::TestOptions::hasSameInitializationOptions const): * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::TestController::platformCreateWebView): LayoutTests: Add a new layout test to verify that we don't crash under this circumstance. * editing/selection/selection-change-in-disconnected-frame-crash-expected.txt: Added. * editing/selection/selection-change-in-disconnected-frame-crash.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256859 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-18 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] Web process may crash under ServicesOverlayController::buildPotentialHighlightsIfNeeded https://bugs.webkit.org/show_bug.cgi?id=207899 <rdar://problem/55658207> Reviewed by Tim Horton and Simon Fraser. Add another missing null check on iOS, for the case where FrameView is null. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::platformEditorState const): 2020-02-19 Russell Epstein <repstein@apple.com> Cherry-pick r256790. rdar://problem/59576023 Data detectors do not trigger on macCatalyst https://bugs.webkit.org/show_bug.cgi?id=207860 <rdar://problem/59038913> Reviewed by Tim Horton. The lookup gesture which run data detection needs touch information to function. Allow touches to be sent to the gesture. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView gestureRecognizer:shouldReceiveTouch:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256790 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-17 Megan Gardner <megan_gardner@apple.com> Data detectors do not trigger on macCatalyst https://bugs.webkit.org/show_bug.cgi?id=207860 <rdar://problem/59038913> Reviewed by Tim Horton. The lookup gesture which run data detection needs touch information to function. Allow touches to be sent to the gesture. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView gestureRecognizer:shouldReceiveTouch:]): 2020-02-18 Alan Coon <alancoon@apple.com> Cherry-pick r256191. rdar://problem/59447003 Disallow setting base URL to a data or JavaScript URL https://bugs.webkit.org/show_bug.cgi?id=207136 Source/WebCore: Reviewed by Brent Fulgham. Inspired by <https://bugs.chromium.org/p/chromium/issues/detail?id=679318>. Block setting the base URL to a data URL or JavaScript URL as such usage is questionable. This makes WebKit match the behavior of Chrome and Firefox and is in the spirit of the discussion in <https://github.com/whatwg/html/issues/2249>. On Mac and iOS, this restriction is applied only to apps linked against a future SDK to avoid breaking shipped apps. For all other ports, this restriction is enabled by default. Tests: fast/url/relative2.html fast/url/segments-from-data-url2.html http/tests/security/allowed-base-url-data-url-via-setting.html http/tests/security/denied-base-url-data-url.html http/tests/security/denied-base-url-javascript-url.html * dom/Document.cpp: (WebCore::Document::processBaseElement): Condition updating the parsed base URL on whether is has an allowed scheme, if restrictions are enabled. Otherwise, do what we do now. If the scheme is disallowed then log a message to the console to explain this to web developers. * html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::scan): Pass whether to apply restrictons to the base URL to updatePredictedBaseURL(). This depends on whether the setting is enabled or not. (WebCore::TokenPreloadScanner::updatePredictedBaseURL): Modifed to take a boolean as to whether to apply restrictions. If restrictions are not to be applied do what we do now. Otherwise, only do what we do now if the scheme for the predicated base URL is allowed. * html/parser/HTMLPreloadScanner.h: * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::isBaseURLSchemeAllowed): Added. * page/SecurityPolicy.h: * page/Settings.yaml: Add a setting to toggle restrictions on the base URL scheme. Source/WebKit: Reviewed by Brent Fulgham. Apply base URL restrictions to apps linked to a future WebKit to avoid breaking existing apps. * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKWebView.mm: (shouldRestrictBaseURLSchemes): Added. (-[WKWebView _setupPageConfiguration:]): Update settings. * UIProcess/Cocoa/VersionChecks.h: Source/WebKitLegacy/mac: Reviewed by Brent Fulgham. Apply base URL restrictions to apps linked to a future WebKit to avoid breaking existing apps. * Misc/WebKitVersionChecks.h: * WebView/WebView.mm: (shouldRestrictBaseURLSchemes): Added. (-[WebView _commonInitializationWithFrameName:groupName:]): Update settings. Source/WTF: Reviewed by Brent Fulgham. Add some more macro definitions. * wtf/spi/darwin/dyldSPI.h: LayoutTests: RReviewed by Brent Fulgham. Add some tests. Update others to toggle the setting to apply or unapply the new behavior. The test denied-base-url-javascript-url.html is derived from the test base-url-javascript.html, included in <https://chromium.googlesource.com/chromium/src.git/+/c133efa0b915430701930b76a7cfe35608b9a403>. * fast/url/relative-expected.txt: * fast/url/relative.html: * fast/url/relative2-expected.txt: Copied from LayoutTests/fast/url/relative-expected.txt. * fast/url/relative2.html: Copied from LayoutTests/fast/url/relative.html. * fast/url/resources/utilities.js: (setShouldEllipsizeFileURLPaths): Added. Toggles ellipsizing the path portion of a file URL to simplify matching. Otherwise, file URLs could be machine-specific. (canonicalizedPathname): Added. (segments): Modified to optionally call canonicalizedPathname. (canonicalize): Ditto. * fast/url/segments-from-data-url-expected.txt: * fast/url/segments-from-data-url.html: * fast/url/segments-from-data-url2-expected.txt: Copied from LayoutTests/fast/url/segments-from-data-url-expected.txt. * fast/url/segments-from-data-url2.html: Copied from LayoutTests/fast/url/segments-from-data-url.html. * fetch/fetch-url-serialization-expected.txt: * http/tests/plugins/navigation-during-load-embed.html: * http/tests/plugins/navigation-during-load.html: * http/tests/security/allowed-base-url-data-url-via-setting-expected.txt: Added. * http/tests/security/allowed-base-url-data-url-via-setting.html: Added. * http/tests/security/denied-base-url-data-url-expected.txt: Added. * http/tests/security/denied-base-url-data-url.html: Added. * http/tests/security/denied-base-url-javascript-url-expected.txt: Added. * http/tests/security/denied-base-url-javascript-url.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256191 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-10 Daniel Bates <dabates@apple.com> Disallow setting base URL to a data or JavaScript URL https://bugs.webkit.org/show_bug.cgi?id=207136 Reviewed by Brent Fulgham. Apply base URL restrictions to apps linked to a future WebKit to avoid breaking existing apps. * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKWebView.mm: (shouldRestrictBaseURLSchemes): Added. (-[WKWebView _setupPageConfiguration:]): Update settings. * UIProcess/Cocoa/VersionChecks.h: 2020-02-17 Alan Coon <alancoon@apple.com> Cherry-pick r255881. rdar://problem/59447271 Adopt MTOverrideShouldPlayHDRVideo() https://bugs.webkit.org/show_bug.cgi?id=207275 <rdar://problem/58837093> Reviewed by Eric Carlson. Source/WebCore: * platform/PlatformScreen.h: * platform/mac/PlatformScreenMac.mm: (WebCore::setShouldOverrideScreenSupportsHighDynamicRange): Source/WebCore/PAL: * pal/cocoa/MediaToolboxSoftLink.cpp: * pal/cocoa/MediaToolboxSoftLink.h: Source/WebKit: The WebProcess sandbox can block access to the services necessary for MediaToolbox to determine whether the current display is capable of displaying HDR. Rather than opening up the sandbox, provide the information gathered by the UIProcess by way of MTOverrideShouldPlayHDRVideo(). * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::windowScreenDidChange): (WebKit::WebPage::displayID const): * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setScreenProperties): Deleted. * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::setScreenProperties): (WebKit::WebProcess::updatePageScreenProperties): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255881 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-05 Jer Noble <jer.noble@apple.com> Adopt MTOverrideShouldPlayHDRVideo() https://bugs.webkit.org/show_bug.cgi?id=207275 <rdar://problem/58837093> Reviewed by Eric Carlson. The WebProcess sandbox can block access to the services necessary for MediaToolbox to determine whether the current display is capable of displaying HDR. Rather than opening up the sandbox, provide the information gathered by the UIProcess by way of MTOverrideShouldPlayHDRVideo(). * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::windowScreenDidChange): (WebKit::WebPage::displayID const): * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setScreenProperties): Deleted. * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::setScreenProperties): (WebKit::WebProcess::updatePageScreenProperties): 2020-02-17 Alan Coon <alancoon@apple.com> Cherry-pick r256632. rdar://problem/59478906 NetworkLoadMetrics should be shared by multiple ResourceResponse instances https://bugs.webkit.org/show_bug.cgi?id=207747 Reviewed by Keith Miller. Source/WebCore: ResourceResponse is value data, and it is copied multiple times in various places, (1) to create a new ResourceResponse which has slightly different fields, or (1) to hold ResourceResponse even after loading finishes. For example, DocumentLoader has Vector<ResourceResponse> to replay response dispatching in the case of loading from BackForwardCache. The problem is that ResourceResponse is very large: 440 bytes. While we sometimes copy ResourceResponse to modify some part of it, NetworkLoadMetrics is immutable. It is set when response is created, and is never changed. And NetworkLoadMetrics is large: sizeof(NetworkLoadMetrics) is 184 bytes. Given that we have multiple copies of ResourceResponse in WebCore, we should share NetworkLoadMetrics by them. This patch puts Box<NetworkLoadMetrics> in ResourceResponse to share it with all copied ResourceResponses. We do not make NetworkLoadMetrics RefCounted<> for now since some legit data structures embed NetworkLoadMetrics. This patch adds ArgumentCoder for Box so that we can encode / decode Box<NetworkLoadMetrics> in ResourceResponse in IPC. To ensure NetworkLoadMetrics in ResourceResponse immutable, we add ResourceResponse::setDeprecatedNetworkLoadMetrics instead of modifying NetworkLoadMetrics already created in ResourceResponse. We also attempt to compact ResourceResponse more by using bit-fields. And removing m_isValid field in ParsedContentRange since this can be represented by the different field. These changes make sizeof(ResourceResponse) from 440 to 248. No behavior change. * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::buildObjectForTiming): (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse): * inspector/agents/InspectorNetworkAgent.h: * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::loadRequest): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didFinishLoading): * page/PerformanceTiming.cpp: (WebCore::PerformanceTiming::domainLookupStart const): (WebCore::PerformanceTiming::domainLookupEnd const): (WebCore::PerformanceTiming::connectStart const): (WebCore::PerformanceTiming::connectEnd const): (WebCore::PerformanceTiming::secureConnectionStart const): (WebCore::PerformanceTiming::requestStart const): (WebCore::PerformanceTiming::responseStart const): * platform/network/NetworkLoadMetrics.h: * platform/network/ParsedContentRange.cpp: (WebCore::areContentRangeValuesValid): (WebCore::parseContentRange): (WebCore::ParsedContentRange::ParsedContentRange): (WebCore::ParsedContentRange::headerValue const): * platform/network/ParsedContentRange.h: (WebCore::ParsedContentRange::isValid const): (WebCore::ParsedContentRange::invalidValue): (WebCore::ParsedContentRange::MarkableTraits::isEmptyValue): (WebCore::ParsedContentRange::MarkableTraits::emptyValue): (WebCore::ParsedContentRange::ParsedContentRange): Deleted. * platform/network/ResourceHandle.h: * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::ResourceResponseBase): (WebCore::ResourceResponseBase::crossThreadData const): (WebCore::ResourceResponseBase::fromCrossThreadData): (WebCore::ResourceResponseBase::compare): * platform/network/ResourceResponseBase.h: (WebCore::ResourceResponseBase::deprecatedNetworkLoadMetricsOrNull const): (WebCore::ResourceResponseBase::setDeprecatedNetworkLoadMetrics): (WebCore::ResourceResponseBase::encode const): (WebCore::ResourceResponseBase::decode): (WebCore::ResourceResponseBase::deprecatedNetworkLoadMetrics const): Deleted. * platform/network/cf/ResourceResponse.h: (WebCore::ResourceResponse::ResourceResponse): * platform/network/cocoa/NetworkLoadMetrics.mm: (WebCore::copyTimingData): * platform/network/curl/CurlResourceHandleDelegate.cpp: (WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse): * platform/network/curl/ResourceResponse.h: * platform/network/curl/ResourceResponseCurl.cpp: (WebCore::ResourceResponse::setDeprecatedNetworkLoadMetrics): Deleted. * platform/network/mac/ResourceHandleMac.mm: (WebCore::ResourceHandle::getConnectionTimingData): * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]): Source/WebKit: Add ArgumentCoder support for Box<T>. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): * Platform/IPC/ArgumentCoders.h: (IPC::ArgumentCoder<Box<T>>::encode): (IPC::ArgumentCoder<Box<T>>::decode): Tools: * TestWebKitAPI/Tests/WebCore/ParsedContentRange.cpp: (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256632 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-14 Yusuke Suzuki <ysuzuki@apple.com> NetworkLoadMetrics should be shared by multiple ResourceResponse instances https://bugs.webkit.org/show_bug.cgi?id=207747 Reviewed by Keith Miller. Add ArgumentCoder support for Box<T>. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): * Platform/IPC/ArgumentCoders.h: (IPC::ArgumentCoder<Box<T>>::encode): (IPC::ArgumentCoder<Box<T>>::decode): 2020-02-17 Alan Coon <alancoon@apple.com> Cherry-pick r256432. rdar://problem/59446974 WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should https://bugs.webkit.org/show_bug.cgi?id=207537 Reviewed by Chris Dumez. Source/WebKit: Covered by added API test. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::registerServiceWorkerClient): Fix use after move so that we can get the context connection and send the IPC message to UIProcess as expected. Tools: * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256432 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-12 Youenn Fablet <youenn@apple.com> WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should https://bugs.webkit.org/show_bug.cgi?id=207537 Reviewed by Chris Dumez. Covered by added API test. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::registerServiceWorkerClient): Fix use after move so that we can get the context connection and send the IPC message to UIProcess as expected. 2020-02-17 Alan Coon <alancoon@apple.com> Cherry-pick r256383. rdar://problem/59446974 Unreviewed, rolling out r256314. https://bugs.webkit.org/show_bug.cgi?id=207594 It is breaking an API test (Requested by youenn on #webkit). Reverted changeset: "WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should" https://bugs.webkit.org/show_bug.cgi?id=207537 https://trac.webkit.org/changeset/256314 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256383 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-11 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r256314. https://bugs.webkit.org/show_bug.cgi?id=207594 It is breaking an API test (Requested by youenn on #webkit). Reverted changeset: "WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should" https://bugs.webkit.org/show_bug.cgi?id=207537 https://trac.webkit.org/changeset/256314 2020-02-17 Alan Coon <alancoon@apple.com> Cherry-pick r255037. rdar://problem/59446986 Fixed elements no longer stay fixed with elastic overscroll https://bugs.webkit.org/show_bug.cgi?id=206227 rdar://problem/58707084 Reviewed by Antti Koivisto. Source/WebCore: Intended behavior on iOS and macOS is for position:fixed and sticky elements to maintain their position relative to the view bounds when rubber-banding ("overscrolling"). This broke some time back. This change restores the correct behavior with the call to layoutViewportRespectingRubberBanding() in ScrollingTreeFixedNode::applyLayerPositions() and ScrollingTreeStickyNode::computeLayerPosition(). layoutViewportRespectingRubberBanding() computes a layout viewport without clamping. The rest of the changes are to support testing. internals.unconstrainedScrollTo() didn't work for main frame scrolling because of scroll position clamping in various places, so propagate ScrollClamping in more places (and replace the redundant ScrollPositionClamp with ScrollClamping). "requested scroll position" updates now carry along both clamping and "is programmatic" data, wrapped in a struct which is passed around the scrolling tree. This allows us to not clamp the scroll position (for testing) in more places. Internals::unconstrainedScrollTo() needs one weird hack to trigger a layout (and thus a scrolling tree commit), because the layout is normally triggered by a layout viewport change, but when rubber-banding we clamp the layoutViewport used for layout, so those layouts are never triggered. Tests: tiled-drawing/scrolling/fixed/fixed-during-rubberband.html tiled-drawing/scrolling/sticky/sticky-during-rubberband.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/Element.cpp: (WebCore::Element::scrollTo): * page/DOMWindow.cpp: (WebCore::DOMWindow::scrollTo const): * page/FrameView.cpp: (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::requestScrollPositionUpdate): * page/FrameView.h: * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.cpp: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::requestScrollPositionUpdate): * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setRequestedScrollData): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setRequestedScrollPosition): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::RequestedScrollData::operator== const): (WebCore::ScrollingStateScrollingNode::requestedScrollData const): (WebCore::ScrollingStateScrollingNode::requestedScrollPosition const): Deleted. (WebCore::ScrollingStateScrollingNode::requestedScrollPositionRepresentsProgrammaticScroll const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::scrollingTreeNodeRequestsScroll): * page/scrolling/ScrollingTreeFrameScrollingNode.cpp: (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition const): (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportRespectingRubberBanding const): * page/scrolling/ScrollingTreeFrameScrollingNode.h: * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren): (WebCore::ScrollingTreeScrollingNode::adjustedScrollPosition const): (WebCore::ScrollingTreeScrollingNode::scrollBy): (WebCore::ScrollingTreeScrollingNode::scrollTo): (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/cocoa/ScrollingTreeFixedNode.mm: (WebCore::ScrollingTreeFixedNode::applyLayerPositions): * page/scrolling/cocoa/ScrollingTreeStickyNode.mm: (WebCore::ScrollingTreeStickyNode::computeLayerPosition const): * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren): (WebCore::ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition const): * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateAfterChildren): (WebCore::ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition const): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollByWithoutContentEdgeConstraints): * platform/ScrollTypes.cpp: Added. (WebCore::operator<<): * platform/ScrollTypes.h: * platform/ScrollView.cpp: (WebCore::ScrollView::setContentsScrollPosition): (WebCore::ScrollView::setScrollPosition): * platform/ScrollView.h: * platform/ScrollableArea.cpp: (WebCore::ScrollableArea::setScrollOffsetFromAnimation): * platform/ScrollableArea.h: (WebCore::ScrollableArea::requestScrollPositionUpdate): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollToOffset): * testing/Internals.cpp: (WebCore::Internals::unconstrainedScrollTo): Source/WebKit: Intended behavior on iOS and macOS is for position:fixed and sticky elements to maintain their position relative to the view bounds when rubber-banding ("overscrolling"). This broke some time back. This change restores the correct behavior with the call to layoutViewportRespectingRubberBanding() in ScrollingTreeFixedNode::applyLayerPositions() and ScrollingTreeStickyNode::computeLayerPosition(). layoutViewportRespectingRubberBanding() computes a layout viewport without clamping. The rest of the changes are to support testing. internals.unconstrainedScrollTo() didn't work for main frame scrolling because of scroll position clamping in various places, so propagate ScrollClamping in more places (and replace the redundant ScrollPositionClamp with ScrollClamping). "requested scroll position" updates now carry along both clamping and "is programmatic" data, wrapped in a struct which is passed around the scrolling tree. This allows us to not clamp the scroll position (for testing) in more places. * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: (ArgumentCoder<ScrollingStateScrollingNode>::encode): (ArgumentCoder<ScrollingStateScrollingNode>::decode): (ArgumentCoder<RequestedScrollData>::encode): (ArgumentCoder<RequestedScrollData>::decode): (WebKit::dump): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp: (WebKit::RemoteScrollingTree::scrollingTreeNodeRequestsScroll): * UIProcess/RemoteLayerTree/RemoteScrollingTree.h: * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm: (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren): * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren): LayoutTests: * tiled-drawing/scrolling/fixed/fixed-during-rubberband-expected.html: Added. * tiled-drawing/scrolling/fixed/fixed-during-rubberband.html: Added. * tiled-drawing/scrolling/sticky/sticky-during-rubberband-expected.html: Added. * tiled-drawing/scrolling/sticky/sticky-during-rubberband.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255037 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-17 Alan Coon <alancoon@apple.com> Cherry-pick r256225. rdar://problem/59446983 [watchOS] Notification listener is never unregistered https://bugs.webkit.org/show_bug.cgi?id=207459 Source/WebKit: <rdar://problem/58923393> Reviewed by Maciej Stachowiak. On watchOS, the backlight changed notification is registered in WebProcessPool::registerNotificationObservers(), but not unregistered in WebProcessPool::unregisterNotificationObservers(). API test: WebKit.BacklightLevelNotificationCrash * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::unregisterNotificationObservers): Tools: Reviewed by Maciej Stachowiak. Add a test which tests that posting a backlight level change notification will not cause a crash. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKit/BacklightLevelNotification.mm: Added. (TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256225 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-10 Per Arne Vollan <pvollan@apple.com> [watchOS] Notification listener is never unregistered https://bugs.webkit.org/show_bug.cgi?id=207459 <rdar://problem/58923393> Reviewed by Maciej Stachowiak. On watchOS, the backlight changed notification is registered in WebProcessPool::registerNotificationObservers(), but not unregistered in WebProcessPool::unregisterNotificationObservers(). API test: WebKit.BacklightLevelNotificationCrash * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::unregisterNotificationObservers): 2020-02-17 Alan Coon <alancoon@apple.com> Cherry-pick r256426. rdar://problem/59447008 [ Mac Debug wk2 ] ASSERTION FAILED: m_wasConstructedOnMainThread == isMainThread() https://bugs.webkit.org/show_bug.cgi?id=207509 <rdar://problem/59325466> Reviewed by Chris Dumez. Covered by existing tests. * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::writeSizeFile): Make sure completion handler is always called on the main thread. Minor refactoring to make things more efficient. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256426 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-11 Youenn Fablet <youenn@apple.com> [ Mac Debug wk2 ] ASSERTION FAILED: m_wasConstructedOnMainThread == isMainThread() https://bugs.webkit.org/show_bug.cgi?id=207509 <rdar://problem/59325466> Reviewed by Chris Dumez. Covered by existing tests. * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::writeSizeFile): Make sure completion handler is always called on the main thread. Minor refactoring to make things more efficient. 2020-02-17 Alan Coon <alancoon@apple.com> Cherry-pick r256314. rdar://problem/59446974 WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should https://bugs.webkit.org/show_bug.cgi?id=207537 Reviewed by Chris Dumez. Source/WebKit: Covered by added API test. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::registerServiceWorkerClient): Fix use after move so that we can get the context connection and send the IPC message to UIProcess as expected. Tools: * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256314 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-11 Youenn Fablet <youenn@apple.com> WebSWServerConnection::registerServiceWorkerClient is not sending IPC message to UIProcess when it should https://bugs.webkit.org/show_bug.cgi?id=207537 Reviewed by Chris Dumez. Covered by added API test. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::registerServiceWorkerClient): Fix use after move so that we can get the context connection and send the IPC message to UIProcess as expected. 2020-02-14 Russell Epstein <repstein@apple.com> Cherry-pick r252849. rdar://problem/59446998 Crash in WebCore::ServiceWorkerRegistrationKey::hash() const https://bugs.webkit.org/show_bug.cgi?id=204497 <rdar://problem/57348603> Reviewed by Alex Christensen. Source/WebCore: Update ServiceWorkerContainer::jobResolvedWithRegistration to handle the case of a ServiceWorkerContainer that might have a job whose promise is not related to the same context. In that case, the ServiceWorkerContainer might get stopped, thus its m_ongoingSettledRegistrations be cleared. But the promise may get settled shortly after since its context is not stopped and will then retrieve an empty registration data key. This is difficult to test given we do not control when the resolvedWithRegistration task is posted to the client. * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration): * workers/service/ServiceWorkerRegistrationKey.h: (WebCore::ServiceWorkerRegistrationKey::encode const): Add release asserts to make sure we do not store/transfer empty registration keys. Source/WebKit: * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::scheduleJobInServer): Add a release assert to be able to further debug the crash. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252849 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-11-25 Youenn Fablet <youenn@apple.com> Crash in WebCore::ServiceWorkerRegistrationKey::hash() const https://bugs.webkit.org/show_bug.cgi?id=204497 <rdar://problem/57348603> Reviewed by Alex Christensen. * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::scheduleJobInServer): Add a release assert to be able to further debug the crash. 2020-02-14 Russell Epstein <repstein@apple.com> Cherry-pick r256578. rdar://problem/59447009 Protect WebSWServerConnection::scheduleJobInServer from bad scopeURL https://bugs.webkit.org/show_bug.cgi?id=207722 Reviewed by Chris Dumez. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::scheduleJobInServer): In case of bad scope, fail the job early on. * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::scheduleJobInServer): Remove the RELEASE_ASSERT from now since we defend in Network process. We will add it back in ServiceWorkerRegistration::getOrCreate as a follow-up. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256578 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-13 Youenn Fablet <youenn@apple.com> Protect WebSWServerConnection::scheduleJobInServer from bad scopeURL https://bugs.webkit.org/show_bug.cgi?id=207722 Reviewed by Chris Dumez. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::scheduleJobInServer): In case of bad scope, fail the job early on. * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::scheduleJobInServer): Remove the RELEASE_ASSERT from now since we defend in Network process. We will add it back in ServiceWorkerRegistration::getOrCreate as a follow-up. 2020-02-14 Russell Epstein <repstein@apple.com> Cherry-pick r256452. rdar://problem/59446979 Pages that trigger a redirect will sometimes be left blank https://bugs.webkit.org/show_bug.cgi?id=207614 rdar://problem/59077740 Reviewed by Tim Horton. TiledCoreAnimationDrawingArea::setRootCompositingGraphicsLayer() can be called when the layer tree is frozen, in which case we stash away the layer in m_pendingRootLayer to be parented later at flush time. However, this sequence of calls had a bug: setRootCompositingGraphicsLayer() when frozen -> stash in m_pendingRootLayer setRootCompositingGraphicsLayer() when not frozen -> set the root layer flushLayers() -> set the root layer to the (old) m_pendingRootLayer So we need to clear m_pendingRootLayer at step 2. Very timing dependent, hard to test. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256452 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-12 Simon Fraser <simon.fraser@apple.com> Pages that trigger a redirect will sometimes be left blank https://bugs.webkit.org/show_bug.cgi?id=207614 rdar://problem/59077740 Reviewed by Tim Horton. TiledCoreAnimationDrawingArea::setRootCompositingGraphicsLayer() can be called when the layer tree is frozen, in which case we stash away the layer in m_pendingRootLayer to be parented later at flush time. However, this sequence of calls had a bug: setRootCompositingGraphicsLayer() when frozen -> stash in m_pendingRootLayer setRootCompositingGraphicsLayer() when not frozen -> set the root layer flushLayers() -> set the root layer to the (old) m_pendingRootLayer So we need to clear m_pendingRootLayer at step 2. Very timing dependent, hard to test. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): 2020-02-14 Russell Epstein <repstein@apple.com> Cherry-pick r256401. rdar://problem/59447020 WebPage::getFocusedElementInformation should be robust when the focused element changes during layout https://bugs.webkit.org/show_bug.cgi?id=207582 <rdar://problem/47634344> Reviewed by Tim Horton. 2020-01-22 Simon Fraser <simon.fraser@apple.com> Fixed elements no longer stay fixed with elastic overscroll https://bugs.webkit.org/show_bug.cgi?id=206227 rdar://problem/58707084 Reviewed by Antti Koivisto. Intended behavior on iOS and macOS is for position:fixed and sticky elements to maintain their position relative to the view bounds when rubber-banding ("overscrolling"). This broke some time back. This change restores the correct behavior with the call to layoutViewportRespectingRubberBanding() in ScrollingTreeFixedNode::applyLayerPositions() and ScrollingTreeStickyNode::computeLayerPosition(). layoutViewportRespectingRubberBanding() computes a layout viewport without clamping. The rest of the changes are to support testing. internals.unconstrainedScrollTo() didn't work for main frame scrolling because of scroll position clamping in various places, so propagate ScrollClamping in more places (and replace the redundant ScrollPositionClamp with ScrollClamping). "requested scroll position" updates now carry along both clamping and "is programmatic" data, wrapped in a struct which is passed around the scrolling tree. This allows us to not clamp the scroll position (for testing) in more places. * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: (ArgumentCoder<ScrollingStateScrollingNode>::encode): (ArgumentCoder<ScrollingStateScrollingNode>::decode): (ArgumentCoder<RequestedScrollData>::encode): (ArgumentCoder<RequestedScrollData>::decode): (WebKit::dump): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp: (WebKit::RemoteScrollingTree::scrollingTreeNodeRequestsScroll): * UIProcess/RemoteLayerTree/RemoteScrollingTree.h: * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm: (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren): * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren): This is a speculative fix for <rdar://problem/47634344>, wherein the initial layout update in WebPage:: getFocusedElementInformation may cause the currently focused element to disappear (or change). In the case where m_focusedElement becomes nil, we end up crashing with a null pointer deref, since the rest of the method assumes that m_focusedElement exists. To patch this crash, bail early (after the first layout update) if m_focusedElement changed during the layout pass. Since the rest of the function my trigger even more layout updates that could nuke m_focusedElement, I also changed the rest of the function to use the locally stored `focusedElement` variable instead of m_focusedElement, on WebPage. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getFocusedElementInformation): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256401 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-11 Wenson Hsieh <wenson_hsieh@apple.com> WebPage::getFocusedElementInformation should be robust when the focused element changes during layout https://bugs.webkit.org/show_bug.cgi?id=207582 <rdar://problem/47634344> Reviewed by Tim Horton. This is a speculative fix for <rdar://problem/47634344>, wherein the initial layout update in WebPage:: getFocusedElementInformation may cause the currently focused element to disappear (or change). In the case where m_focusedElement becomes nil, we end up crashing with a null pointer deref, since the rest of the method assumes that m_focusedElement exists. To patch this crash, bail early (after the first layout update) if m_focusedElement changed during the layout pass. Since the rest of the function my trigger even more layout updates that could nuke m_focusedElement, I also changed the rest of the function to use the locally stored `focusedElement` variable instead of m_focusedElement, on WebPage. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getFocusedElementInformation): 2020-02-14 Russell Epstein <repstein@apple.com> Cherry-pick r256346. rdar://problem/59446984 video.currentTime is not being updated in iOS 13.4 Beta https://bugs.webkit.org/show_bug.cgi?id=207489 <rdar://problem/59322640> Reviewed by Youenn Fablet. Source/WebKit: Allow the Web process and the GPU process to communicate with 'com.apple.coremedia.audiodeviceclock.xpc' because it is necessary to use a CMTimeBase, which is used by MediaPlayerPrivateMediaStreamAVFObjC for currentTime. Test: fast/mediastream/media-element-current-time.html * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: LayoutTests: * fast/mediastream/media-element-current-time.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256346 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-11 Eric Carlson <eric.carlson@apple.com> video.currentTime is not being updated in iOS 13.4 Beta https://bugs.webkit.org/show_bug.cgi?id=207489 <rdar://problem/59322640> Reviewed by Youenn Fablet. Allow the Web process and the GPU process to communicate with 'com.apple.coremedia.audiodeviceclock.xpc' because it is necessary to use a CMTimeBase, which is used by MediaPlayerPrivateMediaStreamAVFObjC for currentTime. Test: fast/mediastream/media-element-current-time.html * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-02-14 Russell Epstein <repstein@apple.com> Cherry-pick r256233. rdar://problem/59447027 WebKit::WebProcessPool::initializeClassesForParameterCoding() should keep a copy of CString <https://webkit.org/b/207519> <rdar://problem/59043436> Reviewed by Brent Fulgham. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::initializeClassesForParameterCoding): - Change `className` to keep a copy of the CString object. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256233 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-10 David Kilzer <ddkilzer@apple.com> WebKit::WebProcessPool::initializeClassesForParameterCoding() should keep a copy of CString <https://webkit.org/b/207519> <rdar://problem/59043436> Reviewed by Brent Fulgham. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::initializeClassesForParameterCoding): - Change `className` to keep a copy of the CString object. 2020-02-14 Russell Epstein <repstein@apple.com> Cherry-pick r256187. rdar://problem/59446994 Crash under WebProcessProxy::shouldSendPendingMessage() https://bugs.webkit.org/show_bug.cgi?id=207464 <rdar://problem/59293825> Reviewed by Alex Christensen. I suspect the WebProcessProxy object is getting destroyed as we are iterating over the pending messages in AuxiliaryProcessProxy::didFinishLaunching(), thus crashing when calling WebProcessProxy::shouldSendPendingMessage() inside the loop. As a speculative fix, protect |this| at the beginning of WebProcessProxy::didFinishLaunching(). * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didFinishLaunching): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256187 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-10 Chris Dumez <cdumez@apple.com> Crash under WebProcessProxy::shouldSendPendingMessage() https://bugs.webkit.org/show_bug.cgi?id=207464 <rdar://problem/59293825> Reviewed by Alex Christensen. I suspect the WebProcessProxy object is getting destroyed as we are iterating over the pending messages in AuxiliaryProcessProxy::didFinishLaunching(), thus crashing when calling WebProcessProxy::shouldSendPendingMessage() inside the loop. As a speculative fix, protect |this| at the beginning of WebProcessProxy::didFinishLaunching(). * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didFinishLaunching): 2020-02-13 Russell Epstein <repstein@apple.com> Revert r256407. rdar://problem/59299143 2020-02-13 Russell Epstein <repstein@apple.com> Cherry-pick r256520. rdar://problem/59430255 [iOS] -updateSelectionWithExtentPoint:completionHandler: should work without requiring floating cursor https://bugs.webkit.org/show_bug.cgi?id=207680 <rdar://problem/59340940> Reviewed by Tim Horton. Source/WebKit: Currently, WebPage::updateSelectionWithExtentPoint consults the value of m_selectionAnchor to determine whether it should attempt to modify the current selection using the hit-tested visible position. m_selectionAnchor is only set under WebPage::beginSelectionInDirection, which is only invoked when the user begins a floating cursor gesture. When attempting to perform an out-of-band selection update (i.e. without calling beginSelectionInDirection beforehand), we will end up consulting an arbitrary value for m_selectionAnchor (::Start by default; otherwise, the last value set by beginSelectionInDirection if it was previously called). This means that the selection can often only be extended in one direction (typically forwards) when an API client attempts to use -updateSelectionWithExtentPoint:completionHandler: to extend the current selection. To fix this, make it so that we only respect the selection anchor (m_selectionAnchor) in the case where the user is currently using the floating cursor; otherwise, allow the SPI to expand the selection, such that it contains the visible position for the given location. Test: UIWKInteractionViewProtocol.UpdateSelectionWithExtentPoint * Platform/spi/ios/UIKitSPI.h: * Scripts/webkit/messages.py: * Shared/ios/GestureTypes.h: Add a new flag to tell the web process whether it should limit selection extent updates to the current selection anchor. Also, remove an existing enum type, SelectionHandlePosition, that is unused (since we no longer support block text selection). * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[UITextInteractionAssistant _wk_hasFloatingCursor]): Add a helper method to determine (using the text interaction assistant) whether there's an active floating cursor gesture. In the case where floating cursor is active, the text interaction assistant will be in an active gesture but its UITextInteraction will not, since the gesture recognizer belongs to the keyboard or input view rather than the first responder (in this case, WKContentView). (-[WKContentView updateSelectionWithExtentPoint:completionHandler:]): Only respect the selection anchor if we're in floating cursor mode; otherwise, allow selection updates with an extent point to extend the current selection to include the new position. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::updateSelectionWithExtentPoint): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Plumb the RespectsSelectionAnchor flag over to the web process. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::updateSelectionWithExtentPoint): Tools: Add a new API test to verify that calling -updateSelectionWithExtentPoint:completionHandler: with a point behind the current selection works. * TestWebKitAPI/Tests/ios/UIWKInteractionViewProtocol.mm: (-[TestWKWebView updateSelectionWithExtentPoint:]): * TestWebKitAPI/ios/UIKitSPI.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256520 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-13 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] -updateSelectionWithExtentPoint:completionHandler: should work without requiring floating cursor https://bugs.webkit.org/show_bug.cgi?id=207680 <rdar://problem/59340940> Reviewed by Tim Horton. Currently, WebPage::updateSelectionWithExtentPoint consults the value of m_selectionAnchor to determine whether it should attempt to modify the current selection using the hit-tested visible position. m_selectionAnchor is only set under WebPage::beginSelectionInDirection, which is only invoked when the user begins a floating cursor gesture. When attempting to perform an out-of-band selection update (i.e. without calling beginSelectionInDirection beforehand), we will end up consulting an arbitrary value for m_selectionAnchor (::Start by default; otherwise, the last value set by beginSelectionInDirection if it was previously called). This means that the selection can often only be extended in one direction (typically forwards) when an API client attempts to use -updateSelectionWithExtentPoint:completionHandler: to extend the current selection. To fix this, make it so that we only respect the selection anchor (m_selectionAnchor) in the case where the user is currently using the floating cursor; otherwise, allow the SPI to expand the selection, such that it contains the visible position for the given location. Test: UIWKInteractionViewProtocol.UpdateSelectionWithExtentPoint * Platform/spi/ios/UIKitSPI.h: * Scripts/webkit/messages.py: * Shared/ios/GestureTypes.h: Add a new flag to tell the web process whether it should limit selection extent updates to the current selection anchor. Also, remove an existing enum type, SelectionHandlePosition, that is unused (since we no longer support block text selection). * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[UITextInteractionAssistant _wk_hasFloatingCursor]): Add a helper method to determine (using the text interaction assistant) whether there's an active floating cursor gesture. In the case where floating cursor is active, the text interaction assistant will be in an active gesture but its UITextInteraction will not, since the gesture recognizer belongs to the keyboard or input view rather than the first responder (in this case, WKContentView). (-[WKContentView updateSelectionWithExtentPoint:completionHandler:]): Only respect the selection anchor if we're in floating cursor mode; otherwise, allow selection updates with an extent point to extend the current selection to include the new position. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::updateSelectionWithExtentPoint): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Plumb the RespectsSelectionAnchor flag over to the web process. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::updateSelectionWithExtentPoint): 2020-02-13 Russell Epstein <repstein@apple.com> Cherry-pick r256485. rdar://problem/59430261 Composition highlight rects should be rounded and inset https://bugs.webkit.org/show_bug.cgi?id=207655 <rdar://problem/59362474> Reviewed by Tim Horton. Source/WebCore: Apply a couple of minor adjustments to the appearance of composition highlight rects that appear behind marked text, in the case where the client specifies attributed marked text with background colors. Test: editing/input/composition-highlights.html * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintMarkedTextBackground): (WebCore::InlineTextBox::paintCompositionBackground): In the case where custom composition rects are specified, add a half-pixel inset to all sides of the background rect, and add a slight corner radius around each background rect. * rendering/InlineTextBox.h: Source/WebKit: Stitch adjacent highlight rects together if they have the same highlight color; this minimizes the number of composition highlight rects we hand to the web process when changing the marked text. * UIProcess/ios/WKContentViewInteraction.mm: (compositionHighlights): LayoutTests: Make this existing layout test work with the new composition highlight appearance by covering up the edges of the composition highlight rect with a black border. Due to subpixel insets around the composition highlight rect, the reference image would be offset by a half pixel without this change (even when changing the spans to have a `border-radius`). * editing/input/composition-highlights-expected.html: * editing/input/composition-highlights.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256485 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-12 Wenson Hsieh <wenson_hsieh@apple.com> Composition highlight rects should be rounded and inset https://bugs.webkit.org/show_bug.cgi?id=207655 <rdar://problem/59362474> Reviewed by Tim Horton. Stitch adjacent highlight rects together if they have the same highlight color; this minimizes the number of composition highlight rects we hand to the web process when changing the marked text. * UIProcess/ios/WKContentViewInteraction.mm: (compositionHighlights): 2020-02-13 Russell Epstein <repstein@apple.com> Cherry-pick r256433. rdar://problem/59412971 macCatalyst: Unable to grab scrollbar on editable text field https://bugs.webkit.org/show_bug.cgi?id=207615 <rdar://problem/59212993> Reviewed by Tim Horton. In macCatalyst, hovering over the scrollbar (an instance of the internal UIKit class `_UIScrollViewScrollIndicator`) is required in order for a click and drag with the mouse to actually move the scrollbar. This is because UIKit depends on the cursor interaction added to this view to recognize and call its delegate methods. However, we override hit-testing in WebKit to skip over all children of scroll views, and instead force hit- testing to find the scroll view instead. This means that UIKit can never hit-test to the scroll indicator views embedded directly beneath each WKChildScrollView, so the cursor interactions described earlier will not recognize. To work around this, special case these scroll indicator views, such that we will allow -hitTest:withEvent: to find these views. * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (WebKit::scrollViewScrollIndicatorClass): (-[UIView _web_findDescendantViewAtPoint:withEvent:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256433 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-12 Wenson Hsieh <wenson_hsieh@apple.com> macCatalyst: Unable to grab scrollbar on editable text field https://bugs.webkit.org/show_bug.cgi?id=207615 <rdar://problem/59212993> Reviewed by Tim Horton. In macCatalyst, hovering over the scrollbar (an instance of the internal UIKit class `_UIScrollViewScrollIndicator`) is required in order for a click and drag with the mouse to actually move the scrollbar. This is because UIKit depends on the cursor interaction added to this view to recognize and call its delegate methods. However, we override hit-testing in WebKit to skip over all children of scroll views, and instead force hit- testing to find the scroll view instead. This means that UIKit can never hit-test to the scroll indicator views embedded directly beneath each WKChildScrollView, so the cursor interactions described earlier will not recognize. To work around this, special case these scroll indicator views, such that we will allow -hitTest:withEvent: to find these views. * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (WebKit::scrollViewScrollIndicatorClass): (-[UIView _web_findDescendantViewAtPoint:withEvent:]): 2020-02-12 Alan Coon <alancoon@apple.com> Cherry-pick r254859. rdar://problem/59298172 Minor improvements to StorageAreaMap https://bugs.webkit.org/show_bug.cgi?id=206433 Reviewed by Darin Adler. Source/WebCore: Use inline initialization for some of StorageMap's data member. Also specify uint8_t as underlying type of StorageType enum class for better packing. * inspector/InspectorInstrumentation.h: * storage/StorageArea.h: * storage/StorageMap.cpp: (WebCore::StorageMap::StorageMap): * storage/StorageMap.h: * storage/StorageType.h: Source/WebKit: Minor improvements to StorageAreaMap: 1. The class does not need to be RefCounted, as it is solely owned by StorageNamespaceImpl. Having it RefCounted was actually dangerous because StorageAreaMap had a raw pointer data member to its owner: m_storageNamespace. This raw pointer could become stale if you extend the lifetime of the StorageAreaMap object to outlive its StorageNamespaceImpl. 2. Make StorageAreaMap::connect() private as it is never called from outside the class 3. Reorder data members for better packing 4. Use modern loops in the implementation 5. Rename loadValuesIfNeeded() to ensureStorageMap() and have it return the StorageMap object. This makes calls site more concise and it makes it clearer when this method needs to be called. 6. Mark class as final 7. Replace LOG_ERROR() with RELEASE_LOG_ERROR() so that we can see error logging in sysdiagnoses 8. Use more references instead of raw pointers to make it clear when null checks are not needed * WebProcess/WebStorage/StorageAreaImpl.cpp: (WebKit::StorageAreaImpl::create): (WebKit::StorageAreaImpl::StorageAreaImpl): * WebProcess/WebStorage/StorageAreaImpl.h: * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::StorageAreaMap::StorageAreaMap): (WebKit::StorageAreaMap::length): (WebKit::StorageAreaMap::key): (WebKit::StorageAreaMap::item): (WebKit::StorageAreaMap::setItem): (WebKit::StorageAreaMap::removeItem): (WebKit::StorageAreaMap::clear): (WebKit::StorageAreaMap::contains): (WebKit::StorageAreaMap::resetValues): (WebKit::StorageAreaMap::ensureStorageMap): (WebKit::StorageAreaMap::applyChange): (WebKit::StorageAreaMap::dispatchSessionStorageEvent): (WebKit::StorageAreaMap::dispatchLocalStorageEvent): (WebKit::StorageAreaMap::connect): (WebKit::StorageAreaMap::disconnect): * WebProcess/WebStorage/StorageAreaMap.h: * WebProcess/WebStorage/StorageAreaMap.messages.in: * WebProcess/WebStorage/StorageNamespaceImpl.cpp: (WebKit::StorageNamespaceImpl::storageArea): * WebProcess/WebStorage/StorageNamespaceImpl.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254859 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-21 Chris Dumez <cdumez@apple.com> Minor improvements to StorageAreaMap https://bugs.webkit.org/show_bug.cgi?id=206433 Reviewed by Darin Adler. Minor improvements to StorageAreaMap: 1. The class does not need to be RefCounted, as it is solely owned by StorageNamespaceImpl. Having it RefCounted was actually dangerous because StorageAreaMap had a raw pointer data member to its owner: m_storageNamespace. This raw pointer could become stale if you extend the lifetime of the StorageAreaMap object to outlive its StorageNamespaceImpl. 2. Make StorageAreaMap::connect() private as it is never called from outside the class 3. Reorder data members for better packing 4. Use modern loops in the implementation 5. Rename loadValuesIfNeeded() to ensureStorageMap() and have it return the StorageMap object. This makes calls site more concise and it makes it clearer when this method needs to be called. 6. Mark class as final 7. Replace LOG_ERROR() with RELEASE_LOG_ERROR() so that we can see error logging in sysdiagnoses 8. Use more references instead of raw pointers to make it clear when null checks are not needed * WebProcess/WebStorage/StorageAreaImpl.cpp: (WebKit::StorageAreaImpl::create): (WebKit::StorageAreaImpl::StorageAreaImpl): * WebProcess/WebStorage/StorageAreaImpl.h: * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::StorageAreaMap::StorageAreaMap): (WebKit::StorageAreaMap::length): (WebKit::StorageAreaMap::key): (WebKit::StorageAreaMap::item): (WebKit::StorageAreaMap::setItem): (WebKit::StorageAreaMap::removeItem): (WebKit::StorageAreaMap::clear): (WebKit::StorageAreaMap::contains): (WebKit::StorageAreaMap::resetValues): (WebKit::StorageAreaMap::ensureStorageMap): (WebKit::StorageAreaMap::applyChange): (WebKit::StorageAreaMap::dispatchSessionStorageEvent): (WebKit::StorageAreaMap::dispatchLocalStorageEvent): (WebKit::StorageAreaMap::connect): (WebKit::StorageAreaMap::disconnect): * WebProcess/WebStorage/StorageAreaMap.h: * WebProcess/WebStorage/StorageAreaMap.messages.in: * WebProcess/WebStorage/StorageNamespaceImpl.cpp: (WebKit::StorageNamespaceImpl::storageArea): * WebProcess/WebStorage/StorageNamespaceImpl.h: 2020-02-11 Alan Coon <alancoon@apple.com> Cherry-pick r256073. rdar://problem/59299148 Remember if we used legacy TLS in the back/forward cache like we remember if we have only secure content https://bugs.webkit.org/show_bug.cgi?id=207409 rdar://problem/59275641 Patch by Alex Christensen <achristensen@apple.com> on 2020-02-07 Reviewed by Chris Dumez. Source/WebCore: Covered by an API test. * history/CachedFrame.cpp: (WebCore::CachedFrame::setHasInsecureContent): * history/CachedFrame.h: (WebCore::CachedFrame::usedLegacyTLS const): * loader/EmptyFrameLoaderClient.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::receivedFirstData): (WebCore::FrameLoader::commitProvisionalLoad): (WebCore::FrameLoader::dispatchDidCommitLoad): * loader/FrameLoader.h: * loader/FrameLoaderClient.h: Source/WebKit: * Scripts/webkit/messages.py: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::hasInsecureContent): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: Source/WebKitLegacy/mac: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::dispatchDidCommitLoad): Source/WebKitLegacy/win: * WebCoreSupport/WebFrameLoaderClient.cpp: (WebFrameLoaderClient::dispatchDidCommitLoad): * WebCoreSupport/WebFrameLoaderClient.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm: (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256073 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-07 Alex Christensen <achristensen@apple.com> Remember if we used legacy TLS in the back/forward cache like we remember if we have only secure content https://bugs.webkit.org/show_bug.cgi?id=207409 rdar://problem/59275641 Reviewed by Chris Dumez. * Scripts/webkit/messages.py: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::hasInsecureContent): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2020-02-11 Alan Coon <alancoon@apple.com> Cherry-pick r255992. rdar://problem/59298165 [WK2][iOS] Add WKWebviewConfiguration SPI to run client navigations at foreground priority, even if the view is background https://bugs.webkit.org/show_bug.cgi?id=207341 <rdar://problem/59227077> Reviewed by Geoff Garen. Add WKWebviewConfiguration SPI to run client navigations at foreground priority, even if the view is background, as long as the application itself is foreground. The new SPI is: WKWebViewConfiguration._clientNavigationsRunAtForegroundPriority The use case is that the client may choose to load something in an offscreen view and only show the view once the load is complete (to avoid flashing for e.g.). In such cases, it makes sense to use foreground priority for the load since it needs to complete as fast as possible, even though the view is technically background. * UIProcess/API/APINavigation.h: (API::Navigation::setForegroundActivity): * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::copy const): * UIProcess/API/APIPageConfiguration.h: (API::PageConfiguration::clientNavigationsRunAtForegroundPriority const): (API::PageConfiguration::setClientNavigationsRunAtForegroundPriority): (API::PageConfiguration::alwaysRunsAtForegroundPriority const): (API::PageConfiguration::alwaysRunsAtForegroundPriority): Deleted. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration _clientNavigationsRunAtForegroundPriority]): (-[WKWebViewConfiguration _setClientNavigationsRunAtForegroundPriority:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadRequest): (WebKit::WebPageProxy::loadFile): (WebKit::WebPageProxy::loadData): (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): * UIProcess/WebPageProxy.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::isApplicationVisible): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::shouldUseForegroundPriorityForClientNavigation const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255992 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-06 Chris Dumez <cdumez@apple.com> [WK2][iOS] Add WKWebviewConfiguration SPI to run client navigations at foreground priority, even if the view is background https://bugs.webkit.org/show_bug.cgi?id=207341 <rdar://problem/59227077> Reviewed by Geoff Garen. Add WKWebviewConfiguration SPI to run client navigations at foreground priority, even if the view is background, as long as the application itself is foreground. The new SPI is: WKWebViewConfiguration._clientNavigationsRunAtForegroundPriority The use case is that the client may choose to load something in an offscreen view and only show the view once the load is complete (to avoid flashing for e.g.). In such cases, it makes sense to use foreground priority for the load since it needs to complete as fast as possible, even though the view is technically background. * UIProcess/API/APINavigation.h: (API::Navigation::setForegroundActivity): * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::copy const): * UIProcess/API/APIPageConfiguration.h: (API::PageConfiguration::clientNavigationsRunAtForegroundPriority const): (API::PageConfiguration::setClientNavigationsRunAtForegroundPriority): (API::PageConfiguration::alwaysRunsAtForegroundPriority const): (API::PageConfiguration::alwaysRunsAtForegroundPriority): Deleted. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration _clientNavigationsRunAtForegroundPriority]): (-[WKWebViewConfiguration _setClientNavigationsRunAtForegroundPriority:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadRequest): (WebKit::WebPageProxy::loadFile): (WebKit::WebPageProxy::loadData): (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): * UIProcess/WebPageProxy.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::isApplicationVisible): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::shouldUseForegroundPriorityForClientNavigation const): 2020-02-11 Alan Coon <alancoon@apple.com> Cherry-pick r255881. rdar://problem/59299143 Adopt MTOverrideShouldPlayHDRVideo() https://bugs.webkit.org/show_bug.cgi?id=207275 <rdar://problem/58837093> Reviewed by Eric Carlson. Source/WebCore: * platform/PlatformScreen.h: * platform/mac/PlatformScreenMac.mm: (WebCore::setShouldOverrideScreenSupportsHighDynamicRange): Source/WebCore/PAL: * pal/cocoa/MediaToolboxSoftLink.cpp: * pal/cocoa/MediaToolboxSoftLink.h: Source/WebKit: The WebProcess sandbox can block access to the services necessary for MediaToolbox to determine whether the current display is capable of displaying HDR. Rather than opening up the sandbox, provide the information gathered by the UIProcess by way of MTOverrideShouldPlayHDRVideo(). * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::windowScreenDidChange): (WebKit::WebPage::displayID const): * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setScreenProperties): Deleted. * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::setScreenProperties): (WebKit::WebProcess::updatePageScreenProperties): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255881 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-05 Jer Noble <jer.noble@apple.com> Adopt MTOverrideShouldPlayHDRVideo() https://bugs.webkit.org/show_bug.cgi?id=207275 <rdar://problem/58837093> Reviewed by Eric Carlson. The WebProcess sandbox can block access to the services necessary for MediaToolbox to determine whether the current display is capable of displaying HDR. Rather than opening up the sandbox, provide the information gathered by the UIProcess by way of MTOverrideShouldPlayHDRVideo(). * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::windowScreenDidChange): (WebKit::WebPage::displayID const): * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setScreenProperties): Deleted. * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::setScreenProperties): (WebKit::WebProcess::updatePageScreenProperties): 2020-02-11 Alan Coon <alancoon@apple.com> Cherry-pick r255846. rdar://problem/59299151 Make WKWebView._negotiatedLegacyTLS accurate when loading main resouorce from network or cache https://bugs.webkit.org/show_bug.cgi?id=207207 Reviewed by Chris Dumez. Source/WebCore: * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::includeCertificateInfo const): * platform/network/ResourceResponseBase.h: (WebCore::ResourceResponseBase::usedLegacyTLS const): (WebCore::ResourceResponseBase::encode const): (WebCore::ResourceResponseBase::decode): Source/WebKit: In PageLoadState::didCommitLoad, I was resetting the value of _negotiatedLegacyTLS to false. That created a race condition when loading the main resource because the NetworkProcess would message the UIProcess setting _negotiatedLegacyTLS to false, while the NetworkProcess would message the WebProcess which would message the UIProcess to call PageLoadState::didCommitLoad which would reset it to false. Now it resets it to the correct value, whatever it is. Updating the ResourceResponseBase serialization code has the desirable side effect that the disk cache will remember whether legacy TLS was used to fetch each resource. This will make it so _negotiatedLegacyTLS is true if we read content from the disk cache that was originally fetched using legacy TLS. In order to not increase the memory footprint of ResourceResponse, I changed m_httpStatusCode from an int to a short. It just needs to be able to cover the values 0-600 or so, which really only needs 10 bits. Covered by new API tests. * NetworkProcess/NetworkCORSPreflightChecker.cpp: (WebKit::NetworkCORSPreflightChecker::didReceiveResponse): * NetworkProcess/NetworkCORSPreflightChecker.h: * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::didReceiveResponse): (WebKit::NetworkDataTask::negotiatedLegacyTLS const): Deleted. * NetworkProcess/NetworkDataTask.h: (WebKit::NetworkDataTaskClient::negotiatedLegacyTLS const): Deleted. * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse): * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::didReceiveResponse): (WebKit::NetworkLoad::notifyDidReceiveResponse): (WebKit::NetworkLoad::throttleDelayCompleted): (WebKit::NetworkLoad::negotiatedLegacyTLS const): Deleted. * NetworkProcess/NetworkLoad.h: * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/PingLoad.cpp: (WebKit::PingLoad::didReceiveResponse): * NetworkProcess/PingLoad.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::didReceiveResponse): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse): * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::didCommitLoad): * UIProcess/PageLoadState.h: * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::didCommitLoadForFrame): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::commitProvisionalPage): (WebKit::WebPageProxy::didCommitLoadForFrame): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): Source/WTF: * wtf/persistence/PersistentDecoder.cpp: (WTF::Persistence::Decoder::decode): * wtf/persistence/PersistentDecoder.h: * wtf/persistence/PersistentEncoder.cpp: (WTF::Persistence::Encoder::encode): * wtf/persistence/PersistentEncoder.h: Tools: HTTPServer now supports HTTPS. Tell your friends! * TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm: (testCertificate): (testIdentity): (credentialWithIdentity): * TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm: (TestWebKitAPI::webViewWithNavigationDelegate): (TestWebKitAPI::TEST): * TestWebKitAPI/cocoa/HTTPServer.h: * TestWebKitAPI/cocoa/HTTPServer.mm: (TestWebKitAPI::HTTPServer::HTTPServer): (TestWebKitAPI::HTTPServer::request const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255846 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-05 Alex Christensen <achristensen@webkit.org> Make WKWebView._negotiatedLegacyTLS accurate when loading main resouorce from network or cache https://bugs.webkit.org/show_bug.cgi?id=207207 Reviewed by Chris Dumez. In PageLoadState::didCommitLoad, I was resetting the value of _negotiatedLegacyTLS to false. That created a race condition when loading the main resource because the NetworkProcess would message the UIProcess setting _negotiatedLegacyTLS to false, while the NetworkProcess would message the WebProcess which would message the UIProcess to call PageLoadState::didCommitLoad which would reset it to false. Now it resets it to the correct value, whatever it is. Updating the ResourceResponseBase serialization code has the desirable side effect that the disk cache will remember whether legacy TLS was used to fetch each resource. This will make it so _negotiatedLegacyTLS is true if we read content from the disk cache that was originally fetched using legacy TLS. In order to not increase the memory footprint of ResourceResponse, I changed m_httpStatusCode from an int to a short. It just needs to be able to cover the values 0-600 or so, which really only needs 10 bits. Covered by new API tests. * NetworkProcess/NetworkCORSPreflightChecker.cpp: (WebKit::NetworkCORSPreflightChecker::didReceiveResponse): * NetworkProcess/NetworkCORSPreflightChecker.h: * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::didReceiveResponse): (WebKit::NetworkDataTask::negotiatedLegacyTLS const): Deleted. * NetworkProcess/NetworkDataTask.h: (WebKit::NetworkDataTaskClient::negotiatedLegacyTLS const): Deleted. * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse): * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::didReceiveResponse): (WebKit::NetworkLoad::notifyDidReceiveResponse): (WebKit::NetworkLoad::throttleDelayCompleted): (WebKit::NetworkLoad::negotiatedLegacyTLS const): Deleted. * NetworkProcess/NetworkLoad.h: * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/PingLoad.cpp: (WebKit::PingLoad::didReceiveResponse): * NetworkProcess/PingLoad.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::didReceiveResponse): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse): * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::didCommitLoad): * UIProcess/PageLoadState.h: * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::didCommitLoadForFrame): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::commitProvisionalPage): (WebKit::WebPageProxy::didCommitLoadForFrame): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): 2020-02-11 Alan Coon <alancoon@apple.com> Cherry-pick r255845. rdar://problem/59298143 _WKDownload should expose the originating FrameInfo. <rdar://problem/58022576> and https://bugs.webkit.org/show_bug.cgi?id=207185 Patch by Brady Eidson <beidson@apple.com> on 2020-02-05 Reviewed by Geoff Garen. Source/WebKit: Covered by new API test. For the cases where a navigation is converted into a download, include the relevant WKFrameInfo on the _WKDownload object. * UIProcess/API/APIFrameInfo.h: * UIProcess/API/Cocoa/_WKDownload.h: * UIProcess/API/Cocoa/_WKDownload.mm: (-[_WKDownload originatingFrameInfo]): * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::generateDownloadID): (WebKit::DownloadProxy::DownloadProxy): (WebKit::DownloadProxy::create): Deleted. (WebKit::DownloadProxy::setOriginatingPage): Deleted. * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::create): (WebKit::DownloadProxy::frameInfo): * UIProcess/Downloads/DownloadProxyMap.cpp: (WebKit::DownloadProxyMap::createDownloadProxy): * UIProcess/Downloads/DownloadProxyMap.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::createDownloadProxy): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedPolicyDecision): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::download): (WebKit::WebProcessPool::resumeDownload): (WebKit::WebProcessPool::createDownloadProxy): * UIProcess/WebProcessPool.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/Download.mm: (-[DownloadTestSchemeDelegate webView:decidePolicyForNavigationResponse:decisionHandler:]): (-[DownloadSecurityOriginDelegate _downloadDidStart:]): (loaded): * TestWebKitAPI/cocoa/HTTPServer.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255845 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-05 Brady Eidson <beidson@apple.com> _WKDownload should expose the originating FrameInfo. <rdar://problem/58022576> and https://bugs.webkit.org/show_bug.cgi?id=207185 Reviewed by Geoff Garen. Covered by new API test. For the cases where a navigation is converted into a download, include the relevant WKFrameInfo on the _WKDownload object. * UIProcess/API/APIFrameInfo.h: * UIProcess/API/Cocoa/_WKDownload.h: * UIProcess/API/Cocoa/_WKDownload.mm: (-[_WKDownload originatingFrameInfo]): * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::generateDownloadID): (WebKit::DownloadProxy::DownloadProxy): (WebKit::DownloadProxy::create): Deleted. (WebKit::DownloadProxy::setOriginatingPage): Deleted. * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::create): (WebKit::DownloadProxy::frameInfo): * UIProcess/Downloads/DownloadProxyMap.cpp: (WebKit::DownloadProxyMap::createDownloadProxy): * UIProcess/Downloads/DownloadProxyMap.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::createDownloadProxy): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedPolicyDecision): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::download): (WebKit::WebProcessPool::resumeDownload): (WebKit::WebProcessPool::createDownloadProxy): * UIProcess/WebProcessPool.h: 2020-02-11 Alan Coon <alancoon@apple.com> Cherry-pick r255595. rdar://problem/59298183 Regression(r253224) WKUIDelegate.webViewDidClose may get called twice after calling _tryClose on the WKWebView https://bugs.webkit.org/show_bug.cgi?id=207121 <rdar://problem/58880177> Reviewed by Alex Christensen. Source/WebKit: WKUIDelegate.webViewDidClose may get called twice after calling _tryClose on the WKWebView, in case we time out while waiting for an answer from the WebProcess but the WebProcess eventually responds. Change is covered by new API test. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::tryClose): Tools: Add API test coverage. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKit/beforeunload-slow.html: Added. * TestWebKitAPI/Tests/WebKitCocoa/ModalAlerts.mm: (-[SlowBeforeUnloadHandlerUIDelegate _webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:completionHandler:]): (-[SlowBeforeUnloadHandlerUIDelegate webViewDidClose:]): (TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255595 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-03 Chris Dumez <cdumez@apple.com> Regression(r253224) WKUIDelegate.webViewDidClose may get called twice after calling _tryClose on the WKWebView https://bugs.webkit.org/show_bug.cgi?id=207121 <rdar://problem/58880177> Reviewed by Alex Christensen. WKUIDelegate.webViewDidClose may get called twice after calling _tryClose on the WKWebView, in case we time out while waiting for an answer from the WebProcess but the WebProcess eventually responds. Change is covered by new API test. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::tryClose): 2020-02-11 Alan Coon <alancoon@apple.com> Cherry-pick r255519. rdar://problem/59298166 Unreviewed macOS build fix after r255518 * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handleGestureEvent): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255519 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-31 Chris Dumez <cdumez@apple.com> Unreviewed macOS build fix after r255518 * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handleGestureEvent): 2020-02-11 Alan Coon <alancoon@apple.com> Cherry-pick r255518. rdar://problem/59298166 [ iOS ] imported/w3c/web-platform-tests/IndexedDB/key-generators/reading-autoincrement-indexes-cursors.any.serviceworker.html is flaky failing. https://bugs.webkit.org/show_bug.cgi?id=206934 <rdar://problem/58991581> Source/WebKit: Reviewed by Brady Eidson. Flakiness would happen when the service worker would take too long to launch and the responsiveness timer would fire and report the process as unresponsive while still launching or very shortly after. When a service worker is reported as unresponsive, we would kill it. To address the issue, several changes were made: - Responsiveness checks are now disabled for slow builds (Debug, ASAN, GuardMalloc) - We only start the ResponsivenessTimer after the process has finished launching since the responsiveness check relies on IPC to the process and we cannot send the IPC until after the process has launched. * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp: (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState): * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::goToBackForwardItem): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::launchProcessForReload): (WebKit::WebPageProxy::launchProcessWithItem): (WebKit::WebPageProxy::loadRequestWithNavigationShared): (WebKit::WebPageProxy::loadFile): (WebKit::WebPageProxy::loadDataWithNavigationShared): (WebKit::WebPageProxy::loadAlternateHTML): (WebKit::WebPageProxy::loadWebArchiveData): (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick): (WebKit::WebPageProxy::stopLoading): (WebKit::WebPageProxy::reload): (WebKit::WebPageProxy::goToBackForwardItem): (WebKit::WebPageProxy::dispatchActivityStateChange): (WebKit::WebPageProxy::processNextQueuedMouseEvent): (WebKit::WebPageProxy::handleKeyboardEvent): (WebKit::WebPageProxy::handleGestureEvent): (WebKit::WebPageProxy::handlePreventableTouchEvent): (WebKit::WebPageProxy::handleTouchEvent): (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): (WebKit::WebPageProxy::runOpenPanel): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::mayBecomeUnresponsive): (WebKit::WebProcessProxy::didFinishLaunching): (WebKit::WebProcessProxy::startResponsivenessTimer): (WebKit::WebProcessProxy::isResponsive): * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::responsivenessTimer): LayoutTests: Unskip test which should no longer be flaky. * platform/ios-wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255518 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-31 Chris Dumez <cdumez@apple.com> [ iOS ] imported/w3c/web-platform-tests/IndexedDB/key-generators/reading-autoincrement-indexes-cursors.any.serviceworker.html is flaky failing. https://bugs.webkit.org/show_bug.cgi?id=206934 <rdar://problem/58991581> Reviewed by Brady Eidson. Flakiness would happen when the service worker would take too long to launch and the responsiveness timer would fire and report the process as unresponsive while still launching or very shortly after. When a service worker is reported as unresponsive, we would kill it. To address the issue, several changes were made: - Responsiveness checks are now disabled for slow builds (Debug, ASAN, GuardMalloc) - We only start the ResponsivenessTimer after the process has finished launching since the responsiveness check relies on IPC to the process and we cannot send the IPC until after the process has launched. * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp: (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState): * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::goToBackForwardItem): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::launchProcessForReload): (WebKit::WebPageProxy::launchProcessWithItem): (WebKit::WebPageProxy::loadRequestWithNavigationShared): (WebKit::WebPageProxy::loadFile): (WebKit::WebPageProxy::loadDataWithNavigationShared): (WebKit::WebPageProxy::loadAlternateHTML): (WebKit::WebPageProxy::loadWebArchiveData): (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick): (WebKit::WebPageProxy::stopLoading): (WebKit::WebPageProxy::reload): (WebKit::WebPageProxy::goToBackForwardItem): (WebKit::WebPageProxy::dispatchActivityStateChange): (WebKit::WebPageProxy::processNextQueuedMouseEvent): (WebKit::WebPageProxy::handleKeyboardEvent): (WebKit::WebPageProxy::handleGestureEvent): (WebKit::WebPageProxy::handlePreventableTouchEvent): (WebKit::WebPageProxy::handleTouchEvent): (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): (WebKit::WebPageProxy::runOpenPanel): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::mayBecomeUnresponsive): (WebKit::WebProcessProxy::didFinishLaunching): (WebKit::WebProcessProxy::startResponsivenessTimer): (WebKit::WebProcessProxy::isResponsive): * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::responsivenessTimer): 2020-02-11 Alan Coon <alancoon@apple.com> Cherry-pick r255158. rdar://problem/59298137 Throttling requestAnimationFrame should be controlled by RenderingUpdateScheduler https://bugs.webkit.org/show_bug.cgi?id=204713 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2020-01-27 Reviewed by Simon Fraser. Source/WebCore: Test: fast/animation/request-animation-frame-throttling-outside-viewport.html requestAnimationFrame is throttled by a timer although its callback are serviced by the page RenderingUpdate. This led to excessive rAF firing which makes it more than the preferred frame per seconds. The solution is to have two throttling types: 1) Page throttling (or full throttling) which slows down all the steps of RenderingUpdate for the main document and all the sub-documents. 2) Document throttling (or partial throttling) which only slows down the rAF of a certain document. * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::animationInterval const): (WebCore::DocumentTimeline::updateThrottlingState): Deleted. * animation/DocumentTimeline.h: There is no need to have DocumentTimeline throttling. It is already throttled when the page RenderingUpdate is throttled. * dom/Document.cpp: (WebCore::Document::requestAnimationFrame): (WebCore::Document::updateLastHandledUserGestureTimestamp): LowPowerMode throttling is now handled by the page. So remove its handling in the Document side. * dom/ScriptedAnimationController.cpp: (WebCore::ScriptedAnimationController::ScriptedAnimationController): (WebCore::ScriptedAnimationController::page const): (WebCore::ScriptedAnimationController::preferredScriptedAnimationInterval const): (WebCore::ScriptedAnimationController::interval const): (WebCore::ScriptedAnimationController::isThrottled const): (WebCore::ScriptedAnimationController::isThrottledRelativeToPage const): (WebCore::ScriptedAnimationController::shouldRescheduleRequestAnimationFrame const): (WebCore::ScriptedAnimationController::registerCallback): (WebCore::ScriptedAnimationController::cancelCallback): (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks): (WebCore::ScriptedAnimationController::scheduleAnimation): (WebCore::throttlingReasonToString): Deleted. (WebCore::throttlingReasonsToString): Deleted. (WebCore::ScriptedAnimationController::addThrottlingReason): Deleted. (WebCore::ScriptedAnimationController::removeThrottlingReason): Deleted. (WebCore::ScriptedAnimationController::animationTimerFired): Deleted. * dom/ScriptedAnimationController.h: (WebCore::ScriptedAnimationController::addThrottlingReason): (WebCore::ScriptedAnimationController::removeThrottlingReason): Get rid of the rAF throttling timer. Service the rAF callback only when the period from the current time stamp till the last service time stamp is greater than the preferred rAF interval . * page/FrameView.cpp: (WebCore::FrameView::updateScriptedAnimationsAndTimersThrottlingState): ThrottlingReason is now defined outside ScriptedAnimationController. * page/Page.cpp: (WebCore::Page::renderingUpdateThrottlingEnabled const): (WebCore::Page::renderingUpdateThrottlingEnabledChanged): (WebCore::Page::isRenderingUpdateThrottled const): (WebCore::Page::preferredRenderingUpdateInterval const): Calculate the preferred RenderingUpdate interval from the throttling reasons. (WebCore::Page::setIsVisuallyIdleInternal): (WebCore::Page::handleLowModePowerChange): Call adjustRenderingUpdateFrequency() when isLowPowerModeEnabled or IsVisuallyIdle is toggled. (WebCore::updateScriptedAnimationsThrottlingReason): Deleted. * page/Page.h: * page/RenderingUpdateScheduler.cpp: (WebCore::RenderingUpdateScheduler::adjustFramesPerSecond): (WebCore::RenderingUpdateScheduler::adjustRenderingUpdateFrequency): Change the preferredFramesPerSecond of the DisplayRefreshMonitor if the throttling is not aggressive e.g. 10_s. Otherwise use the timer. (WebCore::RenderingUpdateScheduler::scheduleTimedRenderingUpdate): Call adjustFramesPerSecond() when DisplayRefreshMonitor is created. (WebCore::RenderingUpdateScheduler::startTimer): * page/RenderingUpdateScheduler.h: * page/Settings.yaml: * page/SettingsBase.cpp: (WebCore::SettingsBase::renderingUpdateThrottlingEnabledChanged): * page/SettingsBase.h: Add a setting to enable/disable RenderingUpdateThrottling. * platform/graphics/AnimationFrameRate.h: Added. (WebCore::preferredFrameInterval): (WebCore::preferredFramesPerSecond): * platform/graphics/DisplayRefreshMonitor.h: (WebCore::DisplayRefreshMonitor::setPreferredFramesPerSecond): * platform/graphics/DisplayRefreshMonitorManager.cpp: (WebCore::DisplayRefreshMonitorManager::monitorForClient): Rename createMonitorForClient() to monitorForClient() since it may return a cached DisplayRefreshMonitor. (WebCore::DisplayRefreshMonitorManager::setPreferredFramesPerSecond): (WebCore::DisplayRefreshMonitorManager::scheduleAnimation): (WebCore::DisplayRefreshMonitorManager::windowScreenDidChange): No need to call registerClient(). This function was just ensuring the DisplayRefreshMonitor is created. scheduleAnimation() does the same thing. (WebCore::DisplayRefreshMonitorManager::createMonitorForClient): Deleted. (WebCore::DisplayRefreshMonitorManager::registerClient): Deleted. * platform/graphics/DisplayRefreshMonitorManager.h: (WebCore::DisplayRefreshMonitorManager::DisplayRefreshMonitorManager): Deleted. * platform/graphics/GraphicsLayerUpdater.cpp: (WebCore::GraphicsLayerUpdater::GraphicsLayerUpdater): * platform/graphics/ios/DisplayRefreshMonitorIOS.mm: (-[WebDisplayLinkHandler setPreferredFramesPerSecond:]): Set the preferredFramesPerSecond of the CADisplayLink. Source/WebKit: Create an IPC message on the DrawingArea to send a message from the WebProcess to the UIProcess to setPreferredFramesPerSecond of the DisplayRefreshMonitor. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetRenderingUpdateThrottlingEnabled): (WKPreferencesGetRenderingUpdateThrottlingEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: Add a WKPreference key for RenderingUpdateThrottlingEnabled. * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (-[WKOneShotDisplayLinkHandler setPreferredFramesPerSecond:]): (WebKit::RemoteLayerTreeDrawingAreaProxy::setPreferredFramesPerSecond): Set the preferredFramesPerSecond of the CADisplayLink. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm: (WebKit::RemoteLayerTreeDisplayRefreshMonitor::setPreferredFramesPerSecond): Delegate the call to RemoteLayerTreeDrawingArea. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::setPreferredFramesPerSecond): Send the IPC message from the WebProcess to the UIProcess. Source/WebKitLegacy/mac: Add a WKPreference key for RenderingUpdateThrottling. * WebView/WebPreferenceKeysPrivate.h: * WebView/WebPreferences.mm: (+[WebPreferences initialize]): (-[WebPreferences renderingUpdateThrottlingEnabled]): (-[WebPreferences setRenderingUpdateThrottlingEnabled:]): * WebView/WebPreferencesPrivate.h: * WebView/WebView.mm: (-[WebView _preferencesChanged:]): Source/WebKitLegacy/win: Add a WKPreference key for RenderingUpdateThrottling. * Interfaces/IWebPreferencesPrivate.idl: * WebPreferenceKeysPrivate.h: * WebPreferences.cpp: (WebPreferences::initializeDefaultSettings): (WebPreferences::renderingUpdateThrottlingEnabled): (WebPreferences::setRenderingUpdateThrottlingEnabled): * WebPreferences.h: * WebView.cpp: (WebView::notifyPreferencesChanged): Tools: RenderingUpdateThrottling is enabled by default. Turn it off for DRT and WTR. In some cases, the page may not get visually active while it's waiting for rAF. Throttling tests will have to explicitly turn it on. * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebPreferencesToConsistentValues): * DumpRenderTree/win/DumpRenderTree.cpp: (resetWebPreferencesToConsistentValues): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetPreferencesToConsistentValues): LayoutTests: * fast/animation/css-animation-throttling-lowPowerMode.html: * fast/animation/request-animation-frame-throttle-subframe.html: * fast/animation/request-animation-frame-throttling-detached-iframe.html: Enable RenderingUpdateThrottling for these tests. * fast/animation/request-animation-frame-throttling-lowPowerMode-expected.txt: * fast/animation/request-animation-frame-throttling-lowPowerMode.html: Ensure the actual rAF interval is > 30ms for lowPowerMode. * fast/animation/request-animation-frame-throttling-outside-viewport-expected.txt: Added. * fast/animation/request-animation-frame-throttling-outside-viewport.html: Added. * fast/animation/resources/frame-with-animation-2.html: Added. Test the OutsideViewport throttling case. * http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe.html: Enable RenderingUpdateThrottling for this test. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255158 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-27 Said Abou-Hallawa <sabouhallawa@apple.com> Throttling requestAnimationFrame should be controlled by RenderingUpdateScheduler https://bugs.webkit.org/show_bug.cgi?id=204713 Reviewed by Simon Fraser. Create an IPC message on the DrawingArea to send a message from the WebProcess to the UIProcess to setPreferredFramesPerSecond of the DisplayRefreshMonitor. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetRenderingUpdateThrottlingEnabled): (WKPreferencesGetRenderingUpdateThrottlingEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: Add a WKPreference key for RenderingUpdateThrottlingEnabled. * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (-[WKOneShotDisplayLinkHandler setPreferredFramesPerSecond:]): (WebKit::RemoteLayerTreeDrawingAreaProxy::setPreferredFramesPerSecond): Set the preferredFramesPerSecond of the CADisplayLink. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm: (WebKit::RemoteLayerTreeDisplayRefreshMonitor::setPreferredFramesPerSecond): Delegate the call to RemoteLayerTreeDrawingArea. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::setPreferredFramesPerSecond): Send the IPC message from the WebProcess to the UIProcess. 2020-02-11 Brent Fulgham <bfulgham@apple.com> Cherry-pick r254989. rdar://problem/59354409 [iOS] Camera is lost during WebRTC demo https://bugs.webkit.org/show_bug.cgi?id=206613 <rdar://problem/58764572> Reviewed by Brent Fulgham. Fix observed sandbox violations in the Networking process. * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r256105. rdar://problem/59302221 Fix the watchOS build after <rdar://problem/56134081> https://bugs.webkit.org/show_bug.cgi?id=207443 <rdar://problem/59295173> Reviewed by Maciej Stachowiak. Use the version of the SPI that's guaranteed to be available across all platforms. * UIProcess/ios/WKContentViewInteraction.mm: (gestureRecognizerModifierFlags): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256105 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-09 Wenson Hsieh <wenson_hsieh@apple.com> Fix the watchOS build after <rdar://problem/56134081> https://bugs.webkit.org/show_bug.cgi?id=207443 <rdar://problem/59295173> Reviewed by Maciej Stachowiak. Use the version of the SPI that's guaranteed to be available across all platforms. * UIProcess/ios/WKContentViewInteraction.mm: (gestureRecognizerModifierFlags): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r256090. rdar://problem/59298156 Resource Load Statistics: Hold off non-cookie website data deletion until an hour after user interaction https://bugs.webkit.org/show_bug.cgi?id=207418 <rdar://problem/58550164> Reviewed by Chris Dumez. This change makes sure there is at least a one-hour or older timestamp for user interaction for some website before activating deletion of non-cookie website data for sites the user has not interacted with. This ensures that a fresh start such as after a reset or on a new device doesn't interpret the lack of data as lack of user interaction. No new tests. Existing tests make sure we don't regress the functionality. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor): * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256090 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-08 John Wilander <wilander@apple.com> Resource Load Statistics: Hold off non-cookie website data deletion until an hour after user interaction https://bugs.webkit.org/show_bug.cgi?id=207418 <rdar://problem/58550164> Reviewed by Chris Dumez. This change makes sure there is at least a one-hour or older timestamp for user interaction for some website before activating deletion of non-cookie website data for sites the user has not interacted with. This ensures that a fresh start such as after a reset or on a new device doesn't interpret the lack of data as lack of user interaction. No new tests. Existing tests make sure we don't regress the functionality. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor): * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r256075. rdar://problem/59298173 [Hardening] Validate Geolocation access permission on UIProcess side https://bugs.webkit.org/show_bug.cgi?id=207393 <rdar://problem/56816051> Reviewed by Brent Fulgham. Source/WebCore: Validate Geolocation access permission on UIProcess side, instead of only relying solely on the WebProcess for this. The workflow is as follows: - The Geolocation objects request for permission to access location data - The UIProcess shows a prompt - If the user accepts, the UIProcess sends an authorization token (a UUID string) to the Geolocation object. - When the Geolocation object later asks for location updates from the UIProcess, the UIProcess validates that this is a valid authorization token (one that it previously issued for this page) - When the Geolocation objects gets destroyed (or resets its permission), the authorization token gets revoked so that it is no longer valid. No new tests, no Web-facing behavior change, merely hardening. * Modules/geolocation/Geolocation.cpp: (WebCore::Geolocation::~Geolocation): (WebCore::Geolocation::resumeTimerFired): (WebCore::Geolocation::resetAllGeolocationPermission): (WebCore::Geolocation::stop): (WebCore::Geolocation::setIsAllowed): (WebCore::Geolocation::revokeAuthorizationTokenIfNecessary): (WebCore::Geolocation::resetIsAllowed): * Modules/geolocation/Geolocation.h: * Modules/geolocation/GeolocationClient.h: (WebCore::GeolocationClient::revokeAuthorizationToken): * Modules/geolocation/GeolocationController.cpp: (WebCore::GeolocationController::addObserver): (WebCore::GeolocationController::revokeAuthorizationToken): (WebCore::GeolocationController::activityStateDidChange): * Modules/geolocation/GeolocationController.h: * platform/mock/GeolocationClientMock.cpp: (WebCore::GeolocationClientMock::permissionTimerFired): (WebCore::GeolocationClientMock::startUpdating): * platform/mock/GeolocationClientMock.h: Source/WebKit: * UIProcess/GeolocationPermissionRequestManagerProxy.cpp: (WebKit::GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision): (WebKit::GeolocationPermissionRequestManagerProxy::isValidAuthorizationToken const): (WebKit::GeolocationPermissionRequestManagerProxy::revokeAuthorizationToken): * UIProcess/GeolocationPermissionRequestManagerProxy.h: * UIProcess/WebGeolocationManagerProxy.cpp: (WebKit::WebGeolocationManagerProxy::startUpdating): * UIProcess/WebGeolocationManagerProxy.h: * UIProcess/WebGeolocationManagerProxy.messages.in: * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::geolocationPermissionRequestManager): * UIProcess/WebPageProxy.messages.in: * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp: (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation): (WebKit::GeolocationPermissionRequestManager::revokeAuthorizationToken): (WebKit::GeolocationPermissionRequestManager::didReceiveGeolocationPermissionDecision): * WebProcess/Geolocation/GeolocationPermissionRequestManager.h: * WebProcess/Geolocation/WebGeolocationManager.cpp: (WebKit::WebGeolocationManager::registerWebPage): * WebProcess/Geolocation/WebGeolocationManager.h: * WebProcess/WebCoreSupport/WebGeolocationClient.cpp: (WebKit::WebGeolocationClient::startUpdating): (WebKit::WebGeolocationClient::revokeAuthorizationToken): * WebProcess/WebCoreSupport/WebGeolocationClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didReceiveGeolocationPermissionDecision): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Source/WebKitLegacy/mac: * WebCoreSupport/WebGeolocationClient.h: * WebCoreSupport/WebGeolocationClient.mm: (WebGeolocationClient::startUpdating): (WebGeolocationClient::requestPermission): (-[WebGeolocationPolicyListener allow]): (-[WebGeolocationPolicyListener deny]): Source/WebKitLegacy/win: * WebCoreSupport/WebGeolocationClient.cpp: (WebGeolocationClient::startUpdating): * WebCoreSupport/WebGeolocationClient.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256075 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-07 Chris Dumez <cdumez@apple.com> [Hardening] Validate Geolocation access permission on UIProcess side https://bugs.webkit.org/show_bug.cgi?id=207393 <rdar://problem/56816051> Reviewed by Brent Fulgham. * UIProcess/GeolocationPermissionRequestManagerProxy.cpp: (WebKit::GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision): (WebKit::GeolocationPermissionRequestManagerProxy::isValidAuthorizationToken const): (WebKit::GeolocationPermissionRequestManagerProxy::revokeAuthorizationToken): * UIProcess/GeolocationPermissionRequestManagerProxy.h: * UIProcess/WebGeolocationManagerProxy.cpp: (WebKit::WebGeolocationManagerProxy::startUpdating): * UIProcess/WebGeolocationManagerProxy.h: * UIProcess/WebGeolocationManagerProxy.messages.in: * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::geolocationPermissionRequestManager): * UIProcess/WebPageProxy.messages.in: * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp: (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation): (WebKit::GeolocationPermissionRequestManager::revokeAuthorizationToken): (WebKit::GeolocationPermissionRequestManager::didReceiveGeolocationPermissionDecision): * WebProcess/Geolocation/GeolocationPermissionRequestManager.h: * WebProcess/Geolocation/WebGeolocationManager.cpp: (WebKit::WebGeolocationManager::registerWebPage): * WebProcess/Geolocation/WebGeolocationManager.h: * WebProcess/WebCoreSupport/WebGeolocationClient.cpp: (WebKit::WebGeolocationClient::startUpdating): (WebKit::WebGeolocationClient::revokeAuthorizationToken): * WebProcess/WebCoreSupport/WebGeolocationClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didReceiveGeolocationPermissionDecision): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r256022. rdar://problem/59298187 Address post-landing review comments from Darin on r255989. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::terminateServiceWorkerProcess): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256022 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-07 Chris Dumez <cdumez@apple.com> Address post-landing review comments from Darin on r255989. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::terminateServiceWorkerProcess): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r256016. rdar://problem/59298146 Mandate UUID version 4 for mDNS ICE candidates https://bugs.webkit.org/show_bug.cgi?id=207329 Reviewed by Alex Christensen. Source/WebCore: Ignore ICE candidates if they are mDNS but not UUID version 4. Covered by existing tests relying on mDNS to do the connection. * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::shouldIgnoreCandidate): (WebCore::PeerConnectionBackend::addIceCandidate): Source/WebKit: * NetworkProcess/webrtc/NetworkMDNSRegister.cpp: (WebKit::NetworkMDNSRegister::registerMDNSName): Remove the count at the end of the mDNS name to make it a fully version 4 UUID. Source/WTF: Add a routine to validate version 4 UUID. * wtf/UUID.cpp: (WTF::isHexadecimalCharacter): (WTF::isVersion4UUID): * wtf/UUID.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256016 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-07 youenn fablet <youenn@apple.com> Mandate UUID version 4 for mDNS ICE candidates https://bugs.webkit.org/show_bug.cgi?id=207329 Reviewed by Alex Christensen. * NetworkProcess/webrtc/NetworkMDNSRegister.cpp: (WebKit::NetworkMDNSRegister::registerMDNSName): Remove the count at the end of the mDNS name to make it a fully version 4 UUID. 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r256005. rdar://problem/59299335 macCatalyst: Unnecessary I-beam over images in editable areas https://bugs.webkit.org/show_bug.cgi?id=207370 <rdar://problem/59235429> Reviewed by Wenson Hsieh. Source/WebCore: * dom/Position.h: Source/WebKit: * Shared/ios/InteractionInformationAtPosition.h: * Shared/ios/InteractionInformationAtPosition.mm: (WebKit::InteractionInformationAtPosition::encode const): (WebKit::InteractionInformationAtPosition::decode): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::populateCaretContext): Add a bit indicating whether the forced I-beam for editable contexts should be used or not, based on whether it is adjacent to (or immediately over) a replaced element. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256005 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-06 Tim Horton <timothy_horton@apple.com> macCatalyst: Unnecessary I-beam over images in editable areas https://bugs.webkit.org/show_bug.cgi?id=207370 <rdar://problem/59235429> Reviewed by Wenson Hsieh. * Shared/ios/InteractionInformationAtPosition.h: * Shared/ios/InteractionInformationAtPosition.mm: (WebKit::InteractionInformationAtPosition::encode const): (WebKit::InteractionInformationAtPosition::decode): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::populateCaretContext): Add a bit indicating whether the forced I-beam for editable contexts should be used or not, based on whether it is adjacent to (or immediately over) a replaced element. 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r256000. rdar://problem/59299326 WebPage::rangeForGranularityAtPoint always returns null in the case of CharacterGranularity https://bugs.webkit.org/show_bug.cgi?id=207350 <rdar://problem/59239914> Reviewed by Tim Horton. Source/WebKit: Handle the character granularity case in `WebPage::rangeForGranularityAtPoint` by just returning a collapsed Range. Certain internal clients will have a need to place and update the text selection using character granularity; see radar for more details. Test: UIWKInteractionViewProtocol.SelectTextWithCharacterGranularity * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView supportsTextSelectionWithCharacterGranularity]): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::rangeForGranularityAtPoint): Tools: Add a test to exercise the corner case in the SPI. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/ios/UIWKInteractionViewProtocol.mm: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256000 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-06 Wenson Hsieh <wenson_hsieh@apple.com> WebPage::rangeForGranularityAtPoint always returns null in the case of CharacterGranularity https://bugs.webkit.org/show_bug.cgi?id=207350 <rdar://problem/59239914> Reviewed by Tim Horton. Handle the character granularity case in `WebPage::rangeForGranularityAtPoint` by just returning a collapsed Range. Certain internal clients will have a need to place and update the text selection using character granularity; see radar for more details. Test: UIWKInteractionViewProtocol.SelectTextWithCharacterGranularity * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView supportsTextSelectionWithCharacterGranularity]): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::rangeForGranularityAtPoint): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255989. rdar://problem/59298187 REGRESSION (r254706): Crash under WebProcessPool::terminateServiceWorkerProcess() https://bugs.webkit.org/show_bug.cgi?id=207354 <rdar://problem/59184818> Reviewed by Geoffrey Garen. No new tests, not easily testable AFAIK since this happens on failure to send sync IPC to the service worker when terminating it. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::terminateServiceWorkerProcess): 'auto' resolved to 'WeakPtr<WebProcessProxy>' in this method and the call to disableServiceWorkers() could cause the process to get destroyed. We would then do a null dereference on the next line. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255989 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-06 Chris Dumez <cdumez@apple.com> REGRESSION (r254706): Crash under WebProcessPool::terminateServiceWorkerProcess() https://bugs.webkit.org/show_bug.cgi?id=207354 <rdar://problem/59184818> Reviewed by Geoffrey Garen. No new tests, not easily testable AFAIK since this happens on failure to send sync IPC to the service worker when terminating it. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::terminateServiceWorkerProcess): 'auto' resolved to 'WeakPtr<WebProcessProxy>' in this method and the call to disableServiceWorkers() could cause the process to get destroyed. We would then do a null dereference on the next line. 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255879. rdar://problem/59299329 [macCatalyst] Incorrect IBeam cursor when selecting text on Wikipedia https://bugs.webkit.org/show_bug.cgi?id=207299 <rdar://problem/59200545> Reviewed by Tim Horton. After r255827, if EventHandler selects an IBeam cursor at the position information request location, we will always attempt to show a caret at that location, whose height is the height of the editing caret for that visible position. However, this means that: - It's possible for the caret to be incorrectly sized if the caret is before a large replaced element, such as a table. Since the request location is also outside of any line rect, it doesn't make sense to use the caret height for the height of the cursor. Instead, fall back to computed line height. This fixes an issue on en.wikipedia.org where the line rect would sometimes update to an enormous size when selecting text, since the caret would temporarily hover over an editing position that is before a large table. - This fallback path completely negates certain cursor behaviors; partially restore this behavior by making it so that in the case where the cursor is in editable content and the line caret first line from the top of the hit-tested node already contains the request point, don't bother trying to recenter the line rect to be right over the request point. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::populateCaretContext): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255879 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-05 Wenson Hsieh <wenson_hsieh@apple.com> [macCatalyst] Incorrect IBeam cursor when selecting text on Wikipedia https://bugs.webkit.org/show_bug.cgi?id=207299 <rdar://problem/59200545> Reviewed by Tim Horton. After r255827, if EventHandler selects an IBeam cursor at the position information request location, we will always attempt to show a caret at that location, whose height is the height of the editing caret for that visible position. However, this means that: - It's possible for the caret to be incorrectly sized if the caret is before a large replaced element, such as a table. Since the request location is also outside of any line rect, it doesn't make sense to use the caret height for the height of the cursor. Instead, fall back to computed line height. This fixes an issue on en.wikipedia.org where the line rect would sometimes update to an enormous size when selecting text, since the caret would temporarily hover over an editing position that is before a large table. - This fallback path completely negates certain cursor behaviors; partially restore this behavior by making it so that in the case where the cursor is in editable content and the line caret first line from the top of the hit-tested node already contains the request point, don't bother trying to recenter the line rect to be right over the request point. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::populateCaretContext): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255874. rdar://problem/59298178 [iOS] Do not create sandbox reports when the UI process cannot issue extensions to diagnostics service https://bugs.webkit.org/show_bug.cgi?id=207279 <rdar://problem/59030957> Source/WebKit: Reviewed by Brent Fulgham. Do not create sandbox reports when the UI process cannot issue mach extensions to the diagnostics service. The majority of clients are capable of doing this. No new tests, since it is not trivial to test if no sandbox reports are generated for a violation. * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::SandboxExtensionImpl::create): (WebKit::SandboxExtensionImpl::sandboxExtensionForType): (WebKit::SandboxExtensionImpl::SandboxExtensionImpl): (WebKit::SandboxExtension::createHandleForMachLookup): * Shared/SandboxExtension.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): Source/WTF: Reviewed by Brent Fulgham. Add flag which avoids generating sandbox reports. * wtf/spi/darwin/SandboxSPI.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255874 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-05 Per Arne Vollan <pvollan@apple.com> [iOS] Do not create sandbox reports when the UI process cannot issue extensions to diagnostics service https://bugs.webkit.org/show_bug.cgi?id=207279 <rdar://problem/59030957> Reviewed by Brent Fulgham. Do not create sandbox reports when the UI process cannot issue mach extensions to the diagnostics service. The majority of clients are capable of doing this. No new tests, since it is not trivial to test if no sandbox reports are generated for a violation. * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::SandboxExtensionImpl::create): (WebKit::SandboxExtensionImpl::sandboxExtensionForType): (WebKit::SandboxExtensionImpl::SandboxExtensionImpl): (WebKit::SandboxExtension::createHandleForMachLookup): * Shared/SandboxExtension.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255848. rdar://problem/59298190 [IPC Hardening] Protect against bad RegistrableDomain under WebProcessProxy::didCollectPrewarmInformation() https://bugs.webkit.org/show_bug.cgi?id=207281 <rdar://problem/55318108> Reviewed by Geoffrey Garen. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didCollectPrewarmInformation): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255848 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-05 Chris Dumez <cdumez@apple.com> [IPC Hardening] Protect against bad RegistrableDomain under WebProcessProxy::didCollectPrewarmInformation() https://bugs.webkit.org/show_bug.cgi?id=207281 <rdar://problem/55318108> Reviewed by Geoffrey Garen. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didCollectPrewarmInformation): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255827. rdar://problem/59299345 [macCatalyst] IBeam cursor doesn't show up when hovering over text form controls prior to editing https://bugs.webkit.org/show_bug.cgi?id=207268 <rdar://problem/59188152> Reviewed by Tim Horton. On macCatalyst, when hovering over textareas and input fields that have not been edited yet, the cursor fails to change to an IBeam and instead falls back to the default style. Even though `EventHandler::selectCursor()` returns `IBeam`, we end up not actually using an IBeam because the position information's `lineCaretExtent` is an empty rect, which means the caret height is 0 and, more importantly, the line rect will not contain the request point. The line rect is empty in text fields that have not been edited yet because the form control's inner plaintext contenteditable div (embedded in the shadow root) does not contain any child renderers with a non-zero height. Even if it did, however, the element may still be much taller than the combined height of the inner div's children, so the line rect may still not contain the position information request point (this is most easily noticeable when focusing a textarea, typing a few letters, and then moving the cursor to near the bottom of the textarea element). To fix this, add a fallback path for the scenario where we want to show an IBeam, but fail to find line rects that contain the request point. Instead, we still show an IBeam, but simply fake the lineCaretExtent to be an element-wide rect that is the height of the caret, and is also vertically centered about the request point. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::populateCaretContext): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255827 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-05 Wenson Hsieh <wenson_hsieh@apple.com> [macCatalyst] IBeam cursor doesn't show up when hovering over text form controls prior to editing https://bugs.webkit.org/show_bug.cgi?id=207268 <rdar://problem/59188152> Reviewed by Tim Horton. On macCatalyst, when hovering over textareas and input fields that have not been edited yet, the cursor fails to change to an IBeam and instead falls back to the default style. Even though `EventHandler::selectCursor()` returns `IBeam`, we end up not actually using an IBeam because the position information's `lineCaretExtent` is an empty rect, which means the caret height is 0 and, more importantly, the line rect will not contain the request point. The line rect is empty in text fields that have not been edited yet because the form control's inner plaintext contenteditable div (embedded in the shadow root) does not contain any child renderers with a non-zero height. Even if it did, however, the element may still be much taller than the combined height of the inner div's children, so the line rect may still not contain the position information request point (this is most easily noticeable when focusing a textarea, typing a few letters, and then moving the cursor to near the bottom of the textarea element). To fix this, add a fallback path for the scenario where we want to show an IBeam, but fail to find line rects that contain the request point. Instead, we still show an IBeam, but simply fake the lineCaretExtent to be an element-wide rect that is the height of the caret, and is also vertically centered about the request point. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::populateCaretContext): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255814. rdar://problem/59298180 Unreviewed, follow-up assertion fix after r255662. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255814 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-05 Chris Dumez <cdumez@apple.com> Unreviewed, follow-up assertion fix after r255662. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255786. rdar://problem/59298135 REGRESSION (r251320): Can't double tap to select word in Notes on iCloud.com https://bugs.webkit.org/show_bug.cgi?id=207239 <rdar://problem/58686015> Reviewed by Tim Horton. Source/WebKit: Following r251320, all synthetic mouse events on iOS additionally dispatched corresponding pointer events. This led to duplicate "pointerdown"/"pointerup" events dispatched with every tap. r253878 fixed this by avoiding pointer event dispatch for synthetically generated mouse events (and made this determination by consulting `syntheticClickType()`). However, in the case where we're synthesizing a mouse event for a "dblclick" event handler (after a double- tap), we currently pass `NoTap` as the synthetic click event type when creating the mouse event. This causes additional pointer events to be synthesized and dispatched during a double tap, which creates three pairs of "pointerdown"/"pointerup" events upon double-tap. This subsequently confuses iCloud Notes' web app when double tapping to select a word. Fix this by passing in `OneFingerTap` as the synthetic click type instead (since two-finger double taps should already be handled by the two-finger double-tap magnification gesture). Test: pointerevents/ios/pointer-events-for-double-tap.html * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint): LayoutTests: Add a test to verify that performing a double tap on an element with a dblclick handler results in the following sequence of events: `[ "pointerdown", "pointerup", "pointerdown", "pointerup", "dblclick" ]`. * pointerevents/ios/pointer-events-for-double-tap-expected.txt: Added. * pointerevents/ios/pointer-events-for-double-tap.html: Added. * pointerevents/utils.js: (const.ui.new.UIController.prototype.doubleTap): Add a helper method to simulate a double-tap gesture. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255786 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-04 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r251320): Can't double tap to select word in Notes on iCloud.com https://bugs.webkit.org/show_bug.cgi?id=207239 <rdar://problem/58686015> Reviewed by Tim Horton. Following r251320, all synthetic mouse events on iOS additionally dispatched corresponding pointer events. This led to duplicate "pointerdown"/"pointerup" events dispatched with every tap. r253878 fixed this by avoiding pointer event dispatch for synthetically generated mouse events (and made this determination by consulting `syntheticClickType()`). However, in the case where we're synthesizing a mouse event for a "dblclick" event handler (after a double- tap), we currently pass `NoTap` as the synthetic click event type when creating the mouse event. This causes additional pointer events to be synthesized and dispatched during a double tap, which creates three pairs of "pointerdown"/"pointerup" events upon double-tap. This subsequently confuses iCloud Notes' web app when double tapping to select a word. Fix this by passing in `OneFingerTap` as the synthetic click type instead (since two-finger double taps should already be handled by the two-finger double-tap magnification gesture). Test: pointerevents/ios/pointer-events-for-double-tap.html * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255710. rdar://problem/59299340 macCatalyst: Shouldn't get text cursor on checkboxes https://bugs.webkit.org/show_bug.cgi?id=207234 <rdar://problem/59155917> Reviewed by Wenson Hsieh. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::canForceCaretForPosition): (WebKit::populateCaretContext): (WebKit::lineCaretExtent): Deleted. The I-beam forcing code was a bit too aggressive; it should consider the style of the node that it ends up finding after searching, not just assume it wants an I-beam because it's "texty". git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255710 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-04 Tim Horton <timothy_horton@apple.com> macCatalyst: Shouldn't get text cursor on checkboxes https://bugs.webkit.org/show_bug.cgi?id=207234 <rdar://problem/59155917> Reviewed by Wenson Hsieh. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::canForceCaretForPosition): (WebKit::populateCaretContext): (WebKit::lineCaretExtent): Deleted. The I-beam forcing code was a bit too aggressive; it should consider the style of the node that it ends up finding after searching, not just assume it wants an I-beam because it's "texty". 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255705. rdar://problem/59298180 Unreviewed, follow-up assertion fix after r255662. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255705 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-04 Chris Dumez <cdumez@apple.com> Unreviewed, follow-up assertion fix after r255662. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255691. rdar://problem/59299315 [macCatalyst] Missing custom cursors in subframes that are offset from the origin of the root view https://bugs.webkit.org/show_bug.cgi?id=207215 <rdar://problem/59157625> Reviewed by Tim Horton. <https://trac.webkit.org/r255046> added support for custom cursor styles when hovering over subframes. However, we currently try to hit-test content in the subframe using the interaction information request's point, which is in root view coordinates; as such, we only get the correct custom cursor styles when hovering over elements in a subframe, if the subframe is also at the origin of the root view. To fix this, simply convert from root view coordinates to frame coordinates when performing the hit-test. Unfortunately, this change is currently untestable; see <rdar://problem/59158410>. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::lineCaretExtent): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255691 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-04 Wenson Hsieh <wenson_hsieh@apple.com> [macCatalyst] Missing custom cursors in subframes that are offset from the origin of the root view https://bugs.webkit.org/show_bug.cgi?id=207215 <rdar://problem/59157625> Reviewed by Tim Horton. <https://trac.webkit.org/r255046> added support for custom cursor styles when hovering over subframes. However, we currently try to hit-test content in the subframe using the interaction information request's point, which is in root view coordinates; as such, we only get the correct custom cursor styles when hovering over elements in a subframe, if the subframe is also at the origin of the root view. To fix this, simply convert from root view coordinates to frame coordinates when performing the hit-test. Unfortunately, this change is currently untestable; see <rdar://problem/59158410>. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::lineCaretExtent): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255681. rdar://problem/59298166 NetworkProcess should be notified by UIProcess when its service worker process connection should be on https://bugs.webkit.org/show_bug.cgi?id=207122 <rdar://problem/59089780> Reviewed by Chris Dumez. Source/WebCore: Add a completion handler to the create context connection callback. This is called when the context connection should have been created. In case there is a context connection, completion handler does nothing. Otherwise, SWServer will retry creating a context connection if needed. The pending connection map entry is now removed in the completion handler instead of addContextConnection. This ensures that only one connection request is sent by network process at a time. Add extra logging to monitor creation of a context connection. * workers/service/context/SWContextManager.h: * workers/service/server/SWServer.cpp: (WebCore::SWServer::addContextConnection): (WebCore::SWServer::removeContextConnection): (WebCore::SWServer::createContextConnectionFinished): * workers/service/server/SWServer.h: Source/WebKit: Add completion handlers to the messaging from NetworkProcess -> UIProcess -> WebProcess -> NetworkProcess used to create a service worker context connection. This allows NetworkProcess to ask again for a connection if the connection is still needed but NetworkProcess did not find the context connection. This is difficult to test since we would need for the process selected to host service workers to exit between the time it is selected and the time it sends the message to Networking process. To ensure that the context connection is created by WebProcess, WebProcessProxy takes a background assertion until WebProcess finishes creating the context connection to Network process. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::establishSWContextConnection): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::swServerForSession): * NetworkProcess/NetworkProcess.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::establishServiceWorkerContext): * UIProcess/WebProcessProxy.h: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::m_userAgent): (WebKit::WebSWContextManagerConnection::establishConnection): * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255681 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-04 youenn fablet <youenn@apple.com> NetworkProcess should be notified by UIProcess when its service worker process connection should be on https://bugs.webkit.org/show_bug.cgi?id=207122 <rdar://problem/59089780> Reviewed by Chris Dumez. Add completion handlers to the messaging from NetworkProcess -> UIProcess -> WebProcess -> NetworkProcess used to create a service worker context connection. This allows NetworkProcess to ask again for a connection if the connection is still needed but NetworkProcess did not find the context connection. This is difficult to test since we would need for the process selected to host service workers to exit between the time it is selected and the time it sends the message to Networking process. To ensure that the context connection is created by WebProcess, WebProcessProxy takes a background assertion until WebProcess finishes creating the context connection to Network process. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::establishSWContextConnection): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::swServerForSession): * NetworkProcess/NetworkProcess.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::establishServiceWorkerContext): * UIProcess/WebProcessProxy.h: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::m_userAgent): (WebKit::WebSWContextManagerConnection::establishConnection): * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255679. rdar://problem/59298180 Unreviewed, follow-up assertion fix after r255662. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255679 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-04 Chris Dumez <cdumez@apple.com> Unreviewed, follow-up assertion fix after r255662. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255677. rdar://problem/59299115 REGRESSION(r255595): page not closed after beforeunload handler returns true https://bugs.webkit.org/show_bug.cgi?id=207189 Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2020-02-04 Reviewed by Chris Dumez. We are assuming the try close did timeout in that case, because the timer is stopped before running the beforeunload dialog. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): Start the try close timer again when the beforeunload dialog replies. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255677 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-04 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r255595): page not closed after beforeunload handler returns true https://bugs.webkit.org/show_bug.cgi?id=207189 Reviewed by Chris Dumez. We are assuming the try close did timeout in that case, because the timer is stopped before running the beforeunload dialog. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): Start the try close timer again when the beforeunload dialog replies. 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255664. rdar://problem/59299338 Add a WebKitAdditions hook to provide additional customizations to UIDragInteraction https://bugs.webkit.org/show_bug.cgi?id=207177 <rdar://problem/59121266> Reviewed by Tim Horton. Add a WebKitAdditions extension point that runs immediately after setting up UIDragInteraction and UIDropInteraction. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupDragAndDropInteractions]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255664 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-03 Wenson Hsieh <wenson_hsieh@apple.com> Add a WebKitAdditions hook to provide additional customizations to UIDragInteraction https://bugs.webkit.org/show_bug.cgi?id=207177 <rdar://problem/59121266> Reviewed by Tim Horton. Add a WebKitAdditions extension point that runs immediately after setting up UIDragInteraction and UIDropInteraction. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupDragAndDropInteractions]): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255662. rdar://problem/59298180 Stop relying on ResponsivenessTimer to keep the WebProcess from suspending during initialization https://bugs.webkit.org/show_bug.cgi?id=207144 Reviewed by Brady Eidson. Stop relying on ResponsivenessTimer to keep the WebProcess from suspending during initialization. Instead, make the WebProcess::InitializeWebProcess IPC async with a reply and take a process assertion on behalf of the WebContent process until we get a response back. This avoids sending an extra WebProcess::MainThreadPing IPC to the WebProcess for no reason (since we're already sending the WebProcess::InitializeWebProcess IPC) and this is also more reliable since the ResponsivenessTimer can actually time out and cause the process to get suspended during initialization still. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255662 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-03 Chris Dumez <cdumez@apple.com> Stop relying on ResponsivenessTimer to keep the WebProcess from suspending during initialization https://bugs.webkit.org/show_bug.cgi?id=207144 Reviewed by Brady Eidson. Stop relying on ResponsivenessTimer to keep the WebProcess from suspending during initialization. Instead, make the WebProcess::InitializeWebProcess IPC async with a reply and take a process assertion on behalf of the WebContent process until we get a response back. This avoids sending an extra WebProcess::MainThreadPing IPC to the WebProcess for no reason (since we're already sending the WebProcess::InitializeWebProcess IPC) and this is also more reliable since the ResponsivenessTimer can actually time out and cause the process to get suspended during initialization still. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255658. rdar://problem/59299333 Unreviewed, fix the internal build after <rdar://problem/59132944> * UIProcess/ios/WKContentViewInteraction.h: Declare this helper in the header, now that it's consulted by some WebKitAdditions code. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255658 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-03 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix the internal build after <rdar://problem/59132944> * UIProcess/ios/WKContentViewInteraction.h: Declare this helper in the header, now that it's consulted by some WebKitAdditions code. 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255625. rdar://problem/59299317 Add a WebKitAdditions hook to override the behavior of -[WKContentView gestureRecognizer:shouldReceiveTouch:] https://bugs.webkit.org/show_bug.cgi?id=207162 <rdar://problem/59129739> Reviewed by Tim Horton. Allow an internal implementation of `-_allowGestureRecognizer:toReceiveTouch:` to prevent touches from being routed to certain gesture recognizers, if necessary. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView gestureRecognizer:shouldReceiveTouch:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255625 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-03 Wenson Hsieh <wenson_hsieh@apple.com> Add a WebKitAdditions hook to override the behavior of -[WKContentView gestureRecognizer:shouldReceiveTouch:] https://bugs.webkit.org/show_bug.cgi?id=207162 <rdar://problem/59129739> Reviewed by Tim Horton. Allow an internal implementation of `-_allowGestureRecognizer:toReceiveTouch:` to prevent touches from being routed to certain gesture recognizers, if necessary. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView gestureRecognizer:shouldReceiveTouch:]): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255610. rdar://problem/59298157 [WK2] Use per-UIProcess default cookie storage for Mac Catalyst apps https://bugs.webkit.org/show_bug.cgi?id=207139 <rdar://problem/59047014> Reviewed by Brent Fulgham. Use per-UIProcess default cookie storage for Mac Catalyst apps, similarly to what we do for regular macOS apps. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255610 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-03 Chris Dumez <cdumez@apple.com> [WK2] Use per-UIProcess default cookie storage for Mac Catalyst apps https://bugs.webkit.org/show_bug.cgi?id=207139 <rdar://problem/59047014> Reviewed by Brent Fulgham. Use per-UIProcess default cookie storage for Mac Catalyst apps, similarly to what we do for regular macOS apps. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255603. rdar://problem/59299321 [iOS 13] Dragging on-screen volume control on a YouTube video selects text around the panel https://bugs.webkit.org/show_bug.cgi?id=207140 <rdar://problem/58852938> Reviewed by Tim Horton. Source/WebKit: This bug occurs on iPadOS when long pressing the volume controls on the desktop version of YouTube, and then performing a pan gesture; this activates the highlight text selection gesture recognizer added in iOS 13, causing text to be selected while adjusting the volume using these custom controls. On macOS, we avoid this because `Node::canStartSelection()` returns `false`, due to a container node having both `user-drag: element` and `user-select: none`; in this scenario, we allow dragging to take precendence over text selection, so the volume slider can be moved using a mouse without simultaneously selecting text. This logic is currently absent on iOS, where UIKit text interaction gesture recognizers ask us for information about the DOM at given locations, and we determine whether to allow text interaction gestures (such as long pressing) to begin in `-textInteractionGesture:shouldBeginAtPoint:` and `-hasSelectablePositionAtPoint:`. Ideally, we'd want to eventually unify these two codepaths for triggering text selection (and preferably just have both go through EventHandler); in lieu of this, simply make the iOS codepath behave a little more like macOS by adding a bit to allow text interaction gestures to bail in the case where at least one container of the hit-tested element is both draggable and unselectable. Test: editing/selection/ios/prefer-drag-over-text-selection.html * Shared/ios/InteractionInformationAtPosition.h: * Shared/ios/InteractionInformationAtPosition.mm: (WebKit::InteractionInformationAtPosition::encode const): (WebKit::InteractionInformationAtPosition::decode): Add the new bit to InteractionInformationAtPosition. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): Avoid beginning text selection if the bit is set. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::selectionPositionInformation): Move a comment about the ">= 97% of the document's visible area" heuristic next to the relevant code, and also leave a FIXME mentioning that we should reconsider whether this is really needed; it seems that this was originally intended to avoid ending up with an excessively large block selection, but block selection has been removed entirely since iOS 12. That said, this logic may still be helping avoid situations where the text selection is too aggressive on iOS and ends up selecting too much text. LayoutTests: Add a layout test to verify that we don't allow text selection gestures inside of containers that have both `user-drag: element` and `user-select: none`. * editing/selection/ios/prefer-drag-over-text-selection-expected.txt: Added. * editing/selection/ios/prefer-drag-over-text-selection.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255603 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-03 Wenson Hsieh <wenson_hsieh@apple.com> [iOS 13] Dragging on-screen volume control on a YouTube video selects text around the panel https://bugs.webkit.org/show_bug.cgi?id=207140 <rdar://problem/58852938> Reviewed by Tim Horton. This bug occurs on iPadOS when long pressing the volume controls on the desktop version of YouTube, and then performing a pan gesture; this activates the highlight text selection gesture recognizer added in iOS 13, causing text to be selected while adjusting the volume using these custom controls. On macOS, we avoid this because `Node::canStartSelection()` returns `false`, due to a container node having both `user-drag: element` and `user-select: none`; in this scenario, we allow dragging to take precendence over text selection, so the volume slider can be moved using a mouse without simultaneously selecting text. This logic is currently absent on iOS, where UIKit text interaction gesture recognizers ask us for information about the DOM at given locations, and we determine whether to allow text interaction gestures (such as long pressing) to begin in `-textInteractionGesture:shouldBeginAtPoint:` and `-hasSelectablePositionAtPoint:`. Ideally, we'd want to eventually unify these two codepaths for triggering text selection (and preferably just have both go through EventHandler); in lieu of this, simply make the iOS codepath behave a little more like macOS by adding a bit to allow text interaction gestures to bail in the case where at least one container of the hit-tested element is both draggable and unselectable. Test: editing/selection/ios/prefer-drag-over-text-selection.html * Shared/ios/InteractionInformationAtPosition.h: * Shared/ios/InteractionInformationAtPosition.mm: (WebKit::InteractionInformationAtPosition::encode const): (WebKit::InteractionInformationAtPosition::decode): Add the new bit to InteractionInformationAtPosition. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): Avoid beginning text selection if the bit is set. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::selectionPositionInformation): Move a comment about the ">= 97% of the document's visible area" heuristic next to the relevant code, and also leave a FIXME mentioning that we should reconsider whether this is really needed; it seems that this was originally intended to avoid ending up with an excessively large block selection, but block selection has been removed entirely since iOS 12. That said, this logic may still be helping avoid situations where the text selection is too aggressive on iOS and ends up selecting too much text. 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255581. rdar://problem/59298169 [macOS] AirPlay sometimes stops after 60 minutes of playback https://bugs.webkit.org/show_bug.cgi?id=207056 Source/WebCore: <rdar://problem/53649508> Reviewed by Jer Noble. No new tests, this only reproduces when playing to an AirPlay device. AVPlayerItem.tracks is empty during AirPlay. If AirPlay is activated immediately after the item is created, as is typically the case when switching from an MSE to a url based player, MediaPlayerPrivateAVFoundationObjC doesn't know if the AVPlayerItem has audio or video so the state reported to the WebMediaSessionManager is incorrect. AirPlay can't actually be active if an item doesn't have audio or video, so always claim to have both during AirPlay. Converted WebMediaSessionManager logging from debug-only to runtime to make it easier to diagnose problems in the future. * Modules/mediasession/WebMediaSessionManager.cpp: (WebCore::mediaProducerStateString): (WebCore::WebMediaSessionLogger::create): (WebCore::WebMediaSessionLogger::WebMediaSessionLogger): (WebCore::WebMediaSessionLogger::log const): (WebCore::WebMediaSessionManager::logger): (WebCore::WebMediaSessionManager::alwaysOnLoggingAllowed const): (WebCore::WebMediaSessionManager::setMockMediaPlaybackTargetPickerEnabled): (WebCore::WebMediaSessionManager::setMockMediaPlaybackTargetPickerState): (WebCore::WebMediaSessionManager::mockMediaPlaybackTargetPickerDismissPopup): (WebCore::WebMediaSessionManager::addPlaybackTargetPickerClient): (WebCore::WebMediaSessionManager::removePlaybackTargetPickerClient): (WebCore::WebMediaSessionManager::removeAllPlaybackTargetPickerClients): (WebCore::WebMediaSessionManager::showPlaybackTargetPicker): (WebCore::WebMediaSessionManager::clientStateDidChange): (WebCore::WebMediaSessionManager::setPlaybackTarget): (WebCore::WebMediaSessionManager::externalOutputDeviceAvailableDidChange): (WebCore::WebMediaSessionManager::playbackTargetPickerWasDismissed): (WebCore::WebMediaSessionManager::configurePlaybackTargetClients): (WebCore::WebMediaSessionManager::configurePlaybackTargetMonitoring): (WebCore::WebMediaSessionManager::configureWatchdogTimer): (WebCore::WebMediaSessionManager::watchdogTimerFired): (WebCore::ClientState::logAlways const): Deleted. * Modules/mediasession/WebMediaSessionManager.h: * Modules/mediasession/WebMediaSessionManagerClient.h: (WebCore::WebMediaSessionManagerClient::alwaysOnLoggingAllowed): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaState const): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::hasVideo const): (WebCore::MediaPlayerPrivateAVFoundationObjC::hasAudio const): Source/WebKit: Reviewed by Jer Noble. * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255581 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-03 Eric Carlson <eric.carlson@apple.com> [macOS] AirPlay sometimes stops after 60 minutes of playback https://bugs.webkit.org/show_bug.cgi?id=207056 Reviewed by Jer Noble. * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255527. rdar://problem/59299116 Unreviewed build fix after r255522. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): Switched to a C-style cast. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255527 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-31 Andy Estes <aestes@apple.com> Unreviewed build fix after r255522. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): Switched to a C-style cast. 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255522. rdar://problem/59299116 Add KVO SPI WKWebView._negotiatedLegacyTLS https://bugs.webkit.org/show_bug.cgi?id=207067 Patch by Alex Christensen <achristensen@webkit.org> on 2020-01-31 Reviewed by Andy Estes. Source/WebKit: Covered by API tests. * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::negotiatedLegacyTLS const): * NetworkProcess/NetworkDataTask.h: (WebKit::NetworkDataTaskClient::negotiatedLegacyTLS const): * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::negotiatedLegacyTLS const): * NetworkProcess/NetworkLoad.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): * Shared/Authentication/AuthenticationManager.cpp: (WebKit::AuthenticationManager::negotiatedLegacyTLS const): * Shared/Authentication/AuthenticationManager.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _negotiatedLegacyTLS]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::willChangeNegotiatedLegacyTLS): (WebKit::NavigationState::didChangeNegotiatedLegacyTLS): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::negotiatedLegacyTLS): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::commitChanges): (WebKit::PageLoadState::hasNegotiatedLegacyTLS const): (WebKit::PageLoadState::negotiatedLegacyTLS): (WebKit::PageLoadState::didCommitLoad): * UIProcess/PageLoadState.h: (WebKit::PageLoadState::Observer::willChangeNegotiatedLegacyTLS): (WebKit::PageLoadState::Observer::didChangeNegotiatedLegacyTLS): (WebKit::PageLoadState::Data::Data): Deleted. * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm: (-[TLSObserver observeValueForKeyPath:ofObject:change:context:]): (-[TLSObserver waitUntilNegotiatedLegacyTLSChanged]): (TestWebKitAPI::TEST): * TestWebKitAPI/config.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255522 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-31 Alex Christensen <achristensen@webkit.org> Add KVO SPI WKWebView._negotiatedLegacyTLS https://bugs.webkit.org/show_bug.cgi?id=207067 Reviewed by Andy Estes. Covered by API tests. * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::negotiatedLegacyTLS const): * NetworkProcess/NetworkDataTask.h: (WebKit::NetworkDataTaskClient::negotiatedLegacyTLS const): * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::negotiatedLegacyTLS const): * NetworkProcess/NetworkLoad.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): * Shared/Authentication/AuthenticationManager.cpp: (WebKit::AuthenticationManager::negotiatedLegacyTLS const): * Shared/Authentication/AuthenticationManager.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _negotiatedLegacyTLS]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::willChangeNegotiatedLegacyTLS): (WebKit::NavigationState::didChangeNegotiatedLegacyTLS): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::negotiatedLegacyTLS): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::commitChanges): (WebKit::PageLoadState::hasNegotiatedLegacyTLS const): (WebKit::PageLoadState::negotiatedLegacyTLS): (WebKit::PageLoadState::didCommitLoad): * UIProcess/PageLoadState.h: (WebKit::PageLoadState::Observer::willChangeNegotiatedLegacyTLS): (WebKit::PageLoadState::Observer::didChangeNegotiatedLegacyTLS): (WebKit::PageLoadState::Data::Data): Deleted. * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255438. rdar://problem/59299136 Disable Service Workers before terminating an unresponsive service worker process https://bugs.webkit.org/show_bug.cgi?id=206994 Reviewed by Chris Dumez. In case a process becomes unresponsive, we terminate it in case it is a service worker process. In that case, we should make sure not to call the service worker process crash callback. To do so, disable service workers before terminating the IPC connection. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didBecomeUnresponsive): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255438 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-30 youenn fablet <youenn@apple.com> Disable Service Workers before terminating an unresponsive service worker process https://bugs.webkit.org/show_bug.cgi?id=206994 Reviewed by Chris Dumez. In case a process becomes unresponsive, we terminate it in case it is a service worker process. In that case, we should make sure not to call the service worker process crash callback. To do so, disable service workers before terminating the IPC connection. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didBecomeUnresponsive): 2020-02-10 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r255875. rdar://problem/59298172 Regression(r248734) StorageAreaMap objects are getting leaked https://bugs.webkit.org/show_bug.cgi?id=207073 <rdar://problem/59168065> Reviewed by Darin Adler. Source/WebCore: Add test infrastructure for testing this change. Test: http/tests/storage/storage-map-leaking.html * storage/StorageNamespace.h: (WebCore::StorageNamespace::storageAreaMapCountForTesting const): * storage/StorageNamespaceProvider.h: * testing/Internals.cpp: (WebCore::Internals::storageAreaMapCount const): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: Make sure that StorageAreaMap objects are getting removed from the HashMap in StorageNamespaceImpl, once they no longer have any users. * WebProcess/WebStorage/StorageAreaImpl.cpp: (WebKit::StorageAreaImpl::StorageAreaImpl): (WebKit::StorageAreaImpl::~StorageAreaImpl): * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::StorageAreaMap::incrementUseCount): (WebKit::StorageAreaMap::decrementUseCount): * WebProcess/WebStorage/StorageAreaMap.h: * WebProcess/WebStorage/StorageNamespaceImpl.cpp: (WebKit::StorageNamespaceImpl::destroyStorageAreaMap): (WebKit::StorageNamespaceImpl::didDestroyStorageAreaMap): Deleted. * WebProcess/WebStorage/StorageNamespaceImpl.h: (WebKit::StorageNamespaceImpl::storageType const): Deleted. (WebKit::StorageNamespaceImpl::storageNamespaceID const): Deleted. (WebKit::StorageNamespaceImpl::topLevelOrigin const): Deleted. (WebKit::StorageNamespaceImpl::quotaInBytes const): Deleted. LayoutTests: Add layout test coverage. * TestExpectations: * http/tests/storage/resources/storage-map-leaking-iframe.html: Added. * http/tests/storage/storage-map-leaking-expected.txt: Added. * http/tests/storage/storage-map-leaking.html: Added. * platform/wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255875 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-05 Chris Dumez <cdumez@apple.com> Regression(r248734) StorageAreaMap objects are getting leaked https://bugs.webkit.org/show_bug.cgi?id=207073 <rdar://problem/59168065> Reviewed by Darin Adler. Make sure that StorageAreaMap objects are getting removed from the HashMap in StorageNamespaceImpl, once they no longer have any users. * WebProcess/WebStorage/StorageAreaImpl.cpp: (WebKit::StorageAreaImpl::StorageAreaImpl): (WebKit::StorageAreaImpl::~StorageAreaImpl): * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::StorageAreaMap::incrementUseCount): (WebKit::StorageAreaMap::decrementUseCount): * WebProcess/WebStorage/StorageAreaMap.h: * WebProcess/WebStorage/StorageNamespaceImpl.cpp: (WebKit::StorageNamespaceImpl::destroyStorageAreaMap): (WebKit::StorageNamespaceImpl::didDestroyStorageAreaMap): Deleted. * WebProcess/WebStorage/StorageNamespaceImpl.h: (WebKit::StorageNamespaceImpl::storageType const): Deleted. (WebKit::StorageNamespaceImpl::storageNamespaceID const): Deleted. (WebKit::StorageNamespaceImpl::topLevelOrigin const): Deleted. (WebKit::StorageNamespaceImpl::quotaInBytes const): Deleted. 2020-02-05 Russell Epstein <repstein@apple.com> Cherry-pick r254873. rdar://problem/59161343 Revert suppressesConnectionTerminationOnSystemChange part of r254081 https://bugs.webkit.org/show_bug.cgi?id=205751 <rdar://problem/58725096> There was an API client that still hadn't migrated to the replacement SPI. * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::suppressesConnectionTerminationOnSystemChange const): * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration suppressesConnectionTerminationOnSystemChange]): (-[_WKProcessPoolConfiguration setSuppressesConnectionTerminationOnSystemChange:]): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254873 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-21 Alex Christensen <achristensen@webkit.org> Revert suppressesConnectionTerminationOnSystemChange part of r254081 https://bugs.webkit.org/show_bug.cgi?id=205751 <rdar://problem/58725096> There was an API client that still hadn't migrated to the replacement SPI. * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::suppressesConnectionTerminationOnSystemChange const): * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration suppressesConnectionTerminationOnSystemChange]): (-[_WKProcessPoolConfiguration setSuppressesConnectionTerminationOnSystemChange:]): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): 2020-02-05 Russell Epstein <repstein@apple.com> Cherry-pick r254081. rdar://problem/59161343 Remove _WKProcessPoolConfiguration.CTDataConnectionServiceType and suppressesConnectionTerminationOnSystemChange https://bugs.webkit.org/show_bug.cgi?id=205751 Patch by Alex Christensen <achristensen@webkit.org> on 2020-01-06 Reviewed by Darin Adler. Their replacements on _WKWebViewConfiguration have been adopted. * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::suppressesConnectionTerminationOnSystemChange const): Deleted. * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::dataConnectionServiceType const): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): (WebKit::globalCTDataConnectionServiceType): Deleted. (WebKit::NetworkSessionCocoa::setCTDataConnectionServiceType): Deleted. * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration suppressesConnectionTerminationOnSystemChange]): Deleted. (-[_WKProcessPoolConfiguration setSuppressesConnectionTerminationOnSystemChange:]): Deleted. (-[_WKProcessPoolConfiguration CTDataConnectionServiceType]): Deleted. (-[_WKProcessPoolConfiguration setCTDataConnectionServiceType:]): Deleted. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254081 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-06 Alex Christensen <achristensen@webkit.org> Remove _WKProcessPoolConfiguration.CTDataConnectionServiceType and suppressesConnectionTerminationOnSystemChange https://bugs.webkit.org/show_bug.cgi?id=205751 Reviewed by Darin Adler. Their replacements on _WKWebViewConfiguration have been adopted. * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::suppressesConnectionTerminationOnSystemChange const): Deleted. * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::dataConnectionServiceType const): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): (WebKit::globalCTDataConnectionServiceType): Deleted. (WebKit::NetworkSessionCocoa::setCTDataConnectionServiceType): Deleted. * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration suppressesConnectionTerminationOnSystemChange]): Deleted. (-[_WKProcessPoolConfiguration setSuppressesConnectionTerminationOnSystemChange:]): Deleted. (-[_WKProcessPoolConfiguration CTDataConnectionServiceType]): Deleted. (-[_WKProcessPoolConfiguration setCTDataConnectionServiceType:]): Deleted. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType): 2020-02-05 Brent Fulgham <bfulgham@apple.com> Correct branch sandboxes. rdar://problem/59098315 * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-02-04 Russell Epstein <repstein@apple.com> Cherry-pick r255189. rdar://problem/58943054 Unreviewed, revert r253984 as it appears to be causing assertion leaks. https://bugs.webkit.org/show_bug.cgi?id=205687 Source/WebKit: * Configurations/WebKit.xcconfig: * Platform/spi/ios/RunningBoardServicesSPI.h: Removed. * Scripts/process-entitlements.sh: * Shared/DependencyProcessAssertion.cpp: Removed. * Shared/DependencyProcessAssertion.h: Removed. * Shared/NativeWebTouchEvent.h: * Shared/ios/DependencyProcessAssertionIOS.mm: Removed. * Sources.txt: * SourcesCocoa.txt: * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::processWasResumed): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeConnection): * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::processTaskStateDidChange): (WebKit::WebProcess::releaseProcessWasResumedAssertions): WebKitLibraries: * WebKitPrivateFrameworkStubs/iOS/13/RunningBoardServices.framework/RunningBoardServices.tbd: Removed. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255189 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-27 Chris Dumez <cdumez@apple.com> Unreviewed, revert r253984 as it appears to be causing assertion leaks. https://bugs.webkit.org/show_bug.cgi?id=205687 * Configurations/WebKit.xcconfig: * Platform/spi/ios/RunningBoardServicesSPI.h: Removed. * Scripts/process-entitlements.sh: * Shared/DependencyProcessAssertion.cpp: Removed. * Shared/DependencyProcessAssertion.h: Removed. * Shared/NativeWebTouchEvent.h: * Shared/ios/DependencyProcessAssertionIOS.mm: Removed. * Sources.txt: * SourcesCocoa.txt: * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::processWasResumed): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeConnection): * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::processTaskStateDidChange): (WebKit::WebProcess::releaseProcessWasResumedAssertions): 2020-02-04 Russell Epstein <repstein@apple.com> Cherry-pick r255428. rdar://problem/59097797 [iOS] Remove report rule for 'com.apple.runningboard' from the Network and GPU process sandboxes https://bugs.webkit.org/show_bug.cgi?id=206980 <rdar://problem/58900030> Reviewed by Maciej Stachowiak. Remove the logging now that we have useful backtraces. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255428 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-30 Brent Fulgham <bfulgham@apple.com> [iOS] Remove report rule for 'com.apple.runningboard' from the Network and GPU process sandboxes https://bugs.webkit.org/show_bug.cgi?id=206980 <rdar://problem/58900030> Reviewed by Maciej Stachowiak. Remove the logging now that we have useful backtraces. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: 2020-02-04 Russell Epstein <repstein@apple.com> Cherry-pick r255461. rdar://problem/59153618 Add WKNavigationDelegate SPI to disable TLS 1.0 and 1.1 https://bugs.webkit.org/show_bug.cgi?id=206979 Reviewed by Brady Eidson. Source/WebCore/PAL: * pal/spi/cf/CFNetworkSPI.h: Source/WebKit: * NetworkProcess/NetworkCORSPreflightChecker.cpp: (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge): * NetworkProcess/NetworkCORSPreflightChecker.h: * NetworkProcess/NetworkDataTask.h: * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::didReceiveChallenge): * NetworkProcess/NetworkLoad.h: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/PingLoad.cpp: (WebKit::PingLoad::didReceiveChallenge): * NetworkProcess/PingLoad.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::didReceiveChallenge): (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (processServerTrustEvaluation): (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): (WebKit::NetworkSessionCocoa::continueDidReceiveChallenge): * Shared/Authentication/AuthenticationManager.cpp: (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge): * Shared/Authentication/AuthenticationManager.h: * UIProcess/API/APINavigationClient.h: (API::NavigationClient::shouldAllowLegacyTLS): * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::setNavigationDelegate): (WebKit::systemAllowsLegacyTLSFor): (WebKit::NavigationState::NavigationClient::shouldAllowLegacyTLS): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: Source/WebKitLegacy/mac: * WebView/WebView.mm: (-[WebView _commonInitializationWithFrameName:groupName:]): Tools: * MiniBrowser/mac/SettingsController.m: * TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm: (-[TLSNavigationDelegate waitForDidFinishNavigation]): (-[TLSNavigationDelegate waitForDidFailProvisionalNavigation]): (-[TLSNavigationDelegate receivedShouldAllowLegacyTLS]): (-[TLSNavigationDelegate webView:didReceiveAuthenticationChallenge:completionHandler:]): (-[TLSNavigationDelegate webView:didFinishNavigation:]): (-[TLSNavigationDelegate webView:didFailProvisionalNavigation:withError:]): (-[TLSNavigationDelegate _webView:authenticationChallenge:shouldAllowLegacyTLS:]): (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255461 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-30 Alex Christensen <achristensen@webkit.org> Add WKNavigationDelegate SPI to disable TLS 1.0 and 1.1 https://bugs.webkit.org/show_bug.cgi?id=206979 Reviewed by Brady Eidson. * NetworkProcess/NetworkCORSPreflightChecker.cpp: (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge): * NetworkProcess/NetworkCORSPreflightChecker.h: * NetworkProcess/NetworkDataTask.h: * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::didReceiveChallenge): * NetworkProcess/NetworkLoad.h: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/PingLoad.cpp: (WebKit::PingLoad::didReceiveChallenge): * NetworkProcess/PingLoad.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::didReceiveChallenge): (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (processServerTrustEvaluation): (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): (WebKit::NetworkSessionCocoa::continueDidReceiveChallenge): * Shared/Authentication/AuthenticationManager.cpp: (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge): * Shared/Authentication/AuthenticationManager.h: * UIProcess/API/APINavigationClient.h: (API::NavigationClient::shouldAllowLegacyTLS): * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::setNavigationDelegate): (WebKit::systemAllowsLegacyTLSFor): (WebKit::NavigationState::NavigationClient::shouldAllowLegacyTLS): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: 2020-02-04 Russell Epstein <repstein@apple.com> Cherry-pick r255533. rdar://problem/59098565 REGRESSION(r252185): NetworkSessionCocoa cancels downloads that receive authentication challenges https://bugs.webkit.org/show_bug.cgi?id=206984 rdar://problem/58999654 Reviewed by Brady Eidson. Source/WebKit: r252185 changed the early return in WKNetworkSessionDelegate's -...task:didReceiveChallenge:... method from "cancel the task and return early if self has no _session" to "cancel the task and return early if we can't determine the network session for the given data task". When this method is called for an NSURLSessionDownloadTask, this early return is hit because there is no NetworkDataTaskCocoa for an active download. As a result, the download is canceled when it might have otherwise been able to proceed. Fix this by adding a code path to fetch the NetworkSession associated with the Download when an NSURLSessionDownloadTask receives an authentication challenge. This ensures we can actually handle the challenge appropriately and not just cancel the task. * NetworkProcess/Downloads/Download.h: (WebKit::Download::sessionID const): Expose the session ID so we can use it to look up the NetworkSession for a Download. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): Remove an unnecessary redeclaration of networkDataTask, and also an unneeded assertion that networkDataTask != nullptr. Even if this is the case, the code that eventually handles this task will null check it and handle the challenge as a websocket task or download task based on the taskIdentifier. Tools: Add an API test for a resumed download that receives an authentication challenge. The download delegate should be asked to handle the challenge, and the download should be able to finish. * TestWebKitAPI/Tests/WebKitCocoa/Download.mm: (-[DownloadCancelingDelegate _download:decideDestinationWithSuggestedFilename:completionHandler:]): (-[DownloadCancelingDelegate _download:didReceiveData:]): (-[DownloadCancelingDelegate _downloadDidCancel:]): (-[AuthenticationChallengeHandlingDelegate _download:didReceiveAuthenticationChallenge:completionHandler:]): (-[AuthenticationChallengeHandlingDelegate _downloadDidFinish:]): (TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255533 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-31 David Quesada <david_quesada@apple.com> REGRESSION(r252185): NetworkSessionCocoa cancels downloads that receive authentication challenges https://bugs.webkit.org/show_bug.cgi?id=206984 rdar://problem/58999654 Reviewed by Brady Eidson. r252185 changed the early return in WKNetworkSessionDelegate's -...task:didReceiveChallenge:... method from "cancel the task and return early if self has no _session" to "cancel the task and return early if we can't determine the network session for the given data task". When this method is called for an NSURLSessionDownloadTask, this early return is hit because there is no NetworkDataTaskCocoa for an active download. As a result, the download is canceled when it might have otherwise been able to proceed. Fix this by adding a code path to fetch the NetworkSession associated with the Download when an NSURLSessionDownloadTask receives an authentication challenge. This ensures we can actually handle the challenge appropriately and not just cancel the task. * NetworkProcess/Downloads/Download.h: (WebKit::Download::sessionID const): Expose the session ID so we can use it to look up the NetworkSession for a Download. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): Remove an unnecessary redeclaration of networkDataTask, and also an unneeded assertion that networkDataTask != nullptr. Even if this is the case, the code that eventually handles this task will null check it and handle the challenge as a websocket task or download task based on the taskIdentifier. 2020-02-04 Russell Epstein <repstein@apple.com> Cherry-pick r255507. rdar://problem/59098088 REGRESSION: [ iPadOS ] imported/w3c/web-platform-tests/dom/events/Event-dispatch-on-disabled-elements.html always fails <https://webkit.org/b/206759> <rdar://problem/58872607> Reviewed by Brent Fulgham. Source/WebKit: Test: imported/w3c/web-platform-tests/dom/events/Event-dispatch-on-disabled-elements.html * Platform/spi/ios/UIKitSPI.h: (-[UIViewController isPerformingModalTransition]): Add SPI declaration. Tools: * WebKitTestRunner/ios/UIScriptControllerIOS.h: (WTR::UIScriptControllerIOS::waitForModalTransitionToFinish const): - Add declaration. * WebKitTestRunner/ios/UIScriptControllerIOS.mm: (WTR::UIScriptControllerIOS::waitForModalTransitionToFinish const): - Implement by waiting for -[UIViewController isPerformingModalTransition] to return NO while spinning the runloop. (WTR::UIScriptControllerIOS::singleTapAtPointWithModifiers): - Call waitForModalTransitionToFinish() to fix the test. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255507 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-31 David Kilzer <ddkilzer@apple.com> REGRESSION: [ iPadOS ] imported/w3c/web-platform-tests/dom/events/Event-dispatch-on-disabled-elements.html always fails <https://webkit.org/b/206759> <rdar://problem/58872607> Reviewed by Brent Fulgham. Test: imported/w3c/web-platform-tests/dom/events/Event-dispatch-on-disabled-elements.html * Platform/spi/ios/UIKitSPI.h: (-[UIViewController isPerformingModalTransition]): Add SPI declaration. 2020-02-04 Russell Epstein <repstein@apple.com> Cherry-pick r255415. rdar://problem/59098091 REGRESSION (r255322): macCatalyst: Tapping in an input field doesn't change the selection location https://bugs.webkit.org/show_bug.cgi?id=206978 Reviewed by Wenson Hsieh. Source/WebCore: * page/ChromeClient.h: (WebCore::ChromeClient::shouldUseMouseEventForSelection): (WebCore::ChromeClient::shouldUseMouseEventsForSelection): Deleted. * page/EventHandler.cpp: (WebCore::EventHandler::canMouseDownStartSelect): (WebCore::EventHandler::handleMousePressEvent): * page/EventHandler.h: Plumb the event through to the ChromeClient so it can use it to make decisions. Source/WebKit: * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: (WebKit::WebChromeClient::shouldUseMouseEventForSelection): (WebKit::WebChromeClient::shouldUseMouseEventsForSelection): Deleted. Allow single-click events to change the selection; this is required in order to allow WebCore to set the selection in the case that the UITextInteraction gestures haven't yet been installed. Continue to not allow multi-click events to change the selection, because these are the ones that conflict with UIKit's behaviors. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255415 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-29 Tim Horton <timothy_horton@apple.com> REGRESSION (r255322): macCatalyst: Tapping in an input field doesn't change the selection location https://bugs.webkit.org/show_bug.cgi?id=206978 Reviewed by Wenson Hsieh. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: (WebKit::WebChromeClient::shouldUseMouseEventForSelection): (WebKit::WebChromeClient::shouldUseMouseEventsForSelection): Deleted. Allow single-click events to change the selection; this is required in order to allow WebCore to set the selection in the case that the UITextInteraction gestures haven't yet been installed. Continue to not allow multi-click events to change the selection, because these are the ones that conflict with UIKit's behaviors. 2020-02-04 Russell Epstein <repstein@apple.com> Cherry-pick r255322. rdar://problem/59097817 macCatalyst: Triple clicking to select a sentence results in an empty selection https://bugs.webkit.org/show_bug.cgi?id=206863 <rdar://problem/58776993> Reviewed by Wenson Hsieh. Source/WebCore: * editing/EditingBehavior.h: (WebCore::EditingBehavior::shouldSelectOnContextualMenuClick const): * page/ChromeClient.h: (WebCore::ChromeClient::shouldUseMouseEventsForSelection): * page/EventHandler.cpp: (WebCore::EventHandler::canMouseDownStartSelect): (WebCore::canMouseDownStartSelect): Deleted. * page/EventHandler.h: Disable WebCore's mouse-event-driven selection mechanisms on macCatalyst, where we use a UITextInteraction-driven selection instead. Otherwise, they conflict with each other in a chaotic fashion. Source/WebKit: * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _doAfterProcessingAllPendingMouseEvents:]): * UIProcess/API/mac/WKWebViewPrivateForTestingMac.h: * UIProcess/API/mac/WKWebViewTestingMac.mm: (-[WKWebView _doAfterProcessingAllPendingMouseEvents:]): Deleted. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::handleProcessSwapOrExit): (WebKit::WebViewImpl::doAfterProcessingAllPendingMouseEvents): Deleted. (WebKit::WebViewImpl::didFinishProcessingAllPendingMouseEvents): Deleted. (WebKit::WebViewImpl::flushPendingMouseEventCallbacks): Deleted. * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::doAfterProcessingAllPendingMouseEvents): (WebKit::WebPageProxy::didFinishProcessingAllPendingMouseEvents): (WebKit::WebPageProxy::flushPendingMouseEventCallbacks): * UIProcess/WebPageProxy.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::didFinishProcessingAllPendingMouseEvents): Deleted. Move "doAfterProcessingAllPendingMouseEvents" to WebPage instead of WebViewImpl, so it can be used on all platforms. Expose it via WKWebView. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: (WebKit::WebChromeClient::shouldUseMouseEventsForSelection): Tools: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKitCocoa/MacCatalystMouseSupport.mm: Added. (-[WKTestingEvent locationInView:]): (-[WKTestingEvent _setButtonMask:]): (-[WKTestingEvent _buttonMask]): (-[WKTestingTouch locationInView:]): (-[WKTestingTouch setTapCount:]): (-[WKTestingTouch tapCount]): (mouseGesture): (TEST): Add a test ensuring that simply plumbing mouse events to WebCore does not result in a selection change in macCatalyst (because UIKit will handle the selection change itself, instead). git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255322 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-28 Tim Horton <timothy_horton@apple.com> macCatalyst: Triple clicking to select a sentence results in an empty selection https://bugs.webkit.org/show_bug.cgi?id=206863 <rdar://problem/58776993> Reviewed by Wenson Hsieh. * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _doAfterProcessingAllPendingMouseEvents:]): * UIProcess/API/mac/WKWebViewPrivateForTestingMac.h: * UIProcess/API/mac/WKWebViewTestingMac.mm: (-[WKWebView _doAfterProcessingAllPendingMouseEvents:]): Deleted. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::handleProcessSwapOrExit): (WebKit::WebViewImpl::doAfterProcessingAllPendingMouseEvents): Deleted. (WebKit::WebViewImpl::didFinishProcessingAllPendingMouseEvents): Deleted. (WebKit::WebViewImpl::flushPendingMouseEventCallbacks): Deleted. * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::doAfterProcessingAllPendingMouseEvents): (WebKit::WebPageProxy::didFinishProcessingAllPendingMouseEvents): (WebKit::WebPageProxy::flushPendingMouseEventCallbacks): * UIProcess/WebPageProxy.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::didFinishProcessingAllPendingMouseEvents): Deleted. Move "doAfterProcessingAllPendingMouseEvents" to WebPage instead of WebViewImpl, so it can be used on all platforms. Expose it via WKWebView. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: (WebKit::WebChromeClient::shouldUseMouseEventsForSelection): 2020-02-04 Russell Epstein <repstein@apple.com> Cherry-pick r255234. rdar://problem/59098321 [Web Animations] Make Animation.timeline read-write only if a runtime flag is enabled https://bugs.webkit.org/show_bug.cgi?id=206173 <rdar://problem/58527432> Reviewed by Dean Jackson. Source/WebCore: Make the timeline property of Animation read-write only if the new WebAnimationsMutableTimelines runtime flag is enabled. * animation/WebAnimation.idl: Make the "timeline" property conditionally read-write if WebAnimationsMutableTimelines is enabled. * bindings/js/WebCoreBuiltinNames.h: With the new RuntimeConditionallyReadWrite property used in WebAnimation.idl, it is necessary to declare the name of the affected property, in this case "timeline", in WebCoreBuiltinNames. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setWebAnimationsMutableTimelinesEnabled): (WebCore::RuntimeEnabledFeatures::webAnimationsMutableTimelinesEnabled const): Source/WebKit: Add a new WebAnimationsMutableTimelines runtime flag. * Shared/WebPreferences.yaml: Source/WebKitLegacy/mac: Add a new WebAnimationsMutableTimelines runtime flag. * WebView/WebPreferenceKeysPrivate.h: * WebView/WebPreferences.mm: (-[WebPreferences webAnimationsMutableTimelinesEnabled]): (-[WebPreferences setWebAnimationsMutableTimelinesEnabled:]): * WebView/WebPreferencesPrivate.h: * WebView/WebView.mm: (-[WebView _preferencesChanged:]): Source/WebKitLegacy/win: Add a new WebAnimationsMutableTimelines runtime flag. * Interfaces/IWebPreferencesPrivate.idl: * WebPreferenceKeysPrivate.h: * WebPreferences.cpp: (WebPreferences::initializeDefaultSettings): (WebPreferences::setWebAnimationsMutableTimelinesEnabled): (WebPreferences::webAnimationsMutableTimelinesEnabled): * WebPreferences.h: * WebView.cpp: (WebView::notifyPreferencesChanged): Tools: Manually enable the new WebAnimationsMutableTimelines runtime flag in DumpRenderTree. * DumpRenderTree/mac/DumpRenderTree.mm: (enableExperimentalFeatures): * DumpRenderTree/win/DumpRenderTree.cpp: (enableExperimentalFeatures): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255234 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-27 Antoine Quint <graouts@apple.com> [Web Animations] Make Animation.timeline read-write only if a runtime flag is enabled https://bugs.webkit.org/show_bug.cgi?id=206173 <rdar://problem/58527432> Reviewed by Dean Jackson. Add a new WebAnimationsMutableTimelines runtime flag. * Shared/WebPreferences.yaml: 2020-02-03 Russell Epstein <repstein@apple.com> Cherry-pick r255375. rdar://problem/59097770 Crash under com.apple.WebKit.Networking at WebKit: WebKit::WebIDBServer::suspend https://bugs.webkit.org/show_bug.cgi?id=206904 <rdar://problem/58791603> Reviewed by Maciej Stachowiak. Wait until m_server is set in constructor of WebIDBServer to make sure m_server can be accessed in WebIDBServer::suspend. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::WebIDBServer): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255375 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-29 Sihui Liu <sihui_liu@apple.com> Crash under com.apple.WebKit.Networking at WebKit: WebKit::WebIDBServer::suspend https://bugs.webkit.org/show_bug.cgi?id=206904 <rdar://problem/58791603> Reviewed by Maciej Stachowiak. Wait until m_server is set in constructor of WebIDBServer to make sure m_server can be accessed in WebIDBServer::suspend. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::WebIDBServer): 2020-02-03 Russell Epstein <repstein@apple.com> Cherry-pick r255054. rdar://problem/58942727 [iOS] Support setting minimum effective device width during dynamic viewport size updates https://bugs.webkit.org/show_bug.cgi?id=206709 <rdar://problem/58713872> Reviewed by Tim Horton. Source/WebKit: Changes to minimum effective device width are currently always propagated to the web process via out-of-band updates to the web process. During animated resize, Safari currently changes the minimum effective device width prior to updating the view size; this causes the viewport configuration to temporarily be in a state where the new value for minimum effective device width is used, but the old viewport width and height are still used. This subsequently breaks existing logic in WebPage::dynamicViewportSizeUpdate that attempts to keep the portion of the unobscured content width that is visible consistent before and after rotation (see visibleHorizontalFraction), since that code will be mislead into believing that the wrong fraction of content width is visible. To fix this, we roll minimum effective device width changes along with view size (and other attributes) in dynamic viewport size updates. Test: WebKit.ChangeFrameAndMinimumEffectiveDeviceWidthDuringAnimatedResize * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _setViewScale:]): (-[WKWebView _setMinimumEffectiveDeviceWidth:]): During animated resize, just set m_minimumEffectiveDeviceWidth without notifying the web process; if the value changed during the update block, we send the new minimum effective device width to the web page as a part of the dynamic viewport size update. Also, make a drive-by adjustment to use `_page->viewLayoutSize()` instead of recomputing the active layout bounds when we know that only the minimum effective device width is changing. We also apply the same adjustment above, in -_setViewScale:. * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _beginAnimatedResizeWithUpdates:]): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::viewLayoutSize const): (WebKit::WebPageProxy::setMinimumEffectiveDeviceWidthWithoutViewportConfigurationUpdate): Add a helper method to update the minimum effective device width without updating the viewport configuration in the web process. This is only used when the minimum effective device width is specified in the middle of a dynamic viewport size update (i.e. animated resize). * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::dynamicViewportSizeUpdate): Plumb the new minimum effective device width over to the web process as a part of the dynamic viewport size update, and update both the new view size and minimum effective device width on the viewport configuration at the same time. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::dynamicViewportSizeUpdate): Tools: Adds a new API test that changes both the effective minimum device width and view size during animated resize. * TestWebKitAPI/Tests/WebKitCocoa/AnimatedResize.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255054 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-23 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Support setting minimum effective device width during dynamic viewport size updates https://bugs.webkit.org/show_bug.cgi?id=206709 <rdar://problem/58713872> Reviewed by Tim Horton. Changes to minimum effective device width are currently always propagated to the web process via out-of-band updates to the web process. During animated resize, Safari currently changes the minimum effective device width prior to updating the view size; this causes the viewport configuration to temporarily be in a state where the new value for minimum effective device width is used, but the old viewport width and height are still used. This subsequently breaks existing logic in WebPage::dynamicViewportSizeUpdate that attempts to keep the portion of the unobscured content width that is visible consistent before and after rotation (see visibleHorizontalFraction), since that code will be mislead into believing that the wrong fraction of content width is visible. To fix this, we roll minimum effective device width changes along with view size (and other attributes) in dynamic viewport size updates. Test: WebKit.ChangeFrameAndMinimumEffectiveDeviceWidthDuringAnimatedResize * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _setViewScale:]): (-[WKWebView _setMinimumEffectiveDeviceWidth:]): During animated resize, just set m_minimumEffectiveDeviceWidth without notifying the web process; if the value changed during the update block, we send the new minimum effective device width to the web page as a part of the dynamic viewport size update. Also, make a drive-by adjustment to use `_page->viewLayoutSize()` instead of recomputing the active layout bounds when we know that only the minimum effective device width is changing. We also apply the same adjustment above, in -_setViewScale:. * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _beginAnimatedResizeWithUpdates:]): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::viewLayoutSize const): (WebKit::WebPageProxy::setMinimumEffectiveDeviceWidthWithoutViewportConfigurationUpdate): Add a helper method to update the minimum effective device width without updating the viewport configuration in the web process. This is only used when the minimum effective device width is specified in the middle of a dynamic viewport size update (i.e. animated resize). * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::dynamicViewportSizeUpdate): Plumb the new minimum effective device width over to the web process as a part of the dynamic viewport size update, and update both the new view size and minimum effective device width on the viewport configuration at the same time. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::dynamicViewportSizeUpdate): 2020-02-03 Russell Epstein <repstein@apple.com> Cherry-pick r255532. rdar://problem/59098561 Add support for specifying background colors when setting marked text https://bugs.webkit.org/show_bug.cgi?id=207065 <rdar://problem/57876140> Reviewed by Tim Horton. Source/WebCore: Add support for rendering custom highlights (background colors) behind marked text in WebCore. To do this, we plumb a Vector of CompositionHighlights alongside the Vector of CompositionUnderlines to Editor. At paint time, we then consult this highlight data to determine which ranges of text in the composition should paint using custom background colors. Note that in the future, we should consider refactoring both composition underlines and highlights to use the MarkedText mechanism for decorating ranges of text instead. Test: editing/input/composition-highlights.html * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: * editing/CompositionHighlight.h: Added. (WebCore::CompositionHighlight::CompositionHighlight): (WebCore::CompositionHighlight::encode const): (WebCore::CompositionHighlight::decode): Add CompositionHighlight, which represents a range in the composition that should be highlighted with a given background color. * editing/Editor.cpp: (WebCore::Editor::clear): (WebCore::Editor::setComposition): Add logic for clearing and updating m_customCompositionHighlights. * editing/Editor.h: (WebCore::Editor::compositionUsesCustomHighlights const): (WebCore::Editor::customCompositionHighlights const): * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintCompositionBackground): If custom composition highlights are given, use those when painting the composition background; otherwise, default to painting the entire composition range using `Color::compositionFill`. Source/WebCore/PAL: Add an SPI soft-linking declaration for NSMarkedClauseSegmentAttributeName. * pal/spi/cocoa/NSAttributedStringSPI.h: Source/WebKit: Implement -setAttributedMarkedText:selectedRange: on WKContentView, and have it extract highlight color information from the given attributed string. Plumb this through to the web process by serializing and deserializing `WebCore::CompositionHighlight`s. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::setMarkedText): * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.mm: (compositionHighlights): For each marked text clause, grab the specified background color (defaulting to Color::compositionFill) and use it to create a list of CompositionHighlights. (-[WKContentView setAttributedMarkedText:selectedRange:]): (-[WKContentView setMarkedText:selectedRange:]): (-[WKContentView _setMarkedText:highlights:selectedRange:]): * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageSetComposition): Add testing support for specifying highlight ranges when setting marked text. * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: * WebProcess/WebCoreSupport/glib/WebEditorClientGLib.cpp: (WebKit::WebEditorClient::didDispatchInputMethodKeydown): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setCompositionForTesting): (WebKit::WebPage::setCompositionAsync): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Source/WebKitLegacy/mac: Adjust some call sites of Editor::setComposition(). * WebView/WebFrame.mm: (-[WebFrame setMarkedText:selectedRange:]): (-[WebFrame setMarkedText:forCandidates:]): * WebView/WebHTMLView.mm: (-[WebHTMLView setMarkedText:selectedRange:]): Source/WebKitLegacy/win: Adjust some call sites of Editor::setComposition(). * WebView.cpp: (WebView::onIMEComposition): (WebView::setCompositionForTesting): Tools: Add support in WebKitTestRunner for specifying a list of highlight ranges when setting marked text. This comes in the form of an additional argument to TextInputController::setMarkedText, which contains an array of objects, each describing one range (in the composition) to highlight. * DumpRenderTree/ios/TextInputControllerIOS.m: (+[TextInputController isSelectorExcludedFromWebScript:]): (+[TextInputController webScriptNameForSelector:]): (-[TextInputController setMarkedText:selectedFrom:length:suppressUnderline:highlights:]): (-[TextInputController setMarkedText:selectedFrom:length:suppressUnderline:]): Deleted. * DumpRenderTree/mac/TextInputControllerMac.m: (+[TextInputController isSelectorExcludedFromWebScript:]): (+[TextInputController webScriptNameForSelector:]): (-[TextInputController setMarkedText:selectedFrom:length:suppressUnderline:highlights:]): (-[TextInputController setMarkedText:selectedFrom:length:suppressUnderline:]): Deleted. * WebKitTestRunner/InjectedBundle/Bindings/TextInputController.idl: * WebKitTestRunner/InjectedBundle/TextInputController.cpp: (WTR::arrayLength): (WTR::createCompositionHighlightData): Add logic to convert a given JSObject containing the composition highlight information into a WKArrayRef, which is then passed into WebKit via WKBundlePageSetComposition. (WTR::TextInputController::setMarkedText): * WebKitTestRunner/InjectedBundle/TextInputController.h: LayoutTests: Add a test to check that highlighting different parts of a composition range results in the same behavior as applying background colors using CSS. This test is currently only supported in WebKit2. * TestExpectations: * editing/input/composition-highlights-expected.html: Added. * editing/input/composition-highlights.html: Added. * platform/wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255532 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-31 Wenson Hsieh <wenson_hsieh@apple.com> Add support for specifying background colors when setting marked text https://bugs.webkit.org/show_bug.cgi?id=207065 <rdar://problem/57876140> Reviewed by Tim Horton. Implement -setAttributedMarkedText:selectedRange: on WKContentView, and have it extract highlight color information from the given attributed string. Plumb this through to the web process by serializing and deserializing `WebCore::CompositionHighlight`s. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::setMarkedText): * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.mm: (compositionHighlights): For each marked text clause, grab the specified background color (defaulting to Color::compositionFill) and use it to create a list of CompositionHighlights. (-[WKContentView setAttributedMarkedText:selectedRange:]): (-[WKContentView setMarkedText:selectedRange:]): (-[WKContentView _setMarkedText:highlights:selectedRange:]): * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageSetComposition): Add testing support for specifying highlight ranges when setting marked text. * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: * WebProcess/WebCoreSupport/glib/WebEditorClientGLib.cpp: (WebKit::WebEditorClient::didDispatchInputMethodKeydown): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setCompositionForTesting): (WebKit::WebPage::setCompositionAsync): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-02-03 Russell Epstein <repstein@apple.com> Cherry-pick r255503. rdar://problem/59097793 REGRESSION (r251511): [iOS] HDR Playback broken https://bugs.webkit.org/show_bug.cgi?id=207052 <rdar://problem/58975614> Reviewed by Maciej Stachowiak. I missed an XPC service in Bug 203318 when I stopped importing the 'common.sb' sandbox. This broke some aspects of HDR playback for certain clients. This patch returns the XPC service, and unblocks access to a network preference file that AVFoundation needs to read to support some media playback features. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255503 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-31 Brent Fulgham <bfulgham@apple.com> REGRESSION (r251511): [iOS] HDR Playback broken https://bugs.webkit.org/show_bug.cgi?id=207052 <rdar://problem/58975614> Reviewed by Maciej Stachowiak. I missed an XPC service in Bug 203318 when I stopped importing the 'common.sb' sandbox. This broke some aspects of HDR playback for certain clients. This patch returns the XPC service, and unblocks access to a network preference file that AVFoundation needs to read to support some media playback features. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-02-03 Russell Epstein <repstein@apple.com> Cherry-pick r255466. rdar://problem/59097777 Unreviewed, another speculative test fix after r255041 Source/WebKit: * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::getAttestation const): Adds kSecAttrAccessible: kSecAttrAccessibleAfterFirstUnlock to secItem to bypass potential error due to screen locks. Tools: * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::TestController::addTestKeyToKeychain): Adds kSecAttrAccessible: kSecAttrAccessibleAfterFirstUnlock to secItem to bypass potential error due to screen locks. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255466 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-30 Jiewen Tan <jiewen_tan@apple.com> Unreviewed, another speculative test fix after r255041 * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::getAttestation const): Adds kSecAttrAccessible: kSecAttrAccessibleAfterFirstUnlock to secItem to bypass potential error due to screen locks. 2020-02-03 Russell Epstein <repstein@apple.com> Cherry-pick r255458. rdar://problem/59097790 Can still get stuck after swipe backwards with a slow server, even after r254552 https://bugs.webkit.org/show_bug.cgi?id=207017 <rdar://problem/59016256> Reviewed by Chris Dumez. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::unfreezeLayerTreeDueToSwipeAnimation): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: There's a second case where you can get stuck with the "swipe gesture" layer tree freeze reason in the web process: when doing a cross-origin navigation where the load takes more than 3 seconds (the swipe snapshot timeout) to commit, the provisional page will have mirrored the original page's frozen state upon creation, but will not ever receive the unfreeze, because it is sent while still provisional. To fix this, just forward the unfreeze message to the provisional page. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255458 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-30 Tim Horton <timothy_horton@apple.com> Can still get stuck after swipe backwards with a slow server, even after r254552 https://bugs.webkit.org/show_bug.cgi?id=207017 <rdar://problem/59016256> Reviewed by Chris Dumez. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::unfreezeLayerTreeDueToSwipeAnimation): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: There's a second case where you can get stuck with the "swipe gesture" layer tree freeze reason in the web process: when doing a cross-origin navigation where the load takes more than 3 seconds (the swipe snapshot timeout) to commit, the provisional page will have mirrored the original page's frozen state upon creation, but will not ever receive the unfreeze, because it is sent while still provisional. To fix this, just forward the unfreeze message to the provisional page. 2020-02-03 Russell Epstein <repstein@apple.com> Cherry-pick r255385. rdar://problem/59097758 [iPadOS] Select popovers on amazon.com sometimes dismiss immediately after appearing https://bugs.webkit.org/show_bug.cgi?id=206948 <rdar://problem/58954516> Reviewed by Tim Horton. Source/WebKit: Amazon adds active touchstart event listeners to their select elements, where they call preventDefault() and programmatically focus the select element. Doing so prevents clicks from being dispatched by allowing the web touch event gesture to recognize instead of the synthetic click gesture, which (inside -_singleTapRecognized:) would otherwise dismiss any currently presented popover. After making touchstart events dispatch asynchronously, preventing touchstart no longer causes other native gestures (such as the synthetic click gesture) to fail in the case where there is a sync touchmove or touchend event listener, and the touch gesture has ended before the touchstart handler has finished executing and told the UI process whether or not the touch was handled. This is because the touchend or touchmove is dispatched synchronously while the touchstart is still being processed; while the web page sees the correct order of events, the UI process will end up learning that the synchronous touch was handled before the response to the asynchronously dispatched touchstart event has arrived. Our current logic in the sync touch event dispatch case then unconditionally ends gesture deferral by calling `doneDeferringNativeGestures` with `handled` equal to whether or not the touch event (a "touchend", in this case) had been handled. However, in the case where touchstart event is prevented but the touchend event is not, this will cause us to prematurely stop deferring gestures even though the page called `preventDefault()` in the touchstart event handler, and allow the synthetic click gesture to recognize when it shouldn't. To fix this, keep deferring native gestures after handling a sync touch in the case where a touchstart event is still being handled; instead, remember whether the touch event was handled using a new member variable (`m_handledSynchronousTouchEventWhileDispatchingPreventableTouchStart`), and consult this when the response to the touchstart has been received in the UI process to determine whether platform gestures should be allowed to recognize. This variable is reset once we're done handling the touchstart. Test: fast/events/touch/ios/prevent-default-with-slow-touchstart-handler.html * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handlePreventableTouchEvent): * UIProcess/WebPageProxy.h: LayoutTests: Adds a new layout test to verify that preventing default on elements with slow, active touchstart event handlers actually prevents click events from being dispatched. * fast/events/touch/ios/prevent-default-with-slow-touchstart-handler-expected.txt: Added. * fast/events/touch/ios/prevent-default-with-slow-touchstart-handler.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255385 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-29 Wenson Hsieh <wenson_hsieh@apple.com> [iPadOS] Select popovers on amazon.com sometimes dismiss immediately after appearing https://bugs.webkit.org/show_bug.cgi?id=206948 <rdar://problem/58954516> Reviewed by Tim Horton. Amazon adds active touchstart event listeners to their select elements, where they call preventDefault() and programmatically focus the select element. Doing so prevents clicks from being dispatched by allowing the web touch event gesture to recognize instead of the synthetic click gesture, which (inside -_singleTapRecognized:) would otherwise dismiss any currently presented popover. After making touchstart events dispatch asynchronously, preventing touchstart no longer causes other native gestures (such as the synthetic click gesture) to fail in the case where there is a sync touchmove or touchend event listener, and the touch gesture has ended before the touchstart handler has finished executing and told the UI process whether or not the touch was handled. This is because the touchend or touchmove is dispatched synchronously while the touchstart is still being processed; while the web page sees the correct order of events, the UI process will end up learning that the synchronous touch was handled before the response to the asynchronously dispatched touchstart event has arrived. Our current logic in the sync touch event dispatch case then unconditionally ends gesture deferral by calling `doneDeferringNativeGestures` with `handled` equal to whether or not the touch event (a "touchend", in this case) had been handled. However, in the case where touchstart event is prevented but the touchend event is not, this will cause us to prematurely stop deferring gestures even though the page called `preventDefault()` in the touchstart event handler, and allow the synthetic click gesture to recognize when it shouldn't. To fix this, keep deferring native gestures after handling a sync touch in the case where a touchstart event is still being handled; instead, remember whether the touch event was handled using a new member variable (`m_handledSynchronousTouchEventWhileDispatchingPreventableTouchStart`), and consult this when the response to the touchstart has been received in the UI process to determine whether platform gestures should be allowed to recognize. This variable is reset once we're done handling the touchstart. Test: fast/events/touch/ios/prevent-default-with-slow-touchstart-handler.html * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handlePreventableTouchEvent): * UIProcess/WebPageProxy.h: 2020-02-03 Russell Epstein <repstein@apple.com> Cherry-pick r255378. rdar://problem/59097763 [iOS] Make sure unused service worker processes exit promptly on low memory warning https://bugs.webkit.org/show_bug.cgi?id=206939 <rdar://problem/58972717> Reviewed by Alex Christensen. Make sure unused service worker processes exit promptly on low memory warning. They normally take 10 seconds to exit for performance reasons. However, in case of memory pressure, keeping those processes around that long is not the right thing to do. Source/WebCore: * workers/service/server/SWServer.cpp: (WebCore::SWServer::handleLowMemoryWarning): * workers/service/server/SWServer.h: Source/WebKit: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::lowMemoryHandler): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255378 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-29 Chris Dumez <cdumez@apple.com> [iOS] Make sure unused service worker processes exit promptly on low memory warning https://bugs.webkit.org/show_bug.cgi?id=206939 <rdar://problem/58972717> Reviewed by Alex Christensen. Make sure unused service worker processes exit promptly on low memory warning. They normally take 10 seconds to exit for performance reasons. However, in case of memory pressure, keeping those processes around that long is not the right thing to do. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::lowMemoryHandler): 2020-02-03 Russell Epstein <repstein@apple.com> Cherry-pick r255376. rdar://problem/59097754 Unreviewed, fix Catalyst build after r255366 * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultDisallowSyncXHRDuringPageDismissalEnabled): * Shared/WebPreferencesDefaultValues.h: * Shared/ios/WebPreferencesDefaultValuesIOS.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255376 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-29 Chris Dumez <cdumez@apple.com> Unreviewed, fix Catalyst build after r255366 * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultDisallowSyncXHRDuringPageDismissalEnabled): * Shared/WebPreferencesDefaultValues.h: * Shared/ios/WebPreferencesDefaultValuesIOS.mm: 2020-02-03 Russell Epstein <repstein@apple.com> Cherry-pick r255366. rdar://problem/59097754 [iOS] Add managed preference to allow legacy sync XHRs during page dismissal https://bugs.webkit.org/show_bug.cgi?id=206944 <rdar://problem/58440111> Reviewed by Alex Christensen. Add managed preference for iOS to allow enterprise customers to keep using legacy sync XHRs during page dismissal. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultDisallowSyncXHRDuringPageDismissalEnabled): * Shared/WebPreferencesDefaultValues.h: * Shared/ios/WebPreferencesDefaultValuesIOS.mm: (WebKit::allowsDeprecatedSynchronousXMLHttpRequestDuringUnload): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255366 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-29 Chris Dumez <cdumez@apple.com> [iOS] Add managed preference to allow legacy sync XHRs during page dismissal https://bugs.webkit.org/show_bug.cgi?id=206944 <rdar://problem/58440111> Reviewed by Alex Christensen. Add managed preference for iOS to allow enterprise customers to keep using legacy sync XHRs during page dismissal. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultDisallowSyncXHRDuringPageDismissalEnabled): * Shared/WebPreferencesDefaultValues.h: * Shared/ios/WebPreferencesDefaultValuesIOS.mm: (WebKit::allowsDeprecatedSynchronousXMLHttpRequestDuringUnload): 2020-02-03 Russell Epstein <repstein@apple.com> Cherry-pick r255222. rdar://problem/59097766 Support observing a different set of view service state notifications in ApplicationStateTracker https://bugs.webkit.org/show_bug.cgi?id=201737 rdar://problem/54786414 Reviewed by Chris Dumez. * UIProcess/ApplicationStateTracker.mm: Make ApplicationStateTracker conditionally (based on a flag to be defined in WebKitAdditions) use a different pair of notifications when it is in a view service or extension. These notifications report state changes of the individual scene that hosts the web view, rather than the state of the overall host application. This allows for more accurate state tracking for web views in extensions or view services hosted by apps with multiple open scenes. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255222 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-27 David Quesada <david_quesada@apple.com> Support observing a different set of view service state notifications in ApplicationStateTracker https://bugs.webkit.org/show_bug.cgi?id=201737 rdar://problem/54786414 Reviewed by Chris Dumez. * UIProcess/ApplicationStateTracker.mm: Make ApplicationStateTracker conditionally (based on a flag to be defined in WebKitAdditions) use a different pair of notifications when it is in a view service or extension. These notifications report state changes of the individual scene that hosts the web view, rather than the state of the overall host application. This allows for more accurate state tracking for web views in extensions or view services hosted by apps with multiple open scenes. 2020-02-03 Russell Epstein <repstein@apple.com> Cherry-pick r255188. rdar://problem/59097777 Unreviewed, a build fix after r255111 * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: Adding some missing headers. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255188 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-27 Jiewen Tan <jiewen_tan@apple.com> Unreviewed, a build fix after r255111 * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: Adding some missing headers. 2020-02-03 Russell Epstein <repstein@apple.com> Cherry-pick r255111. rdar://problem/59097777 Unreviewed, a speculative test fix after r255041 * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::getAttestation const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255111 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-24 Jiewen Tan <jiewen_tan@apple.com> Unreviewed, a speculative test fix after r255041 * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::getAttestation const): 2020-02-03 Russell Epstein <repstein@apple.com> Cherry-pick r255058. rdar://problem/59097764 Make sure fetch tasks go to network if service worker never gets to activated https://bugs.webkit.org/show_bug.cgi?id=206648 Reviewed by Chris Dumez. Source/WebCore: In case worker context process crashes, the SWServerWorker gets set to NotRunning. If the SWServerWorker has pending activating completion handlers, they will never be called until the worker is destroyed. But the worker may never be destroyed until its registration is destroyed. This may trigger service worker fetch task hangs. To fix this, make sure to call activating completion handlers whenever the SWServerWorker state is changed to either Terminating or NotRunning. Covered by updated test. * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::~SWServerWorker): (WebCore::SWServerWorker::whenActivated): (WebCore::SWServerWorker::setState): * workers/service/server/SWServerWorker.h: Source/WebKit: In case activating completion handlers are not called, the fetch task timeout should kick in and make the load go to network process. The issue is that our code was using the context connection to do so. If the fetch task is waiting for the worker activation, the context connection might not be set and the timeout will be a no-op. To fix this, the fetch task will do as if its context is closed when the timeout fires. The fetck task now has a weak pointer to the WebSWServerConnection and will use to terminate the service worker as done previously. We no longer handle all ongoing fetch tasks of the ongoing service worker. Each individual fetch task timeout provides the same level of protection. The service worker will anyway get terminated which will race to finalize the service worker fetch tasks with each of their timeout. * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask): (WebKit::ServiceWorkerFetchTask::timeoutTimerFired): * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::createFetchTask): (WebKit::WebSWServerConnection::fetchTaskTimedOut): * NetworkProcess/ServiceWorker/WebSWServerConnection.h: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: (WebKit::WebSWServerToContextConnection::fetchTaskTimedOut): LayoutTests: * http/wpt/service-workers/service-worker-spinning-activate.https-expected.txt: * http/wpt/service-workers/service-worker-spinning-activate.https.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255058 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-24 youenn fablet <youenn@apple.com> Make sure fetch tasks go to network if service worker never gets to activated https://bugs.webkit.org/show_bug.cgi?id=206648 Reviewed by Chris Dumez. In case activating completion handlers are not called, the fetch task timeout should kick in and make the load go to network process. The issue is that our code was using the context connection to do so. If the fetch task is waiting for the worker activation, the context connection might not be set and the timeout will be a no-op. To fix this, the fetch task will do as if its context is closed when the timeout fires. The fetck task now has a weak pointer to the WebSWServerConnection and will use to terminate the service worker as done previously. We no longer handle all ongoing fetch tasks of the ongoing service worker. Each individual fetch task timeout provides the same level of protection. The service worker will anyway get terminated which will race to finalize the service worker fetch tasks with each of their timeout. * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask): (WebKit::ServiceWorkerFetchTask::timeoutTimerFired): * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::createFetchTask): (WebKit::WebSWServerConnection::fetchTaskTimedOut): * NetworkProcess/ServiceWorker/WebSWServerConnection.h: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: (WebKit::WebSWServerToContextConnection::fetchTaskTimedOut): 2020-02-03 Russell Epstein <repstein@apple.com> Cherry-pick r254381. rdar://problem/59097774 [iOS] Remove reporting for some well-understood sandbox rules https://bugs.webkit.org/show_bug.cgi?id=206111 Reviewed by Per Arne Vollan. Remove sandbox rules designed to generate reporting about resource use for some well-understood items that are frequently hit in WebKit use. No new tests. No change in behavior. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254381 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-10 Brent Fulgham <bfulgham@apple.com> [iOS] Remove reporting for some well-understood sandbox rules https://bugs.webkit.org/show_bug.cgi?id=206111 Reviewed by Per Arne Vollan. Remove sandbox rules designed to generate reporting about resource use for some well-understood items that are frequently hit in WebKit use. No new tests. No change in behavior. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-01-30 Alan Coon <alancoon@apple.com> Cherry-pick r255339. rdar://problem/58936679 Fix the build * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer touchesEnded:withEvent:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255339 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-28 Timothy Horton <timothy_horton@apple.com> Fix the build * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer touchesEnded:withEvent:]): 2020-01-30 Alan Coon <alancoon@apple.com> Cherry-pick r255337. rdar://problem/58936679 macCatalyst: Right clicking on a link follows it immediately https://bugs.webkit.org/show_bug.cgi?id=206919 <rdar://problem/58936679> Reviewed by Wenson Hsieh. Source/WebKit: * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer createMouseEventWithType:forEvent:]): (-[WKMouseGestureRecognizer touchesBegan:withEvent:]): (-[WKMouseGestureRecognizer touchesEnded:withEvent:]): UIKit's _buttonMask does not include the currently-released button, so in order to correctly identify the released button in touchesEnded, store the mask for the length of the click. Tools: * TestWebKitAPI/Tests/WebKitCocoa/MacCatalystMouseSupport.mm: (TEST): Add a test ensuring that mouseup is still called with the secondary button, even if the event's buttonmask is 0. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255337 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-28 Tim Horton <timothy_horton@apple.com> macCatalyst: Right clicking on a link follows it immediately https://bugs.webkit.org/show_bug.cgi?id=206919 <rdar://problem/58936679> Reviewed by Wenson Hsieh. * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer createMouseEventWithType:forEvent:]): (-[WKMouseGestureRecognizer touchesBegan:withEvent:]): (-[WKMouseGestureRecognizer touchesEnded:withEvent:]): UIKit's _buttonMask does not include the currently-released button, so in order to correctly identify the released button in touchesEnded, store the mask for the length of the click. 2020-01-27 Russell Epstein <repstein@apple.com> Cherry-pick r255114. rdar://problem/58920176 macCatalyst: Don't get any custom cursors in subframes https://bugs.webkit.org/show_bug.cgi?id=206781 <rdar://problem/58698374> Reviewed by Simon Fraser. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::positionInformation): Adjust the hit test to allow child frame content, and reorganize the rest of the code to use the hit frame instead of the main frame. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255114 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-24 Tim Horton <timothy_horton@apple.com> macCatalyst: Don't get any custom cursors in subframes https://bugs.webkit.org/show_bug.cgi?id=206781 <rdar://problem/58698374> Reviewed by Simon Fraser. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::positionInformation): Adjust the hit test to allow child frame content, and reorganize the rest of the code to use the hit frame instead of the main frame. 2020-01-27 Russell Epstein <repstein@apple.com> Cherry-pick r255108. rdar://problem/58920185 [iOS] Long pressing text inside a selection should update the selection https://bugs.webkit.org/show_bug.cgi?id=206769 <rdar://problem/58704316> Reviewed by Tim Horton. Source/WebCore: Remove `hasSelectionAtPosition`, which is no longer needed. * page/Page.cpp: (WebCore::Page::hasSelectionAtPosition const): Deleted. * page/Page.h: Source/WebKit: Makes it possible to update the selection using text interaction gestures inside an existing text selection. To do this, we remove code that was previously required in order to disambiguate text selection and drag gestures. However, since adopting asynchronous drag interaction SPI, this check has not been necessary. The only other purpose of this check was to avoid triggering text selection gestures after canceling a drag that did not begin (i.e. the touch location did not move). Instead of bailing in -textInteractionGestures: shouldBeginAtPoint: and -hasSelectablePositionAtPoint:, we can achieve the same effect by simply resetting the text interaction gestures when the drag lift begins (at which point we know the drag interaction is starting). This also ensures that on iPad, in the case where the drag was cancelled by the page, long pressing may still trigger text selection. Test: editing/selection/ios/select-text-in-existing-selection.html * Shared/ios/InteractionInformationAtPosition.h: * Shared/ios/InteractionInformationAtPosition.mm: (WebKit::InteractionInformationAtPosition::encode const): (WebKit::InteractionInformationAtPosition::decode): Remove the hasSelectionAtPosition flag from position information, since we no longer need it. * UIProcess/ios/WKContentViewInteraction.mm: (-[UIGestureRecognizer _wk_cancel]): Drive-by fix: just ignore the gesture if it is already disabled. This prevents us from causing a gesture recognizer that was previously disabled to become enabled as a result of calling -_wk_cancel. (-[WKContentView hasSelectablePositionAtPoint:]): (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): (-[WKContentView cancelActiveTextInteractionGestures]): Instead of making the text interaction gestures return NO from -gestureRecognizerShouldBegin:, explicitly cancel the text interaction gestures that may select text. (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::positionInformation): Remove the hasSelectionAtPosition flag from position information, since we no longer need it. LayoutTests: Add a layout test to verify that it's possible to select text by long pressing inside an existing text selection. The test is runnable on both iPad and iPhone, since it programmatically prevents `dragstart`. * editing/selection/ios/select-text-in-existing-selection-expected.txt: Added. * editing/selection/ios/select-text-in-existing-selection.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255108 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-24 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Long pressing text inside a selection should update the selection https://bugs.webkit.org/show_bug.cgi?id=206769 <rdar://problem/58704316> Reviewed by Tim Horton. Makes it possible to update the selection using text interaction gestures inside an existing text selection. To do this, we remove code that was previously required in order to disambiguate text selection and drag gestures. However, since adopting asynchronous drag interaction SPI, this check has not been necessary. The only other purpose of this check was to avoid triggering text selection gestures after canceling a drag that did not begin (i.e. the touch location did not move). Instead of bailing in -textInteractionGestures: shouldBeginAtPoint: and -hasSelectablePositionAtPoint:, we can achieve the same effect by simply resetting the text interaction gestures when the drag lift begins (at which point we know the drag interaction is starting). This also ensures that on iPad, in the case where the drag was cancelled by the page, long pressing may still trigger text selection. Test: editing/selection/ios/select-text-in-existing-selection.html * Shared/ios/InteractionInformationAtPosition.h: * Shared/ios/InteractionInformationAtPosition.mm: (WebKit::InteractionInformationAtPosition::encode const): (WebKit::InteractionInformationAtPosition::decode): Remove the hasSelectionAtPosition flag from position information, since we no longer need it. * UIProcess/ios/WKContentViewInteraction.mm: (-[UIGestureRecognizer _wk_cancel]): Drive-by fix: just ignore the gesture if it is already disabled. This prevents us from causing a gesture recognizer that was previously disabled to become enabled as a result of calling -_wk_cancel. (-[WKContentView hasSelectablePositionAtPoint:]): (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): (-[WKContentView cancelActiveTextInteractionGestures]): Instead of making the text interaction gestures return NO from -gestureRecognizerShouldBegin:, explicitly cancel the text interaction gestures that may select text. (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::positionInformation): Remove the hasSelectionAtPosition flag from position information, since we no longer need it. 2020-01-27 Russell Epstein <repstein@apple.com> Cherry-pick r255105. rdar://problem/58920180 macCatalyst: Right clicking on links follows the link, but shouldn't https://bugs.webkit.org/show_bug.cgi?id=206777 <rdar://problem/56586280> Reviewed by Wenson Hsieh. * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer createMouseEventWithType:forEvent:]): (-[WKMouseGestureRecognizer touchesEnded:withEvent:]): I got 'button' and 'buttons' backwards. 'button' indicates which button the event is about, so in MouseUp, it should still be 2. 'buttons' indicate which buttons are still down, so in MouseUp, it should not include 2. Since we don't currently track mouse button chording here, we'll just say "none". Leave a FIXME about that. This makes WebCore's behavior correct, and now it doesn't follow the link. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255105 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-24 Tim Horton <timothy_horton@apple.com> macCatalyst: Right clicking on links follows the link, but shouldn't https://bugs.webkit.org/show_bug.cgi?id=206777 <rdar://problem/56586280> Reviewed by Wenson Hsieh. * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer createMouseEventWithType:forEvent:]): (-[WKMouseGestureRecognizer touchesEnded:withEvent:]): I got 'button' and 'buttons' backwards. 'button' indicates which button the event is about, so in MouseUp, it should still be 2. 'buttons' indicate which buttons are still down, so in MouseUp, it should not include 2. Since we don't currently track mouse button chording here, we'll just say "none". Leave a FIXME about that. This makes WebCore's behavior correct, and now it doesn't follow the link. 2020-01-27 Russell Epstein <repstein@apple.com> Cherry-pick r255046. rdar://problem/58920204 macCatalyst: I-Beam is too conservative, doesn't show up in editable areas with no text https://bugs.webkit.org/show_bug.cgi?id=206716 <rdar://problem/58359523> Reviewed by Simon Fraser. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::lineCaretExtent): (WebKit::populateCaretContext): (WebKit::WebPage::positionInformation): Instead of uniting the caret position for the first and last position on the line to find the I-Beam region, use the bounds of the selection rect for the line, which extends beyond existing text, matching our traditional behavior of showing the I-Beam over blank regions. * editing/VisiblePosition.cpp: (WebCore::VisiblePosition::absoluteSelectionBoundsForLine const): * editing/VisiblePosition.h: Expose the bounds of the possible selection for the line that the given position belongs to. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255046 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-23 Tim Horton <timothy_horton@apple.com> macCatalyst: I-Beam is too conservative, doesn't show up in editable areas with no text https://bugs.webkit.org/show_bug.cgi?id=206716 <rdar://problem/58359523> Reviewed by Simon Fraser. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::lineCaretExtent): (WebKit::populateCaretContext): (WebKit::WebPage::positionInformation): Instead of uniting the caret position for the first and last position on the line to find the I-Beam region, use the bounds of the selection rect for the line, which extends beyond existing text, matching our traditional behavior of showing the I-Beam over blank regions. 2020-01-24 Russell Epstein <repstein@apple.com> Cherry-pick r255039. rdar://problem/58855996 Background thread with ITP Database should lock when the network process is suspended https://bugs.webkit.org/show_bug.cgi?id=206593 rdar://problem/58713379 Reviewed by Chris Dumez. This patch adds a function to hang the background queue when the NetworkProcess is preparing to suspend. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::suspend): (WebKit::WebResourceLoadStatisticsStore::resume): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::prepareToSuspend): (WebKit::NetworkProcess::resume): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255039 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-23 Kate Cheney <katherine_cheney@apple.com> Background thread with ITP Database should lock when the network process is suspended https://bugs.webkit.org/show_bug.cgi?id=206593 rdar://problem/58713379 Reviewed by Chris Dumez. This patch adds a function to hang the background queue when the NetworkProcess is preparing to suspend. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::suspend): (WebKit::WebResourceLoadStatisticsStore::resume): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::prepareToSuspend): (WebKit::NetworkProcess::resume): 2020-01-24 Russell Epstein <repstein@apple.com> Cherry-pick r254938. rdar://problem/58856028 Fix SDK availability macros https://bugs.webkit.org/show_bug.cgi?id=206463 <rdar://problem/58581906> Reviewed by Timothy Hatcher. Bug 197841 updated WebKit.xcconfig with regards to when it runs a header post-processing script. This post-processing script grovels over our exported headers, changing macros like WK_API_AVAILABLE to the standard API_AVAILABLE. Because of the change in Bug 197841, the script was no longer being run when preparing macOS 10.15 SDKs, which was breaking those SDKs. Fix this by reverting the change, allowing the macros to be replaced for macOS 10.15. We also need to touch WKFoundation.h in order to support incremental builds. If we don't, then the version of WKFoundation.h that was exported in the previous build and that was incorrectly post-processed would remain incorrectly post-processed. Touch the file so that it will get re-exported and re-post-processed. No new tests - no added or changed functionality. * Configurations/WebKit.xcconfig: * Shared/API/Cocoa/WKFoundation.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254938 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-22 Keith Rollin <krollin@apple.com> Fix SDK availability macros https://bugs.webkit.org/show_bug.cgi?id=206463 <rdar://problem/58581906> Reviewed by Timothy Hatcher. Bug 197841 updated WebKit.xcconfig with regards to when it runs a header post-processing script. This post-processing script grovels over our exported headers, changing macros like WK_API_AVAILABLE to the standard API_AVAILABLE. Because of the change in Bug 197841, the script was no longer being run when preparing macOS 10.15 SDKs, which was breaking those SDKs. Fix this by reverting the change, allowing the macros to be replaced for macOS 10.15. We also need to touch WKFoundation.h in order to support incremental builds. If we don't, then the version of WKFoundation.h that was exported in the previous build and that was incorrectly post-processed would remain incorrectly post-processed. Touch the file so that it will get re-exported and re-post-processed. No new tests - no added or changed functionality. * Configurations/WebKit.xcconfig: * Shared/API/Cocoa/WKFoundation.h: 2020-01-23 Russell Epstein <repstein@apple.com> Cherry-pick r254892. rdar://problem/58816313 [IPC Hardening] Only process Messages::NetworkProcess messages when sent by the UIProcess https://bugs.webkit.org/show_bug.cgi?id=206558 <rdar://problem/58733679> Reviewed by Alex Christensen. Port UpdateQuotaBasedOnSpaceUsageForTesting IPC from the NetworkProcess to the NetworkConnectionToWebProcess since it is sent by the WebContent process. As a result, we can now stop forwarding all Messages::NetworkProcess IPC messages from the WebContent process to the NetworkProcess class. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): (WebKit::NetworkConnectionToWebProcess::updateQuotaBasedOnSpaceUsageForTesting): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didReceiveMessage): (WebKit::NetworkProcess::didReceiveSyncMessage): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * Platform/IPC/StringReference.h: (IPC::StringReference::operator!=): * WebProcess/Cache/WebCacheStorageConnection.cpp: (WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254892 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-21 Chris Dumez <cdumez@apple.com> [IPC Hardening] Only process Messages::NetworkProcess messages when sent by the UIProcess https://bugs.webkit.org/show_bug.cgi?id=206558 <rdar://problem/58733679> Reviewed by Alex Christensen. Port UpdateQuotaBasedOnSpaceUsageForTesting IPC from the NetworkProcess to the NetworkConnectionToWebProcess since it is sent by the WebContent process. As a result, we can now stop forwarding all Messages::NetworkProcess IPC messages from the WebContent process to the NetworkProcess class. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): (WebKit::NetworkConnectionToWebProcess::updateQuotaBasedOnSpaceUsageForTesting): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didReceiveMessage): (WebKit::NetworkProcess::didReceiveSyncMessage): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * Platform/IPC/StringReference.h: (IPC::StringReference::operator!=): * WebProcess/Cache/WebCacheStorageConnection.cpp: (WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage): 2020-01-23 Russell Epstein <repstein@apple.com> Cherry-pick r254884. rdar://problem/58807972 ProvisionalPageProxy::loadData should pass last navigation's shouldOpenExternalURLsPolicy flag to WebPageProxy https://bugs.webkit.org/show_bug.cgi?id=206462 <rdar://problem/57468718> Reviewed by Chris Dumez. Source/WebKit: Covered by API tests. This patch also does it for ProvisionalPageProxy::loadRequest. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::loadData): (WebKit::ProvisionalPageProxy::loadRequest): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::continueNavigationInNewProcess): Tools: * TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm: (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254884 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-21 Jiewen Tan <jiewen_tan@apple.com> ProvisionalPageProxy::loadData should pass last navigation's shouldOpenExternalURLsPolicy flag to WebPageProxy https://bugs.webkit.org/show_bug.cgi?id=206462 <rdar://problem/57468718> Reviewed by Chris Dumez. Covered by API tests. This patch also does it for ProvisionalPageProxy::loadRequest. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::loadData): (WebKit::ProvisionalPageProxy::loadRequest): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::continueNavigationInNewProcess): 2020-01-23 Russell Epstein <repstein@apple.com> Cherry-pick r254880. rdar://problem/58816328 [macOS] Add managed preference to allow synchronous XHR during page dismissal https://bugs.webkit.org/show_bug.cgi?id=206540 <rdar://problem/58644447> Reviewed by Alex Christensen. Add managed preference to allow synchronous XHR during page dismissal. This is temporarily needed by some enterprise products until they can update their code. * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultDisallowSyncXHRDuringPageDismissalEnabled): * Shared/WebPreferencesDefaultValues.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254880 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-21 Chris Dumez <cdumez@apple.com> [macOS] Add managed preference to allow synchronous XHR during page dismissal https://bugs.webkit.org/show_bug.cgi?id=206540 <rdar://problem/58644447> Reviewed by Alex Christensen. Add managed preference to allow synchronous XHR during page dismissal. This is temporarily needed by some enterprise products until they can update their code. * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultDisallowSyncXHRDuringPageDismissalEnabled): * Shared/WebPreferencesDefaultValues.h: 2020-01-23 Russell Epstein <repstein@apple.com> Cherry-pick r254874. rdar://problem/58816330 macCatalyst: Two-finger click is dispatched to DOM as left click https://bugs.webkit.org/show_bug.cgi?id=206549 Reviewed by Simon Fraser. * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer createMouseEventWithType:forEvent:]): (-[WKMouseGestureRecognizer touchesBegan:withEvent:]): (-[WKMouseGestureRecognizer touchesMoved:withEvent:]): (-[WKMouseGestureRecognizer touchesEnded:withEvent:]): (-[WKMouseGestureRecognizer _hoverEntered:withEvent:]): (-[WKMouseGestureRecognizer _hoverMoved:withEvent:]): (-[WKMouseGestureRecognizer _hoverExited:withEvent:]): (-[WKMouseGestureRecognizer createMouseEventWithType:]): Deleted. We correctly say button=2 for ctrl-click, but not for secondary-button click. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254874 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-21 Tim Horton <timothy_horton@apple.com> macCatalyst: Two-finger click is dispatched to DOM as left click https://bugs.webkit.org/show_bug.cgi?id=206549 Reviewed by Simon Fraser. * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer createMouseEventWithType:forEvent:]): (-[WKMouseGestureRecognizer touchesBegan:withEvent:]): (-[WKMouseGestureRecognizer touchesMoved:withEvent:]): (-[WKMouseGestureRecognizer touchesEnded:withEvent:]): (-[WKMouseGestureRecognizer _hoverEntered:withEvent:]): (-[WKMouseGestureRecognizer _hoverMoved:withEvent:]): (-[WKMouseGestureRecognizer _hoverExited:withEvent:]): (-[WKMouseGestureRecognizer createMouseEventWithType:]): Deleted. We correctly say button=2 for ctrl-click, but not for secondary-button click. 2020-01-23 Russell Epstein <repstein@apple.com> Cherry-pick r254711. rdar://problem/58816343 Regression(r253224) No longer able to prevent a tab from closing via the beforeunload prompt https://bugs.webkit.org/show_bug.cgi?id=206366 <rdar://problem/58537467> Reviewed by Geoffrey Garen. Source/WebKit: Change is covered by new API test. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _tryClose]): (-[WKWebView _isClosed]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: Add new _tryClose / _isClosed SPI on WKWebView in order to write an API test to cover the change. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): In WebPageProxy::tryClose(), we start a timer before sending the TryClose async IPC to the WebProcess. We would then stop the timer when receiving the response to the TryClose IPC. If the timer fires, we would forcefully close the page. The issue was that before answering the TryClose IPC, the WebContent process would send a sync RunBeforeUnloadConfirmPanel IPC to the UIProcess to show the confirmation prompt, and this would fail to stop the timer. WebPageProxy::runBeforeUnloadConfirmPanel() would spin a nested run loop to show the prompt and we would time out while showing the prompt. Tools: tryClose_timeout_fix * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKit/beforeunload.html: Added. * TestWebKitAPI/Tests/WebKitCocoa/ModalAlerts.mm: (-[SlowBeforeUnloadPromptUIDelegate _webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:completionHandler:]): (-[SlowBeforeUnloadPromptUIDelegate webViewDidClose:]): (TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254711 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-16 Chris Dumez <cdumez@apple.com> Regression(r253224) No longer able to prevent a tab from closing via the beforeunload prompt https://bugs.webkit.org/show_bug.cgi?id=206366 <rdar://problem/58537467> Reviewed by Geoffrey Garen. Change is covered by new API test. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _tryClose]): (-[WKWebView _isClosed]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: Add new _tryClose / _isClosed SPI on WKWebView in order to write an API test to cover the change. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): In WebPageProxy::tryClose(), we start a timer before sending the TryClose async IPC to the WebProcess. We would then stop the timer when receiving the response to the TryClose IPC. If the timer fires, we would forcefully close the page. The issue was that before answering the TryClose IPC, the WebContent process would send a sync RunBeforeUnloadConfirmPanel IPC to the UIProcess to show the confirmation prompt, and this would fail to stop the timer. WebPageProxy::runBeforeUnloadConfirmPanel() would spin a nested run loop to show the prompt and we would time out while showing the prompt. 2020-01-23 Russell Epstein <repstein@apple.com> Cherry-pick r254706. rdar://problem/58811361 Add finite timeout when synchronously terminating a service worker https://bugs.webkit.org/show_bug.cgi?id=206325 <rdar://problem/58183380> Patch by Alex Christensen <achristensen@webkit.org> on 2020-01-16 Reviewed by Youenn Fablet. When this message reply is never received, it hangs everything. If we haven't received verification that a service worker was terminated in 10 seconds, unhang everything and tell the UI process to terminate the hanging service worker process. Continue handling messages during these 10 seconds to hopefully turn a bad hang into no perceptible hang. * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: (WebKit::WebSWServerToContextConnection::syncTerminateWorker): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254706 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-16 Alex Christensen <achristensen@webkit.org> Add finite timeout when synchronously terminating a service worker https://bugs.webkit.org/show_bug.cgi?id=206325 <rdar://problem/58183380> Reviewed by Youenn Fablet. When this message reply is never received, it hangs everything. If we haven't received verification that a service worker was terminated in 10 seconds, unhang everything and tell the UI process to terminate the hanging service worker process. Continue handling messages during these 10 seconds to hopefully turn a bad hang into no perceptible hang. * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: (WebKit::WebSWServerToContextConnection::syncTerminateWorker): 2020-01-23 Russell Epstein <repstein@apple.com> Cherry-pick r254552. rdar://problem/58812968 REGRESSION (r253394): After swiping back during a navigation, WKWebView gets stuck with the forward content, stops repainting https://bugs.webkit.org/show_bug.cgi?id=206268 <rdar://problem/58536702> Reviewed by Simon Fraser. * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::endSwipeGesture): * UIProcess/ViewGestureController.h: * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::beginSwipeGesture): (WebKit::ViewGestureController::endSwipeGesture): (WebKit::ViewGestureController::removeSwipeSnapshot): * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::beginSwipeGesture): (WebKit::ViewGestureController::removeSwipeSnapshot): After r253394, we start loading the destination page in willEndSwipeGesture, when we know the gesture will complete, instead of in endSwipeGesture, when it is actually done. This means that if we decide that we should tear down the snapshot immediately, this can now happen in the window between willEndSwipeGesture and endSwipeGesture. However, removeSwipeSnapshot has numerous dependencies on endSwipeGesture (especially on iOS, where there are /also/ dependencies in the other direction - endSwipeGesture will never be called after removeSwipeSnapshot because of the gestureID mismatch). Regardless, it does not make sense to remove the snapshot while the animation is still running. So, if something causes removeSwipeSnapshot to be called before endSwipeGesture, we just set a bit and call it inside endSwipeGesture instead. This ends up putting the snapshot removal ordering back as it was before r253394. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254552 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-14 Tim Horton <timothy_horton@apple.com> REGRESSION (r253394): After swiping back during a navigation, WKWebView gets stuck with the forward content, stops repainting https://bugs.webkit.org/show_bug.cgi?id=206268 <rdar://problem/58536702> Reviewed by Simon Fraser. * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::endSwipeGesture): * UIProcess/ViewGestureController.h: * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::beginSwipeGesture): (WebKit::ViewGestureController::endSwipeGesture): (WebKit::ViewGestureController::removeSwipeSnapshot): * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::beginSwipeGesture): (WebKit::ViewGestureController::removeSwipeSnapshot): After r253394, we start loading the destination page in willEndSwipeGesture, when we know the gesture will complete, instead of in endSwipeGesture, when it is actually done. This means that if we decide that we should tear down the snapshot immediately, this can now happen in the window between willEndSwipeGesture and endSwipeGesture. However, removeSwipeSnapshot has numerous dependencies on endSwipeGesture (especially on iOS, where there are /also/ dependencies in the other direction - endSwipeGesture will never be called after removeSwipeSnapshot because of the gestureID mismatch). Regardless, it does not make sense to remove the snapshot while the animation is still running. So, if something causes removeSwipeSnapshot to be called before endSwipeGesture, we just set a bit and call it inside endSwipeGesture instead. This ends up putting the snapshot removal ordering back as it was before r253394. 2020-01-23 Russell Epstein <repstein@apple.com> Cherry-pick r254550. rdar://problem/58812988 REGRESSION(iOS 13): createMediaElementSource not working https://bugs.webkit.org/show_bug.cgi?id=203435 Reviewed by David Kilzer. The WebContent process is missing an entitlement according to logs. * Scripts/process-entitlements.sh: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254550 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-14 Per Arne Vollan <pvollan@apple.com> REGRESSION(iOS 13): createMediaElementSource not working https://bugs.webkit.org/show_bug.cgi?id=203435 Reviewed by David Kilzer. The WebContent process is missing an entitlement according to logs. * Scripts/process-entitlements.sh: 2020-01-23 Russell Epstein <repstein@apple.com> Cherry-pick r254487. rdar://problem/58606185 Reformat WebProcessPool logging https://bugs.webkit.org/show_bug.cgi?id=205882 <rdar://problem/58384349> Reviewed by Brent Fulgham. Update the format used by WebProcessPool in its RELEASE_LOG logging. Use the format used by WebPageProxy and NetworkResourceLoader, which is generally of the form: <object-address> - [<values that help thread together operations>] <class>::<method>: <message and other useful values> So, for example: Using prewarmed process 0 becomes: 0x7f81e8804008 - WebProcessPool::processForRegistrableDomain: Using prewarmed process (process=0x1471c2a00, PID=64197) No new tests - no added or changed functionality. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::applicationIsAboutToSuspend): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess): (WebKit::WebProcessPool::tryTakePrewarmedProcess): (WebKit::WebProcessPool::prewarmProcess): (WebKit::WebProcessPool::processForRegistrableDomain): (WebKit::WebProcessPool::didReachGoodTimeToPrewarm): (WebKit::WebProcessPool::handleMemoryPressureWarning): (WebKit::WebProcessPool::processForNavigation): (WebKit::WebProcessPool::processForNavigationInternal): (WebKit::WebProcessPool::setWebProcessHasUploads): (WebKit::WebProcessPool::clearWebProcessHasUploads): (WebKit::WebProcessPool::setWebProcessIsPlayingAudibleMedia): (WebKit::WebProcessPool::clearWebProcessIsPlayingAudibleMedia): (WebKit::WebProcessPool::setUseSeparateServiceWorkerProcess): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254487 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-13 Keith Rollin <krollin@apple.com> Reformat WebProcessPool logging https://bugs.webkit.org/show_bug.cgi?id=205882 <rdar://problem/58384349> Reviewed by Brent Fulgham. Update the format used by WebProcessPool in its RELEASE_LOG logging. Use the format used by WebPageProxy and NetworkResourceLoader, which is generally of the form: <object-address> - [<values that help thread together operations>] <class>::<method>: <message and other useful values> So, for example: Using prewarmed process 0 becomes: 0x7f81e8804008 - WebProcessPool::processForRegistrableDomain: Using prewarmed process (process=0x1471c2a00, PID=64197) No new tests - no added or changed functionality. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::applicationIsAboutToSuspend): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess): (WebKit::WebProcessPool::tryTakePrewarmedProcess): (WebKit::WebProcessPool::prewarmProcess): (WebKit::WebProcessPool::processForRegistrableDomain): (WebKit::WebProcessPool::didReachGoodTimeToPrewarm): (WebKit::WebProcessPool::handleMemoryPressureWarning): (WebKit::WebProcessPool::processForNavigation): (WebKit::WebProcessPool::processForNavigationInternal): (WebKit::WebProcessPool::setWebProcessHasUploads): (WebKit::WebProcessPool::clearWebProcessHasUploads): (WebKit::WebProcessPool::setWebProcessIsPlayingAudibleMedia): (WebKit::WebProcessPool::clearWebProcessIsPlayingAudibleMedia): (WebKit::WebProcessPool::setUseSeparateServiceWorkerProcess): 2020-01-23 Russell Epstein <repstein@apple.com> Cherry-pick r254296. rdar://problem/58606275 Resource Load Statistics: Add timing information to WebPageProxy::logFrameNavigation() to detect delayed client-side redirects https://bugs.webkit.org/show_bug.cgi?id=205522 <rdar://problem/58125759> Reviewed by Chris Dumez. Source/WebKit: The purpose of this patch is to capture navigations that happen programmatically after the document has loaded. These are delayed redirects and should be counted as redirects in ITP. To achieve this, a timestamp is captured in WebPageProxy::didFinishDocumentLoadForFrame() to be able to calculate how much time has passed since that timestamp in the IPC sent from WebPageProxy::logFrameNavigation(). The IPC also gets information on whether userInitiatedActivity exists so that ITP can decide whether to treat the navigation as triggered by the user or not. A new test was added and existing test expectations were updated. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation): Now takes the extra parameters delayAfterMainFrameDocumentLoad and wasPotentiallyInitiatedByUser. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation): Now takes the extra parameters delayAfterMainFrameDocumentLoad and wasPotentiallyInitiatedByUser. * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation): Now takes the extra parameters delayAfterMainFrameDocumentLoad and wasPotentiallyInitiatedByUser. The deleted WebResourceLoadStatisticsStore::logFrameNavigation() was dead code. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::logFrameNavigation): Now takes the extra parameters delayAfterMainFrameDocumentLoad and wasPotentiallyInitiatedByUser. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _resourceLoadStatisticsSetShouldSubmitTelemetry:]): Deleted. Dead code. * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): Now captures a timestamp. (WebKit::WebPageProxy::decidePolicyForNavigationAction): Removed dead code. (WebKit::WebPageProxy::logFrameNavigation): Now sends the diff between now and the timestamp captured in WebPageProxy::didFinishDocumentLoadForFrame(). * UIProcess/WebPageProxy.h: * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::platformInitialize): Removed dead code. (WebKit::WebsiteDataStore::platformDestroy): Removed dead code. * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::resourceLoadStatistics const): Deleted. Dead code. Tools: * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::initializeWebViewConfiguration): Removed dead code. LayoutTests: Results updated with additional data now that delayed redirects are captured. * http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-database-expected.txt: * http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-expected.txt: * http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-database-expected.txt: Added. * http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-database.html: Added. * http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-expected.txt: Added. * http/tests/resourceLoadStatistics/log-delayed-client-side-redirects.html: Added. * http/tests/storageAccess/aggregate-sorted-data-with-storage-access-database-expected.txt: * http/tests/storageAccess/aggregate-sorted-data-with-storage-access-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254296 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-09 John Wilander <wilander@apple.com> Resource Load Statistics: Add timing information to WebPageProxy::logFrameNavigation() to detect delayed client-side redirects https://bugs.webkit.org/show_bug.cgi?id=205522 <rdar://problem/58125759> Reviewed by Chris Dumez. The purpose of this patch is to capture navigations that happen programmatically after the document has loaded. These are delayed redirects and should be counted as redirects in ITP. To achieve this, a timestamp is captured in WebPageProxy::didFinishDocumentLoadForFrame() to be able to calculate how much time has passed since that timestamp in the IPC sent from WebPageProxy::logFrameNavigation(). The IPC also gets information on whether userInitiatedActivity exists so that ITP can decide whether to treat the navigation as triggered by the user or not. A new test was added and existing test expectations were updated. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation): Now takes the extra parameters delayAfterMainFrameDocumentLoad and wasPotentiallyInitiatedByUser. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation): Now takes the extra parameters delayAfterMainFrameDocumentLoad and wasPotentiallyInitiatedByUser. * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation): Now takes the extra parameters delayAfterMainFrameDocumentLoad and wasPotentiallyInitiatedByUser. The deleted WebResourceLoadStatisticsStore::logFrameNavigation() was dead code. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::logFrameNavigation): Now takes the extra parameters delayAfterMainFrameDocumentLoad and wasPotentiallyInitiatedByUser. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _resourceLoadStatisticsSetShouldSubmitTelemetry:]): Deleted. Dead code. * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): Now captures a timestamp. (WebKit::WebPageProxy::decidePolicyForNavigationAction): Removed dead code. (WebKit::WebPageProxy::logFrameNavigation): Now sends the diff between now and the timestamp captured in WebPageProxy::didFinishDocumentLoadForFrame(). * UIProcess/WebPageProxy.h: * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::platformInitialize): Removed dead code. (WebKit::WebsiteDataStore::platformDestroy): Removed dead code. * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::resourceLoadStatistics const): Deleted. Dead code. 2020-01-21 Alan Coon <alancoon@apple.com> Cherry-pick r254125. rdar://problem/58353217 Fix non GPUProcess build issue in UserMediaCaptureManager https://bugs.webkit.org/show_bug.cgi?id=205851 Reviewed by Eric Carlson. Build fix, no change of behavior. * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::Source::connection): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254125 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-07 youenn fablet <youenn@apple.com> Fix non GPUProcess build issue in UserMediaCaptureManager https://bugs.webkit.org/show_bug.cgi?id=205851 Reviewed by Eric Carlson. Build fix, no change of behavior. * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::Source::connection): 2020-01-17 Alan Coon <alancoon@apple.com> Cherry-pick r254433. rdar://problem/58686757 [macCatalyst] UI process crashes on launch after r254101 https://bugs.webkit.org/show_bug.cgi?id=206156 <rdar://problem/58514942> Reviewed by Brent Fulgham. Fixes the crash by not soft-linking BackBoardServices in an attempt to invoke BKSDisplayBrightnessGetCurrent on macCatalyst. Prior to r254101, this was only defined on iOS and not watchOS or tvOS; after this change, it should be defined only on iOS, watchOS and tvOS. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::registerNotificationObservers): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): * UIProcess/WebProcessPool.h: * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254433 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-12 Wenson Hsieh <wenson_hsieh@apple.com> [macCatalyst] UI process crashes on launch after r254101 https://bugs.webkit.org/show_bug.cgi?id=206156 <rdar://problem/58514942> Reviewed by Brent Fulgham. Fixes the crash by not soft-linking BackBoardServices in an attempt to invoke BKSDisplayBrightnessGetCurrent on macCatalyst. Prior to r254101, this was only defined on iOS and not watchOS or tvOS; after this change, it should be defined only on iOS, watchOS and tvOS. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::registerNotificationObservers): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): * UIProcess/WebProcessPool.h: * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: 2020-01-15 Alan Coon <alancoon@apple.com> Cherry-pick r254187. rdar://problem/58605950 Implement css3-images image-orientation https://bugs.webkit.org/show_bug.cgi?id=89052 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2020-01-07 Reviewed by Simon Fraser. LayoutTests/imported/w3c: * web-platform-tests/css/css-images/inheritance-expected.txt: * web-platform-tests/css/css-images/inheritance.html: This test is re-synced from upstream * web-platform-tests/css/css-images/parsing/image-orientation-computed-expected.txt: * web-platform-tests/css/css-images/parsing/image-orientation-valid-expected.txt: Source/JavaScriptCore: Remove the ENABLE_CSS_IMAGE_ORIENTATION feature flag. * Configurations/FeatureDefines.xcconfig: Source/WebCore: Implement the CSS image-orientation property for content images. The valid values are "from-image" or "none". The default value is "from-image". Specification: https://drafts.csswg.org/css-images-3/#the-image-orientation GitHub issue: https://github.com/w3c/csswg-drafts/issues/4164 Tests: fast/images/image-orientation-dynamic-from-image.html fast/images/image-orientation-dynamic-none.html fast/images/image-orientation-none.html * Configurations/FeatureDefines.xcconfig: * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::operator ImageOrientation const): Deleted. * css/CSSProperties.json: * css/CSSValueKeywords.in: * css/parser/CSSPropertyParser.cpp: (WebCore::consumeImageOrientation): (WebCore::CSSPropertyParser::parseSingleValue): * rendering/RenderElement.cpp: (WebCore::RenderElement::imageOrientation const): * rendering/RenderImage.cpp: (WebCore::RenderImage::styleDidChange): * rendering/style/RenderStyle.cpp: (WebCore::rareInheritedDataChangeRequiresLayout): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::setImageOrientation): (WebCore::RenderStyle::initialImageOrientation): (WebCore::RenderStyle::imageOrientation const): * rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): (WebCore::StyleRareInheritedData::operator== const): * rendering/style/StyleRareInheritedData.h: * style/StyleBuilderConverter.h: (WebCore::Style::BuilderConverter::convertImageOrientation): Source/WebCore/PAL: Remove the ENABLE_CSS_IMAGE_ORIENTATION feature flag. * Configurations/FeatureDefines.xcconfig: Source/WebKit: Remove the ENABLE_CSS_IMAGE_ORIENTATION feature flag. * Configurations/FeatureDefines.xcconfig: Source/WebKitLegacy/mac: Remove the ENABLE_CSS_IMAGE_ORIENTATION feature flag. * Configurations/FeatureDefines.xcconfig: Source/WTF: Remove the ENABLE_CSS_IMAGE_ORIENTATION feature flag. * wtf/FeatureDefines.h: Tools: Remove the ENABLE_CSS_IMAGE_ORIENTATION feature flag. * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: LayoutTests: Test the css image-orientation property. * fast/images/image-orientation-dynamic-from-image-expected.html: Added. * fast/images/image-orientation-dynamic-from-image.html: Added. * fast/images/image-orientation-dynamic-none-expected.html: Added. * fast/images/image-orientation-dynamic-none.html: Added. * fast/images/image-orientation-none-expected.html: Added. * fast/images/image-orientation-none.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254187 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-07 Said Abou-Hallawa <sabouhallawa@apple.com> Implement css3-images image-orientation https://bugs.webkit.org/show_bug.cgi?id=89052 Reviewed by Simon Fraser. Remove the ENABLE_CSS_IMAGE_ORIENTATION feature flag. * Configurations/FeatureDefines.xcconfig: 2020-01-14 Alan Coon <alancoon@apple.com> Cherry-pick r254344. rdar://problem/58559189 Add SPI to enable TLS 1.0 and 1.1 in WKWebViews https://bugs.webkit.org/show_bug.cgi?id=206046 Patch by Alex Christensen <achristensen@webkit.org> on 2020-01-10 Reviewed by Youenn Fablet. Source/WebKit: This is needed for <rdar://problem/58464912> Covered by API tests. * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: (-[_WKWebsiteDataStoreConfiguration legacyTLSEnabled]): (-[_WKWebsiteDataStoreConfiguration setLegacyTLSEnabled:]): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::copy const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: (WebKit::WebsiteDataStoreConfiguration::legacyTLSEnabled const): (WebKit::WebsiteDataStoreConfiguration::setLegacyTLSEnabled): Tools: * TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm: (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254344 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-10 Alex Christensen <achristensen@webkit.org> Add SPI to enable TLS 1.0 and 1.1 in WKWebViews https://bugs.webkit.org/show_bug.cgi?id=206046 Reviewed by Youenn Fablet. This is needed for <rdar://problem/58464912> Covered by API tests. * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: (-[_WKWebsiteDataStoreConfiguration legacyTLSEnabled]): (-[_WKWebsiteDataStoreConfiguration setLegacyTLSEnabled:]): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::copy const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: (WebKit::WebsiteDataStoreConfiguration::legacyTLSEnabled const): (WebKit::WebsiteDataStoreConfiguration::setLegacyTLSEnabled): 2020-01-14 Alan Coon <alancoon@apple.com> Cherry-pick r254310. rdar://problem/58552856 Check the existence of the optional m_sessionID before using it in WebProcess::setResourceLoadStatisticsEnabled() https://bugs.webkit.org/show_bug.cgi?id=206035 <rdar://problem/58455306> Reviewed by Brent Fulgham. No new tests. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setResourceLoadStatisticsEnabled): Added a check that m_sessionID exists. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254310 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-09 John Wilander <wilander@apple.com> Check the existence of the optional m_sessionID before using it in WebProcess::setResourceLoadStatisticsEnabled() https://bugs.webkit.org/show_bug.cgi?id=206035 <rdar://problem/58455306> Reviewed by Brent Fulgham. No new tests. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setResourceLoadStatisticsEnabled): Added a check that m_sessionID exists. 2020-01-14 Alan Coon <alancoon@apple.com> Cherry-pick r254293. rdar://problem/58549084 Resource Load Statistics: Flip experimental website data removal setting from an enable to a disable https://bugs.webkit.org/show_bug.cgi?id=205966 <rdar://problem/58425000> Reviewed by Brent Fulgham. To get default on behavior, experimental features in the network process need to be turned from enable flags to disable flags. This patch does that for the experimental website data removal flag. Source/WebCore: No new tests. This change just reverses the interpretation of a flag. * page/Settings.yaml: Source/WebKit: This change also aligns the init values of the setting to match the default. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/NetworkSession.h: * NetworkProcess/NetworkSessionCreationParameters.h: * Shared/WebPreferences.yaml: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254293 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-09 John Wilander <wilander@apple.com> Resource Load Statistics: Flip experimental website data removal setting from an enable to a disable https://bugs.webkit.org/show_bug.cgi?id=205966 <rdar://problem/58425000> Reviewed by Brent Fulgham. To get default on behavior, experimental features in the network process need to be turned from enable flags to disable flags. This patch does that for the experimental website data removal flag. This change also aligns the init values of the setting to match the default. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/NetworkSession.h: * NetworkProcess/NetworkSessionCreationParameters.h: * Shared/WebPreferences.yaml: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): 2020-01-14 Alan Coon <alancoon@apple.com> Cherry-pick r254292. rdar://problem/58552868 Set the title for images so it will be correctly displayed in UIContextMenus https://bugs.webkit.org/show_bug.cgi?id=205980 <rdar://problem/57701988> Reviewed by Dean Jackson. Need to set the title text for images. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView continueContextMenuInteraction:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254292 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-09 Megan Gardner <megan_gardner@apple.com> Set the title for images so it will be correctly displayed in UIContextMenus https://bugs.webkit.org/show_bug.cgi?id=205980 <rdar://problem/57701988> Reviewed by Dean Jackson. Need to set the title text for images. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView continueContextMenuInteraction:]): 2020-01-14 Alan Coon <alancoon@apple.com> Cherry-pick r254287. rdar://problem/58552886 Fullscreen videos do not enter PiP in first tap https://bugs.webkit.org/show_bug.cgi?id=205986 Reviewed by Eric Carlson. This patch essentially reverts the fix for webkit.org/b/204461. The fix for webkit.org/b/204461 depends on a fix in AVKit along with a corresponding update in WebKit (webkit.org/b/204979). We will need to reapply the fix for webkit.org/b/204461 after they are landed. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254287 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-09 Peng Liu <peng.liu6@apple.com> Fullscreen videos do not enter PiP in first tap https://bugs.webkit.org/show_bug.cgi?id=205986 Reviewed by Eric Carlson. This patch essentially reverts the fix for webkit.org/b/204461. The fix for webkit.org/b/204461 depends on a fix in AVKit along with a corresponding update in WebKit (webkit.org/b/204979). We will need to reapply the fix for webkit.org/b/204461 after they are landed. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement): 2020-01-14 Alan Coon <alancoon@apple.com> Cherry-pick r254254. rdar://problem/58548978 WebKitTestRunner leaks objects in a top-level autoreleasePool that's never cleared <https://webkit.org/b/205950> <rdar://problem/50987831> Reviewed by Joseph Pecoraro. Source/WebKit: * UIProcess/mac/WebPreferencesMac.mm: (WebKit::WebPreferences::platformInitializeStore): - Add an @autoreleasepool block around the contents of this method since it generates numerous autoreleased objects when run. Tools: * WebKitTestRunner/ios/mainIOS.mm: (main): - Add an @autoreleasepool block around a line of code that generates autoreleased objects. These objects would never be released for the life of the process prior to this change. * WebKitTestRunner/mac/main.mm: (main): - Move instantiation of WTR::TestController outside of @autoreleasepool block so the pool can be drained while running tests. Prior to this change, this autoreleasePool would never be drained. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254254 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-09 David Kilzer <ddkilzer@apple.com> WebKitTestRunner leaks objects in a top-level autoreleasePool that's never cleared <https://webkit.org/b/205950> <rdar://problem/50987831> Reviewed by Joseph Pecoraro. * UIProcess/mac/WebPreferencesMac.mm: (WebKit::WebPreferences::platformInitializeStore): - Add an @autoreleasepool block around the contents of this method since it generates numerous autoreleased objects when run. 2020-01-14 Alan Coon <alancoon@apple.com> Cherry-pick r254239. rdar://problem/58549100 Resource Load Statistics: Flip experimental cookie blocking setting from an enable to a disable https://bugs.webkit.org/show_bug.cgi?id=205963 <rdar://problem/58424136> Reviewed by Brent Fulgham. To get default on behavior, experimental features in the network process need to be turned from enable flags to disable flags. This patch does that for the experimental cookie blocking flag. Source/WebCore: No new tests. This change just reverses the interpretation of a flag. * page/Settings.yaml: Source/WebKit: This change also aligns the init values of the setting to match the default. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/NetworkSession.h: * NetworkProcess/NetworkSessionCreationParameters.h: * Shared/WebPreferences.yaml: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254239 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-08 John Wilander <wilander@apple.com> Resource Load Statistics: Flip experimental cookie blocking setting from an enable to a disable https://bugs.webkit.org/show_bug.cgi?id=205963 <rdar://problem/58424136> Reviewed by Brent Fulgham. To get default on behavior, experimental features in the network process need to be turned from enable flags to disable flags. This patch does that for the experimental cookie blocking flag. This change also aligns the init values of the setting to match the default. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/NetworkSession.h: * NetworkProcess/NetworkSessionCreationParameters.h: * Shared/WebPreferences.yaml: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): 2020-01-14 Alan Coon <alancoon@apple.com> Cherry-pick r254208. rdar://problem/58559193 IPC::Connection::sendMessage() should use CRASH_WITH_INFO() <https://webkit.org/b/205419> <rdar://problem/58058661> Reviewed by Mark Lam. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::sendMessage): - Switch from CRASH() to CRASH_WITH_INFO(). git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254208 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-08 David Kilzer <ddkilzer@apple.com> IPC::Connection::sendMessage() should use CRASH_WITH_INFO() <https://webkit.org/b/205419> <rdar://problem/58058661> Reviewed by Mark Lam. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::sendMessage): - Switch from CRASH() to CRASH_WITH_INFO(). 2020-01-14 Alan Coon <alancoon@apple.com> Cherry-pick r254147. rdar://problem/58549096 Reformat WebFrameLoaderClient logging https://bugs.webkit.org/show_bug.cgi?id=205869 <rdar://problem/58379240> Reviewed by Brent Fulgham. Update the format used by WebFrameLoaderClient in its RELEASE_LOG logging. Use the format used by WebPageProxy and NetworkResourceLoader, which is generally of the form: <object-address> - [<values that help thread together operations>] <class>::<method>: <message and other useful values> So, for example: 0x4a1d7c310 - WebFrameLoaderClient::dispatchDidReachLayoutMilestone: dispatching didCompletePageTransition, page = 0x7f83ba009208 becomes: 0x4a1d7c310 - [webFrame=0x7ff703f03b68, webFrameID=3, webPage=0x7ff704831808, webPageID=15] WebFrameLoaderClient::dispatchDidReachLayoutMilestone: dispatching didCompletePageTransition No new tests - no added or changed functionality. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad): (WebKit::WebFrameLoaderClient::dispatchDidFailLoad): (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254147 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-07 Keith Rollin <krollin@apple.com> Reformat WebFrameLoaderClient logging https://bugs.webkit.org/show_bug.cgi?id=205869 <rdar://problem/58379240> Reviewed by Brent Fulgham. Update the format used by WebFrameLoaderClient in its RELEASE_LOG logging. Use the format used by WebPageProxy and NetworkResourceLoader, which is generally of the form: <object-address> - [<values that help thread together operations>] <class>::<method>: <message and other useful values> So, for example: 0x4a1d7c310 - WebFrameLoaderClient::dispatchDidReachLayoutMilestone: dispatching didCompletePageTransition, page = 0x7f83ba009208 becomes: 0x4a1d7c310 - [webFrame=0x7ff703f03b68, webFrameID=3, webPage=0x7ff704831808, webPageID=15] WebFrameLoaderClient::dispatchDidReachLayoutMilestone: dispatching didCompletePageTransition No new tests - no added or changed functionality. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad): (WebKit::WebFrameLoaderClient::dispatchDidFailLoad): (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone): 2020-01-14 Alan Coon <alancoon@apple.com> Cherry-pick r254092. rdar://problem/58552872 NetworkSessionCocoa::isolatedSession should not use iterator after mutating m_isolatedSessions https://bugs.webkit.org/show_bug.cgi?id=205824 <rdar://problem/55107625> Patch by Alex Christensen <achristensen@webkit.org> on 2020-01-06 Reviewed by Chris Dumez. Classic iterator use after mutating iterated container was causing crashes by returning a null SessionWrapper& This was introduced in r252185 or r248640. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::isolatedSession): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254092 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-06 Alex Christensen <achristensen@webkit.org> NetworkSessionCocoa::isolatedSession should not use iterator after mutating m_isolatedSessions https://bugs.webkit.org/show_bug.cgi?id=205824 <rdar://problem/55107625> Reviewed by Chris Dumez. Classic iterator use after mutating iterated container was causing crashes by returning a null SessionWrapper& This was introduced in r252185 or r248640. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::isolatedSession): 2020-01-14 Alan Coon <alancoon@apple.com> Cherry-pick r254078. rdar://problem/58549073 Reformat WebPage logging https://bugs.webkit.org/show_bug.cgi?id=205709 <rdar://problem/58290285> Reviewed by Brent Fulgham. Update the format used by WebPage in its RELEASE_LOG logging. Use the format used by WebPageProxy and NetworkResourceLoader, which is generally of the form: <object-address> - [<values that help thread together operations>] <class>::<method>: <message and other useful values> So, for example: 0x4a1df5000 - WebLoaderStrategy::scheduleLoad: Resource is being scheduled with the NetworkProcess (frame=0x4a1db0220, priority=0, webPageID=15, frameID=3, resourceID=32)', becomes: 0x4a1df5000 - [resourceLoader=0x1418b7200, frameLoader=0x1326d7340, frame=0x4a1db0220, webPageID=15, frameID=3, resourceID=32] WebLoaderStrategy::scheduleLoad: Resource is being scheduled with the NetworkProcess (priority=2) This new form is a lot more verbose, but it really helps in tracing activity from the top of our page/frame/resource load stack to the bottom. No new tests - no added or changed functionality. * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoad): (WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler): (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): (WebKit::WebLoaderStrategy::networkProcessCrashed): (WebKit::WebLoaderStrategy::loadResourceSynchronously): * WebProcess/Network/WebLoaderStrategy.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254078 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-06 Keith Rollin <krollin@apple.com> Reformat WebPage logging https://bugs.webkit.org/show_bug.cgi?id=205709 <rdar://problem/58290285> Reviewed by Brent Fulgham. Update the format used by WebPage in its RELEASE_LOG logging. Use the format used by WebPageProxy and NetworkResourceLoader, which is generally of the form: <object-address> - [<values that help thread together operations>] <class>::<method>: <message and other useful values> So, for example: 0x4a1df5000 - WebLoaderStrategy::scheduleLoad: Resource is being scheduled with the NetworkProcess (frame=0x4a1db0220, priority=0, webPageID=15, frameID=3, resourceID=32)', becomes: 0x4a1df5000 - [resourceLoader=0x1418b7200, frameLoader=0x1326d7340, frame=0x4a1db0220, webPageID=15, frameID=3, resourceID=32] WebLoaderStrategy::scheduleLoad: Resource is being scheduled with the NetworkProcess (priority=2) This new form is a lot more verbose, but it really helps in tracing activity from the top of our page/frame/resource load stack to the bottom. No new tests - no added or changed functionality. * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoad): (WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler): (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): (WebKit::WebLoaderStrategy::networkProcessCrashed): (WebKit::WebLoaderStrategy::loadResourceSynchronously): * WebProcess/Network/WebLoaderStrategy.h: 2020-01-14 Alan Coon <alancoon@apple.com> Cherry-pick r254042. rdar://problem/58549102 Source/WebCore/PAL: DumpRenderTree doesn't always call updateRendering() when a test completes https://bugs.webkit.org/show_bug.cgi?id=205761 Reviewed by Darin Adler. Add -[CATransaction synchronize]. * pal/spi/cocoa/QuartzCoreSPI.h: Source/WebKit: DumpRenderTree doesn't always call updateRendering() when a test completes https://bugs.webkit.org/show_bug.cgi?id=205761 Reviewed by Darin Adler. Use the QuartzCore SPI header. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Source/WebKitLegacy/mac: Fix a souce of WebKit1 test flakiness https://bugs.webkit.org/show_bug.cgi?id=205761 Reviewed by Darin Adler. Some animation tests (and possibly many others) are flakey or broken in WK1 because there was no code to guarantee that Page::updateRendering() was called at notifyDone() time. WK2 calls DrawingArea::forceRepaint(), which does updateRendering(), flushes layers, and flushes a CATransaction. In WK1, we historically relied in AppKit to call -viewWillDraw on WebView and/or WebHTMLView, and just called [webView display] to make this happen. However, with layer backing, AppKit behavior changes, and WebCore changes that make more things happen with HTML event loop timing, this approach no longer works. The fix is to add WebView SPI, _forceRepaintForTesting, which emulates what WK2 is doing. * WebView/WebView.mm: (-[WebView _forceRepaintForTesting]): * WebView/WebViewPrivate.h: Tools: DumpRenderTree doesn't always call updateRendering() when a test completes https://bugs.webkit.org/show_bug.cgi?id=205761 Reviewed by Darin Adler. Some animation tests (and possibly many others) are flakey or broken in WK1 because there was no code to guarantee that Page::updateRendering() was called at notifyDone() time. WK2 calls DrawingArea::forceRepaint(), which does updateRendering(), flushes layers, and flushes a CATransaction. In WK1, we historically relied in AppKit to call -viewWillDraw on WebView and/or WebHTMLView, and just called [webView display] to make this happen. However, with layer backing, AppKit behavior changes, and WebCore changes that make more things happen with HTML event loop timing, this approach no longer works. The fix is to add WebView SPI, _forceRepaintForTesting, which emulates what WK2 is doing. * DumpRenderTree/mac/DumpRenderTree.mm: (updateDisplay): * DumpRenderTree/mac/PixelDumpSupportMac.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254042 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-05 Simon Fraser <simon.fraser@apple.com> DumpRenderTree doesn't always call updateRendering() when a test completes https://bugs.webkit.org/show_bug.cgi?id=205761 Reviewed by Darin Adler. Use the QuartzCore SPI header. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: 2020-01-14 Alan Coon <alancoon@apple.com> Cherry-pick r254033. rdar://problem/58548645 Reformat WebPage logging https://bugs.webkit.org/show_bug.cgi?id=205705 <rdar://problem/58288704> Reviewed by Alex Christensen. Update the format used by WebPage in its RELEASE_LOG logging. Use the format used by WebPageProxy and NetworkResourceLoader, which is generally of the form: <object-address> - [<values that help thread together operations>] <class>::<method>: <message and other useful values> So, for example: 0x7f83ba009208 - WebPage (webPageID=15) - Adding a reason 1 to freeze layer tree (now 1); old reasons were 0 becomes: 0x7f83ba009208 - [webPageID=15] WebPage::freezeLayerTree: Adding a reason to freeze layer tree (reason=1, new=1, old=0) No new tests - no added or changed functionality. * WebProcess/WebPage/WebPage.cpp: (WebKit::m_overriddenMediaType): (WebKit::WebPage::createPlugin): (WebKit::WebPage::freezeLayerTree): (WebKit::WebPage::unfreezeLayerTree): (WebKit::WebPage::markLayersVolatile): (WebKit::WebPage::cancelMarkLayersVolatile): (WebKit::WebPage::touchEventSync): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254033 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-04 Keith Rollin <krollin@apple.com> Reformat WebPage logging https://bugs.webkit.org/show_bug.cgi?id=205705 <rdar://problem/58288704> Reviewed by Alex Christensen. Update the format used by WebPage in its RELEASE_LOG logging. Use the format used by WebPageProxy and NetworkResourceLoader, which is generally of the form: <object-address> - [<values that help thread together operations>] <class>::<method>: <message and other useful values> So, for example: 0x7f83ba009208 - WebPage (webPageID=15) - Adding a reason 1 to freeze layer tree (now 1); old reasons were 0 becomes: 0x7f83ba009208 - [webPageID=15] WebPage::freezeLayerTree: Adding a reason to freeze layer tree (reason=1, new=1, old=0) No new tests - no added or changed functionality. * WebProcess/WebPage/WebPage.cpp: (WebKit::m_overriddenMediaType): (WebKit::WebPage::createPlugin): (WebKit::WebPage::freezeLayerTree): (WebKit::WebPage::unfreezeLayerTree): (WebKit::WebPage::markLayersVolatile): (WebKit::WebPage::cancelMarkLayersVolatile): (WebKit::WebPage::touchEventSync): 2020-01-13 Alan Coon <alancoon@apple.com> Cherry-pick r254101. rdar://problem/58535157 [iOS] Get display level in the UI process for all iOS platforms https://bugs.webkit.org/show_bug.cgi?id=205835 <rdar://problem/58116883> Reviewed by Brent Fulgham. This was previously only done for iOS, but should be done for all iOS platforms. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::registerNotificationObservers): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): * UIProcess/WebProcessPool.h: * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254101 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-06 Per Arne Vollan <pvollan@apple.com> [iOS] Get display level in the UI process for all iOS platforms https://bugs.webkit.org/show_bug.cgi?id=205835 <rdar://problem/58116883> Reviewed by Brent Fulgham. This was previously only done for iOS, but should be done for all iOS platforms. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::registerNotificationObservers): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): * UIProcess/WebProcessPool.h: * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: 2020-01-03 Garrett Davidson <garrett_davidson@apple.com> IconLoadingClient::getLoadDecisionForIcon() leaks an Objective-C block https://bugs.webkit.org/show_bug.cgi?id=205750 <rdar://problem/57981723> Reviewed by Wenson Hsieh. Replace a Block_copy with makeBlockPtr to prevent leaking the ObjC block. * UIProcess/Cocoa/IconLoadingDelegate.mm: (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon): 2020-01-03 Tim Horton <timothy_horton@apple.com> Crashes under -[WKWebView _addUpdateVisibleContentRectPreCommitHandler]_block_invoke https://bugs.webkit.org/show_bug.cgi?id=205749 <rdar://problem/56433624> Reviewed by Simon Fraser. Implement a speculative fix for a common crash. We believe that this is due to a mechanism UIKit uses to bounce -dealloc (in our case, of WKWebView and/or WKContentView) to the main thread when the last reference is dropped on a background thread. At that point, deallocation has already begun, -retain cannot revive the object, but -dealloc has not yet been called (because of the nature of this mechanism). To avoid this, make PageClientImpl -> WKContentView and WKContentView -> WKWebView weak instead of raw references. This way, we won't even get to _addUpdateVisibleContentRectPreCommitHandler with a deallocating WKWebView, nor try (and fail) to retain it for later use in the block. * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::viewSize): (WebKit::PageClientImpl::didPerformDictionaryLookup): (WebKit::PageClientImpl::createValidationBubble): (WebKit::PageClientImpl::createDataListSuggestionsDropdown): (WebKit::PageClientImpl::createDrawingView): * UIProcess/ios/WKContentView.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView _commonInitializationWithProcessPool:configuration:]): (-[WKContentView webView]): (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): (-[WKContentView _didCommitLayerTree:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): (-[WKContentView _updateLongPressAndHighlightLongPressGestures]): (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]): (-[WKContentView gestureRecognizerMayPinchToZoomWebView:]): (-[WKContentView _showAttachmentSheet]): (-[WKContentView _actionForLongPressFromPositionInformation:]): (-[WKContentView gestureRecognizerShouldBegin:]): (-[WKContentView hasSelectablePositionAtPoint:]): (-[WKContentView pointIsNearMarkedText:]): (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): (-[WKContentView _stylusSingleTapRecognized:]): (-[WKContentView _endPotentialTapAndEnableDoubleTapGesturesIfNecessary]): (-[WKContentView _updateInteractionTintColor]): (-[WKContentView canPerformActionForWebView:withSender:]): (-[WKContentView accessibilityRetrieveSpeakSelectionContent]): (-[WKContentView requestRectsToEvadeForSelectionCommandsWithCompletionHandler:]): (-[WKContentView accessoryAutoFill]): (-[WKContentView _updateAccessory]): (-[WKContentView _didChangeWebViewEditability]): (-[WKContentView insertTextSuggestion:]): (-[WKContentView isScrollableForKeyboardScrollViewAnimator:]): (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:inDirection:]): (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]): (-[WKContentView addFocusedFormControlOverlay]): (-[WKContentView presentViewControllerForCurrentFocusedElement]): (-[WKContentView dismissAllInputViewControllers:]): (-[WKContentView _showShareSheet:inRect:completionHandler:]): (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]): (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]): (-[WKContentView dataDetectionContextForPositionInformation:]): (-[WKContentView actionSheetAssistant:getAlternateURLForImage:completion:]): (-[WKContentView _didChangeDragInteractionPolicy]): (-[WKContentView dragLiftDelay]): (-[WKContentView setupDragAndDropInteractions]): (-[WKContentView _didPerformDragOperation:]): (-[WKContentView _dragDestinationActionForDropSession:]): (-[WKContentView _itemsForBeginningOrAddingToSessionWithRegistrationLists:stagedDragSource:]): (-[WKContentView _handleDropByInsertingImagePlaceholders:session:]): (-[WKContentView _dragInteraction:dataOwnerForSession:]): (-[WKContentView dragInteraction:previewForLiftingItem:session:]): (-[WKContentView dragInteraction:sessionWillBegin:]): (-[WKContentView dragInteraction:session:didEndWithOperation:]): (-[WKContentView dragInteraction:previewForCancellingItem:withDefault:]): (-[WKContentView _dropInteraction:dataOwnerForSession:]): (-[WKContentView dropInteraction:sessionDidUpdate:]): (-[WKContentView dropInteraction:performDrop:]): (-[WKContentView dismissQuickboardViewControllerAndRevealFocusedFormOverlayIfNecessary:]): (-[WKContentView viewController:inputContextViewHeightForSize:]): (-[WKContentView inputContextViewForViewController:]): (-[WKContentView _registerPreview]): (-[WKContentView assignLegacyDataForContextMenuInteraction]): (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]): (-[WKContentView continueContextMenuInteraction:]): (-[WKContentView _createTargetedPreviewIfPossible]): (-[WKContentView contextMenuInteraction:willDisplayMenuForConfiguration:animator:]): (-[WKContentView contextMenuInteraction:willPerformPreviewActionForMenuWithConfiguration:animator:]): (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]): (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]): (-[WKContentView _dataForPreviewItemController:atPosition:type:]): (-[WKContentView _presentedViewControllerForPreviewItemController:]): (-[WKContentView _previewItemController:commitPreview:]): (-[WKContentView _previewItemController:didDismissPreview:committing:]): 2020-01-03 Peng Liu <peng.liu6@apple.com> Update the RemoteMediaPlayerManagerProxy::Load XPC message to provide the updated RemoteMediaPlayerConfiguration to the web process https://bugs.webkit.org/show_bug.cgi?id=205740 Reviewed by Eric Carlson. * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: (WebKit::RemoteMediaPlayerManagerProxy::load): * GPUProcess/media/RemoteMediaPlayerManagerProxy.h: * GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in: * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::load): * GPUProcess/media/RemoteMediaPlayerProxy.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::load): 2020-01-03 Andy Estes <aestes@apple.com> [Apple Pay] Provide a better error message when Apple Pay blocks user agent script evaluation https://bugs.webkit.org/show_bug.cgi?id=205730 <rdar://problem/55573484> Reviewed by Brady Eidson. * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::userAgentScriptsBlockedErrorMessage const): * WebProcess/ApplePay/WebPaymentCoordinator.h: 2020-01-03 Dean Jackson <dino@apple.com> Provide pid to crashing service worker process and GPU process https://bugs.webkit.org/show_bug.cgi?id=205564 <rdar://problem/58300321> Build fix for TestWebKitAPI. * UIProcess/API/C/WKContext.h: 2020-01-03 Yusuke Suzuki <ysuzuki@apple.com> Put more WebCore/WebKit JS objects into IsoSubspace https://bugs.webkit.org/show_bug.cgi?id=205711 Reviewed by Keith Miller. * WebProcess/Plugins/Netscape/JSNPMethod.h: * WebProcess/Plugins/Netscape/JSNPObject.h: 2020-01-03 Simon Fraser <simon.fraser@apple.com> Add some shared schemes to the WebKit.xcworkspace https://bugs.webkit.org/show_bug.cgi?id=205698 Reviewed by Tim Horton. Make WebKit.xcworkspace show the following schemes by default: All Source All Tools WTF JavaScriptCore WebCore WebKit WebKitLegacy DumpRenderTree WebKitTestRunner TestWebKitAPI MiniBrowser MobileMiniBrowser. Also remove the MobileMiniBrowserUITests scheme. * WebKit.xcodeproj/xcshareddata/xcschemes/WebKit.xcscheme: Copied from Tools/MobileMiniBrowser/MobileMiniBrowser.xcodeproj/xcshareddata/xcschemes/MobileMiniBrowserUITests.xcscheme. 2020-01-03 youenn fablet <youenn@apple.com> Provide pid to crashing service worker process and GPU process https://bugs.webkit.org/show_bug.cgi?id=205564 Reviewed by Alex Christensen. No change of behavior, we provide pids to the WKContext callbacks. * UIProcess/API/C/WKContext.h: * UIProcess/API/C/WKContextPrivate.h: * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::gpuProcessCrashed): * UIProcess/WebContextClient.cpp: (WebKit::WebContextClient::serviceWorkerProcessDidCrash): (WebKit::WebContextClient::gpuProcessDidCrash): * UIProcess/WebContextClient.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::serviceWorkerProcessCrashed): (WebKit::WebProcessPool::gpuProcessCrashed): * UIProcess/WebProcessPool.h: 2020-01-03 Alex Christensen <achristensen@webkit.org> Deprecate _WKWebsitePolicies https://bugs.webkit.org/show_bug.cgi?id=205539 Reviewed by Wenson Hsieh. Its last use was removed in rdar://problem/58064847 but we need to keep it in WebKit until the next Safari release to keep Safari working with built versions of open source WebKit with run-safari. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _updateWebsitePolicies:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/_WKWebsitePolicies.h: * UIProcess/API/Cocoa/_WKWebsitePolicies.mm: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): 2020-01-03 youenn fablet <youenn@apple.com> NetworkResourceLoader::didFinishWithRedirectResponse should not assume the load is coming from network https://bugs.webkit.org/show_bug.cgi?id=205715 Reviewed by Alex Christensen. Covered by updated test. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::didFinishWithRedirectResponse): If redirection is coming from cache, the load is not null. We just need to use the request URL since the redirection mode is manual. 2020-01-03 Chris Dumez <cdumez@apple.com> Unreviewed, drop new assertion added in r253984 which hits on OpenSource bots * Shared/ios/DependencyProcessAssertionIOS.mm: (WebKit::DependencyProcessAssertion::DependencyProcessAssertion): 2020-01-03 Chris Dumez <cdumez@apple.com> Improve release logging in ServiceWorkerFetchTask https://bugs.webkit.org/show_bug.cgi?id=205692 Reviewed by Youenn Fablet. Improve release logging in ServiceWorkerFetchTask to facilitate debugging. * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask): (WebKit::ServiceWorkerFetchTask::~ServiceWorkerFetchTask): (WebKit::ServiceWorkerFetchTask::start): (WebKit::ServiceWorkerFetchTask::contextClosed): (WebKit::ServiceWorkerFetchTask::startFetch): (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse): (WebKit::ServiceWorkerFetchTask::didReceiveResponse): (WebKit::ServiceWorkerFetchTask::didFinish): (WebKit::ServiceWorkerFetchTask::didFail): (WebKit::ServiceWorkerFetchTask::didNotHandle): (WebKit::ServiceWorkerFetchTask::cannotHandle): (WebKit::ServiceWorkerFetchTask::cancelFromClient): (WebKit::ServiceWorkerFetchTask::continueDidReceiveFetchResponse): (WebKit::ServiceWorkerFetchTask::continueFetchTaskWith): (WebKit::ServiceWorkerFetchTask::timeoutTimerFired): (WebKit::ServiceWorkerFetchTask::softUpdateIfNeeded): 2020-01-03 youenn fablet <youenn@apple.com> Fix non-libwebrtc builds after r253957 https://bugs.webkit.org/show_bug.cgi?id=205714 Unreviewed. * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: Move the includes inside the compilation guard. 2020-01-02 Keith Rollin <krollin@apple.com> Reformat WebProcess logging https://bugs.webkit.org/show_bug.cgi?id=205691 <rdar://problem/58283294> Reviewed by Chris Dumez. Update the format used by WebProcess in its RELEASE_LOG logging. Use the format used by WebPageProxy and NetworkResourceLoader, which is generally of the form: <object-address> - [<values that help thread together operations>] <class>::<method>: <message and other useful values> So, for example: 0x6f1df7000 - WebProcess::destroyRenderingResources() took 0.02ms becomes: 0x6f1df7000 - [sessionID=2] WebProcess::destroyRenderingResources: took 0.02ms While we're at it, also convert over to the RELEASE_LOG_IF_ALLOWED style of logging macro. We didn't used to be able to do this since the decision on whether or not to allow logging is typically based on SessionID, which didn't used to be an attribute of WebProcess. Now WebProcesses do (or can) have a SessionID, so use that to support the hiding of logging in private sessions. No new tests - no added or changed functionality. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): (WebKit::WebProcess::prepareToSuspend): (WebKit::WebProcess::markAllLayersVolatile): (WebKit::WebProcess::freezeAllLayerTrees): (WebKit::WebProcess::unfreezeAllLayerTrees): (WebKit::WebProcess::processDidResume): (WebKit::WebProcess::grantUserMediaDeviceSandboxExtensions): (WebKit::WebProcess::revokeUserMediaDeviceSandboxExtensions): * WebProcess/WebProcess.h: (WebKit::WebProcess::isAlwaysOnLoggingAllowed): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updateProcessName): (WebKit::WebProcess::updateCPUMonitorState): (WebKit::WebProcess::destroyRenderingResources): (WebKit::WebProcess::updateFreezerStatus): 2020-01-02 Yusuke Suzuki <ysuzuki@apple.com> and Simon Fraser <simon.fraser@apple.com> Experiment: create lots of different malloc zones for easier accounting of memory use https://bugs.webkit.org/show_bug.cgi?id=186422 Reviewed by Saam Barati. * Shared/ShareableBitmap.cpp: (WebKit::ShareableBitmap::create): (WebKit::ShareableBitmap::~ShareableBitmap): * UIProcess/mac/LegacySessionStateCoding.cpp: (WebKit::HistoryEntryDataEncoder::HistoryEntryDataEncoder): (WebKit::HistoryEntryDataEncoder::finishEncoding): (WebKit::encodeSessionHistoryEntryData): (WebKit::encodeLegacySessionState): 2020-01-02 Chris Dumez <cdumez@apple.com> [iOS] Replace "unexpectedly resumed" observer with RunningBoard suspendible assertions https://bugs.webkit.org/show_bug.cgi?id=205687 <rdar://problem/57890246> Reviewed by Tim Horton. Adopt new RunningBoard process assertion to indicate that WebContent processes depend on their UIProcess (and therefore, the UIProcess must be running if the WebContent process is). This replaces our "Unexpectedly resumed" assertion which was causing unexpected terminations in some cases. * Configurations/WebKit.xcconfig: * Platform/spi/ios/RunningBoardServicesSPI.h: Added. * Scripts/process-entitlements.sh: * Shared/DependencyProcessAssertion.cpp: Added. (WebKit::DependencyProcessAssertion::DependencyProcessAssertion): (WebKit::DependencyProcessAssertion::~DependencyProcessAssertion): * Shared/DependencyProcessAssertion.h: Added. * Shared/ios/DependencyProcessAssertionIOS.mm: Added. (WebKit::DependencyProcessAssertion::DependencyProcessAssertion): (WebKit::DependencyProcessAssertion::~DependencyProcessAssertion): * Sources.txt: * SourcesCocoa.txt: * UIProcess/Cocoa/WebProcessProxyCocoa.mm: * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeConnection): * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: 2020-01-02 Keith Rollin <krollin@apple.com> Reformat WebProcessCache logging https://bugs.webkit.org/show_bug.cgi?id=205683 <rdar://problem/58269352> Reviewed by Alex Christensen. Update the format used by WebProcessCache in its RELEASE_LOG logging. Use the format used by WebPageProxy and NetworkResourceLoader, which is generally of the form: <object-address> - [<values that help thread together operations>] <class>::<method>: <message and other useful values> So, for example: 0x1145ed208 - WebProcessCache::canCacheProcess(): Not caching process 83671 because it does not have an associated registrable domain becomes: 0x1145ed208 - [PID=83671] WebProcessCache::canCacheProcess: Not caching process because it does not have an associated registrable domain No new tests - no added or changed functionality. * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::canCacheProcess const): (WebKit::WebProcessCache::addProcessIfPossible): (WebKit::WebProcessCache::addProcess): (WebKit::WebProcessCache::takeProcess): (WebKit::WebProcessCache::updateCapacity): (WebKit::WebProcessCache::clear): (WebKit::WebProcessCache::clearAllProcessesForSession): (WebKit::WebProcessCache::setApplicationIsActive): (WebKit::WebProcessCache::removeProcess): 2020-01-02 Keith Rollin <krollin@apple.com> Reformat ProcessThrottler logging https://bugs.webkit.org/show_bug.cgi?id=205679 <rdar://problem/58265958> Reviewed by Alex Christensen. Update the format used by ProcessThrottler in its RELEASE_LOG logging. Use the format used by WebPageProxy and NetworkResourceLoader, which is generally of the form: <object-address> - [<values that help thread together operations>] <class>::<method>: <message and other useful values> So, for example: [PID: 0] 0x1145ce5e8 - ProcessThrottler::invalidateAllActivities() BEGIN becomes: 0x1145ce5e8 - [PID: 0] ProcessThrottler::invalidateAllActivities: BEGIN No new tests - no added or changed functionality. * UIProcess/ProcessThrottler.cpp: (WebKit::ProcessThrottler::invalidateAllActivities): (WebKit::ProcessThrottler::setAssertionState): (WebKit::ProcessThrottler::updateAssertionIfNeeded): (WebKit::ProcessThrottler::didConnectToProcess): (WebKit::ProcessThrottler::prepareToSuspendTimeoutTimerFired): (WebKit::ProcessThrottler::processReadyToSuspend): (WebKit::ProcessThrottler::sendPrepareToSuspendIPC): (WebKit::ProcessThrottler::uiAssertionWillExpireImminently): * UIProcess/ProcessThrottler.h: (WebKit::ProcessThrottler::Activity::Activity): (WebKit::ProcessThrottler::Activity::invalidate): 2020-01-02 Keith Rollin <krollin@apple.com> Reformat WebResourceLoader logging https://bugs.webkit.org/show_bug.cgi?id=205680 <rdar://problem/58266105> Reviewed by Alex Christensen. Update the format used by WebResourceLoader in its RELEASE_LOG logging. Use the format used by WebPageProxy and NetworkResourceLoader, which is generally of the form: <object-address> - [<values that help thread together operations>] <class>::<method>: <message and other useful values> So, for example: 0x4a1dbcb58 - WebResourceLoader::didFinishResourceLoad: (webPageID=15, frameID=3, resourceID=1, length=212132) becomes: 0x4a1dbcb58 - [webPageID=15, frameID=3, resourceID=1] WebResourceLoader::didFinishResourceLoad: (length=212132) No new tests - no added or changed functionality. * WebProcess/Network/WebResourceLoader.cpp: (WebKit::WebResourceLoader::willSendRequest): (WebKit::WebResourceLoader::didReceiveResponse): (WebKit::WebResourceLoader::didReceiveData): (WebKit::WebResourceLoader::didFinishResourceLoad): (WebKit::WebResourceLoader::serviceWorkerDidNotHandle): (WebKit::WebResourceLoader::didFailResourceLoad): (WebKit::WebResourceLoader::didBlockAuthenticationChallenge): (WebKit::WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied): (WebKit::WebResourceLoader::didReceiveResource): 2020-01-02 Alex Christensen <achristensen@webkit.org> Add SPI to disable CORS on requests to URLs matching a pattern https://bugs.webkit.org/show_bug.cgi?id=205534 <rdar://problem/58011337> Reviewed by Chris Dumez. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::copy const): (API::PageConfiguration::PageConfiguration): Deleted. (API::PageConfiguration::~PageConfiguration): Deleted. * UIProcess/API/APIPageConfiguration.h: (API::PageConfiguration::corsDisablingPatterns const): (API::PageConfiguration::setCORSDisablingPatterns): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration _corsDisablingPatterns]): (-[WKWebViewConfiguration _setCORSDisablingPatterns:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/WebPageProxy.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_overriddenMediaType): 2020-01-02 Sam Weinig <weinig@apple.com> Simplify StringBuilder API/align with makeString by removing appendFixed* functions and using FormatNumber struct instead https://bugs.webkit.org/show_bug.cgi?id=205671 Reviewed by Alex Christensen. * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::dumpContentsToFile): * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::asJSON const): * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::loggingString const): Replace all uses of builder.appendFixedPrecisionNumber(...) with builder.append(FormattedNumber::fixedPrecision(...)). 2020-01-02 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Make ondemand hardware acceleration policy never leave AC mode https://bugs.webkit.org/show_bug.cgi?id=205558 Reviewed by Sergio Villar Senin. We still enter AC mode on demand but we never leave it for the same drawing area. This avoids scrolling performance problems with some websites that start small accelerated animation while scrolling (like WebKit bugzilla review tool), due to constant enter/leave AC mode. * UIProcess/API/glib/WebKitSettings.cpp: (webkit_settings_class_init): Update API documentation. * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode): Force AC mode the first time we enter it. 2019-12-22 Jeff Miller <jeffm@apple.com> Update user-visible copyright strings to include 2020 https://bugs.webkit.org/show_bug.cgi?id=205552 Reviewed by Darin Adler. * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-OSX.plist: * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-iOS.plist: * Info.plist: * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-OSX.plist: * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-iOS.plist: * PluginProcess/EntryPoint/Cocoa/XPCService/PluginService.64.Info.plist: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-OSX.plist: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist: 2019-12-31 Peng Liu <peng.liu6@apple.com> Add remote media resource loader for the GPU process https://bugs.webkit.org/show_bug.cgi?id=205379 Reviewed by Youenn Fablet. In the GPU process, the RemoteMediaResourceLoader creates RemoteMediaResource(s), which will notify the media resource clients (WebCoreNSURLSessionDataTaskClient). Then the data will be forwarded to AVFoundation. In the Web process, MeidaResourceLoader creates MediaResource(s), which take care of downloading media data through the network process. The received data will be forwarded to RemoteMediaResourceProxy, which will forward the data to the corresponding RemoteMediaResource through XPC messages. (WebKit::GPUConnectionToWebProcess::remoteMediaResourceManager): (WebKit::GPUConnectionToWebProcess::didReceiveMessage): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: * GPUProcess/media/RemoteMediaPlayerManagerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::~RemoteMediaPlayerProxy): (WebKit::RemoteMediaPlayerProxy::requestResource): (WebKit::RemoteMediaPlayerProxy::removeResource): (WebKit::RemoteMediaPlayerProxy::mediaPlayerCreateResourceLoader): * GPUProcess/media/RemoteMediaPlayerProxy.h: (WebKit::RemoteMediaPlayerProxy::~RemoteMediaPlayerProxy): Deleted. (WebKit::RemoteMediaPlayerProxy::mediaPlayerLogIdentifier): Deleted. * GPUProcess/media/RemoteMediaResource.cpp: Added. (WebKit::RemoteMediaResource::create): (WebKit::RemoteMediaResource::RemoteMediaResource): (WebKit::RemoteMediaResource::~RemoteMediaResource): (WebKit::RemoteMediaResource::stop): (WebKit::RemoteMediaResource::didPassAccessControlCheck const): (WebKit::RemoteMediaResource::responseReceived): (WebKit::RemoteMediaResource::redirectReceived): (WebKit::RemoteMediaResource::shouldCacheResponse): (WebKit::RemoteMediaResource::dataSent): (WebKit::RemoteMediaResource::dataReceived): (WebKit::RemoteMediaResource::accessControlCheckFailed): (WebKit::RemoteMediaResource::loadFailed): (WebKit::RemoteMediaResource::loadFinished): * GPUProcess/media/RemoteMediaResource.h: Added. (WebKit::RemoteMediaResource::ready const): (WebKit::RemoteMediaResource::setReady): * GPUProcess/media/RemoteMediaResourceIdentifier.h: Added. * GPUProcess/media/RemoteMediaResourceLoader.cpp: Added. (WebKit::RemoteMediaResourceLoader::RemoteMediaResourceLoader): (WebKit::RemoteMediaResourceLoader::~RemoteMediaResourceLoader): (WebKit::RemoteMediaResourceLoader::requestResource): * GPUProcess/media/RemoteMediaResourceLoader.h: Added. * GPUProcess/media/RemoteMediaResourceManager.cpp: Added. (WebKit::RemoteMediaResourceManager::RemoteMediaResourceManager): (WebKit::RemoteMediaResourceManager::~RemoteMediaResourceManager): (WebKit::RemoteMediaResourceManager::addMediaResource): (WebKit::RemoteMediaResourceManager::removeMediaResource): (WebKit::RemoteMediaResourceManager::responseReceived): (WebKit::RemoteMediaResourceManager::redirectReceived): (WebKit::RemoteMediaResourceManager::dataSent): (WebKit::RemoteMediaResourceManager::dataReceived): (WebKit::RemoteMediaResourceManager::accessControlCheckFailed): (WebKit::RemoteMediaResourceManager::loadFailed): (WebKit::RemoteMediaResourceManager::loadFinished): * GPUProcess/media/RemoteMediaResourceManager.h: Added. * GPUProcess/media/RemoteMediaResourceManager.messages.in: Added. * WebProcess/GPU/GPUProcessConnection.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote): (WebKit::MediaPlayerPrivateRemote::requestResource): (WebKit::MediaPlayerPrivateRemote::removeResource): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/MediaPlayerPrivateRemoteIdentifier.h: * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::supportsTypeAndCodecs): (WebKit::RemoteMediaPlayerManager::originsInMediaCache): (WebKit::RemoteMediaPlayerManager::clearMediaCacheForOrigins): (WebKit::RemoteMediaPlayerManager::networkStateChanged): (WebKit::RemoteMediaPlayerManager::readyStateChanged): (WebKit::RemoteMediaPlayerManager::volumeChanged): (WebKit::RemoteMediaPlayerManager::muteChanged): (WebKit::RemoteMediaPlayerManager::timeChanged): (WebKit::RemoteMediaPlayerManager::durationChanged): (WebKit::RemoteMediaPlayerManager::rateChanged): (WebKit::RemoteMediaPlayerManager::playbackStateChanged): (WebKit::RemoteMediaPlayerManager::engineFailedToLoad): (WebKit::RemoteMediaPlayerManager::requestResource): (WebKit::RemoteMediaPlayerManager::removeResource): * WebProcess/GPU/media/RemoteMediaPlayerManager.h: (WebKit::RemoteMediaPlayerManager::didReceiveMessageFromGPUProcess): (WebKit::RemoteMediaPlayerManager::didReceiveMessageFromWebProcess): Deleted. * WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in: * WebProcess/GPU/media/RemoteMediaResourceProxy.cpp: Added. (WebKit::RemoteMediaResourceProxy::RemoteMediaResourceProxy): (WebKit::RemoteMediaResourceProxy::~RemoteMediaResourceProxy): (WebKit::RemoteMediaResourceProxy::responseReceived): (WebKit::RemoteMediaResourceProxy::redirectReceived): (WebKit::RemoteMediaResourceProxy::shouldCacheResponse): (WebKit::RemoteMediaResourceProxy::dataSent): (WebKit::RemoteMediaResourceProxy::dataReceived): (WebKit::RemoteMediaResourceProxy::accessControlCheckFailed): (WebKit::RemoteMediaResourceProxy::loadFailed): (WebKit::RemoteMediaResourceProxy::loadFinished): * WebProcess/GPU/media/RemoteMediaResourceProxy.h: Added. 2019-12-31 youenn fablet <youenn@apple.com> Implement RTC VTB decoders in GPUProcess https://bugs.webkit.org/show_bug.cgi?id=205607 Reviewed by Eric Carlson. Implement decoder factory callbacks. Implement WebProcess codecs by sending IPC for creating/releasing/decoding a frame. WebProcess receives IPC messages from GPU Process whenever a frame is decoded. * Configurations/WebKit.xcconfig: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::libWebRTCCodecsProxy): (WebKit::GPUConnectionToWebProcess::didReceiveMessage): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.h: Added. (WebKit::LibWebRTCCodecsProxy::didReceiveMessageFromWebProcess): * GPUProcess/webrtc/LibWebRTCCodecsProxy.messages.in: Added. * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: Added. (WebKit::LibWebRTCCodecsProxy::LibWebRTCCodecsProxy): (WebKit::LibWebRTCCodecsProxy::~LibWebRTCCodecsProxy): (WebKit::LibWebRTCCodecsProxy::createDecoder): (WebKit::LibWebRTCCodecsProxy::releaseDecoder): (WebKit::LibWebRTCCodecsProxy::decodeFrame): * Scripts/webkit/messages.py: * Sources.txt: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::didReceiveMessage): * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: Added. (WebKit::createVideoDecoder): (WebKit::releaseVideoDecoder): (WebKit::decodeVideoFrame): (WebKit::registerDecodeCompleteCallback): (WebKit::LibWebRTCCodecs::setVideoDecoderCallbacks): (WebKit::LibWebRTCCodecs::createDecoder): (WebKit::LibWebRTCCodecs::releaseDecoder): (WebKit::LibWebRTCCodecs::decodeFrame): (WebKit::LibWebRTCCodecs::registerDecodeFrameCallback): (WebKit::LibWebRTCCodecs::failedDecoding): (WebKit::LibWebRTCCodecs::completedDecoding): * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: Added. * WebProcess/GPU/webrtc/LibWebRTCCodecs.messages.in: Added. * WebProcess/GPU/webrtc/RTCDecoderIdentifier.h: Added. * WebProcess/Network/webrtc/LibWebRTCProvider.cpp: (WebKit::LibWebRTCProvider::createDecoderFactory): * WebProcess/Network/webrtc/LibWebRTCProvider.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::libWebRTCCodecs): * WebProcess/WebProcess.h: 2019-12-30 Brady Eidson <beidson@apple.com> Add WKWebView SPI to evaluate a function with arguments https://bugs.webkit.org/show_bug.cgi?id=205239 Reviewed by Alex Christensen. * Shared/API/APISerializedScriptValue.h: * UIProcess/API/C/WKPage.cpp: (WKPageRunJavaScriptInMainFrame): * UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm: (API::sharedContext): (API::SerializedScriptValue::deserialize): (API::SerializedScriptValue::wireBytesFromNSObject): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView evaluateJavaScript:completionHandler:]): (validateArgument): (-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:completionHandler:]): (-[WKWebView _callAsyncFunction:withArguments:completionHandler:]): (-[WKWebView _evaluateJavaScriptWithoutUserGesture:completionHandler:]): (-[WKWebView _evaluateJavaScript:forceUserGesture:completionHandler:]): Deleted. * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_run_javascript): (webkit_web_view_run_javascript_in_world): (resourcesStreamReadCallback): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::runJavaScriptInMainFrame): (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld): * UIProcess/WebPageProxy.h: * UIProcess/socket/RemoteInspectorProtocolHandler.cpp: (WebKit::RemoteInspectorProtocolHandler::runScript): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::runJavaScript): (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld): (WebKit::WebPage::runJavaScriptInFrame): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2019-12-29 Peng Liu <peng.liu6@apple.com> Tweak the format and comment in the code to support media in GPU process https://bugs.webkit.org/show_bug.cgi?id=205631 Reviewed by Eric Carlson. No new tests, no functional change. * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: (WebKit::RemoteMediaPlayerManagerProxy::logChannel const): * GPUProcess/media/RemoteMediaPlayerManagerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h: * WebProcess/GPU/GPUProcessConnectionInfo.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: * WebProcess/GPU/media/MediaPlayerPrivateRemoteIdentifier.h: * WebProcess/GPU/media/RemoteMediaPlayerConfiguration.h: * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: * WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in: * WebProcess/GPU/media/RemoteMediaPlayerState.h: 2019-12-29 Eric Carlson <eric.carlson@apple.com> Cleanup media IPC encoders https://bugs.webkit.org/show_bug.cgi?id=205630 <rdar://problem/58232173> Reviewed by Anders Carlsson. * GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h: (WebKit::RemoteMediaPlayerProxyConfiguration::decode): * WebProcess/GPU/media/RemoteMediaPlayerConfiguration.h: (WebKit::RemoteMediaPlayerConfiguration::decode): 2019-12-28 Antti Koivisto <antti@apple.com> Make simple line layout an internal feature https://bugs.webkit.org/show_bug.cgi?id=205615 Reviewed by Zalan Bujtas. So it can be enabled/disabled from run-webkit-tests command line. This also adds it to the internal feature menus, allowing removal of hardcoded menu entries. * Shared/WebPreferences.yaml: 2019-12-23 Darin Adler <darin@apple.com> Refactor to simplify broadcasting to all media elements https://bugs.webkit.org/show_bug.cgi?id=205567 Reviewed by Eric Carlson. * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: (WebKit::InjectedBundleHitTestResult::mediaType const): Use is<HTMLMediaElement>. 2019-12-26 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Remove duplicated code https://bugs.webkit.org/show_bug.cgi?id=205560 Reviewed by Sergio Villar Senin. Remove duplicated code related to IME between GTK and WPE that can be shared. * SourcesGTK.txt: * SourcesWPE.txt: * WebProcess/WebCoreSupport/glib/WebEditorClientGLib.cpp: Added. (WebKit::WebEditorClient::handleInputMethodKeydown): (WebKit::WebEditorClient::didDispatchInputMethodKeydown): * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp: * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp: * WebProcess/WebPage/glib/WebPageGLib.cpp: (WebKit::WebPage::setInputMethodState): * WebProcess/WebPage/gtk/WebPageGtk.cpp: * WebProcess/WebPage/wpe/WebPageWPE.cpp: 2019-12-24 Eric Carlson <eric.carlson@apple.com> [Media in GPU process] Enable media player proxy logging https://bugs.webkit.org/show_bug.cgi?id=205557 <rdar://problem/58160932> Reviewed by Youenn Fablet. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::create): (WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess): (WebKit::GPUConnectionToWebProcess::logger): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::createGPUConnectionToWebProcess): * GPUProcess/GPUProcess.h: * GPUProcess/GPUProcess.messages.in: * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: (WebKit::RemoteMediaPlayerManagerProxy::logger const): (WebKit::nullLogger): Deleted. * Platform/Logging.h: * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::openGPUProcessConnection): * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::logChannel const): 2019-12-24 youenn fablet <youenn@apple.com> Service Worker doesn't terminate after a period of time when thread blocking https://bugs.webkit.org/show_bug.cgi?id=202992 <rdar://problem/56298596> Reviewed by Chris Dumez. Add a preference to enable/disable service worker short timeouts. Add IPC handling for passing service worker heart beat failures and to get from WebProcess whether a given service worker is running or not. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::contextConnectionCreated): (WebKit::WebSWServerConnection::syncTerminateWorkerFromClient): (WebKit::WebSWServerConnection::isServiceWorkerRunning): * NetworkProcess/ServiceWorker/WebSWServerConnection.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesGetServiceWorkerTestMode): (WKPreferencesSetServiceWorkerTestMode): * UIProcess/API/C/WKPreferencesRef.h: * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::isServiceWorkerRunning): * WebProcess/Storage/WebSWClientConnection.h: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::updatePreferencesStore): (WebKit::WebSWContextManagerConnection::didFailHeartBeatCheck): * WebProcess/Storage/WebSWContextManagerConnection.h: 2019-12-23 Alexey Proskuryakov <ap@apple.com> watchOS build fix attempt Not sure what broke the build, seems like UserInterfaceIdiom.h used to be included via unified build, and no longer is. Added the include. While at it, removed an ancient __IPHONE_OS_VERSION_MIN_REQUIRED version check. * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: 2019-12-23 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix the macCatalyst build after r253866 * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer): MediaPlayer::mediaKeysStorageDirectory() is guarded by ENABLE(LEGACY_ENCRYPTED_MEDIA). 2019-12-23 Carlos Garcia Campos <cgarcia@igalia.com> WebDriver: fix handling of session timeouts for values higher than MAX_INT https://bugs.webkit.org/show_bug.cgi?id=204114 Reviewed by Brian Burg. Use number instead of integer for all optional timeout parameters. In the case of script timeout, not passing a value means a timeout should not be used, so use Optional<double> also for the IPC message and handle the optional value in the web process to not set any timeout in that case. * UIProcess/Automation/Automation.json: * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::waitForNavigationToComplete): (WebKit::WebAutomationSession::navigateBrowsingContext): (WebKit::WebAutomationSession::goBackInBrowsingContext): (WebKit::WebAutomationSession::goForwardInBrowsingContext): (WebKit::WebAutomationSession::reloadBrowsingContext): (WebKit::WebAutomationSession::evaluateJavaScriptFunction): * UIProcess/Automation/WebAutomationSession.h: * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): * WebProcess/Automation/WebAutomationSessionProxy.h: * WebProcess/Automation/WebAutomationSessionProxy.js: (let.AutomationSessionProxy.prototype.evaluateJavaScriptFunction): * WebProcess/Automation/WebAutomationSessionProxy.messages.in: 2019-12-23 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] InputMethod API unit tests don't work under X11 https://bugs.webkit.org/show_bug.cgi?id=205497 Reviewed by Žan Doberšek. Assume the web view is always focused when running tests under Xvfb, since there isn't a window manager to focus the toplevel window in that case. * UIProcess/API/glib/InputMethodFilter.cpp: (WebKit::InputMethodFilter::isViewFocused const): 2019-12-23 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Special combination characters doesn't respect the keystroke order when high CPU load https://bugs.webkit.org/show_bug.cgi?id=185248 Reviewed by Žan Doberšek. Key events are queued by the WebPageProxy so that the next event is not sent to the web process until the previous one has been handled by the web process already. However, the composition results generated by key events are sent to the web process using IPC messages when they happen. In case of high CPU load it can happen that the composition results are sent to the web process even before the associated keys, that are still in the queue waiting to be sent. We need to ensure that composition results are always processed right after its associated key press event. So, instead of sending the results independently, we now include them as part of the key event. * Shared/NativeWebKeyboardEvent.h: Add optional preeditUnderlines and preeditSelectionRange parameters to constructor. * Shared/WebEvent.h: (WebKit::WebKeyboardEvent::preeditUnderlines const): Return the optional preeditUnderlines. (WebKit::WebKeyboardEvent::preeditSelectionRange const): Return the optional preeditSelectionRange. * Shared/WebEventConversion.cpp: (WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent): Copy preeditUnderlines and preeditSelectionRange too. * Shared/WebKeyboardEvent.cpp: (WebKit::WebKeyboardEvent::WebKeyboardEvent): Add optional preeditUnderlines and preeditSelectionRange parameters and initialize them. (WebKit::WebKeyboardEvent::encode const): Encode preeditUnderlines and preeditSelectionRange. (WebKit::WebKeyboardEvent::decode): Decode preeditUnderlines and preeditSelectionRange. * Shared/gtk/NativeWebKeyboardEventGtk.cpp: (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): Add optional preeditUnderlines and preeditSelectionRange parameters and initialize them. * Shared/gtk/WebEventFactory.cpp: (WebKit::WebEventFactory::createWebKeyboardEvent): Add optional preeditUnderlines and preeditSelectionRange parameters and pass them to WebKeyboardEvent constructor. * Shared/gtk/WebEventFactory.h: * Shared/libwpe/NativeWebKeyboardEventLibWPE.cpp: (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): Add optional preeditUnderlines and preeditSelectionRange parameters and initialize them. * Shared/libwpe/WebEventFactory.cpp: (WebKit::WebEventFactory::createWebKeyboardEvent): Add optional preeditUnderlines and preeditSelectionRang parameters and pass them to WebKeyboardEvent constructor. * Shared/libwpe/WebEventFactory.h: Add optional preeditUnderlines and preeditSelectionRange parameters to constructor. * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewSynthesizeCompositionKeyPress): Pass the preeditUnderlines and preeditSelectionRange to platform implementation. (webkitWebViewSetComposition): Remove the call to WebPageProxy::setComposition(). (webkitWebViewConfirmComposition): Remove the call to WebPageProxy::confirmComposition(). (webkitWebViewCancelComposition): Call WebPageProxy::cancelComposition(); * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseKeyPressEvent): Pass the preeditUnderlines and preeditSelectionRange to NativeWebKeyboardEvent constructor. (webkitWebViewBaseKeyReleaseEvent): Ditto. (webkitWebViewBaseSynthesizeCompositionKeyPress): Ditto. * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: * UIProcess/API/wpe/WPEView.cpp: (WKWPE::View::handleKeyboardEvent): Ditto. (WKWPE::View::synthesizeCompositionKeyPress): Ditto. * UIProcess/API/wpe/WPEView.h: * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * WebProcess/WebCoreSupport/WebEditorClient.h: * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp: (WebKit::WebEditorClient::didDispatchInputMethodKeydown): Handle the composition results here, right after the associated key events has been dispatched. * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp: (WebKit::WebEditorClient::didDispatchInputMethodKeydown): Ditto. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::cancelComposition): Confirm the given string to cancel the composition. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Remove SetComposition message and rename ConfirmComposition as CancelComposition since it's now only used for canceling. 2019-12-22 Simon Fraser <simon.fraser@apple.com> Make support for <dialog> an internal feature, off by default https://bugs.webkit.org/show_bug.cgi?id=205542 Reviewed by Antti Koivisto. Make DialogElementEnabled an internal feature so it shows up in the menus and can be toggled on for experimentation. * Shared/WebPreferences.yaml: 2019-12-21 Simon Fraser <simon.fraser@apple.com> Make support for <dialog> an experimental feature, off by default https://bugs.webkit.org/show_bug.cgi?id=205542 Reviewed by Dean Jackson. Make DialogElementEnabled an experimental feature (off by default). * Shared/WebPreferences.yaml: 2019-12-21 Simon Fraser <simon.fraser@apple.com> Make support for <dialog> an experimental feature, off by default https://bugs.webkit.org/show_bug.cgi?id=205542 Reviewed by Dean Jackson. Make DialogElementEnabled an experimental feature (off by default). * Shared/WebPreferences.yaml: 2019-12-22 Eric Carlson <eric.carlson@apple.com> [Media in GPU process] Add remote media player proxy configuration https://bugs.webkit.org/show_bug.cgi?id=205547 <rdar://problem/58139762> Reviewed by Tim Horton. * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: (WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer): * GPUProcess/media/RemoteMediaPlayerManagerProxy.h: * GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in: * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::RemoteMediaPlayerProxy): (WebKit::RemoteMediaPlayerProxy::getConfiguration): (WebKit::RemoteMediaPlayerProxy::mediaPlayerMediaKeysStorageDirectory const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerReferrer const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerUserAgent const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerSourceApplicationIdentifier const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerNetworkInterfaceName const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerMediaCacheDirectory const): (WebKit::RemoteMediaPlayerProxy::mediaContentTypesRequiringHardwareSupport const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerPreferredAudioCharacteristics const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerShouldUsePersistentCache const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerIsVideo const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerKeyNeeded): (WebKit::RemoteMediaPlayerProxy::mediaPlayerGetRawCookies const): * GPUProcess/media/RemoteMediaPlayerProxy.h: (WebKit::RemoteMediaPlayerProxy::mediaPlayerLogIdentifier): * GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h: Added. (WebKit::RemoteMediaPlayerProxyConfiguration::encode const): (WebKit::RemoteMediaPlayerProxyConfiguration::decode): * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote): (WebKit::MediaPlayerPrivateRemote::engineDescription const): (WebKit::MediaPlayerPrivateRemote::supportsScanning const): (WebKit::MediaPlayerPrivateRemote::supportsPictureInPicture const): (WebKit::MediaPlayerPrivateRemote::supportsAcceleratedRendering const): (WebKit::MediaPlayerPrivateRemote::canPlayToWirelessPlaybackTarget const): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/RemoteMediaPlayerConfiguration.h: Added. (WebKit::RemoteMediaPlayerConfiguration::encode const): (WebKit::RemoteMediaPlayerConfiguration::decode): * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer): 2019-12-21 Brian Burg <bburg@apple.com> Web Inspector: add InspectedTargetTypes diagnostic event and related hooks https://bugs.webkit.org/show_bug.cgi?id=205174 <rdar://problem/57887953> Reviewed by Devin Rousso. This change supplies Web Inspector with information about the debuggable that it is connected to. This is used for diagnostics and to customize the UI based on the target type being inspected. For remote Web Inspector, WebKit clients can populate an instance of _WKInspectorDebuggableInfo and use it when calling into -[_WKRemoteWebInspectorViewController loadForDebuggable:backendCommandsURL:]. For local Web Inspector, WebInspectorProxy fills in information for the local debuggable by consulting SystemVersion.plist (on Mac port). The new enum _WKInspectorDebuggableType replaces _WKRemoteWebInspectorDebuggableType. Its WebCore equivalent is Inspector::DebuggableType. The type and other information are carried around in a _WKInspectorDebuggableInfo class. The equivalents for this class are API::DebuggableInfo and DebuggableInfoData (for sending over IPC). The DebuggableInfoData is sent as part of the initial message from UIProcess to an Inspector WebProcess, similar to how a debuggableType string was sent before. * Sources.txt: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: Add new files. * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): Add new object type. * Shared/WebCoreArgumentCoders.h: Add EnumTraits for Inspector::DebuggableType. * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewControllerPrivate.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (legacyDebuggableTypeToModernDebuggableType): (-[_WKRemoteWebInspectorViewController loadForDebuggableType:backendCommandsURL:]): (-[_WKRemoteWebInspectorViewController loadForDebuggable:backendCommandsURL:]): (debuggableTypeString): Deleted. Use the new enum in a new method that clients can switch over to. The old method can be removed when it is no longer being used. * UIProcess/RemoteWebInspectorProxy.h: * UIProcess/RemoteWebInspectorProxy.cpp: (WebKit::RemoteWebInspectorProxy::RemoteWebInspectorProxy): (WebKit::RemoteWebInspectorProxy::load): (WebKit::RemoteWebInspectorProxy::reopen): Send DebuggableInfoData struct to RemoteWebInspectorUI. * UIProcess/WebInspectorProxy.h: * UIProcess/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::openLocalInspectorFrontend): (WebKit::WebInspectorProxy::infoForLocalDebuggable): Send DebuggableInfoData struct to WebInspectorUI. * UIProcess/mac/WebInspectorProxyMac.mm: (WebKit::systemVersionPlist): (WebKit::WebInspectorProxy::infoForLocalDebuggable): Add Mac implementation for local debuggables. * UIProcess/gtk/WebInspectorProxyGtk.cpp: (WebKit::WebInspectorProxy::infoForLocalDebuggable): * UIProcess/win/WebInspectorProxyWin.cpp: (WebKit::WebInspectorProxy::infoForLocalDebuggable): * UIProcess/wpe/WebInspectorProxyWPE.cpp: (WebKit::WebInspectorProxy::infoForLocalDebuggable): Add stubs for other platforms. * UIProcess/glib/RemoteInspectorClient.cpp: * UIProcess/socket/RemoteInspectorClient.h: * UIProcess/socket/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::inspect): (WebKit::debuggableTypeToString): (WebKit::RemoteInspectorClient::setTargetList): Use Inspector::DebuggableType instead of String for debuggable type. * WebProcess/WebPage/RemoteWebInspectorUI.messages.in: * WebProcess/WebPage/RemoteWebInspectorUI.h: * WebProcess/WebPage/RemoteWebInspectorUI.cpp: (WebKit::RemoteWebInspectorUI::initialize): (WebKit::RemoteWebInspectorUI::debuggableType const): (WebKit::RemoteWebInspectorUI::targetPlatformName const): (WebKit::RemoteWebInspectorUI::targetBuildVersion const): (WebKit::RemoteWebInspectorUI::targetProductVersion const): (WebKit::RemoteWebInspectorUI::targetIsSimulator const): Implement new methods needed by InspectorFrontendClient / InspectorFrontendHost. * WebProcess/WebPage/WebInspectorUI.messages.in: * WebProcess/WebPage/WebInspectorUI.h: * WebProcess/WebPage/WebInspectorUI.cpp: (WebKit::WebInspectorUI::establishConnection): (WebKit::WebInspectorUI::targetPlatformName const): (WebKit::WebInspectorUI::targetBuildVersion const): (WebKit::WebInspectorUI::targetProductVersion const): Implement new methods needed by InspectorFrontendClient / InspectorFrontendHost. 2019-12-21 Eric Carlson <eric.carlson@apple.com> [Media in GPU process] Add remote media player configuration https://bugs.webkit.org/show_bug.cgi?id=205541 <rdar://problem/58137418> Reviewed by Simon Fraser. * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: (WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer): * GPUProcess/media/RemoteMediaPlayerManagerProxy.h: * GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in: * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::RemoteMediaPlayerProxy): (WebKit::RemoteMediaPlayerProxy::mediaPlayerMediaKeysStorageDirectory const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerReferrer const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerUserAgent const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerSourceApplicationIdentifier const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerNetworkInterfaceName const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerMediaCacheDirectory const): (WebKit::RemoteMediaPlayerProxy::mediaContentTypesRequiringHardwareSupport const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerPreferredAudioCharacteristics const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerShouldUsePersistentCache const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerIsVideo const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerKeyNeeded): (WebKit::RemoteMediaPlayerProxy::mediaPlayerGetRawCookies const): * GPUProcess/media/RemoteMediaPlayerProxy.h: (WebKit::RemoteMediaPlayerProxy::mediaPlayerLogIdentifier): * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer): 2019-12-21 Kate Cheney <katherine_cheney@apple.com> Add timeStamp to ITP database https://bugs.webkit.org/show_bug.cgi?id=205121 <rdar://problem/57633021> Reviewed by John Wilander. This patch adds support for collecting most-recently-updated timestamps for third-party/first-party domain pairs in the ITP database. It updates the timestamp when new statistics are merged into the database. It then exposes the timestamp via the _getResourceLoadStatisticsDataSummary API. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements): (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationshipList): Changed INSERT OR IGNORE queries to be INSERT OR REPLACE so the timestamp will be replaced upon a new attempted insert into one of the third-party/first-party relationship tables. ResourceLoadStatisticsDatabaseStore::insertDomainRelationshipList now checks for the keyword "REPLACE" to know if another bind is needed to update the timestamp. (WebKit::ResourceLoadStatisticsDatabaseStore::getMostRecentlyUpdatedTimestamp): Queries the most recent time that the third party has appeared as a subframe or subresource under the first party or redirected to the first party. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: (WebKit::ThirdPartyDataForSpecificFirstParty::toString const): Updated the toString to check if the timestamp occured in the last 24 hours for testing purposes. It doesn't print the specific time because it would change for every run and could not be tested. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _setUseITPDatabase:completionHandler:]): Added new function that enables the ITP Database backend so the timestamp parameter can be tested in in TestWebKitAPI. * UIProcess/API/APIResourceLoadStatisticsFirstParty.h: * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/API/Cocoa/_WKResourceLoadStatisticsFirstParty.h: * UIProcess/API/Cocoa/_WKResourceLoadStatisticsFirstParty.mm: (-[_WKResourceLoadStatisticsFirstParty timeLastUpdated]): Added the new timestamp parameter to the _WKResourceLoadStatisticsFirstParty.mm class and its wrapper to be sent via API call. 2019-12-20 Eric Carlson <eric.carlson@apple.com> [Media in GPU process] Get audio playing https://bugs.webkit.org/show_bug.cgi?id=205511 <rdar://problem/58120354> Reviewed by Jer Noble. * GPUProcess/media/RemoteMediaPlayerManagerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::updateCachedState): (WebKit::MediaPlayerPrivateRemote::maximumDurationToCacheMediaTime const): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/RemoteMediaPlayerManager.h: 2019-12-20 Jer Noble <jer.noble@apple.com> Enable HDR Media Capabilities by default https://bugs.webkit.org/show_bug.cgi?id=205518 <rdar://problem/57674289> Reviewed by Eric Carlson. * Shared/WebPreferences.yaml: 2019-12-20 Tim Horton <timothy_horton@apple.com> Clean up and generalize some interaction additions https://bugs.webkit.org/show_bug.cgi?id=205430 Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): (-[WKContentView cleanupInteraction]): 2019-12-20 Tim Horton <timothy_horton@apple.com> Expose approximate caret extents for the hit line via InteractionInformationAtPosition https://bugs.webkit.org/show_bug.cgi?id=205526 <rdar://problem/57983076> Reviewed by Dean Jackson. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::positionInformation): Compute and expose the union of first and last caret rects on the line. * Shared/ios/InteractionInformationAtPosition.h: * Shared/ios/InteractionInformationAtPosition.mm: (WebKit::InteractionInformationAtPosition::encode const): (WebKit::InteractionInformationAtPosition::decode): * Shared/ios/InteractionInformationRequest.cpp: (WebKit::InteractionInformationRequest::encode const): (WebKit::InteractionInformationRequest::decode): (WebKit::InteractionInformationRequest::isValidForRequest): * Shared/ios/InteractionInformationRequest.h: Also, add a bit so that we can only fetch this data when needed. 2019-12-20 Brent Fulgham <bfulgham@apple.com> Remove access to 'com.apple.cfprefsd.agent' from the macOS sandbox https://bugs.webkit.org/show_bug.cgi?id=205478 <rdar://problem/57915066> Reviewed by Darin Adler. Telemetry and thorough testing has confirmed that we do not need access to this mach service, and so should remove it. Tested by fast/sandboxing/mac * WebProcess/com.apple.WebProcess.sb.in: 2019-12-20 Brian Burg <bburg@apple.com> Unreviewed, try to fix the non-unified sources build. * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: (WebKit::MockAuthenticatorManager::filterTransports const): The current chunking of unified source files seems to provide a 'using namespace WebCore' for these references to AuthenticatorTransport. Add a namespace qualification so that this file compiles by itself. 2019-12-20 James Savage <james.savage@apple.com> Include WKPDFConfiguration, WKFindConfiguration, and WKFindResult in umbrella header https://bugs.webkit.org/show_bug.cgi?id=205432 <rdar://problem/58067946> Reviewed by Wenson Hsieh. * Shared/API/Cocoa/WebKit.h: Include new headers. 2019-12-20 Brian Burg <bburg@apple.com> Web Inspector: convert some InspectorFrontendHost methods to getters https://bugs.webkit.org/show_bug.cgi?id=205475 Reviewed by Devin Rousso. No reason for these to be method calls, so expose as getters / attributes instead. * WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp: (WebKit::WebInspectorUI::localizedStringsURL const): (WebKit::RemoteWebInspectorUI::localizedStringsURL const): (WebKit::WebInspectorUI::localizedStringsURL): Deleted. (WebKit::RemoteWebInspectorUI::localizedStringsURL): Deleted. * WebProcess/WebPage/mac/WebInspectorUIMac.mm: (WebKit::WebInspectorUI::localizedStringsURL const): (WebKit::RemoteWebInspectorUI::localizedStringsURL const): (WebKit::WebInspectorUI::localizedStringsURL): Deleted. (WebKit::RemoteWebInspectorUI::localizedStringsURL): Deleted. * WebProcess/WebPage/win/WebInspectorUIWin.cpp: (WebKit::WebInspectorUI::localizedStringsURL const): (WebKit::RemoteWebInspectorUI::localizedStringsURL const): (WebKit::WebInspectorUI::localizedStringsURL): Deleted. (WebKit::RemoteWebInspectorUI::localizedStringsURL): Deleted. * WebProcess/WebPage/wpe/WebInspectorUIWPE.cpp: (WebKit::WebInspectorUI::localizedStringsURL const): (WebKit::RemoteWebInspectorUI::localizedStringsURL const): (WebKit::WebInspectorUI::localizedStringsURL): Deleted. (WebKit::RemoteWebInspectorUI::localizedStringsURL): Deleted. 2019-12-20 Alex Christensen <achristensen@webkit.org> Allow a managed configuration to re-enable TLS 1.0 and 1.1 https://bugs.webkit.org/show_bug.cgi?id=205479 <rdar://problem/54493516> Reviewed by Geoffrey Garen. * Platform/spi/ios/ManagedConfigurationSPI.h: Removed. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView canPerformActionForWebView:withSender:]): (-[WKContentView _defineForWebView:]): * WebKit.xcodeproj/project.pbxproj: 2019-12-20 youenn fablet <youenn@apple.com> Set whether to use mock capture devices at GPUProcess creation time. https://bugs.webkit.org/show_bug.cgi?id=205492 Reviewed by Eric Carlson. This ensures UIProcess remains always in sync with GPUProcess. Covered by fast/mediastream/captureAudioInGPUProcess.html. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::initializeGPUProcess): (WebKit::GPUProcess::setMockCaptureDevicesEnabled): * GPUProcess/GPUProcess.h: * GPUProcess/GPUProcessCreationParameters.cpp: (WebKit::GPUProcessCreationParameters::encode const): (WebKit::GPUProcessCreationParameters::decode): * GPUProcess/GPUProcessCreationParameters.h: * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::singleton): 2019-12-19 Brent Fulgham <bfulgham@apple.com> Log telemetry for IOUserClient lookups https://bugs.webkit.org/show_bug.cgi?id=205463 <rdar://problem/57987372> Reviewed by Per Arne Vollan. This patch adds some telemetry for IOKit classes. No new tests. No change in behavior. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2019-12-19 Chris Dumez <cdumez@apple.com> Use a WeakHashSet for WKProcessAssertionBackgroundTaskManager._assertionsNeedingBackgroundTask https://bugs.webkit.org/show_bug.cgi?id=205471 Reviewed by Ryosuke Niwa. Use a WeakHashSet for WKProcessAssertionBackgroundTaskManager._assertionsNeedingBackgroundTask, instead of a HashSet of raw pointers, for extra safety. * UIProcess/ios/ProcessAssertionIOS.mm: (-[WKProcessAssertionBackgroundTaskManager removeAssertionNeedingBackgroundTask:]): (-[WKProcessAssertionBackgroundTaskManager _notifyAssertionsOfImminentSuspension]): (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]): 2019-12-19 Brent Fulgham <bfulgham@apple.com> Unblock iokit-get-property needed for frame buffer initialization https://bugs.webkit.org/show_bug.cgi?id=205468 <rdar://problem/57897684> Reviewed by Per Arne Vollan. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-12-19 Brent Fulgham <bfulgham@apple.com> Add telemetry to macOS WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=205464 <rdar://problem/58087833> Reviewed by Per Arne Vollan. Add telemetry to various mach lookups, like we did for iOS. No new tests. No change in behavior. * WebProcess/com.apple.WebProcess.sb.in: 2019-12-19 Per Arne Vollan <pvollan@apple.com> REGRESSION (r253530): Incorrect colors in Dark Mode https://bugs.webkit.org/show_bug.cgi?id=205457 Unreviewed rollout of r253530. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2019-12-19 Alex Christensen <achristensen@webkit.org> Deprecate _WKRemoteObjectInterface methods without ofReply: https://bugs.webkit.org/show_bug.cgi?id=205073 Reviewed by Timothy Hatcher. Using them makes it hard to figure out how to add classes allowed for the reply, and there's a comment saying to deprecate them, so let's do it. * Shared/API/Cocoa/_WKRemoteObjectInterface.h: 2019-12-19 Brent Fulgham <bfulgham@apple.com> WebContent process does not need access to 'com.apple.system.logger' https://bugs.webkit.org/show_bug.cgi?id=205411 <rdar://problem/56966080> Reviewed by Per Arne Vollan. Telemetry and thorough testing has confirmed that we do not need access to this mach service, and so should remove it. Tested by fast/sandbox. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2019-12-19 Brent Fulgham <bfulgham@apple.com> Deny mach lookup access to "com.apple.TextInput" in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=205423 <rdar://problem/56990842> Reviewed by Per Arne Vollan. Telemetry and thorough testing has confirmed that we do not need access to this mach service, and so should remove it. Tested by fast/sandbox/ios/sandbox-mach-lookup.html. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-12-19 youenn fablet <youenn@apple.com> CacheStorageEngine should not clear caches memory representation for ephemeral sessions https://bugs.webkit.org/show_bug.cgi?id=205332 Reviewed by Chris Dumez. * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::dispose): We cannot dispose an ephemeral cache memory representation since it can be reopened by a page with the same session. 2019-12-19 Brent Fulgham <bfulgham@apple.com> Deny mach lookup access to "com.apple.pluginkit.pkd" in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=205421 <rdar://problem/56995585> Reviewed by Per Arne Vollan. Telemetry and thorough testing has confirmed that we do not need access to this mach service, and so should remove it. Tested by fast/sandbox/ios/sandbox-mach-lookup.html. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-12-19 Brent Fulgham <bfulgham@apple.com> Remove syscall filtering from GPU Process sandbox https://bugs.webkit.org/show_bug.cgi?id=205456 <rdar://problem/58080834> Reviewed by Tim Horton. We don't have a fully built-out GPU Process yet. Let's not lock down the syscall filter set until we know which are actually needed by the process. The current set is just copied over from the WebContent process, and are not likely to be the correct set. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: 2019-12-19 Chris Dumez <cdumez@apple.com> imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-installed.https.html is flaky https://bugs.webkit.org/show_bug.cgi?id=205408 Reviewed by Youenn Fablet. * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: (WebKit::WebSWServerToContextConnection::didFinishSkipWaiting): Deleted. * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::skipWaiting): (WebKit::WebSWContextManagerConnection::didFinishSkipWaiting): Deleted. * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/Storage/WebSWContextManagerConnection.messages.in: 2019-12-19 Chris Dumez <cdumez@apple.com> Stop blocking the worker thread in WorkerMessagePortChannelProvider::postMessageToRemote() https://bugs.webkit.org/show_bug.cgi?id=205414 Reviewed by Youenn Fablet. * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.cpp: (WebKit::WebMessagePortChannelProvider::postMessageToRemote): * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.h: 2019-12-19 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Add initial API for input method https://bugs.webkit.org/show_bug.cgi?id=204679 Reviewed by Žan Doberšek. In the case of GTK port, it allows to use a custom IM instead of GtkIMContext that it's still used by default. In the case of WPE it brings IM support, but there's no default implementation so applications need to provide their own. * PlatformGTK.cmake: Add new public header WebKitInputMethodContext.h. * PlatformWPE.cmake: Ditto. * Shared/EditorState.cpp: (WebKit::EditorState::PostLayoutData::encode const): Encode caretRectAtStart for WPE too. (WebKit::EditorState::PostLayoutData::decode): Decode caretRectAtStart for WPE too. (WebKit::operator<<): Dump caretRectAtStart for WPE too. * Shared/EditorState.h: Define caretRectAtStart for WPE too. * Shared/NativeWebKeyboardEvent.h: (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): Remove FakedForComposition parameter for GTK and add HandledByInputMethod to WPE. * Shared/WebEvent.h: * Shared/WebKeyboardEvent.cpp: (WebKit::WebKeyboardEvent::WebKeyboardEvent): Add handledByInputMethod parameter for WPE. (WebKit::WebKeyboardEvent::encode const): Encode m_handledByInputMethod in WPE too. (WebKit::WebKeyboardEvent::decode): Decode m_handledByInputMethod in WPE too. * Shared/gtk/NativeWebKeyboardEventGtk.cpp: (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): Remove FakedForComposition and the redundant members that are already in the bcase class or no longer needed. * Shared/libwpe/NativeWebKeyboardEventLibWPE.cpp: (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): Add text and handledByInputMethod parameters * Shared/libwpe/WebEventFactory.cpp: (WebKit::WebEventFactory::createWebKeyboardEvent): Use the given text if not null and pass handledByInputMethod, to WebKeyboardEvent. * Shared/libwpe/WebEventFactory.h: * SourcesGTK.txt: Add new files to compilation. * SourcesWPE.txt: Ditto. * UIProcess/API/glib/InputMethodFilter.cpp: Added. (WebKit::InputMethodFilter::~InputMethodFilter): (WebKit::InputMethodFilter::preeditStartedCallback): (WebKit::InputMethodFilter::preeditChangedCallback): (WebKit::InputMethodFilter::preeditFinishedCallback): (WebKit::InputMethodFilter::committedCallback): (WebKit::InputMethodFilter::setContext): (WebKit::InputMethodFilter::setEnabled): (WebKit::InputMethodFilter::filterKeyEvent): (WebKit::InputMethodFilter::isViewFocused const): (WebKit::InputMethodFilter::notifyFocusedIn): (WebKit::InputMethodFilter::notifyFocusedOut): (WebKit::InputMethodFilter::notifyCursorRect): (WebKit::InputMethodFilter::preeditStarted): (WebKit::InputMethodFilter::preeditChanged): (WebKit::InputMethodFilter::preeditFinished): (WebKit::InputMethodFilter::committed): (WebKit::InputMethodFilter::cancelComposition): * UIProcess/API/glib/InputMethodFilter.h: Added. (WebKit::InputMethodFilter::context const): * UIProcess/API/glib/WebKitInputMethodContext.cpp: Added. (webkitInputMethodUnderlineGetCompositionUnderline): (webkit_input_method_underline_new): (webkit_input_method_underline_copy): (webkit_input_method_underline_free): (webkitInputMethodContextSetWebView): (webkitInputMethodContextGetWebView): (webkit_input_method_context_set_enable_preedit): (webkit_input_method_context_get_preedit): (webkit_input_method_context_notify_focus_in): (webkit_input_method_context_notify_focus_out): (webkit_input_method_context_notify_cursor_area): (webkit_input_method_context_reset): * UIProcess/API/glib/WebKitInputMethodContextPrivate.h: Added. (_WebKitInputMethodUnderline::_WebKitInputMethodUnderline): * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewConstructed): (webkitWebViewSynthesizeCompositionKeyPress): (webkitWebViewSetComposition): (webkitWebViewConfirmComposition): (webkitWebViewCancelComposition): (webkit_web_view_set_input_method_context): (webkit_web_view_get_input_method_context): * UIProcess/API/glib/WebKitWebViewPrivate.h: * UIProcess/API/gtk/InputMethodFilterGtk.cpp: Added. (WebKit::InputMethodFilter::platformTransformCursorRectToViewCoordinates): (WebKit::InputMethodFilter::platformEventKeyIsKeyPress const): * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::doneWithKeyEvent): Remove the early return in case of fake event, composition events are always handled by the web process. * UIProcess/API/gtk/WebKitInputMethodContext.h: Added. * UIProcess/API/gtk/WebKitInputMethodContextGtk.cpp: Added. (webkit_input_method_underline_set_color): (webkit_input_method_context_filter_key_event): * UIProcess/API/gtk/WebKitInputMethodContextImplGtk.cpp: Added. (contextPreeditStartCallback): (contextPreeditChangedCallback): (contextPreeditEndCallback): (contextCommitCallback): (webkitInputMethodContextImplGtkConstructed): (webkitInputMethodContextImplGtkSetEnablePreedit): (webkitInputMethodContextImplGtkGetPreedit): (webkitInputMethodContextImplGtkFilterKeyEvent): (webkitInputMethodContextImplGtkNotifyFocusIn): (webkitInputMethodContextImplGtkNotifyFocusOut): (webkitInputMethodContextImplGtkNotifyCursorArea): (webkitInputMethodContextImplGtkReset): (webkit_input_method_context_impl_gtk_class_init): (webkitInputMethodContextImplGtkNew): (webkitInputMethodContextImplGtkSetClientWindow): * UIProcess/API/gtk/WebKitInputMethodContextImplGtk.h: Added. * UIProcess/API/gtk/WebKitWebView.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseRealize): If current IM filter is the default one, call webkitInputMethodContextImplGtkSetClientWindow(). (webkitWebViewBaseUnrealize): Ditto. (webkitWebViewBaseDispose): Set a nullptr context on IM filter. (webkitWebViewBaseKeyPressEvent): Use the new IM filter that simplifies the code. (webkitWebViewBaseKeyReleaseEvent): Ditto. (webkitWebViewBaseHandleMouseEvent): Cancel composition in case of click. (webkitWebViewBaseCreateWebPage): The new IM filter doesn't need to know the page. (webkitWebViewBaseUpdateTextInputState): Use new IM filter API. (webkitWebViewBaseSetInputMethodContext): Set the IM filter context. (webkitWebViewBaseGetInputMethodContext): Get the IM filter context. (webkitWebViewBaseSynthesizeCompositionKeyPress): Synthesize a key event for composition. * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: * UIProcess/API/gtk/webkit2.h: * UIProcess/API/wpe/InputMethodFilterWPE.cpp: Added. (WebKit::InputMethodFilter::platformTransformCursorRectToViewCoordinates): (WebKit::InputMethodFilter::platformEventKeyIsKeyPress const): * UIProcess/API/wpe/PageClientImpl.cpp: (WebKit::PageClientImpl::setInputMethodState): (WebKit::PageClientImpl::selectionDidChange): * UIProcess/API/wpe/PageClientImpl.h: * UIProcess/API/wpe/WPEView.cpp: (WKWPE::View::setInputMethodContext): Set the IM filter context. (WKWPE::View::inputMethodContext const): Get the IM filter context. (WKWPE::View::setInputMethodState): Enable or disable input methods. (WKWPE::View::selectionDidChange): Notify the IM filter about the cursor position change. (WKWPE::View::setViewState): Notify the IM filter about the focus change. (WKWPE::View::handleKeyboardEvent): Allow the IM filter to handle the key event. (WKWPE::View::synthesizeCompositionKeyPress): Synthesize a key event for composition. * UIProcess/API/wpe/WPEView.h: * UIProcess/API/wpe/WebKitInputMethodContext.h: Added. * UIProcess/API/wpe/WebKitInputMethodContextWPE.cpp: Added. (webkit_input_method_underline_set_color): (webkit_input_method_context_filter_key_event): * UIProcess/API/wpe/WebKitWebView.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: * UIProcess/API/wpe/docs/wpe-docs.sgml: * UIProcess/API/wpe/webkit.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/gtk/InputMethodFilter.cpp: Removed. * UIProcess/gtk/InputMethodFilter.h: Removed. * UIProcess/wpe/WebPageProxyWPE.cpp: (WebKit::WebPageProxy::updateEditorState): Save the editor state and notify about selection change. (WebKit::WebPageProxy::setInputMethodState): Notify the page client about the input method state. * WebProcess/WebCoreSupport/WebEditorClient.cpp: (WebKit::WebEditorClient::setInputMethodState): Implement this for WPE too. * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp: (WebKit::WebEditorClient::handleInputMethodKeydown): Use handledByInputMethod() now. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/wpe/WebPageWPE.cpp: (WebKit::WebPage::platformEditorState const): Save the current caret cursor rectangle in post layout data struct. (WebKit::WebPage::setInputMethodState): Send SetInputMethodState message to the UI process if state changed. 2019-12-19 Carlos Garcia Campos <cgarcia@igalia.com> [CoordinatedGraphics] ThreadedDisplayRefreshMonitor is never released https://bugs.webkit.org/show_bug.cgi?id=205387 Reviewed by Žan Doberšek. Update the window screen ID after creating the layer tree host to ensure that the call to createDisplayRefreshMonitor will create the ThreadedDisplayRefrershMonitor instead of the default one. * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode): Use the dispalyID of the layer tree host. * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp: (WebKit::LayerTreeHost::LayerTreeHost): Initialize the display ID. * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: 2019-12-18 Sihui Liu <sihui_liu@apple.com> IndexedDB: perform IDBServer work only on background thread https://bugs.webkit.org/show_bug.cgi?id=203690 <rdar://problem/56908496> Reviewed by Alex Christensen. * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: (WebKit::WebIDBConnectionToClient::~WebIDBConnectionToClient): * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::create): (WebKit::WebIDBServer::WebIDBServer): (WebKit::WebIDBServer::closeAndDeleteDatabasesModifiedSince): (WebKit::WebIDBServer::closeAndDeleteDatabasesForOrigins): (WebKit::WebIDBServer::suspend): (WebKit::WebIDBServer::resume): (WebKit::WebIDBServer::openDatabase): (WebKit::WebIDBServer::deleteDatabase): (WebKit::WebIDBServer::abortTransaction): (WebKit::WebIDBServer::commitTransaction): (WebKit::WebIDBServer::didFinishHandlingVersionChangeTransaction): (WebKit::WebIDBServer::createObjectStore): (WebKit::WebIDBServer::deleteObjectStore): (WebKit::WebIDBServer::renameObjectStore): (WebKit::WebIDBServer::clearObjectStore): (WebKit::WebIDBServer::createIndex): (WebKit::WebIDBServer::deleteIndex): (WebKit::WebIDBServer::renameIndex): (WebKit::WebIDBServer::putOrAdd): (WebKit::WebIDBServer::getRecord): (WebKit::WebIDBServer::getAllRecords): (WebKit::WebIDBServer::getCount): (WebKit::WebIDBServer::deleteRecord): (WebKit::WebIDBServer::openCursor): (WebKit::WebIDBServer::iterateCursor): (WebKit::WebIDBServer::establishTransaction): (WebKit::WebIDBServer::databaseConnectionPendingClose): (WebKit::WebIDBServer::databaseConnectionClosed): (WebKit::WebIDBServer::abortOpenAndUpgradeNeeded): (WebKit::WebIDBServer::didFireVersionChangeEvent): (WebKit::WebIDBServer::openDBRequestCancelled): (WebKit::WebIDBServer::getAllDatabaseNames): (WebKit::WebIDBServer::addConnection): (WebKit::WebIDBServer::removeConnection): (WebKit::WebIDBServer::postTask): (WebKit::WebIDBServer::dispatchToThread): (WebKit::WebIDBServer::registerConnection): Deleted. (WebKit::WebIDBServer::unregisterConnection): Deleted. (WebKit::WebIDBServer::confirmDidCloseFromServer): Deleted. * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/IndexedDB/WebIDBServer.messages.in: * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::prepareToSuspend): * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp: (WebKit::WebIDBConnectionToServer::confirmDidCloseFromServer): Deleted. * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h: 2019-12-18 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r253646. https://bugs.webkit.org/show_bug.cgi?id=205433 "We think this may have caused a membuster regression, so rolling it out." (Requested by nham on #webkit). Reverted changeset: "Navigation from empty page doesn't use cached web process" https://bugs.webkit.org/show_bug.cgi?id=205015 https://trac.webkit.org/changeset/253646 2019-12-18 Alex Christensen <achristensen@webkit.org> Add SPI WKWebView._updateWebpagePreferences to replace _updateWebsitePolicies https://bugs.webkit.org/show_bug.cgi?id=205427 Reviewed by Wenson Hsieh. This blocks the removal of _WKWebsitePolicies. This change is verified by an API test. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _updateWebsitePolicies:]): (-[WKWebView _updateWebpagePreferences:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: 2019-12-18 Tim Horton <timothy_horton@apple.com> macCatalyst: Cursor should update when the platform deems it necessary https://bugs.webkit.org/show_bug.cgi?id=205429 <rdar://problem/57983076> Reviewed by Wenson Hsieh. * Shared/ios/InteractionInformationAtPosition.h: * Shared/ios/InteractionInformationAtPosition.mm: (WebKit::InteractionInformationAtPosition::encode const): (WebKit::InteractionInformationAtPosition::decode): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::positionInformation): Expose the current cursor and caret size on position information so that macCatalyst UIKit can retrieve it out-of-band (in addition to setting it when we do a hit-test, like in r253636. 2019-12-18 Alex Christensen <achristensen@webkit.org> Add ObjC version of WKBundleFrameIsMainFrame https://bugs.webkit.org/show_bug.cgi?id=205415 Reviewed by Brian Weinstein. I need this for rdar://problem/57132290 Covered by API tests. * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h: * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm: (-[WKWebProcessPlugInFrame isMainFrame]): * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h: 2019-12-18 Eric Carlson <eric.carlson@apple.com> Remove more unused MediaPlayer methods https://bugs.webkit.org/show_bug.cgi?id=205405 <rdar://problem/58049744> Reviewed by Jer Noble. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerHandlePlaybackCommand): Deleted. (WebKit::RemoteMediaPlayerProxy::mediaPlayerIsInMediaDocument const): Deleted. * GPUProcess/media/RemoteMediaPlayerProxy.h: 2019-12-18 youenn fablet <youenn@apple.com> Add support for Audio Capture in GPUProcess https://bugs.webkit.org/show_bug.cgi?id=205056 Reviewed by Eric Carlson. Make UserMediaCaptureManager and Proxy able to work with GPU process. Add support for capturing audio in the GPU process, this is limited to mock audio sources for now as we do not support AudioSession in the GPU process. Covered by rebased test. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess): (WebKit::GPUConnectionToWebProcess::didReceiveMessage): (WebKit::GPUConnectionToWebProcess::didReceiveSyncMessage): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::setMockCaptureDevicesEnabled): * GPUProcess/GPUProcess.h: * GPUProcess/GPUProcess.messages.in: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::UserMediaCaptureManagerProxy): (WebKit::UserMediaCaptureManagerProxy::~UserMediaCaptureManagerProxy): (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): (WebKit::UserMediaCaptureManagerProxy::applyConstraints): (WebKit::UserMediaCaptureManagerProxy::clone): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h: (WebKit::UserMediaCaptureManagerProxy::didReceiveMessageFromGPUProcess): (WebKit::UserMediaCaptureManagerProxy::didReceiveSyncMessageFromGPUProcess): * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs const): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::didReceiveMessage): * WebProcess/GPU/GPUProcessConnection.h: * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::Source::setShouldCaptureInGPUProcess): (WebKit::UserMediaCaptureManager::Source::shouldCaptureInGPUProcess const): (WebKit::UserMediaCaptureManager::Source::requestToEnd): (WebKit::UserMediaCaptureManager::createCaptureSource): (WebKit::UserMediaCaptureManager::sourceStopped): (WebKit::UserMediaCaptureManager::captureFailed): (WebKit::UserMediaCaptureManager::Source::connection): (WebKit::UserMediaCaptureManager::Source::startProducingData): (WebKit::UserMediaCaptureManager::Source::stopProducingData): (WebKit::UserMediaCaptureManager::Source::capabilities): (WebKit::UserMediaCaptureManager::Source::applyConstraints): (WebKit::UserMediaCaptureManager::sourceEnded): (WebKit::UserMediaCaptureManager::Source::hasEnded): (WebKit::UserMediaCaptureManager::Source::stopBeingObserved): (WebKit::UserMediaCaptureManager::AudioFactory::createAudioCaptureSource): * WebProcess/cocoa/UserMediaCaptureManager.h: (WebKit::UserMediaCaptureManager::didReceiveMessageFromGPUProcess): 2019-12-18 Ben Nham <nham@apple.com> Add network loading signposts https://bugs.webkit.org/show_bug.cgi?id=204822 <rdar://problem/57608824> Reviewed by Alex Christensen. This adds os_signposts related to network loads to aid in debugging networking performance issues. Since URLs are logged in the signposts, this capability is only enabled on Apple internal builds when an environment variable is set. * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::signpostLogHandle): (WebKit::signpostsEnabled): (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::didSendData): (WebKit::NetworkDataTaskCocoa::didReceiveChallenge): (WebKit::NetworkDataTaskCocoa::didCompleteWithError): (WebKit::NetworkDataTaskCocoa::didReceiveData): (WebKit::NetworkDataTaskCocoa::didReceiveResponse): (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): (WebKit::NetworkDataTaskCocoa::cancel): (WebKit::NetworkDataTaskCocoa::resume): 2019-12-18 youenn fablet <youenn@apple.com> Refine RTCMonitor logging https://bugs.webkit.org/show_bug.cgi?id=205384 Reviewed by Eric Carlson. Catch the case where the rtc thread is blocked in WebProcess and NetworkProcess. Add logging of 'this' so as to disambiguate the case of several pages doing RTC in parallel. No change of behavior. * NetworkProcess/webrtc/NetworkRTCMonitor.cpp: (WebKit::NetworkRTCMonitor::startUpdatingIfNeeded): (WebKit::NetworkRTCMonitor::stopUpdating): (WebKit::NetworkRTCMonitor::onNetworksChanged): * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::NetworkRTCProvider): (WebKit::NetworkRTCProvider::close): (WebKit::NetworkRTCProvider::createSocket): * NetworkProcess/webrtc/NetworkRTCProvider.h: (WebKit::NetworkRTCProvider::canLog const): * WebProcess/Network/webrtc/WebRTCMonitor.cpp: (WebKit::WebRTCMonitor::StartUpdating): (WebKit::WebRTCMonitor::StopUpdating): (WebKit::WebRTCMonitor::networksChanged): 2019-12-18 Kate Cheney <katherine_cheney@apple.com> Only report prevalent domains in the ResourceLoadStatistics data summary API https://bugs.webkit.org/show_bug.cgi?id=205281 <rdar://problem/57975017> Reviewed by Brent Fulgham. ResourceLoadStatisticsStore::aggregatedThirdPartyData() should only return prevalent third party domains. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: 2019-12-18 Brent Fulgham <bfulgham@apple.com> Add syscall to GPU Process sandbox https://bugs.webkit.org/show_bug.cgi?id=205400 <rdar://problem/58046272> Reviewed by Simon Fraser. This patch temporarily adds a syscall to the sandbox to work around a bug in the system Sandbox framework. We will remove this in Bug 205400 once that issue is resolved. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: 2019-12-18 Eric Carlson <eric.carlson@apple.com> Enable generic cue API https://bugs.webkit.org/show_bug.cgi?id=205398 <rdar://problem/58044492> Reviewed by Jon Lee. No new tests, covered by existing tests. * Shared/WebPreferences.yaml: 2019-12-18 Eric Carlson <eric.carlson@apple.com> Remove unused MediaPlayer methods https://bugs.webkit.org/show_bug.cgi?id=205341 <rdar://problem/58006776> Reviewed by Jer Noble. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerSawUnsupportedTracks): Deleted. (WebKit::RemoteMediaPlayerProxy::mediaPlayerRepaint): Deleted. (WebKit::RemoteMediaPlayerProxy::mediaPlayerAcceleratedCompositingEnabled): Deleted. (WebKit::RemoteMediaPlayerProxy::mediaPlayerSetSize): Deleted. (WebKit::RemoteMediaPlayerProxy::mediaPlayerIsPaused const): Deleted. (WebKit::RemoteMediaPlayerProxy::mediaPlayerIsLooping const): Deleted. * GPUProcess/media/RemoteMediaPlayerProxy.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::canLoadPoster const): Deleted. (WebKit::MediaPlayerPrivateRemote::setPoster): Deleted. * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: 2019-12-18 Simon Fraser <simon.fraser@apple.com> Move m_exposedContentRect into the DelegatedScrollingGeometry optional https://bugs.webkit.org/show_bug.cgi?id=205377 Reviewed by Tim Horton. ScrollView's m_exposedContentRect is only set for delegated scrolling, so move it into DelegatedScrollingGeometry and remove the iOS #ifdefs around it. Move the WAK/NSView-related code into platformExposedContentRect() for iOS WK1. Stub out exposedContentRect() functions on TiledCoreAnimationDrawingArea. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::setExposedContentRect): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange): (WebKit::TiledCoreAnimationDrawingArea::setViewExposedRect): (WebKit::TiledCoreAnimationDrawingArea::exposedContentRect const): (WebKit::TiledCoreAnimationDrawingArea::setExposedContentRect): (WebKit::TiledCoreAnimationDrawingArea::adjustLayerFlushThrottling): 2019-12-18 Wenson Hsieh <wenson_hsieh@apple.com> Enable the async clipboard API by default on macOS and iOS https://bugs.webkit.org/show_bug.cgi?id=205322 <rdar://problem/55861627> Reviewed by Tim Horton. Enables the asynchronous clipboard API by default on Cocoa platforms. * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.h: 2019-12-18 Philippe Normand <pnormand@igalia.com> [GTK][WebInspector] Support for saving remote data https://bugs.webkit.org/show_bug.cgi?id=204618 Reviewed by Carlos Garcia Campos. Similarly to what landed already in r251069, the Remote WebInspector GTK client can now save data coming from the inspector server. * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp: (WebKit::RemoteWebInspectorProxy::platformSave): 2019-12-17 Joonghun Park <jh718.park@samsung.com> Unreviewed. Remove the build warning below since r253452. warning: unused variable ‘isNewEntry’ [-Wunused-variable] No new tests, no new behavioral changes. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::addConnection): 2019-12-17 Per Arne Vollan <pvollan@apple.com> Unreviewed build fix after r253661. * UIProcess/ios/forms/WKFileUploadPanel.mm: 2019-12-17 Per Arne Vollan <pvollan@apple.com> [iOS] The WebContent process should not use API to get the user interface idiom https://bugs.webkit.org/show_bug.cgi?id=205236 Reviewed by Brent Fulgham. This should be done in the UI process, since using the API in the WebContent process will connect to daemons we intend to block access to. Add a flag to the process creation parameters which indicates whether the user interface idiom is iPad or not. This flag will be set on the UI process side, and on the WebContent process side, this flag will be read and cached for later use. No new tests, covered by existing tests. * Platform/spi/ios/UIKitSPI.h: (currentUserInterfaceIdiomIsPad): Deleted. * Shared/UserInterfaceIdiom.h: Added. * Shared/UserInterfaceIdiom.mm: Added. (WebKit::userInterfaceIdiomIsPad): (WebKit::currentUserInterfaceIdiomIsPad): (WebKit::setCurrentUserInterfaceIdiomIsPad): * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * Shared/ios/WebPreferencesDefaultValuesIOS.mm: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/ios/SmartMagnificationController.mm: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKFormInputSession setAccessoryViewCustomButtonTitle:]): (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]): (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]): (-[WKContentView _zoomToRevealFocusedElement]): (-[WKContentView requiresAccessoryView]): (-[WKContentView _updateAccessory]): (shouldShowKeyboardForElement): (-[WKContentView _shouldUseLegacySelectPopoverDismissalBehavior]): * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm: * UIProcess/ios/WebPageProxyIOS.mm: * UIProcess/ios/forms/WKFormColorControl.mm: (-[WKFormColorControl initWithView:]): * UIProcess/ios/forms/WKFormColorPicker.mm: * UIProcess/ios/forms/WKFormInputControl.mm: * UIProcess/ios/forms/WKFormSelectControl.mm: * WebKit.xcodeproj/project.pbxproj: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2019-12-17 Eric Carlson <eric.carlson@apple.com> Add remote media player methods for prepareToPlay, preload, private browsing mode, preserves pitch, and failed to load https://bugs.webkit.org/show_bug.cgi?id=205351 <rdar://problem/58018451> Reviewed by Jer Noble. * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: (WebKit::RemoteMediaPlayerManagerProxy::prepareToPlay): (WebKit::RemoteMediaPlayerManagerProxy::setPreload): (WebKit::RemoteMediaPlayerManagerProxy::setPrivateBrowsingMode): (WebKit::RemoteMediaPlayerManagerProxy::setPreservesPitch): * GPUProcess/media/RemoteMediaPlayerManagerProxy.h: * GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in: * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::prepareToPlay): (WebKit::RemoteMediaPlayerProxy::setPreload): (WebKit::RemoteMediaPlayerProxy::setPrivateBrowsingMode): (WebKit::RemoteMediaPlayerProxy::setPreservesPitch): * GPUProcess/media/RemoteMediaPlayerProxy.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::prepareToPlay): (WebKit::MediaPlayerPrivateRemote::setPreservesPitch): (WebKit::MediaPlayerPrivateRemote::setPreload): (WebKit::MediaPlayerPrivateRemote::setPrivateBrowsingMode): (WebKit::MediaPlayerPrivateRemote::engineFailedToLoad): (WebKit::MediaPlayerPrivateRemote::platformErrorCode const): Deleted. (WebKit::MediaPlayerPrivateRemote::requiresImmediateCompositing const): Deleted. * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::engineFailedToLoad): * WebProcess/GPU/media/RemoteMediaPlayerManager.h: * WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in: 2019-12-17 Kate Cheney <katherine_cheney@apple.com> Add run-time flag for in-app browser privacy https://bugs.webkit.org/show_bug.cgi?id=205288 <rdar://problem/57569206> Reviewed by John Wilander. * Shared/WebPreferences.yaml: 2019-12-17 Ben Nham <nham@apple.com> Navigation from empty page doesn't use cached web process https://bugs.webkit.org/show_bug.cgi?id=205015 <rdar://problem/57703742> Reviewed by Chris Dumez. When navigating from an empty page to another domain foo.com, we always use the source WebProcess (which is basically uninitialized) rather than using an already-initialized cached WebProcess that has navigated to foo.com. The cached WebProcess should probably be preferred since it has more relevant cached resources available to it (e.g. memory cache, JS bytecode cache, prewarmed fonts, ...). Added an API test. * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _ensureRunningProcessForTesting]): Allows tests to force WebProcess to launch to an empty document for testing purposes. This matches the behavior of how Safari uses WKWebView. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigationInternal): Prefer cached web process over source process if the source process hasn't committed any loads. 2019-12-17 Benjamin Nham <nham@apple.com> Drop support for NSURLCache callbacks in NetworkProcess https://bugs.webkit.org/show_bug.cgi?id=203344 Reviewed by Alex Christensen. Remove the NSURLSession caching policy callback in NetworkProcess. It's no longer necessary since we don't use NSURLCache in NetworkProcess (https://bugs.webkit.org/show_bug.cgi?id=185990). * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:dataTask:willCacheResponse:completionHandler:]): Deleted. 2019-12-17 David Kilzer <ddkilzer@apple.com> Remove SafeBrowsingResult <https://webkit.org/b/205296> Reviewed by Anders Carlsson. * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Remove. * UIProcess/SafeBrowsingResult.h: Remove. 2019-12-17 youenn fablet <youenn@apple.com> WebKitTestRunner should report GPU process crashes https://bugs.webkit.org/show_bug.cgi?id=205338 Reviewed by Tim Horton. Expose a callback to notify of GPU process crash. No change of behavior. * UIProcess/API/C/WKContext.h: * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::gpuProcessCrashed): * UIProcess/WebContextClient.cpp: (WebKit::WebContextClient::gpuProcessDidCrash): * UIProcess/WebContextClient.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::gpuProcessCrashed): * UIProcess/WebProcessPool.h: 2019-12-17 Tim Horton <timothy_horton@apple.com> macCatalyst: Cursor should update on mouse movement and style change https://bugs.webkit.org/show_bug.cgi?id=205317 <rdar://problem/46793696> Reviewed by Anders Carlsson. * Configurations/WebKit.xcconfig: Link AppKit for NSCursor. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<Cursor>::decode): Enable Cursor encoders. * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::setCursor): * WebProcess/WebCoreSupport/WebChromeClient.cpp: * WebProcess/WebCoreSupport/WebChromeClient.h: Unifdef various things. Implement setCursor(). 2019-12-17 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] IndexedDB directory set in WebsiteDataManager is ignored https://bugs.webkit.org/show_bug.cgi?id=205330 Reviewed by Youenn Fablet. There are two problems here: 1- WebKitWebsiteDataManager is no longer setting the indexedDB directory to the WebsiteDatastore configuration. It seems the code was removed by mistake in r249778 when rolling out r249768. 2- The WebProcessPool is not considering the primary WebsiteDataStore for indexedDB configuration. Fixes: /webkit/WebKitWebsiteData/databases /webkit/WebKitWebsiteData/configuration * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkitWebsiteDataManagerGetDataStore): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): 2019-12-17 youenn fablet <youenn@apple.com> Bump the priority of CacheStorageEngine write operations https://bugs.webkit.org/show_bug.cgi?id=205329 Reviewed by Antti Koivisto. Introduce an IOChannel extra optional parameter to set the QOS. Use this parameter for IOChannels created by CacheStorageEngine when writing files to increase the priority to default. Increase the priority of the CacheStorageEngine background queue to default. No observable change of behavior except potential speed increase. * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::Engine): (WebKit::CacheStorage::Engine::writeFile): * NetworkProcess/cache/NetworkCacheIOChannel.h: (WebKit::NetworkCache::IOChannel::open): * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm: (WebKit::NetworkCache::dispatchQueueFromPriority): (WebKit::NetworkCache::IOChannel::IOChannel): (WebKit::NetworkCache::IOChannel::open): * NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp: (WebKit::NetworkCache::IOChannel::open): * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp: (WebKit::NetworkCache::IOChannel::open): 2019-12-17 youenn fablet <youenn@apple.com> WebKitTestRunner should report service worker process crashes https://bugs.webkit.org/show_bug.cgi?id=205267 Reviewed by Chris Dumez. Expose a way for WTR to be notified of service worker process crashes. * UIProcess/API/C/WKContext.h: * UIProcess/WebContextClient.cpp: (WebKit::WebContextClient::serviceWorkerProcessDidCrash): * UIProcess/WebContextClient.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::serviceWorkerProcessCrashed): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): 2019-12-17 Chris Dumez <cdumez@apple.com> Improve release logging in NetworkResourceLoader https://bugs.webkit.org/show_bug.cgi?id=205295 Reviewed by Youenn Fablet. Improve release logging in NetworkResourceLoader to facilitate debugging of loading-related issues. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::start): (WebKit::NetworkResourceLoader::retrieveCacheEntry): (WebKit::NetworkResourceLoader::retrieveCacheEntryInternal): (WebKit::NetworkResourceLoader::startNetworkLoad): (WebKit::NetworkResourceLoader::cleanup): (WebKit::NetworkResourceLoader::convertToDownload): (WebKit::NetworkResourceLoader::abort): (WebKit::NetworkResourceLoader::didReceiveResponse): (WebKit::NetworkResourceLoader::didReceiveBuffer): (WebKit::NetworkResourceLoader::didFinishLoading): (WebKit::NetworkResourceLoader::didFailLoading): (WebKit::NetworkResourceLoader::didBlockAuthenticationChallenge): (WebKit::NetworkResourceLoader::willSendRedirectedRequest): (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): (WebKit::NetworkResourceLoader::didFinishWithRedirectResponse): (WebKit::NetworkResourceLoader::restartNetworkLoad): (WebKit::NetworkResourceLoader::continueWillSendRequest): (WebKit::NetworkResourceLoader::continueDidReceiveResponse): (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry): (WebKit::NetworkResourceLoader::didReceiveMainResourceResponse): (WebKit::NetworkResourceLoader::didRetrieveCacheEntry): (WebKit::NetworkResourceLoader::sendResultForCacheEntry): (WebKit::NetworkResourceLoader::validateCacheEntry): (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry): (WebKit::NetworkResourceLoader::startWithServiceWorker): (WebKit::NetworkResourceLoader::serviceWorkerDidNotHandle): 2019-12-16 Simon Fraser <simon.fraser@apple.com> Change 'delegatesPageScaling' from a Setting to a flag on ScrollView https://bugs.webkit.org/show_bug.cgi?id=205319 Reviewed by Tim Horton. delegatesPageScaling() is never toggled at runtime (even by tests), and it should be a flag on FrameView just like delegatesScrolling (maybe in future the flags can merge). So remove the Setting, and have DrawingArea control whether page scaling is delegated. In WebKit1, WebFrameLoaderClient::transitionToCommittedForNewPage() turns on delegated page scaling for iOS. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::usesDelegatedPageScaling const): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): * WebProcess/WebPage/ios/FindControllerIOS.mm: (WebKit::FindIndicatorOverlayClientIOS::drawRect): 2019-12-16 Wenson Hsieh <wenson_hsieh@apple.com> -[UIWKDocumentContext markedTextRange] is wrong when the caret is not at the start of marked text https://bugs.webkit.org/show_bug.cgi?id=205302 Reviewed by Tim Horton. Makes a few minor adjustments around marked text handling in document editing context request code. 1. In the case where markedTextRects are requested, automatically expand the context range (i.e. contextBefore and contextAfter) to encompass the marked text. This fixes UIWKDocumentContext's logic that computes the marked text range by subtracting `contextBefore` string's length from `selectedRangeInMarkedText`'s location. (Note that this still requires an adjustment in UIKit to actually respect `selectedRangeInMarkedText` when computing `markedTextRange`. This is tracked in <rdar://problem/57338528>). 2. Stop clamping compositionStart and compositionEnd to the range of interest (in this case, the selection range, which is a collapsed caret selection). This makes the composition range seem as if it were empty, which prevents us from computing the marked text string (and importantly, its length). 3. Flip the arguments to `distanceBetweenPositions`, such that we end up with a positive value for `selectedRangeInMarkedText` in the case where `compositionStart` is before `startOfRangeOfInterestInSelection`. Test: DocumentEditingContext.RequestMarkedTextRectsAndTextOnly * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestDocumentEditingContext): 2019-12-16 Per Arne Vollan <pvollan@apple.com> [iOS] Issue mach lookup extension to diagnostics daemon https://bugs.webkit.org/show_bug.cgi?id=205292 Reviewed by Brent Fulgham. For internal installs, issue a mach lookup extension to the diagnostics daemon. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::isInternalInstall): (WebKit::WebProcessPool::platformInitializeWebProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2019-12-16 Daniel Bates <dabates@apple.com> Reproducible case of backwards nextParagraph returning a position ahead of the input position https://bugs.webkit.org/show_bug.cgi?id=196127 <rdar://problem/49135890> Reviewed by Wenson Hsieh. Remove workaround now that WebCore::nextParagraphBoundaryInDirection() behaves correctly. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::moveByGranularityRespectingWordBoundary): 2019-12-16 youenn fablet <youenn@apple.com> Make ServiceWorkerSoftUpdateLoader::loadWithCacheEntry more robust https://bugs.webkit.org/show_bug.cgi?id=205202 rdar://problem/57852910 Reviewed by Chris Dumez. In case loading an entry from the cache, we were calling didReceiveResponse, which may destroy the loader and then continue processing. Instead, add a processResponse method that checks the response and returns an error if needed. didReceiveResponse calls this method and returns early in case of error. So does the method loading data from the cache. Covered by existing tests. * NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp: (WebKit::ServiceWorkerSoftUpdateLoader::loadWithCacheEntry): (WebKit::ServiceWorkerSoftUpdateLoader::didReceiveResponse): (WebKit::ServiceWorkerSoftUpdateLoader::processResponse): * NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.h: 2019-12-16 Antti Koivisto <antti@apple.com> Remove display:contents feature flag https://bugs.webkit.org/show_bug.cgi?id=205276 Reviewed by Ryosuke Niwa. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetDisplayContentsEnabled): Deleted. (WKPreferencesGetDisplayContentsEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: 2019-12-16 Wenson Hsieh <wenson_hsieh@apple.com> Fix API availability for -_getResourceLoadStatisticsDataSummary: after r253484 https://bugs.webkit.org/show_bug.cgi?id=205256 Reviewed by Alex Christensen. Replaces WK_API_AVAILABLE(macos(10.15), ios(13.0)) with WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)), since this is new WebKit SPI that hasn't made its way into the SDK. * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: 2019-12-16 Daniel Bates <dabates@apple.com> -requestDocumentContext always returns 1 text unit more granularity than requested https://bugs.webkit.org/show_bug.cgi?id=205142 <rdar://problem/57858236> Reviewed by Darin Adler and Wenson Hsieh. Use WebCore::atBoundaryOfGranularity() to identify each boundary so that we return the position exactly granularityCount text units advanced from the specified position. When using sentence granularity we do not need to round the resulting position to the nearest word because it already falls before the next word (if there is one). For all other granularities we do what we do now and round to the nearest word, which may cross that granularity's boundary. Additionally, added assertions to ensure that we are passed a non-zero granularity count and a non- null initial position. The function takes advantage of these assumptions to 1) ensure correct results and 2) make use of a do-while loop. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::moveByGranularityRespectingWordBoundary): 2019-12-16 Simon Fraser <simon.fraser@apple.com> Let the DrawingArea decide whether scrolling is delegated https://bugs.webkit.org/show_bug.cgi?id=205258 Reviewed by Anders Carlsson. Delegated scrolling was hardcoded on for iOS WK2 (as it is for iOS WK1) and off for macOS, but if macOS is using RemoteLayerTreeDrawingArea that should also use delegated scrolling. Also make some DrawingArea functions const, and put m_frame->coreFrame()->view() into a local RefPtr in WebFrameLoaderClient::transitionToCommittedForNewPage(). * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::supportsAsyncScrolling const): (WebKit::DrawingArea::usesDelegatedScrolling const): (WebKit::DrawingArea::shouldUseTiledBackingForFrameView const): (WebKit::DrawingArea::supportsAsyncScrolling): Deleted. (WebKit::DrawingArea::shouldUseTiledBackingForFrameView): Deleted. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::shouldUseTiledBackingForFrameView const): (WebKit::RemoteLayerTreeDrawingArea::shouldUseTiledBackingForFrameView): Deleted. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView const): (WebKit::TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView): Deleted. 2019-12-16 Eric Carlson <eric.carlson@apple.com> Log when unimplemented remote MediaPlayer methods are called https://bugs.webkit.org/show_bug.cgi?id=205269 <rdar://problem/57967733> Reviewed by Youenn Fablet. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerPlaybackStateChanged): (WebKit::RemoteMediaPlayerProxy::mediaPlayerSawUnsupportedTracks): (WebKit::RemoteMediaPlayerProxy::mediaPlayerResourceNotSupported): (WebKit::RemoteMediaPlayerProxy::mediaPlayerRepaint): (WebKit::RemoteMediaPlayerProxy::mediaPlayerSizeChanged): (WebKit::RemoteMediaPlayerProxy::mediaPlayerEngineUpdated): (WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable): (WebKit::RemoteMediaPlayerProxy::mediaPlayerCharacteristicChanged): (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingCanBeAccelerated): (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged): (WebKit::RemoteMediaPlayerProxy::mediaPlayerAcceleratedCompositingEnabled): (WebKit::RemoteMediaPlayerProxy::mediaPlayerActiveSourceBuffersChanged): (WebKit::RemoteMediaPlayerProxy::mediaPlayerCachedKeyForKeyId const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerKeyNeeded): (WebKit::RemoteMediaPlayerProxy::mediaPlayerMediaKeysStorageDirectory const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerInitializationDataEncountered): (WebKit::RemoteMediaPlayerProxy::mediaPlayerWaitingForKeyChanged): (WebKit::RemoteMediaPlayerProxy::mediaPlayerCurrentPlaybackTargetIsWirelessChanged): (WebKit::RemoteMediaPlayerProxy::mediaPlayerReferrer const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerUserAgent const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerEnterFullscreen): (WebKit::RemoteMediaPlayerProxy::mediaPlayerExitFullscreen): (WebKit::RemoteMediaPlayerProxy::mediaPlayerIsFullscreen const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerIsFullscreenPermitted const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerIsVideo const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerContentBoxRect const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerContentsScale const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerSetSize): (WebKit::RemoteMediaPlayerProxy::mediaPlayerPause): (WebKit::RemoteMediaPlayerProxy::mediaPlayerPlay): (WebKit::RemoteMediaPlayerProxy::mediaPlayerPlatformVolumeConfigurationRequired const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerIsPaused const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerIsLooping const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerCachedResourceLoader): (WebKit::RemoteMediaPlayerProxy::mediaPlayerCreateResourceLoader): (WebKit::RemoteMediaPlayerProxy::doesHaveAttribute const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerShouldUsePersistentCache const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerMediaCacheDirectory const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidAddAudioTrack): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidAddTextTrack): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidAddVideoTrack): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidRemoveAudioTrack): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidRemoveTextTrack): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidRemoveVideoTrack): (WebKit::RemoteMediaPlayerProxy::textTrackRepresentationBoundsChanged): (WebKit::RemoteMediaPlayerProxy::outOfBandTrackSources): (WebKit::RemoteMediaPlayerProxy::mediaPlayerNetworkInterfaceName const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerGetRawCookies const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerHandlePlaybackCommand): (WebKit::RemoteMediaPlayerProxy::mediaPlayerSourceApplicationIdentifier const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerIsInMediaDocument const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerEngineFailedToLoad const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerRequestedPlaybackRate const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerFullscreenMode const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerIsVideoFullscreenStandby const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerPreferredAudioCharacteristics const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerShouldDisableSleep const): (WebKit::RemoteMediaPlayerProxy::mediaContentTypesRequiringHardwareSupport const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerShouldCheckHardwareSupport const): * GPUProcess/media/RemoteMediaPlayerProxy.h: 2019-12-16 Kate Cheney <katherine_cheney@apple.com> Add NS_UNAVAILABLE tags to prevent alloc inits for _WKResourceLoadStatistics* classes https://bugs.webkit.org/show_bug.cgi?id=205221 Reviewed by Anders Carlsson. This patch ensures that no one tries to alloc init _WKResourceLoadStatisticsFirstParty or _WKResourceLoadStatisticsThirdParty. They should only be created via the API call to create(). * UIProcess/API/Cocoa/_WKResourceLoadStatisticsFirstParty.h: * UIProcess/API/Cocoa/_WKResourceLoadStatisticsThirdParty.h: 2019-12-16 youenn fablet <youenn@apple.com> http/wpt/service-workers/postMessage-fetch-order.https.html is a flaky failure after r253528 https://bugs.webkit.org/show_bug.cgi?id=205261 Reviewed by Chris Dumez. Instead of starting the fetch task asynchronously, start it synchronously but make sure that not handling the fetch is either coming from IPC or is done asynchronously. We add a boolean m_isDone that ensures that the loader will only be called once for didFail/didFinish/didNotHandle. This covers the potential case of a task for which cannotHandle is called synchronously at creation but the call to didNotHandle is not yet done. Before the call to didNotHandle is done, a timeout timer is firing and will call didNotHandle a first time. The second didNotHandle should be a no-op. Covered by existing tests and unflakes above test. * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: (WebKit::ServiceWorkerFetchTask::contextClosed): (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse): (WebKit::ServiceWorkerFetchTask::didReceiveResponse): (WebKit::ServiceWorkerFetchTask::didReceiveData): (WebKit::ServiceWorkerFetchTask::didReceiveFormData): (WebKit::ServiceWorkerFetchTask::didFinish): (WebKit::ServiceWorkerFetchTask::didFail): (WebKit::ServiceWorkerFetchTask::didNotHandle): Make sure to call didNotHandle only once based on m_isDone. (WebKit::ServiceWorkerFetchTask::cannotHandle): Do not expose didNotHandle as a public method. Instead expose cannotHandle that will call didNotHandle asynchronously. (WebKit::ServiceWorkerFetchTask::continueFetchTaskWith): No need to set a timer if we will not create a fetch event. * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h: (WebKit::ServiceWorkerFetchTask::takeRequest): * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::startFetch): * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: (WebKit::WebSWServerToContextConnection::fetchTaskTimedOut): Small refactoring to only use contextClosed and not expose whether the task is handled or not. This also potentially allows to call didNotHandle in case the service worker crashed before answering the fetch event. 2019-12-16 Emilio Cobos Álvarez <emilio@crisal.io> [GTK] Build with USE_WPE_RENDERER=No fails with undefined EGL_WAYLAND_BUFFER_WL https://bugs.webkit.org/show_bug.cgi?id=205250 Reviewed by Carlos Garcia Campos. Define the enum if not present. No new tests, just a build fix. * UIProcess/gtk/WaylandCompositor.cpp: 2019-12-16 youenn fablet <youenn@apple.com> Reset cached getUserMedia queries when calling stopMediaCapture https://bugs.webkit.org/show_bug.cgi?id=205064 Reviewed by Eric Carlson. Reset cached queries when calling stop media capture API allows to trigger again the prompt after the API call. Covered by updated API test. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::resetAccess): * UIProcess/UserMediaPermissionRequestManagerProxy.h: (WebKit::UserMediaPermissionRequestManagerProxy::resetAccess): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::stopMediaCapture): 2019-12-15 Wenson Hsieh <wenson_hsieh@apple.com> -[WKWebView _detectDataWithTypes:completionHandler:] crashes when there is no running process https://bugs.webkit.org/show_bug.cgi?id=205254 Reviewed by Tim Horton. Bail early and call the completion handler in the case where we don't have a running web process, to avoid a null `Connection*` deref. Speculative fix for <rdar://problem/57463469>. * UIProcess/WebPageProxy.cpp: 2019-12-14 Adrian Perez de Castro <aperez@igalia.com> [GTK][WPE] Fix various non-unified build issues introduced since r251698 https://bugs.webkit.org/show_bug.cgi?id=204891 Reviewed by Alex Christensen. * NetworkProcess/IndexedDB/WebIDBServer.cpp: Add missing WebCore namespace prefixes in function declarations. (WebKit::WebIDBServer::create): (WebKit::WebIDBServer::WebIDBServer): (WebKit::WebIDBServer::closeAndDeleteDatabasesForOrigins): (WebKit::WebIDBServer::suspend): (WebKit::WebIDBServer::idFireVersionChangeEvent): * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::requestSpace): Add missing namespace prefix for WebCore::ClientOrigin. * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp: Add missing inclusion of WebCore/RegistrableDomain.h (WebKit::NetworkCache::SubresourceInfo::isFirstParty const): Add missing namespace prefix for WebCore::RegistrableDomain. * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::setFilesForInputFileUpload): Add missing namespace prefix for WebCore::File::create() and WebCore::FileList::create() calls. 2019-12-14 Simon Fraser <simon.fraser@apple.com> Rename "customFixedPositionRect" to "layoutViewportRect" https://bugs.webkit.org/show_bug.cgi?id=205241 Reviewed by Dean Jackson. WK2 computes the rect used to layout out position:fixed elements in the UI process. For historical reasons this was called customFixedPositionRect, but rename it to layoutViewportRect since that what it really is. * Shared/VisibleContentRectUpdateInfo.cpp: (WebKit::VisibleContentRectUpdateInfo::encode const): (WebKit::VisibleContentRectUpdateInfo::decode): (WebKit::operator<<): * Shared/VisibleContentRectUpdateInfo.h: (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo): (WebKit::VisibleContentRectUpdateInfo::layoutViewportRect const): (WebKit::operator==): (WebKit::VisibleContentRectUpdateInfo::customFixedPositionRect const): Deleted. * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: (WebKit::RemoteScrollingCoordinatorProxy::currentLayoutViewport const): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::layoutViewportRect const): (WebKit::WebPageProxy::customFixedPositionRect const): Deleted. * UIProcess/ios/WKContentView.mm: (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): (-[WKContentView _didCommitLayerTree:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::computeLayoutViewportRect const): (WebKit::WebPageProxy::unconstrainedLayoutViewportRect const): (WebKit::WebPageProxy::computeCustomFixedPositionRect const): Deleted. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::updateVisibleContentRects): 2019-12-14 Per Arne Vollan <pvollan@apple.com> Map CSS value ID to system color in the UI process https://bugs.webkit.org/show_bug.cgi?id=204314 <rdar://problem/57295392> Reviewed by Brent Fulgham. Create mapping between CSS value IDs and system colors in the UI process and send to the WebContent process on process startup. No new tests, covered by existing tests. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2019-12-14 Per Arne Vollan <pvollan@apple.com> [iOS] Deny mach lookup access to "*.viewservice" in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=205240 Reviewed by Brent Fulgham. As part of sandbox hardening in the WebContent process, mach lookup access to “*.viewservice” should be removed. Test: fast/sandbox/ios/sandbox-mach-lookup.html * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-12-14 Chris Dumez <cdumez@apple.com> WebSWServerConnection::startFetch() should never fail synchronously https://bugs.webkit.org/show_bug.cgi?id=205225 <rdar://problem/57490508> Reviewed by Geoffrey Garen. WebSWServerConnection::startFetch() should never fail synchronously. If it does, it will confuse the NetworkResourceLoader. NetworkResourceLoader::serviceWorkerDidNotHandle() will get called *before* NetworkResourceLoader::m_serviceWorkerFetchTask has been sent, which means that we would not properly deal with redirects. Worse, the call site which creates the ServiceWorkerFetchTask would then null out m_networkLoad, which would silently cancel the load that WebSWServerConnection::startFetch() started synchronously. No new tests, I am not sure how to test this. It would have to cause a redirect do a URL that has a service worker and then we would have to get WebSWServerConnection::startFetch() to fail synchronously. I think that to fail synchronously, we would have to not find a ServiceWorker with the given ID, or the ServiceWorker's hasTimedOutAnyFetchTasks would have to be set. I added a RELEASE_ASSERT() in NetworkResourceLoader::serviceWorkerDidNotHandle() that would have caught this. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::startFetch): 2019-12-14 Simon Fraser <simon.fraser@apple.com> Move code out of WKWebView.mm into platform-specific files, for easier navigation https://bugs.webkit.org/show_bug.cgi?id=205233 Reviewed by Tim Horton. Move as much platform-specific code out of WKWebView.mm as possible, moving it to WKWebViewMac/WKWebViewIOS. WKWebView (WKPrivate) is split into WKWebView (WKPrivateIOS) and WKWebView (WKPrivateMac) so the implementations of those functions can move. Code that remains in WKWebView.mm is either Cocoa-generic, or implements API. This is entirely cut/paste, other than the addition of -_takeFindStringFromSelectionInternal: for macOS to allow WKWebView.mm to call -takeFindStringFromSelection:. * SourcesCocoa.txt: * UIProcess/API/Cocoa/WKWebView.mm: (hardwareKeyboardAvailabilityChangedCallback): (-[WKWebView setAllowsBackForwardNavigationGestures:]): (-[WKWebView allowsBackForwardNavigationGestures]): (-[WKWebView setPageZoom:]): (-[WKWebView pageZoom]): (toFindOptions): (-[WKWebView findString:withConfiguration:completionHandler:]): (+[WKWebView handlesURLScheme:]): (-[WKWebView setMediaType:]): (-[WKWebView mediaType]): (-[WKWebView scrollView]): (-[WKWebView setAllowsMagnification:]): (-[WKWebView allowsMagnification]): (-[WKWebView setMagnification:centeredAtPoint:]): (-[WKWebView setMagnification:]): (-[WKWebView magnification]): (-[WKWebView printOperationWithPrintInfo:]): (-[WKWebView _showSafeBrowsingWarning:completionHandler:]): (-[WKWebView _clearSafeBrowsingWarning]): (-[WKWebView _clearSafeBrowsingWarningIfForMainFrameNavigation]): (-[WKWebView _internalDoAfterNextPresentationUpdate:withoutWaitingForPainting:withoutWaitingForAnimatedResize:]): (dictionaryRepresentationForEditorState): (nsTextAlignment): (selectionAttributes): (-[WKWebView _didChangeEditorState]): (-[WKWebView _toggleStrikeThrough:]): (-[WKWebView _increaseListLevel:]): (-[WKWebView _decreaseListLevel:]): (-[WKWebView _changeListType:]): (-[WKWebView inputAccessoryView]): (-[WKWebView inputView]): (-[WKWebView inputAssistantItem]): (-[WKWebView _selectionAttributes]): (-[WKWebView _viewportSizeForCSSViewportUnits]): (-[WKWebView _setViewportSizeForCSSViewportUnits:]): (-[WKWebView _inspector]): (-[WKWebView _mainFrame]): (-[WKWebView _isEditable]): (-[WKWebView _setEditable:]): (-[WKWebView _executeEditCommand:argument:completion:]): (-[WKWebView _textManipulationDelegate]): (-[WKWebView _setTextManipulationDelegate:]): (-[WKWebView _startTextManipulationsWithConfiguration:completion:]): (-[WKWebView _completeTextManipulation:completion:]): (-[WKWebView _takeFindStringFromSelection:]): (+[WKWebView _stringForFind]): (+[WKWebView _setStringForFind:]): (-[WKWebView _remoteObjectRegistry]): (-[WKWebView _handle]): (-[WKWebView _observedRenderingProgressEvents]): (-[WKWebView _historyDelegate]): (-[WKWebView _setHistoryDelegate:]): (-[WKWebView _updateMediaPlaybackControlsManager]): (-[WKWebView _canTogglePictureInPicture]): (-[WKWebView _isPictureInPictureActive]): (-[WKWebView _togglePictureInPicture]): (-[WKWebView _closeAllMediaPresentations]): (-[WKWebView _stopMediaCapture]): (-[WKWebView _stopAllMediaPlayback]): (-[WKWebView _suspendAllMediaPlayback]): (-[WKWebView _resumeAllMediaPlayback]): (-[WKWebView _unreachableURL]): (-[WKWebView _mainFrameURL]): (-[WKWebView _loadAlternateHTMLString:baseURL:forUnreachableURL:]): (-[WKWebView _loadData:MIMEType:characterEncodingName:baseURL:userData:]): (-[WKWebView _loadRequest:shouldOpenExternalURLs:]): (-[WKWebView _certificateChain]): (-[WKWebView _committedURL]): (-[WKWebView _MIMEType]): (-[WKWebView _userAgent]): (-[WKWebView _applicationNameForUserAgent]): (-[WKWebView _setApplicationNameForUserAgent:]): (-[WKWebView _customUserAgent]): (-[WKWebView _setCustomUserAgent:]): (-[WKWebView _setUserContentExtensionsEnabled:]): (-[WKWebView _userContentExtensionsEnabled]): (-[WKWebView _webProcessIdentifier]): (-[WKWebView _provisionalWebProcessIdentifier]): (-[WKWebView _webProcessIsResponsive]): (-[WKWebView _killWebContentProcess]): (-[WKWebView _reloadWithoutContentBlockers]): (-[WKWebView _reloadExpiredOnly]): (-[WKWebView _killWebContentProcessAndResetState]): (-[WKWebView _convertRectFromRootViewCoordinates:]): (-[WKWebView _convertRectToRootViewCoordinates:]): (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): (-[WKWebView _focusTextInputContext:completionHandler:]): (-[WKWebView _takePDFSnapshotWithConfiguration:completionHandler:]): (-[WKWebView _sessionStateData]): (-[WKWebView _sessionState]): (-[WKWebView _sessionStateWithFilter:]): (-[WKWebView _restoreFromSessionStateData:]): (-[WKWebView _restoreSessionState:andNavigate:]): (-[WKWebView _close]): (-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]): (-[WKWebView _insertAttachmentWithFileWrapper:contentType:options:completion:]): (-[WKWebView _insertAttachmentWithFileWrapper:contentType:completion:]): (-[WKWebView _attachmentForIdentifier:]): (-[WKWebView _simulateDeviceOrientationChangeWithAlpha:beta:gamma:]): (+[WKWebView _handlesSafeBrowsing]): (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]): (-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:details:completionHandler:]): (+[WKWebView _confirmMalwareSentinel]): (+[WKWebView _visitUnsafeWebsiteSentinel]): (-[WKWebView _isJITEnabled:]): (-[WKWebView _evaluateJavaScriptWithoutUserGesture:completionHandler:]): (-[WKWebView _updateWebsitePolicies:]): (-[WKWebView _allowsRemoteInspection]): (-[WKWebView _setAllowsRemoteInspection:]): (-[WKWebView _remoteInspectionNameOverride]): (-[WKWebView _setRemoteInspectionNameOverride:]): (-[WKWebView _addsVisitedLinks]): (-[WKWebView _setAddsVisitedLinks:]): (-[WKWebView _networkRequestsInProgress]): (layoutMilestones): (-[WKWebView _setObservedRenderingProgressEvents:]): (-[WKWebView _getMainResourceDataWithCompletionHandler:]): (-[WKWebView _getWebArchiveDataWithCompletionHandler:]): (-[WKWebView _getContentsAsStringWithCompletionHandler:]): (-[WKWebView _getContentsAsAttributedStringWithCompletionHandler:]): (-[WKWebView _getApplicationManifestWithCompletionHandler:]): (-[WKWebView _paginationMode]): (-[WKWebView _setPaginationMode:]): (-[WKWebView _paginationBehavesLikeColumns]): (-[WKWebView _setPaginationBehavesLikeColumns:]): (-[WKWebView _pageLength]): (-[WKWebView _setPageLength:]): (-[WKWebView _gapBetweenPages]): (-[WKWebView _setGapBetweenPages:]): (-[WKWebView _paginationLineGridEnabled]): (-[WKWebView _setPaginationLineGridEnabled:]): (-[WKWebView _pageCount]): (-[WKWebView _supportsTextZoom]): (-[WKWebView _textZoomFactor]): (-[WKWebView _setTextZoomFactor:]): (-[WKWebView _pageZoomFactor]): (-[WKWebView _setPageZoomFactor:]): (-[WKWebView _diagnosticLoggingDelegate]): (-[WKWebView _setDiagnosticLoggingDelegate:]): (-[WKWebView _findDelegate]): (-[WKWebView _setFindDelegate:]): (-[WKWebView _countStringMatches:options:maxCount:]): (-[WKWebView _findString:options:maxCount:]): (-[WKWebView _hideFindUI]): (-[WKWebView _saveBackForwardSnapshotForItem:]): (-[WKWebView _inputDelegate]): (-[WKWebView _setInputDelegate:]): (-[WKWebView _isDisplayingStandaloneImageDocument]): (-[WKWebView _isDisplayingStandaloneMediaDocument]): (-[WKWebView _isPlayingAudio]): (-[WKWebView _isShowingNavigationGestureSnapshot]): (-[WKWebView _layoutMode]): (-[WKWebView _setLayoutMode:]): (-[WKWebView _fixedLayoutSize]): (-[WKWebView _setFixedLayoutSize:]): (-[WKWebView _setBackgroundExtendsBeyondPage:]): (-[WKWebView _backgroundExtendsBeyondPage]): (-[WKWebView _viewScale]): (-[WKWebView _setViewScale:]): (-[WKWebView _setMinimumEffectiveDeviceWidth:]): (-[WKWebView _minimumEffectiveDeviceWidth]): (-[WKWebView _setScrollPerformanceDataCollectionEnabled:]): (-[WKWebView _scrollPerformanceDataCollectionEnabled]): (-[WKWebView _scrollPerformanceData]): (-[WKWebView _allowsMediaDocumentInlinePlayback]): (-[WKWebView _setAllowsMediaDocumentInlinePlayback:]): (-[WKWebView _setFullscreenDelegate:]): (-[WKWebView _fullscreenDelegate]): (-[WKWebView _isInFullscreen]): (-[WKWebView _mediaCaptureState]): (-[WKWebView _setMediaCaptureEnabled:]): (-[WKWebView _mediaCaptureEnabled]): (-[WKWebView _setPageMuted:]): (-[WKWebView _removeDataDetectedLinks:]): (-[WKWebView _doAfterNextPresentationUpdate:]): (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]): (toAPIScrollbarStyle): Deleted. (toCoreScrollbarStyle): Deleted. (deviceOrientationForUIInterfaceOrientation): Deleted. (deviceOrientation): Deleted. (-[WKWebView setFrame:]): Deleted. (-[WKWebView setBounds:]): Deleted. (-[WKWebView layoutSubviews]): Deleted. (-[WKWebView _isShowingVideoPictureInPicture]): Deleted. (-[WKWebView _mayAutomaticallyShowVideoPictureInPicture]): Deleted. (-[WKWebView _incrementFocusPreservationCount]): Deleted. (-[WKWebView _decrementFocusPreservationCount]): Deleted. (-[WKWebView _resetFocusPreservationCount]): Deleted. (-[WKWebView _isRetainingActiveFocusedState]): Deleted. (-[WKWebView _effectiveAppearanceIsDark]): Deleted. (-[WKWebView _effectiveUserInterfaceLevelIsElevated]): Deleted. (-[WKWebView _shouldAvoidResizingWhenInputViewBoundsChange]): Deleted. (-[WKWebView _dragInteractionPolicy]): Deleted. (-[WKWebView _setDragInteractionPolicy:]): Deleted. (-[WKWebView _populateArchivedSubviews:]): Deleted. (-[WKWebView _isBackground]): Deleted. (-[WKWebView browsingContextController]): Deleted. (-[WKWebView becomeFirstResponder]): Deleted. (-[WKWebView canBecomeFirstResponder]): Deleted. (-[WKWebView resignFirstResponder]): Deleted. (-[WKWebView canPerformAction:withSender:]): Deleted. (-[WKWebView targetForAction:withSender:]): Deleted. (-[WKWebView willFinishIgnoringCalloutBarFadeAfterPerformingAction]): Deleted. (floorToDevicePixel): Deleted. (pointsEqualInDevicePixels): Deleted. (roundScrollViewContentSize): Deleted. (-[WKWebView _currentContentView]): Deleted. (-[WKWebView _contentProviderRegistry]): Deleted. (-[WKWebView _selectionGranularity]): Deleted. (-[WKWebView _setHasCustomContentView:loadedMIMEType:]): Deleted. (-[WKWebView _didFinishLoadingDataForCustomContentProviderWithSuggestedFilename:data:]): Deleted. (-[WKWebView _handleKeyUIEvent:]): Deleted. (-[WKWebView _willInvokeUIScrollViewDelegateCallback]): Deleted. (-[WKWebView _didInvokeUIScrollViewDelegateCallback]): Deleted. (contentZoomScale): Deleted. (baseScrollViewBackgroundColor): Deleted. (scrollViewBackgroundColor): Deleted. (-[WKWebView _updateScrollViewBackground]): Deleted. (-[WKWebView _videoControlsManagerDidChange]): Deleted. (-[WKWebView _initialContentOffsetForScrollView]): Deleted. (-[WKWebView _contentOffsetAdjustedForObscuredInset:]): Deleted. (-[WKWebView _effectiveObscuredInsetEdgesAffectedBySafeArea]): Deleted. (-[WKWebView _computedObscuredInset]): Deleted. (-[WKWebView _computedContentInset]): Deleted. (-[WKWebView _computedUnobscuredSafeAreaInset]): Deleted. (-[WKWebView _processWillSwapOrDidExit]): Deleted. (-[WKWebView _processWillSwap]): Deleted. (-[WKWebView _processDidExit]): Deleted. (-[WKWebView _didRelaunchProcess]): Deleted. (-[WKWebView _didCommitLoadForMainFrame]): Deleted. (contentOffsetBoundedInValidRange): Deleted. (changeContentOffsetBoundedInValidRange): Deleted. (-[WKWebView visibleRectInViewCoordinates]): Deleted. (areEssentiallyEqualAsFloat): Deleted. (-[WKWebView _didCommitLayerTreeDuringAnimatedResize:]): Deleted. (-[WKWebView _didCommitLayerTree:]): Deleted. (-[WKWebView _layerTreeCommitComplete]): Deleted. (-[WKWebView _couldNotRestorePageState]): Deleted. (-[WKWebView _restorePageScrollPosition:scrollOrigin:previousObscuredInset:scale:]): Deleted. (-[WKWebView _restorePageStateToUnobscuredCenter:scale:]): Deleted. (-[WKWebView _takeViewSnapshot]): Deleted. (-[WKWebView _zoomToPoint:atScale:animated:]): Deleted. (-[WKWebView _zoomToRect:atScale:origin:animated:]): Deleted. (constrainContentOffset): Deleted. (-[WKWebView _scrollToContentScrollPosition:scrollOrigin:]): Deleted. (-[WKWebView _scrollToRect:origin:minimumScrollDistance:]): Deleted. (-[WKWebView _zoomOutWithOrigin:animated:]): Deleted. (-[WKWebView _zoomToInitialScaleWithOrigin:animated:]): Deleted. (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted. (-[WKWebView _initialScaleFactor]): Deleted. (-[WKWebView _contentZoomScale]): Deleted. (-[WKWebView _targetContentZoomScaleForRect:currentScale:fitEntireRect:minimumScale:maximumScale:]): Deleted. (-[WKWebView _zoomToRect:withOrigin:fitEntireRect:minimumScale:maximumScale:minimumScrollDistance:]): Deleted. (-[WKWebView didMoveToWindow]): Deleted. (-[WKWebView _setOpaqueInternal:]): Deleted. (-[WKWebView setOpaque:]): Deleted. (-[WKWebView setBackgroundColor:]): Deleted. (-[WKWebView _allowsDoubleTapGestures]): Deleted. (-[WKWebView _stylusTapGestureShouldCreateEditableImage]): Deleted. (-[WKWebView usesStandardContentView]): Deleted. (-[WKWebView scrollView:contentSizeForZoomScale:withProposedSize:]): Deleted. (-[WKWebView viewForZoomingInScrollView:]): Deleted. (-[WKWebView scrollViewWillBeginZooming:withView:]): Deleted. (-[WKWebView scrollViewWillBeginDragging:]): Deleted. (-[WKWebView _didFinishScrolling]): Deleted. (-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Deleted. (-[WKWebView scrollViewDidEndDragging:willDecelerate:]): Deleted. (-[WKWebView scrollViewDidEndDecelerating:]): Deleted. (-[WKWebView scrollViewDidScrollToTop:]): Deleted. (-[WKWebView _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]): Deleted. (-[WKWebView scrollViewDidScroll:]): Deleted. (-[WKWebView scrollViewDidZoom:]): Deleted. (-[WKWebView scrollViewDidEndZooming:withView:atScale:]): Deleted. (-[WKWebView scrollViewDidEndScrollingAnimation:]): Deleted. (-[WKWebView _scrollViewDidInterruptDecelerating:]): Deleted. (-[WKWebView _enclosingViewForExposedRectComputation]): Deleted. (-[WKWebView _visibleRectInEnclosingView:]): Deleted. (-[WKWebView _visibleContentRect]): Deleted. (-[WKWebView _didScroll]): Deleted. (-[WKWebView _enclosingScrollerScrollingEnded:]): Deleted. (-[WKWebView _scrollViewSystemContentInset]): Deleted. (-[WKWebView activeViewLayoutSize:]): Deleted. (-[WKWebView _dispatchSetViewLayoutSize:]): Deleted. (-[WKWebView _dispatchSetMaximumUnobscuredSize:]): Deleted. (-[WKWebView _dispatchSetDeviceOrientation:]): Deleted. (-[WKWebView _frameOrBoundsChanged]): Deleted. (-[WKWebView _contentRectForUserInteraction]): Deleted. (-[WKWebView _scrollViewIsRubberBanding]): Deleted. (-[WKWebView safeAreaInsetsDidChange]): Deleted. (-[WKWebView _scheduleVisibleContentRectUpdate]): Deleted. (-[WKWebView _scrollViewIsInStableState:]): Deleted. (-[WKWebView _addUpdateVisibleContentRectPreCommitHandler]): Deleted. (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]): Deleted. (scrollViewCanScroll): Deleted. (-[WKWebView _contentBoundsExtendedForRubberbandingWithScale:]): Deleted. (-[WKWebView _updateVisibleContentRects]): Deleted. (-[WKWebView _didStartProvisionalLoadForMainFrame]): Deleted. (activeMaximumUnobscuredSize): Deleted. (activeOrientation): Deleted. (-[WKWebView _cancelAnimatedResize]): Deleted. (-[WKWebView _didCompleteAnimatedResize]): Deleted. (-[WKWebView _didFinishLoadForMainFrame]): Deleted. (-[WKWebView _didFailLoadForMainFrame]): Deleted. (-[WKWebView _didSameDocumentNavigationForMainFrame:]): Deleted. (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]): Deleted. (-[WKWebView _shouldUpdateKeyboardWithInfo:]): Deleted. (-[WKWebView _keyboardWillChangeFrame:]): Deleted. (-[WKWebView _keyboardDidChangeFrame:]): Deleted. (-[WKWebView _keyboardWillShow:]): Deleted. (-[WKWebView _keyboardDidShow:]): Deleted. (-[WKWebView _keyboardWillHide:]): Deleted. (-[WKWebView _windowDidRotate:]): Deleted. (-[WKWebView _contentSizeCategoryDidChange:]): Deleted. (-[WKWebView _contentSizeCategory]): Deleted. (-[WKWebView _accessibilitySettingsDidChange:]): Deleted. (-[WKWebView _isNavigationSwipeGestureRecognizer:]): Deleted. (-[WKWebView _navigationGestureDidBegin]): Deleted. (-[WKWebView _navigationGestureDidEnd]): Deleted. (-[WKWebView _showPasswordViewWithDocumentName:passwordHandler:]): Deleted. (-[WKWebView _hidePasswordView]): Deleted. (-[WKWebView _passwordView]): Deleted. (-[WKWebView _updateScrollViewInsetAdjustmentBehavior]): Deleted. (-[WKWebView _setAvoidsUnsafeArea:]): Deleted. (-[WKWebView _haveSetObscuredInsets]): Deleted. (-[WKWebView acceptsFirstResponder]): Deleted. (-[WKWebView viewWillStartLiveResize]): Deleted. (-[WKWebView viewDidEndLiveResize]): Deleted. (-[WKWebView isFlipped]): Deleted. (-[WKWebView intrinsicContentSize]): Deleted. (-[WKWebView prepareContentInRect:]): Deleted. (-[WKWebView setFrameSize:]): Deleted. (-[WKWebView _web_grantDOMPasteAccess]): Deleted. (-[WKWebView _prepareForImmediateActionAnimation]): Deleted. (-[WKWebView _cancelImmediateActionAnimation]): Deleted. (-[WKWebView _completeImmediateActionAnimation]): Deleted. (-[WKWebView ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): Deleted. (-[WKWebView writeSelectionToPasteboard:types:]): Deleted. (-[WKWebView centerSelectionInVisibleArea:]): Deleted. (-[WKWebView validRequestorForSendType:returnType:]): Deleted. (-[WKWebView readSelectionFromPasteboard:]): Deleted. (-[WKWebView changeFont:]): Deleted. (-[WKWebView changeColor:]): Deleted. (-[WKWebView changeAttributes:]): Deleted. (-[WKWebView startSpeaking:]): Deleted. (-[WKWebView stopSpeaking:]): Deleted. (-[WKWebView showGuessPanel:]): Deleted. (-[WKWebView checkSpelling:]): Deleted. (-[WKWebView changeSpelling:]): Deleted. (-[WKWebView toggleContinuousSpellChecking:]): Deleted. (-[WKWebView isGrammarCheckingEnabled]): Deleted. (-[WKWebView setGrammarCheckingEnabled:]): Deleted. (-[WKWebView toggleGrammarChecking:]): Deleted. (-[WKWebView toggleAutomaticSpellingCorrection:]): Deleted. (-[WKWebView orderFrontSubstitutionsPanel:]): Deleted. (-[WKWebView toggleSmartInsertDelete:]): Deleted. (-[WKWebView isAutomaticQuoteSubstitutionEnabled]): Deleted. (-[WKWebView setAutomaticQuoteSubstitutionEnabled:]): Deleted. (-[WKWebView toggleAutomaticQuoteSubstitution:]): Deleted. (-[WKWebView isAutomaticDashSubstitutionEnabled]): Deleted. (-[WKWebView setAutomaticDashSubstitutionEnabled:]): Deleted. (-[WKWebView toggleAutomaticDashSubstitution:]): Deleted. (-[WKWebView isAutomaticLinkDetectionEnabled]): Deleted. (-[WKWebView setAutomaticLinkDetectionEnabled:]): Deleted. (-[WKWebView toggleAutomaticLinkDetection:]): Deleted. (-[WKWebView isAutomaticTextReplacementEnabled]): Deleted. (-[WKWebView setAutomaticTextReplacementEnabled:]): Deleted. (-[WKWebView toggleAutomaticTextReplacement:]): Deleted. (-[WKWebView uppercaseWord:]): Deleted. (-[WKWebView lowercaseWord:]): Deleted. (-[WKWebView capitalizeWord:]): Deleted. (-[WKWebView _wantsKeyDownForEvent:]): Deleted. (-[WKWebView scrollWheel:]): Deleted. (-[WKWebView swipeWithEvent:]): Deleted. (-[WKWebView mouseMoved:]): Deleted. (-[WKWebView mouseDown:]): Deleted. (-[WKWebView mouseUp:]): Deleted. (-[WKWebView mouseDragged:]): Deleted. (-[WKWebView mouseEntered:]): Deleted. (-[WKWebView mouseExited:]): Deleted. (-[WKWebView otherMouseDown:]): Deleted. (-[WKWebView otherMouseDragged:]): Deleted. (-[WKWebView otherMouseUp:]): Deleted. (-[WKWebView rightMouseDown:]): Deleted. (-[WKWebView rightMouseDragged:]): Deleted. (-[WKWebView rightMouseUp:]): Deleted. (-[WKWebView pressureChangeWithEvent:]): Deleted. (-[WKWebView acceptsFirstMouse:]): Deleted. (-[WKWebView shouldDelayWindowOrderingForEvent:]): Deleted. (-[WKWebView doCommandBySelector:]): Deleted. (-[WKWebView insertText:]): Deleted. (-[WKWebView insertText:replacementRange:]): Deleted. (-[WKWebView inputContext]): Deleted. (-[WKWebView performKeyEquivalent:]): Deleted. (-[WKWebView keyUp:]): Deleted. (-[WKWebView keyDown:]): Deleted. (-[WKWebView flagsChanged:]): Deleted. (-[WKWebView setMarkedText:selectedRange:replacementRange:]): Deleted. (-[WKWebView unmarkText]): Deleted. (-[WKWebView selectedRange]): Deleted. (-[WKWebView hasMarkedText]): Deleted. (-[WKWebView markedRange]): Deleted. (-[WKWebView attributedSubstringForProposedRange:actualRange:]): Deleted. (-[WKWebView characterIndexForPoint:]): Deleted. (-[WKWebView typingAttributesWithCompletionHandler:]): Deleted. (-[WKWebView firstRectForCharacterRange:actualRange:]): Deleted. (-[WKWebView selectedRangeWithCompletionHandler:]): Deleted. (-[WKWebView markedRangeWithCompletionHandler:]): Deleted. (-[WKWebView hasMarkedTextWithCompletionHandler:]): Deleted. (-[WKWebView attributedSubstringForProposedRange:completionHandler:]): Deleted. (-[WKWebView firstRectForCharacterRange:completionHandler:]): Deleted. (-[WKWebView characterIndexForPoint:completionHandler:]): Deleted. (-[WKWebView validAttributesForMarkedText]): Deleted. (-[WKWebView draggedImage:endedAt:operation:]): Deleted. (-[WKWebView draggingEntered:]): Deleted. (-[WKWebView draggingUpdated:]): Deleted. (-[WKWebView draggingExited:]): Deleted. (-[WKWebView prepareForDragOperation:]): Deleted. (-[WKWebView performDragOperation:]): Deleted. (-[WKWebView _hitTest:dragTypes:]): Deleted. (-[WKWebView _windowResizeMouseLocationIsInVisibleScrollerThumb:]): Deleted. (-[WKWebView viewWillMoveToWindow:]): Deleted. (-[WKWebView viewDidMoveToWindow]): Deleted. (-[WKWebView drawRect:]): Deleted. (-[WKWebView isOpaque]): Deleted. (-[WKWebView mouseDownCanMoveWindow]): Deleted. (-[WKWebView viewDidHide]): Deleted. (-[WKWebView viewDidUnhide]): Deleted. (-[WKWebView viewDidChangeBackingProperties]): Deleted. (-[WKWebView _activeSpaceDidChange:]): Deleted. (-[WKWebView accessibilityFocusedUIElement]): Deleted. (-[WKWebView accessibilityHitTest:]): Deleted. (-[WKWebView accessibilityAttributeValue:]): Deleted. (-[WKWebView accessibilityAttributeValue:forParameter:]): Deleted. (-[WKWebView hitTest:]): Deleted. (-[WKWebView conversationIdentifier]): Deleted. (-[WKWebView quickLookWithEvent:]): Deleted. (-[WKWebView addTrackingRect:owner:userData:assumeInside:]): Deleted. (-[WKWebView _addTrackingRect:owner:userData:assumeInside:useTrackingNum:]): Deleted. (-[WKWebView _addTrackingRects:owner:userDataList:assumeInsideList:trackingNums:count:]): Deleted. (-[WKWebView removeTrackingRect:]): Deleted. (-[WKWebView _removeTrackingRects:count:]): Deleted. (-[WKWebView view:stringForToolTip:point:userData:]): Deleted. (-[WKWebView pasteboardChangedOwner:]): Deleted. (-[WKWebView pasteboard:provideDataForType:]): Deleted. (-[WKWebView namesOfPromisedFilesDroppedAtDestination:]): Deleted. (-[WKWebView wantsUpdateLayer]): Deleted. (-[WKWebView updateLayer]): Deleted. (-[WKWebView smartMagnifyWithEvent:]): Deleted. (-[WKWebView magnifyWithEvent:]): Deleted. (-[WKWebView rotateWithEvent:]): Deleted. (-[WKWebView _usePlatformFindUI]): Deleted. (-[WKWebView _setUsePlatformFindUI:]): Deleted. (-[WKWebView _ensureTextFinderClient]): Deleted. (-[WKWebView findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:]): Deleted. (-[WKWebView replaceMatches:withString:inSelectionOnly:resultCollector:]): Deleted. (-[WKWebView scrollFindMatchToVisible:]): Deleted. (-[WKWebView documentContainerView]): Deleted. (-[WKWebView getSelectedText:]): Deleted. (-[WKWebView selectFindMatch:completionHandler:]): Deleted. (-[WKWebView _web_superInputContext]): Deleted. (-[WKWebView _web_superQuickLookWithEvent:]): Deleted. (-[WKWebView _web_superSwipeWithEvent:]): Deleted. (-[WKWebView _web_superMagnifyWithEvent:]): Deleted. (-[WKWebView _web_superSmartMagnifyWithEvent:]): Deleted. (-[WKWebView _web_superRemoveTrackingRect:]): Deleted. (-[WKWebView _web_superAccessibilityAttributeValue:]): Deleted. (-[WKWebView _web_superDoCommandBySelector:]): Deleted. (-[WKWebView _web_superPerformKeyEquivalent:]): Deleted. (-[WKWebView _web_superKeyDown:]): Deleted. (-[WKWebView _web_superHitTest:]): Deleted. (-[WKWebView _web_immediateActionAnimationControllerForHitTestResultInternal:withType:userData:]): Deleted. (-[WKWebView _web_prepareForImmediateActionAnimation]): Deleted. (-[WKWebView _web_cancelImmediateActionAnimation]): Deleted. (-[WKWebView _web_completeImmediateActionAnimation]): Deleted. (-[WKWebView _web_didChangeContentSize:]): Deleted. (-[WKWebView _web_dragDestinationActionForDraggingInfo:]): Deleted. (-[WKWebView _web_didPerformDragOperation:]): Deleted. (-[WKWebView _web_dismissContentRelativeChildWindows]): Deleted. (-[WKWebView _web_dismissContentRelativeChildWindowsWithAnimation:]): Deleted. (-[WKWebView _web_editorStateDidChange]): Deleted. (-[WKWebView _web_gestureEventWasNotHandledByWebCore:]): Deleted. (-[WKWebView filePromiseProvider:fileNameForType:]): Deleted. (-[WKWebView filePromiseProvider:writePromiseToURL:completionHandler:]): Deleted. (-[WKWebView draggingSession:sourceOperationMaskForDraggingContext:]): Deleted. (-[WKWebView draggingSession:endedAtPoint:operation:]): Deleted. (-[WKWebView makeTouchBar]): Deleted. (-[WKWebView candidateListTouchBarItem]): Deleted. (-[WKWebView _web_didAddMediaControlsManager:]): Deleted. (-[WKWebView _web_didRemoveMediaControlsManager]): Deleted. (-[WKWebView _interactWithMediaControlsForTesting]): Deleted. (-[WKWebView _useSystemAppearance]): Deleted. (-[WKWebView _setUseSystemAppearance:]): Deleted. (-[WKWebView _pageRefForTransitionToWKWebView]): Deleted. (-[WKWebView _canChangeFrameLayout:]): Deleted. (-[WKWebView _tryToSwipeWithEvent:ignoringPinnedState:]): Deleted. (-[WKWebView _ignoresNonWheelEvents]): Deleted. (-[WKWebView _setIgnoresNonWheelEvents:]): Deleted. (-[WKWebView _hasActiveVideoForControlsManager]): Deleted. (-[WKWebView _dismissContentRelativeChildWindows]): Deleted. (-[WKWebView _gestureEventWasNotHandledByWebCore:]): Deleted. (-[WKWebView _disableFrameSizeUpdates]): Deleted. (-[WKWebView _enableFrameSizeUpdates]): Deleted. (-[WKWebView _beginDeferringViewInWindowChanges]): Deleted. (-[WKWebView _endDeferringViewInWindowChanges]): Deleted. (-[WKWebView _endDeferringViewInWindowChangesSync]): Deleted. (-[WKWebView _fullScreenPlaceholderView]): Deleted. (-[WKWebView _fullScreenWindow]): Deleted. (-[WKWebView _underlayColor]): Deleted. (-[WKWebView _setUnderlayColor:]): Deleted. (-[WKWebView _setCustomSwipeViews:]): Deleted. (-[WKWebView _setCustomSwipeViewsTopContentInset:]): Deleted. (-[WKWebView _setDidMoveSwipeSnapshotCallback:]): Deleted. (-[WKWebView _setFrame:andScrollBy:]): Deleted. (-[WKWebView _setTotalHeightOfBanners:]): Deleted. (-[WKWebView _totalHeightOfBanners]): Deleted. (-[WKWebView _setShouldSuppressFirstResponderChanges:]): Deleted. (-[WKWebView _setFont:sender:]): Deleted. (-[WKWebView _setFontSize:sender:]): Deleted. (-[WKWebView _setTextColor:sender:]): Deleted. (-[WKWebView _requestActivatedElementAtPosition:completionBlock:]): Deleted. (-[WKWebView _contentVisibleRect]): Deleted. (-[WKWebView _convertPointFromContentsToView:]): Deleted. (-[WKWebView _convertPointFromViewToContents:]): Deleted. (-[WKWebView didStartFormControlInteraction]): Deleted. (-[WKWebView didEndFormControlInteraction]): Deleted. (-[WKWebView _uiTextCaretRect]): Deleted. (-[WKWebView _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:]): Deleted. (-[WKWebView _accessibilityStoreSelection]): Deleted. (-[WKWebView _accessibilityClearSelection]): Deleted. (-[WKWebView _contentViewIsFirstResponder]): Deleted. (-[WKWebView _retainActiveFocusedState]): Deleted. (-[WKWebView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]): Deleted. (-[WKWebView _snapshotLayerContentsForBackForwardListItem:]): Deleted. (-[WKWebView _dataDetectionResults]): Deleted. (-[WKWebView _accessibilityRetrieveSpeakSelectionContent]): Deleted. (-[WKWebView _accessibilityDidGetSpeakSelectionContent:]): Deleted. (-[WKWebView _safeBrowsingWarning]): Deleted. (-[WKWebView _doAfterNextStablePresentationUpdate:]): Deleted. (-[WKWebView _detectDataWithTypes:completionHandler:]): Deleted. (-[WKWebView removeFromSuperview]): Deleted. (-[WKWebView _minimumLayoutSizeOverride]): Deleted. (-[WKWebView _setViewLayoutSizeOverride:]): Deleted. (-[WKWebView _obscuredInsets]): Deleted. (-[WKWebView _setObscuredInsets:]): Deleted. (-[WKWebView _obscuredInsetEdgesAffectedBySafeArea]): Deleted. (-[WKWebView _setObscuredInsetEdgesAffectedBySafeArea:]): Deleted. (-[WKWebView _unobscuredSafeAreaInsets]): Deleted. (-[WKWebView _setUnobscuredSafeAreaInsets:]): Deleted. (-[WKWebView _safeAreaShouldAffectObscuredInsets]): Deleted. (-[WKWebView _setInterfaceOrientationOverride:]): Deleted. (-[WKWebView _interfaceOrientationOverride]): Deleted. (-[WKWebView _clearInterfaceOrientationOverride]): Deleted. (-[WKWebView _maximumUnobscuredSizeOverride]): Deleted. (-[WKWebView _setMaximumUnobscuredSizeOverride:]): Deleted. (-[WKWebView _setAllowsViewportShrinkToFit:]): Deleted. (-[WKWebView _allowsViewportShrinkToFit]): Deleted. (-[WKWebView _beginInteractiveObscuredInsetsChange]): Deleted. (-[WKWebView _endInteractiveObscuredInsetsChange]): Deleted. (-[WKWebView _hideContentUntilNextUpdate]): Deleted. (-[WKWebView _beginAnimatedResizeWithUpdates:]): Deleted. (-[WKWebView _endAnimatedResize]): Deleted. (-[WKWebView _resizeWhileHidingContentWithUpdates:]): Deleted. (-[WKWebView _firePresentationUpdateForPendingStableStatePresentationCallbacks]): Deleted. (-[WKWebView _setOverlaidAccessoryViewsInset:]): Deleted. (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): Deleted. (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:maximumUnobscuredSizeOverride:]): Deleted. (-[WKWebView _clearOverrideLayoutParameters]): Deleted. (viewportArgumentsFromDictionary): Deleted. (-[WKWebView _overrideViewportWithArguments:]): Deleted. (-[WKWebView _viewForFindUI]): Deleted. (-[WKWebView _isDisplayingPDF]): Deleted. (-[WKWebView _dataForDisplayedPDF]): Deleted. (-[WKWebView _suggestedFilenameForDisplayedPDF]): Deleted. (-[WKWebView _webViewPrintFormatter]): Deleted. (toUserInterfaceLayoutDirection): Deleted. (-[WKWebView setSemanticContentAttribute:]): Deleted. (-[WKWebView _drawsBackground]): Deleted. (-[WKWebView _setDrawsBackground:]): Deleted. (-[WKWebView _backgroundColor]): Deleted. (-[WKWebView _setBackgroundColor:]): Deleted. (-[WKWebView _setDrawsTransparentBackground:]): Deleted. (-[WKWebView _inspectorAttachmentView]): Deleted. (-[WKWebView _setInspectorAttachmentView:]): Deleted. (-[WKWebView _setOverlayScrollbarStyle:]): Deleted. (-[WKWebView _overlayScrollbarStyle]): Deleted. (-[WKWebView _windowOcclusionDetectionEnabled]): Deleted. (-[WKWebView _setWindowOcclusionDetectionEnabled:]): Deleted. (-[WKWebView shareSheetDidDismiss:]): Deleted. (-[WKWebView _setOverrideDeviceScaleFactor:]): Deleted. (-[WKWebView _overrideDeviceScaleFactor]): Deleted. (-[WKWebView _setTopContentInset:]): Deleted. (-[WKWebView _topContentInset]): Deleted. (-[WKWebView _pageExtendedBackgroundColor]): Deleted. (-[WKWebView _pinnedState]): Deleted. (-[WKWebView _rubberBandingEnabled]): Deleted. (-[WKWebView _setRubberBandingEnabled:]): Deleted. (-[WKWebView _immediateActionAnimationControllerForHitTestResult:withType:userData:]): Deleted. (-[WKWebView _setAutomaticallyAdjustsContentInsets:]): Deleted. (-[WKWebView _automaticallyAdjustsContentInsets]): Deleted. (-[WKWebView _minimumLayoutWidth]): Deleted. (-[WKWebView _setMinimumLayoutWidth:]): Deleted. (-[WKWebView _shouldExpandContentToViewHeightForAutoLayout]): Deleted. (-[WKWebView _setShouldExpandContentToViewHeightForAutoLayout:]): Deleted. (-[WKWebView _alwaysShowsHorizontalScroller]): Deleted. (-[WKWebView _setAlwaysShowsHorizontalScroller:]): Deleted. (-[WKWebView _alwaysShowsVerticalScroller]): Deleted. (-[WKWebView _setAlwaysShowsVerticalScroller:]): Deleted. (-[WKWebView _printOperationWithPrintInfo:]): Deleted. (-[WKWebView _printOperationWithPrintInfo:forFrame:]): Deleted. (-[WKWebView setUserInterfaceLayoutDirection:]): Deleted. (-[WKWebView _wantsMediaPlaybackControlsView]): Deleted. (-[WKWebView _setWantsMediaPlaybackControlsView:]): Deleted. (-[WKWebView _mediaPlaybackControlsView]): Deleted. (-[WKWebView _addMediaPlaybackControlsView:]): Deleted. (-[WKWebView _removeMediaPlaybackControlsView]): Deleted. (-[WKWebView _prepareForMoveToWindow:completionHandler:]): Deleted. (-[WKWebView _setThumbnailView:]): Deleted. (-[WKWebView _thumbnailView]): Deleted. (-[WKWebView _setIgnoresAllEvents:]): Deleted. (-[WKWebView _ignoresAllEvents]): Deleted. (-[WKWebView _spellCheckerDocumentTag]): Deleted. (-[WKWebView hasFullScreenWindowController]): Deleted. (-[WKWebView closeFullScreenWindowController]): Deleted. (-[WKWebView fullScreenWindowController]): Deleted. (-[WKWebView validateUserInterfaceItem:]): Deleted. (-[WKWebView goBack:]): Deleted. (-[WKWebView goForward:]): Deleted. (-[WKWebView reload:]): Deleted. (-[WKWebView reloadFromOrigin:]): Deleted. (-[WKWebView stopLoading:]): Deleted. (-[WKWebView _printFormatterClass]): Deleted. (-[WKWebView _printProvider]): Deleted. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: * UIProcess/API/ios/WKWebViewIOS.h: Copied from Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h. * UIProcess/API/ios/WKWebViewIOS.mm: Added. (deviceOrientationForUIInterfaceOrientation): (deviceOrientation): (-[WKWebView setFrame:]): (-[WKWebView setBounds:]): (-[WKWebView layoutSubviews]): (-[WKWebView _isShowingVideoPictureInPicture]): (-[WKWebView _mayAutomaticallyShowVideoPictureInPicture]): (-[WKWebView _incrementFocusPreservationCount]): (-[WKWebView _decrementFocusPreservationCount]): (-[WKWebView _resetFocusPreservationCount]): (-[WKWebView _isRetainingActiveFocusedState]): (-[WKWebView _effectiveAppearanceIsDark]): (-[WKWebView _effectiveUserInterfaceLevelIsElevated]): (-[WKWebView _populateArchivedSubviews:]): (-[WKWebView _isBackground]): (-[WKWebView browsingContextController]): (-[WKWebView becomeFirstResponder]): (-[WKWebView canBecomeFirstResponder]): (-[WKWebView resignFirstResponder]): (-[WKWebView canPerformAction:withSender:]): (-[WKWebView targetForAction:withSender:]): (-[WKWebView willFinishIgnoringCalloutBarFadeAfterPerformingAction]): (floorToDevicePixel): (pointsEqualInDevicePixels): (roundScrollViewContentSize): (-[WKWebView _currentContentView]): (-[WKWebView _contentProviderRegistry]): (-[WKWebView _selectionGranularity]): (-[WKWebView _setHasCustomContentView:loadedMIMEType:]): (-[WKWebView _didFinishLoadingDataForCustomContentProviderWithSuggestedFilename:data:]): (-[WKWebView _handleKeyUIEvent:]): (-[WKWebView _willInvokeUIScrollViewDelegateCallback]): (-[WKWebView _didInvokeUIScrollViewDelegateCallback]): (contentZoomScale): (baseScrollViewBackgroundColor): (scrollViewBackgroundColor): (-[WKWebView _updateScrollViewBackground]): (-[WKWebView _videoControlsManagerDidChange]): (-[WKWebView _initialContentOffsetForScrollView]): (-[WKWebView _contentOffsetAdjustedForObscuredInset:]): (-[WKWebView _effectiveObscuredInsetEdgesAffectedBySafeArea]): (-[WKWebView _computedObscuredInset]): (-[WKWebView _computedContentInset]): (-[WKWebView _computedUnobscuredSafeAreaInset]): (-[WKWebView _processWillSwapOrDidExit]): (-[WKWebView _processWillSwap]): (-[WKWebView _processDidExit]): (-[WKWebView _didRelaunchProcess]): (-[WKWebView _didCommitLoadForMainFrame]): (contentOffsetBoundedInValidRange): (changeContentOffsetBoundedInValidRange): (-[WKWebView visibleRectInViewCoordinates]): (areEssentiallyEqualAsFloat): (-[WKWebView _didCommitLayerTreeDuringAnimatedResize:]): (-[WKWebView _didCommitLayerTree:]): (-[WKWebView _layerTreeCommitComplete]): (-[WKWebView _couldNotRestorePageState]): (-[WKWebView _restorePageScrollPosition:scrollOrigin:previousObscuredInset:scale:]): (-[WKWebView _restorePageStateToUnobscuredCenter:scale:]): (-[WKWebView _takeViewSnapshot]): (-[WKWebView _zoomToPoint:atScale:animated:]): (-[WKWebView _zoomToRect:atScale:origin:animated:]): (constrainContentOffset): (-[WKWebView _scrollToContentScrollPosition:scrollOrigin:]): (-[WKWebView _scrollToRect:origin:minimumScrollDistance:]): (-[WKWebView _zoomOutWithOrigin:animated:]): (-[WKWebView _zoomToInitialScaleWithOrigin:animated:]): (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): (-[WKWebView _initialScaleFactor]): (-[WKWebView _contentZoomScale]): (-[WKWebView _targetContentZoomScaleForRect:currentScale:fitEntireRect:minimumScale:maximumScale:]): (-[WKWebView _zoomToRect:withOrigin:fitEntireRect:minimumScale:maximumScale:minimumScrollDistance:]): (-[WKWebView didMoveToWindow]): (-[WKWebView _setOpaqueInternal:]): (-[WKWebView setOpaque:]): (-[WKWebView setBackgroundColor:]): (-[WKWebView _allowsDoubleTapGestures]): (-[WKWebView _stylusTapGestureShouldCreateEditableImage]): (-[WKWebView usesStandardContentView]): (-[WKWebView scrollView:contentSizeForZoomScale:withProposedSize:]): (-[WKWebView viewForZoomingInScrollView:]): (-[WKWebView scrollViewWillBeginZooming:withView:]): (-[WKWebView scrollViewWillBeginDragging:]): (-[WKWebView _didFinishScrolling]): (-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]): (-[WKWebView scrollViewDidEndDragging:willDecelerate:]): (-[WKWebView scrollViewDidEndDecelerating:]): (-[WKWebView scrollViewDidScrollToTop:]): (-[WKWebView _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]): (-[WKWebView scrollViewDidScroll:]): (-[WKWebView scrollViewDidZoom:]): (-[WKWebView scrollViewDidEndZooming:withView:atScale:]): (-[WKWebView scrollViewDidEndScrollingAnimation:]): (-[WKWebView _scrollViewDidInterruptDecelerating:]): (-[WKWebView _visibleRectInEnclosingView:]): (-[WKWebView _visibleContentRect]): (-[WKWebView _didScroll]): (-[WKWebView _enclosingScrollerScrollingEnded:]): (-[WKWebView _scrollViewSystemContentInset]): (-[WKWebView activeViewLayoutSize:]): (-[WKWebView _dispatchSetViewLayoutSize:]): (-[WKWebView _dispatchSetMaximumUnobscuredSize:]): (-[WKWebView _dispatchSetDeviceOrientation:]): (-[WKWebView _frameOrBoundsChanged]): (-[WKWebView _contentRectForUserInteraction]): (-[WKWebView _scrollViewIsRubberBanding]): (-[WKWebView safeAreaInsetsDidChange]): (-[WKWebView _scheduleVisibleContentRectUpdate]): (-[WKWebView _scrollViewIsInStableState:]): (-[WKWebView _addUpdateVisibleContentRectPreCommitHandler]): (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]): (scrollViewCanScroll): (-[WKWebView _contentBoundsExtendedForRubberbandingWithScale:]): (-[WKWebView _updateVisibleContentRects]): (-[WKWebView _didStartProvisionalLoadForMainFrame]): (activeMaximumUnobscuredSize): (activeOrientation): (-[WKWebView _cancelAnimatedResize]): (-[WKWebView _didCompleteAnimatedResize]): (-[WKWebView _didFinishLoadForMainFrame]): (-[WKWebView _didFailLoadForMainFrame]): (-[WKWebView _didSameDocumentNavigationForMainFrame:]): (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]): (-[WKWebView _shouldUpdateKeyboardWithInfo:]): (-[WKWebView _keyboardWillChangeFrame:]): (-[WKWebView _keyboardDidChangeFrame:]): (-[WKWebView _keyboardWillShow:]): (-[WKWebView _keyboardDidShow:]): (-[WKWebView _keyboardWillHide:]): (-[WKWebView _windowDidRotate:]): (-[WKWebView _contentSizeCategoryDidChange:]): (-[WKWebView _accessibilitySettingsDidChange:]): (-[WKWebView _contentSizeCategory]): (-[WKWebView _isNavigationSwipeGestureRecognizer:]): (-[WKWebView _navigationGestureDidBegin]): (-[WKWebView _navigationGestureDidEnd]): (-[WKWebView _showPasswordViewWithDocumentName:passwordHandler:]): (-[WKWebView _hidePasswordView]): (-[WKWebView _passwordView]): (-[WKWebView _updateScrollViewInsetAdjustmentBehavior]): (-[WKWebView _setAvoidsUnsafeArea:]): (-[WKWebView _haveSetObscuredInsets]): (-[WKWebView removeFromSuperview]): (-[WKWebView _firePresentationUpdateForPendingStableStatePresentationCallbacks]): (toUserInterfaceLayoutDirection): (-[WKWebView setSemanticContentAttribute:]): (-[WKWebView _contentVisibleRect]): (-[WKWebView _minimumLayoutSizeOverride]): (-[WKWebView _setViewLayoutSizeOverride:]): (-[WKWebView _maximumUnobscuredSizeOverride]): (-[WKWebView _setMaximumUnobscuredSizeOverride:]): (-[WKWebView _obscuredInsets]): (-[WKWebView _setObscuredInsets:]): (-[WKWebView _obscuredInsetEdgesAffectedBySafeArea]): (-[WKWebView _setObscuredInsetEdgesAffectedBySafeArea:]): (-[WKWebView _unobscuredSafeAreaInsets]): (-[WKWebView _setUnobscuredSafeAreaInsets:]): (-[WKWebView _safeAreaShouldAffectObscuredInsets]): (-[WKWebView _enclosingViewForExposedRectComputation]): (-[WKWebView _setInterfaceOrientationOverride:]): (-[WKWebView _interfaceOrientationOverride]): (-[WKWebView _clearInterfaceOrientationOverride]): (-[WKWebView _setAllowsViewportShrinkToFit:]): (-[WKWebView _allowsViewportShrinkToFit]): (-[WKWebView _isDisplayingPDF]): (-[WKWebView _dataForDisplayedPDF]): (-[WKWebView _suggestedFilenameForDisplayedPDF]): (-[WKWebView _webViewPrintFormatter]): (-[WKWebView _dragInteractionPolicy]): (-[WKWebView _setDragInteractionPolicy:]): (-[WKWebView _shouldAvoidResizingWhenInputViewBoundsChange]): (-[WKWebView _contentViewIsFirstResponder]): (-[WKWebView _uiTextCaretRect]): (-[WKWebView _safeBrowsingWarning]): (-[WKWebView _convertPointFromContentsToView:]): (-[WKWebView _convertPointFromViewToContents:]): (-[WKWebView _doAfterNextStablePresentationUpdate:]): (-[WKWebView _setFont:sender:]): (-[WKWebView _setFontSize:sender:]): (-[WKWebView _setTextColor:sender:]): (-[WKWebView _detectDataWithTypes:completionHandler:]): (-[WKWebView _requestActivatedElementAtPosition:completionBlock:]): (-[WKWebView didStartFormControlInteraction]): (-[WKWebView didEndFormControlInteraction]): (-[WKWebView _beginInteractiveObscuredInsetsChange]): (-[WKWebView _endInteractiveObscuredInsetsChange]): (-[WKWebView _hideContentUntilNextUpdate]): (-[WKWebView _beginAnimatedResizeWithUpdates:]): (-[WKWebView _endAnimatedResize]): (-[WKWebView _resizeWhileHidingContentWithUpdates:]): (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:maximumUnobscuredSizeOverride:]): (-[WKWebView _clearOverrideLayoutParameters]): (viewportArgumentsFromDictionary): (-[WKWebView _overrideViewportWithArguments:]): (-[WKWebView _viewForFindUI]): (-[WKWebView _setOverlaidAccessoryViewsInset:]): (-[WKWebView _retainActiveFocusedState]): (-[WKWebView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]): (-[WKWebView _snapshotLayerContentsForBackForwardListItem:]): (-[WKWebView _dataDetectionResults]): (-[WKWebView _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:]): (-[WKWebView _accessibilityStoreSelection]): (-[WKWebView _accessibilityClearSelection]): (-[WKWebView _accessibilityRetrieveSpeakSelectionContent]): (-[WKWebView _accessibilityDidGetSpeakSelectionContent:]): (-[WKWebView _fullScreenPlaceholderView]): (-[WKWebView hasFullScreenWindowController]): (-[WKWebView closeFullScreenWindowController]): (-[WKWebView fullScreenWindowController]): (-[WKWebView _printFormatterClass]): (-[WKWebView _printProvider]): * UIProcess/API/ios/WKWebViewTestingIOS.mm: * UIProcess/API/mac/WKView.mm: (toCoreScrollbarStyle): Deleted. (toAPIScrollbarStyle): Deleted. * UIProcess/API/mac/WKWebViewMac.h: Added. * UIProcess/API/mac/WKWebViewMac.mm: Added. (toAPIScrollbarStyle): (toCoreScrollbarStyle): (-[WKWebView acceptsFirstResponder]): (-[WKWebView becomeFirstResponder]): (-[WKWebView resignFirstResponder]): (-[WKWebView viewWillStartLiveResize]): (-[WKWebView viewDidEndLiveResize]): (-[WKWebView isFlipped]): (-[WKWebView intrinsicContentSize]): (-[WKWebView prepareContentInRect:]): (-[WKWebView setFrameSize:]): (-[WKWebView setUserInterfaceLayoutDirection:]): (-[WKWebView ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): (-[WKWebView writeSelectionToPasteboard:types:]): (-[WKWebView centerSelectionInVisibleArea:]): (-[WKWebView validRequestorForSendType:returnType:]): (-[WKWebView readSelectionFromPasteboard:]): (-[WKWebView changeFont:]): (-[WKWebView changeColor:]): (-[WKWebView changeAttributes:]): (-[WKWebView startSpeaking:]): (-[WKWebView stopSpeaking:]): (-[WKWebView showGuessPanel:]): (-[WKWebView checkSpelling:]): (-[WKWebView changeSpelling:]): (-[WKWebView toggleContinuousSpellChecking:]): (-[WKWebView isGrammarCheckingEnabled]): (-[WKWebView setGrammarCheckingEnabled:]): (-[WKWebView toggleGrammarChecking:]): (-[WKWebView toggleAutomaticSpellingCorrection:]): (-[WKWebView orderFrontSubstitutionsPanel:]): (-[WKWebView toggleSmartInsertDelete:]): (-[WKWebView isAutomaticQuoteSubstitutionEnabled]): (-[WKWebView setAutomaticQuoteSubstitutionEnabled:]): (-[WKWebView toggleAutomaticQuoteSubstitution:]): (-[WKWebView isAutomaticDashSubstitutionEnabled]): (-[WKWebView setAutomaticDashSubstitutionEnabled:]): (-[WKWebView toggleAutomaticDashSubstitution:]): (-[WKWebView isAutomaticLinkDetectionEnabled]): (-[WKWebView setAutomaticLinkDetectionEnabled:]): (-[WKWebView toggleAutomaticLinkDetection:]): (-[WKWebView isAutomaticTextReplacementEnabled]): (-[WKWebView setAutomaticTextReplacementEnabled:]): (-[WKWebView toggleAutomaticTextReplacement:]): (-[WKWebView uppercaseWord:]): (-[WKWebView lowercaseWord:]): (-[WKWebView capitalizeWord:]): (-[WKWebView _wantsKeyDownForEvent:]): (-[WKWebView scrollWheel:]): (-[WKWebView swipeWithEvent:]): (-[WKWebView mouseMoved:]): (-[WKWebView mouseDown:]): (-[WKWebView mouseUp:]): (-[WKWebView mouseDragged:]): (-[WKWebView mouseEntered:]): (-[WKWebView mouseExited:]): (-[WKWebView otherMouseDown:]): (-[WKWebView otherMouseDragged:]): (-[WKWebView otherMouseUp:]): (-[WKWebView rightMouseDown:]): (-[WKWebView rightMouseDragged:]): (-[WKWebView rightMouseUp:]): (-[WKWebView pressureChangeWithEvent:]): (-[WKWebView acceptsFirstMouse:]): (-[WKWebView shouldDelayWindowOrderingForEvent:]): (-[WKWebView doCommandBySelector:]): (-[WKWebView inputContext]): (-[WKWebView performKeyEquivalent:]): (-[WKWebView keyUp:]): (-[WKWebView keyDown:]): (-[WKWebView flagsChanged:]): (-[WKWebView setMarkedText:selectedRange:replacementRange:]): (-[WKWebView unmarkText]): (-[WKWebView selectedRange]): (-[WKWebView hasMarkedText]): (-[WKWebView markedRange]): (-[WKWebView attributedSubstringForProposedRange:actualRange:]): (-[WKWebView characterIndexForPoint:]): (-[WKWebView typingAttributesWithCompletionHandler:]): (-[WKWebView firstRectForCharacterRange:actualRange:]): (-[WKWebView selectedRangeWithCompletionHandler:]): (-[WKWebView markedRangeWithCompletionHandler:]): (-[WKWebView hasMarkedTextWithCompletionHandler:]): (-[WKWebView attributedSubstringForProposedRange:completionHandler:]): (-[WKWebView firstRectForCharacterRange:completionHandler:]): (-[WKWebView characterIndexForPoint:completionHandler:]): (-[WKWebView validAttributesForMarkedText]): (-[WKWebView draggedImage:endedAt:operation:]): (-[WKWebView draggingEntered:]): (-[WKWebView draggingUpdated:]): (-[WKWebView draggingExited:]): (-[WKWebView prepareForDragOperation:]): (-[WKWebView performDragOperation:]): (-[WKWebView _hitTest:dragTypes:]): (-[WKWebView _windowResizeMouseLocationIsInVisibleScrollerThumb:]): (-[WKWebView viewWillMoveToWindow:]): (-[WKWebView viewDidMoveToWindow]): (-[WKWebView drawRect:]): (-[WKWebView isOpaque]): (-[WKWebView mouseDownCanMoveWindow]): (-[WKWebView viewDidHide]): (-[WKWebView viewDidUnhide]): (-[WKWebView viewDidChangeBackingProperties]): (-[WKWebView _activeSpaceDidChange:]): (-[WKWebView accessibilityFocusedUIElement]): (-[WKWebView accessibilityHitTest:]): (-[WKWebView accessibilityAttributeValue:]): (-[WKWebView accessibilityAttributeValue:forParameter:]): (-[WKWebView hitTest:]): (-[WKWebView conversationIdentifier]): (-[WKWebView quickLookWithEvent:]): (-[WKWebView addTrackingRect:owner:userData:assumeInside:]): (-[WKWebView _addTrackingRect:owner:userData:assumeInside:useTrackingNum:]): (-[WKWebView _addTrackingRects:owner:userDataList:assumeInsideList:trackingNums:count:]): (-[WKWebView removeTrackingRect:]): (-[WKWebView _removeTrackingRects:count:]): (-[WKWebView view:stringForToolTip:point:userData:]): (-[WKWebView pasteboardChangedOwner:]): (-[WKWebView pasteboard:provideDataForType:]): (-[WKWebView namesOfPromisedFilesDroppedAtDestination:]): (-[WKWebView wantsUpdateLayer]): (-[WKWebView updateLayer]): (-[WKWebView smartMagnifyWithEvent:]): (-[WKWebView magnifyWithEvent:]): (-[WKWebView rotateWithEvent:]): (-[WKWebView _ensureTextFinderClient]): (-[WKWebView findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:]): (-[WKWebView replaceMatches:withString:inSelectionOnly:resultCollector:]): (-[WKWebView scrollFindMatchToVisible:]): (-[WKWebView documentContainerView]): (-[WKWebView getSelectedText:]): (-[WKWebView selectFindMatch:completionHandler:]): (-[WKWebView filePromiseProvider:fileNameForType:]): (-[WKWebView filePromiseProvider:writePromiseToURL:completionHandler:]): (-[WKWebView draggingSession:sourceOperationMaskForDraggingContext:]): (-[WKWebView draggingSession:endedAtPoint:operation:]): (-[WKWebView _prepareForImmediateActionAnimation]): (-[WKWebView _cancelImmediateActionAnimation]): (-[WKWebView _completeImmediateActionAnimation]): (-[WKWebView _setDrawsTransparentBackground:]): (-[WKWebView shareSheetDidDismiss:]): (-[WKWebView makeTouchBar]): (-[WKWebView candidateListTouchBarItem]): (-[WKWebView _web_didAddMediaControlsManager:]): (-[WKWebView _web_didRemoveMediaControlsManager]): (-[WKWebView _interactWithMediaControlsForTesting]): (-[WKWebView validateUserInterfaceItem:]): (-[WKWebView goBack:]): (-[WKWebView goForward:]): (-[WKWebView reload:]): (-[WKWebView reloadFromOrigin:]): (-[WKWebView stopLoading:]): (-[WKWebView _web_superInputContext]): (-[WKWebView _web_superQuickLookWithEvent:]): (-[WKWebView _web_superSwipeWithEvent:]): (-[WKWebView _web_superMagnifyWithEvent:]): (-[WKWebView _web_superSmartMagnifyWithEvent:]): (-[WKWebView _web_superRemoveTrackingRect:]): (-[WKWebView _web_superAccessibilityAttributeValue:]): (-[WKWebView _web_superDoCommandBySelector:]): (-[WKWebView _web_superPerformKeyEquivalent:]): (-[WKWebView _web_superKeyDown:]): (-[WKWebView _web_superHitTest:]): (-[WKWebView _web_immediateActionAnimationControllerForHitTestResultInternal:withType:userData:]): (-[WKWebView _web_prepareForImmediateActionAnimation]): (-[WKWebView _web_cancelImmediateActionAnimation]): (-[WKWebView _web_completeImmediateActionAnimation]): (-[WKWebView _web_didChangeContentSize:]): (-[WKWebView _web_dragDestinationActionForDraggingInfo:]): (-[WKWebView _web_didPerformDragOperation:]): (-[WKWebView _web_dismissContentRelativeChildWindows]): (-[WKWebView _web_dismissContentRelativeChildWindowsWithAnimation:]): (-[WKWebView _web_editorStateDidChange]): (-[WKWebView _web_gestureEventWasNotHandledByWebCore:]): (-[WKWebView _web_grantDOMPasteAccess]): (-[WKWebView _takeFindStringFromSelectionInternal:]): (-[WKWebView insertText:]): (-[WKWebView insertText:replacementRange:]): (-[WKWebView _pageRefForTransitionToWKWebView]): (-[WKWebView _hasActiveVideoForControlsManager]): (-[WKWebView _ignoresNonWheelEvents]): (-[WKWebView _setIgnoresNonWheelEvents:]): (-[WKWebView _safeBrowsingWarning]): (-[WKWebView _pinnedState]): (-[WKWebView _rubberBandingEnabled]): (-[WKWebView _setRubberBandingEnabled:]): (-[WKWebView _pageExtendedBackgroundColor]): (-[WKWebView _backgroundColor]): (-[WKWebView _setBackgroundColor:]): (-[WKWebView _underlayColor]): (-[WKWebView _setUnderlayColor:]): (-[WKWebView _setTotalHeightOfBanners:]): (-[WKWebView _totalHeightOfBanners]): (-[WKWebView _drawsBackground]): (-[WKWebView _setDrawsBackground:]): (-[WKWebView _setTopContentInset:]): (-[WKWebView _topContentInset]): (-[WKWebView _setAutomaticallyAdjustsContentInsets:]): (-[WKWebView _automaticallyAdjustsContentInsets]): (-[WKWebView _setOverrideDeviceScaleFactor:]): (-[WKWebView _overrideDeviceScaleFactor]): (-[WKWebView _windowOcclusionDetectionEnabled]): (-[WKWebView _setWindowOcclusionDetectionEnabled:]): (-[WKWebView _spellCheckerDocumentTag]): (-[WKWebView _shouldExpandContentToViewHeightForAutoLayout]): (-[WKWebView _setShouldExpandContentToViewHeightForAutoLayout:]): (-[WKWebView _minimumLayoutWidth]): (-[WKWebView _setMinimumLayoutWidth:]): (-[WKWebView _alwaysShowsHorizontalScroller]): (-[WKWebView _setAlwaysShowsHorizontalScroller:]): (-[WKWebView _alwaysShowsVerticalScroller]): (-[WKWebView _setAlwaysShowsVerticalScroller:]): (-[WKWebView _useSystemAppearance]): (-[WKWebView _setUseSystemAppearance:]): (-[WKWebView _setOverlayScrollbarStyle:]): (-[WKWebView _overlayScrollbarStyle]): (-[WKWebView _inspectorAttachmentView]): (-[WKWebView _setInspectorAttachmentView:]): (-[WKWebView _setThumbnailView:]): (-[WKWebView _thumbnailView]): (-[WKWebView _setIgnoresAllEvents:]): (-[WKWebView _ignoresAllEvents]): (-[WKWebView _usePlatformFindUI]): (-[WKWebView _setUsePlatformFindUI:]): (-[WKWebView _setShouldSuppressFirstResponderChanges:]): (-[WKWebView _canChangeFrameLayout:]): (-[WKWebView _tryToSwipeWithEvent:ignoringPinnedState:]): (-[WKWebView _dismissContentRelativeChildWindows]): (-[WKWebView _setFrame:andScrollBy:]): (-[WKWebView _gestureEventWasNotHandledByWebCore:]): (-[WKWebView _disableFrameSizeUpdates]): (-[WKWebView _enableFrameSizeUpdates]): (-[WKWebView _beginDeferringViewInWindowChanges]): (-[WKWebView _endDeferringViewInWindowChanges]): (-[WKWebView _endDeferringViewInWindowChangesSync]): (-[WKWebView _setCustomSwipeViews:]): (-[WKWebView _setCustomSwipeViewsTopContentInset:]): (-[WKWebView _setDidMoveSwipeSnapshotCallback:]): (-[WKWebView _fullScreenPlaceholderView]): (-[WKWebView _fullScreenWindow]): (-[WKWebView _immediateActionAnimationControllerForHitTestResult:withType:userData:]): (-[WKWebView _printOperationWithPrintInfo:]): (-[WKWebView _printOperationWithPrintInfo:forFrame:]): (-[WKWebView _wantsMediaPlaybackControlsView]): (-[WKWebView _setWantsMediaPlaybackControlsView:]): (-[WKWebView _mediaPlaybackControlsView]): (-[WKWebView _addMediaPlaybackControlsView:]): (-[WKWebView _removeMediaPlaybackControlsView]): (-[WKWebView _prepareForMoveToWindow:completionHandler:]): * UIProcess/API/mac/WKWebViewTestingMac.mm: * UIProcess/ios/PageClientImplIOS.mm: * UIProcess/ios/WKContentView.mm: * UIProcess/ios/WKContentViewInteraction.mm: * UIProcess/ios/WKPDFView.mm: * UIProcess/ios/WKScrollView.mm: * UIProcess/ios/WKSystemPreviewView.mm: * WebKit.xcodeproj/project.pbxproj: 2019-12-14 David Kilzer <ddkilzer@apple.com> Add release assert for selectedIndex in WebKit::WebPopupMenu::show() <https://webkit.org/b/205223> <rdar://problem/57929078> Reviewed by Wenson Hsieh. * WebProcess/WebCoreSupport/WebPopupMenu.cpp: (WebKit::WebPopupMenu::show): - Add release assert to check for valid `selectedIndex` to fix the bug. - Rename `index` parameter to `selectedIndex`. * WebProcess/WebCoreSupport/WebPopupMenu.h: (WebKit::WebPopupMenu::show): - Rename `index` parameter to `selectedIndex`. 2019-12-13 Brady Eidson <beidson@apple.com> Refactor ScriptController's proliferation of ExceptionDetails*. https://bugs.webkit.org/show_bug.cgi?id=205151 Reviewed by Alex Christensen. * UIProcess/API/C/WKPage.cpp: (WKPageRunJavaScriptInMainFrame): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _evaluateJavaScript:forceUserGesture:completionHandler:]): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::runJavaScriptInMainFrame): (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld): (WebKit::WebPageProxy::runJavaScriptInFrame): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::performJavaScriptURLRequest): * WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.cpp: (WebKit::WebInspectorFrontendAPIDispatcher::evaluateOrQueueExpression): (WebKit::WebInspectorFrontendAPIDispatcher::evaluateQueuedExpressions): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::runJavaScript): 2019-12-13 Eric Carlson <eric.carlson@apple.com> Add remote media player message to load and play https://bugs.webkit.org/show_bug.cgi?id=205220 <rdar://problem/57927486> Reviewed by Jer Noble. Add WP -> GPU process messages: PrepareForPlayback, Load, CancelLoad, Play, Pause, SetVolume, and SetMuted Add GPUP -> WP message: PlaybackStateChanged * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: (WebKit::RemoteMediaPlayerManagerProxy::RemoteMediaPlayerManagerProxy): (WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer): (WebKit::RemoteMediaPlayerManagerProxy::deleteMediaPlayer): (WebKit::RemoteMediaPlayerManagerProxy::prepareForPlayback): (WebKit::RemoteMediaPlayerManagerProxy::load): (WebKit::RemoteMediaPlayerManagerProxy::cancelLoad): (WebKit::RemoteMediaPlayerManagerProxy::play): (WebKit::RemoteMediaPlayerManagerProxy::pause): (WebKit::RemoteMediaPlayerManagerProxy::setVolume): (WebKit::RemoteMediaPlayerManagerProxy::setMuted): (WebKit::RemoteMediaPlayerManagerProxy::logChannel const): * GPUProcess/media/RemoteMediaPlayerManagerProxy.h: (WebKit::RemoteMediaPlayerManagerProxy::gpuConnectionToWebProcess const): (WebKit::RemoteMediaPlayerManagerProxy::webProcessConnection const): Deleted. * GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in: * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::RemoteMediaPlayerProxy): (WebKit::RemoteMediaPlayerProxy::load): (WebKit::RemoteMediaPlayerProxy::prepareForPlayback): (WebKit::RemoteMediaPlayerProxy::cancelLoad): (WebKit::RemoteMediaPlayerProxy::play): (WebKit::RemoteMediaPlayerProxy::pause): (WebKit::RemoteMediaPlayerProxy::setVolume): (WebKit::RemoteMediaPlayerProxy::setMuted): (WebKit::RemoteMediaPlayerProxy::mediaPlayerNetworkStateChanged): (WebKit::RemoteMediaPlayerProxy::mediaPlayerReadyStateChanged): (WebKit::RemoteMediaPlayerProxy::mediaPlayerVolumeChanged): (WebKit::RemoteMediaPlayerProxy::mediaPlayerMuteChanged): (WebKit::RemoteMediaPlayerProxy::mediaPlayerTimeChanged): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDurationChanged): (WebKit::RemoteMediaPlayerProxy::mediaPlayerRateChanged): * GPUProcess/media/RemoteMediaPlayerProxy.h: * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::didReceiveMessage): * WebProcess/GPU/GPUProcessConnection.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::prepareForPlayback): (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::load): (WebKit::MediaPlayerPrivateRemote::cancelLoad): (WebKit::MediaPlayerPrivateRemote::play): (WebKit::MediaPlayerPrivateRemote::pause): (WebKit::MediaPlayerPrivateRemote::setVolumeDouble): (WebKit::MediaPlayerPrivateRemote::setMuted): (WebKit::MediaPlayerPrivateRemote::muteChanged): (WebKit::MediaPlayerPrivateRemote::timeChanged): (WebKit::MediaPlayerPrivateRemote::playbackStateChanged): (WebKit::MediaPlayerPrivateRemote::paused const): Deleted. * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::RemoteMediaPlayerManager): (WebKit::RemoteMediaPlayerManager::~RemoteMediaPlayerManager): (WebKit::RemoteMediaPlayerManager::playbackStateChanged): * WebProcess/GPU/media/RemoteMediaPlayerManager.h: (WebKit::RemoteMediaPlayerManager::didReceiveMessageFromWebProcess): * WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in: 2019-12-13 Chris Dumez <cdumez@apple.com> [macOS] Swipe gesture snapshot stays too long if provisional load has not started yet when endSwipeGesture() is called https://bugs.webkit.org/show_bug.cgi?id=205206 Reviewed by Tim Horton. Swipe gesture snapshot stays too long if provisional load has not started yet when endSwipeGesture() is called on macOS. This is because the SnapshotRemovalTracker::eventOccurred() calls get ignored while the SnapshotRemovalTracker is paused and the SnapshotRemovalTracker only gets unpaused once the provisional load has started. The idea is that we should ignore any events from a previous navigation. However, the SwipeGestureEnd event is a UI-side event fired by the ViewGestureController itself, so there is reason to ignore it. Since we ask the WebContent process to do the load in willEndSwipeGesture(), it is possible that the provisional load has not started yet by the time endSwipeGesture() is called. In such case, the SwipeGestureEnd event would get ignored and we would keep the snapshot until the timeout. * UIProcess/ViewGestureController.cpp: (WebKit::stopWaitingForEvent): (WebKit::ViewGestureController::SnapshotRemovalTracker::eventOccurred): (WebKit::ViewGestureController::endSwipeGesture): (WebKit::ViewGestureController::SnapshotRemovalTracker::stopWaitingForEvent): Deleted. * UIProcess/ViewGestureController.h: 2019-12-13 David Kilzer <ddkilzer@apple.com> Add MESSAGE_CHECK() for selectedIndex in Messages::WebPageProxy::ShowPopupMenu <https://webkit.org/b/205177> <rdar://problem/57337872> Reviewed by Chris Dumez. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showPopupMenu): Add MESSAGE_CHECK() to validate the `selectedIndex` parameter, which must be -1 to select no items, or a valid zero-based index into `items`. 2019-12-13 Alex Christensen <achristensen@webkit.org> Allow cross-origin requests to WKURLSchemeHandlers https://bugs.webkit.org/show_bug.cgi?id=205198 <rdar://problem/57897836> Reviewed by Brady Eidson. Covered by an API test. * UIProcess/API/Cocoa/WKURLSchemeTask.h: Document the requirements for cross-origin requests. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::registerURLSchemeHandler): When we register a scheme handler, allow cross origin resources for that scheme. This will make the check in DocumentThreadableLoader::checkURLSchemeAsCORSEnabled allow the request to get to the WKURLSchemeHandler. The resposne must still have CORS header fields in order for the data to get to the web content, like CORS with HTTP. 2019-12-13 Wenson Hsieh <wenson_hsieh@apple.com> Implement encoding/decoding for DisplayList::DrawNativeImage https://bugs.webkit.org/show_bug.cgi?id=205200 Reviewed by Simon Fraser. Add helper functions to encode and decode NativeImagePtr (RetainPtr<CGImageRef> on Cocoa platforms). This mirrors the implementation of encoding and decoding for WebCore::Image, which create and draws into ShareableBitmap, and send a handle to the data over IPC. * Shared/WebCoreArgumentCoders.cpp: (IPC::encodeImage): (IPC::decodeImage): (IPC::encodeNativeImage): (IPC::decodeNativeImage): Additionally make Image and NativeImagePtr encoding and decoding helpers fail quickly in the case where the ShareableBitmap failed to create a graphics context by having the encoder indicate whether a graphics context was created, and having the decoder fail if the graphics context could not be created. (IPC::encodeOptionalNativeImage): (IPC::decodeOptionalNativeImage): (IPC::ArgumentCoder<NativeImageHandle>::encode): (IPC::ArgumentCoder<NativeImageHandle>::decode): * Shared/WebCoreArgumentCoders.h: 2019-12-13 Per Arne Vollan <pvollan@apple.com> [iOS] Deny mach lookup access to "*.apple-extension-service" in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=205134 <rdar://problem/56984257> Reviewed by Brent Fulgham. Remove mach lookup access to "*.apple-extension-service" in the sandbox. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-12-13 youenn fablet <youenn@apple.com> Help debugging flaky http/tests/cache-storage/page-cache-domcachestorage-pending-promise.html https://bugs.webkit.org/show_bug.cgi?id=205209 Reviewed by Chris Dumez. Add a bunch of asserts that no pending activity is happening in the Cache Storage backend is happening when querying the backend representation, which is a debug tool. No change of behavior. * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::representation): * NetworkProcess/cache/CacheStorageEngineCache.h: (WebKit::CacheStorage::Cache::hasPendingOpeningCallbacks const): * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::appendRepresentation const): 2019-12-13 Kate Cheney <katherine_cheney@apple.com> Create WebKit API calls for ITP Data https://bugs.webkit.org/show_bug.cgi?id=204932 <rdar://problem/57632753> Reviewed by Alex Christensen. This patch exposes ITP data captured in the network process through the Objective C API using two new classes: _WKResourceLoadStatisticsFirstParty and _WKResourceLoadStatisticsThirdParty. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ensureThirdPartyDataForSpecificFirstPartyDomain): (WebKit::getThirdPartyDataForSpecificFirstPartyDomains): (WebKit::ResourceLoadStatisticsMemoryStore::aggregatedThirdPartyData const): * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: Updated mentions of ThirdPartyData to include the WebResourceLoadStatisticsStore:: class specifier after relocating ThirdPartyData. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::aggregatedThirdPartyData): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: Updated the data to be sent via completion handler from WebResourceLoadStatisticsStore so that calls to aggregatedThirdPartyData() are happening on a background thread. * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * UIProcess/API/APIResourceLoadStatisticsFirstParty.h: Added. * UIProcess/API/APIResourceLoadStatisticsThirdParty.h: Added. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _getResourceLoadStatisticsDataSummary:]): * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/API/Cocoa/_WKResourceLoadStatisticsFirstParty.h: Added. * UIProcess/API/Cocoa/_WKResourceLoadStatisticsFirstParty.mm: Added. (-[_WKResourceLoadStatisticsFirstParty dealloc]): (-[_WKResourceLoadStatisticsFirstParty firstPartyDomain]): (-[_WKResourceLoadStatisticsFirstParty storageAccess]): (-[_WKResourceLoadStatisticsFirstParty _apiObject]): * UIProcess/API/Cocoa/_WKResourceLoadStatisticsFirstPartyInternal.h: Added. * UIProcess/API/Cocoa/_WKResourceLoadStatisticsThirdParty.h: Added. * UIProcess/API/Cocoa/_WKResourceLoadStatisticsThirdParty.mm: Added. (-[_WKResourceLoadStatisticsThirdParty dealloc]): (-[_WKResourceLoadStatisticsThirdParty thirdPartyDomain]): (-[_WKResourceLoadStatisticsThirdParty underFirstParties]): (-[_WKResourceLoadStatisticsThirdParty _apiObject]): * UIProcess/API/Cocoa/_WKResourceLoadStatisticsThirdPartyInternal.h: Added. _WKResourceLoadStatisticsFirstParty and _WKResourceLoadStatisticsThirdParty represent first and third party domains respectively which hold ITP data and are strongly typed to ensure the correct data is being exposed via API. The function and parameter names for storage access specify "third party" because each WKITPFirstParty holds data relevent to a specific third party and storage access would not make sense in just a first party context. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::getResourceLoadStatisticsDataSummary): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::getResourceLoadStatisticsDataSummary): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary): * UIProcess/WebsiteData/WebsiteDataStore.h: * WebKit.xcodeproj/project.pbxproj: 2019-12-13 Eric Carlson <eric.carlson@apple.com> Add infrastructure needed for playing media player in the GPU process https://bugs.webkit.org/show_bug.cgi?id=205094 <rdar://problem/57815393> Reviewed by Youenn Fablet. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess): (WebKit::GPUConnectionToWebProcess::~GPUConnectionToWebProcess): (WebKit::GPUConnectionToWebProcess::didReceiveMessage): (WebKit::GPUConnectionToWebProcess::didReceiveSyncMessage): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: Added. (WebKit::nullLogger): (WebKit::RemoteMediaPlayerManagerProxy::PlayerProxy::PlayerProxy): (WebKit::RemoteMediaPlayerManagerProxy::PlayerProxy::~PlayerProxy): (WebKit::RemoteMediaPlayerManagerProxy::RemoteMediaPlayerManagerProxy): (WebKit::RemoteMediaPlayerManagerProxy::~RemoteMediaPlayerManagerProxy): (WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer): (WebKit::RemoteMediaPlayerManagerProxy::getSupportedTypes): (WebKit::RemoteMediaPlayerManagerProxy::supportsType): (WebKit::RemoteMediaPlayerManagerProxy::originsInMediaCache): (WebKit::RemoteMediaPlayerManagerProxy::clearMediaCache): (WebKit::RemoteMediaPlayerManagerProxy::clearMediaCacheForOrigins): (WebKit::RemoteMediaPlayerManagerProxy::supportsKeySystem): * GPUProcess/media/RemoteMediaPlayerManagerProxy.h: Added. (WebKit::RemoteMediaPlayerManagerProxy::webProcessConnection const): (WebKit::RemoteMediaPlayerManagerProxy::didReceiveMessageFromWebProcess): (WebKit::RemoteMediaPlayerManagerProxy::didReceiveSyncMessageFromWebProcess): * GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in: Added. * Scripts/webkit/messages.py: * Sources.txt: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: Added. (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote): (WebKit::MediaPlayerPrivateRemote::~MediaPlayerPrivateRemote): (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::load): (WebKit::MediaPlayerPrivateRemote::load): (WebKit::MediaPlayerPrivateRemote::cancelLoad): (WebKit::MediaPlayerPrivateRemote::prepareToPlay): (WebKit::MediaPlayerPrivateRemote::platformLayer const): (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenLayer): (WebKit::MediaPlayerPrivateRemote::updateVideoFullscreenInlineImage): (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenFrame): (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenGravity): (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenMode): (WebKit::MediaPlayerPrivateRemote::videoFullscreenStandbyChanged): (WebKit::MediaPlayerPrivateRemote::accessLog const): (WebKit::MediaPlayerPrivateRemote::errorLog const): (WebKit::MediaPlayerPrivateRemote::platformErrorCode const): (WebKit::MediaPlayerPrivateRemote::play): (WebKit::MediaPlayerPrivateRemote::pause): (WebKit::MediaPlayerPrivateRemote::setBufferingPolicy): (WebKit::MediaPlayerPrivateRemote::supportsPictureInPicture const): (WebKit::MediaPlayerPrivateRemote::supportsFullscreen const): (WebKit::MediaPlayerPrivateRemote::supportsScanning const): (WebKit::MediaPlayerPrivateRemote::requiresImmediateCompositing const): (WebKit::MediaPlayerPrivateRemote::canSaveMediaData const): (WebKit::MediaPlayerPrivateRemote::naturalSize const): (WebKit::MediaPlayerPrivateRemote::hasVideo const): (WebKit::MediaPlayerPrivateRemote::hasAudio const): (WebKit::MediaPlayerPrivateRemote::setVisible): (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::durationMediaTime const): (WebKit::MediaPlayerPrivateRemote::currentMediaTime const): (WebKit::MediaPlayerPrivateRemote::getStartDate const): (WebKit::MediaPlayerPrivateRemote::seek): (WebKit::MediaPlayerPrivateRemote::seekWithTolerance): (WebKit::MediaPlayerPrivateRemote::seeking const): (WebKit::MediaPlayerPrivateRemote::startTime const): (WebKit::MediaPlayerPrivateRemote::setRateDouble): (WebKit::MediaPlayerPrivateRemote::rate const): (WebKit::MediaPlayerPrivateRemote::setPreservesPitch): (WebKit::MediaPlayerPrivateRemote::paused const): (WebKit::MediaPlayerPrivateRemote::setVolumeDouble): (WebKit::MediaPlayerPrivateRemote::setMuted): (WebKit::MediaPlayerPrivateRemote::hasClosedCaptions const): (WebKit::MediaPlayerPrivateRemote::setClosedCaptionsVisible): (WebKit::MediaPlayerPrivateRemote::maxFastForwardRate const): (WebKit::MediaPlayerPrivateRemote::minFastReverseRate const): (WebKit::MediaPlayerPrivateRemote::networkState const): (WebKit::MediaPlayerPrivateRemote::readyState const): (WebKit::MediaPlayerPrivateRemote::seekable const): (WebKit::MediaPlayerPrivateRemote::buffered const): (WebKit::MediaPlayerPrivateRemote::maxMediaTimeSeekable const): (WebKit::MediaPlayerPrivateRemote::minMediaTimeSeekable const): (WebKit::MediaPlayerPrivateRemote::seekableTimeRangesLastModifiedTime const): (WebKit::MediaPlayerPrivateRemote::liveUpdateInterval const): (WebKit::MediaPlayerPrivateRemote::totalBytes const): (WebKit::MediaPlayerPrivateRemote::didLoadingProgress const): (WebKit::MediaPlayerPrivateRemote::setSize): (WebKit::MediaPlayerPrivateRemote::paint): (WebKit::MediaPlayerPrivateRemote::paintCurrentFrameInContext): (WebKit::MediaPlayerPrivateRemote::copyVideoTextureToPlatformTexture): (WebKit::MediaPlayerPrivateRemote::nativeImageForCurrentTime): (WebKit::MediaPlayerPrivateRemote::setPreload): (WebKit::MediaPlayerPrivateRemote::hasAvailableVideoFrame const): (WebKit::MediaPlayerPrivateRemote::canLoadPoster const): (WebKit::MediaPlayerPrivateRemote::setPoster): (WebKit::MediaPlayerPrivateRemote::enterFullscreen): (WebKit::MediaPlayerPrivateRemote::exitFullscreen): (WebKit::MediaPlayerPrivateRemote::wirelessPlaybackTargetName const): (WebKit::MediaPlayerPrivateRemote::wirelessPlaybackTargetType const): (WebKit::MediaPlayerPrivateRemote::wirelessVideoPlaybackDisabled const): (WebKit::MediaPlayerPrivateRemote::setWirelessVideoPlaybackDisabled): (WebKit::MediaPlayerPrivateRemote::canPlayToWirelessPlaybackTarget const): (WebKit::MediaPlayerPrivateRemote::isCurrentPlaybackTargetWireless const): (WebKit::MediaPlayerPrivateRemote::setWirelessPlaybackTarget): (WebKit::MediaPlayerPrivateRemote::setShouldPlayToPlaybackTarget): (WebKit::MediaPlayerPrivateRemote::canEnterFullscreen const): (WebKit::MediaPlayerPrivateRemote::supportsAcceleratedRendering const): (WebKit::MediaPlayerPrivateRemote::acceleratedRenderingStateChanged): (WebKit::MediaPlayerPrivateRemote::shouldMaintainAspectRatio const): (WebKit::MediaPlayerPrivateRemote::setShouldMaintainAspectRatio): (WebKit::MediaPlayerPrivateRemote::hasSingleSecurityOrigin const): (WebKit::MediaPlayerPrivateRemote::didPassCORSAccessCheck const): (WebKit::MediaPlayerPrivateRemote::wouldTaintOrigin const): (WebKit::MediaPlayerPrivateRemote::movieLoadType const): (WebKit::MediaPlayerPrivateRemote::prepareForRendering): (WebKit::MediaPlayerPrivateRemote::mediaTimeForTimeValue const): (WebKit::MediaPlayerPrivateRemote::maximumDurationToCacheMediaTime const): (WebKit::MediaPlayerPrivateRemote::decodedFrameCount const): (WebKit::MediaPlayerPrivateRemote::droppedFrameCount const): (WebKit::MediaPlayerPrivateRemote::audioDecodedByteCount const): (WebKit::MediaPlayerPrivateRemote::videoDecodedByteCount const): (WebKit::MediaPlayerPrivateRemote::setPrivateBrowsingMode): (WebKit::MediaPlayerPrivateRemote::engineDescription const): (WebKit::MediaPlayerPrivateRemote::audioSourceProvider): (WebKit::MediaPlayerPrivateRemote::createSession): (WebKit::MediaPlayerPrivateRemote::setCDMSession): (WebKit::MediaPlayerPrivateRemote::keyAdded): (WebKit::MediaPlayerPrivateRemote::cdmInstanceAttached): (WebKit::MediaPlayerPrivateRemote::cdmInstanceDetached): (WebKit::MediaPlayerPrivateRemote::attemptToDecryptWithInstance): (WebKit::MediaPlayerPrivateRemote::waitingForKey const): (WebKit::MediaPlayerPrivateRemote::requiresTextTrackRepresentation const): (WebKit::MediaPlayerPrivateRemote::setTextTrackRepresentation): (WebKit::MediaPlayerPrivateRemote::syncTextTrackBounds): (WebKit::MediaPlayerPrivateRemote::tracksChanged): (WebKit::MediaPlayerPrivateRemote::simulateAudioInterruption): (WebKit::MediaPlayerPrivateRemote::beginSimulatedHDCPError): (WebKit::MediaPlayerPrivateRemote::endSimulatedHDCPError): (WebKit::MediaPlayerPrivateRemote::languageOfPrimaryAudioTrack const): (WebKit::MediaPlayerPrivateRemote::extraMemoryCost const): (WebKit::MediaPlayerPrivateRemote::fileSize const): (WebKit::MediaPlayerPrivateRemote::ended const): (WebKit::MediaPlayerPrivateRemote::videoPlaybackQualityMetrics): (WebKit::MediaPlayerPrivateRemote::notifyTrackModeChanged): (WebKit::MediaPlayerPrivateRemote::notifyActiveSourceBuffersChanged): (WebKit::MediaPlayerPrivateRemote::setShouldDisableSleep): (WebKit::MediaPlayerPrivateRemote::applicationWillResignActive): (WebKit::MediaPlayerPrivateRemote::applicationDidBecomeActive): (WebKit::MediaPlayerPrivateRemote::performTaskAtMediaTime): (WebKit::MediaPlayerPrivateRemote::shouldIgnoreIntrinsicSize): (WebKit::MediaPlayerPrivateRemote::logChannel const): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: Added. * WebProcess/GPU/media/MediaPlayerPrivateRemoteIdentifier.h: Added. * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: Added. (WebKit::MediaPlayerRemoteFactory::MediaPlayerRemoteFactory): (WebKit::RemoteMediaPlayerManager::RemoteMediaPlayerManager): (WebKit::RemoteMediaPlayerManager::~RemoteMediaPlayerManager): (WebKit::RemoteMediaPlayerManager::supplementName): (WebKit::RemoteMediaPlayerManager::initialize): (WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer): (WebKit::RemoteMediaPlayerManager::getSupportedTypes): (WebKit::RemoteMediaPlayerManager::supportsTypeAndCodecs): (WebKit::RemoteMediaPlayerManager::supportsKeySystem): (WebKit::RemoteMediaPlayerManager::originsInMediaCache): (WebKit::RemoteMediaPlayerManager::clearMediaCache): (WebKit::RemoteMediaPlayerManager::clearMediaCacheForOrigins): (WebKit::RemoteMediaPlayerManager::networkStateChanged): (WebKit::RemoteMediaPlayerManager::updatePreferences): (WebKit::RemoteMediaPlayerManager::gpuProcessConnection const): * WebProcess/GPU/media/RemoteMediaPlayerManager.h: Added. * WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in: Added. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): * WebProcess/WebProcess.cpp: 2019-12-13 Jim Mason <jmason@ibinx.com> [GTK] WebKitGTK build hangs on g-ir-scanner https://bugs.webkit.org/show_bug.cgi?id=204715 This patch fixes the static initialization order problem introduced by Bug 204503. The patch replaces the static data members with statics that are constructed only upon first access (i.e., the 'construct on first use' idiom). Reviewed by Carlos Garcia Campos. * UIProcess/glib/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::messageHandlers): (WebKit::RemoteInspectorClient::RemoteInspectorClient): * UIProcess/glib/RemoteInspectorClient.h: 2019-12-13 Per Arne Vollan <pvollan@apple.com> [iOS] The AGX compiler service is incorrectly listed as a global name in sandbox https://bugs.webkit.org/show_bug.cgi?id=205189 Reviewed by Brent Fulgham. It should be a XPC service name. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-12-12 Simon Fraser <simon.fraser@apple.com> Minor WKWebView.mm code rearrangement https://bugs.webkit.org/show_bug.cgi?id=205129 Reviewed by Tim Horton. Throw in some more #pragma marks and move some functions around, with the goal of having the implementation order mostly follow header order, and grouping related functions. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _pageForTesting]): (-[WKWebView _page]): (-[WKWebView urlSchemeHandlerForURLScheme:]): (+[WKWebView handlesURLScheme:]): (-[WKWebView _resolutionForShareSheetImmediateCompletionForTesting]): (-[WKWebView createPDFWithConfiguration:completionHandler:]): (-[WKWebView createWebArchiveDataWithCompletionHandler:]): (toFindOptions): (-[WKWebView findString:withConfiguration:completionHandler:]): (-[WKWebView setMediaType:]): (-[WKWebView mediaType]): (-[WKWebView layoutSubviews]): (-[WKWebView scrollView]): (-[WKWebView _isShowingVideoPictureInPicture]): (-[WKWebView _mayAutomaticallyShowVideoPictureInPicture]): (-[WKWebView _incrementFocusPreservationCount]): (-[WKWebView _decrementFocusPreservationCount]): (-[WKWebView _resetFocusPreservationCount]): (-[WKWebView _isRetainingActiveFocusedState]): (-[WKWebView _effectiveAppearanceIsDark]): (-[WKWebView _effectiveUserInterfaceLevelIsElevated]): (-[WKWebView _shouldAvoidResizingWhenInputViewBoundsChange]): (-[WKWebView _dragInteractionPolicy]): (-[WKWebView _setDragInteractionPolicy:]): (-[WKWebView _populateArchivedSubviews:]): (-[WKWebView _isBackground]): (-[WKWebView _setShouldSuppressFirstResponderChanges:]): (-[WKWebView _retainActiveFocusedState]): (-[WKWebView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]): (-[WKWebView _snapshotLayerContentsForBackForwardListItem:]): (-[WKWebView _dataDetectionResults]): (-[WKWebView _accessibilityRetrieveSpeakSelectionContent]): (-[WKWebView _accessibilityDidGetSpeakSelectionContent:]): (-[WKWebView _viewportSizeForCSSViewportUnits]): (-[WKWebView _setViewportSizeForCSSViewportUnits:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/SOAuthorization/SOAuthorizationCoordinator.mm: Unified sources build fix (seen while doing other stuff). 2019-12-12 Simon Fraser <simon.fraser@apple.com> Move WKWebView code related to testing to new files, with new private "for testing" headers. https://bugs.webkit.org/show_bug.cgi?id=205021 Reviewed by Tim Horton. Move testing-only SPI to new private headers to discourage first parties from using them by mistake. Move test-only code to new files to reduce the size of WKWebView.mm. * SourcesCocoa.txt: * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _internalDoAfterNextPresentationUpdate:withoutWaitingForPainting:withoutWaitingForAnimatedResize:]): (-[WKWebView _prepareForImmediateActionAnimation]): (-[WKWebView _cancelImmediateActionAnimation]): (-[WKWebView _completeImmediateActionAnimation]): (-[WKWebView _useSystemAppearance]): (-[WKWebView _setUseSystemAppearance:]): (-[WKWebView _pageRefForTransitionToWKWebView]): (-[WKWebView _canChangeFrameLayout:]): (-[WKWebView _tryToSwipeWithEvent:ignoringPinnedState:]): (-[WKWebView _ignoresNonWheelEvents]): (-[WKWebView _setIgnoresNonWheelEvents:]): (-[WKWebView _hasActiveVideoForControlsManager]): (-[WKWebView _dismissContentRelativeChildWindows]): (-[WKWebView _gestureEventWasNotHandledByWebCore:]): (-[WKWebView _disableFrameSizeUpdates]): (-[WKWebView _enableFrameSizeUpdates]): (-[WKWebView _beginDeferringViewInWindowChanges]): (-[WKWebView _endDeferringViewInWindowChanges]): (-[WKWebView _endDeferringViewInWindowChangesSync]): (-[WKWebView _fullScreenPlaceholderView]): (-[WKWebView _fullScreenWindow]): (-[WKWebView _underlayColor]): (-[WKWebView _setUnderlayColor:]): (-[WKWebView _setCustomSwipeViews:]): (-[WKWebView _setCustomSwipeViewsTopContentInset:]): (-[WKWebView _setDidMoveSwipeSnapshotCallback:]): (-[WKWebView _setFrame:andScrollBy:]): (-[WKWebView _setTotalHeightOfBanners:]): (-[WKWebView _totalHeightOfBanners]): (-[WKWebView _setFont:sender:]): (-[WKWebView _setFontSize:sender:]): (-[WKWebView _setTextColor:sender:]): (-[WKWebView inputAccessoryView]): (-[WKWebView inputView]): (-[WKWebView _requestActivatedElementAtPosition:completionBlock:]): (-[WKWebView _contentVisibleRect]): (-[WKWebView _convertPointFromContentsToView:]): (-[WKWebView _convertPointFromViewToContents:]): (-[WKWebView didStartFormControlInteraction]): (-[WKWebView didEndFormControlInteraction]): (-[WKWebView _uiTextCaretRect]): (-[WKWebView _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:]): (-[WKWebView _accessibilityStoreSelection]): (-[WKWebView _accessibilityClearSelection]): (-[WKWebView _contentViewIsFirstResponder]): (-[WKWebView _inspector]): (-[WKWebView _mainFrame]): (-[WKWebView _isEditable]): (-[WKWebView _setEditable:]): (-[WKWebView _executeEditCommand:argument:completion:]): (-[WKWebView _textManipulationDelegate]): (-[WKWebView _setTextManipulationDelegate:]): (-[WKWebView _startTextManipulationsWithConfiguration:completion:]): (-[WKWebView _completeTextManipulation:completion:]): (-[WKWebView _takeFindStringFromSelection:]): (+[WKWebView _stringForFind]): (+[WKWebView _setStringForFind:]): (-[WKWebView _remoteObjectRegistry]): (-[WKWebView _handle]): (-[WKWebView _observedRenderingProgressEvents]): (-[WKWebView _historyDelegate]): (-[WKWebView _setHistoryDelegate:]): (-[WKWebView _updateMediaPlaybackControlsManager]): (-[WKWebView _canTogglePictureInPicture]): (-[WKWebView _isPictureInPictureActive]): (-[WKWebView _togglePictureInPicture]): (-[WKWebView _closeAllMediaPresentations]): (-[WKWebView _stopMediaCapture]): (-[WKWebView _stopAllMediaPlayback]): (-[WKWebView _suspendAllMediaPlayback]): (-[WKWebView _resumeAllMediaPlayback]): (-[WKWebView _unreachableURL]): (-[WKWebView _mainFrameURL]): (-[WKWebView _loadAlternateHTMLString:baseURL:forUnreachableURL:]): (-[WKWebView _loadData:MIMEType:characterEncodingName:baseURL:userData:]): (-[WKWebView _loadRequest:shouldOpenExternalURLs:]): (-[WKWebView _certificateChain]): (-[WKWebView _committedURL]): (-[WKWebView _MIMEType]): (-[WKWebView _userAgent]): (-[WKWebView _applicationNameForUserAgent]): (-[WKWebView _setApplicationNameForUserAgent:]): (-[WKWebView _customUserAgent]): (-[WKWebView _setCustomUserAgent:]): (-[WKWebView _setUserContentExtensionsEnabled:]): (-[WKWebView _userContentExtensionsEnabled]): (-[WKWebView _webProcessIdentifier]): (-[WKWebView _provisionalWebProcessIdentifier]): (-[WKWebView _killWebContentProcess]): (-[WKWebView _safeBrowsingWarning]): (-[WKWebView _reloadWithoutContentBlockers]): (-[WKWebView _reloadExpiredOnly]): (-[WKWebView _killWebContentProcessAndResetState]): (-[WKWebView _convertRectFromRootViewCoordinates:]): (-[WKWebView _convertRectToRootViewCoordinates:]): (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): (-[WKWebView _focusTextInputContext:completionHandler:]): (-[WKWebView _takePDFSnapshotWithConfiguration:completionHandler:]): (-[WKWebView _setShouldSuppressFirstResponderChanges:]): (-[WKWebView _retainActiveFocusedState]): (-[WKWebView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]): (-[WKWebView _snapshotLayerContentsForBackForwardListItem:]): (-[WKWebView _dataDetectionResults]): (-[WKWebView _accessibilityRetrieveSpeakSelectionContent]): (-[WKWebView _accessibilityDidGetSpeakSelectionContent:]): (-[WKWebView inputAssistantItem]): (-[WKWebView _sessionStateData]): (-[WKWebView _sessionState]): (-[WKWebView _sessionStateWithFilter:]): (-[WKWebView _restoreFromSessionStateData:]): (-[WKWebView _restoreSessionState:andNavigate:]): (-[WKWebView _close]): (-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]): (-[WKWebView _insertAttachmentWithFileWrapper:contentType:options:completion:]): (-[WKWebView _insertAttachmentWithFileWrapper:contentType:completion:]): (-[WKWebView _attachmentForIdentifier:]): (-[WKWebView _simulateDeviceOrientationChangeWithAlpha:beta:gamma:]): (+[WKWebView _handlesSafeBrowsing]): (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]): (-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:details:completionHandler:]): (+[WKWebView _confirmMalwareSentinel]): (+[WKWebView _visitUnsafeWebsiteSentinel]): (-[WKWebView _isJITEnabled:]): (-[WKWebView _evaluateJavaScriptWithoutUserGesture:completionHandler:]): (-[WKWebView _updateWebsitePolicies:]): (-[WKWebView _allowsRemoteInspection]): (-[WKWebView _setAllowsRemoteInspection:]): (-[WKWebView _remoteInspectionNameOverride]): (-[WKWebView _setRemoteInspectionNameOverride:]): (-[WKWebView _addsVisitedLinks]): (-[WKWebView _setAddsVisitedLinks:]): (-[WKWebView _networkRequestsInProgress]): (layoutMilestones): (-[WKWebView _setObservedRenderingProgressEvents:]): (-[WKWebView _getMainResourceDataWithCompletionHandler:]): (-[WKWebView _getWebArchiveDataWithCompletionHandler:]): (-[WKWebView _getContentsAsStringWithCompletionHandler:]): (-[WKWebView _getContentsAsAttributedStringWithCompletionHandler:]): (-[WKWebView _getApplicationManifestWithCompletionHandler:]): (-[WKWebView _paginationMode]): (-[WKWebView _setPaginationMode:]): (-[WKWebView _paginationBehavesLikeColumns]): (-[WKWebView _setPaginationBehavesLikeColumns:]): (-[WKWebView _pageLength]): (-[WKWebView _setPageLength:]): (-[WKWebView _gapBetweenPages]): (-[WKWebView _setGapBetweenPages:]): (-[WKWebView _paginationLineGridEnabled]): (-[WKWebView _setPaginationLineGridEnabled:]): (-[WKWebView _pageCount]): (-[WKWebView _supportsTextZoom]): (-[WKWebView _textZoomFactor]): (-[WKWebView _setTextZoomFactor:]): (-[WKWebView setPageZoom:]): (-[WKWebView pageZoom]): (-[WKWebView _pageZoomFactor]): (-[WKWebView _setPageZoomFactor:]): (-[WKWebView _diagnosticLoggingDelegate]): (-[WKWebView _setDiagnosticLoggingDelegate:]): (-[WKWebView _findDelegate]): (-[WKWebView _setFindDelegate:]): (toFindOptions): (-[WKWebView _countStringMatches:options:maxCount:]): (-[WKWebView _findString:options:maxCount:]): (-[WKWebView _hideFindUI]): (-[WKWebView _saveBackForwardSnapshotForItem:]): (-[WKWebView _inputDelegate]): (-[WKWebView _setInputDelegate:]): (-[WKWebView _isDisplayingStandaloneImageDocument]): (-[WKWebView _isDisplayingStandaloneMediaDocument]): (-[WKWebView _isPlayingAudio]): (-[WKWebView _isShowingNavigationGestureSnapshot]): (-[WKWebView _layoutMode]): (-[WKWebView _setLayoutMode:]): (-[WKWebView _fixedLayoutSize]): (-[WKWebView _setFixedLayoutSize:]): (-[WKWebView _setBackgroundExtendsBeyondPage:]): (-[WKWebView _backgroundExtendsBeyondPage]): (-[WKWebView _viewScale]): (-[WKWebView _setViewScale:]): (-[WKWebView _setMinimumEffectiveDeviceWidth:]): (-[WKWebView _minimumEffectiveDeviceWidth]): (-[WKWebView _setScrollPerformanceDataCollectionEnabled:]): (-[WKWebView _scrollPerformanceDataCollectionEnabled]): (-[WKWebView _scrollPerformanceData]): (-[WKWebView _allowsMediaDocumentInlinePlayback]): (-[WKWebView _setAllowsMediaDocumentInlinePlayback:]): (-[WKWebView _webProcessIsResponsive]): (-[WKWebView _setFullscreenDelegate:]): (-[WKWebView _fullscreenDelegate]): (-[WKWebView _isInFullscreen]): (-[WKWebView _mediaCaptureState]): (-[WKWebView _setMediaCaptureEnabled:]): (-[WKWebView _mediaCaptureEnabled]): (-[WKWebView _setPageMuted:]): (-[WKWebView _removeDataDetectedLinks:]): (-[WKWebView _doAfterNextPresentationUpdate:]): (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]): (-[WKWebView _doAfterNextStablePresentationUpdate:]): (-[WKWebView _detectDataWithTypes:completionHandler:]): (-[WKWebView removeFromSuperview]): (-[WKWebView _minimumLayoutSizeOverride]): (-[WKWebView _setViewLayoutSizeOverride:]): (-[WKWebView _obscuredInsets]): (-[WKWebView _setObscuredInsets:]): (-[WKWebView _obscuredInsetEdgesAffectedBySafeArea]): (-[WKWebView _setObscuredInsetEdgesAffectedBySafeArea:]): (-[WKWebView _unobscuredSafeAreaInsets]): (-[WKWebView _setUnobscuredSafeAreaInsets:]): (-[WKWebView _safeAreaShouldAffectObscuredInsets]): (-[WKWebView _setInterfaceOrientationOverride:]): (-[WKWebView _interfaceOrientationOverride]): (-[WKWebView _clearInterfaceOrientationOverride]): (-[WKWebView _maximumUnobscuredSizeOverride]): (-[WKWebView _setMaximumUnobscuredSizeOverride:]): (-[WKWebView _setAllowsViewportShrinkToFit:]): (-[WKWebView _allowsViewportShrinkToFit]): (-[WKWebView _beginInteractiveObscuredInsetsChange]): (-[WKWebView _endInteractiveObscuredInsetsChange]): (-[WKWebView _hideContentUntilNextUpdate]): (-[WKWebView _beginAnimatedResizeWithUpdates:]): (-[WKWebView _endAnimatedResize]): (-[WKWebView _resizeWhileHidingContentWithUpdates:]): (-[WKWebView _setOverlaidAccessoryViewsInset:]): (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:maximumUnobscuredSizeOverride:]): (-[WKWebView _clearOverrideLayoutParameters]): (viewportArgumentsFromDictionary): (-[WKWebView _overrideViewportWithArguments:]): (-[WKWebView _viewForFindUI]): (-[WKWebView _isDisplayingPDF]): (-[WKWebView _dataForDisplayedPDF]): (-[WKWebView _suggestedFilenameForDisplayedPDF]): (-[WKWebView _webViewPrintFormatter]): (toUserInterfaceLayoutDirection): (-[WKWebView setSemanticContentAttribute:]): (-[WKWebView _drawsBackground]): (-[WKWebView _setDrawsBackground:]): (-[WKWebView _backgroundColor]): (-[WKWebView _setBackgroundColor:]): (-[WKWebView _setDrawsTransparentBackground:]): (-[WKWebView _inspectorAttachmentView]): (-[WKWebView _setInspectorAttachmentView:]): (-[WKWebView _setOverlayScrollbarStyle:]): (-[WKWebView _overlayScrollbarStyle]): (-[WKWebView _windowOcclusionDetectionEnabled]): (-[WKWebView _setWindowOcclusionDetectionEnabled:]): (-[WKWebView shareSheetDidDismiss:]): (-[WKWebView _setOverrideDeviceScaleFactor:]): (-[WKWebView _overrideDeviceScaleFactor]): (-[WKWebView _setTopContentInset:]): (-[WKWebView _topContentInset]): (-[WKWebView _pageExtendedBackgroundColor]): (-[WKWebView _pinnedState]): (-[WKWebView _rubberBandingEnabled]): (-[WKWebView _setRubberBandingEnabled:]): (-[WKWebView _immediateActionAnimationControllerForHitTestResult:withType:userData:]): (-[WKWebView _setAutomaticallyAdjustsContentInsets:]): (-[WKWebView _automaticallyAdjustsContentInsets]): (-[WKWebView _minimumLayoutWidth]): (-[WKWebView _setMinimumLayoutWidth:]): (-[WKWebView _shouldExpandContentToViewHeightForAutoLayout]): (-[WKWebView _setShouldExpandContentToViewHeightForAutoLayout:]): (-[WKWebView _alwaysShowsHorizontalScroller]): (-[WKWebView _setAlwaysShowsHorizontalScroller:]): (-[WKWebView _alwaysShowsVerticalScroller]): (-[WKWebView _setAlwaysShowsVerticalScroller:]): (-[WKWebView _printOperationWithPrintInfo:]): (-[WKWebView _printOperationWithPrintInfo:forFrame:]): (-[WKWebView setUserInterfaceLayoutDirection:]): (-[WKWebView _wantsMediaPlaybackControlsView]): (-[WKWebView _setWantsMediaPlaybackControlsView:]): (-[WKWebView _mediaPlaybackControlsView]): (-[WKWebView _addMediaPlaybackControlsView:]): (-[WKWebView _removeMediaPlaybackControlsView]): (-[WKWebView _prepareForMoveToWindow:completionHandler:]): (-[WKWebView _setThumbnailView:]): (-[WKWebView _thumbnailView]): (-[WKWebView _setIgnoresAllEvents:]): (-[WKWebView _ignoresAllEvents]): (-[WKWebView _spellCheckerDocumentTag]): (-[WKWebView _setContinuousSpellCheckingEnabledForTesting:]): Deleted. (-[WKWebView _contentsOfUserInterfaceItem:]): Deleted. (-[WKWebView _setDeviceOrientationUserPermissionHandlerForTesting:]): Deleted. (-[WKWebView keyboardAccessoryBarNext]): Deleted. (-[WKWebView keyboardAccessoryBarPrevious]): Deleted. (-[WKWebView applyAutocorrection:toString:withCompletionHandler:]): Deleted. (-[WKWebView dismissFormAccessoryView]): Deleted. (-[WKWebView _dismissFilePicker]): Deleted. (-[WKWebView setTimePickerValueToHour:minute:]): Deleted. (-[WKWebView selectFormAccessoryPickerRow:]): Deleted. (-[WKWebView selectFormPopoverTitle]): Deleted. (-[WKWebView textContentTypeForTesting]): Deleted. (-[WKWebView formInputLabel]): Deleted. (-[WKWebView _didShowContextMenu]): Deleted. (-[WKWebView _didDismissContextMenu]): Deleted. (-[WKWebView _inputViewBounds]): Deleted. (-[WKWebView _uiTextSelectionRects]): Deleted. (-[WKWebView _scrollingTreeAsText]): Deleted. (-[WKWebView _stableStateOverride]): Deleted. (-[WKWebView _propertiesOfLayerWithID:]): Deleted. (-[WKWebView _doAfterResettingSingleTapGesture:]): Deleted. (-[WKWebView _doAfterReceivingEditDragSnapshotForTesting:]): Deleted. (-[WKWebView _requestControlledElementID]): Deleted. (-[WKWebView _handleControlledElementIDResponse:]): Deleted. (-[WKWebView _handleAcceptedCandidate:]): Deleted. (-[WKWebView _didHandleAcceptedCandidate]): Deleted. (-[WKWebView _didUpdateCandidateListVisibility:]): Deleted. (-[WKWebView _forceRequestCandidates]): Deleted. (-[WKWebView _shouldRequestCandidates]): Deleted. (-[WKWebView _insertText:replacementRange:]): Deleted. (-[WKWebView _candidateRect]): Deleted. (-[WKWebView viewDidChangeEffectiveAppearance]): Deleted. (-[WKWebView _setHeaderBannerHeight:]): Deleted. (-[WKWebView _setFooterBannerHeight:]): Deleted. (-[WKWebView _doAfterProcessingAllPendingMouseEvents:]): Deleted. (-[WKWebView _activeMenu]): Deleted. (-[WKWebView _requestActiveNowPlayingSessionInfo:]): Deleted. (-[WKWebView _setPageScale:withOrigin:]): Deleted. (-[WKWebView _pageScale]): Deleted. (-[WKWebView _scrollingUpdatesDisabledForTesting]): Deleted. (-[WKWebView _setScrollingUpdatesDisabledForTesting:]): Deleted. (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForAnimatedResizeForTesting:]): Deleted. (-[WKWebView _doAfterNextVisibleContentRectUpdate:]): Deleted. (-[WKWebView _disableBackForwardSnapshotVolatilityForTesting]): Deleted. (-[WKWebView _dragCaretRect]): Deleted. (-[WKWebView _simulateLongPressActionAtLocation:]): Deleted. (-[WKWebView _simulateTextEntered:]): Deleted. (-[WKWebView _dynamicUserInterfaceTraitDidChange]): Deleted. (-[WKWebView _beginBackSwipeForTesting]): Deleted. (-[WKWebView _completeBackSwipeForTesting]): Deleted. (-[WKWebView _setDefersLoadingForTesting:]): Deleted. (-[WKWebView _setShareSheetCompletesImmediatelyWithResolutionForTesting:]): Deleted. (-[WKWebView _hasInspectorFrontend]): Deleted. (-[WKWebView _processWillSuspendImminentlyForTesting]): Deleted. (-[WKWebView _processDidResumeForTesting]): Deleted. (-[WKWebView _setAssertionStateForTesting:]): Deleted. (-[WKWebView _hasServiceWorkerBackgroundActivityForTesting]): Deleted. (-[WKWebView _hasServiceWorkerForegroundActivityForTesting]): Deleted. (-[WKWebView _denyNextUserMediaRequest]): Deleted. (-[WKWebView _triggerSystemPreviewActionOnElement:document:page:]): Deleted. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: Added. * UIProcess/API/Cocoa/WKWebViewTesting.mm: Added. (-[WKWebView _setPageScale:withOrigin:]): (-[WKWebView _pageScale]): (-[WKWebView _setContinuousSpellCheckingEnabledForTesting:]): (-[WKWebView _contentsOfUserInterfaceItem:]): (-[WKWebView _requestActiveNowPlayingSessionInfo:]): (-[WKWebView _scrollingUpdatesDisabledForTesting]): (-[WKWebView _setScrollingUpdatesDisabledForTesting:]): (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForAnimatedResizeForTesting:]): (-[WKWebView _doAfterNextVisibleContentRectUpdate:]): (-[WKWebView _disableBackForwardSnapshotVolatilityForTesting]): (-[WKWebView _beginBackSwipeForTesting]): (-[WKWebView _completeBackSwipeForTesting]): (-[WKWebView _setDefersLoadingForTesting:]): (-[WKWebView _setShareSheetCompletesImmediatelyWithResolutionForTesting:]): (-[WKWebView _hasInspectorFrontend]): (-[WKWebView _processWillSuspendImminentlyForTesting]): (-[WKWebView _processDidResumeForTesting]): (-[WKWebView _setAssertionStateForTesting:]): (-[WKWebView _hasServiceWorkerBackgroundActivityForTesting]): (-[WKWebView _hasServiceWorkerForegroundActivityForTesting]): (-[WKWebView _denyNextUserMediaRequest]): * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h: Added. * UIProcess/API/ios/WKWebViewTestingIOS.mm: Added. (-[WKWebView keyboardAccessoryBarNext]): (-[WKWebView keyboardAccessoryBarPrevious]): (-[WKWebView applyAutocorrection:toString:withCompletionHandler:]): (-[WKWebView dismissFormAccessoryView]): (-[WKWebView _dismissFilePicker]): (-[WKWebView setTimePickerValueToHour:minute:]): (-[WKWebView selectFormAccessoryPickerRow:]): (-[WKWebView selectFormPopoverTitle]): (-[WKWebView textContentTypeForTesting]): (-[WKWebView formInputLabel]): (-[WKWebView _didShowContextMenu]): (-[WKWebView _didDismissContextMenu]): (-[WKWebView _inputViewBounds]): (-[WKWebView _uiTextSelectionRects]): (-[WKWebView _scrollingTreeAsText]): (-[WKWebView _stableStateOverride]): (-[WKWebView _propertiesOfLayerWithID:]): (-[WKWebView _doAfterResettingSingleTapGesture:]): (-[WKWebView _doAfterReceivingEditDragSnapshotForTesting:]): (-[WKWebView _dragCaretRect]): (-[WKWebView _simulateLongPressActionAtLocation:]): (-[WKWebView _simulateTextEntered:]): (-[WKWebView _dynamicUserInterfaceTraitDidChange]): (-[WKWebView _triggerSystemPreviewActionOnElement:document:page:]): (-[WKWebView _setDeviceOrientationUserPermissionHandlerForTesting:]): * UIProcess/API/mac/WKWebViewPrivateForTestingMac.h: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/InteractionDeadlockAfterCrash.mm. * UIProcess/API/mac/WKWebViewTestingMac.mm: Added. (-[WKWebView _requestControlledElementID]): (-[WKWebView _handleControlledElementIDResponse:]): (-[WKWebView _handleAcceptedCandidate:]): (-[WKWebView _didHandleAcceptedCandidate]): (-[WKWebView _didUpdateCandidateListVisibility:]): (-[WKWebView _forceRequestCandidates]): (-[WKWebView _shouldRequestCandidates]): (-[WKWebView _insertText:replacementRange:]): (-[WKWebView _candidateRect]): (-[WKWebView viewDidChangeEffectiveAppearance]): (-[WKWebView _setHeaderBannerHeight:]): (-[WKWebView _setFooterBannerHeight:]): (-[WKWebView _doAfterProcessingAllPendingMouseEvents:]): (-[WKWebView _activeMenu]): * UIProcess/Cocoa/PageClientImplCocoa.mm: * UIProcess/ios/PageClientImplIOS.mm: * UIProcess/ios/WKContentViewInteraction.mm: * UIProcess/ios/WKMouseGestureRecognizer.h: * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: * UIProcess/mac/PageClientImplMac.mm: * UIProcess/mac/WKFullScreenWindowController.h: * WebKit.xcodeproj/project.pbxproj: 2019-12-12 Per Arne Vollan <pvollan@apple.com> [iOS] Add sandbox telemetry to mach lookup rules in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=205175 Reviewed by Brent Fulgham. We have already added telemetry to many mach lookup rules, but some were missing telemetry. No new tests, no behavior change. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-12-12 Sihui Liu <sihui_liu@apple.com> IndexedDB: make WebIDBServer a MessageReceiver to replace WebIDBConnection https://bugs.webkit.org/show_bug.cgi?id=205145 Reviewed by Alex Christensen. Work towards <rdar://problem/56908496>. Move message handling from WebIDBConnectionToClient to WebIDBServer. Also, WebIDBConnectionClient now is owned by WebIDBServer instead of NetworkConnectionToWebProcess. No behavior change. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient): (WebKit::WebIDBConnectionToClient::messageSenderConnection const): (WebKit::WebIDBConnectionToClient::idbServer): Deleted. (WebKit::WebIDBConnectionToClient::disconnectedFromWebProcess): Deleted. (WebKit::WebIDBConnectionToClient::deleteDatabase): Deleted. (WebKit::WebIDBConnectionToClient::openDatabase): Deleted. (WebKit::WebIDBConnectionToClient::abortTransaction): Deleted. (WebKit::WebIDBConnectionToClient::commitTransaction): Deleted. (WebKit::WebIDBConnectionToClient::didFinishHandlingVersionChangeTransaction): Deleted. (WebKit::WebIDBConnectionToClient::createObjectStore): Deleted. (WebKit::WebIDBConnectionToClient::deleteObjectStore): Deleted. (WebKit::WebIDBConnectionToClient::renameObjectStore): Deleted. (WebKit::WebIDBConnectionToClient::clearObjectStore): Deleted. (WebKit::WebIDBConnectionToClient::createIndex): Deleted. (WebKit::WebIDBConnectionToClient::deleteIndex): Deleted. (WebKit::WebIDBConnectionToClient::renameIndex): Deleted. (WebKit::WebIDBConnectionToClient::putOrAdd): Deleted. (WebKit::WebIDBConnectionToClient::getRecord): Deleted. (WebKit::WebIDBConnectionToClient::getAllRecords): Deleted. (WebKit::WebIDBConnectionToClient::getCount): Deleted. (WebKit::WebIDBConnectionToClient::deleteRecord): Deleted. (WebKit::WebIDBConnectionToClient::openCursor): Deleted. (WebKit::WebIDBConnectionToClient::iterateCursor): Deleted. (WebKit::WebIDBConnectionToClient::establishTransaction): Deleted. (WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose): Deleted. (WebKit::WebIDBConnectionToClient::databaseConnectionClosed): Deleted. (WebKit::WebIDBConnectionToClient::abortOpenAndUpgradeNeeded): Deleted. (WebKit::WebIDBConnectionToClient::didFireVersionChangeEvent): Deleted. (WebKit::WebIDBConnectionToClient::openDBRequestCancelled): Deleted. (WebKit::WebIDBConnectionToClient::confirmDidCloseFromServer): Deleted. (WebKit::WebIDBConnectionToClient::getAllDatabaseNames): Deleted. * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::getAllDatabaseNames): (WebKit::WebIDBServer::addConnection): (WebKit::WebIDBServer::removeConnection): * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/IndexedDB/WebIDBServer.messages.in: Renamed from Source/WebKit/NetworkProcess/IndexedDB/WebIDBConnectionToClient.messages.in. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): (WebKit::NetworkConnectionToWebProcess::didClose): (WebKit::NetworkConnectionToWebProcess::findNetworkActivityTracker): (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer): Deleted. NetworkConnectionToWebProcess::establishIDBConnectionToServer was used to ensure WebIDBConnectionToCilent member exists in NetworkConnectionToWebProcess. Now WebIDBConnectionToCilent is created in WebIDBServer::addConnection(when NetworkConnectionToWebProcess is created), so we don't need the message to do initialization. * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::createNetworkConnectionToWebProcess): (WebKit::NetworkProcess::connectionToWebProcessClosed): * NetworkProcess/NetworkProcess.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp: (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer): (WebKit::WebIDBConnectionToServer::deleteDatabase): (WebKit::WebIDBConnectionToServer::openDatabase): (WebKit::WebIDBConnectionToServer::abortTransaction): (WebKit::WebIDBConnectionToServer::commitTransaction): (WebKit::WebIDBConnectionToServer::didFinishHandlingVersionChangeTransaction): (WebKit::WebIDBConnectionToServer::createObjectStore): (WebKit::WebIDBConnectionToServer::deleteObjectStore): (WebKit::WebIDBConnectionToServer::renameObjectStore): (WebKit::WebIDBConnectionToServer::clearObjectStore): (WebKit::WebIDBConnectionToServer::createIndex): (WebKit::WebIDBConnectionToServer::deleteIndex): (WebKit::WebIDBConnectionToServer::renameIndex): (WebKit::WebIDBConnectionToServer::putOrAdd): (WebKit::WebIDBConnectionToServer::getRecord): (WebKit::WebIDBConnectionToServer::getAllRecords): (WebKit::WebIDBConnectionToServer::getCount): (WebKit::WebIDBConnectionToServer::deleteRecord): (WebKit::WebIDBConnectionToServer::openCursor): (WebKit::WebIDBConnectionToServer::iterateCursor): (WebKit::WebIDBConnectionToServer::establishTransaction): (WebKit::WebIDBConnectionToServer::databaseConnectionPendingClose): (WebKit::WebIDBConnectionToServer::databaseConnectionClosed): (WebKit::WebIDBConnectionToServer::abortOpenAndUpgradeNeeded): (WebKit::WebIDBConnectionToServer::didFireVersionChangeEvent): (WebKit::WebIDBConnectionToServer::openDBRequestCancelled): (WebKit::WebIDBConnectionToServer::confirmDidCloseFromServer): (WebKit::WebIDBConnectionToServer::getAllDatabaseNames): 2019-12-12 Chris Dumez <cdumez@apple.com> Regression(r253394) swipe/basic-cached-back-swipe.html is timing out on iOS https://bugs.webkit.org/show_bug.cgi?id=205173 Reviewed by Tim Horton. Test test was calling beginSimulatedSwipeInDirectionForTesting / completeSimulatedSwipeInDirectionForTesting on the ViewGestureController. This was causing beginSwipeGesture() and endSwipeGesture() but not willEndSwipeGesture(). This was causing the timeout since willEndSwipeGesture() now actually triggers the load. This patch also gets rid of the SnapshotRemovalTracker::SwipeAnimationEnd. We don't really need it since we already wait for SnapshotRemovalTracker::RepaintAfterNavigation and we won't repaint until the swipe animation is over (due to the layer tree being frozen during the swipe animation). The SwipeAnimationEnd was causing trouble because the provisional load may not have started yet by the time endSwipeGesture() is called, which means that the call to eventOccurred(SwipeAnimationEnd) would get ignored because the SnapshotRemovalTracker is still paused (it gets unpaused when the provisional load actually starts). * UIProcess/ViewGestureController.h: * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::beginSwipeGesture): (WebKit::ViewGestureController::willEndSwipeGesture): (WebKit::ViewGestureController::endSwipeGesture): 2019-12-12 Alex Christensen <achristensen@webkit.org> NetworkDataTaskCocoa and NetworkSessionCocoa should use public methods instead of being friends https://bugs.webkit.org/show_bug.cgi?id=204242 Reviewed by Chris Dumez. This makes them stay good abstractions, and probably could make a good meme about not having any friends. * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded): * NetworkProcess/cocoa/NetworkSessionCocoa.h: 2019-12-12 Per Arne Vollan <pvollan@apple.com> [iOS] Deny mach lookup access to content filter service in the WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=205077 Reviewed by Brent Fulgham. Mach lookup access to the content filter service in the WebContent process is only needed if [WebFilterEvaluator isManagedSession] evaluates to true. If this is the case, issue the needed mach lookup sandbox extension to the WebContent process, where it will be consumed. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2019-12-12 Carlos Garcia Campos <cgarcia@igalia.com> WebDriver: tests is_element_enabled/enabled.py::test_fieldset_disabled_descendant are failing https://bugs.webkit.org/show_bug.cgi?id=204700 Reviewed by Carlos Alberto Lopez Perez. Add ElementEnabled atom to easily implement is element enabled command. * UIProcess/Automation/atoms/ElementEnabled.js: Added. (isEnabled.isDisabledAttributeSupported): (isEnabled.findParent): (isEnabled): 2019-12-11 Jiewen Tan <jiewen_tan@apple.com> Unreviewed, a nit after r253366 * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: Change the parameter type of the completion handler from NSData to NSString. 2019-12-11 Daniel Bates <dabates@apple.com> Remove unused Frame parameter from moveByGranularityRespectingWordBoundary() and take const VisiblePosition& https://bugs.webkit.org/show_bug.cgi?id=205137 Reviewed by Wenson Hsieh. moveByGranularityRespectingWordBoundary() never makes use of the passed Frame and does not mutate the passed VisiblePosition. So, do not accept the former and take the latter as a const lvalue reference. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::moveByGranularityRespectingWordBoundary): (WebKit::WebPage::requestDocumentEditingContext): 2019-12-11 Daniel Bates <dabates@apple.com> UIWKDocumentContext returns 0 character rects when caret is at beginning or end of text https://bugs.webkit.org/show_bug.cgi?id=205135 <rdar://problem/56887914> Reviewed by Wenson Hsieh. When the specified position to move from is at the beginning or end of the text then return the position of the beginning or end of the nearest word based on the specified direction. Currently we always return the null position. As a result we do not compute a valid character range to convert to rectangles. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::moveByGranularityRespectingWordBoundary): 2019-12-11 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Combine AuthenticatorResponse and PublicKeyCredentialData https://bugs.webkit.org/show_bug.cgi?id=190783 <rdar://problem/57781183> Reviewed by Brent Fulgham. Code in WebKit are changed to use AuthenticatorResponse and its subtypes. * UIProcess/WebAuthentication/Authenticator.h: * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::respondReceived): (WebKit::AuthenticatorManager::invokePendingCompletionHandler): * UIProcess/WebAuthentication/AuthenticatorManager.h: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested): (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented): * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp: (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest): * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h: * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in: * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp: (WebKit::CtapAuthenticator::continueMakeCredentialAfterResponseReceived const): (WebKit::CtapAuthenticator::continueGetAssertionAfterResponseReceived): * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp: (WebKit::U2fAuthenticator::continueRegisterCommandAfterResponseReceived): (WebKit::U2fAuthenticator::continueSignCommandAfterResponseReceived): * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: 2019-12-11 Truitt Savell <tsavell@apple.com> Unreviewed, rolling out r253376. Broke internal builds Reverted changeset: "Move WKWebView code related to testing to new files, with their own headers, and stop exposing test-only functions as SPI." https://bugs.webkit.org/show_bug.cgi?id=205021 https://trac.webkit.org/changeset/253376 2019-12-11 Chris Dumez <cdumez@apple.com> There should be no user-noticeable delay when closing a tab https://bugs.webkit.org/show_bug.cgi?id=205069 <rdar://problem/57797494> Reviewed by Ryosuke Niwa. There should be no user-noticeable delay when closing a tab. To achieve this, use a timeout of 50ms for doing the IPC handshake with the WebContent process, instead of 500ms. * UIProcess/WebPageProxy.cpp: 2019-12-11 Chris Dumez <cdumez@apple.com> [iOS] Issue load sooner on swipe back/forward navigation https://bugs.webkit.org/show_bug.cgi?id=205127 <rdar://problem/57843862> Reviewed by Tim Horton. Issue load sooner on swipe back/forward navigation on iOS. We were waiting until the end of the swipe animation to issue the load. We now issue the load as soon as the user lifts the finger off the screen and thus commits to navigating. This results in improved perceived performance when swiping back/forward to navigate. * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::didStartProvisionalOrSameDocumentLoadForMainFrame): (WebKit::ViewGestureController::willEndSwipeGesture): * UIProcess/ViewGestureController.h: * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::beginSwipeGesture): (WebKit::ViewGestureController::willEndSwipeGesture): (WebKit::ViewGestureController::endSwipeGesture): 2019-12-11 Sihui Liu <sihui_liu@apple.com> IndexedDB: Introduce WebIDBServer class https://bugs.webkit.org/show_bug.cgi?id=205095 Reviewed by Alex Christensen. Work towards <rdar://problem/56908496>. WebIDBServer currently is just a wrapper of WebCore::IDBServer. * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: (WebKit::WebIDBConnectionToClient::idbServer): * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: * NetworkProcess/IndexedDB/WebIDBServer.cpp: Added. (WebKit::WebIDBServer::create): (WebKit::WebIDBServer::WebIDBServer): (WebKit::WebIDBServer::registerConnection): (WebKit::WebIDBServer::unregisterConnection): (WebKit::WebIDBServer::closeAndDeleteDatabasesModifiedSince): (WebKit::WebIDBServer::closeAndDeleteDatabasesForOrigins): (WebKit::WebIDBServer::suspend): (WebKit::WebIDBServer::resume): (WebKit::WebIDBServer::openDatabase): (WebKit::WebIDBServer::deleteDatabase): (WebKit::WebIDBServer::abortTransaction): (WebKit::WebIDBServer::commitTransaction): (WebKit::WebIDBServer::didFinishHandlingVersionChangeTransaction): (WebKit::WebIDBServer::createObjectStore): (WebKit::WebIDBServer::deleteObjectStore): (WebKit::WebIDBServer::renameObjectStore): (WebKit::WebIDBServer::clearObjectStore): (WebKit::WebIDBServer::createIndex): (WebKit::WebIDBServer::deleteIndex): (WebKit::WebIDBServer::renameIndex): (WebKit::WebIDBServer::putOrAdd): (WebKit::WebIDBServer::getRecord): (WebKit::WebIDBServer::getAllRecords): (WebKit::WebIDBServer::getCount): (WebKit::WebIDBServer::deleteRecord): (WebKit::WebIDBServer::openCursor): (WebKit::WebIDBServer::iterateCursor): (WebKit::WebIDBServer::establishTransaction): (WebKit::WebIDBServer::databaseConnectionPendingClose): (WebKit::WebIDBServer::databaseConnectionClosed): (WebKit::WebIDBServer::abortOpenAndUpgradeNeeded): (WebKit::WebIDBServer::didFireVersionChangeEvent): (WebKit::WebIDBServer::openDBRequestCancelled): (WebKit::WebIDBServer::getAllDatabaseNames): (WebKit::WebIDBServer::confirmDidCloseFromServer): * NetworkProcess/IndexedDB/WebIDBServer.h: Added. * NetworkProcess/NetworkProcess.cpp: replace WebCore::IDBServer with WebIDBServer. (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains): (WebKit::NetworkProcess::prepareToSuspend): (WebKit::NetworkProcess::resume): (WebKit::NetworkProcess::createWebIDBServer): (WebKit::NetworkProcess::webIDBServer): (WebKit::NetworkProcess::createIDBServer): Deleted. (WebKit::NetworkProcess::idbServer): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::requestSpace): * Sources.txt: * WebKit.xcodeproj/project.pbxproj: 2019-12-11 Don Olmstead <don.olmstead@sony.com> [CMake] Add HarfBuzz targets https://bugs.webkit.org/show_bug.cgi?id=205042 Reviewed by Konstantin Tokarev. Use the HarfBuzz targets directly instead of HARFBUZZ_LIBRARIES and HARFBUZZ_INCLUDE_DIRS. * PlatformGTK.cmake: * PlatformWPE.cmake: 2019-12-11 Jiewen Tan <jiewen_tan@apple.com> Unreviewed, a nit after r253366 * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: Improve the naming of the new SPI a bit. 2019-12-11 Wenson Hsieh <wenson_hsieh@apple.com> Make incremental builds faster after modifying DisplayListItems.h https://bugs.webkit.org/show_bug.cgi?id=205032 Reviewed by Tim Horton. Include DisplayListItems.h directly, since these need to know about the actual display list items (and how to encode or decode them). * GPUProcess/GPUConnectionToWebProcess.h: 2019-12-10 Simon Fraser <simon.fraser@apple.com> Move WKWebView code related to testing to new files, with their own headers, and stop exposing test-only functions as SPI. https://bugs.webkit.org/show_bug.cgi?id=205021 Reviewed by Tim Horton. Stop exposing WKWebView (WKTesting) as SPI, because everyone added SPI here by mistake, and internal clients kept using testing SPI. Instead, move testing-only functions to internal headers that are not present in the built framework, and move to WKWebView (WKPrivate) properties and functions that webkit clients rely on. Add WKWebViewTesting/WKWebViewTestingMac/WKWebViewTestingIOS for test-only code. WKWebViewTesting* headers are copied to a "WebKitTestSupport" directory in the Products directory, and WTR/DRT and TestWebKitAPI get header search paths to find the headers there. * SourcesCocoa.txt: * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _internalDoAfterNextPresentationUpdate:withoutWaitingForPainting:withoutWaitingForAnimatedResize:]): (-[WKWebView _prepareForImmediateActionAnimation]): (-[WKWebView _cancelImmediateActionAnimation]): (-[WKWebView _completeImmediateActionAnimation]): (-[WKWebView _useSystemAppearance]): (-[WKWebView _setUseSystemAppearance:]): (-[WKWebView _pageRefForTransitionToWKWebView]): (-[WKWebView _canChangeFrameLayout:]): (-[WKWebView _tryToSwipeWithEvent:ignoringPinnedState:]): (-[WKWebView _ignoresNonWheelEvents]): (-[WKWebView _setIgnoresNonWheelEvents:]): (-[WKWebView _hasActiveVideoForControlsManager]): (-[WKWebView _dismissContentRelativeChildWindows]): (-[WKWebView _gestureEventWasNotHandledByWebCore:]): (-[WKWebView _disableFrameSizeUpdates]): (-[WKWebView _enableFrameSizeUpdates]): (-[WKWebView _beginDeferringViewInWindowChanges]): (-[WKWebView _endDeferringViewInWindowChanges]): (-[WKWebView _endDeferringViewInWindowChangesSync]): (-[WKWebView _fullScreenPlaceholderView]): (-[WKWebView _fullScreenWindow]): (-[WKWebView _underlayColor]): (-[WKWebView _setUnderlayColor:]): (-[WKWebView _setCustomSwipeViews:]): (-[WKWebView _setCustomSwipeViewsTopContentInset:]): (-[WKWebView _setDidMoveSwipeSnapshotCallback:]): (-[WKWebView _setFrame:andScrollBy:]): (-[WKWebView _setTotalHeightOfBanners:]): (-[WKWebView _totalHeightOfBanners]): (-[WKWebView _setFont:sender:]): (-[WKWebView _setFontSize:sender:]): (-[WKWebView _setTextColor:sender:]): (-[WKWebView inputAccessoryView]): (-[WKWebView inputView]): (-[WKWebView _requestActivatedElementAtPosition:completionBlock:]): (-[WKWebView _contentVisibleRect]): (-[WKWebView _convertPointFromContentsToView:]): (-[WKWebView _convertPointFromViewToContents:]): (-[WKWebView didStartFormControlInteraction]): (-[WKWebView didEndFormControlInteraction]): (-[WKWebView _uiTextCaretRect]): (-[WKWebView _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:]): (-[WKWebView _accessibilityStoreSelection]): (-[WKWebView _accessibilityClearSelection]): (-[WKWebView _contentViewIsFirstResponder]): (-[WKWebView _inspector]): (-[WKWebView _mainFrame]): (-[WKWebView _isEditable]): (-[WKWebView _setEditable:]): (-[WKWebView _executeEditCommand:argument:completion:]): (-[WKWebView _textManipulationDelegate]): (-[WKWebView _setTextManipulationDelegate:]): (-[WKWebView _startTextManipulationsWithConfiguration:completion:]): (-[WKWebView _completeTextManipulation:completion:]): (-[WKWebView _takeFindStringFromSelection:]): (+[WKWebView _stringForFind]): (+[WKWebView _setStringForFind:]): (-[WKWebView _remoteObjectRegistry]): (-[WKWebView _handle]): (-[WKWebView _observedRenderingProgressEvents]): (-[WKWebView _historyDelegate]): (-[WKWebView _setHistoryDelegate:]): (-[WKWebView _updateMediaPlaybackControlsManager]): (-[WKWebView _canTogglePictureInPicture]): (-[WKWebView _isPictureInPictureActive]): (-[WKWebView _togglePictureInPicture]): (-[WKWebView _closeAllMediaPresentations]): (-[WKWebView _stopMediaCapture]): (-[WKWebView _stopAllMediaPlayback]): (-[WKWebView _suspendAllMediaPlayback]): (-[WKWebView _resumeAllMediaPlayback]): (-[WKWebView _unreachableURL]): (-[WKWebView _mainFrameURL]): (-[WKWebView _loadAlternateHTMLString:baseURL:forUnreachableURL:]): (-[WKWebView _loadData:MIMEType:characterEncodingName:baseURL:userData:]): (-[WKWebView _loadRequest:shouldOpenExternalURLs:]): (-[WKWebView _certificateChain]): (-[WKWebView _committedURL]): (-[WKWebView _MIMEType]): (-[WKWebView _userAgent]): (-[WKWebView _applicationNameForUserAgent]): (-[WKWebView _setApplicationNameForUserAgent:]): (-[WKWebView _customUserAgent]): (-[WKWebView _setCustomUserAgent:]): (-[WKWebView _setUserContentExtensionsEnabled:]): (-[WKWebView _userContentExtensionsEnabled]): (-[WKWebView _webProcessIdentifier]): (-[WKWebView _provisionalWebProcessIdentifier]): (-[WKWebView _killWebContentProcess]): (-[WKWebView _safeBrowsingWarning]): (-[WKWebView _reloadWithoutContentBlockers]): (-[WKWebView _reloadExpiredOnly]): (-[WKWebView _killWebContentProcessAndResetState]): (-[WKWebView _convertRectFromRootViewCoordinates:]): (-[WKWebView _convertRectToRootViewCoordinates:]): (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): (-[WKWebView _focusTextInputContext:completionHandler:]): (-[WKWebView _takePDFSnapshotWithConfiguration:completionHandler:]): (-[WKWebView _setShouldSuppressFirstResponderChanges:]): (-[WKWebView _retainActiveFocusedState]): (-[WKWebView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]): (-[WKWebView _snapshotLayerContentsForBackForwardListItem:]): (-[WKWebView _dataDetectionResults]): (-[WKWebView _accessibilityRetrieveSpeakSelectionContent]): (-[WKWebView _accessibilityDidGetSpeakSelectionContent:]): (-[WKWebView inputAssistantItem]): (-[WKWebView _sessionStateData]): (-[WKWebView _sessionState]): (-[WKWebView _sessionStateWithFilter:]): (-[WKWebView _restoreFromSessionStateData:]): (-[WKWebView _restoreSessionState:andNavigate:]): (-[WKWebView _close]): (-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]): (-[WKWebView _insertAttachmentWithFileWrapper:contentType:options:completion:]): (-[WKWebView _insertAttachmentWithFileWrapper:contentType:completion:]): (-[WKWebView _attachmentForIdentifier:]): (-[WKWebView _simulateDeviceOrientationChangeWithAlpha:beta:gamma:]): (+[WKWebView _handlesSafeBrowsing]): (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]): (-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:details:completionHandler:]): (+[WKWebView _confirmMalwareSentinel]): (+[WKWebView _visitUnsafeWebsiteSentinel]): (-[WKWebView _isJITEnabled:]): (-[WKWebView _evaluateJavaScriptWithoutUserGesture:completionHandler:]): (-[WKWebView _updateWebsitePolicies:]): (-[WKWebView _allowsRemoteInspection]): (-[WKWebView _setAllowsRemoteInspection:]): (-[WKWebView _remoteInspectionNameOverride]): (-[WKWebView _setRemoteInspectionNameOverride:]): (-[WKWebView _addsVisitedLinks]): (-[WKWebView _setAddsVisitedLinks:]): (-[WKWebView _networkRequestsInProgress]): (layoutMilestones): (-[WKWebView _setObservedRenderingProgressEvents:]): (-[WKWebView _getMainResourceDataWithCompletionHandler:]): (-[WKWebView _getWebArchiveDataWithCompletionHandler:]): (-[WKWebView _getContentsAsStringWithCompletionHandler:]): (-[WKWebView _getContentsAsAttributedStringWithCompletionHandler:]): (-[WKWebView _getApplicationManifestWithCompletionHandler:]): (-[WKWebView _paginationMode]): (-[WKWebView _setPaginationMode:]): (-[WKWebView _paginationBehavesLikeColumns]): (-[WKWebView _setPaginationBehavesLikeColumns:]): (-[WKWebView _pageLength]): (-[WKWebView _setPageLength:]): (-[WKWebView _gapBetweenPages]): (-[WKWebView _setGapBetweenPages:]): (-[WKWebView _paginationLineGridEnabled]): (-[WKWebView _setPaginationLineGridEnabled:]): (-[WKWebView _pageCount]): (-[WKWebView _supportsTextZoom]): (-[WKWebView _textZoomFactor]): (-[WKWebView _setTextZoomFactor:]): (-[WKWebView setPageZoom:]): (-[WKWebView pageZoom]): (-[WKWebView _pageZoomFactor]): (-[WKWebView _setPageZoomFactor:]): (-[WKWebView _diagnosticLoggingDelegate]): (-[WKWebView _setDiagnosticLoggingDelegate:]): (-[WKWebView _findDelegate]): (-[WKWebView _setFindDelegate:]): (toFindOptions): (-[WKWebView _countStringMatches:options:maxCount:]): (-[WKWebView _findString:options:maxCount:]): (-[WKWebView _hideFindUI]): (-[WKWebView _saveBackForwardSnapshotForItem:]): (-[WKWebView _inputDelegate]): (-[WKWebView _setInputDelegate:]): (-[WKWebView _isDisplayingStandaloneImageDocument]): (-[WKWebView _isDisplayingStandaloneMediaDocument]): (-[WKWebView _isPlayingAudio]): (-[WKWebView _isShowingNavigationGestureSnapshot]): (-[WKWebView _layoutMode]): (-[WKWebView _setLayoutMode:]): (-[WKWebView _fixedLayoutSize]): (-[WKWebView _setFixedLayoutSize:]): (-[WKWebView _setBackgroundExtendsBeyondPage:]): (-[WKWebView _backgroundExtendsBeyondPage]): (-[WKWebView _viewScale]): (-[WKWebView _setViewScale:]): (-[WKWebView _setMinimumEffectiveDeviceWidth:]): (-[WKWebView _minimumEffectiveDeviceWidth]): (-[WKWebView _setScrollPerformanceDataCollectionEnabled:]): (-[WKWebView _scrollPerformanceDataCollectionEnabled]): (-[WKWebView _scrollPerformanceData]): (-[WKWebView _allowsMediaDocumentInlinePlayback]): (-[WKWebView _setAllowsMediaDocumentInlinePlayback:]): (-[WKWebView _webProcessIsResponsive]): (-[WKWebView _setFullscreenDelegate:]): (-[WKWebView _fullscreenDelegate]): (-[WKWebView _isInFullscreen]): (-[WKWebView _mediaCaptureState]): (-[WKWebView _setMediaCaptureEnabled:]): (-[WKWebView _mediaCaptureEnabled]): (-[WKWebView _setPageMuted:]): (-[WKWebView _removeDataDetectedLinks:]): (-[WKWebView _doAfterNextPresentationUpdate:]): (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]): (-[WKWebView _doAfterNextStablePresentationUpdate:]): (-[WKWebView _detectDataWithTypes:completionHandler:]): (-[WKWebView removeFromSuperview]): (-[WKWebView _minimumLayoutSizeOverride]): (-[WKWebView _setViewLayoutSizeOverride:]): (-[WKWebView _obscuredInsets]): (-[WKWebView _setObscuredInsets:]): (-[WKWebView _obscuredInsetEdgesAffectedBySafeArea]): (-[WKWebView _setObscuredInsetEdgesAffectedBySafeArea:]): (-[WKWebView _unobscuredSafeAreaInsets]): (-[WKWebView _setUnobscuredSafeAreaInsets:]): (-[WKWebView _safeAreaShouldAffectObscuredInsets]): (-[WKWebView _setInterfaceOrientationOverride:]): (-[WKWebView _interfaceOrientationOverride]): (-[WKWebView _clearInterfaceOrientationOverride]): (-[WKWebView _maximumUnobscuredSizeOverride]): (-[WKWebView _setMaximumUnobscuredSizeOverride:]): (-[WKWebView _setAllowsViewportShrinkToFit:]): (-[WKWebView _allowsViewportShrinkToFit]): (-[WKWebView _beginInteractiveObscuredInsetsChange]): (-[WKWebView _endInteractiveObscuredInsetsChange]): (-[WKWebView _hideContentUntilNextUpdate]): (-[WKWebView _beginAnimatedResizeWithUpdates:]): (-[WKWebView _endAnimatedResize]): (-[WKWebView _resizeWhileHidingContentWithUpdates:]): (-[WKWebView _setOverlaidAccessoryViewsInset:]): (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:maximumUnobscuredSizeOverride:]): (-[WKWebView _clearOverrideLayoutParameters]): (viewportArgumentsFromDictionary): (-[WKWebView _overrideViewportWithArguments:]): (-[WKWebView _viewForFindUI]): (-[WKWebView _isDisplayingPDF]): (-[WKWebView _dataForDisplayedPDF]): (-[WKWebView _suggestedFilenameForDisplayedPDF]): (-[WKWebView _webViewPrintFormatter]): (toUserInterfaceLayoutDirection): (-[WKWebView setSemanticContentAttribute:]): (-[WKWebView _drawsBackground]): (-[WKWebView _setDrawsBackground:]): (-[WKWebView _backgroundColor]): (-[WKWebView _setBackgroundColor:]): (-[WKWebView _setDrawsTransparentBackground:]): (-[WKWebView _inspectorAttachmentView]): (-[WKWebView _setInspectorAttachmentView:]): (-[WKWebView _setOverlayScrollbarStyle:]): (-[WKWebView _overlayScrollbarStyle]): (-[WKWebView _windowOcclusionDetectionEnabled]): (-[WKWebView _setWindowOcclusionDetectionEnabled:]): (-[WKWebView shareSheetDidDismiss:]): (-[WKWebView _setOverrideDeviceScaleFactor:]): (-[WKWebView _overrideDeviceScaleFactor]): (-[WKWebView _setTopContentInset:]): (-[WKWebView _topContentInset]): (-[WKWebView _pageExtendedBackgroundColor]): (-[WKWebView _pinnedState]): (-[WKWebView _rubberBandingEnabled]): (-[WKWebView _setRubberBandingEnabled:]): (-[WKWebView _immediateActionAnimationControllerForHitTestResult:withType:userData:]): (-[WKWebView _setAutomaticallyAdjustsContentInsets:]): (-[WKWebView _automaticallyAdjustsContentInsets]): (-[WKWebView _minimumLayoutWidth]): (-[WKWebView _setMinimumLayoutWidth:]): (-[WKWebView _shouldExpandContentToViewHeightForAutoLayout]): (-[WKWebView _setShouldExpandContentToViewHeightForAutoLayout:]): (-[WKWebView _alwaysShowsHorizontalScroller]): (-[WKWebView _setAlwaysShowsHorizontalScroller:]): (-[WKWebView _alwaysShowsVerticalScroller]): (-[WKWebView _setAlwaysShowsVerticalScroller:]): (-[WKWebView _printOperationWithPrintInfo:]): (-[WKWebView _printOperationWithPrintInfo:forFrame:]): (-[WKWebView setUserInterfaceLayoutDirection:]): (-[WKWebView _wantsMediaPlaybackControlsView]): (-[WKWebView _setWantsMediaPlaybackControlsView:]): (-[WKWebView _mediaPlaybackControlsView]): (-[WKWebView _addMediaPlaybackControlsView:]): (-[WKWebView _removeMediaPlaybackControlsView]): (-[WKWebView _prepareForMoveToWindow:completionHandler:]): (-[WKWebView _setThumbnailView:]): (-[WKWebView _thumbnailView]): (-[WKWebView _setIgnoresAllEvents:]): (-[WKWebView _ignoresAllEvents]): (-[WKWebView _spellCheckerDocumentTag]): (-[WKWebView _setContinuousSpellCheckingEnabledForTesting:]): Deleted. (-[WKWebView _contentsOfUserInterfaceItem:]): Deleted. (-[WKWebView keyboardAccessoryBarNext]): Deleted. (-[WKWebView keyboardAccessoryBarPrevious]): Deleted. (-[WKWebView applyAutocorrection:toString:withCompletionHandler:]): Deleted. (-[WKWebView dismissFormAccessoryView]): Deleted. (-[WKWebView _dismissFilePicker]): Deleted. (-[WKWebView setTimePickerValueToHour:minute:]): Deleted. (-[WKWebView selectFormAccessoryPickerRow:]): Deleted. (-[WKWebView selectFormPopoverTitle]): Deleted. (-[WKWebView textContentTypeForTesting]): Deleted. (-[WKWebView formInputLabel]): Deleted. (-[WKWebView _didShowContextMenu]): Deleted. (-[WKWebView _didDismissContextMenu]): Deleted. (-[WKWebView _inputViewBounds]): Deleted. (-[WKWebView _uiTextSelectionRects]): Deleted. (-[WKWebView _scrollingTreeAsText]): Deleted. (-[WKWebView _stableStateOverride]): Deleted. (-[WKWebView _propertiesOfLayerWithID:]): Deleted. (-[WKWebView _doAfterResettingSingleTapGesture:]): Deleted. (-[WKWebView _doAfterReceivingEditDragSnapshotForTesting:]): Deleted. (-[WKWebView _requestControlledElementID]): Deleted. (-[WKWebView _handleControlledElementIDResponse:]): Deleted. (-[WKWebView _handleAcceptedCandidate:]): Deleted. (-[WKWebView _didHandleAcceptedCandidate]): Deleted. (-[WKWebView _didUpdateCandidateListVisibility:]): Deleted. (-[WKWebView _forceRequestCandidates]): Deleted. (-[WKWebView _shouldRequestCandidates]): Deleted. (-[WKWebView _insertText:replacementRange:]): Deleted. (-[WKWebView _candidateRect]): Deleted. (-[WKWebView viewDidChangeEffectiveAppearance]): Deleted. (-[WKWebView _setHeaderBannerHeight:]): Deleted. (-[WKWebView _setFooterBannerHeight:]): Deleted. (-[WKWebView _doAfterProcessingAllPendingMouseEvents:]): Deleted. (-[WKWebView _activeMenu]): Deleted. (-[WKWebView _requestActiveNowPlayingSessionInfo:]): Deleted. (-[WKWebView _setPageScale:withOrigin:]): Deleted. (-[WKWebView _pageScale]): Deleted. (-[WKWebView _scrollingUpdatesDisabledForTesting]): Deleted. (-[WKWebView _setScrollingUpdatesDisabledForTesting:]): Deleted. (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForAnimatedResizeForTesting:]): Deleted. (-[WKWebView _doAfterNextVisibleContentRectUpdate:]): Deleted. (-[WKWebView _disableBackForwardSnapshotVolatilityForTesting]): Deleted. (-[WKWebView _dragCaretRect]): Deleted. (-[WKWebView _simulateLongPressActionAtLocation:]): Deleted. (-[WKWebView _simulateTextEntered:]): Deleted. (-[WKWebView _dynamicUserInterfaceTraitDidChange]): Deleted. (-[WKWebView _beginBackSwipeForTesting]): Deleted. (-[WKWebView _completeBackSwipeForTesting]): Deleted. (-[WKWebView _setDefersLoadingForTesting:]): Deleted. (-[WKWebView _setShareSheetCompletesImmediatelyWithResolutionForTesting:]): Deleted. (-[WKWebView _hasInspectorFrontend]): Deleted. (-[WKWebView _processWillSuspendImminentlyForTesting]): Deleted. (-[WKWebView _processDidResumeForTesting]): Deleted. (-[WKWebView _setAssertionStateForTesting:]): Deleted. (-[WKWebView _hasServiceWorkerBackgroundActivityForTesting]): Deleted. (-[WKWebView _hasServiceWorkerForegroundActivityForTesting]): Deleted. (-[WKWebView _denyNextUserMediaRequest]): Deleted. (-[WKWebView _triggerSystemPreviewActionOnElement:document:page:]): Deleted. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/WKWebViewTesting.h: Added. * UIProcess/API/Cocoa/WKWebViewTesting.mm: Added. (-[WKWebView _setPageScale:withOrigin:]): (-[WKWebView _pageScale]): (-[WKWebView _setContinuousSpellCheckingEnabledForTesting:]): (-[WKWebView _contentsOfUserInterfaceItem:]): (-[WKWebView _requestActiveNowPlayingSessionInfo:]): (-[WKWebView _scrollingUpdatesDisabledForTesting]): (-[WKWebView _setScrollingUpdatesDisabledForTesting:]): (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForAnimatedResizeForTesting:]): (-[WKWebView _doAfterNextVisibleContentRectUpdate:]): (-[WKWebView _disableBackForwardSnapshotVolatilityForTesting]): (-[WKWebView _beginBackSwipeForTesting]): (-[WKWebView _completeBackSwipeForTesting]): (-[WKWebView _setDefersLoadingForTesting:]): (-[WKWebView _setShareSheetCompletesImmediatelyWithResolutionForTesting:]): (-[WKWebView _hasInspectorFrontend]): (-[WKWebView _processWillSuspendImminentlyForTesting]): (-[WKWebView _processDidResumeForTesting]): (-[WKWebView _setAssertionStateForTesting:]): (-[WKWebView _hasServiceWorkerBackgroundActivityForTesting]): (-[WKWebView _hasServiceWorkerForegroundActivityForTesting]): (-[WKWebView _denyNextUserMediaRequest]): * UIProcess/API/ios/WKWebViewTestingIOS.h: Added. * UIProcess/API/ios/WKWebViewTestingIOS.mm: Added. (-[WKWebView keyboardAccessoryBarNext]): (-[WKWebView keyboardAccessoryBarPrevious]): (-[WKWebView applyAutocorrection:toString:withCompletionHandler:]): (-[WKWebView dismissFormAccessoryView]): (-[WKWebView _dismissFilePicker]): (-[WKWebView setTimePickerValueToHour:minute:]): (-[WKWebView selectFormAccessoryPickerRow:]): (-[WKWebView selectFormPopoverTitle]): (-[WKWebView textContentTypeForTesting]): (-[WKWebView formInputLabel]): (-[WKWebView _didShowContextMenu]): (-[WKWebView _didDismissContextMenu]): (-[WKWebView _inputViewBounds]): (-[WKWebView _uiTextSelectionRects]): (-[WKWebView _scrollingTreeAsText]): (-[WKWebView _stableStateOverride]): (-[WKWebView _propertiesOfLayerWithID:]): (-[WKWebView _doAfterResettingSingleTapGesture:]): (-[WKWebView _doAfterReceivingEditDragSnapshotForTesting:]): (-[WKWebView _dragCaretRect]): (-[WKWebView _simulateLongPressActionAtLocation:]): (-[WKWebView _simulateTextEntered:]): (-[WKWebView _dynamicUserInterfaceTraitDidChange]): (-[WKWebView _triggerSystemPreviewActionOnElement:document:page:]): * UIProcess/API/mac/WKWebViewTestingMac.h: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/InteractionDeadlockAfterCrash.mm. * UIProcess/API/mac/WKWebViewTestingMac.mm: Added. (-[WKWebView _requestControlledElementID]): (-[WKWebView _handleControlledElementIDResponse:]): (-[WKWebView _handleAcceptedCandidate:]): (-[WKWebView _didHandleAcceptedCandidate]): (-[WKWebView _didUpdateCandidateListVisibility:]): (-[WKWebView _forceRequestCandidates]): (-[WKWebView _shouldRequestCandidates]): (-[WKWebView _insertText:replacementRange:]): (-[WKWebView _candidateRect]): (-[WKWebView viewDidChangeEffectiveAppearance]): (-[WKWebView _setHeaderBannerHeight:]): (-[WKWebView _setFooterBannerHeight:]): (-[WKWebView _doAfterProcessingAllPendingMouseEvents:]): (-[WKWebView _activeMenu]): * UIProcess/Cocoa/PageClientImplCocoa.mm: * UIProcess/ios/PageClientImplIOS.mm: * UIProcess/ios/WKContentViewInteraction.mm: * UIProcess/ios/WKMouseGestureRecognizer.h: * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: * UIProcess/mac/PageClientImplMac.mm: * UIProcess/mac/WKFullScreenWindowController.h: * WebKit.xcodeproj/project.pbxproj: 2019-12-11 Chris Dumez <cdumez@apple.com> Unreviewed iOS build fix after r253343. * UIProcess/API/Cocoa/WKWebViewPrivate.h: 2019-12-11 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Implement dummy _WKWebAuthenticationPanel SPIs for CTAP PIN support https://bugs.webkit.org/show_bug.cgi?id=205100 <rdar://problem/57822953> Reviewed by Brent Fulgham. This patch implements dummy _WKWebAuthenticationPanel SPIs for CTAP PIN support. CTAP PIN is a way for authenticators to be able to do user verification by asking clients/users for a pre-set PIN. Here is the spec: https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#authenticatorClientPIN In order to support this, WebKit needs to interacts with UIClients to ask users to enter the PINs. Therefore, a new set of SPI is needed. Here is the proposed SPI for WebKit to ask Safari for the PIN: @protocol _WKWebAuthenticationPanelDelegate <NSObject> @optional ... - (void)panel:(_WKWebAuthenticationPanel *)panel requestPINWithRetries:(NSUInteger)retries completionHandler:(void (^)(NSData *))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); ... @end Retries is the number of retires before the authenticator getting blocked, which is a state that only factory reset can save the authenticator. UIClients can have a threshold and WARN users loudly when the threshold is reached. A byte array that is less than or equal to 63 bytes is expected to return to the passed completion handler. Otherwise, the completion handler will bail out. For error handling: typedef NS_ENUM(NSInteger, _WKWebAuthenticationPanelUpdate) { ... _WKWebAuthenticationPanelUpdatePINBlocked, _WKWebAuthenticationPanelUpdatePINAuthBlocked, _WKWebAuthenticationPanelUpdatePINInvalid, } WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); The above three error will be passed to UIClients via updateWebAuthenticationPanel SPI. _WKWebAuthenticationPanelUpdatePINBlocked means the authenticator is dead. A factory reset is needed. _WKWebAuthenticationPanelUpdatePINAuthBlocked means 3 consecutive mismatches. The authenticator will need to be reconnected. _WKWebAuthenticationPanelUpdatePINInvalid means a wrong PIN is provided. This will often be followed with another requestPINWithRetries delegate call. Here is the spec for the error: https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#using-pinToken-in-authenticatorMakeCredential. * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: 2019-12-10 Chris Dumez <cdumez@apple.com> [macOS] Issue load sooner on swipe back/forward navigation https://bugs.webkit.org/show_bug.cgi?id=205087 Reviewed by Tim Horton. Issue load sooner on swipe back/forward navigation on macOS. We were waiting until the end of the swipe animation to issue the load. We now issue the load as soon as the user lifts the finger off the screen and thus commits to navigating. This results in improved perceived performance when swiping back/forward to navigate. This patch does not take care of iOS because the ViewGestureController logic is different on that platform. There is no reason we shouldn't be able to do the same optimization on iOS too though. To achieve the behavior change on macOS, the following was done: - Issue the load in ViewGestureController::willEndSwipeGesture() instead of ViewGestureController::endSwipeGesture(). - Add a new SnapshotRemovalTracker::Event::SwipeAnimationEnd event and wait for this event before taking away the snapshot. This makes sure we do not take away the swipe snapshot until the swipe animation is actually over (now that we start the navigation during the animation, instead of after). - To make sure that layer being swiped away stays the same until the end of the animation, I added a new SwipeAnimation reason for freezing the layer tree. At the beginning of the animation, the UIProcess sends a FreezeLayerTreeDueToSwipeAnimation IPC to the WebProcess to add this layer tree freeze reason. At the end of the animation, the UIProcess sends the UnfreezeLayerTreeDueToSwipeAnimation IPC to remove this freeze reason. Without this change, the layer being swiped away would sometimes start showing the destination site being loaded before the end of the animation. On cross-process navigation, not freezing the layer tree would cause the swipe animation to get interrupted when we have something to paint in the new process before the end of the swipe animation. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::initializeWebPage): * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::SnapshotRemovalTracker::eventsDescription): (WebKit::ViewGestureController::willEndSwipeGesture): (WebKit::ViewGestureController::endSwipeGesture): * UIProcess/ViewGestureController.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::commitProvisionalPage): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::isLayerTreeFrozenDueToSwipeAnimation const): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::freezeLayerTreeDueToSwipeAnimation): (WebKit::WebPage::unfreezeLayerTreeDueToSwipeAnimation): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2019-12-10 Fujii Hironori <Hironori.Fujii@sony.com> [Win] Fix MSVC warning C4701: potentially uninitialized local variable 'x' used https://bugs.webkit.org/show_bug.cgi?id=205052 Reviewed by Don Olmstead. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor const): * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const): Zero-initialized local variables. 2019-12-10 Per Arne Vollan <pvollan@apple.com> [iOS] Calls to the device motion API should be done in the UI process https://bugs.webkit.org/show_bug.cgi?id=204770 Reviewed by Brent Fulgham. The class WebDeviceOrientationUpdateProviderProxy will handle messages to start and stop updating device motion in the UI process. Also, add a message to update the device motion in the WebContent process. In the UI process, the device motion API is called through the already existing WebCoreMotionManager class. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h: * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.messages.in: * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.mm: (WebKit::WebDeviceOrientationUpdateProviderProxy::startUpdatingDeviceMotion): (WebKit::WebDeviceOrientationUpdateProviderProxy::stopUpdatingDeviceMotion): (WebKit::WebDeviceOrientationUpdateProviderProxy::motionChanged): * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp: (WebKit::WebDeviceOrientationUpdateProvider::startUpdatingDeviceOrientation): (WebKit::WebDeviceOrientationUpdateProvider::stopUpdatingDeviceOrientation): (WebKit::WebDeviceOrientationUpdateProvider::startUpdatingDeviceMotion): (WebKit::WebDeviceOrientationUpdateProvider::stopUpdatingDeviceMotion): (WebKit::WebDeviceOrientationUpdateProvider::deviceOrientationChanged): (WebKit::WebDeviceOrientationUpdateProvider::deviceMotionChanged): (WebKit::WebDeviceOrientationUpdateProvider::startUpdating): Deleted. (WebKit::WebDeviceOrientationUpdateProvider::stopUpdating): Deleted. * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h: * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.messages.in: 2019-12-10 Chris Dumez <cdumez@apple.com> Unreviewed, drop debug assertion in InspectorTargetProxy::didCommitProvisionalTarget() that is hitting after r253337 r253337 causes the ProvisionalPageProxy to get destroyed a little bit early, before didCommitProvisionalTarget() is called. didCommitProvisionalTarget() had an assertion that isProvisional() returns true, which merely checked that the ProvisionalPageProxy is still alive before nulling out its WeakPtr. * UIProcess/InspectorTargetProxy.cpp: (WebKit::InspectorTargetProxy::didCommitProvisionalTarget): 2019-12-10 Per Arne Vollan <pvollan@apple.com> [iOS] Deny mach lookup access to network extension services in the WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=203929 Reviewed by Brent Fulgham. Mach lookup access to network extension services in the WebContent process is only needed if NEFilterSource.filterRequired is true. If this is the case, issue the needed mach lookup sandbox extensions to the WebContent process, where they will be consumed. Eventually, all the content filtering code should be moved to the Networking process, but since this is a bigger undertaking, we can issue extensions in the meantime to strengthen the sandbox. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): * WebProcess/com.apple.WebProcess.sb.in: 2019-12-10 Chris Dumez <cdumez@apple.com> Leverage the fact that WebPageProxy subclasses IPC::MessageSender to simplify IPC sending code https://bugs.webkit.org/show_bug.cgi?id=205065 Reviewed by Alex Christensen. * UIProcess/API/C/WKPage.cpp: (WKPageSetPageLoaderClient): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::switchToBrowsingContext): (WebKit::WebAutomationSession::evaluateJavaScriptFunction): (WebKit::WebAutomationSession::resolveChildFrameHandle): (WebKit::WebAutomationSession::resolveParentFrameHandle): (WebKit::WebAutomationSession::computeElementLayout): (WebKit::WebAutomationSession::selectOptionElement): (WebKit::WebAutomationSession::setFilesForInputFileUpload): (WebKit::WebAutomationSession::getAllCookies): (WebKit::WebAutomationSession::deleteSingleCookie): (WebKit::WebAutomationSession::takeScreenshot): * UIProcess/RemoteWebInspectorProxy.cpp: (WebKit::RemoteWebInspectorProxy::load): (WebKit::RemoteWebInspectorProxy::sendMessageToFrontend): * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy): * UIProcess/WebEditCommandProxy.cpp: (WebKit::WebEditCommandProxy::unapply): (WebKit::WebEditCommandProxy::reapply): * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::loadURL): (WebKit::WebFrameProxy::loadData): (WebKit::WebFrameProxy::stopLoading const): * UIProcess/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::sendMessageToFrontend): (WebKit::WebInspectorProxy::connect): (WebKit::WebInspectorProxy::close): (WebKit::WebInspectorProxy::updateForNewPageProcess): (WebKit::WebInspectorProxy::setFrontendConnection): (WebKit::WebInspectorProxy::showConsole): (WebKit::WebInspectorProxy::showResources): (WebKit::WebInspectorProxy::showMainResourceForFrame): (WebKit::WebInspectorProxy::attach): (WebKit::WebInspectorProxy::detach): (WebKit::WebInspectorProxy::togglePageProfiling): (WebKit::WebInspectorProxy::toggleElementSelection): (WebKit::WebInspectorProxy::openLocalInspectorFrontend): (WebKit::WebInspectorProxy::open): (WebKit::WebInspectorProxy::closeFrontendPageAndWindow): (WebKit::WebInspectorProxy::attachAvailabilityChanged): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setUIClient): (WebKit::WebPageProxy::setIconLoadingClient): (WebKit::WebPageProxy::launchProcessForReload): (WebKit::WebPageProxy::launchProcessWithItem): (WebKit::WebPageProxy::initializeWebPage): (WebKit::WebPageProxy::close): (WebKit::WebPageProxy::loadRequestWithNavigationShared): (WebKit::WebPageProxy::loadFile): (WebKit::WebPageProxy::loadAlternateHTML): (WebKit::WebPageProxy::loadWebArchiveData): (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick): (WebKit::WebPageProxy::stopLoading): (WebKit::WebPageProxy::reload): (WebKit::WebPageProxy::goToBackForwardItem): (WebKit::WebPageProxy::tryRestoreScrollPosition): (WebKit::WebPageProxy::setControlledByAutomation): (WebKit::WebPageProxy::setIndicating): (WebKit::WebPageProxy::setBackgroundColor): (WebKit::WebPageProxy::setTopContentInset): (WebKit::WebPageProxy::setUnderlayColor): (WebKit::WebPageProxy::viewWillStartLiveResize): (WebKit::WebPageProxy::viewWillEndLiveResize): (WebKit::WebPageProxy::viewDidEnterWindow): (WebKit::WebPageProxy::dispatchActivityStateChange): (WebKit::WebPageProxy::layerHostingModeDidChange): (WebKit::WebPageProxy::setInitialFocus): (WebKit::WebPageProxy::clearSelection): (WebKit::WebPageProxy::restoreSelectionInFocusedEditableElement): (WebKit::WebPageProxy::validateCommand): (WebKit::WebPageProxy::increaseListLevel): (WebKit::WebPageProxy::decreaseListLevel): (WebKit::WebPageProxy::changeListType): (WebKit::WebPageProxy::setBaseWritingDirection): (WebKit::WebPageProxy::setNeedsFontAttributes): (WebKit::WebPageProxy::scheduleFullEditorStateUpdate): (WebKit::WebPageProxy::selectAll): (WebKit::WebPageProxy::executeEditCommand): (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart): (WebKit::WebPageProxy::setEditable): (WebKit::WebPageProxy::performDragControllerAction): (WebKit::WebPageProxy::dragEnded): (WebKit::WebPageProxy::didStartDrag): (WebKit::WebPageProxy::dragCancelled): (WebKit::WebPageProxy::processNextQueuedMouseEvent): (WebKit::WebPageProxy::sendWheelEvent): (WebKit::WebPageProxy::handleKeyboardEvent): (WebKit::WebPageProxy::handleGestureEvent): (WebKit::WebPageProxy::handlePreventableTouchEvent): (WebKit::WebPageProxy::resetPotentialTapSecurityOrigin): (WebKit::WebPageProxy::handleUnpreventableTouchEvent): (WebKit::WebPageProxy::handleTouchEvent): (WebKit::WebPageProxy::cancelPointer): (WebKit::WebPageProxy::touchWithIdentifierWasRemoved): (WebKit::WebPageProxy::scrollBy): (WebKit::WebPageProxy::centerSelectionInVisibleArea): (WebKit::WebPageProxy::commitProvisionalPage): (WebKit::WebPageProxy::setUserAgent): (WebKit::WebPageProxy::resumeActiveDOMObjectsAndAnimations): (WebKit::WebPageProxy::suspendActiveDOMObjectsAndAnimations): (WebKit::WebPageProxy::setCustomTextEncodingName): (WebKit::WebPageProxy::restoreFromSessionState): (WebKit::WebPageProxy::setTextZoomFactor): (WebKit::WebPageProxy::setPageZoomFactor): (WebKit::WebPageProxy::setPageAndTextZoomFactors): (WebKit::WebPageProxy::scalePage): (WebKit::WebPageProxy::scalePageInViewCoordinates): (WebKit::WebPageProxy::scaleView): (WebKit::WebPageProxy::windowScreenDidChange): (WebKit::WebPageProxy::accessibilitySettingsDidChange): (WebKit::WebPageProxy::setUseFixedLayout): (WebKit::WebPageProxy::setFixedLayoutSize): (WebKit::WebPageProxy::setAlwaysShowsHorizontalScroller): (WebKit::WebPageProxy::setAlwaysShowsVerticalScroller): (WebKit::WebPageProxy::listenForLayoutMilestones): (WebKit::WebPageProxy::setSuppressScrollbarAnimations): (WebKit::WebPageProxy::setEnableVerticalRubberBanding): (WebKit::WebPageProxy::setEnableHorizontalRubberBanding): (WebKit::WebPageProxy::setBackgroundExtendsBeyondPage): (WebKit::WebPageProxy::setPaginationMode): (WebKit::WebPageProxy::setPaginationBehavesLikeColumns): (WebKit::WebPageProxy::setPageLength): (WebKit::WebPageProxy::setGapBetweenPages): (WebKit::WebPageProxy::setPaginationLineGridEnabled): (WebKit::WebPageProxy::findStringMatches): (WebKit::WebPageProxy::findString): (WebKit::WebPageProxy::getImageForFindMatch): (WebKit::WebPageProxy::selectFindMatch): (WebKit::WebPageProxy::indicateFindMatch): (WebKit::WebPageProxy::hideFindUI): (WebKit::WebPageProxy::countStringMatches): (WebKit::WebPageProxy::replaceMatches): (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld): (WebKit::WebPageProxy::runJavaScriptInFrame): (WebKit::WebPageProxy::getRenderTreeExternalRepresentation): (WebKit::WebPageProxy::getSourceForFrame): (WebKit::WebPageProxy::getContentsAsString): (WebKit::WebPageProxy::getBytecodeProfile): (WebKit::WebPageProxy::getSamplingProfilerOutput): (WebKit::WebPageProxy::getContentsAsMHTMLData): (WebKit::WebPageProxy::getSelectionOrContentsAsString): (WebKit::WebPageProxy::getSelectionAsWebArchiveData): (WebKit::WebPageProxy::getMainResourceDataOfFrame): (WebKit::WebPageProxy::getResourceDataFromFrame): (WebKit::WebPageProxy::getWebArchiveOfFrame): (WebKit::WebPageProxy::forceRepaint): (WebKit::WebPageProxy::preferencesDidChange): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::willSubmitForm): (WebKit::WebPageProxy::showShareSheet): (WebKit::WebPageProxy::setMediaVolume): (WebKit::WebPageProxy::setMuted): (WebKit::WebPageProxy::stopMediaCapture): (WebKit::WebPageProxy::stopAllMediaPlayback): (WebKit::WebPageProxy::suspendAllMediaPlayback): (WebKit::WebPageProxy::resumeAllMediaPlayback): (WebKit::WebPageProxy::handleMediaEvent): * UIProcess/gtk/WebInspectorProxyGtk.cpp: (WebKit::WebInspectorProxy::platformSave): 2019-12-10 Chris Dumez <cdumez@apple.com> Gyroscope (DeviceMotion related) permission cannot be requested in WKWebView unless the client app sets a WKUIDelegate https://bugs.webkit.org/show_bug.cgi?id=203287 Reviewed by Alex Christensen. Device orientation / motion events permission dialog would not be shown unless the client app set a WKUIDelegate on the WKWebView, even though we do not need this WKUIDelegate to show the prompt. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _deviceOrientationUserPermissionHandler]): (-[WKWebView _setDeviceOrientationUserPermissionHandler:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess): * UIProcess/Cocoa/WKOrientationAccessAlert.mm: (WebKit::presentOrientationAccessAlert): 2019-12-10 Chris Dumez <cdumez@apple.com> Unreviewed, drop bad assertion in PreconnectTask::willSendRedirectedRequest() PreconnectTask::willSendRedirectedRequest() may get called in case of HSTS redirect, so the ASSERT_NOT_REACHED() is wrong. * NetworkProcess/PreconnectTask.cpp: (WebKit::PreconnectTask::willSendRedirectedRequest): 2019-12-10 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r253212. https://bugs.webkit.org/show_bug.cgi?id=205074 '<rdar://problem/57771300> REGRESSION (253212): Safari does not load local html file, base system Safari does not load RecoveryInformation.html' (Requested by nham on #webkit). Reverted changeset: "Drop support for NSURLCache callbacks in NetworkProcess" https://bugs.webkit.org/show_bug.cgi?id=203344 https://trac.webkit.org/changeset/253212 2019-12-10 Chris Dumez <cdumez@apple.com> [WK2][iOS] Visibility propagation view is not properly updated when navigating cross-process https://bugs.webkit.org/show_bug.cgi?id=205028 Reviewed by Tim Horton. Make sure we keep the contextIDForVisibilityPropagation on the ProvisionalPageProxy / SuspendedPageProxy objects and update WebPageProxy::m_contextIDForVisibilityPropagation whenever we commit a provisional page. Also update ProvisionalPageProxy to listen for the WebPageProxy::DidCreateContextForVisibilityPropagation IPC so that it can update m_contextIDForVisibilityPropagation once the WebPage is created in the provisional WebProcess (which creates the visibility propagation view). * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::ProvisionalPageProxy): (WebKit::ProvisionalPageProxy::didCreateContextForVisibilityPropagation): (WebKit::ProvisionalPageProxy::didReceiveMessage): * UIProcess/ProvisionalPageProxy.h: (WebKit::ProvisionalPageProxy::contextIDForVisibilityPropagation const): * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::SuspendedPageProxy): * UIProcess/SuspendedPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::swapToProvisionalPage): (WebKit::WebPageProxy::commitProvisionalPage): (WebKit::WebPageProxy::resetState): (WebKit::WebPageProxy::swapToWebProcess): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView _setupVisibilityPropagationView]): (-[WKContentView _removeVisibilityPropagationView]): 2019-12-10 Chris Dumez <cdumez@apple.com> Regression(r253277) ASSERTION FAILED: !parameters.request.httpBody() in NetworkConnectionToWebProcess::preconnectTo() https://bugs.webkit.org/show_bug.cgi?id=205030 Reviewed by Antti Koivisto. Instead of using the full request as preconnect request, create a simple one that contains only the destination URL. This avoids sending a request body unnecessarily over IPC, which was the cause of the assertion. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadRequest): 2019-12-10 Chris Dumez <cdumez@apple.com> Make preconnectTo()'s completionHandler optional https://bugs.webkit.org/show_bug.cgi?id=205011 Reviewed by Antti Koivisto. Make preconnectTo()'s completionHandler optional, so that the network process does not unnecessarily send an IPC back if the client is not interested. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::preconnectTo): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::preconnectTo): * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadRequest): 2019-12-09 Eric Carlson <eric.carlson@apple.com> Rename media in the GPU process preference https://bugs.webkit.org/show_bug.cgi?id=205013 <rdar://problem/57755319> Reviewed by Tim Horton. * Shared/WebPreferences.yaml: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): 2019-12-09 Truitt Savell <tsavell@apple.com> Unreviewed, rolling out r253299. Casued 30+ imported/ test failures on Mac wk2 Reverted changeset: "Throttling requestAnimationFrame should be controlled by RenderingUpdateScheduler" https://bugs.webkit.org/show_bug.cgi?id=204713 https://trac.webkit.org/changeset/253299 2019-12-09 Chris Dumez <cdumez@apple.com> Regression(r249329) ViewGestureController::requestRenderTreeSizeNotificationIfNeeded() sometimes uses wrong webPageID for IPC https://bugs.webkit.org/show_bug.cgi?id=205012 Reviewed by Tim Horton. * UIProcess/InspectorTargetProxy.cpp: (WebKit::InspectorTargetProxy::connect): (WebKit::InspectorTargetProxy::disconnect): (WebKit::InspectorTargetProxy::sendMessageToTargetBackend): * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy): (WebKit::ProvisionalPageProxy::initializeWebPage): (WebKit::ProvisionalPageProxy::goToBackForwardItem): (WebKit::ProvisionalPageProxy::messageSenderConnection const): (WebKit::ProvisionalPageProxy::messageSenderDestinationID const): * UIProcess/ProvisionalPageProxy.h: * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::SuspendedPageProxy): (WebKit::SuspendedPageProxy::unsuspend): (WebKit::SuspendedPageProxy::close): (WebKit::SuspendedPageProxy::messageSenderConnection const): (WebKit::SuspendedPageProxy::messageSenderDestinationID const): * UIProcess/SuspendedPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::continueNavigationInNewProcess): Have SuspendedPageProxy & ProvisionalPageProxy subclass IPC::MessageSender so that we can call send() on them without having to pass in a PageIdentifier. Passing a PageIdentifier was error-prone. * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::requestRenderTreeSizeNotificationIfNeeded): When there was a provisonal page proxy, we would properly send the IPC to the provisional page's process but would use the wrong PageIdentifier for the IPC. We would use the identifier of the committed WebPage instead of the one of the provisional WebPage. 2019-12-09 Wenson Hsieh <wenson_hsieh@apple.com> Finish encoding/decoding support for DisplayList::SetState https://bugs.webkit.org/show_bug.cgi?id=205018 Reviewed by Tim Horton. Replaces WebCore::DisplayList::ImageHandle with just WebCore::ImageHandle. See WebCore ChangeLog for more details. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<ImageHandle>::encode): (IPC::ArgumentCoder<ImageHandle>::decode): (IPC::ArgumentCoder<DisplayList::ImageHandle>::encode): Deleted. (IPC::ArgumentCoder<DisplayList::ImageHandle>::decode): Deleted. * Shared/WebCoreArgumentCoders.h: 2019-12-09 Said Abou-Hallawa <sabouhallawa@apple.com> Throttling requestAnimationFrame should be controlled by RenderingUpdateScheduler https://bugs.webkit.org/show_bug.cgi?id=204713 Reviewed by Simon Fraser. Create an IPC message on the DrawingArea to send a message from the WebProcess to the UIProcess to setPreferredFramesPerSecond of the DisplayRefreshMonitor. * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (-[WKOneShotDisplayLinkHandler setPreferredFramesPerSecond:]): (WebKit::RemoteLayerTreeDrawingAreaProxy::setPreferredFramesPerSecond): Set the preferredFramesPerSecond of the CADisplayLink. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm: (WebKit::RemoteLayerTreeDisplayRefreshMonitor::setPreferredFramesPerSecond): Delegate the call to RemoteLayerTreeDrawingArea. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::setPreferredFramesPerSecond): Send the IPC message from the WebProcess to the UIProcess. 2019-12-09 youenn fablet <youenn@apple.com> NetworkResourceLoader should consume its sandbox extensions when starting a fetch through service worker https://bugs.webkit.org/show_bug.cgi?id=204883 <rdar://problem/57568535> Reviewed by Alex Christensen. Consume sandbox extensions in network process before sending fetch task to service worker. This makes sure network process can send proper sandbox extensions to the service worker and it also ensures it will have the necessary rights to access the file if the fetch task is not handled by service worker. Test: http/wpt/service-workers/file-upload.html * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::consumeSandboxExtensionsIfNeeded): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: (WebKit::ServiceWorkerFetchTask::startFetch): 2019-12-09 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix the macCatalyst build after r253267 * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]): 2019-12-09 Alex Christensen <achristensen@webkit.org> Re-disable TLS1.0 and TLS1.1 by default https://bugs.webkit.org/show_bug.cgi?id=204922 <rdar://problem/57677752> Reviewed by Youenn Fablet. Covered by updated API tests. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): 2019-12-09 Chris Dumez <cdumez@apple.com> Unreviewed, fix debug assertion for ApplePay API tests on iOS after r253277. Disable server preconnect if the load will be handled by the LegacyCustomProtocolManager. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::preconnectTo): 2019-12-09 youenn fablet <youenn@apple.com> Add an option to capture audio in GPU process https://bugs.webkit.org/show_bug.cgi?id=205007 Reviewed by Eric Carlson. Add a flag to make audio capture in GPU process. In WebProcess, if trying to capture through GPUProcess, send back an error since this is not implemented. * Shared/WebPreferences.yaml: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetCaptureAudioInGPUProcessEnabled): (WKPreferencesGetCaptureAudioInGPUProcessEnabled): * UIProcess/API/C/WKPreferencesRef.h: * UIProcess/WebPreferences.cpp: (WebKit::WebPreferences::updateBoolValueForInternalDebugFeatureKey): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): (WebKit::WebProcessPool::createWebPage): * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::initialize): (WebKit::UserMediaCaptureManager::AudioFactory::createAudioCaptureSource): * WebProcess/cocoa/UserMediaCaptureManager.h: (WebKit::UserMediaCaptureManager::AudioFactory::setShouldCaptureInGPUProcess): 2019-12-08 Wenson Hsieh <wenson_hsieh@apple.com> Move WebCore::Path encoders and decoders into WebCore from WebCoreArgumentCoders https://bugs.webkit.org/show_bug.cgi?id=204993 Reviewed by Tim Horton. Remove Encoder/Decoder support for WebCore::Path. * Shared/WebCoreArgumentCoders.cpp: (IPC::pathEncodeApplierFunction): Deleted. (IPC::ArgumentCoder<Path>::encode): Deleted. (IPC::ArgumentCoder<Path>::decode): Deleted. * Shared/WebCoreArgumentCoders.h: 2019-12-08 Chris Dumez <cdumez@apple.com> Preconnect to server as early as possible in WebPage::LoadRequest https://bugs.webkit.org/show_bug.cgi?id=204992 Reviewed by Antti Koivisto. Preconnect to server as early as possible in WebPage::LoadRequest. This avoids delaying the connection to the server until after the policy check and is a ~1.3% progression on PLT5 on both macOS and iOS. * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::preconnectTo): * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadRequest): 2019-12-08 youenn fablet <youenn@apple.com> Support different resolutions for video tracks captured from UIProcess https://bugs.webkit.org/show_bug.cgi?id=204945 Reviewed by Eric Carlson. Change video capture in uiprocess to an experimental flag. Add support for remote video source cloning by sending some IPC to UIProcess and cloning the source there. This triggers IPC for both cloning and cloned sources but this allows to do resizing in UIProcess instead of WebProcess. We thus disable video capture resizing in WebProcess. * Shared/WebPreferences.yaml: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::SourceProxy::start): (WebKit::UserMediaCaptureManagerProxy::SourceProxy::stop): (WebKit::UserMediaCaptureManagerProxy::SourceProxy::requestToEnd): (WebKit::UserMediaCaptureManagerProxy::SourceProxy::preventSourceFromStopping): (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): (WebKit::UserMediaCaptureManagerProxy::startProducingData): (WebKit::UserMediaCaptureManagerProxy::stopProducingData): (WebKit::UserMediaCaptureManagerProxy::clone): (WebKit::UserMediaCaptureManagerProxy::requestToEnd): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in: * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::Source::sourceID const): (WebKit::UserMediaCaptureManager::Source::settings const): (WebKit::UserMediaCaptureManager::Source::remoteVideoSampleAvailable): (WebKit::UserMediaCaptureManager::Source::requestToEnd): (WebKit::UserMediaCaptureManager::Source::stopBeingObserved): (WebKit::UserMediaCaptureManager::cloneSource): (WebKit::UserMediaCaptureManager::cloneVideoSource): (WebKit::UserMediaCaptureManager::requestToEnd): (WebKit::UserMediaCaptureManager::VideoFactory::setVideoCapturePageState): * WebProcess/cocoa/UserMediaCaptureManager.h: 2019-12-08 youenn fablet <youenn@apple.com> Tighten Mac sandbox by removing microphone access https://bugs.webkit.org/show_bug.cgi?id=204939 Reviewed by Brent Fulgham. No change of behavior, we do audio capture in UIProcess. * WebProcess/com.apple.WebProcess.sb.in: 2019-12-08 youenn fablet <youenn@apple.com> Add logging to NetworkRTCMonitor https://bugs.webkit.org/show_bug.cgi?id=204850 <rdar://problem/57618773> Reviewed by Eric Carlson. Add logging and send IPC message back to WebProcess even if monitoring is stopped. No observable change of behavior. * NetworkProcess/webrtc/NetworkRTCMonitor.cpp: (WebKit::NetworkRTCMonitor::startUpdatingIfNeeded): (WebKit::NetworkRTCMonitor::stopUpdating): (WebKit::NetworkRTCMonitor::onNetworksChanged): 2019-12-07 Said Abou-Hallawa <sabouhallawa@apple.com> Make ColorSpace an enum class https://bugs.webkit.org/show_bug.cgi?id=204970 Reviewed by Sam Weinig. * Shared/WebCoreArgumentCoders.h: 2019-12-07 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] WKWebView touch event gesture recognition should not block the application process main thread when possible https://bugs.webkit.org/show_bug.cgi?id=204664 <rdar://problem/38670692> Reviewed by Tim Horton. Adds a mechanism that allows some sync touch events on iOS to be sent asynchronously. To do this, we use the deferring gesture mechanism introduced in trac.webkit.org/r253005 to defer all gestures under WKContentView (and WebKit-owned scroll views) when a touch starts, such that they will not recognize until we know that the page has either prevented default or not (assuming that the touch was over an active listener). See below for more details. Tests: fast/events/touch/ios/prevent-default-on-touch-start-with-slow-event-listener.html fast/events/touch/ios/scroll-on-touch-start-with-slow-event-listener.html * UIProcess/GenericCallback.h: * UIProcess/PageClient.h: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (-[WKChildScrollView gestureRecognizer:shouldRequireFailureOfGestureRecognizer:]): (-[WKChildScrollView gestureRecognizer:shouldBeRequiredToFailByGestureRecognizer:]): Implement gesture recognizer delegate hooks to add dynamic failure requirements between a child scroll view's gestures and the new deferring gesture recognizers on WKContentView. This allows pan gestures over a scrollable container to hold off on recognizing while the deferring gesture recognizer has not failed yet. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handlePreventableTouchEvent): (WebKit::WebPageProxy::handleUnpreventableTouchEvent): Rename handleTouchEventSynchronously and handleTouchEventAsynchronously to handlePreventableTouchEvent and handleUnpreventableTouchEvent, respectively. Instead of always sending touchstart events that may prevent native gestures synchronously, we may now go through the same `EventDispatcher::TouchEvent` codepath used when dispatching touch events in passive tracking regions. However, in the case of preventable touchstarts, we additionally store a completion callback that is invoked after the touch event has been handled by the page; we then either un-defer or prevent native gestures here (depending on whether the page prevented default) by calling PageClient::doneDeferringNativeGestures. Non-touchstart events are still dispatched synchronously, to ensure that calling preventDefault() on touchmove and touchend continue to prevent default gestures from recognizing. (WebKit::WebPageProxy::boolCallback): (WebKit::WebPageProxy::handleTouchEventSynchronously): Deleted. (WebKit::WebPageProxy::handleTouchEventAsynchronously): Deleted. See above. * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::isHandlingPreventableTouchStart const): This is used in WKContentView to determine whether deferring gestures need to remain active after the touch ends. See below for more detail. * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::doneDeferringNativeGestures): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[UIGestureRecognizer _wk_cancel]): (-[WKContentView setupInteraction]): (-[WKContentView cleanupInteraction]): (-[WKContentView _removeDefaultGestureRecognizers]): (-[WKContentView _addDefaultGestureRecognizers]): Add and remove the new deferring gesture recognizers here. (-[WKContentView _webTouchEventsRecognized:]): (-[WKContentView _webTouchEvent:preventsNativeGestures:]): (-[WKContentView _doneDeferringNativeGestures:]): (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): (-[WKContentView ensurePositionInformationIsUpToDate:]): Drive-by fix: add a missing hasRunningProcess check that causes a flaky assertion under `AuxiliaryProcessProxy::connection()` in layout tests. (-[WKContentView gestureRecognizer:shouldRequireFailureOfGestureRecognizer:]): (-[WKContentView gestureRecognizer:shouldBeRequiredToFailByGestureRecognizer:]): Add dynamic failure requirements between WKContentView's gestures (including all text interaction, context menu, and drag and drop gestures) and the new deferring gesture recognizers. (-[WKContentView _didStartProvisionalLoadForMainFrame]): Force the two-finger double tap gesture recognizer to reset when loading a new page. Without this, the layout test fast/events/ios/click-event-while-editing-node.html will rarely fail when run after a test that dispatches a two-finger tap, such as fast/events/ios/click-event-two-finger-single-tap-meta-key.html. This is because the new deferring gestures will temporarily unite multi-finger tap gestures with one-finger double tap gestures in the same subgraph when performing a tap gesture with more than one finger. This means that there's a 300 ms delay before a normal single tap can be recognized again, which (without forcing the two-finger double tap to reset) would cause a subsequent test that loads in under 300 ms and attempts to send a tap to fail. (-[WKContentView deferringGestureRecognizer:shouldDeferGesturesAfterBeginningTouchesWithEvent:]): Avoid deferring native gestures if the scroll view is decelerating; this matches behavior of the web touch event gesture recognizer. (-[WKContentView deferringGestureRecognizer:shouldDeferGesturesAfterEndingTouchesWithEvent:]): Normally, after -touchesEnded:withEvent:, we stop deferring native gesture recognizers by failing the deferring gestures. However, if we're still waiting for a response from the web process, then let -_doneDeferringNativeGestures: handle this instead. (-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]): (-[WKContentView deferringGestureRecognizer:shouldDeferGesturesWithEvent:]): Deleted. Renamed to -shouldDeferGesturesAfterBeginningTouchesWithEvent:. * UIProcess/ios/WKDeferringGestureRecognizer.h: * UIProcess/ios/WKDeferringGestureRecognizer.mm: (-[WKDeferringGestureRecognizer touchesBegan:withEvent:]): (-[WKDeferringGestureRecognizer touchesEnded:withEvent:]): Override this and add a new delegate hook to determine whether we want the deferring gesture recognizer to immediately fail when touches end. It's important to override this and transition to failure state in this case, since not doing so could mean that the deferring gestures stay in Possible state forever; this may lead to the gesture subgraph containing these deferring gestures being unable to reset, since it's waiting for the deferring gesture to either fail or end. * UIProcess/ios/WKScrollView.mm: (-[WKScrollView gestureRecognizer:shouldRequireFailureOfGestureRecognizer:]): (-[WKScrollView gestureRecognizer:shouldBeRequiredToFailByGestureRecognizer:]): Defer more scroll view gestures. * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::touchEvent): Add an optional CallbackID parameter to this IPC message. If a callback ID is given, then we avoid coalescing the touch event. To implement this, we additionally refactor the queued touch events map to contain lists of <WebTouchEvent, Optional<CallbackID>> pairs; if a queued touch event has a corresponding CallbackID, then we fire the callback corresponding to the ID, indicating whether the touch event was handled by the page. * WebProcess/WebPage/EventDispatcher.h: * WebProcess/WebPage/EventDispatcher.messages.in: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::dispatchAsynchronousTouchEvents): 2019-12-07 David Quesada <david_quesada@apple.com> REGRESSION(r253231): Debug assertion failures under ~WebDeviceOrientationUpdateProvider(Proxy) https://bugs.webkit.org/show_bug.cgi?id=204977 rdar://problem/57724251 Reviewed by Per Arne Vollan. In the UI process, have the WebPageProxy swap out its WebDeviceOrientationUpdateProviderProxy whenever it connects to a new process, instead of creating one on construction and holding onto it for the rest of the WebPageProxy lifetime. The …UpdateProviderProxy assumes that its page will have the same ID at the time of registering as a message receiver and later unregistering, but the page ID could change if the WebPageProxy swaps web processes. Using a new instance per web page ID ensures that the updater is always able to successfully remove itself as a message receiver when deallocating. In the Web process, ~WebDeviceOrientationUpdateProvider() should remove itself as a message receiver specifically for its page ID, rather than as a global message receiver. No new tests -- existing tests (at least the ProcessSwap API tests) revealed the regression. * UIProcess/WebPageProxy.cpp: (WebKit::m_tryCloseTimeoutTimer): (WebKit::WebPageProxy::didAttachToRunningProcess): (WebKit::WebPageProxy::resetState): (WebKit::m_webDeviceOrientationUpdateProviderProxy): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h: * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp: (WebKit::WebDeviceOrientationUpdateProvider::WebDeviceOrientationUpdateProvider): (WebKit::WebDeviceOrientationUpdateProvider::~WebDeviceOrientationUpdateProvider): * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h: 2019-12-07 Tim Horton <timothy_horton@apple.com> Implement encoding for DrawImage and DrawRoundedRect display list items https://bugs.webkit.org/show_bug.cgi?id=204881 Reviewed by Simon Fraser. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<DisplayList::ImageHandle>::encode): (IPC::ArgumentCoder<DisplayList::ImageHandle>::decode): * Shared/WebCoreArgumentCoders.h: 2019-12-06 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r253218. https://bugs.webkit.org/show_bug.cgi?id=204968 Broke the build (Requested by ap on #webkit). Reverted changeset: "Remove various .order files." https://bugs.webkit.org/show_bug.cgi?id=204959 https://trac.webkit.org/changeset/253218 2019-12-06 Chris Dumez <cdumez@apple.com> [IPC] MESSAGE_CHECK() parameters for AddPlugInAutoStartOriginHash / PlugInDidReceiveUserInteraction IPCs https://bugs.webkit.org/show_bug.cgi?id=204962 Reviewed by Ryosuke Niwa. MESSAGE_CHECK() parameters for AddPlugInAutoStartOriginHash / PlugInDidReceiveUserInteraction IPCs. Those parameters are used as keys in HashMaps. * UIProcess/Plugins/PlugInAutoStartProvider.cpp: (WebKit::PlugInAutoStartProvider::PlugInAutoStartProvider): (WebKit::PlugInAutoStartProvider::addAutoStartOriginHash): (WebKit::PlugInAutoStartProvider::setAutoStartOriginsTableWithItemsPassingTest): (WebKit::PlugInAutoStartProvider::didReceiveUserInteraction): * UIProcess/Plugins/PlugInAutoStartProvider.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::addPlugInAutoStartOriginHash): (WebKit::WebProcessProxy::plugInDidReceiveUserInteraction): 2019-12-06 Per Arne Vollan <pvollan@apple.com> [iOS] Calls to device orientation API should be done in the UI process https://bugs.webkit.org/show_bug.cgi?id=204720 Reviewed by Alex Christensen. Add a new class, WebDeviceOrientationUpdateProviderProxy, to handle messages to start and stop updating device orientation in the UI process. Also, add a message to update the device orientation in the WebContent process. In the UI process, the device orientation API is called through the already existing WebCoreMotionManager class. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * UIProcess/WebPageProxy.cpp: (WebKit::m_webDeviceOrientationUpdateProviderProxy): (WebKit::m_resetRecentCrashCountTimer): Deleted. * UIProcess/WebPageProxy.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_overriddenMediaType): 2019-12-06 Chris Dumez <cdumez@apple.com> Reduce timeout for page to handle beforeunload events when trying to close a page https://bugs.webkit.org/show_bug.cgi?id=204950 <rdar://problem/57700419> Reviewed by Ryosuke Niwa. Reduce timeout for page to handle beforeunload events when trying to close a page. It would previously take up to 3 seconds to actually close a tab after the user would click on the "X" to close it. This is because we would wait for the page to fire and handle the beforeunload events and only give up after 3 seconds. This patch reduces this timeout to something more reasonable from a user standpoint (500ms). * UIProcess/WebPageProxy.cpp: (WebKit::m_tryCloseTimeoutTimer): (WebKit::WebPageProxy::tryClose): (WebKit::WebPageProxy::tryCloseTimedOut): (WebKit::WebPageProxy::closePage): (WebKit::m_resetRecentCrashCountTimer): Deleted. * UIProcess/WebPageProxy.h: 2019-12-06 Jonathan Bedard <jbedard@apple.com> Python 3: Add support in webkitpy.test https://bugs.webkit.org/show_bug.cgi?id=204952 Reviewed by Stephanie Lewis. Tested by test-webkitpy. * Scripts/webkit/messages_unittest.py: Use Python 2/3 compatible StringIO. 2019-12-06 Keith Miller <keith_miller@apple.com> Remove various .order files. https://bugs.webkit.org/show_bug.cgi?id=204959 Reviewed by Yusuke Suzuki. These files are all super out of date and likely don't do anything anymore. The signatures of the functions have changed thus the mangled name has changed. * mac/WebKit2.order: Removed. 2019-12-06 Dan Bernstein <mitz@apple.com> Address <https://bugs.webkit.org/show_bug.cgi?id=189222#c3> * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView valueForUndefinedKey:]): Added a newline. 2019-12-06 Benjamin Nham <nham@apple.com> Drop support for NSURLCache callbacks in NetworkProcess https://bugs.webkit.org/show_bug.cgi?id=203344 Reviewed by Alex Christensen. Remove the NSURLSession caching policy callback in NetworkProcess. It's no longer necessary since we don't use NSURLCache in NetworkProcess (https://bugs.webkit.org/show_bug.cgi?id=185990). * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:dataTask:willCacheResponse:completionHandler:]): Deleted. 2019-12-05 Chris Dumez <cdumez@apple.com> Stop using reserveCapacity() / reserveInitialCapacity() in IPC decoders https://bugs.webkit.org/show_bug.cgi?id=204930 <rdar://problem/57682737> Reviewed by Ryosuke Niwa. This is IPC hardening since the size we use to reserve the capacity is encoded over IPC and cannot be trusted in some cases. * Platform/IPC/ArgumentCoders.h: * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<Vector<RefPtr<SecurityOrigin>>>::decode): 2019-12-06 youenn fablet <youenn@apple.com> Protect WebRTC network monitoring to wait forever in edge cases https://bugs.webkit.org/show_bug.cgi?id=204846 Reviewed by Eric Carlson. We were limiting the number of IPC message sent to network process by only sending the start monitoring event for the first client. The issue is that, if network process crashes for instance while having not yet given the list of networks, all clients will be hanging waiting for the completion of network list. We are now sending an IPC message for every client and the network process will ignore the ones that are not useful. In addition, in case of network process crash, we send a signal that network list has changed to make sure clients will never hang. They might still fail connecting, which is ok since network process crashed. Test: webrtc/datachannel/gather-candidates-networkprocess-crash.html * NetworkProcess/webrtc/NetworkRTCMonitor.cpp: (WebKit::NetworkRTCMonitor::startUpdatingIfNeeded): * NetworkProcess/webrtc/NetworkRTCMonitor.h: * NetworkProcess/webrtc/NetworkRTCMonitor.messages.in: * WebProcess/Network/webrtc/LibWebRTCNetwork.h: (WebKit::LibWebRTCNetwork::networkProcessCrashed): * WebProcess/Network/webrtc/WebRTCMonitor.cpp: (WebKit::WebRTCMonitor::StartUpdating): (WebKit::WebRTCMonitor::StopUpdating): (WebKit::WebRTCMonitor::networksChanged): (WebKit::WebRTCMonitor::networkProcessCrashed): * WebProcess/Network/webrtc/WebRTCMonitor.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::networkProcessConnectionClosed): 2019-12-06 youenn fablet <youenn@apple.com> Output libwebrtc logging from Network Process as release logging https://bugs.webkit.org/show_bug.cgi?id=204853 Reviewed by Eric Carlson. This will help debugging WebRTC networking issues. No observable change of behavior. * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::doReleaseLogging): (WebKit::NetworkRTCProvider::NetworkRTCProvider): 2019-12-05 Yousuke Kimoto <yousuke.kimoto@sony.com> [WinCairo] Improve Inspectable Target Page to adapt a long title and URL https://bugs.webkit.org/show_bug.cgi?id=204874 Reviewed by Fujii Hironori. Add some CSS atributes to make such long titles and URLs fit the width of a window size. Then "Inspector" button is shown at the visible area. No new tests, since there is no change in behavior. * UIProcess/socket/RemoteInspectorProtocolHandler.cpp: (WebKit::RemoteInspectorProtocolHandler::platformStartTask): 2019-12-05 Fujii Hironori <Hironori.Fujii@sony.com> [WebKit] Fix compilation warnings for MSVC https://bugs.webkit.org/show_bug.cgi?id=204661 Reviewed by Don Olmstead. No behavior changes. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp: (WebKit::makeDescription): * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::cleanup): * NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp: (WebKit::NetworkCache::IOChannel::IOChannel): * Shared/API/c/WKSharedAPICast.h: (WebKit::toAPI): (WebKit::toDiagnosticLoggingResultType): * UIProcess/WebURLSchemeTask.cpp: (WebKit::WebURLSchemeTask::didReceiveData): * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData): * WebProcess/WebCoreSupport/WebEditorClient.cpp: (WebKit::WebEditorClient::registerAttachmentIdentifier): 2019-12-05 Brian Burg <bburg@apple.com> [Cocoa] _WKInspector uses wrong WKWebView in -setDiagnosticLoggingDelegate: https://bugs.webkit.org/show_bug.cgi?id=204928 Reviewed by Timothy Hatcher. I feel like I've made this mistake before. To make the right thing more obvious, add a property named inspectorWebView that returns the Inspector WKWebView. * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector inspectorWebView]): (-[_WKInspector _setDiagnosticLoggingDelegate:]): * UIProcess/WebInspectorProxy.h: (WebKit::WebInspectorProxy::inspectorPage const): 2019-12-05 Chris Dumez <cdumez@apple.com> Use sendWithAsyncReply() for WebPage::TryClose IPC https://bugs.webkit.org/show_bug.cgi?id=204926 Reviewed by Alex Christensen. Use sendWithAsyncReply() for WebPage::TryClose IPC, instead of 2 separate IPCs. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::closeBrowsingContext): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::tryClose): (WebKit::WebPageProxy::closePage): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::tryClose): (WebKit::WebPage::sendClose): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2019-12-05 John Wilander <wilander@apple.com> Resource Load Statistics (experimental): Add fast mode for non-cookie website data deletion https://bugs.webkit.org/show_bug.cgi?id=204858 <rdar://problem/57639851> Reviewed by Alex Christensen. The purpose of this change is to allow for dedicated testing of the change in https://trac.webkit.org/changeset/253082/webkit. Waiting seven days just isn't a good starting point. This change adds two internal flags: - "Live-On Testing" with a one hour timeout instead of seven days. - "Repro Testing" with an instant timeout (bar ITP's regular delays) instead of seven days. The change also makes sure that hasHadUnexpiredRecentUserInteraction() in ResourceLoadStatisticsDatabaseStore and ResourceLoadStatisticsMemoryStore only age out the user interaction timestamp if the OperatingDatesWindow is Long so that we don't age out timestamps early with the shorter OperatingDatesWindows. This change changes the default value of IsFirstPartyWebsiteDataRemovalEnabled to true. These internal flags should be removed once testing is complete: <rdar://problem/57673418> * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUnexpiredRecentUserInteraction const): (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor const): * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const): * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setFirstPartyWebsiteDataRemovalMode): * NetworkProcess/NetworkProcess.messages.in: * Shared/WebPreferences.yaml: * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): 2019-12-05 Chris Dumez <cdumez@apple.com> Optimize IPC::Connection::SyncMessageState methods https://bugs.webkit.org/show_bug.cgi?id=204890 Reviewed by Alex Christensen. Optimize IPC::Connection::SyncMessageState methods. We are seeing lock contention on some (app launch) benchmarks, resulting in the main thread yielding for 10ms. * Platform/IPC/Connection.cpp: (IPC::Connection::SyncMessageState): Make constructor private since this is a singleton class. (IPC::Connection::ConnectionAndIncomingMessage): Add convenience dispatch() method. (IPC::Connection::SyncMessageState::processIncomingMessage): Drop the lock as early as possible, *before* calling RunLoop::main().dispatch(). (IPC::Connection::SyncMessageState::dispatchMessages): Drop allowedConnection parameter and simplify the code a lot as a result. Only dispatchMessagesAndResetDidScheduleDispatchMessagesForConnection() needed the pass an allowedConnection but having dispatchMessagesAndResetDidScheduleDispatchMessagesForConnection() call dispatchMessages() was inefficient since it would cause us to grab the lock in dispatchMessagesAndResetDidScheduleDispatchMessagesForConnection() to update m_didScheduleDispatchMessagesWorkSet, then release it, then grab the lock again in dispatchMessages() for m_messagesToDispatchWhileWaitingForSyncReply. (IPC::Connection::SyncMessageState::dispatchMessagesAndResetDidScheduleDispatchMessagesForConnection): Grab the lock only once to update m_didScheduleDispatchMessagesWorkSet and m_messagesToDispatchWhileWaitingForSyncReply, instead of doing it in 2 separate steps, each one taking the lock. (IPC::Connection::waitForMessage): (IPC::Connection::waitForSyncReply): (IPC::Connection::dispatchSyncMessage): stop passing a null allowedConnection when calling dispatchMessages(). 2019-12-05 Chris Dumez <cdumez@apple.com> PageConfiguration::dragClient should use a smart pointer https://bugs.webkit.org/show_bug.cgi?id=204816 Reviewed by Alex Christensen. * WebProcess/WebPage/WebPage.cpp: (WebKit::m_overriddenMediaType): 2019-12-05 Chris Dumez <cdumez@apple.com> [IPC] Fail BackForwardItemIdentifier decoding if the decoded integer is not a valid ID https://bugs.webkit.org/show_bug.cgi?id=204920 <rdar://problem/57677453> Reviewed by Ryosuke Niwa. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::willGoToBackForwardListItem): (WebKit::WebPageProxy::backForwardGoToItemShared): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::updateBackForwardItem): 2019-12-05 Sihui Liu <sihui_liu@apple.com> Move InProcessIDBServer to WebKitLegacy https://bugs.webkit.org/show_bug.cgi?id=204896 Reviewed by Brady Eidson. * WebProcess/Databases/WebDatabaseProvider.h: 2019-12-05 Sihui Liu <sihui_liu@apple.com> Add ThreadMessageReceiver to IPC::Connection https://bugs.webkit.org/show_bug.cgi?id=204908 Reviewed by Brady Eidson. ThreadMesageReceiver is similar to WorkQueueMessageReceiver, but it should handle messages (dispatched from IPC thread) on a specific thread, while WorkQueueMessageReceiver may handle messages on different threads. * Platform/IPC/Connection.cpp: (IPC::Connection::addThreadMessageReceiver): (IPC::Connection::removeThreadMessageReceiver): (IPC::Connection::dispatchThreadMessageReceiverMessage): (IPC::Connection::processIncomingMessage): (IPC::Connection::dispatchMessageToThreadReceiver): * Platform/IPC/Connection.h: (IPC::Connection::ThreadMessageReceiver::dispatchToThread): 2019-12-05 Chris Dumez <cdumez@apple.com> MESSAGE_CHECK BackForwardItemIdentifier on incoming IPC from the WebProcess https://bugs.webkit.org/show_bug.cgi?id=204899 Reviewed by Ryosuke Niwa. MESSAGE_CHECK BackForwardItemIdentifier on incoming IPC from the WebProcess. This is important since we use this identifier to look up the WebBackForwardListItem in a HashMap, and looking up a bad ID could corrupt said HashMap. * Shared/WebBackForwardListItem.cpp: Make sure the WebBackForwardListItem is always constructed and destroyed on the main thread, to avoid corrupting the allItems() HashMap. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::willGoToBackForwardListItem): (WebKit::WebPageProxy::backForwardGoToItemShared): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::updateBackForwardItem): 2019-12-05 Kate Cheney <katherine_cheney@apple.com> [MSVC] WebResourceLoadStatisticsStore.h is reporting warning C4804: '/': unsafe use of type 'bool' in operation https://bugs.webkit.org/show_bug.cgi?id=204870 Reviewed by Darin Adler. This patch converts storageAccessGranted to a char since makeString() does not explicitly accept bool types. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: (WebKit::ThirdPartyDataForSpecificFirstParty::toString const): 2019-12-05 Philippe Normand <pnormand@igalia.com> [GLib] Display GStreamer version in about:gpu page Rubber-stamped by Carlos Garcia Campos. * UIProcess/API/glib/WebKitProtocolHandler.cpp: (WebKit::WebKitProtocolHandler::handleGPU): 2019-12-05 youenn fablet <youenn@apple.com> inspector/page/overrideSetting-MockCaptureDevicesEnabled.html is failing after removal of internals.setMockMediaCaptureDevicesEnabled API https://bugs.webkit.org/show_bug.cgi?id=204849 Reviewed by Eric Carlson. Synchronize the center with the preferences when the value might be updated. Add API to check which center is used in UIProcess. * UIProcess/API/C/WKPage.cpp: (WKPageIsMockRealtimeMediaSourceCenterEnabled): * UIProcess/API/C/WKPagePrivate.h: * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy): (WebKit::UserMediaPermissionRequestManagerProxy::setMockCaptureDevicesEnabledOverride): * UIProcess/UserMediaPermissionRequestManagerProxy.h: (WebKit::UserMediaPermissionRequestManagerProxy::setMockCaptureDevicesEnabledOverride): Deleted. 2019-12-04 Joonghun Park <jh718.park@samsung.com> Unreviewed. Remove build warnings below since r253025. warning: unused variable ‘iter’ [-Wunused-variable] warning: unused variable ‘isNewEntry’ [-Wunused-variable] No new tests, no new behavioral changes. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::addSessionStorageQuotaManager): * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::SessionStorageQuotaManager::ensureOriginStorageQuotaManager): 2019-12-04 Chris Dumez <cdumez@apple.com> IPC messages may get processed out of order in some cases https://bugs.webkit.org/show_bug.cgi?id=204864 Reviewed by Ryosuke Niwa. IPC messages may get processed out of order in some cases. Connection::SyncMessageState::dispatchMessages() puts messages it did not process back at the end of the queue, instead of the beginning. This means that messages added to the queue while Connection::SyncMessageState::dispatchMessages() was running will incorrectly run *before* the ones dispatchMessages() did not process. * Platform/IPC/Connection.cpp: (IPC::Connection::SyncMessageState::dispatchMessages): 2019-12-04 Chris Dumez <cdumez@apple.com> PageConfiguration::progressTrackerClient should use a smart pointer https://bugs.webkit.org/show_bug.cgi?id=204854 Reviewed by Alex Christensen. * WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp: (WebKit::WebProgressTrackerClient::progressTrackerDestroyed): Deleted. * WebProcess/WebCoreSupport/WebProgressTrackerClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_overriddenMediaType): 2019-12-04 Tim Horton <timothy_horton@apple.com> Fix the iOS build * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: Added. * WebKit.xcodeproj/project.pbxproj: 2019-12-04 Per Arne Vollan <pvollan@apple.com> Unreviewed fix for failure to create sandbox extension on macOS after r253011. This should be iOS only. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest): * UIProcess/UserMediaPermissionRequestManagerProxy.h: 2019-12-04 Per Arne Vollan <pvollan@apple.com> [iOS] The UI process should issue mach sandbox extension to "com.apple.AGXCompilerService" https://bugs.webkit.org/show_bug.cgi?id=203915 Reviewed by Brent Fulgham. Only a few iPad models need access to "com.apple.AGXCompilerService” in the WebContent process. The UI process should issue this mach extension for these iPad models. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::deviceHasAGXCompilerService): (WebKit::WebProcessPool::platformInitializeWebProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2019-12-04 Kate Cheney <katherine_cheney@apple.com> Expose basic ITP data from the database for future API/SPI use https://bugs.webkit.org/show_bug.cgi?id=203432 <rdar://problem/56085040> Reviewed John Wilander. Tests: http/tests/resourceLoadStatistics/user-interface-data-no-storage-access-database.html http/tests/resourceLoadStatistics/user-interface-data-no-storage-access.html http/tests/storageAccess/user-interface-data-with-storage-access-database.html http/tests/storageAccess/user-interface-data-with-storage-access.html Adds the ability to collect sorted ITP data for displaying in a user interface. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements): Added new queries to the database store to check for storage access in the database and aggregate topFrames with the same subframe/subresource so easily create the struct for collecting data for the UI. (WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const): Fixed an incorrect function name in the error message. (WebKit::ResourceLoadStatisticsDatabaseStore::joinSubStatisticsForSorting): Renamed unclear SQL variable names and added a bind parameter to specify whether resource is prevalent or not, which allows this function to be used to collect sorted ITP data for the UI. (WebKit::ResourceLoadStatisticsDatabaseStore::getFirstPartyDataForDomain const): (WebKit::ResourceLoadStatisticsDatabaseStore::gatherDataForUserInterface const): (WebKit::buildQueryStartAndEnd): (WebKit::getMedianOfPrevalentResourcesWithUserInteraction): (WebKit::ResourceLoadStatisticsDatabaseStore::getTopPrevelentResourceDaysSinceUI const): (WebKit::getMedianOfPrevalentResourceWithoutUserInteraction): (WebKit::getNumberOfPrevalentResourcesInTopResources): Changed sql query variable names to make them more clear and added a new bind parameter to allow for more general use of substatistic sorting query. (WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess const): (WebKit::ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics const): Combined UI data with dumpResourceLoadStatistics() data to keep the testing aspect of this patch simpler. (WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString const): Since mostRecentUserInteractionTime changes with each test run, I updated the dumping to report only if it was in the last 24 hours as opposed to reporting an actual time. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ensureFirstPartyStatistic): (WebKit::getFirstPartyDataForDomain): (WebKit::hasBeenThirdParty): (WebKit::ResourceLoadStatisticsMemoryStore::gatherDataForUserInterface const): (WebKit::ResourceLoadStatisticsMemoryStore::dumpResourceLoadStatistics): * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::gatherDataForUserInterface): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: (WebKit::FirstPartyData::toString const): (WebKit::FirstPartyData::operator== const): (WebKit::ThirdPartyData::toString const): (WebKit::ThirdPartyData::operator< const): The toString methods allow the structs to be printed for testing purposes. The equals methods allow the return vectors to use appendIfNotContains. 2019-12-04 Simon Fraser <simon.fraser@apple.com> Minor RemoteLayerTree logging cleanup https://bugs.webkit.org/show_bug.cgi?id=204865 Reviewed by Tim Horton. Have the ::description() methods return Strings like everything else does. Use LOG_WITH_STREAM() so we don't call description() unless the log channel is on. * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h: * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm: (WebKit::RemoteLayerTreeTransaction::dump const): (WebKit::RemoteLayerTreeTransaction::description const): * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: (WebKit::RemoteScrollingCoordinatorTransaction::description const): (WebKit::RemoteScrollingCoordinatorTransaction::dump const): * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree): 2019-12-04 Louie Livon-Bemel <llivonbemel@apple.com> Add exclusion rule for text manipulation SPI to exclude based on element class https://bugs.webkit.org/show_bug.cgi?id=204754 <rdar://problem/57398802> Reviewed by Ryosuke Niwa. Give clients another option for adding an exclusion for text manipulation; allow them to exclude based on an element having a certain class. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _startTextManipulationsWithConfiguration:completion:]): If the rule doesn't have an attribute but does have a class name, treat it as a ClassRule exclusion. * UIProcess/API/Cocoa/_WKTextManipulationExclusionRule.h: Add an initializer for excluding based on a class name. Also add a getter for the className. * UIProcess/API/Cocoa/_WKTextManipulationExclusionRule.mm: (-[_WKTextManipulationExclusionRule initExclusion:forClass:]): (-[_WKTextManipulationExclusionRule className]): 2019-12-04 Kenneth Russell <kbr@chromium.org> Enable WebGL's ASTC extension all the time https://bugs.webkit.org/show_bug.cgi?id=202836 <rdar://problem/57627592> Reviewed by Dean Jackson. Remove the run-time flag - no longer necessary. * Shared/WebPreferences.yaml: 2019-12-04 youenn fablet <youenn@apple.com> WebProcessPool::terminateServiceWorkerProcess should be renamed terminateServiceWorkers https://bugs.webkit.org/show_bug.cgi?id=204792 Reviewed by Chris Dumez. Make use of disableServiceWorkers in terminateServiceWorkers as we might need to handle the case of a service worker in a process containing a page. Renaming API accordingly. Covered by existing tests. * UIProcess/API/C/WKContext.cpp: (WKContextTerminateServiceWorkers): * UIProcess/API/C/WKContextPrivate.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _terminateServiceWorkers]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess): (WebKit::WebProcessPool::createWebPage): (WebKit::WebProcessPool::updateServiceWorkerUserAgent): (WebKit::WebProcessPool::terminateNetworkProcess): (WebKit::WebProcessPool::terminateServiceWorkers): (WebKit::WebProcessPool::updateProcessAssertions): (WebKit::WebProcessPool::isServiceWorkerPageID const): * UIProcess/WebProcessPool.h: 2019-12-04 youenn fablet <youenn@apple.com> Move soft update handling to network process https://bugs.webkit.org/show_bug.cgi?id=204678 Reviewed by Chris Dumez. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::swServerForSession): * NetworkProcess/NetworkSession.h: (WebKit::NetworkSession::addSoftUpdateLoader): (WebKit::NetworkSession::removeSoftUpdateLoader): * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask): (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse): (WebKit::ServiceWorkerFetchTask::didReceiveResponse): (WebKit::ServiceWorkerFetchTask::didFail): (WebKit::ServiceWorkerFetchTask::didNotHandle): (WebKit::ServiceWorkerFetchTask::continueFetchTaskWith): (WebKit::ServiceWorkerFetchTask::timeoutTimerFired): (WebKit::ServiceWorkerFetchTask::softUpdateIfNeeded): * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h: * NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp: Added. (WebKit::ServiceWorkerSoftUpdateLoader::start): (WebKit::ServiceWorkerSoftUpdateLoader::ServiceWorkerSoftUpdateLoader): (WebKit::ServiceWorkerSoftUpdateLoader::~ServiceWorkerSoftUpdateLoader): (WebKit::ServiceWorkerSoftUpdateLoader::fail): (WebKit::ServiceWorkerSoftUpdateLoader::loadWithCacheEntry): (WebKit::ServiceWorkerSoftUpdateLoader::loadFromNetwork): (WebKit::ServiceWorkerSoftUpdateLoader::willSendRedirectedRequest): (WebKit::ServiceWorkerSoftUpdateLoader::didReceiveResponse): (WebKit::ServiceWorkerSoftUpdateLoader::didReceiveBuffer): (WebKit::ServiceWorkerSoftUpdateLoader::didFinishLoading): (WebKit::ServiceWorkerSoftUpdateLoader::didFailLoading): (WebKit::ServiceWorkerSoftUpdateLoader::didComplete): * NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.h: Added. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::createFetchTask): * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: * Shared/Authentication/AuthenticationManager.cpp: (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge): * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Storage/WebSWContextManagerConnection.cpp: * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/Storage/WebSWContextManagerConnection.messages.in: 2019-12-04 Tim Horton <timothy_horton@apple.com> Introduce a GPU process https://bugs.webkit.org/show_bug.cgi?id=204343 Reviewed by Simon Fraser. Add a GPU process. This process is destined to be used as a proxy between WebKit and the underlying graphics mechanisms; in the case of the Cocoa ports, it will specifically gate access to IOKit and a few media-related daemons. In this patch, the process is a UI-process singleton; the WebKit client application gets a single GPU process for all rendering, regardless of the number of Web Content processes, process pools, or web views. For now, it is just a shell of a process; functionality will be added in future patches! * Configurations/FeatureDefines.xcconfig: Add ENABLE(GPU_PROCESS). * Configurations/GPUService.xcconfig: Added. * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-OSX.plist: Added. * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-iOS.plist: Added. * GPUProcess/EntryPoint/Cocoa/XPCService/GPUServiceEntryPoint.mm: Added. * Shared/AuxiliaryProcess.h: * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h: * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: * Platform/ExtraPrivateSymbolsForTAPI.h: * Shared/mac/AuxiliaryProcessMac.mm: * Sources.txt: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * Configurations/WebKit.xcconfig: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::getLaunchOptions): * UIProcess/Launcher/ProcessLauncher.h: * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::serviceName): (WebKit::shouldLeakBoost): Add a new target for the XPC service, and do the paperwork to launch it. * GPUProcess/GPUConnectionToWebProcess.cpp: Added. * GPUProcess/GPUConnectionToWebProcess.h: Added. * GPUProcess/GPUConnectionToWebProcess.messages.in: Added. On the GPU process side, the incoming connection from the Web Content process. * GPUProcess/GPUProcess.cpp: Added. * GPUProcess/GPUProcess.h: Added. * GPUProcess/GPUProcess.messages.in: Added. * GPUProcess/GPUProcessCreationParameters.cpp: Added. * GPUProcess/GPUProcessCreationParameters.h: Added. * GPUProcess/cocoa/GPUProcessCocoa.mm: Added. * GPUProcess/ios/GPUProcessIOS.mm: Added. * GPUProcess/mac/GPUProcessMac.mm: Added. Add the shell of the GPU process. Mostly stolen from the Networking process. * UIProcess/GPU/GPUProcessProxy.cpp: Added. (WebKit::GPUProcessProxy::singleton): (WebKit::GPUProcessProxy::GPUProcessProxy): (WebKit::GPUProcessProxy::~GPUProcessProxy): (WebKit::GPUProcessProxy::getLaunchOptions): (WebKit::GPUProcessProxy::connectionWillOpen): (WebKit::GPUProcessProxy::processWillShutDown): (WebKit::GPUProcessProxy::getGPUProcessConnection): (WebKit::GPUProcessProxy::openGPUProcessConnection): (WebKit::GPUProcessProxy::gpuProcessCrashed): (WebKit::GPUProcessProxy::didReceiveMessage): (WebKit::GPUProcessProxy::didReceiveSyncMessage): (WebKit::GPUProcessProxy::didClose): (WebKit::GPUProcessProxy::didReceiveInvalidMessage): (WebKit::GPUProcessProxy::didFinishLaunching): (WebKit::GPUProcessProxy::updateProcessAssertion): * UIProcess/GPU/GPUProcessProxy.h: Added. * UIProcess/GPU/GPUProcessProxy.messages.in: Added. On the UI process side, the GPUProcessProxy is the singleton that owns the GPU process for the process. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: Added. This sandbox profile is copied from the Web Content process. We will cut it down in the future, but this is a sensible starting point, since the code that is moving to the GPU process is code that currently lives in the Web Content process. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::updateProcessAssertion): Fix a logging typo I stumbled upon. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::getGPUProcessConnection): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::getGPUProcessConnection): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: Add a message from Web->UI to retrieve the GPU process connection. In the future, we should send this along with the Web Content process initialization message, but this mechanism doesn't exist yet. * WebProcess/GPU/GPUProcessConnection.cpp: Added. (WebKit::GPUProcessConnection::GPUProcessConnection): (WebKit::GPUProcessConnection::~GPUProcessConnection): (WebKit::GPUProcessConnection::didReceiveMessage): (WebKit::GPUProcessConnection::didReceiveSyncMessage): (WebKit::GPUProcessConnection::didClose): (WebKit::GPUProcessConnection::didReceiveInvalidMessage): * WebProcess/GPU/GPUProcessConnection.h: Added. (WebKit::GPUProcessConnection::create): (WebKit::GPUProcessConnection::connection): * WebProcess/GPU/GPUProcessConnection.messages.in: Added. * WebProcess/GPU/GPUProcessConnectionInfo.h: Added. (WebKit::GPUProcessConnectionInfo::identifier): (WebKit::GPUProcessConnectionInfo::releaseIdentifier): (WebKit::GPUProcessConnectionInfo::encode const): (WebKit::GPUProcessConnectionInfo::decode): In the Web Content process, GPUProcessConnection is the process-wide connection to the GPU process. All pages in a given Web Content process use the same connection to talk to the singleton GPU process. * WebProcess/WebProcess.cpp: (WebKit::getGPUProcessConnection): (WebKit::WebProcess::ensureGPUProcessConnection): (WebKit::WebProcess::gpuProcessConnectionClosed): * WebProcess/WebProcess.h: (WebKit::WebProcess::existingGPUProcessConnection): In the Web Content process, make it possible for clients to retrieve the GPU process connection. 2019-12-04 Yury Semikhatsky <yurys@chromium.org> Web Inspector: allow inspector to pause provisional page load and restore its state https://bugs.webkit.org/show_bug.cgi?id=204170 Reviewed by Devin Rousso. Provisional page loading can be deffered if inspector front-end is connected. This allows to configure inspector backend in the provisional page before load request is sent. If inspector front-end is not connected provisional loading will conitinue exactly as before. Tests: http/tests/inspector/target/pause-on-inline-debugger-statement.html http/tests/inspector/target/provisional-load-cancels-previous-load.html * UIProcess/InspectorTargetProxy.cpp: (WebKit::InspectorTargetProxy::disconnect): * UIProcess/WebPageInspectorController.cpp: (WebKit::WebPageInspectorController::shouldPauseLoading const): (WebKit::WebPageInspectorController::setContinueLoadingCallback): * UIProcess/WebPageInspectorController.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::continueNavigationInNewProcess): 2019-12-03 Megan Gardner <megan_gardner@apple.com> Add disabled highlight API skeleton https://bugs.webkit.org/show_bug.cgi?id=204809 Reviewed by Ryosuke Niwa. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetHighlightAPIEnabled): (WKPreferencesGetHighlightAPIEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: 2019-12-03 Ryosuke Niwa <rniwa@webkit.org> Replace customJavaScriptUserAgentAsSiteSpecificQuirks with customUserAgentAsSiteSpecificQuirks https://bugs.webkit.org/show_bug.cgi?id=204824 Reviewed by Brent Fulgham. This patch replaces _WKWebsitePolicies's customJavaScriptUserAgentAsSiteSpecificQuirks with customUserAgentAsSiteSpecificQuirks and makes it apply to network requests as well as JS API. * Shared/WebsitePoliciesData.cpp: (WebKit::WebsitePoliciesData::encode const): (WebKit::WebsitePoliciesData::decode): (WebKit::WebsitePoliciesData::applyToDocumentLoader): * Shared/WebsitePoliciesData.h: * UIProcess/API/APIWebsitePolicies.cpp: (API::WebsitePolicies::copy const): (API::WebsitePolicies::data): * UIProcess/API/APIWebsitePolicies.h: * UIProcess/API/Cocoa/WKWebpagePreferences.mm: (-[WKWebpagePreferences _setCustomUserAgentAsSiteSpecificQuirks:]): Renamed from _setCustomJavaScriptUserAgentAsSiteSpecificQuirks. (-[WKWebpagePreferences _customUserAgentAsSiteSpecificQuirks]): Renamed from _customJavaScriptUserAgentAsSiteSpecificQuirks. * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: * UIProcess/API/Cocoa/_WKWebsitePolicies.h: * UIProcess/API/Cocoa/_WKWebsitePolicies.mm: (-[_WKWebsitePolicies setCustomUserAgentAsSiteSpecificQuirks:]): Renamed from setCustomJavaScriptUserAgentAsSiteSpecificQuirks. (-[_WKWebsitePolicies customUserAgentAsSiteSpecificQuirks]): Renamed from customJavaScriptUserAgentAsSiteSpecificQuirks. 2019-12-03 Andres Gonzalez <andresg_22@apple.com> Focus tracking support in the accessibility isolatedtree. https://bugs.webkit.org/show_bug.cgi?id=204535 Reviewed by Chris Fleizach. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKAccessibilityFocusedObject): 2019-12-03 John Wilander <wilander@apple.com> Resource Load Statistics (experimental): Delete non-cookie website data after 7 days of no user interaction https://bugs.webkit.org/show_bug.cgi?id=204779 <rdar://problem/57578989> Reviewed by Alex Christensen. Trackers are continuing to move cross-site tracking IDs into first-party storage. This change ages out script-writable non-cookie website data in alignment with the 7-day cap on client-side cookies. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllButCookiesFor const): Now makes use of the set WebCore::FirstPartyWebsiteDataRemovalMode. * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor const): Now makes use of the set WebCore::FirstPartyWebsiteDataRemovalMode. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: (WebKit::ResourceLoadStatisticsStore::setFirstPartyWebsiteDataRemovalMode): (WebKit::ResourceLoadStatisticsStore::firstPartyWebsiteDataRemovalMode const): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setFirstPartyWebsiteDataRemovalMode): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::setFirstPartyWebsiteDataRemovalModeForTesting): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::setResourceLoadStatisticsEnabled): (WebKit::NetworkSession::recreateResourceLoadStatisticStore): (WebKit::NetworkSession::forwardResourceLoadStatisticsSettings): New convenience function to avoid code duplication in NetworkSession::setResourceLoadStatisticsEnabled() and NetworkSession::forwardResourceLoadStatisticsSettings(). * NetworkProcess/NetworkSession.h: * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * Scripts/webkit/messages.py: Makes sure the WebCore::FirstPartyWebsiteDataRemovalMode is found in WebCore/NetworkStorageSession.h. * Shared/WebPreferences.yaml: New experimental feature, off by default. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting): (WKWebsiteDataStoreStatisticsResetToConsistentState): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setFirstPartyWebsiteDataRemovalModeForTesting): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting): * UIProcess/WebsiteData/WebsiteDataStore.h: 2019-12-03 Chris Dumez <cdumez@apple.com> [iOS] Unable to interact with the view after a back swipe until lifting the finger off the screen https://bugs.webkit.org/show_bug.cgi?id=204821 Reviewed by Tim Horton. If you swipe back on iOS and then put your finger on the screen before the view gesture snapshot is taken down, your gestures will not be recognized, even after the snapshot is taken down, until after you lift your finger off the screen and back on. This makes MobileSafari look more unresponsive than it needs to be. To address the issue, disable user interactions for the snapshot view, so that interactions go through to the actual view underneath. * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::beginSwipeGesture): 2019-12-03 Chris Dumez <cdumez@apple.com> Use a 3 second timeout for the view gesture snapshot on macOS https://bugs.webkit.org/show_bug.cgi?id=204818 Reviewed by Tim Horton. Use a 3 second timeout for the view gesture snapshot on macOS, for consistency with iOS. It used to be 5 seconds on macOS. * UIProcess/ViewGestureController.cpp: 2019-12-03 Chris Dumez <cdumez@apple.com> REGRESSION (r252778): ASSERT(!m_networkLoad); in ~SpeculativeLoad() https://bugs.webkit.org/show_bug.cgi?id=204813 <rdar://problem/57581082> Reviewed by Antti Koivisto. After r252778, SpeculativeLoadManager::revalidateSubresource() may delay the revalidation until we receive the response for the main resource. We can hit the assertion in the SpeculativeLoad destructor if a speculative revalidation for the SAME resource gets scheduled while we're waiting for the main resource response. When we eventually receive the main resource response, we would call revalidateSubresource() again, which would create a SpeculativeLoad and try to add it to m_pendingPreloads. Because m_pendingPreloads would already contain a preload for this same resource, the SpeculativeLoad would not get added to the map and it would get destroyed right away, before completing (thus hitting the assert). This unnecessary creation of the SpeculativeLoad is inefficient and it is thus best to avoid it. To address the issue, when we receive the response, we now make sure that m_pendingPreloads does not already contain a preload for this resource before calling revalidateSubresource() again, similarly to what was already done at the beginning of SpeculativeLoadManager::preloadEntry(). No new tests, unknown how to reproduce. * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: (WebKit::NetworkCache::SpeculativeLoadManager::revalidateSubresource): 2019-12-03 Eric Carlson <eric.carlson@apple.com> Add a runtime setting for media in the GPU process https://bugs.webkit.org/show_bug.cgi?id=204801 <rdar://problem/57596199> Reviewed by Jer Noble. * Shared/WebPreferences.yaml: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): 2019-12-03 Per Arne Vollan <pvollan@apple.com> Unreviewed assertion fix for older macOS versions after r253011. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest): * UIProcess/UserMediaPermissionRequestManagerProxy.h: 2019-12-03 Antoine Quint <graouts@apple.com> [Web Animations] Add a runtime flag for Web Animations composite operations https://bugs.webkit.org/show_bug.cgi?id=204718 Reviewed by Dean Jackson. * Shared/WebPreferences.yaml: 2019-12-03 Youenn Fablet <youenn@apple.com> UserMediaCaptureManager should have independent capture factories https://bugs.webkit.org/show_bug.cgi?id=204786 Reviewed by Eric Carlson. Refactor the code to make UserMediaCaptureManager have 3 different factories. This allows having 3 potential active sources which are used on iOS. We cannot test right now on iOS as audio capture in UIProcess is not yet ready. * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::Source::Source): (WebKit::UserMediaCaptureManager::Source::~Source): (WebKit::UserMediaCaptureManager::UserMediaCaptureManager): (WebKit::UserMediaCaptureManager::~UserMediaCaptureManager): (WebKit::UserMediaCaptureManager::initialize): (WebKit::UserMediaCaptureManager::createCaptureSource): (WebKit::UserMediaCaptureManager::AudioFactory::setAudioCapturePageState): (WebKit::UserMediaCaptureManager::VideoFactory::setVideoCapturePageState): (WebKit::UserMediaCaptureManager::setAudioCapturePageState): Deleted. (WebKit::UserMediaCaptureManager::setVideoCapturePageState): Deleted. * WebProcess/cocoa/UserMediaCaptureManager.h: (WebKit::UserMediaCaptureManager::AudioFactory::AudioFactory): (WebKit::UserMediaCaptureManager::VideoFactory::VideoFactory): (WebKit::UserMediaCaptureManager::DisplayFactory::DisplayFactory): 2019-12-03 Chris Dumez <cdumez@apple.com> PageConfiguration::pluginClient should use a smart pointer https://bugs.webkit.org/show_bug.cgi?id=204780 Reviewed by Anders Carlsson. * WebProcess/WebCoreSupport/WebPlugInClient.cpp: * WebProcess/WebCoreSupport/WebPlugInClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_overriddenMediaType): 2019-12-03 Chris Dumez <cdumez@apple.com> PageConfiguration::alternativeTextClient should use a smart pointer https://bugs.webkit.org/show_bug.cgi?id=204777 Reviewed by Anders Carlsson. * WebProcess/WebCoreSupport/WebAlternativeTextClient.h: * WebProcess/WebCoreSupport/mac/WebAlternativeTextClient.cpp: (WebKit::WebAlternativeTextClient::pageDestroyed): Deleted. * WebProcess/WebPage/WebPage.cpp: (WebKit::m_overriddenMediaType): 2019-12-03 Kate Cheney <katherine_cheney@apple.com> Activate the SQLite database as an on-by-default feature https://bugs.webkit.org/show_bug.cgi?id=204774 <rdar://problem/56117706> Reviewed by Brent Fulgham. The flag to use the ITP Database backend should be set to true by default. * Shared/WebPreferences.yaml: 2019-12-03 youenn fablet <youenn@apple.com> Add support for camera rotation when capturing in UIProcess https://bugs.webkit.org/show_bug.cgi?id=204750 Reviewed by Eric Carlson. Make UserMediaCaptureManagerProxy have an OrientationNotifier. It is updated by each web page of the web process being notified of a device orientation change. Whenever a rotation happens, UIProcess sources are now notified to correctly compute the frame rotations. Covered by existing tests. * UIProcess/API/C/WKPage.cpp: (WKPageSetMockCameraOrientation): * UIProcess/API/C/WKPagePrivate.h: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): (WebKit::UserMediaCaptureManagerProxy::setOrientation): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setOrientationForMediaCapture): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::userMediaCaptureManagerProxy): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::setDeviceOrientation): 2019-12-03 Antti Koivisto <antti@apple.com> [LFC][Integration] Shorten feature flag name https://bugs.webkit.org/show_bug.cgi?id=204788 Reviewed by Sam Weinig. * Shared/WebPreferences.yaml: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): 2019-12-03 youenn fablet <youenn@apple.com> Expose WKWebView API to stop ongoing capture https://bugs.webkit.org/show_bug.cgi?id=204787 Reviewed by Eric Carlson. Covered by API test. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _stopMediaCapture]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: 2019-12-03 youenn fablet <youenn@apple.com> [Cocoa] Run camera capture in UIProcess by default in layout tests https://bugs.webkit.org/show_bug.cgi?id=204512 Reviewed by Eric Carlson. * UIProcess/UserMediaProcessManager.cpp: (WebKit::UserMediaProcessManager::willCreateMediaStream): Do not send sandbox extensions in case capture happens in UIProcess. * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::Source::~Source): (WebKit::UserMediaCaptureManager::createCaptureSource): Register/unregister sources as active/unactive sources to the factory. 2019-12-03 Carlos Garcia Campos <cgarcia@igalia.com> WebDriver: handle elements of type file in send keys command https://bugs.webkit.org/show_bug.cgi?id=188514 Reviewed by Brian Burg. Add setFilesForInputFileUpload method to Automation. It's like setFilesToSelectForFileUpload, but it works differently, so I'm keeping both to not break safaridriver. The new one simply sends the file list to the web process to be set on the input element, instead of saving the file list, wait for the driver to trigger the open panel, intercept and complete the open panel request and send a dismiss open panel event to the driver. * UIProcess/Automation/Automation.json: Add setFilesForInputFileUpload. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::setFilesForInputFileUpload): Send SetFilesForInputFileUpload message to the web process. * UIProcess/Automation/WebAutomationSession.h: * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::setFilesForInputFileUpload): Create a FileList with the received paths and call HTMLInputElement::setFiles() on the given element. * WebProcess/Automation/WebAutomationSessionProxy.h: * WebProcess/Automation/WebAutomationSessionProxy.messages.in: Add SetFilesForInputFileUpload message. 2019-12-03 Carlos Garcia Campos <cgarcia@igalia.com> WebDriver: most of the clear tests are failing https://bugs.webkit.org/show_bug.cgi?id=180404 Reviewed by Brian Burg. Update the FormElementClear atom to follow the spec. * UIProcess/Automation/atoms/FormElementClear.js: (isEditable): (isResettableElementEmpty): 2019-12-03 Carlos Garcia Campos <cgarcia@igalia.com> [PSON] Tooltips from previous page shown on new page https://bugs.webkit.org/show_bug.cgi?id=204735 Reviewed by Chris Dumez. The problem is that WebPage (in the web process) is caching the tooltip text to avoid sending IPC messages when the tooltip didn't change. When a new web process is used for the same web view, the tooltip text doesn't really change (it's always null) until a new one is set. The setToolTip message is always sent right after the MouseDidMoveOverElement, and they both depend on the same hit test result, so we can include the tooltip text as part of the WebHitTestResultData struct passed to MouseDidMoveOverElement and remove the SetToolTip message. Since the UI process is already caching the tooltip, we can simply notify the page client when it changes. * Shared/WebHitTestResultData.cpp: (WebKit::WebHitTestResultData::WebHitTestResultData): Initialize toolTipText. (WebKit::WebHitTestResultData::encode const): Encode toolTipText. (WebKit::WebHitTestResultData::decode): Decode toolTipText. * Shared/WebHitTestResultData.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::mouseDidMoveOverElement): Call setToolTip() after notifying the UI client about the mouse move. (WebKit::WebPageProxy::setToolTip): Return early if tooltip didn't change. (WebKit::WebPageProxy::resetState): Use setToolTip() to ensure the page client is notified about the change. * UIProcess/WebPageProxy.messages.in: Remove SetToolTip message. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::mouseDidMoveOverElement): Pass tooltip text to WebHitTestResultData constructor. * WebProcess/WebCoreSupport/WebChromeClient.h: 2019-12-02 Sihui Liu <sihui_liu@apple.com> Cross-thread version StorageQuotaManager https://bugs.webkit.org/show_bug.cgi?id=203971 <rdar://problem/57290349> Reviewed by Chris Dumez. * NetworkProcess/NetworkProcess.cpp: Introduce class SessionStorageQuotaManager to manage all StorageQuotaManagers of the same session. (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::addWebsiteDataStore): (WebKit::NetworkProcess::addSessionStorageQuotaManager): (WebKit::NetworkProcess::removeSessionStorageQuotaManager): (WebKit::NetworkProcess::destroySession): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::createIDBServer): (WebKit::NetworkProcess::addIndexedDatabaseSession): (WebKit::NetworkProcess::setSessionStorageQuotaManagerIDBRootPath): (WebKit::NetworkProcess::updateQuotaBasedOnSpaceUsageForTesting): (WebKit::NetworkProcess::resetQuota): (WebKit::NetworkProcess::storageQuotaManager): (WebKit::NetworkProcess::initializeStorageQuota): Deleted. (WebKit::NetworkProcess::clearStorageQuota): Deleted. (): Deleted. (WebKit::NetworkProcess::initializeQuotaUsers): Deleted. * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::SessionStorageQuotaManager::SessionStorageQuotaManager): (WebKit::NetworkProcess::SessionStorageQuotaManager::defaultQuota const): (WebKit::NetworkProcess::SessionStorageQuotaManager::ensureOriginStorageQuotaManager): (WebKit::NetworkProcess::SessionStorageQuotaManager::existingStorageQuotaManagers): (WebKit::NetworkProcess::SessionStorageQuotaManager::cacheRootPath const): (WebKit::NetworkProcess::SessionStorageQuotaManager::setIDBRootPath): (WebKit::NetworkProcess::SessionStorageQuotaManager::idbRootPath const): (WebKit::NetworkProcess::StorageQuotaManagers::defaultQuota const): Deleted. (WebKit::NetworkProcess::StorageQuotaManagers::setDefaultQuotas): Deleted. (WebKit::NetworkProcess::StorageQuotaManagers::managersPerOrigin): Deleted. * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::getDirectorySize): (WebKit::CacheStorage::Engine::diskUsage): static function to get the disk usage of CacheStorage given CacheStorage root directory. (WebKit::CacheStorage::Engine::requestSpace): (WebKit::CacheStorage::Engine::readCachesFromDisk): (WebKit::CacheStorage::Engine::writeSizeFile): (WebKit::CacheStorage::Engine::readSizeFile): (WebKit::CacheStorage::Engine::initializeQuotaUser): Deleted. * NetworkProcess/cache/CacheStorageEngine.h: * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::Cache::put): (WebKit::CacheStorage::Cache::remove): * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::create): (WebKit::CacheStorage::Caches::Caches): (WebKit::CacheStorage::Caches::~Caches): (WebKit::CacheStorage::Caches::updateSizeFile): (WebKit::CacheStorage::Caches::initializeSize): (WebKit::CacheStorage::Caches::clear): (WebKit::CacheStorage::Caches::requestSpace): (WebKit::CacheStorage::Caches::writeRecord): (WebKit::CacheStorage::Caches::removeRecord): (WebKit::CacheStorage::Caches::whenInitialized): Deleted. (WebKit::CacheStorage::Caches::resetSpaceUsed): Deleted. * NetworkProcess/cache/CacheStorageEngineCaches.h: * Shared/WebsiteDataStoreParameters.cpp: (WebKit::WebsiteDataStoreParameters::encode const): (WebKit::WebsiteDataStoreParameters::decode): * Shared/WebsiteDataStoreParameters.h: Add a cacheStorageDirectory parameter so we know the direcotry of CacheStorage when we start using WebsiteDataStore. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreResetQuota): * UIProcess/API/C/WKWebsiteDataStoreRef.h: Add a C API for reseting quota in TestRunner. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::resetQuota): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::parameters): (WebKit::WebsiteDataStore::resetQuota): * UIProcess/WebsiteData/WebsiteDataStore.h: 2019-12-02 Per Arne Vollan <pvollan@apple.com> [iOS] Create sandbox extension for "com.apple.tccd" https://bugs.webkit.org/show_bug.cgi?id=204367 <rdar://problem/57330176> Reviewed by Eric Carlson. When camera or microphone access has been granted by the user, have the UI process create a sandbox extension for "com.apple.tccd", and send it to the WebContent process. Also make sure the extension is created only once for each WebContent process. Add telemetry to the tccd rule in the sandbox. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest): * UIProcess/UserMediaPermissionRequestManagerProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::userMediaAccessWasGranted): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2019-12-02 Louie Livon-Bemel <llivonbemel@apple.com> Add helper methods for description and equality to text manipulation SPI https://bugs.webkit.org/show_bug.cgi?id=204758 <rdar://problem/57438200> Reviewed by Wenson Hsieh. I originally added some category methods to _WKTextManipulationItem and _WKTextManipulationToken within Safari to make working with these classes easier. However it makes more sense to just move these methods into the main class. One method is for checking if two instances are equal (including identifiers) and optionally checking if the content itself is equal. The other methods are for debug descriptions for lldb, and a method to get a description that preserves privacy; when logging the instance, the content of the webpage should be redacted. Tests: Tests are added as API tests. * UIProcess/API/Cocoa/_WKTextManipulationItem.h: - Assume everything is non-null unless otherwise specified. - Allow the identifier to be nil, but not the array of tokens. - Add a method to check the equality to another item, optionally including a check for the content of each token being equal. - Add a -debugDescription method that includes the content of tokens for use in lldb. This NSObject declaration is marked optional, so redeclare it here. - No need to add a -description declaration since it exists on NSObject already. * UIProcess/API/Cocoa/_WKTextManipulationItem.mm: (-[_WKTextManipulationItem isEqual:]): The standard NSObject equality check should call our method with equal content. (-[_WKTextManipulationItem isEqualToTextManipulationItem:includingContentEquality:]): - If the other item is nil, the identifiers aren't equal or the number of tokens are mismatched, these items aren't equal. - Just to be safe, only iterate the smaller of the token arrays so we don't crash. - Check if each token is equal, passing along the `includingContentEquality` parameter. (-[_WKTextManipulationItem description]): The general description should not include the webpage content. (-[_WKTextManipulationItem debugDescription]): Include the webpage content, since this is for lldb. (-[_WKTextManipulationItem _descriptionPreservingPrivacy:]): Include the standard description format, and each token on its own line. If we're including the content then use `token.debugDescription`. * UIProcess/API/Cocoa/_WKTextManipulationToken.h: - Also assume everything is non-null. - Identifier and Content can be nil. - Declare a -debugDescription method. - Declare a method to check equality, with or without the content. * UIProcess/API/Cocoa/_WKTextManipulationToken.mm: (isEqualOrBothNil): Helper that checks equality but considers two nil values to be equal as well. (-[_WKTextManipulationToken isEqual:]): The standard NSObject equality check should call our method with equal content. (-[_WKTextManipulationToken isEqualToTextManipulationToken:includingContentEquality:]): Check that the exclusions are equal, the identifiers are equal (considering two nils to be equal), and the content if necessary. (-[_WKTextManipulationToken description]): (-[_WKTextManipulationToken debugDescription]): (-[_WKTextManipulationToken _descriptionPreservingPrivacy:]): If we're preserving privacy, log the content length rather than the content string itself. 2019-12-02 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Introduce a gesture recognizer that can be used to defer recognition of other gestures https://bugs.webkit.org/show_bug.cgi?id=204748 <rdar://problem/38670692> Reviewed by Tim Horton. Introduces WKDeferringGestureRecognizer, which is similar to UIKit's _UIRelationshipGestureRecognizer. In a future patch, this will be added to WKContentView to prevent platform gestures (pinching, panning, single/double taps, etc.) from recognizing when dispatching a preventable touch event to the page. Additionally renames a member variable on WKContentView, in preparation for making touch gesture recognition asynchronous. No new tests, since there is no change in behavior yet. * SourcesCocoa.txt: Add the new file. * UIProcess/ios/WKContentViewInteraction.h: Add a couple of (currently unused) deferring gesture recognizers. These will be added to WKContentView in a future patch. There are two deferring gestures here (one for "immediately resettable" gestures and another for gestures for which the reset is "deferred" -- i.e., multi-tap gestures); this prevents a single deferring gesture from connecting the entire gesture subgraph under WKWebView through failure dependencies. This would result in various usability issues, such as being unable to perform a pan gesture to scroll WKScrollView if a tap was recognized within the last 300 ms, since all gestures would need to wait until every double and triple- tap gesture under WKWebView has failed. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): (-[WKContentView _webTouchEventsRecognized:]): Rename _canSendTouchEventsAsynchronously to _touchEventsCanPreventNativeGestures in preparation for adding a codepath for fully asynchronous touch event dispatch; we also flip the conditional in any places where _canSendTouchEventsAsynchronously was previously set or read. (-[WKContentView _webTouchEvent:preventsNativeGestures:]): (-[WKContentView scrollViewWillStartPanOrPinchGesture]): (-[WKContentView gestureRecognizer:shouldIgnoreWebTouchWithEvent:]): (-[WKContentView gestureRecognizer:isInterruptingMomentumScrollingWithEvent:]): (-[WKContentView deferringGestureRecognizer:shouldDeferGesturesWithEvent:]): (-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]): Implement WKDeferringGestureRecognizerDelegate. (-[WKContentView shouldIgnoreWebTouch]): Deleted. Drive-by fix: remove this unnecessary method implementation, and the related FIXME. * UIProcess/ios/WKDeferringGestureRecognizer.h: Added. * UIProcess/ios/WKDeferringGestureRecognizer.mm: Added. (-[WKDeferringGestureRecognizer initWithDeferringGestureDelegate:]): (-[WKDeferringGestureRecognizer deferringGestureDelegate]): (-[WKDeferringGestureRecognizer touchesBegan:withEvent:]): Unless the touch is interrupts momentum scrolling, WKDeferringGestureRecognizer should transition to Possible state when starting a touch. Later, -setDefaultPrevented: is invoked, which will either transition the deferring gesture recognizer to Failed state (thereby allowing native gestures to begin), or Ended state (preventing other native gestures). (-[WKDeferringGestureRecognizer touchesCancelled:withEvent:]): (-[WKDeferringGestureRecognizer setDefaultPrevented:]): (-[WKDeferringGestureRecognizer canBePreventedByGestureRecognizer:]): Return NO here to prevent certain platform gestures (e.g. scroll view panning) from causing the deferring gesture to Failed state, when these gestures attempt to transition from Possible to Began state. (-[WKDeferringGestureRecognizer shouldDeferGestureRecognizer:]): * WebKit.xcodeproj/project.pbxproj: 2019-12-02 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com> ResponsivenessTimer mistakenly restarts immediately https://bugs.webkit.org/show_bug.cgi?id=204659 Reviewed by Chris Dumez. * UIProcess/ResponsivenessTimer.cpp: (WebKit::ResponsivenessTimer::timerFired): Give startOneShot() a positive number timeout. 2019-12-02 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][PSON] Crash in NetworkProcessProxy::openNetworkProcessConnection https://bugs.webkit.org/show_bug.cgi?id=204703 Reviewed by Michael Catanzaro. Stop sending a message to all web process to prefetch DNS for a hostname. All web processes then send a messaage to their network process to prefetch the DNS. Instead, send a message directly to the network process. * NetworkProcess/NetworkProcess.messages.in: * UIProcess/API/glib/WebKitWebContext.cpp: (webkit_web_context_prefetch_dns): * WebProcess/InjectedBundle/API/glib/WebKitWebExtension.cpp: 2019-12-01 Fujii Hironori <Hironori.Fujii@sony.com> [Win] Retrieve all following WM_CHAR events at the beginning of processing WM_KEYDOWN event https://bugs.webkit.org/show_bug.cgi?id=204694 Reviewed by Ross Kirsling. In Windows ports, WM_KEYDOWN dispatches keydown event, and WM_CHAR dispatches keypress event. If a keydown event is canceled by calling preventDefault, the following corresponding keypress events shouldn't be dispatched. WebKit1 implemented it by removing WM_CHAR events if the keydown event is consumed. However, WebKit2 can't do so because WebKit2 processes key events asynchronously. Thus, retrieve all following WM_CHAR events, and dispatch them after processing the keydown and if it is not consumed. In addition to that, retrieving following WM_CHAR events is needed to fix Bug 204672 because the events are needed for 'key' property of keydown KeyboardEvent for dead key combination. Gecko and Chromium also implements 'key' property in the same approach. Test: Covered by existing fast/events/inputText-never-fired-on-keydown-cancel.html and fast/events/keydown-keypress-preventDefault.html * Shared/NativeWebKeyboardEvent.h: Added m_pendingCharEvents as Vector<MSG>. (WebKit::NativeWebKeyboardEvent::pendingCharEvents const): * Shared/win/NativeWebKeyboardEventWin.cpp: (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didReceiveEvent): * UIProcess/WebPageProxy.h: * UIProcess/win/WebPageProxyWin.cpp: (WebKit::WebPageProxy::dispatchPendingCharEvents): * UIProcess/win/WebView.cpp: (WebKit::WebView::onKeyEvent): 2019-11-30 Tim Horton <timothy_horton@apple.com> Make CompositeOperator and BlendMode encodable https://bugs.webkit.org/show_bug.cgi?id=204722 Reviewed by Eric Carlson. * UIProcess/cairo/BackingStoreCairo.cpp: (WebKit::BackingStore::incorporateUpdate): * WebProcess/Plugins/PluginProxy.cpp: (WebKit::PluginProxy::paint): (WebKit::PluginProxy::update): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::drawRect): 2019-11-30 Tim Horton <timothy_horton@apple.com> Reimplement some PlatformCALayer methods using GraphicsContext instead of CGContextRef https://bugs.webkit.org/show_bug.cgi?id=204698 Reviewed by Sam Weinig. * Shared/RemoteLayerTree/RemoteLayerBackingStore.h: * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::drawInContext): (WebKit::RemoteLayerBackingStore::enumerateRectsBeingDrawn): * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp: (WebKit::PlatformCALayerRemote::enumerateRectsBeingDrawn): * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h: 2019-11-27 Antoine Quint <graouts@apple.com> [Web Animations] Enable WebAnimationsCSSIntegrationEnabled by default https://bugs.webkit.org/show_bug.cgi?id=204650 <rdar://problem/45562752> Reviewed by Dean Jackson. * Shared/WebPreferences.yaml: 2019-11-28 Fujii Hironori <Hironori.Fujii@sony.com> Remove ENABLE_KEYBOARD_CODE_ATTRIBUTE and ENABLE_KEYBOARD_KEY_ATTRIBUTE macros https://bugs.webkit.org/show_bug.cgi?id=204666 No behavior change. * Configurations/FeatureDefines.xcconfig: * Shared/WebEvent.h: (WebKit::WebKeyboardEvent::unmodifiedText const): (WebKit::WebKeyboardEvent::key const): (WebKit::WebKeyboardEvent::code const): * Shared/WebEventConversion.cpp: (WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent): * Shared/WebKeyboardEvent.cpp: (WebKit::WebKeyboardEvent::WebKeyboardEvent): (WebKit::WebKeyboardEvent::encode const): (WebKit::WebKeyboardEvent::decode): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::generateSyntheticEditingCommand): 2019-11-27 Philippe Normand <pnormand@igalia.com> [GTK][WebInspector] Use CString to store exported data https://bugs.webkit.org/show_bug.cgi?id=204623 Reviewed by Carlos Garcia Campos. * UIProcess/gtk/WebInspectorProxyGtk.cpp: (WebKit::WebInspectorProxy::platformSave): Use a CString for copy-on-write assignment. 2019-11-27 Alejandro G. Castro <alex@igalia.com> Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.27.3 release * wpe/NEWS: Add release notes for 2.27.3. 2019-11-27 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] WebDriver: moving toplevel windows is not supported under wayland https://bugs.webkit.org/show_bug.cgi?id=204614 Reviewed by Alejandro G. Castro. So we can stop trying and simply ignore the requests to move the window. * UIProcess/API/glib/WebKitUIClient.cpp: (UIClient::windowConfigureEventCallback): Ensure we only move or resize when actually required and reduce the time we wait for configure events to 200ms (1 second was too long). 2019-11-26 Antti Koivisto <antti@apple.com> [LFC][Render tree] Add LFC line layout path to RenderBlockFlow https://bugs.webkit.org/show_bug.cgi?id=204613 Reviewed by Zalan Bujtas. * Shared/WebPreferences.yaml: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): 2019-11-26 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Update OptionsGTK.cmake and NEWS for 2.27.3 release * gtk/NEWS: Add release notes for 2.27.3. 2019-11-26 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(2.27.2): [GTK] Incognito mode is broken under flatpak https://bugs.webkit.org/show_bug.cgi?id=203460 Reviewed by Youenn Fablet. The problem is that in ephemeral sessions the base disk cache directory is null, and Storage::open() ends up building a cache path with only the version part (/Version n). For some reason g_mkdir_with_parents() doesn't return -1 in flatpak when it fails to create the directory due to write permission, like in this case. But the network process ends up crashing later trying to open a directory that doesn't exist. * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::NetworkSession): Do not create the cache if networkCacheDirectory is null. * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::open): Add an ASSERT to ensure we don't receive a null baseCachePath. 2019-11-25 Yusuke Suzuki <ysuzuki@apple.com> [JSC] InternalFunction should be non-destructible https://bugs.webkit.org/show_bug.cgi?id=204556 Reviewed by Mark Lam. * WebProcess/Plugins/Netscape/JSNPMethod.cpp: (WebKit::JSNPMethod::subspaceForImpl): 2019-11-25 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] Dragged images are only available as .tiff when dropping onto macCatalyst apps https://bugs.webkit.org/show_bug.cgi?id=204598 <rdar://problem/57093920> Reviewed by Tim Horton. On macOS, writing dragged images to the pasteboard only as file promises is mostly sufficient for the purposes of dropping into Finder, Photos, and other apps. However, when dropping into a macCatalyst app, the contents of NSPasteboard will only contain a file URL, which most Catalyst apps aren't able to handle. The only other valid image representation that is written to the pasteboard in this case is "public.tiff", which loses fidelity in the case of animated GIFs. Instead, if the dragged image has a corresponding UTI and corresponding decoded image data, declare the UTI when writing promised data to the pasteboard, and later provide data for the UTI, if the drop destination asks, by using the promised image's data. Test: DragAndDropTests.ProvideImageDataAsTypeIdentifiers * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::setPromisedDataForImage): (WebKit::WebViewImpl::provideDataForPasteboard): 2019-11-25 Fujii Hironori <Hironori.Fujii@sony.com> [Win] Update KeyboardEvent as per the latest specification https://bugs.webkit.org/show_bug.cgi?id=202183 Reviewed by Ross Kirsling. * Shared/WebEvent.h: * Shared/WebKeyboardEvent.cpp: (WebKit::WebKeyboardEvent::WebKeyboardEvent): * Shared/win/WebEventFactory.cpp: (WebKit::windowsKeyNames): (WebKit::WebEventFactory::createWebKeyboardEvent): 2019-11-25 ChangSeok Oh <changseok@webkit.org> [GTK] Check EGL image extension by using native gl API in AcceleratedBackingStoreWayland https://bugs.webkit.org/show_bug.cgi?id=204446 Reviewed by Carlos Garcia Campos. This change is part of efforts bringing ANGLE backend for WebGL to the gtk port. When ANGLE WebGL is enabled, we face a dilemma of choosing either Extensions3DANGLE or Extensions3DOpenGL in AcceleratedBackingStoreWayland.cpp. Since they cannot coexist, we chose Extensions3DANGLE even if what we really want is Extensions3DOepnGL. We address this problem by directly checking egl image extension availability via native GL API rather than relying on Extensions3D* classes in the file. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::isEGLImageAvailable): (WebKit::AcceleratedBackingStoreWayland::checkRequirements): 2019-11-25 Youenn Fablet <youenn@apple.com> Crash in WebCore::ServiceWorkerRegistrationKey::hash() const https://bugs.webkit.org/show_bug.cgi?id=204497 <rdar://problem/57348603> Reviewed by Alex Christensen. * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::scheduleJobInServer): Add a release assert to be able to further debug the crash. 2019-11-23 John Wilander <wilander@apple.com> Resource Load Statistics: Allow multiple third-party cookie blocking settings https://bugs.webkit.org/show_bug.cgi?id=204389 <rdar://problem/57344054> Reviewed by Brent Fulgham. This change make the third-party cookie blocking setting go from a boolean to the new enum WebCore::ThirdPartyCookieBlockingMode with three different settings. Functions and member variables are renamed accordingly. The reason for supporting three different modes is that what is now named OnlyAccordingToPerDomainPolicy is shipping, AllOnSitesWithoutUserInteraction is in beta, and All is behind an experimental flag. The change also updates the test API to map the TestRunner call to the enum. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess): (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess): (WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction): Now makes use of a completion handler and updates the cookie blocking state. (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction): (WebKit::ResourceLoadStatisticsDatabaseStore::areAllThirdPartyCookiesBlockedUnder): New convenience function to check the cookie blocking status per first-party domain. (WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess): Restructured the code to make it very clear that the logic is the same as the corresponding function in ResourceLoadStatisticsMemoryStore. Can no longer be const since it calls areAllThirdPartyCookiesBlockedUnder() which in turn calls hasHadUserInteraction() and that function may clear user interaction data. (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUnexpiredRecentUserInteraction): (WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess const): Deleted. See comment above on the non-const version of this function. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::areAllThirdPartyCookiesBlockedUnder): New convenience function to check the cookie blocking status per first-party domain. (WebKit::ResourceLoadStatisticsMemoryStore::cookieAccess): Restructured the code to make it very clear that the logic is the same as the corresponding function in ResourceLoadStatisticsDatabaseStore. Can no longer be const since it calls areAllThirdPartyCookiesBlockedUnder() which in turn calls hasHadUserInteraction() and that function may clear user interaction data. (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess): (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess): (WebKit::ResourceLoadStatisticsMemoryStore::clearUserInteraction): Now makes use of a completion handler and updates the cookie blocking state. (WebKit::ResourceLoadStatisticsMemoryStore::cookieAccess const): Deleted. See comment above on the non-const version of this function. * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: (WebKit::ResourceLoadStatisticsStore::setThirdPartyCookieBlockingMode): (WebKit::ResourceLoadStatisticsStore::thirdPartyCookieBlockingMode const): (WebKit::ResourceLoadStatisticsStore::setIsThirdPartyCookieBlockingEnabled): Deleted. (WebKit::ResourceLoadStatisticsStore::isThirdPartyCookieBlockingEnabled const): Deleted. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setThirdPartyCookieBlockingMode): (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction): Now forwards the completion handler. (WebKit::WebResourceLoadStatisticsStore::setIsThirdPartyCookieBlockingEnabled): Deleted. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::setShouldBlockThirdPartyCookiesForTesting): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: The SetShouldBlockThirdPartyCookiesForTesting message now uses an enum instead of a boolean. * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::setResourceLoadStatisticsEnabled): Now forwards the enum value instead of a boolean. (WebKit::NetworkSession::recreateResourceLoadStatisticStore): Now makes sure the cookie blocking setting is forwarded to the recreated store. (WebKit::NetworkSession::setThirdPartyCookieBlockingMode): (WebKit::NetworkSession::setIsThirdPartyCookieBlockingEnabled): Deleted. * NetworkProcess/NetworkSession.h: * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): Support for the new enum. * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * Scripts/webkit/messages.py: Tells the IPC code generator where to find WebCore::ThirdPartyCookieBlockingMode. * Shared/WebPreferences.yaml: Flipped the IsThirdPartyCookieBlockingEnabled flag to on by default. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting): (WKWebsiteDataStoreStatisticsResetToConsistentState): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setShouldBlockThirdPartyCookiesForTesting): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): Makes use of the enum in the NetworkSessionCreationParameters. * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting): * UIProcess/WebsiteData/WebsiteDataStore.h: 2019-11-23 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r252805. https://bugs.webkit.org/show_bug.cgi?id=204553 Caused test failures and ASan crashes (Requested by ap on #webkit). Reverted changeset: "Cross-thread version StorageQuotaManager" https://bugs.webkit.org/show_bug.cgi?id=203971 https://trac.webkit.org/changeset/252805 2019-11-22 Alex Christensen <achristensen@webkit.org> Unreviewed, rolling out r252796. Turns out my reverting earlier today wasn't so necessary after all. This is effectively re-landing r250422. Reverted changeset: "Revert r250422" https://bugs.webkit.org/show_bug.cgi?id=202285 https://trac.webkit.org/changeset/252796 2019-11-22 Alex Christensen <achristensen@webkit.org> Unreviewed, rolling out r252798. Turns out my reverting earlier today wasn't so necessary after all. This is effectively re-landing r250421. Reverted changeset: "Revert r250421" https://bugs.webkit.org/show_bug.cgi?id=202290 https://trac.webkit.org/changeset/252798 2019-11-22 Kate Cheney <katherine_cheney@apple.com> ITP Database crashes if table schema is not correct https://bugs.webkit.org/show_bug.cgi?id=204458 <rdar://problem/57399084> Reviewed by Brent Fulgham. ITP database was crashing if the table schema wasn't correct. This should instead be handled by re-opening a new database with a correct schema to allow for future schema updates. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::isCorrectTableSchema): (WebKit::ResourceLoadStatisticsDatabaseStore::openAndDropOldDatabaseIfNecessary): * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: 2019-11-22 Chris Dumez <cdumez@apple.com> Simplify VisitedLinkStore process registration logic https://bugs.webkit.org/show_bug.cgi?id=204472 Reviewed by Geoffrey Garen. Simplify VisitedLinkStore process registration logic: 1. WebProcessProxy objects no longer delay their registration with the VisitedLinkStore until after they are done launching. There is no need to do this because AuxiliaxyProcessProxy::send() will correctly queue the IPC message if the process is not done launching when the VisitedLinkStore tries to send its IPC. 2. Switch VisitedLinkStore to using a WeakHashSet to store the WebProcessProxy object pointers. This is safer and this also makes it so that the WebProcessProxy no longer need to unregister themselves when shutting down. Note that AuxiliaxyProcessProxy::send() properly discards IPC messages to a terminated process anyway. * UIProcess/VisitedLinkStore.cpp: (WebKit::VisitedLinkStore::~VisitedLinkStore): (WebKit::VisitedLinkStore::addProcess): (WebKit::VisitedLinkStore::removeProcess): (WebKit::VisitedLinkStore::removeAll): (WebKit::VisitedLinkStore::didInvalidateSharedMemory): (WebKit::VisitedLinkStore::didUpdateSharedStringHashes): * UIProcess/VisitedLinkStore.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shutDown): (WebKit::WebProcessProxy::addVisitedLinkStoreUser): (WebKit::WebProcessProxy::didFinishLaunching): 2019-11-22 Chris Dumez <cdumez@apple.com> [iOS] Copy assertions before iterating over them in _notifyAssertionsOfImminentSuspension https://bugs.webkit.org/show_bug.cgi?id=204524 <rdar://problem/57265830> Reviewed by Alexey Proskuryakov. Copy assertions before iterating over them in _notifyAssertionsOfImminentSuspension and use WeakPtr to make sure the assertions are still alive before calling uiAssertionWillExpireImminently() on them. It is common for process assertions to get released when uiAssertionWillExpireImminently() gets called, which would remove them from the _assertionsNeedingBackgroundTask vector we were iterating on. * UIProcess/ios/ProcessAssertionIOS.mm: (-[WKProcessAssertionBackgroundTaskManager _notifyAssertionsOfImminentSuspension]): 2019-11-22 Alex Christensen <achristensen@webkit.org> Null check callback in NetworkConnectionToWebProcess::didDeliverMessagePortMessages https://bugs.webkit.org/show_bug.cgi?id=204460 <rdar://problem/57348618> Reviewed by Chris Dumez. When the network process crashes during a message port connection establishment, a web process may have an identifier that becomes stale. In this case, we should not crash again. No test because this only happens during a rare race condition after a network process crash, but the radar shows records of this happening. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::didDeliverMessagePortMessages): 2019-11-22 Sihui Liu <sihui_liu@apple.com> Cross-thread version StorageQuotaManager https://bugs.webkit.org/show_bug.cgi?id=203971 <rdar://problem/57290349> Reviewed by Chris Dumez. * NetworkProcess/NetworkProcess.cpp: Introduce class SessionStorageQuotaManager to manage all StorageQuotaManagers of the same session. (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::addWebsiteDataStore): (WebKit::NetworkProcess::addSessionStorageQuotaManager): (WebKit::NetworkProcess::removeSessionStorageQuotaManager): (WebKit::NetworkProcess::destroySession): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::createIDBServer): (WebKit::NetworkProcess::addIndexedDatabaseSession): (WebKit::NetworkProcess::setSessionStorageQuotaManagerIDBRootPath): (WebKit::NetworkProcess::updateQuotaBasedOnSpaceUsageForTesting): (WebKit::NetworkProcess::resetQuota): (WebKit::NetworkProcess::storageQuotaManager): (WebKit::NetworkProcess::initializeStorageQuota): Deleted. (WebKit::NetworkProcess::clearStorageQuota): Deleted. (): Deleted. (WebKit::NetworkProcess::initializeQuotaUsers): Deleted. * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::SessionStorageQuotaManager::SessionStorageQuotaManager): (WebKit::NetworkProcess::SessionStorageQuotaManager::defaultQuota const): (WebKit::NetworkProcess::SessionStorageQuotaManager::ensureOriginStorageQuotaManager): (WebKit::NetworkProcess::SessionStorageQuotaManager::existingStorageQuotaManagers): (WebKit::NetworkProcess::SessionStorageQuotaManager::cacheRootPath const): (WebKit::NetworkProcess::SessionStorageQuotaManager::setIDBRootPath): (WebKit::NetworkProcess::SessionStorageQuotaManager::idbRootPath const): (WebKit::NetworkProcess::StorageQuotaManagers::defaultQuota const): Deleted. (WebKit::NetworkProcess::StorageQuotaManagers::setDefaultQuotas): Deleted. (WebKit::NetworkProcess::StorageQuotaManagers::managersPerOrigin): Deleted. * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::getDirectorySize): (WebKit::CacheStorage::Engine::diskUsage): static function to get the disk usage of CacheStorage given CacheStorage root directory. (WebKit::CacheStorage::Engine::requestSpace): (WebKit::CacheStorage::Engine::readCachesFromDisk): (WebKit::CacheStorage::Engine::writeSizeFile): (WebKit::CacheStorage::Engine::readSizeFile): (WebKit::CacheStorage::Engine::initializeQuotaUser): Deleted. * NetworkProcess/cache/CacheStorageEngine.h: * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::Cache::put): (WebKit::CacheStorage::Cache::remove): * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::create): (WebKit::CacheStorage::Caches::Caches): (WebKit::CacheStorage::Caches::~Caches): (WebKit::CacheStorage::Caches::updateSizeFile): (WebKit::CacheStorage::Caches::initializeSize): (WebKit::CacheStorage::Caches::clear): (WebKit::CacheStorage::Caches::requestSpace): (WebKit::CacheStorage::Caches::writeRecord): (WebKit::CacheStorage::Caches::removeRecord): (WebKit::CacheStorage::Caches::whenInitialized): Deleted. (WebKit::CacheStorage::Caches::resetSpaceUsed): Deleted. * NetworkProcess/cache/CacheStorageEngineCaches.h: * Shared/WebsiteDataStoreParameters.cpp: (WebKit::WebsiteDataStoreParameters::encode const): (WebKit::WebsiteDataStoreParameters::decode): * Shared/WebsiteDataStoreParameters.h: Add a cacheStorageDirectory parameter so we know the direcotry of CacheStorage when we start using WebsiteDataStore. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreResetQuota): * UIProcess/API/C/WKWebsiteDataStoreRef.h: Add a C API for reseting quota in TestRunner. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::resetQuota): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::parameters): (WebKit::WebsiteDataStore::resetQuota): * UIProcess/WebsiteData/WebsiteDataStore.h: 2019-11-22 Alex Christensen <achristensen@webkit.org> Revert r250421 https://bugs.webkit.org/show_bug.cgi?id=202290 This is needed for rdar://problem/56760896 I left the soup parts of the original change untouched, which leaves speculative validation on for soup ports. * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/C/WKContext.cpp: (WKContextSetDiskCacheSpeculativeValidationEnabled): * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration diskCacheSpeculativeValidationEnabled]): (-[_WKProcessPoolConfiguration setDiskCacheSpeculativeValidationEnabled:]): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): 2019-11-22 Alex Christensen <achristensen@webkit.org> Revert r250422 https://bugs.webkit.org/show_bug.cgi?id=202285 This is needed for rdar://problem/56760896 * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::setCanHandleHTTPSServerTrustEvaluation): * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::canHandleHTTPSServerTrustEvaluation const): * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): * UIProcess/API/C/WKContext.cpp: (WKContextSetCanHandleHTTPSServerTrustEvaluation): * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _setCanHandleHTTPSServerTrustEvaluation:]): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): (WebKit::WebProcessPool::setCanHandleHTTPSServerTrustEvaluation): * UIProcess/WebProcessPool.h: 2019-11-22 Conrad Shultz <conrad_shultz@apple.com> Remove -[_WKThumbnailView usesSnapshot/setUsesSnapshot:] https://bugs.webkit.org/show_bug.cgi?id=150099 Reviewed by Tim Horton. Remove some unused, no-op SPI. While we're here, remove a couple unneeded explicit property syntheses. * UIProcess/API/Cocoa/_WKThumbnailView.h: * UIProcess/API/Cocoa/_WKThumbnailView.mm: (-[_WKThumbnailView setUsesSnapshot:]): Deleted. (-[_WKThumbnailView usesSnapshot]): Deleted. 2019-11-22 Chris Dumez <cdumez@apple.com> Speculative loading sometimes happens too early and is missing login cookies https://bugs.webkit.org/show_bug.cgi?id=204305 <rdar://problem/57063840> Reviewed by Antti Koivisto. Speculative loads were issued before receiving the response from the main resource. However, the main resource may set important cookies that are thus missing from the speculative requests. To address the issue we now delay speculative loads for first-party subresources until we've received the response from the main resource. To avoid regressing PLT, we still warm up the first-party subresources from disk right away and preconnect to the server. No new tests, extended existing test. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::didReceiveResponse): (WebKit::NetworkResourceLoader::didReceiveMainResourceResponse): (WebKit::NetworkResourceLoader::didRetrieveCacheEntry): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::didReceiveMainResourceResponse const): (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::markMainResourceResponseAsReceived): (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::addPostMainResourceResponseTask): (WebKit::NetworkCache::SpeculativeLoadManager::shouldRegisterLoad): (WebKit::NetworkCache::SpeculativeLoadManager::registerLoad): (WebKit::NetworkCache::SpeculativeLoadManager::registerMainResourceLoadResponse): (WebKit::NetworkCache::SpeculativeLoadManager::preconnectForSubresource): (WebKit::NetworkCache::SpeculativeLoadManager::revalidateSubresource): * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h: * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp: (WebKit::NetworkCache::SubresourceInfo::isFirstParty const): * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h: 2019-11-22 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] RemoteInspector: use sockets instead of DBus https://bugs.webkit.org/show_bug.cgi?id=204503 Reviewed by Žan Doberšek. Use GSockets API instead of DBus. * Platform/IPC/Connection.h: * SourcesGTK.txt: Remove GSocketMonitor that has been moved to WTF. * SourcesWPE.txt: Ditto. * UIProcess/glib/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::RemoteInspectorClient): (WebKit::RemoteInspectorClient::~RemoteInspectorClient): (WebKit::RemoteInspectorClient::setupConnection): (WebKit::RemoteInspectorClient::connectionDidClose): (WebKit::RemoteInspectorClient::inspect): (WebKit::RemoteInspectorClient::sendMessageToBackend): (WebKit::RemoteInspectorClient::closeFromFrontend): * UIProcess/glib/RemoteInspectorClient.h: 2019-11-21 Jer Noble <jer.noble@apple.com> Experimental support for HDR media query https://bugs.webkit.org/show_bug.cgi?id=204422 Reviewed by Eric Carlson. Notify the WebContent process of updated screen properties when the screen's color space changes. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (-[WKWindowVisibilityObserver startObserving:]): (-[WKWindowVisibilityObserver stopObserving:]): (-[WKWindowVisibilityObserver _screenDidChangeColorSpace:]): (WebKit::WebViewImpl::screenDidChangeColorSpace): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::screenPropertiesDidChange): * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setScreenProperties): 2019-11-21 Brian Burg <bburg@apple.com> Unreviewed, sort WebKit's project file after changes in r252702 and r252637. * WebKit.xcodeproj/project.pbxproj: 2019-11-21 Sihui Liu <sihui_liu@apple.com> Crash in com.apple.WebKit.WebContent at WebKit: WebKit::StorageAreaMap::loadValuesIfNeeded https://bugs.webkit.org/show_bug.cgi?id=204459 <rdar://problem/57383446> Reviewed by Geoffrey Garen. If m_storageMapID can be null if connect() fails. * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::StorageAreaMap::setItem): (WebKit::StorageAreaMap::removeItem): (WebKit::StorageAreaMap::clear): (WebKit::StorageAreaMap::loadValuesIfNeeded): 2019-11-21 Peng Liu <peng.liu6@apple.com> Ignore the requests to enter/exit video fullscreen/picture-in-picture if the requesting mode is the same as the current mode https://bugs.webkit.org/show_bug.cgi?id=204461 Reviewed by Jer Noble. In enterVideoFullscreenForVideoElement() and exitVideoFullscreenForVideoElement(), we can ignore the request if the targeting mode is the same as the current one. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement): 2019-11-20 ChangSeok Oh <changseok@webkit.org> [GTK] Add ANGLE backend to GTK port https://bugs.webkit.org/show_bug.cgi?id=199060 Reviewed by Žan Doberšek. * UIProcess/API/glib/WebKitProtocolHandler.cpp: Extention3DANGLE is used instead where ANGLE for WebGL is enabled. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: Append gl extensions for ANGLE. (WebKit::AcceleratedBackingStoreWayland::checkRequirements): 2019-11-20 Chris Dumez <cdumez@apple.com> [iOS] Make sure WebContent process does not get suspended while it is holding a process assertion for the UIProcess https://bugs.webkit.org/show_bug.cgi?id=204418 Reviewed by Jer Noble. Make sure WebContent process does not get suspended while it is holding a process assertion for the UIProcess. We see this happening in sysdiagnoses, and it means the system ends up killing the WebContent process because it leaked a process assertion. * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::processTaskStateDidChange): (WebKit::WebProcess::releaseProcessWasResumedAssertions): 2019-11-19 Brian Burg <bburg@apple.com> [Cocoa] Add _WKRemoteWebInspectorViewController SPI to set diagnostic logging delegate https://bugs.webkit.org/show_bug.cgi?id=204371 Reviewed by Devin Rousso. * UIProcess/WebInspectorProxy.h: * UIProcess/RemoteWebInspectorProxy.h: * UIProcess/RemoteWebInspectorProxy.cpp: (WebKit::RemoteWebInspectorProxy::setDiagnosticLoggingAvailable): Hook up the plumbing to forward this state change to the frontend. * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewControllerPrivate.h: Added. * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (-[_WKRemoteWebInspectorViewController _setDiagnosticLoggingDelegate:]): Add new SPI to set the diagnostic logging delegate. This is preferable to directly setting the delegate on the inspector WKWebView (via .webView._diagnosticLoggingDelegate), because the controller can notify the frontend that diagnostic logging is now available. * WebKit.xcodeproj/project.pbxproj: Add new header file and make it private. * WebProcess/WebPage/WebInspectorUI.h: * WebProcess/WebPage/WebInspectorUI.cpp: (WebKit::WebInspectorUI::setDiagnosticLoggingAvailable): Cache this value and use it for InspectorFrontendClient::diagnosticLoggingAvailable(). * WebProcess/WebPage/RemoteWebInspectorUI.messages.in: * WebProcess/WebPage/RemoteWebInspectorUI.h: * WebProcess/WebPage/RemoteWebInspectorUI.cpp: (WebKit::RemoteWebInspectorUI::setDiagnosticLoggingAvailable): Duplicate what is done for the local case. 2019-11-20 Jer Noble <jer.noble@apple.com> HTML5 audio .ended event not fired when app in background or phone screen is off https://bugs.webkit.org/show_bug.cgi?id=173332 <rdar://problem/32757402> Reviewed by Eric Carlson. When a WebPage goes from audible to inaudible, allow a short grace period before removing the activity token, to give the page a chance to (e.g.) move to the next item in a playlist before the process is suspended when in the background. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::close): (WebKit::WebPageProxy::updateThrottleState): (WebKit::WebPageProxy::clearAudibleActivity): * UIProcess/WebPageProxy.h: 2019-11-19 Chris Dumez <cdumez@apple.com> Unreviewed, fix webkitpy failures after r252655. * Scripts/webkit/LegacyMessageReceiver-expected.cpp: (WebKit::WebPage::didReceiveWebPageMessage): (WebKit::WebPage::didReceiveSyncWebPageMessage): * Scripts/webkit/MessageReceiver-expected.cpp: (WebKit::WebPage::didReceiveMessage): (WebKit::WebPage::didReceiveSyncMessage): * Scripts/webkit/MessageReceiverSuperclass-expected.cpp: (WebKit::WebPage::didReceiveMessage): (WebKit::WebPage::didReceiveSyncMessage): 2019-11-19 Chris Dumez <cdumez@apple.com> Unreviewed mac catalyst build fix after r252655. * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.messages.in: 2019-11-19 Ross Kirsling <ross.kirsling@sony.com> Unreviewed non-unified build fixes. * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/FindController.h: 2019-11-19 Chris Dumez <cdumez@apple.com> Protect MessageReceivers when possible while they are processing incoming IPC messages https://bugs.webkit.org/show_bug.cgi?id=204377 Reviewed by Brady Eidson. Protect MessageReceiver while they are processing incoming IPC messages for extra safety. It is a common mistake to call client delegates as a result of an IPC, and failing to protect |this| while doing so. Client code can destroy |this| and we end up crashing. For MessageReceivers that are not RefCounted, they can use the "NotRefCounted" attribute in their messages.in file to opt out. * NetworkProcess/Cookies/WebCookieManager.messages.in: * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.messages.in: * NetworkProcess/IndexedDB/WebIDBConnectionToClient.messages.in: * NetworkProcess/NetworkContentRuleListManager.messages.in: * NetworkProcess/NetworkSocketChannel.messages.in: * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.messages.in: * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * NetworkProcess/webrtc/NetworkMDNSRegister.messages.in: * NetworkProcess/webrtc/NetworkRTCMonitor.messages.in: * NetworkProcess/webrtc/NetworkRTCSocket.messages.in: * PluginProcess/PluginControllerProxy.messages.in: * PluginProcess/PluginProcess.messages.in: * Scripts/webkit/messages.py: * Shared/API/Cocoa/RemoteObjectRegistry.messages.in: * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: * Shared/Authentication/AuthenticationManager.messages.in: * Shared/AuxiliaryProcess.messages.in: * Shared/Plugins/NPObjectMessageReceiver.messages.in: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in: * UIProcess/DrawingAreaProxy.messages.in: * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.messages.in: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in: * UIProcess/ViewGestureController.messages.in: * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in: * UIProcess/WebFullScreenManagerProxy.messages.in: * UIProcess/WebPasteboardProxy.messages.in: * UIProcess/ios/SmartMagnificationController.messages.in: * WebProcess/ApplePay/WebPaymentCoordinator.messages.in: * WebProcess/Automation/WebAutomationSessionProxy.messages.in: * WebProcess/Geolocation/WebGeolocationManager.messages.in: * WebProcess/Network/webrtc/WebMDNSRegister.messages.in: * WebProcess/Network/webrtc/WebRTCMonitor.messages.in: * WebProcess/Network/webrtc/WebRTCResolver.messages.in: * WebProcess/Network/webrtc/WebRTCSocket.messages.in: * WebProcess/Notifications/WebNotificationManager.messages.in: * WebProcess/Storage/WebSWContextManagerConnection.messages.in: * WebProcess/WebPage/DrawingArea.messages.in: * WebProcess/WebPage/ViewGestureGeometryCollector.messages.in: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/UserMediaCaptureManager.messages.in: 2019-11-19 Per Arne Vollan <pvollan@apple.com> [iOS] Fix sysctl-read sandbox violation https://bugs.webkit.org/show_bug.cgi?id=204358 <rdar://problem/57298313> Reviewed by Brent Fulgham. The WebContent sandbox should allow sysctl-read of "kern.hostname", "kern.osrelease", and "kern.version". * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-11-19 John Wilander <wilander@apple.com> Resource Load Statistics: Count third-party script loads under top frame https://bugs.webkit.org/show_bug.cgi?id=204262 <rdar://problem/57244945> Reviewed by Alex Christensen. Third-party scripts running in the first-party context are a significant privacy and security risk. This change captures the number of such script loads which will allow ITP to take action. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::createUniqueIndices): (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema): (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements): (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships): (WebKit::ResourceLoadStatisticsDatabaseStore::getSubStatisticStatement): Addition of the new category TopFrameLoadedThirdPartyScripts. (WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString): Removed the lastSeen output since it may differ between test runs. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: Bumped statisticsModelVersion to 17. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<ResourceLoadStatistics>::encode): (IPC::ArgumentCoder<ResourceLoadStatistics>::decode): Encoding and decoding of the new category topFrameLoadedThirdPartyScripts. * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: (WebKit::WebResourceLoadObserver::logSubresourceLoading): Now takes an additional enum parameter FetchDestinationIsScriptLike which is used to detect third-party script-like loads (script, worker, or service worker) from third-parties. If one is detected, it is stored in the new topFrameLoadedThirdPartyScripts category. * WebProcess/WebCoreSupport/WebResourceLoadObserver.h: 2019-11-19 Brian Burg <bburg@apple.com> [Cocoa] Add _WKInspector SPI to set diagnostic logging delegate for a local Web Inspector https://bugs.webkit.org/show_bug.cgi?id=204323 Reviewed by Devin Rousso. Testing this end-to-end isn't quite possible yet because WebInspectorUI does not yet send any dummy diagnostic events that we can use for testing purposes. * WebKit.xcodeproj/project.pbxproj: * UIProcess/API/Cocoa/_WKInspectorInternal.h: Fix include. * UIProcess/API/Cocoa/_WKInspectorPrivate.h: Added. * UIProcess/API/Cocoa/_WKInspector.mm: Fix include. (-[_WKInspector _setDiagnosticLoggingDelegate:]): Allow clients to set the diagnosticLoggingDelegate directly on _WKInspector. The implementation forwards this setter to the Inspector's WKWebView and notifies the frontend that diagnostic logging availability did change. * UIProcess/WebInspectorProxy.h: * UIProcess/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::setDiagnosticLoggingAvailable): Plumbing. * WebProcess/WebPage/WebInspectorUI.cpp: (WebKit::WebInspectorUI::setDiagnosticLoggingAvailable): * WebProcess/WebPage/WebInspectorUI.h: * WebProcess/WebPage/WebInspectorUI.messages.in: More plumbing. 2019-11-19 Chris Dumez <cdumez@apple.com> Make sendWithAsyncReply() safe to call from any thread https://bugs.webkit.org/show_bug.cgi?id=204355 Reviewed by Alex Christensen. Make sendWithAsyncReply() safe to call from any thread, similarly to the regular send(). Also start using it in WebProcess::processTaskStateDidChange() now that it is safe. * Platform/IPC/Connection.cpp: (IPC::asyncReplyHandlerMapLock): (IPC::asyncReplyHandlerMap): (IPC::nextAsyncReplyHandlerID): (IPC::addAsyncReplyHandler): (IPC::clearAsyncReplyHandlers): (IPC::CompletionHandler<void): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::processWasResumed): * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::hasServiceWorkerPageProxy): Deleted. (WebKit::WebProcessProxy::setAssertionStateForTesting): Deleted. (WebKit::WebProcessProxy::WeakOrStrongPtr::WeakOrStrongPtr): Deleted. (WebKit::WebProcessProxy::WeakOrStrongPtr::setIsWeak): Deleted. (WebKit::WebProcessProxy::WeakOrStrongPtr::get const): Deleted. (WebKit::WebProcessProxy::WeakOrStrongPtr::operator-> const): Deleted. (WebKit::WebProcessProxy::WeakOrStrongPtr::operator* const): Deleted. (WebKit::WebProcessProxy::WeakOrStrongPtr::operator bool const): Deleted. (WebKit::WebProcessProxy::WeakOrStrongPtr::updateStrongReference): Deleted. * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::processTaskStateDidChange): (WebKit::WebProcess::parentProcessDidHandleProcessWasResumed): Deleted. 2019-11-19 Megan Gardner <megan_gardner@apple.com> <rdar://problem/57323799> Unreviwed build fix for older bots. * Platform/spi/ios/UIKitSPI.h: 2019-11-19 Brian Burg <bburg@apple.com> [Cocoa] Add WKUIDelegate SPI to inform clients when a _WKInspector attaches to a WKWebView https://bugs.webkit.org/show_bug.cgi?id=204300 <rdar://problem/57136993> Reviewed by Devin Rousso. Add a new UI delegate method to notify clients when local Web Inspector is about to be loaded. This can be triggered by -[_WKInspector show] in the Cocoa API, or via the WebCore-controlled Inspect context menu item. The client can then configure Web Inspector using delegates or by setting _WKInspector properties. Covered by new API test WebKit.DidNotifyWhenInspectorAttached. * UIProcess/API/APIUIClient.h: (API::UIClient::didAttachInspector): * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::UIDelegate::UIClient::didAttachInspector): * UIProcess/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::openLocalInspectorFrontend): 2019-11-18 John Wilander <wilander@apple.com> Check if ITP is on before applying third-party cookie blocking https://bugs.webkit.org/show_bug.cgi?id=204322 <rdar://problem/57120772> Reviewed by Chris Dumez and Alexey Proskuryakov. This change makes sure WebCore::NetworkStorageSession knows whether ITP is on or off and checks that first thing in WebCore::NetworkStorageSession::shouldBlockCookies(). This check was never needed before since if ITP was off, there would be no classified domains and thus the function would always return false. However, https://trac.webkit.org/changeset/251353/webkit introduced full third-party cookie blocking for websites without user interaction and that rule is checked before checking domain classification. The effect was unconditional third-party cookie blocking if ITP is off. This changes fixes that bug. Note that this patch already landed as branch-specific in https://trac.webkit.org/changeset/252549/webkit * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::setResourceLoadStatisticsEnabled): Now tells WebCore::NetworkStorageSession the status of ITP. 2019-11-18 David Kilzer <ddkilzer@apple.com> IPC::Decoder should use nullptr as invalid value <https://webkit.org/b/203880> <rdar://problem/53159906> Reviewed by Brent Fulgham. Covered by existing tests. * Platform/IPC/Decoder.cpp: (IPC::alignedBufferIsLargeEnoughToContain): Add bufferStart parameter to add beginning bounds check now that m_bufferPos uses nullptr for an invalid value. (IPC::Decoder::alignBufferPosition): Update to pass m_buffer to IPC::alignedBufferIsLargeEnoughToContain(). (IPC::Decoder::bufferIsLargeEnoughToContain const): Ditto. * Platform/IPC/Decoder.h: (IPC::Decoder::isInvalid const): Add beginning bounds check now that m_bufferPos uses nullptr for an invalid value. (IPC::Decoder::markInvalid): Make nullptr the invalid value for m_bufferPos. 2019-11-18 Andres Gonzalez <andresg_22@apple.com> Run AccessibilityController::rootElement on secondary thread to simulate HIServices during LayoutTests. https://bugs.webkit.org/show_bug.cgi?id=204226 Reviewed by Chris Fleizach. Added WKAccessibilityCanUseSecondaryAXThread to support WTR::AccessibilityController spawning of a secondary thread to simulate execution of isolated tree code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKAccessibilityCanUseSecondaryAXThread): * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: 2019-11-18 Chris Dumez <cdumez@apple.com> Promote main thread assertions related to sendWithAsyncReply() to be release assertions https://bugs.webkit.org/show_bug.cgi?id=204298 Reviewed by Wenson Hsieh. Promote main thread assertions related to sendWithAsyncReply() to be release assertions, to help identify threading bugs such as <rdar://problem/57231170>. * Platform/IPC/Connection.cpp: (IPC::addAsyncReplyHandler): (IPC::clearAsyncReplyHandlers): (IPC::CompletionHandler<void): 2019-11-18 Alex Christensen <achristensen@webkit.org> Fix assertion in layout test after r252492. https://bugs.webkit.org/show_bug.cgi?id=204199 There is still a case in a test where there is no frame identifier, so keep the status quo. This is a partial revert of r252492. This fixes layout test http/tests/navigation/window-open-redirect-and-remove-opener.html * Shared/FrameInfoData.cpp: (WebKit::FrameInfoData::decode): * Shared/FrameInfoData.h: * UIProcess/API/APIFrameInfo.cpp: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::createNewPage): 2019-11-18 Alex Christensen <achristensen@webkit.org> Use SecTrustEvaluateWithError instead of SecTrustEvaluate where available https://bugs.webkit.org/show_bug.cgi?id=204159 Reviewed by Darin Adler. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController _EVOrganizationName]): 2019-11-18 Darin Adler <darin@apple.com> WKWebView.mediaType is nullable, not null_resettable https://bugs.webkit.org/show_bug.cgi?id=204297 Reviewed by Anders Carlsson. * UIProcess/API/Cocoa/WKWebView.h: Use nullable for mediaType since this property returns a null value when the media type is not being overridden. 2019-11-18 Carlos Garcia Campos <