2020-07-06 Carlos Garcia Campos [GTK][WPE] Change the cookies accept policy when ITP is enabled https://bugs.webkit.org/show_bug.cgi?id=213502 Reviewed by Michael Catanzaro. * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp: (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): Use NetworkStorageSession::setCookieAcceptPolicy(). * NetworkProcess/soup/NetworkSessionSoup.cpp: (WebKit::NetworkSessionSoup::setCookiePersistentStorage): Do not change the accept policy, it's now done by NetworkStorageSession when the new cookie jar is set. * UIProcess/API/glib/WebKitCookieManager.cpp: Update API docs. * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: Ditto. 2020-07-05 Commit Queue Unreviewed, reverting r263960. https://bugs.webkit.org/show_bug.cgi?id=213980 Re-land, because r263959 somehow fixed the build issue caused by r263953 Reverted changeset: "Unreviewed, reverting r263953 and r263959." https://bugs.webkit.org/show_bug.cgi?id=213979 https://trac.webkit.org/changeset/263960 2020-07-05 Commit Queue Unreviewed, reverting r263953 and r263959. https://bugs.webkit.org/show_bug.cgi?id=213979 Broke internal build Reverted changesets: "[Cocoa] Move almost all features from FeatureDefines.xcconfig to PlatformEnableCocoa.h" https://bugs.webkit.org/show_bug.cgi?id=212542 https://trac.webkit.org/changeset/263953 "[Cocoa] Remove FEATURE_DEFINES from the Cocoa/Xcode build system" https://bugs.webkit.org/show_bug.cgi?id=213976 https://trac.webkit.org/changeset/263959 2020-07-05 Darin Adler [Cocoa] Remove FEATURE_DEFINES from the Cocoa/Xcode build system https://bugs.webkit.org/show_bug.cgi?id=213976 Reviewed by Sam Weinig. * Configurations/BaseTarget.xcconfig: Removed FEATURE_DEFINES, and added WK_ENABLE_EXPERIMENTAL_FEATURES, * Configurations/FeatureDefines.xcconfig: Removed everything except for ENABLE_WEB_RTC. 2020-07-05 Darin Adler [Cocoa] Move almost all features from FeatureDefines.xcconfig to PlatformEnableCocoa.h https://bugs.webkit.org/show_bug.cgi?id=212542 Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: Delete everything except ENABLE_EXPERIMENTAL_FEATURES and ENABLE_WEBRTC. * Configurations/WebKit.xcconfig: Added include of WebKitTargetConditionals.xcconfig. 2020-07-05 Said Abou-Hallawa [macOS] Allow selecting HEIF images if the 'accept' attribute includes an image MIME type that the platform can transcode the HEIF to https://bugs.webkit.org/show_bug.cgi?id=212489 Reviewed by Darin Adler. Make WKOpenPanelParameters call allowedFileExtensions() and allowedMIMETypes() of MIMETypeRegistry via OpenPanelParameters. UIDelegate will get allowedMIMETypes() and pass it to WebOpenPanelResultListenerProxy which will pass it to WebPageProxy. In a following patch, WebPageProxy will use allowedMIMETypes to transcode the selected images before sending them to WebPage. * UIProcess/API/APIOpenPanelParameters.cpp: (API::OpenPanelParameters::allowedMIMETypes const): (API::OpenPanelParameters::allowedFileExtensions const): (API::OpenPanelParameters::mediaCaptureType const): Deleted. * UIProcess/API/APIOpenPanelParameters.h: (API::OpenPanelParameters::mediaCaptureType const): * UIProcess/API/Cocoa/WKOpenPanelParameters.mm: (-[WKOpenPanelParameters _allowedFileExtensions]): (-[WKOpenPanelParameters _allowedFileExtensionsTitles]): Deleted. * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::runOpenPanel): * UIProcess/WebOpenPanelResultListenerProxy.cpp: (WebKit::WebOpenPanelResultListenerProxy::chooseFiles): * UIProcess/WebOpenPanelResultListenerProxy.h: (WebKit::WebOpenPanelResultListenerProxy::chooseFiles): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didChooseFilesForOpenPanel): * UIProcess/WebPageProxy.h: 2020-07-04 Darin Adler [Cocoa] Remove all features from FeatureDefines.xcconfig that are already mentioned in PlatformEnableCocoa.h https://bugs.webkit.org/show_bug.cgi?id=213962 Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: Removed all features that were mentioned in PlatformEnableCocoa.h; the rules in that file now define whether they are enabled. 2020-07-04 Darin Adler [Cocoa] Remove unconditional features from FeatureDefines.xcconfig, making sure they are covered in PlatformEnableCocoa.h https://bugs.webkit.org/show_bug.cgi?id=212418 Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: Removed features that are either unconditionally not enabled, or unconditionally enabled. Double checked that all the enabled ones are either in PlatformEnable.h or PlatformEnableCocoa.h. 2020-07-04 Sam Weinig Part 1 of SimpleColor and SRGBA are essentially the same - let's converge them https://bugs.webkit.org/show_bug.cgi?id=213948 Reviewed by Darin Adler. * UIProcess/API/wpe/WebKitColor.cpp: (webkitColorFillFromWebCoreColor): * UIProcess/gtk/ViewGestureControllerGtk.cpp: (WebKit::ViewGestureController::beginSwipeGesture): * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: (WebKit::animationValueFromKeyframeValue): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::getDocumentBackgroundColor): Adapt to use templatized toSRGBALossy. 2020-07-03 Darin Adler Make generate-unified-sources.sh not depend on features being listed in FEATURE_DEFINES environment variable https://bugs.webkit.org/show_bug.cgi?id=212420 Reviewed by Don Olmstead. * Scripts/generate-unified-sources.sh: Removed --feature-flags from the arguments passed to generate-unified-source-bundles.rb. Also removed many unneeded quotes. 2020-07-04 Darin Adler Update comment in FeatureDefines.xcconfig since PlatformEnableCocoa.h should be used instead https://bugs.webkit.org/show_bug.cgi?id=213952 Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: Updated comment. 2020-07-04 Youenn Fablet Enable VTB required low latency code path https://bugs.webkit.org/show_bug.cgi?id=210609 Reviewed by Darin Adler. Add a runtime flag to enable/disable the low latency code path. * Shared/WebPreferences.yaml: 2020-07-03 Youenn Fablet MediaRecorder should support peer connection remote video tracks https://bugs.webkit.org/show_bug.cgi?id=213924 Reviewed by Darin Adler. Pass a boolean instead of width/height for the video track. * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::create): * GPUProcess/webrtc/RemoteMediaRecorder.h: * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp: (WebKit::RemoteMediaRecorderManager::createRecorder): * GPUProcess/webrtc/RemoteMediaRecorderManager.h: * GPUProcess/webrtc/RemoteMediaRecorderManager.messages.in: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::startRecording): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: 2020-07-03 Sam Weinig Remove support for ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE https://bugs.webkit.org/show_bug.cgi?id=213932 Reviewed by Darin Adler. Removes support for non-standard , currently being guarded by the macro ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE. This macro, was added back in 2013 as a temporary measure to support some engines who shipped support for . It is currently not enabled for any ports so now seems like as good a time as any to remove it. * Configurations/FeatureDefines.xcconfig: 2020-07-03 Sam Weinig Add "-Wliteral-conversion" warning to Xcode based builds and fix the issues it finds https://bugs.webkit.org/show_bug.cgi?id=213931 Reviewed by Darin Adler. * Configurations/Base.xcconfig: Add -Wliteral-conversion. 2020-07-03 Commit Queue Unreviewed, reverting r263882. https://bugs.webkit.org/show_bug.cgi?id=213933 Broke the build Reverted changeset: "Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to replace _WKProcessPoolConfiguration.hstsStorageDirectory" https://bugs.webkit.org/show_bug.cgi?id=213048 https://trac.webkit.org/changeset/263882 2020-07-03 Michael Catanzaro [WPE][GTK] Bubblewrap sandbox should not attempt to bind empty paths https://bugs.webkit.org/show_bug.cgi?id=202880 Reviewed by Carlos Garcia Campos. If an empty path is set in LD_LIBRARY_PATH (e.g. /foo::/bar), we wind up passing --ro-bind-try --ro-bind-try to bwrap, where the second --ro-bind-try is treated as the source path to mount, and the next flag we pass gets treated as the destination path. The web process crashes with this confusing error: bwrap: Can't create file at /.flatpak-info: Read-only file system * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::bindIfExists): 2020-07-03 Youenn Fablet Allow registering VP9 as a VT decoder https://bugs.webkit.org/show_bug.cgi?id=213837 Reviewed by Jer Noble. Add a runtime flag to enable registration of VP9 as a VT decoder. Register conditionally this decoder on creation of page based on this flag. Test: media/vp9.html * Scripts/GeneratePreferences.rb: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * Shared/WebPreferences.yaml: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::enableVP9Decoder): * WebProcess/WebProcess.h: 2020-07-03 Youenn Fablet MediaRecorder stopRecorder() returns empty Blob after first use https://bugs.webkit.org/show_bug.cgi?id=212274 Reviewed by Eric Carlson. Update implementation to do initialization as part of startRecording. * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp: (WebKit::RemoteMediaRecorderManager::releaseRecorder): Remove ASSERT as recorder creation in WebProcess is always ok while creation in GPUProcess may fail and m_recorders may not be populated. * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::MediaRecorderPrivate): (WebKit::MediaRecorderPrivate::startRecording): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: 2020-07-03 Said Abou-Hallawa Change the names of MIMETypeRegistry methods to comply with webkit naming style https://bugs.webkit.org/show_bug.cgi?id=213912 Reviewed by Youenn Fablet. * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::didSendRequest): * UIProcess/API/Cocoa/APIAttachmentCocoa.mm: (API::mimeTypeInferredFromFileExtension): (API::Attachment::setFileWrapperAndUpdateContentType): * UIProcess/API/Cocoa/WKOpenPanelParameters.mm: (-[WKOpenPanelParameters _allowedFileExtensions]): * UIProcess/API/glib/WebKitURISchemeRequest.cpp: (webkitURISchemeRequestReadCallback): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::fileCanBeAcceptedForUpload): * UIProcess/Plugins/PluginInfoStore.cpp: (WebKit::PluginInfoStore::findPlugin): * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel presentWithParameters:resultListener:]): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::objectContentType): 2020-07-03 Alexander Mikhaylenko [GTK4] Support kinetic scrolling https://bugs.webkit.org/show_bug.cgi?id=213791 Reviewed by Carlos Garcia Campos. GtkEventControllerScroll skips the last event and exposes it in a separate signal. Normally one would add the KINETIC flag and listen to decelerate signal, but since WebKit already has code for calculating the velocity for GTK3, just use the same code path as scroll signal handler. * Shared/gtk/NativeWebWheelEventGtk.cpp: (WebKit::NativeWebWheelEvent::NativeWebWheelEvent): * Shared/gtk/WebEventFactory.cpp: (WebKit::WebEventFactory::createWebWheelEvent): * Shared/gtk/WebEventFactory.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseScrollEnd): (webkitWebViewBaseConstructed): 2020-07-02 Alex Christensen Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to replace _WKProcessPoolConfiguration.hstsStorageDirectory https://bugs.webkit.org/show_bug.cgi?id=213048 Reviewed by Youenn Fablet. This uses CFNetwork SPI introduced in rdar://problem/50109631 to allow HSTS storage per NSURLSession. To be complete, I also deprecated our UI process HSTS state removal attempt SPIs, WKContextResetHSTSHosts and WKContextResetHSTSHostsAddedAfterDate, which had their last use removed in rdar://problem/64220838. I manually verified that this new SPI puts HSTS data in the specified location, and I also verified that HSTS state querying and removal works with the new CFNetwork SPI as it did with the old one. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::fetchWebsiteData): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains): (WebKit::NetworkProcess::registrableDomainsWithWebsiteData): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::hostNamesWithHSTSCache const): (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): (WebKit::NetworkProcess::clearHSTSCache): (WebKit::NetworkProcess::getHostNamesWithHSTSCache): Deleted. * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::hstsStorage const): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * NetworkProcess/soup/NetworkProcessSoup.cpp: (WebKit::NetworkProcess::hostNamesWithHSTSCache const): (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): (WebKit::NetworkProcess::clearHSTSCache): (WebKit::NetworkProcess::getHostNamesWithHSTSCache): Deleted. * UIProcess/API/C/mac/WKContextPrivateMac.h: * UIProcess/API/C/mac/WKContextPrivateMac.mm: (WKContextResetHSTSHosts): (WKContextResetHSTSHostsAddedAfterDate): * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: (-[_WKWebsiteDataStoreConfiguration hstsStorageDirectory]): (-[_WKWebsiteDataStoreConfiguration setHSTSStorageDirectory:]): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::privateBrowsingSession): Deleted. (WebKit::WebProcessPool::resetHSTSHosts): Deleted. (WebKit::WebProcessPool::resetHSTSHostsAddedAfterDate): Deleted. * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary): (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::resolvedHSTSStorageDirectory const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::copy const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: 2020-07-02 Alex Christensen Update Mac CMake build * PlatformMac.cmake: 2020-07-02 Kate Cheney Custom URL schemes should be treated as app-bound https://bugs.webkit.org/show_bug.cgi?id=213889 Reviewed by Brent Fulgham. For applications which opt-in to App-Bound Domains, allow specification of app-bound custom URL schemes. All content loaded using an app-bound scheme will have access to otherwise restricted APIs. A custom scheme is specified by a colon at the end of a string in the WKAppBoundDomains list. Custom schemes are included in the count of 10 app-bound domains. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _appBoundSchemes:]): * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: SPI for testing. * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::appBoundSchemes): (WebKit::WebsiteDataStore::initializeAppBoundDomains): Change variable name from appBoundDomains to appBoundData now that more than domains can be specified in the Info.plist. (WebKit::WebsiteDataStore::ensureAppBoundDomains const): Return both domains and schemes to avoid code duplication, at the expense of occasionally returning an unused parameter if only domains or only schemes are needed. (WebKit::WebsiteDataStore::beginAppBoundDomainCheck): (WebKit::WebsiteDataStore::getAppBoundDomains const): (WebKit::WebsiteDataStore::getAppBoundSchemes const): * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-07-02 Austin Blackwood Crash in +[UIViewController _viewControllerForFullScreenPresentationFromView:] when WKContentView is deallocated https://bugs.webkit.org/show_bug.cgi?id=213867 Reviewed by Darin Adler. +[UIViewController _viewControllerForFullScreenPresentationFromView:] asserts that the view parameter is non-nil. WKFileUploadPanel passes its view (a weak pointer to the WKContentView), which may have already been nil'd out when the content view tries to dismiss the panel in its own dealloc. * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel dismiss]): Check for nil. 2020-07-02 Chris Dumez FloatingPointEnvironment::saveMainThreadEnvironment() is not called for macOS Catalyst apps on Apple Silicon https://bugs.webkit.org/show_bug.cgi?id=213897 Reviewed by Darin Adler. FloatingPointEnvironment::saveMainThreadEnvironment() is not called for macOS Catalyst apps on Apple Silicon This causes crashes because FloatingPointEnvironment::propagateMainThreadEnvironment() is called for worker threads for such apps on this platform. * Shared/ios/AuxiliaryProcessIOS.mm: (WebKit::AuxiliaryProcess::initializeSandbox): Drop some dead code for PLATFORM(MACCATALYST) since the whole file is protected with !PLATFORM(MACCATALYST). Mac Catalyst uses AuxiliaryProcessMac.mm instead. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::AuxiliaryProcess::platformInitialize): Call FloatingPointEnvironment::saveMainThreadEnvironment() on AuxiliaryProcessMac.mm since this platformInitialize() is used for Mac Catalyst and Catalyst apps may now run on Apple Silicon / ARM. Note that FloatingPointEnvironment::saveMainThreadEnvironment() is a no-op on platforms where it is not needed. 2020-07-02 Ryan Haddad Unreviewed, reverting r263633, r263651, and r263671. Still seeing MediaRecorder test crashes after re-landing r263633 Reverted changesets: "MediaRecorder stopRecorder() returns empty Blob after first use" https://bugs.webkit.org/show_bug.cgi?id=212274 https://trac.webkit.org/changeset/263633 "MediaRecorder.start() Method is Ignoring the "timeslice" Parameter" https://bugs.webkit.org/show_bug.cgi?id=202233 https://trac.webkit.org/changeset/263651 "Support MediaRecorder.onstart" https://bugs.webkit.org/show_bug.cgi?id=213720 https://trac.webkit.org/changeset/263671 2020-07-02 Chris Dumez Crash under WebKit::NetworkProcessProxy::updateProcessAssertion() https://bugs.webkit.org/show_bug.cgi?id=213891 Reviewed by Alex Christensen. The crash was due to NetworkProcessProxy::updateProcessAssertion() re-entering while in the middle of the `m_activityFromWebProcesses = nullptr;` assignment. Calling the ProcessThrottler::BackgroundActivity destructor, could cause updateProcessAssertion() to get called again, in which case we may dereference m_activityFromWebProcesses and crash. To address the issue, use `std::exchange(m_activityFromWebProcesses, nullptr);` instead, so that m_activityFromWebProcesses becomes null BEFORE the BackgroundActivity destructor gets called. updateProcessAssertion() will still re-enter but m_activityFromWebProcesses will be nullptr and updateProcessAssertion() will do the right thing. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::updateProcessAssertion): 2020-07-02 Carlos Garcia Campos Unreviewed. Fix GTK4 build * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp: (webkitScriptDialogImplConstructed): * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp: (WebKit::WebDataListSuggestionsDropdownGtk::WebDataListSuggestionsDropdownGtk): * UIProcess/gtk/WebPopupMenuProxyGtk.cpp: (WebKit::WebPopupMenuProxyGtk::createPopupMenu): 2020-07-01 Said Abou-Hallawa MIMETypeRegistry::getExtensionsForMIMEType() needs to handle wildcard MIME types https://bugs.webkit.org/show_bug.cgi?id=213826 Reviewed by Darin Adler. Replace extensionsForMIMEType() with MIMETypeRegistry::getExtensionsForMIMEType(). * UIProcess/API/Cocoa/WKOpenPanelParameters.mm: (-[WKOpenPanelParameters _allowedFileExtensions]): 2020-07-01 Lauro Moura [SOUP] Build fix after r263797 for older soup versions. Build was failing in LTS distributions due to -fpermissive Unreviewed build fix. * NetworkProcess/soup/WebSocketTaskSoup.cpp: (WebKit::WebSocketTask::sendString): 2020-07-01 Said Abou-Hallawa Allow the File object to be created with a replacement file https://bugs.webkit.org/show_bug.cgi?id=213825 Reviewed by Darin Adler. The UIProcess passes a list of strings which represents the replacement paths along with a list to the original paths to the WebProcess. The WebProcess passes these two list to FileChooser which creates the File objects and register the Blobs. The WebProcess registers the Blobs in the NetworkProcess which creates BlobDataFileReference objects with both the original path and the replacement path. The WebProcess unregisters the Blobs from the NetworkProcess which deletes the corresponding BlobDataFileReference from its registry. Upon destroying the BlobDataFileReference, the replacement file should be deleted. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::registerFileBlobURL): (WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcessPlatformStrategies.cpp: (WebKit::NetworkProcessPlatformStrategies::createBlobRegistry): * Shared/BlobDataFileReferenceWithSandboxExtension.cpp: (WebKit::BlobDataFileReferenceWithSandboxExtension::BlobDataFileReferenceWithSandboxExtension): * Shared/BlobDataFileReferenceWithSandboxExtension.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didChooseFilesForOpenPanel): * WebProcess/FileAPI/BlobRegistryProxy.cpp: (WebKit::BlobRegistryProxy::registerFileBlobURL): * WebProcess/FileAPI/BlobRegistryProxy.h: * WebProcess/WebPage/WebOpenPanelResultListener.cpp: (WebKit::WebOpenPanelResultListener::didChooseFiles): * WebProcess/WebPage/WebOpenPanelResultListener.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didChooseFilesForOpenPanel): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-07-01 Tim Horton Swipe snapshot is removed too early when swiping away from a page that is still loading https://bugs.webkit.org/show_bug.cgi?id=213763 Reviewed by Darin Adler. Test: http/tests/swipe/swipe-back-with-outstanding-load-cancellation.html When swiping back from a page that is still loading, when the swipe commits, and we start navigating back to the previous page, the unfinished forward navigation is cancelled. This cancellation resulted in a "didFailLoadForMainFrame" making it to ViewGestureController, which took it as an indication that the navigation *it* was interested in (the back navigation) had failed, and immediately removed the snapshot. Instead of listening to any random navigation's load notifications, keep track of the navigation started by goToBackForwardItem, and only listen to notifications from it, ignoring the others. This requires a bunch of plumbing to get the navigation from WebPageProxy to ViewGestureController, but is otherwise fairly trivial. * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::didFinishNavigation): (WebKit::PageClientImpl::didFailNavigation): (WebKit::PageClientImpl::didFinishLoadForMainFrame): Deleted. (WebKit::PageClientImpl::didFailLoadForMainFrame): Deleted. * UIProcess/API/gtk/PageClientImpl.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseDidFinishLoadForMainFrame): (webkitWebViewBaseDidFailLoadForMainFrame): * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: * UIProcess/API/ios/WKWebViewIOS.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _didFinishNavigation:]): (-[WKWebView _didFailNavigation:]): (-[WKWebView _didFinishLoadForMainFrame]): Deleted. (-[WKWebView _didFailLoadForMainFrame]): Deleted. * UIProcess/API/wpe/PageClientImpl.cpp: (WebKit::PageClientImpl::didFinishNavigation): (WebKit::PageClientImpl::didFailNavigation): (WebKit::PageClientImpl::didFinishLoadForMainFrame): Deleted. (WebKit::PageClientImpl::didFailLoadForMainFrame): Deleted. * UIProcess/API/wpe/PageClientImpl.h: * UIProcess/PageClient.h: * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::didReachNavigationTerminalState): (WebKit::ViewGestureController::willEndSwipeGesture): (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState): Deleted. * UIProcess/ViewGestureController.h: (WebKit::ViewGestureController::didFinishNavigation): (WebKit::ViewGestureController::didFailNavigation): (WebKit::ViewGestureController::didFinishLoadForMainFrame): Deleted. (WebKit::ViewGestureController::didFailLoadForMainFrame): Deleted. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::didFinishNavigation): (WebKit::PageClientImpl::didFailNavigation): (WebKit::PageClientImpl::didFinishLoadForMainFrame): Deleted. (WebKit::PageClientImpl::didFailLoadForMainFrame): Deleted. * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::willEndSwipeGesture): (WebKit::ViewGestureController::resetState): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::didFinishNavigation): (WebKit::PageClientImpl::didFailNavigation): (WebKit::PageClientImpl::didFinishLoadForMainFrame): Deleted. (WebKit::PageClientImpl::didFailLoadForMainFrame): Deleted. * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::resetState): * UIProcess/playstation/PageClientImpl.cpp: (WebKit::PageClientImpl::didFinishNavigation): (WebKit::PageClientImpl::didFailNavigation): (WebKit::PageClientImpl::didFinishLoadForMainFrame): Deleted. (WebKit::PageClientImpl::didFailLoadForMainFrame): Deleted. * UIProcess/playstation/PageClientImpl.h: * UIProcess/win/PageClientImpl.cpp: (WebKit::PageClientImpl::didFinishNavigation): (WebKit::PageClientImpl::didFinishLoadForMainFrame): Deleted. * UIProcess/win/PageClientImpl.h: 2020-07-01 Brent Fulgham [iOS] Allow the WebContent sandbox to check the 'hw.product' sysctl https://bugs.webkit.org/show_bug.cgi?id=213861 Reviewed by Per Arne Vollan. Telemetry shows that we need to read the 'hw.product' sysctl in the font subsystem, primarily to enable certain font features (for various products) in different locales. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-07-01 Tim Horton Upstream application accent color support https://bugs.webkit.org/show_bug.cgi?id=213859 Reviewed by Wenson Hsieh. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/Cocoa/PageClientImplCocoa.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::accentColor): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::setAccentColor): Plumb accent color to the Web Content process so that it is used when deciding the colors of selection and form controls. 2020-07-01 Keith Miller Add WebXR to WebKit.plist preferences, off by default https://bugs.webkit.org/show_bug.cgi?id=213860 Reviewed by Tim Horton. Right now we look for "WebXR" in the plist, however, it's not in the file. It so happens that, *I think*, we fall back to false for missing keys. We should have an entry for readability and consistency, though. No tests needed because this shouldn't change behavior. * FeatureFlags/WebKit.plist: 2020-07-01 Chris Dumez Regression(r259242) WebKit no longer does client navigations at foreground priority for extensions https://bugs.webkit.org/show_bug.cgi?id=213852 Reviewed by Alex Christensen. r259242 tried to address a ASSERT(window) debug assertion hit in applicationType() by only calling applicationType() when the window is non-null and assuming the process is an application when the window is null. However, this is not correct for extensions. The first thing isApplicationVisible() does is call _UIApplicationIsExtension() to determine if we are an extension. It does not need the window to make this determination. As a result, I have reverted r259242 and simply dropped the ASSERT(window) assertion in isApplicationVisible() instead. This fixes the regression tracked by by reverting the change that caused it (r259242) and drops the assertion that was hit before r259242. * UIProcess/ApplicationStateTracker.mm: (WebKit::applicationType): * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::isApplicationVisible): 2020-07-01 Daniel Bates [iOS] Implement support for UIWKDocumentRequestSpatialAndCurrentSelection https://bugs.webkit.org/show_bug.cgi?id=213704 Reviewed by Wenson Hsieh. Implement support for the new request type UIWKDocumentRequestSpatialAndCurrentSelection. Requests of this type return the contents inside the range that covers both the specified rect and the current selection, if there is one. The flag UIWKDocumentRequestSpatialAndCurrentSelection was added in . * Platform/spi/ios/UIKitSPI.h: Same thing I did in TestWebKitAPI/ios/UIKitSPI.h. See Tools ChangeLog for why. * Shared/DocumentEditingContext.h: * UIProcess/ios/WKContentViewInteraction.mm: (toWebDocumentRequestOptions): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestDocumentEditingContext): 2020-07-01 Chris Dumez Crash under IPC::isValidMessageName() https://bugs.webkit.org/show_bug.cgi?id=213751 Reviewed by Geoffrey Garen. This is a speculative fix for the crashes tracked by . The suspicion is that the compiler optimizes the code for IPC::isValidMessageName() because its parameter is of type MessageName. It may therefore assume the parameter is a valid MessageName enum value, which is ironic because the purpose of this function is to check whether or not the enum value is valid. To address the issue, I got rid of the #ifdefs in MessageName enum so that the enum values have an underlying value in the range [0, MessageName::Last]. I then updated the isValidEnum template specialization to verify that the input integer is indeed in the range [0, MessageName::Last] before casting it to a MessageName and calling IPC::isValidMessageName(). * Scripts/webkit/messages.py: 2020-07-01 Kate Cheney WKUserScripts injecting into all frames seem to violate app-bound domains https://bugs.webkit.org/show_bug.cgi?id=213816 Reviewed by Brady Eidson. Patch to make app-bound domain checks on a per-frame basis instead of per-page-based-on-main-frame. This will prevent WKUserScripts from being injected in subframes when the main frame is app-bound. Now, all ancestors of a frame must be app-bound in order for a frame to evaluate user script. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted): Move 'isMainFrame' check to be inside of the check for m_limitsNavigationsToAppBoundDomains. The navigation should fail if the main frame is not app-bound and the WKWebView is marked with the limitsNavigationToAppBoundDomains flag, but non-app-bound subframe loads are allowed to continue. (WebKit::WebPageProxy::decidePolicyForNavigationAction): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::isTopFrameNavigatingToAppBoundDomain const): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::download): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): (WebKit::WebLoaderStrategy::loadResourceSynchronously): (WebKit::WebLoaderStrategy::startPingLoad): (WebKit::WebLoaderStrategy::preconnectTo): For reporting loads to the Network Process, we only care if the main frame is app bound, so we need to store that info in the WebPage and WebPageProxy. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::shouldEnableInAppBrowserPrivacyProtections const): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::startDownload): (WebKit::WebFrame::convertMainResourceLoadToDownload): (WebKit::WebFrame::shouldEnableInAppBrowserPrivacyProtections): (WebKit::WebFrame::isTopFrameNavigatingToAppBoundDomain const): * WebProcess/WebPage/WebFrame.h: (WebKit::WebFrame::setIsNavigatingToAppBoundDomain): (WebKit::WebFrame::isNavigatingToAppBoundDomain const): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadRequest): (WebKit::WebPage::loadDataImpl): (WebKit::WebPage::didReceivePolicyDecision): (WebKit::WebPage::runJavaScript): (WebKit::WebPage::setIsNavigatingToAppBoundDomain): (WebKit::WebPage::shouldEnableInAppBrowserPrivacyProtections): Deleted. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::needsInAppBrowserPrivacyQuirks): (WebKit::WebPage::isNavigatingToAppBoundDomain const): Deleted. Move all app-bound domain logic from the WebPage to the WebFrame now that checks are on a per-frame basis. 2020-07-01 Youenn Fablet Make NetworkSendQueue use CString instead of String for UTF-8 data https://bugs.webkit.org/show_bug.cgi?id=213714 Reviewed by Darin Adler. Update code to use CString/DataReference to transmit WebSocket text messages. * NetworkProcess/NetworkSocketChannel.cpp: (WebKit::NetworkSocketChannel::sendString): * NetworkProcess/NetworkSocketChannel.h: * NetworkProcess/NetworkSocketChannel.messages.in: * NetworkProcess/WebSocketTask.h: (WebKit::WebSocketTask::sendString): * NetworkProcess/cocoa/WebSocketTaskCocoa.h: * NetworkProcess/cocoa/WebSocketTaskCocoa.mm: (WebKit::WebSocketTask::sendString): * NetworkProcess/soup/WebSocketTaskSoup.h: * NetworkProcess/soup/WebSocketTaskSoup.cpp: (WebKit::WebSocketTask::sendString): * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::createMessageQueue): (WebKit::WebSocketChannel::send): 2020-07-01 James Savage Fix Swift overlay build after r263727. https://bugs.webkit.org/show_bug.cgi?id=213823. Unreviewed, follow up build fix. * SwiftOverlay/Tests/WebKitTests.swift: (WebKitTests.testAPI): Fix tests to refer to new parameter name. * UIProcess/API/Cocoa/WebKitSwiftOverlay.swift: (callAsyncJavaScript(_:arguments:in:in:completionHandler:Error:)): Use the imported ObjC name that the compiler expects. (evaluateJavaScript(_:in:in:completionHandler:Error:)): Ditto. 2020-07-01 Youenn Fablet Make NetworkRTCProvider receive IPC messages from a background thread https://bugs.webkit.org/show_bug.cgi?id=213557 Reviewed by Geoffrey Garen. To ensure webrtc packets do not get blocked on the main thread, we process WebProcess IPC message directly in the socket thread. For new sockets, we still go through the main thread, to check suspension or proxy values. For sending packets/setting options/closing sockets, we stay in the background thread. * DerivedSources-output.xcfilelist: * DerivedSources.make: * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::sendTo): * NetworkProcess/webrtc/LibWebRTCSocketClient.h: * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::NetworkRTCProvider): (WebKit::NetworkRTCProvider::close): (WebKit::NetworkRTCProvider::createSocket): (WebKit::NetworkRTCProvider::createUDPSocket): (WebKit::NetworkRTCProvider::createServerTCPSocket): (WebKit::NetworkRTCProvider::createClientTCPSocket): (WebKit::NetworkRTCProvider::wrapNewTCPConnection): (WebKit::NetworkRTCProvider::sendToSocket): (WebKit::NetworkRTCProvider::closeSocket): (WebKit::NetworkRTCProvider::setSocketOption): (WebKit::NetworkRTCProvider::addSocket): (WebKit::NetworkRTCProvider::takeSocket): (WebKit::NetworkRTCProvider::newConnection): (WebKit::NetworkRTCProvider::dispatchToThread): * NetworkProcess/webrtc/NetworkRTCProvider.h: (WebKit::NetworkRTCProvider::didReceiveNetworkRTCMonitorMessage): * NetworkProcess/webrtc/NetworkRTCProvider.messages.in: * NetworkProcess/webrtc/NetworkRTCSocket.cpp: Removed. * NetworkProcess/webrtc/NetworkRTCSocket.h: Removed. * NetworkProcess/webrtc/NetworkRTCSocket.messages.in: Removed. * SourcesCocoa.txt: * SourcesGTK.txt: * SourcesWPE.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Network/webrtc/LibWebRTCSocket.cpp: (WebKit::LibWebRTCSocket::SendTo): (WebKit::LibWebRTCSocket::Close): (WebKit::LibWebRTCSocket::SetOption): (WebKit::LibWebRTCSocket::suspend): 2020-06-30 Sam Weinig Split Color serialization out of Color classes https://bugs.webkit.org/show_bug.cgi?id=213820 Reviewed by Darin Adler. Adopt ColorSerialization.h serialization functions. * UIProcess/API/Cocoa/WKWebView.mm: (dictionaryRepresentationForEditorState): * UIProcess/Cocoa/WebViewImpl.mm: (-[WKTextTouchBarItemController _wkChangeColor:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _setTextColorForWebView:sender:]): * UIProcess/ios/forms/WKFormColorPicker.mm: (-[WKColorPicker setControlValueFromUIColor:]): * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm: (WebKit::PDFPluginChoiceAnnotation::createAnnotationElement): * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: (WebKit::PDFPluginTextAnnotation::createAnnotationElement): 2020-06-30 Geoffrey Garen [Cocoa] [GTK] RunLoop::Timer::isActive() is incorrect for timers while they are firing https://bugs.webkit.org/show_bug.cgi?id=213771 Unreviewed assertion fix. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::timeOutTimerFired): Removed this ASSERT. One-shot timers are not active while they are firing. 2020-06-30 Wenson Hsieh Several key event tests in fast/events/ios are failing after https://bugs.webkit.org/show_bug.cgi?id=213821 Reviewed by Megan Gardner. Add an SPI method declaration. * Platform/spi/ios/UIKitSPI.h: 2020-06-30 Jiewen Tan [WebAuthn] Remove whitelistedRpId https://bugs.webkit.org/show_bug.cgi?id=213817 Reviewed by Geoffrey Garen. Remove the whitelist such that we can test the attestation service in a wider range. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): (WebKit::LocalAuthenticatorInternal::whitelistedRpId): Deleted. 2020-06-30 Brady Eidson Fix Swift overlay build after r263727. and https://bugs.webkit.org/show_bug.cgi?id=213823 Reviewed by Darin Adler. No new tests (No behavior change). Adapt the Swift overlay refinemnt to handle the inFrame: argument for these methods. * UIProcess/API/Cocoa/WebKitSwiftOverlay.swift: (callAsyncJavaScript(_:arguments:in:in:completionHandler:Error:)): (evaluateJavaScript(_:in:in:completionHandler:Error:)): (callAsyncJavaScript(_:arguments:in:completionHandler:Error:)): Deleted. (evaluateJavaScript(_:in:completionHandler:Error:)): Deleted. 2020-06-30 Brady Eidson App-bound JavaScript and Navigation failures should have specific error codes. and https://bugs.webkit.org/show_bug.cgi?id=213808 Reviewed by Tim Hatcher. (Informally by Kate Cheney) * UIProcess/API/Cocoa/WKError.h: * UIProcess/API/Cocoa/WKError.mm: (localizedDescriptionForErrorCode): * UIProcess/API/Cocoa/WKWebView.mm: (nsErrorFromExceptionDetails): * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::errorForUnpermittedAppBoundDomainNavigation): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::runJavaScript): 2020-06-30 Per Arne Vollan [macOS] Connections to the preference daemon are established before entering the sandbox https://bugs.webkit.org/show_bug.cgi?id=213379 Reviewed by Darin Adler. On macOS, connections to the preference daemon are established before entering the sandbox. These connections also persist after entering the sandbox and denying access to the preference daemon. There should not be attempts to connect to the preference daemon before entering the sandbox, since these attempts will not be stopped by the sandbox. This patch moves code that connects to the preference daemon to be executed after the sandbox has been entered. That includes code to prevent connections to the Dock and code to initialize WebKit logging. Also, instead of calling [NSBundle bundleForClass:], call [NSBundle bundleWithIdentifier:], since calling [NSBundle bundleForClass:] will connect to the preference daemon. Finally, allow the syscall SYS_gethostuuid, since that is needed by CoreFoundation when there is no access to the preference daemon. No new tests. This should be covered by existing tests. It would be nice to have a test to make sure that there are no connections to the preference daemon just before entering the sandbox, but I am not aware of how to implement this. * NetworkProcess/mac/NetworkProcessMac.mm: (WebKit::NetworkProcess::initializeSandbox): * Shared/AuxiliaryProcess.cpp: (WebKit::AuxiliaryProcess::initialize): * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::runInitializationCode): * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::webKit2Bundle): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::WebProcess::initializeSandbox): * WebProcess/com.apple.WebProcess.sb.in: 2020-06-30 Brent Fulgham Partially revert r257135 now that the underlying bug is resolved https://bugs.webkit.org/show_bug.cgi?id=213814 Reviewed by Per Arne Vollan. This patch is a partial revert of the code change in Bug 208033, where a temporary workaround was added for a bug in an underlying framework. Now that the bug has been fixed, we can remove this workaround. * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::gpuProcessSessionParameters): 2020-06-30 Brent Fulgham [macOS] Stop blocking two audio-related user client classes https://bugs.webkit.org/show_bug.cgi?id=213807 Reviewed by Per Arne Vollan. Restore IOAudioControlUserClient and IOAudioEngineUserClient since we find them being actively used on macOS for some media playback purposes. * WebProcess/com.apple.WebProcess.sb.in: 2020-06-30 Peng Liu Enable the support of FULLSCREEN_API in WebKitTestRunner https://bugs.webkit.org/show_bug.cgi?id=213774 Reviewed by Youenn Fablet. Replace the definition of ENABLE_FULLSCREEN_API in FeatureDefines.xcconfig with the one in PlatformEnableCocoa.h. We have to do that because WebKitTestRunner does not have a FeatureDefines.xcconfig but it uses "ENABLE(FULLSCREEN_API)" to conditionally compile code to test the element fullscreen API. WebKitTestRunner can use the macro defined in PlatformEnableCocoa.h. * Configurations/FeatureDefines.xcconfig: 2020-06-30 Daniel Bates [iOS] Editable regions causes ~1% slowdown in PLT5 https://bugs.webkit.org/show_bug.cgi?id=213659 Reviewed by Simon Fraser. Fix up RemoteLayerTreeViews now that the editable region is an Optional<>. Have the UI process message the web process to enable editable region on the first invocation of _requestTextInputContextsInRect, which is good indicator that there would be benefit to computing it as a typical client that calls it will call it many times. * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (WebKit::mayContainEditableElementsInRect): Fix up the logic now that there may be not be an editable region sent over in the last event region update. If there isn't one then we don't know if there are editable elements in the rect of not. So, return true, which could turn out to be a false positive if there aren't any editable elements in the rect. The caller will have to message the web process to find out the real answer if they want it. Just to clarify, it's OK for this function to have false positives, but it must never have false negatives. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::textInputContextsInRect): Enable editable region. If it's already enabled then doing so again does nothing. 2020-06-30 Peng Liu Scrunching a video to PiP can result in broken animation and leave Safari in a bad state https://bugs.webkit.org/show_bug.cgi?id=213175 Reviewed by Jer Noble. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController _completedExitFullScreen]): Update _exitRequested after exiting fullscreen to make sure the following enter fullscreen request can be processed. (-[WKFullScreenWindowController _dismissFullscreenViewController]): Make sure _completedExitFullScreen function will always execute. (-[WKFullScreenWindowController _interactivePinchDismissChanged:]): Remove a function call which corrupts the state machine under stress test. 2020-06-30 Antoine Quint [iOS] Crash under WebKit::WebPage::getFocusedElementInformation() https://bugs.webkit.org/show_bug.cgi?id=213798 Reviewed by Wenson Hsieh. Since LabelableElement::labels() returns a RefPtr, ensure we get a value before attempting to read data from it. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getFocusedElementInformation): 2020-06-30 Andy Estes [Xcode] Enable the "My Mac (Mac Catalyst)" destination in WebKit Xcode projects https://bugs.webkit.org/show_bug.cgi?id=213740 Reviewed by Darin Adler. * Configurations/Base.xcconfig: Set SUPPORTS_MACCATALYST to YES to tell Xcode that this project supports building for Mac Catalyst. 2020-06-30 Commit Queue Unreviewed, reverting r263724. https://bugs.webkit.org/show_bug.cgi?id=213781 Reverted changeset: "Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to replace _WKProcessPoolConfiguration.hstsStorageDirectory" https://bugs.webkit.org/show_bug.cgi?id=213048 https://trac.webkit.org/changeset/263724 2020-06-30 Youenn Fablet Add VP9 WebRTC codec runtime flag https://bugs.webkit.org/show_bug.cgi?id=213724 Reviewed by Eric Carlson. * Shared/WebPreferences.yaml: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): 2020-06-29 Brady Eidson JavaScript cannot be injected into iframes and https://bugs.webkit.org/show_bug.cgi?id=213556 Reviewed by Geoff Garen. This adds a few mechanisms: - Allows for WKUserScripts to have a target content world - Allows "evaluateJavaScript" and "callAsyncJavaScript" to target a specific frame - Allows for the completion handlers of those methods to be able to distinguish failure-due-to-missing-frame. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Shared/WebCoreArgumentCoders.h: * UIProcess/API/Cocoa/WKError.h: * UIProcess/API/Cocoa/WKError.mm: (localizedDescriptionForErrorCode): * UIProcess/API/Cocoa/WKUserScript.h: * UIProcess/API/Cocoa/WKUserScript.mm: (-[WKUserScript initWithSource:injectionTime:forMainFrameOnly:]): (-[WKUserScript initWithSource:injectionTime:forMainFrameOnly:inContentWorld:]): * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView evaluateJavaScript:inFrame:inContentWorld:completionHandler:]): (-[WKWebView callAsyncJavaScript:arguments:inFrame:inContentWorld:completionHandler:]): (nsErrorFromExceptionDetails): (-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]): (-[WKWebView callAsyncJavaScript:arguments:inContentWorld:completionHandler:]): Deleted. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::runJavaScript): 2020-06-29 Alex Christensen Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to replace _WKProcessPoolConfiguration.hstsStorageDirectory https://bugs.webkit.org/show_bug.cgi?id=213048 Reviewed by Youenn Fablet. This uses CFNetwork SPI introduced in rdar://problem/50109631 to allow HSTS storage per NSURLSession. To be complete, I also deprecated our UI process HSTS state removal attempt SPIs, WKContextResetHSTSHosts and WKContextResetHSTSHostsAddedAfterDate, which had their last use removed in rdar://problem/64220838. I manually verified that this new SPI puts HSTS data in the specified location, and I also verified that HSTS state querying and removal works with the new CFNetwork SPI as it did with the old one. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::fetchWebsiteData): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains): (WebKit::NetworkProcess::registrableDomainsWithWebsiteData): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::hostNamesWithHSTSCache const): (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): (WebKit::NetworkProcess::clearHSTSCache): (WebKit::NetworkProcess::getHostNamesWithHSTSCache): Deleted. * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::hstsStorage const): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * NetworkProcess/soup/NetworkProcessSoup.cpp: (WebKit::NetworkProcess::hostNamesWithHSTSCache const): (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): (WebKit::NetworkProcess::clearHSTSCache): (WebKit::NetworkProcess::getHostNamesWithHSTSCache): Deleted. * UIProcess/API/C/mac/WKContextPrivateMac.h: * UIProcess/API/C/mac/WKContextPrivateMac.mm: (WKContextResetHSTSHosts): (WKContextResetHSTSHostsAddedAfterDate): * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: (-[_WKWebsiteDataStoreConfiguration hstsStorageDirectory]): (-[_WKWebsiteDataStoreConfiguration setHSTSStorageDirectory:]): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::privateBrowsingSession): Deleted. (WebKit::WebProcessPool::resetHSTSHosts): Deleted. (WebKit::WebProcessPool::resetHSTSHostsAddedAfterDate): Deleted. * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary): (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::resolvedHSTSStorageDirectory const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::copy const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: 2020-06-29 Tim Horton Adopt adjusted symbol image names https://bugs.webkit.org/show_bug.cgi?id=213768 Reviewed by Andy Estes. * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction imageForElementActionType:]): 2020-06-29 Guowei Yang Adding Experimental Feature Flags for CoreImage backed SVG/CSS Filters https://bugs.webkit.org/show_bug.cgi?id=213578 Reviewed by Darin Adler, Simon Fraser, Myles C. Maxfield. Preparing to implement CoreImage backed filter rendering Needs Compiler guards and experimental feature guard. * Shared/WebPreferences.yaml: added feature flag definition 2020-06-29 Peng Liu Video spills over PiP screen a little when using Picture in Picture https://bugs.webkit.org/show_bug.cgi?id=213658 Reviewed by Eric Carlson. Add the video content dimensions to the IPC message VideoFullscreenManagerProxy::SetupFullscreenWithID. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): (WebKit::VideoFullscreenManagerProxy::setVideoDimensions): (WebKit::VideoFullscreenManagerProxy::enterFullscreen): * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): 2020-06-29 Chris Dumez Unreviewed, reverting r262004. Revert r262004 as it is not OK to have a data vault in TMPDIR. Reverted changeset: "[WK2] WebKit abandons compiled sandbox profiles" https://bugs.webkit.org/show_bug.cgi?id=212177 https://trac.webkit.org/changeset/262004 2020-06-29 Tetsuharu Ohzeki Remove ENABLE_STREAMS_API compilation flag https://bugs.webkit.org/show_bug.cgi?id=213728 Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: * Shared/WebPreferences.yaml: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): 2020-06-29 Per Arne Vollan [iOS] Temporarily open up sandbox for mapping of Launch Services database https://bugs.webkit.org/show_bug.cgi?id=213756 Reviewed by Brent Fulgham. Address review comments. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-06-29 Per Arne Vollan [iOS] Temporarily open up sandbox for mapping of Launch Services database https://bugs.webkit.org/show_bug.cgi?id=213756 Reviewed by Brent Fulgham. Temporarily open up sandbox for mapping of Launch Services database in the WebContent process on iOS. This is just a short term fix, and access to the service will be closed again soon. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-06-29 Chris Dumez Unreviewed, rebaseline messages.py tests. * Scripts/MessageNames.cpp: (IPC::description): (IPC::receiverName): (IPC::isValidMessageName): * Scripts/MessageNames.h: (WTF::isValidEnum): * Scripts/test-superclassMessagesReplies.h: 2020-06-29 David Kilzer Crash in NetworkProcessProxy::getNetworkProcessConnection() lambda due to missing Optional<> value check Reviewed by Darin Adler. * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::getGPUProcessConnection): - Rename `connectionIdentifier` to `identifier`. - Return early from the lamba if `identifier` does not contain a value. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::getNetworkProcessConnection): - Ditto. 2020-06-29 Wenson Hsieh [iOS] editing/selection/ios/select-text-after-changing-focus.html sometimes fails https://bugs.webkit.org/show_bug.cgi?id=213745 Work towards Reviewed by Tim Horton. This test first taps an input field to focus it, taps a button below the input field to focus the button and dismiss the keyboard, and finally long presses to select a word below the button. On recent iOS 14 builds, this test occasionally fails due to recent changes in UIKit that may cause the callout bar appearance callback to fire after focusing the input field. If this happens, we end up showing the callout bar with a single option to "Select All" (despite the field being empty), and the subsequent tap that's intended to hit the button instead hit-tests to this callout bar item. The tests subsequently times out waiting for the keyboard to dismiss, which never happens because the input field remains focused. Showing the "Select All" callout bar option in empty text fields is inconsistent with the rest of the platform (iOS), and appears to have been unintentionally introduced in iOS 12 by . While it's still unknown which exact system changes caused this test to begin timing out, we can at least fix it by addressing this existing regression in behavior. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView canPerformActionForWebView:withSender:]): Check `-hasContent` here, instead of just checking if the selection is a caret. Note that we don't need to check whether the selection is none separately, since `-hasContent` will always return `NO` if there is no selection. 2020-06-29 Sam Weinig Remove remaining makeSimpleColorFrom* variants https://bugs.webkit.org/show_bug.cgi?id=213706 Reviewed by Darin Adler. * UIProcess/API/wpe/WebKitColor.cpp: (webkitColorToWebCoreColor): Use makeSimpleColor(SRGBA { ... }) rather than makeSimpleColorFromFloats. * WebProcess/Inspector/WebInspectorClient.cpp: (WebKit::WebInspectorClient::showPaintRect): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::drawRect): Use makeSimpleColor rather than makeSimpleColorFromFloats, allowing for constant expression creation of SimpleColors. 2020-06-29 Youenn Fablet Send WebRTC packets received from network process to web process from a background thread https://bugs.webkit.org/show_bug.cgi?id=213548 Reviewed by Eric Carlson. Make LibWebRTCSocketClient take a ref to an IPC connection at creation time. Use this connection from the RTC network thread to send received packets to improve performances. Covered by existing tests. * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient): (WebKit::LibWebRTCSocketClient::signalReadPacket): (WebKit::LibWebRTCSocketClient::signalSentPacket): (WebKit::LibWebRTCSocketClient::signalAddressReady): (WebKit::LibWebRTCSocketClient::signalConnect): (WebKit::LibWebRTCSocketClient::signalClose): * NetworkProcess/webrtc/LibWebRTCSocketClient.h: * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::createSocket): (WebKit::NetworkRTCProvider::createUDPSocket): (WebKit::NetworkRTCProvider::createServerTCPSocket): (WebKit::NetworkRTCProvider::createClientTCPSocket): (WebKit::NetworkRTCProvider::wrapNewTCPConnection): * NetworkProcess/webrtc/NetworkRTCProvider.h: 2020-06-29 Elliot [GTK] Dark mode for GTK themes that end with -Dark https://bugs.webkit.org/show_bug.cgi?id=213465 Reviewed by Carlos Garcia Campos. WebKitGtk has support for automatic detection of dark mode when it comes to GTK themes with the "-dark" and ":dark" suffixes. However, when using GTK themes that end with "-Dark" or ":Dark", this is not the case. This affects many themes like "Arc" and "Flat-Remix". * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::effectiveAppearanceIsDark const): (WebKit::PageClientImpl::themeName const): 2020-06-29 Carlos Garcia Campos [GTK][WPE] Add webkit_authentication_request_get_security_origin https://bugs.webkit.org/show_bug.cgi?id=213596 Reviewed by Michael Catanzaro. Returns the security origin for the authentication protection space. * UIProcess/API/glib/WebKitAuthenticationRequest.cpp: (webkit_authentication_request_get_security_origin): * UIProcess/API/gtk/WebKitAuthenticationRequest.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitAuthenticationRequest.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: 2020-06-29 Alexander Mikhaylenko [GTK4] Context menu is misaligned https://bugs.webkit.org/show_bug.cgi?id=213703 Reviewed by Carlos Garcia Campos. Set halign on the context menu popover to the same value other context menus in GTK use, like in GtkEntry. * UIProcess/gtk/WebContextMenuProxyGtk.cpp: (WebKit::createMenuWidget): Set halign for the context menu to 'start'. 2020-06-28 Chris Dumez Fix thread-safety issue in webProcessPoolHighDynamicRangeDidChangeCallback() https://bugs.webkit.org/show_bug.cgi?id=213689 Reviewed by Darin Adler. webProcessPoolHighDynamicRangeDidChangeCallback() gets called on a background thread so we need to make sure we dispatch to the main thread before we iterate over the process pools. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::webProcessPoolHighDynamicRangeDidChangeCallback): 2020-06-28 Geoffrey Garen Rename initializeThreading to initialize https://bugs.webkit.org/show_bug.cgi?id=213674 Reviewed by Mark Lam. * Shared/API/c/WKString.cpp: (WKStringCopyJSString): * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::runInitializationCode): * Shared/WebKit2Initialize.cpp: (WebKit::InitializeWebKit2): 2020-06-28 Daniel Bates [iOS] Clean up visible position comparisons in WebPage::requestDocumentEditingContext() https://bugs.webkit.org/show_bug.cgi?id=213701 Reviewed by Geoffrey Garen. Use std::min and std::max when the result needs to be copied instead of doing the comparison by hand to make the code a tiny bit more clear. Also, don't copy a VisiblePosition when doing the min/max in-place. Both of these things are unlikely to effect code generation. If they do, the latter makes things a tiny bit more efficient. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestDocumentEditingContext): 2020-06-28 Youenn Fablet MediaRecorder stopRecorder() returns empty Blob after first use https://bugs.webkit.org/show_bug.cgi?id=212274 Reviewed by Eric Carlson. Update implementation to do initialization as part of startRecording. * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp: (WebKit::RemoteMediaRecorderManager::releaseRecorder): Remove ASSERT as recorder creation in WebProcess is always ok while creation in GPUProcess may fail and m_recorders may not be populated. * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::MediaRecorderPrivate): (WebKit::MediaRecorderPrivate::startRecording): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: 2020-06-28 Philippe Normand Unreviewed GTK/WPE Debug build fix after r263589. * Platform/Logging.h: Define a log category for Memory Pressure. 2020-06-27 Daniel Bates Revert r262654 because it caused . Moreover it is no longer necessary as the embedding client changes selection through a different SPI after focusing. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): (-[WKContentView _didCommitLoadForMainFrame]): (-[WKContentView _focusTextInputContext:placeCaretAt:completionHandler:]): 2020-06-26 David Kilzer Crash at WebKit: __62-[WKContentView(WKInteraction) resignFirstResponderForWebView]_block_invoke Reviewed by Darin Adler. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView resignFirstResponderForWebView]): - Speculative fix to return early if there are no queued key events available by the time the block runs. 2020-06-26 Wenson Hsieh [iOS] Layout tests sometimes assert under -[WKContentView hasContent] https://bugs.webkit.org/show_bug.cgi?id=213656 Reviewed by Tim Horton. Make it safe to invoke `-[WKContentView hasContent]` when post-layout data is not present, and there is no ranged or caret selection. Some editing layout tests on iOS tend to hit the post-layout data assertion due to the callout bar presentation callback firing while we reset the test harness to a consistent state (and spin the runloop while doing so). * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView hasContent]): 2020-06-26 Pablo Saavedra [GTK][WPE] Fix the matching of an empty value in getCgroupControllerPath() when only cgroupsV2 hierarchy is found https://bugs.webkit.org/show_bug.cgi?id=213646 Reviewed by Adrian Perez de Castro. * UIProcess/linux/MemoryPressureMonitor.cpp: (WebKit::getCgroupFile): (WebKit::getCgroupControllerPath): (WebKit::systemMemoryUsedAsPercentage): 2020-06-26 Jason Lawrence Unreviewed, reverting r263511, r263514, and r263565. r263511 caused MediaRecorder test crashes on internal testers. Reverted changesets: "MediaRecorder stopRecorder() returns empty Blob after first use" https://bugs.webkit.org/show_bug.cgi?id=212274 https://trac.webkit.org/changeset/263511 "Unreviewed iOS build fix after r263511." https://trac.webkit.org/changeset/263514 "MediaRecorder.start() Method is Ignoring the "timeslice" Parameter" https://bugs.webkit.org/show_bug.cgi?id=202233 https://trac.webkit.org/changeset/263565 2020-06-26 Geoffrey Garen Initializing the main thread should initialize the main run loop https://bugs.webkit.org/show_bug.cgi?id=213637 Reviewed by Anders Carlsson. * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::runInitializationCode): (WebKit::InitializeWebKit2): * Shared/WebKit2Initialize.cpp: (WebKit::InitializeWebKit2): 2020-06-26 Chris Dumez [iOS] Network process is crashing when launching TJMaxx app due to invalid NetworkProcess::DestroySession IPC message https://bugs.webkit.org/show_bug.cgi?id=213625 Reviewed by Alex Christensen. The app is calling [WKWebsiteDataStore init] despite the method being marked as unavailable in WKWebsiteDataStore.h. As a result, they end up with a WKWebsiteDataStore object whose internal _websiteDataStore is bad because its constructor was never called. When [WKWebsiteDataStore dealloc] gets called later own, it calls the ~WebsiteDataStore() destructor for _websiteDataStore but its m_sessionID is 0 because we never called the constructor. This causes us to send a NetworkProcess::DestroySession IPC with a sessionID that is 0, which is not valid so the NetworkProcess crashes. To address the issue, we now provide an implementation of [WKWebsiteDataStore init] which raises an exception, behind a linked-on-after check. To keep the app working, [WKWebsiteDataStore init] returns a new ephemeral data store until rebuilt with the new SDK. * UIProcess/API/Cocoa/WKWebsiteDataStore.h: Mark "new" as unavailable, otherwise [WKWebsiteDataStore new] builds. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore init]): Raise an exception with latest SDK, a new ephemeral data store otherwise. * UIProcess/Cocoa/VersionChecks.h: Add linked-on-after check. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::~WebsiteDataStore): Add a release assertion to make sure that m_sessionID is always valid when the destructor is called. 2020-06-26 Stephan Szabo [WinCairo] Cannot build without resource load statistics https://bugs.webkit.org/show_bug.cgi?id=213534 Reviewed by Don Olmstead. Build fix for !ENABLE(RESOURCE_LOAD_STATISTICS) * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: * UIProcess/WebsiteData/WebsiteDataStore.cpp: 2020-06-25 Alex Christensen WKHTTPCookieStore.setCookie should flush the cookies to disk before calling completion handler when we are using the UIProcess's default cookie storage https://bugs.webkit.org/show_bug.cgi?id=213636 Reviewed by Brady Eidson. This fixes a race condition that many, many third party developers run into, causing them to not be logged in when they thought they did. * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::saveCookies): * UIProcess/API/APIHTTPCookieStore.cpp: (API::HTTPCookieStore::setCookies): (API::HTTPCookieStore::registerForNewProcessPoolNotifications): (API::HTTPCookieStore::flushDefaultUIProcessCookieStore): * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm: (API::HTTPCookieStore::flushDefaultUIProcessCookieStore): 2020-06-25 Megan Gardner Upstream date/time picker style https://bugs.webkit.org/show_bug.cgi?id=213630 Reviewed by Wenson Hsieh. * UIProcess/ios/forms/WKDateTimeInputControl.mm: (-[WKDateTimePicker datePickerStyle]): 2020-06-25 Chris Dumez Unreviewed, reverting r263545. Patch will need refining Reverted changeset: "[iOS] Network process is crashing when launching TJMaxx app due to invalid NetworkProcess::DestroySession IPC message" https://bugs.webkit.org/show_bug.cgi?id=213625 https://trac.webkit.org/changeset/263545 2020-06-25 Chris Dumez [iOS] Network process is crashing when launching TJMaxx app due to invalid NetworkProcess::DestroySession IPC message https://bugs.webkit.org/show_bug.cgi?id=213625 Reviewed by Geoffrey Garen. The app is calling [WKWebsiteDataStore init] despite the method being marked as unavailable in WKWebsiteDataStore.h. As a result, they end up with a WKWebsiteDataStore object whose internal _websiteDataStore is bad because its constructor was never called. When [WKWebsiteDataStore dealloc] gets called later own, it calls the ~WebsiteDataStore() destructor for _websiteDataStore but its m_sessionID is 0 because we never called the constructor. This causes us to send a NetworkProcess::DestroySession IPC with a sessionID that is 0, which is not valid so the NetworkProcess crashes. To address the issue, we now provide an implementation of [WKWebsiteDataStore init] which returns nil behind a linked-on-after check (since this crashes the app). To keep the app working, [WKWebsiteDataStore init] returns the default data store until rebuilt with the new SDK. Note that I tried returning a new ephemeral data store instead but this was getting the app in a bad state. * UIProcess/API/Cocoa/WKWebsiteDataStore.h: Mark "new" as unavailable, otherwise [WKWebsiteDataStore new] builds. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore init]): Return nil with latest SDK, the default data store otherwise. * UIProcess/Cocoa/VersionChecks.h: Add linked-on-after check. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::~WebsiteDataStore): Add a release assertion to make sure that m_sessionID is always valid when the destructor is called. 2020-06-25 Daniel Bates [iOS] -_requestTextInputContextsInRect cannot find empty Quip spreadsheet title https://bugs.webkit.org/show_bug.cgi?id=213564 Reviewed by Simon Fraser. Check if the search rect intersects the interaction rect, even if it's empty, so long as there is an assisted element. If there isn't an assisted element just do what we do now. Otherwise, if the interaction rect is empty then this means the focused element is an empty inline and it's not tracked in the editable region (see WebCore ChangeLog entry for more details). In this case, just ask the web process directly to find the contexts. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _requestTextInputContextsInRect:completionHandler:]): 2020-06-25 Kate Cheney Allow service workers for web browsers https://bugs.webkit.org/show_bug.cgi?id=213573 Reviewed by Brent Fulgham. Allows applications with the full web-browser entitlement to use service workers. * NetworkProcess/ios/NetworkProcessIOS.mm: (WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _setupPageConfiguration:]): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::parentProcessHasServiceWorkerEntitlement const): 2020-06-25 Youenn Fablet MediaRecorder stopRecorder() returns empty Blob after first use https://bugs.webkit.org/show_bug.cgi?id=212274 Reviewed by Eric Carlson. Update implementation to do initialization as part of startRecording. * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp: (WebKit::RemoteMediaRecorderManager::releaseRecorder): Remove ASSERT as recorder creation in WebProcess is always ok while creation in GPUProcess may fail and m_recorders may not be populated. * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::MediaRecorderPrivate): (WebKit::MediaRecorderPrivate::startRecording): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: 2020-06-24 James Savage Upstream iPadOS 13.0 multi-window support https://bugs.webkit.org/show_bug.cgi?id=213590 Reviewed by Alexey Proskuryakov. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController enterFullScreen]): Always construct a UIWindow using the expected UIWindowScene. (makeWindowFromView): Deleted. 2020-06-24 David Kilzer Use ObjectIdentifier<>instead of WebCore::nextPlaybackTargetClientContextId() in Document.cpp Reviewed by Youenn Fablet. Switch from uint64_t to WebCore::PlaybackTargetClientContextIdentifier for contextId values. * Scripts/webkit/messages.py: (types_that_cannot_be_forward_declared): - Add WebCore::PlaybackTargetClientContextIdentifier to list. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::addPlaybackTargetPickerClient): (WebKit::WebPageProxy::removePlaybackTargetPickerClient): (WebKit::WebPageProxy::showPlaybackTargetPicker): (WebKit::WebPageProxy::playbackTargetPickerClientStateDidChange): (WebKit::WebPageProxy::setPlaybackTarget): (WebKit::WebPageProxy::externalOutputDeviceAvailableDidChange): (WebKit::WebPageProxy::setShouldPlayToPlaybackTarget): (WebKit::WebPageProxy::playbackTargetPickerWasDismissed): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::addPlaybackTargetPickerClient): (WebKit::WebChromeClient::removePlaybackTargetPickerClient): (WebKit::WebChromeClient::showPlaybackTargetPicker): (WebKit::WebChromeClient::playbackTargetPickerClientStateDidChange): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::playbackTargetSelected const): (WebKit::WebPage::playbackTargetAvailabilityDidChange): (WebKit::WebPage::setShouldPlayToPlaybackTarget): (WebKit::WebPage::playbackTargetPickerWasDismissed): 2020-06-24 David Kilzer [IPC] Use WebKit::LayerHostingContextID instead of uint32_t for videoLayerID Reviewed by Darin Adler. Use WebKit::LayerHostingContextID instead of uint32_t as type for videoLayerID since the value comes from LayerHostingContext::contextID() in VideoFullscreenManager::enterVideoFullscreenForVideoElement(). * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): 2020-06-24 Tim Horton Cannot play back any video on Apple Silicon devices https://bugs.webkit.org/show_bug.cgi?id=213584 Reviewed by Per Arne Vollan. * WebProcess/com.apple.WebProcess.sb.in: An unfortunate and incorrect refactoring caused some of the sandbox exceptions to get dropped on the floor. 2020-06-24 Simon Fraser REGRESSION (r260276): Scrolling through shelves on music.apple.com is not smooth https://bugs.webkit.org/show_bug.cgi?id=213572 Reviewed by Wenson Hsieh. The scroll position for an overflow:scroll element with scroll-snap could jump around during scrolling, if layout triggered a call to ScrollableArea::updateScrollSnapState(). The crux of the issue is that isScrollSnapInProgress() returned false for overflow:scrollers which are scrolling asynchronously. Fix by extending the existing ScrollingTree::isScrollSnapInProgress() to track all scrolling nodes by storing a HashSet rather than just a flag for the main frame. RenderLayer::isScrollSnapInProgress() then consults the ScrollingCoordinator, which consults the scrolling tree for this state. Add the ability to test via internals.isScrollSnapInProgress(). * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h: * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: (WebKit::RemoteScrollingCoordinator::isScrollSnapInProgress const): 2020-06-24 Commit Queue Unreviewed, reverting r263295. https://bugs.webkit.org/show_bug.cgi?id=213577 Introduced logging regression Reverted changeset: "[macOS] Connections to the preference daemon are established before entering the sandbox" https://bugs.webkit.org/show_bug.cgi?id=213379 https://trac.webkit.org/changeset/263295 2020-06-24 David Kilzer Use ObjectIdentifier<> instead of uint64_t for context IDs in VideoFullscreenManagerProxy Reviewed by Youenn Fablet. Switch from uint64_t to WebKit::PlaybackSessionContextIdentifier for contextId values. * Scripts/webkit/messages.py: (types_that_cannot_be_forward_declared): - Add WebKit::PlaybackSessionContextIdentifier to list. * UIProcess/Cocoa/PlaybackSessionManagerProxy.h: (WebKit::PlaybackSessionManagerProxy::controlsManagerContextId const): * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in: * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm: (WebKit::PlaybackSessionManagerProxy::createModelAndInterface): (WebKit::PlaybackSessionManagerProxy::ensureModelAndInterface): (WebKit::PlaybackSessionManagerProxy::ensureModel): (WebKit::PlaybackSessionManagerProxy::ensureInterface): (WebKit::PlaybackSessionManagerProxy::addClientForContext): (WebKit::PlaybackSessionManagerProxy::removeClientForContext): (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID): (WebKit::PlaybackSessionManagerProxy::clearPlaybackControlsManager): (WebKit::PlaybackSessionManagerProxy::currentTimeChanged): (WebKit::PlaybackSessionManagerProxy::bufferedTimeChanged): (WebKit::PlaybackSessionManagerProxy::seekableRangesVectorChanged): (WebKit::PlaybackSessionManagerProxy::canPlayFastReverseChanged): (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionOptionsChanged): (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionOptionsChanged): (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionIndexChanged): (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionIndexChanged): (WebKit::PlaybackSessionManagerProxy::externalPlaybackPropertiesChanged): (WebKit::PlaybackSessionManagerProxy::wirelessVideoPlaybackDisabledChanged): (WebKit::PlaybackSessionManagerProxy::mutedChanged): (WebKit::PlaybackSessionManagerProxy::volumeChanged): (WebKit::PlaybackSessionManagerProxy::durationChanged): (WebKit::PlaybackSessionManagerProxy::playbackStartedTimeChanged): (WebKit::PlaybackSessionManagerProxy::rateChanged): (WebKit::PlaybackSessionManagerProxy::pictureInPictureSupportedChanged): (WebKit::PlaybackSessionManagerProxy::handleControlledElementIDResponse const): (WebKit::PlaybackSessionManagerProxy::play): (WebKit::PlaybackSessionManagerProxy::pause): (WebKit::PlaybackSessionManagerProxy::togglePlayState): (WebKit::PlaybackSessionManagerProxy::beginScrubbing): (WebKit::PlaybackSessionManagerProxy::endScrubbing): (WebKit::PlaybackSessionManagerProxy::seekToTime): (WebKit::PlaybackSessionManagerProxy::fastSeek): (WebKit::PlaybackSessionManagerProxy::beginScanningForward): (WebKit::PlaybackSessionManagerProxy::beginScanningBackward): (WebKit::PlaybackSessionManagerProxy::endScanning): (WebKit::PlaybackSessionManagerProxy::selectAudioMediaOption): (WebKit::PlaybackSessionManagerProxy::selectLegibleMediaOption): (WebKit::PlaybackSessionManagerProxy::togglePictureInPicture): (WebKit::PlaybackSessionManagerProxy::toggleMuted): (WebKit::PlaybackSessionManagerProxy::setMuted): (WebKit::PlaybackSessionManagerProxy::setVolume): (WebKit::PlaybackSessionManagerProxy::setPlayingOnSecondScreen): - Remove MESSAGE_CHECK_CONTEXTID() since it is now redundant. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenModelContext::VideoFullscreenModelContext): (WebKit::VideoFullscreenManagerProxy::requestRouteSharingPolicyAndContextUID): (WebKit::VideoFullscreenManagerProxy::createModelAndInterface): (WebKit::VideoFullscreenManagerProxy::ensureModelAndInterface): (WebKit::VideoFullscreenManagerProxy::ensureModel): (WebKit::VideoFullscreenManagerProxy::ensureInterface): (WebKit::VideoFullscreenManagerProxy::findInterface): (WebKit::VideoFullscreenManagerProxy::addClientForContext): (WebKit::VideoFullscreenManagerProxy::removeClientForContext): (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): (WebKit::VideoFullscreenManagerProxy::setHasVideo): (WebKit::VideoFullscreenManagerProxy::setVideoDimensions): (WebKit::VideoFullscreenManagerProxy::enterFullscreen): (WebKit::VideoFullscreenManagerProxy::exitFullscreen): (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode): (WebKit::VideoFullscreenManagerProxy::setInlineRect): (WebKit::VideoFullscreenManagerProxy::setHasVideoContentLayer): (WebKit::VideoFullscreenManagerProxy::cleanupFullscreen): (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline): (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen): (WebKit::VideoFullscreenManagerProxy::requestFullscreenMode): (WebKit::VideoFullscreenManagerProxy::requestUpdateInlineRect): (WebKit::VideoFullscreenManagerProxy::requestVideoContentLayer): (WebKit::VideoFullscreenManagerProxy::returnVideoContentLayer): (WebKit::VideoFullscreenManagerProxy::didSetupFullscreen): (WebKit::VideoFullscreenManagerProxy::willExitFullscreen): (WebKit::VideoFullscreenManagerProxy::didExitFullscreen): (WebKit::VideoFullscreenManagerProxy::didEnterFullscreen): (WebKit::VideoFullscreenManagerProxy::didCleanupFullscreen): (WebKit::VideoFullscreenManagerProxy::setVideoLayerFrame): (WebKit::VideoFullscreenManagerProxy::setVideoLayerGravity): (WebKit::VideoFullscreenManagerProxy::fullscreenModeChanged): (WebKit::VideoFullscreenManagerProxy::fullscreenMayReturnToInline): - Remove MESSAGE_CHECK_CONTEXTID() since it is now redundant. * WebKit.xcodeproj/project.pbxproj: - Add PlaybackSessionContextIdentifier.h to the project. * WebProcess/cocoa/PlaybackSessionContextIdentifier.h: Add. * WebProcess/cocoa/PlaybackSessionManager.h: * WebProcess/cocoa/PlaybackSessionManager.messages.in: * WebProcess/cocoa/PlaybackSessionManager.mm: (WebKit::PlaybackSessionInterfaceContext::PlaybackSessionInterfaceContext): (WebKit::PlaybackSessionManager::createModelAndInterface): (WebKit::PlaybackSessionManager::ensureModelAndInterface): (WebKit::PlaybackSessionManager::ensureModel): (WebKit::PlaybackSessionManager::ensureInterface): (WebKit::PlaybackSessionManager::removeContext): (WebKit::PlaybackSessionManager::addClientForContext): (WebKit::PlaybackSessionManager::removeClientForContext): (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager): (WebKit::PlaybackSessionManager::clearPlaybackControlsManager): (WebKit::PlaybackSessionManager::contextIdForMediaElement): (WebKit::PlaybackSessionManager::durationChanged): (WebKit::PlaybackSessionManager::currentTimeChanged): (WebKit::PlaybackSessionManager::bufferedTimeChanged): (WebKit::PlaybackSessionManager::playbackStartedTimeChanged): (WebKit::PlaybackSessionManager::rateChanged): (WebKit::PlaybackSessionManager::seekableRangesChanged): (WebKit::PlaybackSessionManager::canPlayFastReverseChanged): (WebKit::PlaybackSessionManager::audioMediaSelectionOptionsChanged): (WebKit::PlaybackSessionManager::legibleMediaSelectionOptionsChanged): (WebKit::PlaybackSessionManager::externalPlaybackChanged): (WebKit::PlaybackSessionManager::audioMediaSelectionIndexChanged): (WebKit::PlaybackSessionManager::legibleMediaSelectionIndexChanged): (WebKit::PlaybackSessionManager::wirelessVideoPlaybackDisabledChanged): (WebKit::PlaybackSessionManager::mutedChanged): (WebKit::PlaybackSessionManager::volumeChanged): (WebKit::PlaybackSessionManager::isPictureInPictureSupportedChanged): (WebKit::PlaybackSessionManager::play): (WebKit::PlaybackSessionManager::pause): (WebKit::PlaybackSessionManager::togglePlayState): (WebKit::PlaybackSessionManager::beginScrubbing): (WebKit::PlaybackSessionManager::endScrubbing): (WebKit::PlaybackSessionManager::seekToTime): (WebKit::PlaybackSessionManager::fastSeek): (WebKit::PlaybackSessionManager::beginScanningForward): (WebKit::PlaybackSessionManager::beginScanningBackward): (WebKit::PlaybackSessionManager::endScanning): (WebKit::PlaybackSessionManager::selectAudioMediaOption): (WebKit::PlaybackSessionManager::selectLegibleMediaOption): (WebKit::PlaybackSessionManager::handleControlledElementIDRequest): (WebKit::PlaybackSessionManager::togglePictureInPicture): (WebKit::PlaybackSessionManager::toggleMuted): (WebKit::PlaybackSessionManager::setMuted): (WebKit::PlaybackSessionManager::setVolume): (WebKit::PlaybackSessionManager::setPlayingOnSecondScreen): (WebKit::nextContextId): Delete. - Replace with PlaybackSessionContextIdentifier::generate(). * WebProcess/cocoa/VideoFullscreenManager.h: (WebKit::VideoFullscreenInterfaceContext::create): * WebProcess/cocoa/VideoFullscreenManager.messages.in: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenInterfaceContext::VideoFullscreenInterfaceContext): (WebKit::VideoFullscreenManager::createModelAndInterface): (WebKit::VideoFullscreenManager::ensureModelAndInterface): (WebKit::VideoFullscreenManager::ensureModel): (WebKit::VideoFullscreenManager::ensureInterface): (WebKit::VideoFullscreenManager::removeContext): (WebKit::VideoFullscreenManager::addClientForContext): (WebKit::VideoFullscreenManager::removeClientForContext): (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement): (WebKit::VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation): (WebKit::VideoFullscreenManager::hasVideoChanged): (WebKit::VideoFullscreenManager::videoDimensionsChanged): (WebKit::VideoFullscreenManager::requestFullscreenMode): (WebKit::VideoFullscreenManager::fullscreenModeChanged): (WebKit::VideoFullscreenManager::requestUpdateInlineRect): (WebKit::VideoFullscreenManager::requestVideoContentLayer): (WebKit::VideoFullscreenManager::returnVideoContentLayer): (WebKit::VideoFullscreenManager::didSetupFullscreen): (WebKit::VideoFullscreenManager::willExitFullscreen): (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didExitFullscreen): (WebKit::VideoFullscreenManager::didCleanupFullscreen): (WebKit::VideoFullscreenManager::setVideoLayerGravityEnum): (WebKit::VideoFullscreenManager::fullscreenMayReturnToInline): (WebKit::VideoFullscreenManager::requestRouteSharingPolicyAndContextUID): (WebKit::VideoFullscreenManager::setVideoLayerFrameFenced): 2020-06-24 Alex Christensen REGRESSION(r262341) Use UTF-8 to decode CFURLRefs from IPC https://bugs.webkit.org/show_bug.cgi?id=213565 Reviewed by Darin Adler. My assumption that all valid CFURLRefs are ASCII was incorrect. Some of them are UTF-8 encoded non-ASCII. Using kCFStringEncodingUTF8 covers both. Test: fast/url/navigate-non-ascii.html * Shared/cf/ArgumentCodersCF.cpp: (IPC::decode): 2020-06-24 Umar Iqbal We should resurrect the older patch that collects some statistics of web API calls https://bugs.webkit.org/show_bug.cgi?id=213319 Reviewed by Brent Fulgham. + Enabled ENABLE_WEB_API_STATISTICS flag + Removed .string() from mainFrameRegistrableDomain to append it to topFrameRegistrableDomainsWhichAccessedWebAPIs because topFrameRegistrableDomainsWhichAccessedWebAPIs is a HashSet of WebCore::RegistrableDomain * Configurations/FeatureDefines.xcconfig: * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: (WebKit::WebResourceLoadObserver::logFontLoad): (WebKit::WebResourceLoadObserver::logCanvasRead): (WebKit::WebResourceLoadObserver::logCanvasWriteOrMeasure): (WebKit::WebResourceLoadObserver::logNavigatorAPIAccessed): (WebKit::WebResourceLoadObserver::logScreenAPIAccessed): 2020-06-24 Andy Estes [iOS] Open element actions sometimes result in a hover instead of a click https://bugs.webkit.org/show_bug.cgi?id=213530 Reviewed by Darin Adler. _WKElementAction implements a standard action handler for _WKElementActionTypeOpen that attempts a synthetic click at the interaction location, expecting this click to start a navigation to the interaction node's target URL. Synthetic clicks are subject to content change observing, however, and if ContentChangeObserver detects a meaningful visible change after dispatching a mousemove event at the interaction location then WebPage will refrain from dispatching the mousedown and mouseup events that would have started a navigation. While this behavior is necessary to support hover menus, it doesn't make sense when the user is interacting with a context menu. Since the system might display a preview of the target URL found at the interaction location, users expect the "Open" action to navigate to that same URL rather than merely display a hover menu. This change opts synthetic clicks from the open action out of content change observing by ensuring that an interaction is started when handling _WKElementActionTypeOpen (like we do for "Copy" and "Save Image"), then checking if WebPage::m_interactionNode matches the node found in WebPage::attemptSyntheticClick. If it does, WebPage now bypasses content change observing and completes a synthetic click. New API test: ElementActionTests.OpenLinkWithHoverMenu * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction _elementActionWithType:customTitle:assistant:]): Changed to call -[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:] in the handlers for _WKElementActionTypeCopy, _WKElementActionTypeOpen, _WKElementActionTypeSaveImage, and _WKElementActionTypeShare. * UIProcess/ios/WKActionSheetAssistant.h: * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]): Added to handle the subset of standard element actions that flow through WKActionSheetAssistantDelegate. Used a boolean parameter to decide whether the delegate should start and stop an interaction when handling the action. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _highlightLongPressRecognized:]): (-[WKContentView actionSheetAssistant:openElementAtLocation:]): Renamed -_attemptClickAtLocation:modifierFlags: to -_attemptSyntheticClickAtLocation:modifierFlags:. (-[WKContentView _attemptSyntheticClickAtLocation:modifierFlags:]): Changed to call WebPageProxy::attemptSyntheticClick instead of WebPageProxy::handleTap. (-[WKContentView _simulateElementAction:atLocation:]): Set _layerTreeTransactionIdAtLastInteractionStart to better simulate context menu interactions. * UIProcess/WebPageProxy.h: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::attemptSyntheticClick): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::attemptSyntheticClick): Renamed handleTap to attemptSyntheticClick. If the node responding to clicks matches the node found on interaction start (m_interactionNode), call WebPage::completeSyntheticClick directly. 2020-06-24 Tim Horton Fix the build once RBSProcessLimitations.h is introduced https://bugs.webkit.org/show_bug.cgi?id=213562 Reviewed by Wenson Hsieh. * Platform/spi/ios/RunningBoardServicesSPI.h: We can't forward-declare Objective-C SPI if it actually exists without inspiring duplicate definition errors. 2020-06-24 Alex Christensen Remove now-invalid assertion after r263441 https://bugs.webkit.org/show_bug.cgi?id=213527 The alternative service storage directory is now null when HTTP/3 is disabled, not just in private browsing. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): 2020-06-24 Jer Noble REGRESSION (r263328): Crash in bool WTF::WeakHashSet::contains const https://bugs.webkit.org/show_bug.cgi?id=213526 Reviewed by Eric Carlson. Clear the m_routingArbitrator before WebProcessPool::disconnectProcess(), not after. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shutDown): 2020-06-24 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.29.2 release * gtk/NEWS: Add release notes for 2.29.2. 2020-06-24 Carlos Garcia Campos [GTK][WPE] Add API to allow applications to handle the HTTP authentication credential storage https://bugs.webkit.org/show_bug.cgi?id=213177 Reviewed by Michael Catanzaro. Add API to disable the internal credential storage support when building with libsecret. And add new API to WebKitAuthenticationRequest to allow applications to use their own credentials storage: * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::persistentCredentialStorageEnabled const): (WebKit::NetworkDataTaskSoup::authenticate): (WebKit::NetworkDataTaskSoup::continueAuthenticate): (WebKit::NetworkDataTaskSoup::didGetHeaders): * NetworkProcess/soup/NetworkDataTaskSoup.h: * NetworkProcess/soup/NetworkProcessSoup.cpp: (WebKit::NetworkProcess::setPersistentCredentialStorageEnabled): * NetworkProcess/soup/NetworkSessionSoup.cpp: (WebKit::NetworkSessionSoup::NetworkSessionSoup): * NetworkProcess/soup/NetworkSessionSoup.h: * UIProcess/API/glib/WebKitAuthenticationRequest.cpp: (webkitAuthenticationRequestDispose): (webkit_authentication_request_class_init): (webkitAuthenticationRequestCreate): (webkitAuthenticationRequestDidAuthenticate): (webkitAuthenticationRequestGetProposedCredential): (webkit_authentication_request_can_save_credentials): (webkit_authentication_request_set_can_save_credentials): (webkit_authentication_request_get_proposed_credential): (webkit_authentication_request_set_proposed_credential): (webkit_authentication_request_authenticate): (webkit_authentication_request_cancel): * UIProcess/API/glib/WebKitAuthenticationRequestPrivate.h: * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewCompleteAuthenticationRequest): (webkitWebViewLoadChanged): (webkitWebViewLoadFailed): (webkitWebViewLoadFailedWithTLSErrors): (webkitWebViewHandleAuthenticationChallenge): * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkit_website_data_manager_set_persistent_credential_storage_enabled): (webkit_website_data_manager_get_persistent_credential_storage_enabled): * UIProcess/API/gtk/WebKitAuthenticationDialog.cpp: (webkitAuthenticationDialogInitialize): * UIProcess/API/gtk/WebKitAuthenticationRequest.h: * UIProcess/API/gtk/WebKitWebsiteDataManager.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitAuthenticationRequest.h: * UIProcess/API/wpe/WebKitWebsiteDataManager.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::persistentCredentialStorageEnabled const): * UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp: (WebKit::WebsiteDataStore::platformSetNetworkParameters): (WebKit::WebsiteDataStore::setPersistentCredentialStorageEnabled): * UIProcess/soup/WebProcessPoolSoup.cpp: (WebKit::WebProcessPool::platformInitializeNetworkProcess): 2020-06-24 Carlos Garcia Campos [GTK][WPE] Do not set the default configuration again when creating the WebsiteDataStore https://bugs.webkit.org/show_bug.cgi?id=213340 Reviewed by Michael Catanzaro. WebsiteDataStoreConfiguration already initializes on construction with the default paths, so we only need to override the ones set by the user. * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkitWebsiteDataManagerGetDataStore): 2020-06-23 Alex Christensen Make HTTP/3 experimental feature work on iOS and only create storage directory if enabled https://bugs.webkit.org/show_bug.cgi?id=213527 Reviewed by Geoffrey Garen. Reading the experimental feature wasn't working on iOS because the user defaults prefix is different. Also, only resolve and create the directory if it is enabled. This should help with startup time, which has to wait for all directories to be resolved and created. See rdar://problem/64263228 which this should help with. We also respect the system default unless explicitly turned on, which should make it easier for CFNetwork to change things. I added an API test that verifies that the default alt-svc storage directory is not created when we don't want it to be. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::platformSetNetworkParameters): (WebKit::WebsiteDataStore::http3Enabled): 2020-06-23 Wenson Hsieh REGRESSION (r244633): Mail flashes when copying text in an email https://bugs.webkit.org/show_bug.cgi?id=213529 Reviewed by Tim Horton. When copying a text selection in Mail conversation view, Mail uses injected bundle hooks to supply additional metadata before writing to the pasteboard. Grabbing this data involves temporarily expanding any collapsed blockquotes that appear in the mail message, before re-collapsing them after we finish gathering data to be written to the pasteboard. Prior to r244633, the size of the document while expanding collapsed content would not be propagated to the WKWebView, since intrinsic content size changes were batched and sent ahead of the next drawing area flush. After r244633, however, updates are now sent every time the layout size changes. This was done to ensure that the intrinsic content size was always up to date before sending the first layout milestone to the UI process. To preserve the intent of r244633 (with respect to the first layout milestone) as well as intrinsic content size behavior prior to r244633 after performing layout, we reintroduce the mechanism for batching intrinsic size updates until the next flush, but keep the out-of-band mechanism for immediately sending an up-to-date intrinsic size to the UI process before firing the first layout milestone. Test: WebKit.AutoLayoutBatchesUpdatesWhenInvalidatingIntrinsicContentSize * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::intrinsicContentsSizeChanged const): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded): If we have a pending intrinsic content size update, clear it out here so that an out-of-band call to updateIntrinsicContentSizeIfNeeded doesn't get overridden by an older intrinsic content size that was previously scheduled. (WebKit::WebPage::flushPendingIntrinsicContentSizeUpdate): Add a helper method to send any pending intrinsic content size update. (WebKit::WebPage::scheduleIntrinsicContentSizeUpdate): Add a helper method to schedule an intrinsic content size update for the next tiled drawing area flush. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updateRendering): 2020-06-23 Andy Estes [Apple Pay] WebPaymentCoordinatorProxy can be destroyed without dismissing its authorization presenter https://bugs.webkit.org/show_bug.cgi?id=213423 Reviewed by Youenn Fablet. When a website completes a payment session, WebPaymentCoordinatorProxy would set its m_state to Idle by calling didReachFinalState, but would wait to call hidePaymentUI until the payment authorization presenter calls its presenterDidFinish callback. This allows the presenter to display a final message to the user before dismissing. As a catch-all, ~WebPaymentCoordinatorProxy would call hidePaymentUI, but only if m_state wasn't Idle. If a WebPaymentCoordinatorProxy was destroyed after a website completed a payment session but before the presenter called presenterDidFinish, hidePaymentUI would never be called. This patch addresses this by simplifying the logic for completing or canceling a payment session. It's based on the following observations: 1. With the exception of the case described above, every caller of didReachFinalState would also call hidePaymentUI immediately beforehand. That means that we can move the calls to hidePaymentUI inside didReachFinalState. For the completePaymentSession case, rather than call didReachFinalState without dismissing the UI, we enter a new Completing state, then call didReachFinalState either in ~WebPaymentCoordinatorProxy or presenterDidFinish. 2. didCancelPaymentSession is really a special case of didReachFinalState that also sends the DidCancelPaymentSession message to cancel active sessions in the web process. We can teach didReachFinalState to send this message when necessary and remove didCancelPaymentSession. 3. PaymentAuthorizationPresenter stored a "did reach final state" boolean on payment completion and passed this value back to the client in the presenterDidFinish callback. WebPaymentCoordinatorProxy used this to determine whether to cancel an active session by calling didCancelPaymentSession or clean up a completed session by calling hidePaymentUI. With the addition of the Completing state and the merging of didCancelPaymentSession and hidePaymentUI into didReachFinalState, we can get rid of this final state tracking in PaymentAuthorizationPresenter and unconditionally call didReachFinalState in the presenterDidFinish callback. No new tests possible. A manual test case is described in . * Platform/cocoa/PaymentAuthorizationPresenter.h: Removed the didReachFinalState argument from Client::presenterDidFinish. * Platform/cocoa/PaymentAuthorizationPresenter.mm: (WebKit::PaymentAuthorizationPresenter::completePaymentSession): Changed to call -[WKPaymentAuthorizationDelegate completePaymentSession:errors:]. * Platform/cocoa/WKPaymentAuthorizationDelegate.h: * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: Removed the _didReachFinalState ivar. (-[WKPaymentAuthorizationDelegate completePaymentSession:errors:]): Renamed from -completePaymentSession:errors:didReachFinalState:. Stopped setting _didReachFinalState. (-[WKPaymentAuthorizationDelegate invalidate]): Changed to call -completePaymentSession:errors:. (-[WKPaymentAuthorizationDelegate _didAuthorizePayment:completion:]): Ditto. (-[WKPaymentAuthorizationDelegate _didFinish]): Stopped passing the value of _didReachFinalState to PaymentAuthorizationPresenter::Client::presenterDidFinish. (-[WKPaymentAuthorizationDelegate completePaymentSession:errors:didReachFinalState:]): Renamed to -completePaymentSession:errors:. * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp: (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): Replaced calls to didCancelPaymentSession with didReachFinalState. (WebKit::WebPaymentCoordinatorProxy::completePaymentSession): Set m_state to Completing rather than call didReachFinalState. (WebKit::WebPaymentCoordinatorProxy::abortPaymentSession): Removed call to hidePaymentUI since didReachFinalState was already being called. (WebKit::WebPaymentCoordinatorProxy::cancelPaymentSession): Replaced call to didCancelPaymentSession with didReachFinalState. (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Called didReachFinalState unconditionally now that the didReachFinalState boolean has been removed. (WebKit::WebPaymentCoordinatorProxy::canBegin const): Returned false for State::Completing. (WebKit::WebPaymentCoordinatorProxy::canCancel const): Ditto. (WebKit::WebPaymentCoordinatorProxy::canCompletePayment const): Ditto. (WebKit::WebPaymentCoordinatorProxy::canAbort const): Ditto. (WebKit::WebPaymentCoordinatorProxy::didReachFinalState): Added an early return if m_state is already Idle. Sent the DidCancelPaymentSession message if canCancel is true. Called platformHidePaymentUI before clearing m_authorizationPresenter and setting m_state to Idle. (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Deleted. * Shared/ApplePay/WebPaymentCoordinatorProxy.h: (WebKit::WebPaymentCoordinatorProxy::didReachFinalState): Added a PaymentSessionError&& arg. (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Deleted. * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): Replaced call to hidePaymentUI with didReachFinalState. * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: (WebKit::WebPaymentCoordinatorProxy::platformHidePaymentUI): Renamed from hidePaymentUI. Stopped clearing m_authorizationPresenter since didReachFinalState now does that. (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Renamed to platformHidePaymentUI. * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Removed call to hidePaymentUI since didReachFinalState was already being called. (WebKit::WebPaymentCoordinatorProxy::platformHidePaymentUI): Renamed from hidePaymentUI. Stopped clearing m_authorizationPresenter since didReachFinalState now does that. (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Renamed to platformHidePaymentUI. 2020-06-23 Chris Dumez Remove a lot of unnecessary calls to Ref::copyRef() https://bugs.webkit.org/show_bug.cgi?id=213533 Reviewed by Darin Adler. Remove a lot of unnecessary calls to Ref::copyRef() now that Ref is copyable. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::requestResource): * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::CompletionHandler [curl] Unreviewed build fix for r263407 https://bugs.webkit.org/show_bug.cgi?id=213409 * NetworkProcess/curl/NetworkDataTaskCurl.h: Include . 2020-06-23 Alex Christensen Expose already-available WKNavigationAction.request.HTTPBody through the API https://bugs.webkit.org/show_bug.cgi?id=179077 Reviewed by Brady Eidson. When this bug was written, we needed to serialize the HTTP body to the UI process to expose it through the API. The controversial part of this was done in r237639, so this just exposes the data that is already available. Verified by an API test. * UIProcess/API/Cocoa/WKNavigationAction.mm: (-[WKNavigationAction request]): 2020-06-23 Alex Christensen Remove unnecessary Timer from NetworkDataTask https://bugs.webkit.org/show_bug.cgi?id=213409 Reviewed by Youenn Fablet. * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::NetworkDataTask): (WebKit::NetworkDataTask::scheduleFailure): (WebKit::NetworkDataTask::failureTimerFired): Deleted. * NetworkProcess/NetworkDataTask.h: * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::resume): * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::resume): 2020-06-22 Carlos Garcia Campos [GTK][WPE] Add API to configure and handle DOM cache to WebKitWebsiteDataManager https://bugs.webkit.org/show_bug.cgi?id=213337 Reviewed by Adrian Perez de Castro. The default path is always used even for apps setting a base data directory. We should handle WebsiteDataType::DOMCache to configure the directory and allow to fetch and clear it. * UIProcess/API/glib/WebKitWebsiteData.cpp: (recordContainsSupportedDataTypes): (toWebKitWebsiteDataTypes): * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkitWebsiteDataManagerGetProperty): (webkitWebsiteDataManagerSetProperty): (webkitWebsiteDataManagerConstructed): (webkit_website_data_manager_class_init): (webkitWebsiteDataManagerGetDataStore): (webkit_website_data_manager_get_dom_cache_directory): (toWebsiteDataTypes): * UIProcess/API/gtk/WebKitWebsiteData.h: * UIProcess/API/gtk/WebKitWebsiteDataManager.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitWebsiteData.h: * UIProcess/API/wpe/WebKitWebsiteDataManager.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::websiteDataStoreFromSessionID): GTK and WPE ports don't use the default website data store, so only use it when it already exists. Use the process pool website data store instead. 2020-06-22 John Wilander Storage Access API: Add the capability to call the Storage Access API as a quirk, on behalf of websites that should be doing it themselves https://bugs.webkit.org/show_bug.cgi?id=213418 Reviewed by Alex Christensen. These changes are for forwarding ITP's knowledge of user interaction for specific quirks domains to the WebKit::WebProcessPool where it in turn can be distributed to all existing and new Web Content processes. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::needsUserInteractionQuirk const): (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * Shared/WebProcessDataStoreParameters.h: (WebKit::WebProcessDataStoreParameters::encode const): (WebKit::WebProcessDataStoreParameters::decode): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setDomainsWithUserInteraction): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::webProcessDataStoreParameters): (WebKit::WebProcessPool::setDomainsWithUserInteraction): * UIProcess/WebProcessPool.h: * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: (WebKit::WebResourceLoadObserver::hasHadUserInteraction const): * WebProcess/WebCoreSupport/WebResourceLoadObserver.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setWebsiteDataStoreParameters): (WebKit::WebProcess::setDomainsWithUserInteraction): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2020-06-22 Wenson Hsieh [macOS] WebPageProxy::setPromisedDataForImage should sanitize its filename https://bugs.webkit.org/show_bug.cgi?id=213486 Reviewed by Megan Gardner. Ensure that the filename passed into WebPageProxy::setPromisedDataForImage is sanitized in the UI process prior to being used as a suggested filename when writing a dragged image to the pasteboard. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::setPromisedDataForImage): 2020-06-22 Tim Horton WebEx can not share video from Safari on arm64 https://bugs.webkit.org/show_bug.cgi?id=213481 Reviewed by Dean Jackson. * UIProcess/UserMediaProcessManager.cpp: (WebKit::needsAppleCameraService): (WebKit::UserMediaProcessManager::willCreateMediaStream): (WebKit::UserMediaProcessManager::revokeSandboxExtensionsIfNeeded): Pass sandbox extension for "com.apple.applecamerad" to the Web Content process after the user allows camera access, when running on hardware which requires it. * WebProcess/com.apple.WebProcess.sb.in: Make it possible to dynamically extend the sandbox as above. 2020-06-22 Tim Horton Cannot play back encrypted media on arm64 https://bugs.webkit.org/show_bug.cgi?id=213483 Reviewed by Jer Noble and Per Arne Vollan. * WebProcess/com.apple.WebProcess.sb.in: Extend the sandbox as necessary for encrypted media support. 2020-06-22 Michael Catanzaro [WPE][GTK] Public API should not allow trying to register a special URI scheme https://bugs.webkit.org/show_bug.cgi?id=209900 Reviewed by Adrian Perez de Castro Epiphany prior to 3.36 registers a scheme handler for ftp. This introduced criticals. Let's use g_warning() instead, and avoid hardcoding the list of disallowed schemes. * UIProcess/API/glib/WebKitWebContext.cpp: (webkit_web_context_register_uri_scheme): 2020-06-22 Tim Horton dlopen() always fails on arm64, cannot load soft-linked libraries https://bugs.webkit.org/show_bug.cgi?id=213480 Reviewed by Alexey Proskuryakov and Per Arne Vollan. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::initializeSandboxParameters): Expose the auxiliary process' CPU family as a parameter to the sandbox profile, so that it can be used to predicate sandbox expressions. * WebProcess/com.apple.WebProcess.sb.in: Allow mremap_encrypted from the Web Content process, because the arm64 dlopen() needs it. 2020-06-22 Tim Horton Update macOS version macros https://bugs.webkit.org/show_bug.cgi?id=213484 Reviewed by Alexey Proskuryakov. * Configurations/Base.xcconfig: * Configurations/DebugRelease.xcconfig: * Configurations/Version.xcconfig: * Configurations/WebKitTargetConditionals.xcconfig: 2020-06-22 Tim Horton sysctl() fails due to sandbox violation https://bugs.webkit.org/show_bug.cgi?id=213482 Reviewed by Maciej Stachowiak. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: Extend the sandbox as necessary to make sysctl calls work. 2020-06-22 Antoine Quint WebKit fails to leave audio routing arbitration during navigation, closing. https://bugs.webkit.org/show_bug.cgi?id=213426 Unreviewed build fix for an unannotated switch fall-through between switch labels. * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _audioRoutingArbitrationStatus]): 2020-06-21 Jer Noble WebKit fails to leave audio routing arbitration during navigation, closing. https://bugs.webkit.org/show_bug.cgi?id=213426 Reviewed by Eric Carlson. Add testing SPIs to verify whether a WebPage successfully entered or left audio routing arbitration. Notify the Arbitration proxy when the page is shut down, which ensures arbitration will end if the client closes the WKWebView. * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _audioRoutingArbitrationStatus]): * UIProcess/API/mac/WKWebViewTestingMac.mm: * UIProcess/Media/AudioSessionRoutingArbitratorProxy.h: (WebKit::AudioSessionRoutingArbitratorProxy::arbitrationStatus const): * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm: (WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate): (WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory): (WebKit::AudioSessionRoutingArbitratorProxy::endRoutingArbitration): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shutDown): * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::audioSessionRoutingArbitrator): 2020-06-21 Michael Catanzaro [WPE][GTK] Specify underlying storage type for InputMethodState::Hint https://bugs.webkit.org/show_bug.cgi?id=213401 Reviewed by Carlos Garcia Campos. Using unsigned types for flags enums seems nice to do. * Shared/glib/InputMethodState.h: 2020-06-21 Michael Catanzaro [WPE][GTK] Add autocleanup for WebKitWebsitePolicies https://bugs.webkit.org/show_bug.cgi?id=213399 Reviewed by Carlos Garcia Campos. Add missing autocleanups. * UIProcess/API/gtk/WebKitAutocleanups.h: * UIProcess/API/wpe/WebKitAutocleanups.h: 2020-06-20 Jiewen Tan [AppSSO] Should do null check on m_page in dismissViewController() https://bugs.webkit.org/show_bug.cgi?id=213415 Reviewed by Alexey Proskuryakov. * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm: (WebKit::SOAuthorizationSession::dismissViewController): 2020-06-20 Jer Noble RecoveryOS: PAL::getAVPlayerLayerClass() will crash when AVFoundation is missing https://bugs.webkit.org/show_bug.cgi?id=213437 Reviewed by Eric Carlson. Check PAL::isAVFoundationAvailable() before calling PAL::getAVPlayerLayerClass(); * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm: (WebKit::PlatformCALayerRemoteCustom::clone const): 2020-06-20 Jer Noble REGRESSION(r259219): Sleep assertion remains active if WKWebView is closed or WebContent process crashes https://bugs.webkit.org/show_bug.cgi?id=213434 Reviewed by Eric Carlson. Tests: TestWebKitAPI tests: SleepDisabler.Basic SleepDisabler.Pause SleepDisabler.Mute SleepDisabler.Unmute SleepDisabler.DisableAudioTrack SleepDisabler.Loop SleepDisabler.ChangeSrc SleepDisabler.Load SleepDisabler.Unload SleepDisabler.Navigate SleepDisabler.NavigateBack SleepDisabler.Reload SleepDisabler.Close SleepDisabler.Crash Ensure the SleepDisablers are cleared when the WebProcess closes or crashes. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shutDown): (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): 2020-06-20 Brent Fulgham [iOS, macOS] Allow access to the container manager to support Mail InjectedBundle https://bugs.webkit.org/show_bug.cgi?id=213357 Reviewed by Darin Adler. The Mail Injected Bundle requires access to the container manager to support certain OS operations. We do not need this access for web browsing, and should limit this access to this one case. This patch creates a dynamic mach extension to the container manager for this single use case. It also denies the non-extension access case with a backtrace so we can see if any other clients are hitting this. * 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: 2020-06-19 Chris Dumez [Cocoa] Delay issuing ManagedSession & Network Extension sandbox extensions until a load is actually issued https://bugs.webkit.org/show_bug.cgi?id=213414 Reviewed by Per Arne Vollan. Delay issuing ManagedSession & Network Extension sandbox extensions until a load is actually issued. This is a Safari launch time optimization since the checks needed to decide whether or not to issue the extensions are expensive and there is no reason to issue them as soon as the process launches (especially in the case of a prewarmed process). * Shared/Cocoa/LoadParametersCocoa.mm: (WebKit::LoadParameters::platformEncode const): (WebKit::LoadParameters::platformDecode): * Shared/LoadParameters.h: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::addPlatformLoadParameters): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::addPlatformLoadParameters): (WebKit::WebPageProxy::loadRequestWithNavigationShared): (WebKit::WebPageProxy::loadFile): (WebKit::WebPageProxy::loadDataWithNavigationShared): (WebKit::WebPageProxy::loadAlternateHTML): (WebKit::WebPageProxy::loadWebArchiveData): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::hasNetworkExtensionSandboxAccess const): (WebKit::WebProcessProxy::markHasNetworkExtensionSandboxAccess): (WebKit::WebProcessProxy::hasManagedSessionSandboxAccess const): (WebKit::WebProcessProxy::markHasManagedSessionSandboxAccess): * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-06-19 Ryan Haddad Unreviewed, reverting r263287. Caused tests to exit early with crashes on Catalina. Reverted changeset: "[iOS, macOS] Allow access to the container manager to support Mail InjectedBundle" https://bugs.webkit.org/show_bug.cgi?id=213357 https://trac.webkit.org/changeset/263287 2020-06-19 Chris Dumez Crash under WebKit::ProcessAndUIAssertion::updateRunInBackgroundCount() https://bugs.webkit.org/show_bug.cgi?id=213417 Reviewed by Darin Adler. Make sure |this| is still alive in ProcessAndUIAssertion::processAssertionWasInvalidated() after calling ProcessAssertion::processAssertionWasInvalidated() and before calling updateRunInBackgroundCount(). Calling ProcessAssertion::processAssertionWasInvalidated() notifies the client and the client may destroy the assertion as a result. * UIProcess/ios/ProcessAssertionIOS.mm: (WebKit::ProcessAndUIAssertion::processAssertionWasInvalidated): 2020-06-19 Kate Cheney com.apple.WebKit.Networking crash: suspended with locked system files (observations.db) https://bugs.webkit.org/show_bug.cgi?id=213391 Reviewed by Chris Dumez. ITP is the only database that attempts to close when NetworkProcess::didClose() is called. This causes the network process to sometimes crash if the database is still closing when checking for locked system files. Instead, we should only flush the memory store to disk when calling NetworkProcess::didClose (in the memory store case), and only close the database when the network session is destroyed. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::didDestroyNetworkSession): (WebKit::WebResourceLoadStatisticsStore::destroyResourceLoadStatisticsStore): (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: Split into two functions, one to flush and destroy the persistent store, and one to destroy the memory or database store. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didClose): Only flush the persistent store here, as described above. * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::flushAndDestroyPersistentStore): * NetworkProcess/NetworkSession.h: 2020-06-19 Jiewen Tan [WebAuthn] Provide a _WKWebAuthenticationPanelUpdatePINInvalid update to UI clients if the returned PIN from the client is not valid https://bugs.webkit.org/show_bug.cgi?id=213404 Reviewed by Brent Fulgham. Provide a _WKWebAuthenticationPanelUpdatePINInvalid update to UI clients if the returned PIN from the client is not valid such that clients can reuse the same logic to handle invalid pin from the authenticator. This change makes their life easier. Covered by API tests. * UIProcess/API/APIWebAuthenticationPanelClient.h: (API::WebAuthenticationPanelClient::requestPin const): * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm: (WebKit::WebAuthenticationPanelClient::requestPin const): Now, only null strings are intepreted as cancels. * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp: (WebKit::CtapAuthenticator::continueMakeCredentialAfterResponseReceived): (WebKit::CtapAuthenticator::continueGetAssertionAfterResponseReceived): (WebKit::CtapAuthenticator::continueGetPinTokenAfterRequestPin): (WebKit::CtapAuthenticator::continueRequestAfterGetPinToken): This patch also removes potential null pointer dereferences. 2020-06-19 Per Arne Vollan [macOS] Connections to the preference daemon are established before entering the sandbox https://bugs.webkit.org/show_bug.cgi?id=213379 Reviewed by Darin Adler. On macOS, connections to the preference daemon are established before entering the sandbox. These connections also persist after entering the sandbox and denying access to the preference daemon. There should not be attempts to connect to the preference daemon before entering the sandbox, since these attempts will not be stopped by the sandbox. This patch moves code that connects to the preference daemon to be executed after the sandbox has been entered. That includes code to prevent connections to the Dock and code to initialize WebKit logging. Also, instead of calling [NSBundle bundleForClass:], call [NSBundle bundleWithIdentifier:], since calling [NSBundle bundleForClass:] will connect to the preference daemon. Finally, allow the syscall SYS_gethostuuid, since that is needed by CoreFoundation when there is no access to the preference daemon. No new tests. This should be covered by existing tests. It would be nice to have a test to make sure that there are no connections to the preference daemon just before entering the sandbox, but I am not aware of how to implement this. * NetworkProcess/mac/NetworkProcessMac.mm: (WebKit::NetworkProcess::initializeSandbox): * Shared/AuxiliaryProcess.cpp: (WebKit::AuxiliaryProcess::initialize): * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::runInitializationCode): * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::webKit2Bundle): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::WebProcess::initializeSandbox): * WebProcess/com.apple.WebProcess.sb.in: 2020-06-19 Chris Dumez Avoid initializing RenderTheme singleton unnecessarily in the UIProcess https://bugs.webkit.org/show_bug.cgi?id=213406 Reviewed by Per Arne Vollan. Avoid initializing RenderTheme singleton unnecessarily in the UIProcess. Instead, introduce a static function to get the focus ring color on iOS. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): 2020-06-19 Chris Dumez Unreviewed build fix after r263288. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): 2020-06-19 Chris Dumez Use ASCIILiteral more for SandboxExtension functions https://bugs.webkit.org/show_bug.cgi?id=213400 Reviewed by Per Arne Vollan. Use ASCIILiteral more for SandboxExtension functions. Functions like createHandleForMachLookup() / createHandleForIOKitClassExtension() don't need to take in Strings, ASCIILiteral is enough. * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::createHandlesForResources): (WebKit::SandboxExtension::createReadOnlyHandlesForFiles): (WebKit::SandboxExtension::createHandleForGenericExtension): (WebKit::SandboxExtension::createHandleForMachLookup): (WebKit::SandboxExtension::createHandlesForMachLookup): (WebKit::SandboxExtension::createHandleForIOKitClassExtension): (WebKit::SandboxExtension::createHandlesForIOKitClassExtensions): * Shared/SandboxExtension.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::mediaRelatedMachServices): (WebKit::nonBrowserServices): (WebKit::diagnosticServices): (WebKit::agxCompilerClasses): (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::enableRemoteInspectorIfNeeded): * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::singleton): * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon): (WebKit::WebPageProxy::creationParameters): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::grantAccessToAssetServices): 2020-06-19 Brent Fulgham [iOS, macOS] Allow access to the container manager to support Mail InjectedBundle https://bugs.webkit.org/show_bug.cgi?id=213357 Reviewed by Darin Adler. The Mail Injected Bundle requires access to the container manager to support certain OS operations. We do not need this access for web browsing, and should limit this access to this one case. This patch creates a dynamic mach extension to the container manager for this single use case. It also denies the non-extension access case with a backtrace so we can see if any other clients are hitting this. * 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: 2020-06-19 Andres Gonzalez AX: web process crash in AXObjectCache::postNotification. https://bugs.webkit.org/show_bug.cgi?id=213398 Reviewed by Chris Fleizach. AXObjectCache was being instantiated on the AX secondary thread. Therefore the timers for the different delayed notifications where initialized with the secondary thread. When postNotification was triggered on the main thread as it should, and the timer was accessed, the timer would assert/crash for being accessed in a thread different than where it was created. This change guaranties that AXObjectCache is always created on the main thread. * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm: (-[WKAccessibilityWebPageObjectBase axObjectCache]): (-[WKAccessibilityWebPageObjectBase accessibilityPluginObject]): (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]): (-[WKAccessibilityWebPageObjectBase setWebPage:]): (-[WKAccessibilityWebPageObjectBase setHasMainFramePlugin:]): (-[WKAccessibilityWebPageObjectBase setRemoteParent:]): 2020-06-19 Chris Fleizach AX: Make isolated tree enablement status dependent on client preference https://bugs.webkit.org/show_bug.cgi?id=213355 Reviewed by Zalan Bujtas. We don't want the isolated tree mode in all clients (like Mail or Dictionary). As a result, we can set this setting to off and allow safari and mini browser turn on more directly. * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _setAccessibilityIsolatedTreeEnabled:]): (-[WKPreferences _accessibilityIsolatedTreeEnabled]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): (WebKit::InjectedBundle::setAccessibilityIsolatedTreeEnabled): * WebProcess/InjectedBundle/InjectedBundle.h: 2020-06-19 Rob Buis Enable referrer policy attribute support by default https://bugs.webkit.org/show_bug.cgi?id=213285 Reviewed by Youenn Fablet. Enable referrer policy attribute support by default by flipping the switch. * Shared/WebPreferences.yaml: 2020-06-19 Youenn Fablet LibWebRTCSocketClient::sendTo is too verbose in case of error https://bugs.webkit.org/show_bug.cgi?id=213380 Reviewed by Eric Carlson. Only log error message if the error code is different from the previous one. * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::sendTo): * NetworkProcess/webrtc/LibWebRTCSocketClient.h: 2020-06-19 Chris Dumez Web Inspector: RemoteInspector::singleton() slows down MobileSafari launch https://bugs.webkit.org/show_bug.cgi?id=213381 Reviewed by Darin Adler. RemoteInspector::singleton() is expensive according to traces. It was called in WebProcessPool::initializeNewWebProcess() which happens on MobileSafari launch because we prewarm a WebProcess. However, there is no reason to initialize remote Web Inspector at this point. Per associated comment, Remote Web Inspector needs to be initialized once there is a sub process hosting one of our Web View. As a result, I moved the initialization call to WebPageProxy::initializeWebPage() which is when we actually send the IPC to the WebProcess to create the WebPage that is backing the UI-side WebView. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::initializeWebPage): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): 2020-06-19 Chris Dumez Move Prefixed WebAudio interfaces behind their own feature flag https://bugs.webkit.org/show_bug.cgi?id=213356 Reviewed by Darin Adler. * Shared/WebPreferences.yaml: 2020-06-19 Rob Buis Enable stale-while-revalidate support by default https://bugs.webkit.org/show_bug.cgi?id=213286 Reviewed by Youenn Fablet. Enable stale-while-revalidate support for Mac/GTK/WPE by changing the default to true. Note that platforms that do not support speculative loads, which s-w-r relies on, will not see any change in bahavior. * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: 2020-06-19 Alexander Mikhaylenko REGRESSION(r253360): [GTK] Page starts loading during animation in back/forward gesture https://bugs.webkit.org/show_bug.cgi?id=205650 Reviewed by Carlos Garcia Campos. r253360 changed the swipe gesture to start loading the page during the gesture, relying on freezing the layer tree state to prevent unwanted redraws. However, it was implemented for AC mode, but didn't prevent redraws in non-accelerated mode. Add a simple check to skip redraws in this case. * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::display): Skip drawing if layer tree state is frozen. 2020-06-19 Carlos Garcia Campos Add support for fetching registrable domains with resource load statistics https://bugs.webkit.org/show_bug.cgi?id=213291 Reviewed by Adrian Perez de Castro and Youenn Fablet. WebsiteDataStore::fetchData() doesn't return anything for resource load statistics because NetworkProcess::fetchWebsiteData() doesn't handle WebsiteDataType::ResourceLoadStatistics. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::allDomains const): Query all registrable domains from database. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::allDomains const): Return all registrable domains in memory map. * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::registrableDomains): Get the list of registrable domains. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::fetchWebsiteData): Handle WebsiteDataType::ResourceLoadStatistics. * Shared/WebsiteData/WebsiteData.cpp: (WebKit::WebsiteData::encode const): Encode registrableDomainsWithResourceLoadStatistics. (WebKit::WebsiteData::decode): Decode registrableDomainsWithResourceLoadStatistics. * Shared/WebsiteData/WebsiteData.h: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreRemoveITPDataForDomain): Use WebsiteDataRecord::addResourceLoadStatisticsRegistrableDomain() instead of the display name. * UIProcess/WebsiteData/WebsiteDataRecord.cpp: (WebKit::WebsiteDataRecord::addResourceLoadStatisticsRegistrableDomain): Add the given registrable domain to the list. * UIProcess/WebsiteData/WebsiteDataRecord.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::fetchDataAndApply): Handle registrable domains with resource load statistics. (WebKit::WebsiteDataStore::removeData): Use resourceLoadStatisticsRegistrableDomains instead of the display name. 2020-06-18 David Kilzer Use fastMalloc/fastFree in WebCoreArgumentCodersMac.mm Reviewed by Darin Adler. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::createArchiveList): (IPC::createCFURLRequestFromSerializableRepresentation): 2020-06-18 Tim Horton Remove some vestiges of the 32-bit Plugin Process https://bugs.webkit.org/show_bug.cgi?id=213361 Reviewed by Dan Bernstein. We haven't launched 32-bit plugins for a while, but there are some build system complications and random references in the code that we can get rid of. * WebKit.xcodeproj/project.pbxproj: * Configurations/PluginService.xcconfig: Renamed from Source/WebKit/Configurations/PluginService.64.xcconfig. No need for .64 in the name anymore, since it's the only one. We do have to leave the .64 in the product name because there are other things in the system that depend on this. * PluginProcess/EntryPoint/Cocoa/XPCService/PluginService.Info.plist: Renamed from Source/WebKit/PluginProcess/EntryPoint/Cocoa/XPCService/PluginService.64.Info.plist. No need for .64 in the name anymore. * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::getLaunchOptions): * UIProcess/Launcher/ProcessLauncher.h: * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::serviceName): * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes): There need only be one ProcessType for the plugin process now! * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp: (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes): * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::bubblewrapSpawn): * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp: (WebKit::ProcessLauncher::launchProcess): GTK WebKit appears to also only launch 64-bit plugin processes. 2020-06-18 Megan Gardner Workaround for UIKit layout bug in time picker. https://bugs.webkit.org/show_bug.cgi?id=213346 Reviewed by Tim Horton. There is a bug in the layout of UIKit that needs to be fixed. Until then, this workaround should give us a view that is viable. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView resignFirstResponderForWebView]): * UIProcess/ios/forms/WKDateTimeInputControl.mm: (-[WKDateTimeContextMenuViewController preferredContentSize]): 2020-06-18 David Kilzer [IPC hardening] OptionSet<> values should be validated Reviewed by Anders Carlsson. Summary: - Add WTF::EnumTraits<> for all OptionSet<> enums. - Specify unsigned backing types for enum classes. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkSession.h: * Platform/IPC/ArgumentCoders.h: (IPC::ArgumentCoder>::encode): (IPC::ArgumentCoder>::decode): - Add WTF::isValidOptionSet() checks. * Platform/IPC/Decoder.h: * Platform/IPC/Encoder.h: - Replace with since the latter now includes the former. * Platform/IPC/MessageFlags.h: * Shared/DocumentEditingContext.h: * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h: * Shared/WebEvent.h: * Shared/WebsiteAutoplayQuirk.h: * Shared/WebsiteData/WebsiteData.h: * Shared/WebsiteData/WebsiteDataFetchOption.h: * Shared/WebsiteData/WebsiteDataType.h: * Shared/ios/GestureTypes.h: * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Plugins/PluginProcessManager.h: * UIProcess/WebProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.h: * WebProcess/WebProcess.h: 2020-06-18 Carlos Garcia Campos [GTK][WPE] Add API to configure and handle service worker registrations to WebKitWebsiteDataManager https://bugs.webkit.org/show_bug.cgi?id=213290 Reviewed by Michael Catanzaro. The default path is always used even for apps setting a base data directory. We should handle WebsiteDataType::ServiceWorkerRegistrations to configure the directory and allow to fetch and clear them. * UIProcess/API/glib/WebKitWebsiteData.cpp: (recordContainsSupportedDataTypes): (toWebKitWebsiteDataTypes): * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkitWebsiteDataManagerGetProperty): (webkitWebsiteDataManagerSetProperty): (webkitWebsiteDataManagerConstructed): (webkit_website_data_manager_class_init): (webkitWebsiteDataManagerGetDataStore): (webkit_website_data_manager_get_service_worker_registrations_directory): (toWebsiteDataTypes): * UIProcess/API/gtk/WebKitWebsiteData.h: * UIProcess/API/gtk/WebKitWebsiteDataManager.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitWebsiteData.h: * UIProcess/API/wpe/WebKitWebsiteDataManager.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: 2020-06-18 Yuri Chornoivan Unreviewed. Fix a typo introduced in r263085 * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkit_website_data_manager_class_init): 2020-06-17 Chris Dumez Add experimental feature flag for modern & unprefixed WebAudio API https://bugs.webkit.org/show_bug.cgi?id=213268 Reviewed by Jer Noble. Add experimental feature flag for modern & unprefixed WebAudio API, off by default. * Shared/WebPreferences.yaml: 2020-06-17 Wenson Hsieh [macOS] Shift-tab in a bullet list in Mail Compose jumps back to Subject field https://bugs.webkit.org/show_bug.cgi?id=213320 Reviewed by Tim Horton. See WebCore/ChangeLog for more detail. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::handleKeyEventByRelinquishingFocusToChrome): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleEditingKeyboardEvent): Hoist logic for relinquishing focus as a result of shift+tab from EventHandler to WebPage, so that it is the default behavior when processing a "keypress" event that corresponds to shift+tab in an editable web view on Cocoa platforms. If we do end up relinquishing focus, then we consider the keypress event to be handled. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::handleEditingKeyboardEvent): 2020-06-17 Beth Dakin Remove references to blacklist/whitelist in the old C API https://bugs.webkit.org/show_bug.cgi?id=213322 Reviewed by Tim Horton. * UIProcess/API/C/WKPageGroup.cpp: (WKPageGroupAddUserStyleSheet): (WKPageGroupAddUserScript): * UIProcess/API/C/WKPageGroup.h: * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: 2020-06-17 Alex Christensen Null check plugin.m_data before using it in PDFPlugin::ByteRangeRequest::completeUnconditionally https://bugs.webkit.org/show_bug.cgi?id=213305 Reviewed by Brady Eidson. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::ByteRangeRequest::completeUnconditionally): 2020-06-17 Darryl Pogue IndexedDB: Support IDBFactory databases method https://bugs.webkit.org/show_bug.cgi?id=211043 Reviewed by Youenn Fablet. Plumbing for returning a list of IDB databases and versions. * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNamesAndVersions): (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNames): Deleted. * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::getAllDatabaseNamesAndVersions): (WebKit::WebIDBServer::getAllDatabaseNames): Deleted. * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/IndexedDB/WebIDBServer.messages.in: * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp: (WebKit::WebIDBConnectionToServer::getAllDatabaseNamesAndVersions): (WebKit::WebIDBConnectionToServer::didGetAllDatabaseNamesAndVersions): (WebKit::WebIDBConnectionToServer::getAllDatabaseNames): Deleted. (WebKit::WebIDBConnectionToServer::didGetAllDatabaseNames): Deleted. * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h: * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in: 2020-06-16 Simon Fraser REGRESSION (r255037): Broken position while comparing watch bands on www.apple.com/shop/studio/apple-watch https://bugs.webkit.org/show_bug.cgi?id=213282 Reviewed by Antti Koivisto. If a scrolling tree commit has a requested scroll position update for a node, we need to call applyLayerPositons() to set the UIScrollView's contentOffset. Often the layer tree commit will contain a boundsOrigin change for the layer in question (which is equivalent to setting the UIScrollView's contentOffset), but some combinations of user and programmatic scrolling result in no boundsOrigin change, revealing the bug. * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren): 2020-06-16 Kate Cheney Check for inAppBrowserPrivacyEnabled flag in WebsiteDataStore::initializeAppBoundDomains is expensive and calls a non-static function WebsiteDataStore::parameters(). https://bugs.webkit.org/show_bug.cgi?id=213261 Reviewed by Brent Fulgham. There are two bugs here. First, WebsiteDataStore::parameters() does a lot of work aside from returning the parameters, making this an expensive call just to check the value of one flag. Second, appBoundDomains() is a static hashset, and initializing the hashset should not rely on non-static functions. * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Remove flag, it is no longer used here. * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::platformSetNetworkParameters): Save the flag value in a member variable so we can use that later when checking app-bound domains. Rename to something more descriptive. (WebKit::WebsiteDataStore::initializeAppBoundDomains): Remove the check for the non-static runtime flag. (WebKit::WebsiteDataStore::ensureAppBoundDomains const): Enable test mode quirks. We must do it in two places in case the initialization hasn't happened by the time we call ensureAppBoundDomains. * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-06-16 Mark Lam Make Options::useJIT() be the canonical source of truth on whether we should use the JIT. https://bugs.webkit.org/show_bug.cgi?id=212556 Reviewed by Saam Barati. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::isJITEnabled): 2020-06-16 David Kilzer REGRESSION (r262994): Web Inspector is killed when context-clicking anywhere Reviewed by Darin Adler. * Platform/IPC/Decoder.h: * Platform/IPC/Encoder.h: - Include since the definition of the custom WTF::isValidEnum function is needed. * Scripts/webkit/messages.py: (generate_message_names_header): - Change the third typename in the template for WTF::isValidEnum() to avoid partial template specialization errors from other implementations like WTF::isValidEnum(). - Also replace hard-coded "IPC::MessageName" names with template values. 2020-06-16 Chris Dumez Stop calling userPreferredLanguages() in the UIProcess https://bugs.webkit.org/show_bug.cgi?id=213214 Reviewed by Darin Adler. Follow-up to r263094 to address post-landing feedback from Darin. Use makeVector() functionality in WTF to convert the NSArray into a Vector instead of doing it by hand. Also mark the NeverDestroyed variable as static const to avoid leaking. * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::platformOverrideLanguages const): 2020-06-16 Alex Christensen Provide alternatively-named WKBrowsingContextGroup SPI https://bugs.webkit.org/show_bug.cgi?id=213229 Reviewed by Tim Horton. This is unfortunately still used. In order to try to convince the user to make the smallest change possible, make newly named SPI that behaves identically. Doubly-deprecate the old SPI and implement it in terms of the new during the transition period. * UIProcess/API/Cocoa/WKBrowsingContextGroup.h: * UIProcess/API/Cocoa/WKBrowsingContextGroup.mm: (-[WKBrowsingContextGroup addUserStyleSheet:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:mainFrameOnly:]): (-[WKBrowsingContextGroup addUserStyleSheet:baseURL:includeMatchPatternStrings:excludeMatchPatternStrings:mainFrameOnly:]): (-[WKBrowsingContextGroup addUserScript:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:injectionTime:mainFrameOnly:]): (-[WKBrowsingContextGroup addUserScript:baseURL:includeMatchPatternStrings:excludeMatchPatternStrings:injectionTime:mainFrameOnly:]): 2020-06-16 Youenn Fablet Loads triggered by an opaque stylesheet should not be visible to service workers https://bugs.webkit.org/show_bug.cgi?id=213246 Reviewed by Alex Christensen. * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): In case the load is triggered from an opaque response, set service worker mode to none. 2020-06-16 Charlie Turner [GTK] Disable video autoplay https://bugs.webkit.org/show_bug.cgi?id=184845 Reviewed by Carlos Garcia Campos. * PlatformGTK.cmake: Add new source files to the build. * PlatformWPE.cmake: Ditto. * SourcesGTK.txt: Ditto. * SourcesWPE.txt: Ditto. * UIProcess/API/glib/WebKitPolicyDecision.cpp: (webkit_policy_decision_use_with_policies): : Add an API to respond to navigation decisions with policies. * UIProcess/API/glib/WebKitWebContext.cpp: (webkitWebContextCreatePageForWebView): Plumb in the default website policies that are associated with the web view. * UIProcess/API/glib/WebKitWebContextPrivate.h: * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewConstructed): (webkitWebViewSetProperty): (webkitWebViewGetProperty): (webkit_web_view_class_init): (webkit_web_view_get_website_policies): * UIProcess/API/glib/WebKitWebsitePolicies.cpp: Added. (_WebKitWebsitePoliciesPrivate::_WebKitWebsitePoliciesPrivate): (webkitWebsitePoliciesGetWebsitePolicies): (webkitWebsitePoliciesGetPoliciesData): (webkitWebsitePoliciesGetProperty): (webkitWebsitePoliciesSetAutoplayPolicy): (webkitWebsitePoliciesSetProperty): (webkit_website_policies_class_init): (webkit_website_policies_new): (webkit_website_policies_new_with_policies): (webkit_website_policies_get_autoplay_policy): * UIProcess/API/glib/WebKitWebsitePoliciesPrivate.h: Added. * UIProcess/API/gtk/WebKitPolicyDecision.h: * UIProcess/API/gtk/WebKitWebView.h: * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (webkit_web_view_new_with_related_view): * UIProcess/API/gtk/WebKitWebsitePolicies.h: Added. * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitPolicyDecision.h: * UIProcess/API/wpe/WebKitWebView.h: * UIProcess/API/wpe/WebKitWebsitePolicies.h: Added. * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: 2020-06-16 Chris Dumez Stop calling userPreferredLanguages() in the UIProcess https://bugs.webkit.org/show_bug.cgi?id=213214 Reviewed by Per Arne Vollan. Stop calling userPreferredLanguages() in the UIProcess since this can be slow and may keep the main thread busy. Nowadays, the WebProcess is able to call it by itself anyway. The sandbox is allowing it. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::languageChanged): (WebKit::WebProcessPool::initializeNewWebProcess): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): (WebKit::WebProcess::userPreferredLanguagesChanged const): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2020-06-16 Truitt Savell Unreviewed, reverting r263079. Broke Internal builds. Reverted changeset: "IndexedDB: Support IDBFactory databases method" https://bugs.webkit.org/show_bug.cgi?id=211043 https://trac.webkit.org/changeset/263079 2020-06-16 Carlos Garcia Campos [GTK][WPE] Add API to configure and enable resource load statistics https://bugs.webkit.org/show_bug.cgi?id=177943 Reviewed by Michael Catanzaro. * UIProcess/API/glib/WebKitWebsiteData.cpp: (recordContainsSupportedDataTypes): (toWebKitWebsiteDataTypes): * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkitWebsiteDataManagerGetProperty): (webkitWebsiteDataManagerSetProperty): (webkitWebsiteDataManagerConstructed): (webkit_website_data_manager_class_init): (webkitWebsiteDataManagerGetDataStore): (webkit_website_data_manager_get_itp_directory): (webkit_website_data_manager_set_itp_enabled): (webkit_website_data_manager_get_itp_enabled): (toWebsiteDataTypes): * UIProcess/API/gtk/WebKitWebsiteData.h: * UIProcess/API/gtk/WebKitWebsiteDataManager.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitWebsiteData.h: * UIProcess/API/wpe/WebKitWebsiteDataManager.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: * UIProcess/glib/WebsiteDataStoreGLib.cpp: (WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): 2020-06-16 Darryl Pogue IndexedDB: Support IDBFactory databases method https://bugs.webkit.org/show_bug.cgi?id=211043 Reviewed by Youenn Fablet. Plumbing for returning a list of IDB databases and versions. * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNamesAndVersions): (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNames): Deleted. * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::getAllDatabaseNamesAndVersions): (WebKit::WebIDBServer::getAllDatabaseNames): Deleted. * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/IndexedDB/WebIDBServer.messages.in: * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp: (WebKit::WebIDBConnectionToServer::getAllDatabaseNamesAndVersions): (WebKit::WebIDBConnectionToServer::didGetAllDatabaseNamesAndVersions): (WebKit::WebIDBConnectionToServer::getAllDatabaseNames): Deleted. (WebKit::WebIDBConnectionToServer::didGetAllDatabaseNames): Deleted. * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h: * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in: 2020-06-15 Pavel Feldman Web Inspector: introduce request interception https://bugs.webkit.org/show_bug.cgi?id=207446 Reviewed by Devin Rousso. This change introduces network request interception to the Network protocol domain. It adds Network.interceptWithRequest notification that can be continued, modified or fulfilled. NetworkStage enum can now have 'request' and 'response' values. * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoad): 2020-06-15 Brent Fulgham [macOS] Update sandboxes to reduce logging for media-related operations https://bugs.webkit.org/show_bug.cgi?id=213210 Reviewed by Per Arne Vollan. Ongoing testing has uncovered a set of additional services and IOKit properties that we should allow without logging. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::mediaRelatedMachServices): * WebProcess/com.apple.WebProcess.sb.in: 2020-06-15 Alex Christensen Provide alternatively-named SPI for user style sheets and scripts https://bugs.webkit.org/show_bug.cgi?id=213206 Reviewed by Brady Eidson. Test-only SPI was just renamed. SPI used by other projects was deprecated with a replacement so we can remove the old names soon. _WKUserContentWorld/WKContentWorld was tied up in this, and rather than provide replacement SPI with deprecated _WKUserContentWorld, this will move some SPI from _WKUserContentWorld to WKContentWorld too. The most heavy user of _WKUserContentWorld is TestWebKitAPI and we'll remove it soon. * UIProcess/API/C/WKContext.cpp: (WKContextSetFontAllowList): (WKContextSetFontWhitelist): Deleted. * UIProcess/API/C/WKContextPrivate.h: * UIProcess/API/Cocoa/WKUserContentController.mm: (-[WKUserContentController _removeAllUserScriptsAssociatedWithContentWorld:]): (-[WKUserContentController _removeAllUserStyleSheetsAssociatedWithContentWorld:]): (-[WKUserContentController _addScriptMessageHandler:name:contentWorld:]): (-[WKUserContentController _removeAllUserScriptsAssociatedWithUserContentWorld:]): Deleted. (-[WKUserContentController _removeAllUserStyleSheetsAssociatedWithUserContentWorld:]): Deleted. * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h: * UIProcess/API/Cocoa/WKUserScript.mm: (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:includeMatchPatternStrings:excludeMatchPatternStrings:associatedURL:contentWorld:deferRunningUntilNotification:]): * UIProcess/API/Cocoa/WKUserScriptPrivate.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:includeMatchPatternStrings:excludeMatchPatternStrings:baseURL:level:contentWorld:]): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::setFontAllowList): (WebKit::WebProcessPool::setFontWhitelist): Deleted. * UIProcess/WebProcessPool.h: 2020-06-15 Alex Christensen Add SPI to preconnect to a server https://bugs.webkit.org/show_bug.cgi?id=213109 Reviewed by Geoff Garen. Covered by API tests. * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _preconnectToServer:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::preconnectTo): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::preconnectTo): * UIProcess/WebPageProxy.h: 2020-06-15 Keith Miller Signal handlers should have a two phase installation. https://bugs.webkit.org/show_bug.cgi?id=213160 Reviewed by Mark Lam. Put back old WASM fast memory installation. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): 2020-06-15 Víctor Manuel Jáquez Leal Suppress compiler warnings https://bugs.webkit.org/show_bug.cgi?id=213034 Reviewed by Darin Adler. Convert to std:size_t to compare equal data types. * NetworkProcess/cache/NetworkCacheData.cpp: (WebKit::NetworkCache::readOrMakeSalt): 2020-06-15 Chris Dumez Revert r260856 as it seems to have regressed PLT on iOS https://bugs.webkit.org/show_bug.cgi?id=213194 Unreviewed, revert r260856 due to regression. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::NetworkProcess): (WebKit::NetworkProcess::prepareToSuspend): (WebKit::NetworkProcess::resume): * NetworkProcess/NetworkProcess.h: * Shared/WebSQLiteDatabaseTracker.cpp: Added. (WebKit::WebSQLiteDatabaseTracker::WebSQLiteDatabaseTracker): (WebKit::WebSQLiteDatabaseTracker::~WebSQLiteDatabaseTracker): (WebKit::WebSQLiteDatabaseTracker::setIsSuspended): (WebKit::WebSQLiteDatabaseTracker::willBeginFirstTransaction): (WebKit::WebSQLiteDatabaseTracker::didFinishLastTransaction): (WebKit::WebSQLiteDatabaseTracker::setIsHoldingLockedFiles): * Shared/WebSQLiteDatabaseTracker.h: Added. * SourcesCocoa.txt: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didClose): (WebKit::NetworkProcessProxy::setIsHoldingLockedFiles): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shutDown): (WebKit::WebProcessProxy::setIsHoldingLockedFiles): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebProcess.cpp: (WebKit::m_webSQLiteDatabaseTracker): (WebKit::WebProcess::prepareToSuspend): (WebKit::WebProcess::processDidResume): * WebProcess/WebProcess.h: 2020-06-15 Carlos Garcia Campos [GTK][WPE] Add API to expose UIClient::requestStorageAccessConfirm https://bugs.webkit.org/show_bug.cgi?id=210422 Reviewed by Michael Catanzaro. Add WebKitWebsiteDataAccessPermissionRequest to ask for permission to the user using the existing permission request API. * PlatformGTK.cmake: * PlatformWPE.cmake: * SourcesGTK.txt: * SourcesWPE.txt: * UIProcess/API/glib/WebKitUIClient.cpp: * UIProcess/API/glib/WebKitWebsiteDataAccessPermissionRequest.cpp: Added. (webkitWebsiteDataAccessPermissionRequestAllow): (webkitWebsiteDataAccessPermissionRequestDeny): (webkit_permission_request_interface_init): (webkitWebsiteDataAccessPermissionRequestDispose): (webkit_website_data_access_permission_request_class_init): (webkitWebsiteDataAccessPermissionRequestCreate): (webkit_website_data_access_permission_request_get_requesting_domain): (webkit_website_data_access_permission_request_get_current_domain): * UIProcess/API/glib/WebKitWebsiteDataAccessPermissionRequestPrivate.h: Added. * UIProcess/API/gtk/WebKitWebsiteDataAccessPermissionRequest.h: Added. * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: * UIProcess/API/gtk/webkit2.h: * UIProcess/API/wpe/WebKitWebsiteDataAccessPermissionRequest.h: Added. * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: * UIProcess/API/wpe/docs/wpe-docs.sgml: * UIProcess/API/wpe/webkit.h: 2020-06-14 Sam Weinig [WPT] html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-pluginarray.html fails due to lack of caching of Plugin objects https://bugs.webkit.org/show_bug.cgi?id=213185 Reviewed by Darin Adler. * UIProcess/Plugins/PluginInfoStore.h: Add missing #include that is now needed due to pruning of unnecessary #includes in WebCore. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::pluginSupportsExtension): Update to use new webVisibleMimeTypes() rather than the clunky getWebVisibleMimesAndPluginIndices(). 2020-06-14 David Kilzer [IPC hardening] Return type of -[NSCoder validateClassSupportsSecureCoding:] is incorrect Reviewed by Darin Adler. * Shared/API/Cocoa/WKRemoteObjectCoder.mm: (validateClass): - Fix return type of -[NSCoder validateClassSupportsSecureCoding:]. Throw an NSException in case the method ever returns NO without throwing its own NSException. (Currently this method does throw an NSException instead of returning NO.) 2020-06-14 Carlos Garcia Campos [SOUP] Disable HSTS for requests when cookies will be blocked by ITP https://bugs.webkit.org/show_bug.cgi?id=210739 Reviewed by Michael Catanzaro. * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::shouldAllowHSTSProtocolUpgrade const): 2020-06-13 Richard Houle Fix Overrelease in makeFailureSetForAllTextManipulationItems https://bugs.webkit.org/show_bug.cgi?id=213165 Reviewed by Wenson Hsieh. * UIProcess/API/Cocoa/WKWebView.mm: (makeFailureSetForAllTextManipulationItems): 2020-06-13 Wenson Hsieh [Mac Catalyst] Color inputs and selects fail to display popovers when clicked https://bugs.webkit.org/show_bug.cgi?id=213157 Reviewed by Tim Horton. In Mac Catalyst, presenting popovers using `UIPopoverController` causes the first responder to change. This means that the WKContentView will resign first responder, which in turn causes the currently presented popover to be dismissed. This means that popovers for color inputs and select elements will be dismissed immediately after presentation. To mitigate this, adapt the approach taken in r259840 to `WKColorPopover` and `WKSelectPopover` by teaching the base class (`WKRotatingPopover`) to temporarily preserve the focused element in light of first responder changes while presenting a popover on Mac Catalyst. * UIProcess/ios/forms/WKFormPopover.mm: (-[WKRotatingPopover presentPopoverAnimated:]): (-[WKRotatingPopover dismissPopoverAnimated:]): 2020-06-13 Sam Weinig Extended Color: Experiment with strongly typed ColorComponents https://bugs.webkit.org/show_bug.cgi?id=212396 Reviewed by Darin Adler. * UIProcess/API/wpe/WebKitColor.cpp: (webkitColorFillFromWebCoreColor): * UIProcess/gtk/ViewGestureControllerGtk.cpp: (WebKit::ViewGestureController::beginSwipeGesture): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::getDocumentBackgroundColor): Update to call toSRGBALossy() rather than toSRGBAComponentsLossy(). 2020-06-13 Tetsuharu Ohzeki Remove FileError.h https://bugs.webkit.org/show_bug.cgi?id=213119 Reviewed by Chris Dumez. * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::createMessageQueue): 2020-06-12 Brian Burg Automation.computeElementLayout should return iframe-relative element rects (when coordinate system is 'Page') https://bugs.webkit.org/show_bug.cgi?id=213139 Reviewed by Devin Rousso. Automation.computeElementLayout has two coordinate systems it can use, LayoutViewport (used for hit testing) and Page (used for Get Element Rect). Since Get Element Rect expects coordinates relative to the current browsing context, make the mode simpler by reporting the bounds from Element::boundingClientRect() which are frame-relative. Covered by existing WPT suite. The semantics of this command are under review, as the remote end steps seem to describe a different result than what the non-normative text does. * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::computeElementLayout): 2020-06-12 David Kilzer [IPC hardening] Check enum values in IPC::Decoder::decodeEnum() an IPC::Encoder::encodeEnum() Reviewed by Darin Adler. Replace decodeEnum() with decode() and encodeEnum() with operator<<(). * GPUProcess/media/TextTrackPrivateRemoteConfiguration.h: (WebKit::TextTrackPrivateRemoteConfiguration::encode const): * GPUProcess/media/TrackPrivateRemoteConfiguration.h: (WebKit::TrackPrivateRemoteConfiguration::encode const): * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkResourceLoadParameters.cpp: (WebKit::NetworkResourceLoadParameters::encode const): (WebKit::NetworkResourceLoadParameters::decode): * Platform/IPC/Decoder.h: (IPC::Decoder::decode): (IPC::Decoder::operator>>): - Make use of std::underlying_type_t<>. (IPC::Decoder::decodeEnum): Delete. - Replace with calls to decode(). * Platform/IPC/Encoder.h: (IPC::Encoder::operator<<): (IPC::Encoder::encode): - Make use of WTF::enumToUnderlyingType<>. (IPC::Encoder::encodeEnum): Delete. - Replace with calls to operator<<(). * Shared/Cocoa/ArgumentCodersCocoa.mm: (IPC::decodeObject): * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Shared/ContextMenuContextData.cpp: (WebKit::ContextMenuContextData::encode const): (WebKit::ContextMenuContextData::decode): * Shared/FocusedElementInformation.cpp: (WebKit::FocusedElementInformation::encode const): (WebKit::FocusedElementInformation::decode): * Shared/LoadParameters.cpp: (WebKit::LoadParameters::encode const): (WebKit::LoadParameters::decode): * Shared/NavigationActionData.cpp: (WebKit::NavigationActionData::encode const): (WebKit::NavigationActionData::decode): * Shared/PlatformPopupMenuData.cpp: (WebKit::PlatformPopupMenuData::encode const): (WebKit::PlatformPopupMenuData::decode): * Shared/Plugins/PluginProcessCreationParameters.cpp: (WebKit::PluginProcessCreationParameters::encode const): (WebKit::PluginProcessCreationParameters::decode): * Shared/PrintInfo.cpp: (WebKit::PrintInfo::encode const): (WebKit::PrintInfo::decode): * Shared/RTCPacketOptions.cpp: (WebKit::RTCPacketOptions::encode const): (WebKit::RTCPacketOptions::decode): * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm: (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode const): (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode): (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const): (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode): * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: (ArgumentCoder::encode): (ArgumentCoder::encode): (ArgumentCoder::decode): (WebKit::RemoteScrollingCoordinatorTransaction::decode): * Shared/SessionState.cpp: (WebKit::HTTPBody::Element::encode const): (WebKit::HTTPBody::Element::decode): (WebKit::PageState::encode const): (WebKit::PageState::decode): * Shared/TouchBarMenuItemData.cpp: (WebKit::TouchBarMenuItemData::encode const): (WebKit::TouchBarMenuItemData::decode): * Shared/UserData.cpp: (WebKit::UserData::encode): (WebKit::UserData::decode): * Shared/WebContextMenuItemData.cpp: (WebKit::WebContextMenuItemData::encode const): (WebKit::WebContextMenuItemData::decode): * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::decodeFilterOperation): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPopupItem.cpp: (WebKit::WebPopupItem::encode const): (WebKit::WebPopupItem::decode): * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebsiteData/WebsiteData.cpp: (WebKit::WebsiteData::Entry::encode const): (WebKit::WebsiteData::Entry::decode): * Shared/curl/WebCoreArgumentCodersCurl.cpp: (IPC::ArgumentCoder::encodePlatformData): (IPC::ArgumentCoder::decodePlatformData): (IPC::ArgumentCoder::encodePlatformData): (IPC::ArgumentCoder::decodePlatformData): * Shared/glib/InputMethodState.cpp: (WebKit::InputMethodState::encode const): (WebKit::InputMethodState::decode): * Shared/glib/UserMessage.cpp: (WebKit::UserMessage::encode const): (WebKit::UserMessage::decode): * Shared/mac/ColorSpaceData.mm: (WebKit::ColorSpaceData::encode const): (WebKit::ColorSpaceData::decode): * Shared/mac/SecItemRequestData.cpp: (WebKit::SecItemRequestData::encode const): (WebKit::SecItemRequestData::decode): * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::ArgumentCoder::encodePlatformData): (IPC::ArgumentCoder::decodePlatformData): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Shared/soup/WebCoreArgumentCodersSoup.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * WebProcess/GPU/media/RemoteMediaPlayerState.h: (WebKit::RemoteMediaPlayerState::encode const): (WebKit::RemoteMediaPlayerState::decode): * WebProcess/Network/NetworkProcessConnectionInfo.h: (WebKit::NetworkProcessConnectionInfo::decode): * WebProcess/Plugins/Plugin.cpp: (WebKit::Plugin::Parameters::encode const): (WebKit::Plugin::Parameters::decode): * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: (WebKit::PlatformCAAnimationRemote::KeyframeValue::encode const): (WebKit::PlatformCAAnimationRemote::KeyframeValue::decode): (WebKit::PlatformCAAnimationRemote::Properties::encode const): (WebKit::PlatformCAAnimationRemote::Properties::decode): 2020-06-12 Wenson Hsieh [iPadOS] Focusing selects and color inputs should not bring up the software keyboard https://bugs.webkit.org/show_bug.cgi?id=213149 Reviewed by Darin Adler. After , we now opt into bringing up the software keyboard when focusing color inputs and select elements. This is due to the changes in `-_shouldShowAutomaticKeyboardUIIgnoringInputMode`, which were intended to make us return `NO` for date and time inputs, but also unintentionally makes us return `YES` on iPadOS. This patch fixes the bug by returning `!WebKit::currentUserInterfaceIdiomIsPad()` instead, and additionally preserves the existing behavior of now showing a color picker for `` on iPhone. Test: fast/forms/ios/ipad/select-should-not-bring-up-software-keyboard.html * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView becomeFirstResponderForWebView]): (-[WKContentView resignFirstResponderForWebView]): (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]): (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]): 2020-06-12 Alex Christensen Make API tests tolerant of our relatively new use of WebPageProxy::preconnectTo https://bugs.webkit.org/show_bug.cgi?id=213144 Reviewed by Geofferey Garen. * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]): (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): (WebKit::NetworkSessionCocoa::taskServerConnectionSucceeded): (WebKit::NetworkSessionCocoa::taskReceivedBytes): Deleted. Fix our logic that remembers successful client certificate connections. If a task completes with no error (like a preconnect task does), consider that a successful connection. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::preconnectTo): Remove the check to not preconnect to loopback addresses. This was making our tests different than the real internet and prevented me from landing a perfectly good test in https://bugs.webkit.org/show_bug.cgi?id=213109 2020-06-12 Per Arne Vollan [iOS] Preferences are not being observed if the process pool is being created after activation https://bugs.webkit.org/show_bug.cgi?id=213145 Reviewed by Brent Fulgham. If the app is creating the Web process pool after being activated, preferences will not be observed until the app is being backgrounded and then foregrounded again, since the preference observer is initialized when handling the app activation notification. No new tests, since an API test would make sense in this case, but API tests aren't run on iOS. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): 2020-06-12 Takashi Komori [Curl] Implement functions to use ResourceLoadStatistics. https://bugs.webkit.org/show_bug.cgi?id=207692 Reviewed by Don Olmstead. Implement functions which are required to implement ResourceLoadStatistics for Curl port. In NetworkDataTaskCurl.cpp we check if we should block cookies and block if needed. Tests: http/tests/resourceLoadStatistics/ * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::create): * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl): (WebKit::NetworkDataTaskCurl::createCurlRequest): (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection): (WebKit::NetworkDataTaskCurl::blockCookies): (WebKit::NetworkDataTaskCurl::unblockCookies): (WebKit::NetworkDataTaskCurl::shouldBlockCookies): (WebKit::NetworkDataTaskCurl::isThirdPartyRequest): * NetworkProcess/curl/NetworkDataTaskCurl.h: * NetworkProcess/curl/NetworkSessionCurl.cpp: (WebKit::NetworkSessionCurl::NetworkSessionCurl): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreGetAllStorageAccessEntries): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::parameters): 2020-06-12 Antoine Quint Double tap to zoom out doesn't work after upgrading to iOS 13 https://bugs.webkit.org/show_bug.cgi?id=205158 Reviewed by Wenson Hsieh. Test: fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out.html In order to determine whether a significant zoom to happen, we should use the current page scale factor and not the initial page scale factor. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:nodeIsRootLevel:]): 2020-06-12 Alex Christensen Add WKUserScript initializer SPI with alternative names https://bugs.webkit.org/show_bug.cgi?id=213096 Reviewed by Youenn Fablet. And deprecate the existing ones so we can remove them soon. * UIProcess/API/Cocoa/WKUserScript.mm: (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:includeMatchPatternStrings:excludeMatchPatternStrings:associatedURL:contentWorld:deferRunningUntilNotification:]): * UIProcess/API/Cocoa/WKUserScriptPrivate.h: 2020-06-12 Carlos Garcia Campos Unreviewed. Fix GTK4 build * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSynthesizeKeyEvent): 2020-06-11 Sam Weinig Document.currentScript does not work for SVGScriptElements https://bugs.webkit.org/show_bug.cgi?id=213104 Reviewed by Yusuke Suzuki. * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp: (webkit_dom_document_get_current_script): Update to account for change in Document::currentScript() now returning an Element* that can be either an HTMLScriptElement or an SVGScriptElement. To keep API compatibility, only return non-null for HTMLScriptElements. 2020-06-12 Charlie Turner [GTK] Add an internal API to run javascript without forced user gestures https://bugs.webkit.org/show_bug.cgi?id=212969 Reviewed by Carlos Garcia Campos. To be used by tests in a follow-up commit. * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewRunJavaScriptWithParams): Factor out the glue to run JavaScript in the page. (webkitWebViewRunJavascriptWithoutForcedUserGestures): Add a new internal API for use by tests. (webkit_web_view_run_javascript): Modified to use factored out glue. * UIProcess/API/glib/WebKitWebViewInternal.h: Added. Place to keep API test-specific internal APIs. 2020-06-12 Carlos Garcia Campos [GTK4] Make WebDriver work https://bugs.webkit.org/show_bug.cgi?id=212316 Reviewed by Adrian Perez de Castro. Fix UIClient::setWindowFrame to wait for surface size-changed signal after resizing the window and implement maximize, minimize and restore windows for GTK4. * UIProcess/API/glib/WebKitUIClient.cpp: * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (surfaceStateChangedCallback): (webkitWebViewMonitorWindowState): (webkitWebViewMaximizeWindow): (webkitWebViewMinimizeWindow): (webkitWebViewRestoreWindow): 2020-06-11 David Kilzer [IPC] Add WTF::EnumTraits<> for every enum type used in IPC Reviewed by Darin Adler. Summary: - Change underlying type of enum class to `bool` when there are only two values. In some cases, reorder the two values so the mapping to 0 and 1 makes more sense. Converting every enum to an enum class is not a goal of this patch, so some two-value enums stil have WTF::EnumTraits<> defined as noted below. - Add WTF::EnumTraits<> for the remaining enum types that are used by IPC::Encoder::encodeEnum() and IPC::Decoder::decodeEnum() so that WTF::isValidEnum<>() checks may be added next. - Add #include as needed. * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUProcess.h: * NetworkProcess/NetworkLoadParameters.h: * Shared/API/APIObject.h: * Shared/ContextMenuContextData.h: * Shared/DrawingAreaInfo.h: * Shared/FocusedElementInformation.h: * Shared/PrintInfo.h: (WTF::EnumTraits): - Define this since PrintMode is not an enum class. * Shared/RTCPacketOptions.cpp: * Shared/SessionState.h: * Shared/TouchBarMenuItemData.h: * Shared/WebEvent.h: * Shared/WebPopupItem.cpp: (WebKit::WebPopupItem::WebPopupItem): - Fix reference to WebPopupItem::Type enum. * Shared/WebPopupItem.h: (WebKit::WebPopupItem::Type): - Convert from enum to enum class. * Shared/WebsiteData/WebsiteDataType.h: * Shared/glib/InputMethodState.h: * Shared/glib/UserMessage.h: * Shared/mac/ColorSpaceData.mm: * Shared/mac/SecItemRequestData.h: * UIProcess/mac/WebPopupMenuProxyMac.mm: (WebKit::WebPopupMenuProxyMac::populate): - Fix reference to WebPopupItem::Type enum. * WebProcess/Plugins/Plugin.cpp: * WebProcess/WebCoreSupport/WebPopupMenu.cpp: (WebKit::WebPopupMenu::populateItems): - Fix reference to WebPopupItem::Type enum. * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h: 2020-06-11 Alex Christensen Re-enable download resume tests https://bugs.webkit.org/show_bug.cgi?id=213098 Reviewed by Geoffrey Garen. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:]): 2020-06-11 Beth Dakin Replace instances of whitelist in WebCore with allowlist https://bugs.webkit.org/show_bug.cgi?id=213068 Reviewed by Tim Horton. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::addOriginAccessWhitelistEntry): (WebKit::NetworkConnectionToWebProcess::removeOriginAccessWhitelistEntry): (WebKit::NetworkConnectionToWebProcess::resetOriginAccessWhitelists): * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::addOriginAccessWhitelistEntry): (WebKit::InjectedBundle::removeOriginAccessWhitelistEntry): (WebKit::InjectedBundle::resetOriginAccessWhitelists): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-06-11 Jonathan Bedard WebKit: Guard requestDocumentContext with HAVE(UI_WK_DOCUMENT_CONTEXT) https://bugs.webkit.org/show_bug.cgi?id=213076 Reviewed by Tim Horton. No new tests, behavior unchanged. * Platform/spi/ios/UIKitSPI.h: * UIProcess/API/ios/WKWebViewTestingIOS.mm: (-[WKWebView _requestDocumentContext:completionHandler:]): Guard requestDocumentContext with HAVE(UI_WK_DOCUMENT_CONTEXT). (-[WKWebView _adjustSelectionWithDelta:completionHandler:]): Ditto. 2020-06-11 Jonathan Bedard WebKit: Add UIKit SPI for watchOS and tvOS https://bugs.webkit.org/show_bug.cgi?id=213077 Reviewed by Tim Horton. No new tests, behavior unchanged. * Platform/spi/ios/UIKitSPI.h: 2020-06-11 David Kilzer [IPC] Adopt enum class for DragSourceAction Reviewed by Darin Adler. Summary: - Convert argument parameters from uint64_t to OptionSet. - Convert DragSourceAction to OptionSet. * Scripts/webkit/messages.py: - Map DragSourceAction enum to DragActions.h header. * UIProcess/WebPageProxy.h: * UIProcess/ios/DragDropInteractionState.h: * UIProcess/ios/DragDropInteractionState.mm: (WebKit::shouldUseDragImageToCreatePreviewForDragSource): (WebKit::shouldUseVisiblePathToCreatePreviewForDragSource): (WebKit::shouldUseTextIndicatorToCreatePreviewForDragSource): (WebKit::canUpdatePreviewForActiveDragSource): (WebKit::DragDropInteractionState::anyActiveDragSourceIs const): (WebKit::DragDropInteractionState::stageDragItem): (WebKit::DragDropInteractionState::hasStagedDragSource const): (WebKit::DragDropInteractionState::updatePreviewsForActiveDragSources): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _startDrag:item:]): (-[WKContentView _allowedDragSourceActions]): (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::requestDragStart): (WebKit::WebPageProxy::requestAdditionalItemsForDragSession): * WebProcess/WebCoreSupport/WebDragClient.cpp: (WebKit::WebDragClient::dragSourceActionMaskForPoint): * WebProcess/WebCoreSupport/WebDragClient.h: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::allowedDragSourceActions const): * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestDragStart): (WebKit::WebPage::requestAdditionalItemsForDragSession): 2020-06-11 Eric Carlson [Cocoa] MediaUsageManagerCocoa should use a different USVideoUsage initializer https://bugs.webkit.org/show_bug.cgi?id=213058 Reviewed by Jer Noble. No new tests, tested manually. * UIProcess/Media/cocoa/MediaUsageManagerCocoa.mm: (WebKit::MediaUsageManagerCocoa::reset): Drive-by fix: don't call -stop unless the element was playing. (WebKit::MediaUsageManagerCocoa::updateMediaUsage): Use a different initializer so we can pass in the state. 2020-06-11 ChangSeok Oh [GTK] Implement button-press-event, button-release-event, and absolute-axis-event of GAMEPAD API. https://bugs.webkit.org/show_bug.cgi?id=133850 Reviewed by Carlos Garcia Campos. * UIProcess/Gamepad/UIGamepadProvider.cpp: Add the OS(LINUX) guard. * UIProcess/Gamepad/gtk/UIGamepadProviderGtk.cpp: (WebKit::getWebPageProxy): Build fix. WebKitWebViewBase is used, not WebKitWebViewPrivate. * UIProcess/Gamepad/manette/UIGamepadProviderManette.cpp: Add the OS(LINUX) guard. 2020-06-10 Said Abou-Hallawa [macOS]: The File Picker of the file element should show the selection filter https://bugs.webkit.org/show_bug.cgi?id=212485 Reviewed by Darin Adler. Add two private helpers to WKOpenPanelParameters. * UIProcess/API/Cocoa/WKOpenPanelParameters.mm: (-[WKOpenPanelParameters _allowedFileExtensions]): Returns an array of strings representing the allowed extensions. (-[WKOpenPanelParameters _allowedFileExtensionsDescription]): Returns a string representing a description for the allowed extensions. * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h: 2020-06-10 Beth Dakin Replace instances of blacklist in WebCore with blocklist https://bugs.webkit.org/show_bug.cgi?id=213064 Reviewed by Tim Horton. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): 2020-06-10 Wenson Hsieh [iOS] editing/pasteboard/dom-paste tests consistently time out https://bugs.webkit.org/show_bug.cgi?id=213061 Reviewed by Darin Adler. On recent versions of iOS, system changes have moved the timing of the call to `-requestAutocorrectionContextWithCompletionHandler:` when focusing an editable element. This results in a consistently reproducible deadlock between the UI process and web process if a page tries to request programmatic clipboard access during the click event (importantly, in the same runloop as element focus). What ends up happening is that the autocorrection context is requested by the UI process shortly after the (unbounded) sync IPC message for the DOM paste arrives, so we end up waiting forever for the sync-IPC-blocked web process to respond. Normally this just results in a 1 second hang, and the DOM paste proceeds as normal. However these layout tests purposefully opt out of sync IPC timeouts (precisely so that we can catch bugs like this). See below for more details. * UIProcess/ios/WKContentViewInteraction.h: Keep track of the most recent autocorrection context that arrived in the UI process. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): Clear out the autocorrection context, in case the web process crashes. (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]): If the autocorrection context is requested while handling a DOM paste, we know that the latest autocorrection context must be up to date, since the autocorrection context is computed and sent immediately before a DOM paste request. Use this to immediately invoke the completion handler, without any sync IPC back to the web process. (-[WKContentView _handleAutocorrectionContext:]): 2020-06-10 Hiro (mzp) Mizuno [iOS] Option + Forward Delete should delete next word https://bugs.webkit.org/show_bug.cgi?id=213062 rdar://64225458 Reviewed by Daniel Bates. Implement support for pressing Option + Forward Delete to delete the next word. This makes text editing in WebKit more closely match the platform conventions. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView canPerformAction:withSender:]): Handle _deleteForwardByWord. (-[WKContentView _deleteForwardByWord]): Added. 2020-06-10 Geoffrey Garen Some style improvements to main thread code https://bugs.webkit.org/show_bug.cgi?id=213051 Reviewed by Darin Adler. Updated for rename. * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::runInitializationCode): (WebKit::InitializeWebKit2): * Shared/WebKit2Initialize.cpp: (WebKit::InitializeWebKit2): 2020-06-10 Jonathan Bedard WebKit:Add PepperUICoreSPI.h (Follow-up fix 2) https://bugs.webkit.org/show_bug.cgi?id=212996 Unreviewed build fix. * UIProcess/ios/forms/WKNumberPadViewController.mm: (-[WKNumberPadViewController addContentViewAnimations:]): Correct APPLE_INTERNAL_SDK macro. * UIProcess/ios/forms/WKQuickboardListViewController.mm: (-[WKQuickboardListViewController initWithDelegate:]): Ditto. 2020-06-10 Jonathan Bedard WebKit:Add PepperUICoreSPI.h (Follow-up fix) https://bugs.webkit.org/show_bug.cgi?id=212996 Unreviewed build fix. * Platform/spi/watchos/PepperUICoreSPI.h: Add PUICPickerView headers. 2020-06-10 David Kilzer REGRESSION (r262858): Fix macOS build when building EndowmentStateTracker.mm * UIProcess/EndowmentStateTracker.mm: - Move #if PLATFORM(IOS_FAMILY) to fix macOS build. 2020-06-10 Per Arne Vollan [Cocoa] Return early from preference change notification handler if there is no observer https://bugs.webkit.org/show_bug.cgi?id=213050 Reviewed by Darin Adler. Currently, the observer member is checked inside the loop iterating over all the keys, but this check should be moved outside of the loop. No new tests, since this is not a change in behavior. * UIProcess/Cocoa/PreferenceObserver.mm: (-[WKUserDefaults _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:]): 2020-06-10 Brady Eidson Crash growing a CFData with incremental PDF loading. and https://bugs.webkit.org/show_bug.cgi?id=213035 Reviewed by Alex Christensen. No test - No reliable way to trigger. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::ensureDataBufferLength): When you call CFDataCreateMutable with a size other than 0, your data object can never grow beyond that size. And, in fact, CFData will crash on purpose when this is attempted. So always create our mutable CFDatas with size 0 even if we immediately plan to grow them. 2020-06-10 Jonathan Bedard WebKit: Add ClockKitSPI.h https://bugs.webkit.org/show_bug.cgi?id=212994 Reviewed by Wenson Hsieh. No new tests, behavior unchanged. * Platform/spi/watchos: Added. * Platform/spi/watchos/ClockKitSPI.h: Added. * UIProcess/ios/forms/WKTimePickerViewController.mm: Import ClockKitSPI.h and UIKitSPI.h. * WebKit.xcodeproj/project.pbxproj: Include ClockKitSPI. 2020-06-10 Brian Burg WebDriver on non-iOS ports cannot perform ActionChain which has scrolling down to the element and click it https://bugs.webkit.org/show_bug.cgi?id=208232 Reviewed by Devin Rousso. * UIProcess/Automation/mac/WebAutomationSessionMac.mm: (WebKit::WebAutomationSession::platformSimulateMouseInteraction): The provided coordinates are in LayoutViewport coordinate system, which does not take topContentInset into account. Add back in the topContentInset when translating to flipped window coordinates. * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::computeElementLayout): The calculations of element bounds and IVCP have an incorrect handling of root coordinates as contents/absolute coordinates. Add the missing conversion. 2020-06-10 Brent Fulgham [iOS] Update sandbox rules for correct sanitizer paths in current OS releases https://bugs.webkit.org/show_bug.cgi?id=213040 Reviewed by Per Arne Vollan. Update the sandbox rules on iOS platforms to allow access to the new system locations for Asan libraries. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-06-10 Jer Noble Catalyst WebKit apps continue to play audio after quitting https://bugs.webkit.org/show_bug.cgi?id=212981 Reviewed by Chris Dumez. RunningBoard will track whether a process (and it's associated child processes) are "user-visible" by granting those processes an "endowment", similar to the existing endowment for application visibility. Track changes to these endowments using a RBSProcessMonitor, and for Catalyst apps, react to losing the "user-visible" endowment by suspending all media playback. Move all the endowment-related code into a new class, EndowmentStateTracker, which is a singleton object that can have mulitple WebPageProxy clients. Update references to the previously global static isApplicationForeground() function to refer to EndowmentStateTracker instead. Drive-by fix: move some iOS-only functions in WebPageProxy.cpp into WebPageProxyIOS.mm. * UIProcess/ApplicationStateTracker.h: * UIProcess/ApplicationStateTracker.mm: (WebKit::ApplicationStateTracker::ApplicationStateTracker): (WebKit::isApplicationForeground): Deleted. * UIProcess/EndowmentStateTracker.h: Added. (WebKit::EndowmentStateTracker::isVisible const): (WebKit::EndowmentStateTracker::isUserFacing const): * UIProcess/EndowmentStateTracker.mm: Added. (WebKit::handleForPID): (WebKit::EndowmentStateTracker::isApplicationForeground): (WebKit::EndowmentStateTracker::isApplicationUserFacing): (WebKit::EndowmentStateTracker::singleton): (WebKit::EndowmentStateTracker::EndowmentStateTracker): (WebKit::EndowmentStateTracker::addClient): (WebKit::EndowmentStateTracker::removeClient): (WebKit::EndowmentStateTracker::setIsUserFacing): (WebKit::EndowmentStateTracker::setIsVisible): * UIProcess/WebPageProxy.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPageProxy::~WebPageProxy): (WebKit::WebPageProxy::processWillBecomeSuspended): Deleted. (WebKit::WebPageProxy::processWillBecomeForeground): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::isApplicationVisible): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::processWillBecomeSuspended): (WebKit::WebPageProxy::processWillBecomeForeground): (WebKit::WebPageProxy::isUserFacingChanged): (WebKit::WebPageProxy::isVisibleChanged): * WebKit.xcodeproj/project.pbxproj: 2020-06-10 Antoine Quint Subframes should not autosize independently https://bugs.webkit.org/show_bug.cgi?id=212984 Reviewed by Simon Fraser. Ensure we only call FrameView::enableSizeToContentAutoSizeMode() for the main frame. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): 2020-06-10 Jonathan Bedard WebKit:Add PepperUICoreSPI.h https://bugs.webkit.org/show_bug.cgi?id=212996 Reviewed by Tim Horton. No new tests, behavior unchanged. * Platform/spi/watchos: Added. * Platform/spi/watchos/PepperUICoreSPI.h: Added. * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: Include PepperUICoreSPI header. * UIProcess/ios/WKScrollView.mm: Ditto. * UIProcess/ios/forms/WKDatePickerViewController.mm: Remove headers duplicated in PepperUICoreSPI.h. * UIProcess/ios/forms/WKFocusedFormControlView.mm: Ditto. * UIProcess/ios/forms/WKNumberPadView.mm: Include PepperUICoreSPI header. * UIProcess/ios/forms/WKNumberPadViewController.h: Remove headers duplicated in PepperUICoreSPI.h. * UIProcess/ios/forms/WKNumberPadViewController.mm: Ditto. (-[WKNumberPadViewController addContentViewAnimations:]): Limit addAnimation to Internal builds. * UIProcess/ios/forms/WKQuickboardListViewController.h: Include PepperUICoreSPI header. * UIProcess/ios/forms/WKQuickboardListViewController.mm: Remove headers duplicated in PepperUICoreSPI.h. (-[WKQuickboardListViewController initWithDelegate:]): * UIProcess/ios/forms/WKSelectMenuListViewController.mm: Remove headers duplicated in PepperUICoreSPI.h. * UIProcess/ios/forms/WKTextInputListViewController.mm: Ditto. * WebKit.xcodeproj/project.pbxproj: Add PepperUICoreSPI.h. 2020-06-10 Per Arne Vollan [iOS] Add entitlement for PAC exceptions https://bugs.webkit.org/show_bug.cgi?id=213027 Reviewed by Brent Fulgham. On iOS, add entitlement for PAC exceptions. * Scripts/process-entitlements.sh: 2020-06-10 James Savage Swift Overlay API refinements https://bugs.webkit.org/show_bug.cgi?id=212939 Reviewed by Darin Adler. This patch cleans up some inconsistencies in the various Swift projections, and modifies JavaScript evaluation callbacks to be optional to account for scripts which may not evaluate to a useful result (such as ones that simply modify the DOM without reporting a status). It also standardizes on using completionHandler as an argument label to match the rest of WebKit API, and the majority of the Swift API refinements. It also fixes a module issue where the WebKit.h umbrella was missing an import of WKScriptReplyWithMessageHandler.h, making the type unusable from Swift source files/ * Shared/API/Cocoa/WebKit.h: Add missing header. * UIProcess/API/Cocoa/WebKitSwiftOverlay.swift: (callAsyncJavaScript(_:arguments:in:completionHandler:)): Rename completion argument, and make optional. Note: Optional closures are implicitly @escaping, making the annotation redundant and incompatible, so it must be removed. In Swift, Optional.map()'s closure is invoked iff the Optional contains some value, and the result of that transform is returned, else nil is propagated. This allows us to apply the closure transform if the client value is non-nil, without using intermediary variables or if/let. (evaluateJavaScript(_:in:completionHandler:)): Ditto. * SwiftOverlay/Tests/WebKitTests.swift: (WebKitTests.testAPI): Update names to reflect changes. * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/xcshareddata/xcschemes/Everything (Catalyst).xcscheme: Ensure that the unit test files get built as part of Build & Run, so that any changes to names get flagged without even running the tests. * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/xcshareddata/xcschemes/Everything.xcscheme: Ditto. 2020-06-10 Kate Cheney ASSERTION FAILED: suspendedState == State::Running in WebKit::WebResourceLoadStatisticsStore::suspend https://bugs.webkit.org/show_bug.cgi?id=213031 Reviewed by Chris Dumez. There is a race condition if two calls are made to WebResourceLoadStatisticsStore::suspend() simultanously. WebResourceLoadStatisticsStore::resume() notifies the background thread to continue and releases a lock, then sometimes the second call to suspend obtains the lock and updates the suspendedState variable before the background thread resumes and checks the result. This patch allows the suspendedState to be either State::Running or State::WillSuspend to account for this. No new tests, this should fix http/wpt/service-workers/service-worker-spinning-fetch.https.html. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated): (WebKit::WebResourceLoadStatisticsStore::suspend): 2020-06-10 Alex Christensen Revert r259770 https://bugs.webkit.org/show_bug.cgi?id=210097 * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): 2020-06-10 Alex Christensen Add some null checks in PDFPlugin::updatePageAndDeviceScaleFactors https://bugs.webkit.org/show_bug.cgi?id=213009 Reviewed by Chris Dumez. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::updatePageAndDeviceScaleFactors): 2020-06-09 Fujii Hironori Unreviewed, reverting r262791. WinCairo WebKit1 is crashing. Reverted changeset: "[Curl] Implement functions to use ResourceLoadStatistics." https://bugs.webkit.org/show_bug.cgi?id=207692 https://trac.webkit.org/changeset/262791 2020-06-09 Tim Horton Stop using the wrong LaunchServices SPI for getting an app's localized name https://bugs.webkit.org/show_bug.cgi?id=213003 Reviewed by Sam Weinig. * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]): 2020-06-09 Mark Lam Disambiguate the OverridesGetPropertyNames structure flag https://bugs.webkit.org/show_bug.cgi?id=212909 Reviewed by Saam Barati. * WebProcess/Plugins/Netscape/JSNPObject.h: 2020-06-09 Dean Jackson Stop using discriminatory names for WebGL and Plugin blocking https://bugs.webkit.org/show_bug.cgi?id=213000 Reviewed by Simon Fraser. * Shared/Plugins/Netscape/mac/PluginInformationMac.mm: (WebKit::getPlatformPluginModuleInformation): * UIProcess/API/C/mac/WKContextPrivateMac.mm: (WKContextIsPlugInUpdateAvailable): (WKContextShouldBlockWebGL): (WKContextShouldSuggestBlockWebGL): * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: (WebKit::PluginInfoStore::defaultLoadPolicyForPlugin): 2020-06-09 Brian Burg [Cocoa] Element Send Keys can hang when an automation window becomes unfocused https://bugs.webkit.org/show_bug.cgi?id=212985 Reviewed by Devin Rousso. * UIProcess/Automation/mac/WebAutomationSessionMac.mm: (WebKit::WebAutomationSession::sendSynthesizedEventsToPage): Make sure to focus the window and set first responder so sending keys doesn't hang. 2020-06-09 Jonathan Bedard WebKit: Import NSURLConnectionSPI.h instead of CFNSURLConnection.h https://bugs.webkit.org/show_bug.cgi?id=212980 Unreviewed build fix. No new tests, behavior unchanged. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: 2020-06-09 Dean Jackson REGRESSION: [Safari Mojave for High Sierra] Accessing some of the featured pages on apple.com causes the webpage to crash https://bugs.webkit.org/show_bug.cgi?id=212940 Reviewed by Tim Horton. The code to use the singleton for a SwitchingGPUClient was assuming it has always been set, which was not the case when ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) was not true. * WebProcess/cocoa/WebProcessCocoa.mm: Set the singleton unconditionally. (WebKit::WebProcess::platformInitializeProcess): 2020-06-09 Wenson Hsieh REGRESSION (r260820): [macCatalyst] Web process crashes when uploading a file https://bugs.webkit.org/show_bug.cgi?id=212976 Reviewed by Tim Horton. On Mac Catalyst, we attempt to take a sandbox extension for `com.apple.frontboard.systemappservices` when uploading a file; this service does not exist in Catalyst, and we consequently encounter a release assertion under `WebPage::didChooseFilesForOpenPanelWithDisplayStringAndIcon`. Fix this by introducing `HAVE(FRONTBOARD_SYSTEM_APP_SERVICES)`, and using it to guard codepaths that attempt to grab a mach extension to this service. (As a followup, we should consider adopting this in other places that currently reference `com.apple.frontboard.systemappservices`). * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didChooseFilesForOpenPanelWithDisplayStringAndIcon): 2020-06-09 Jonathan Bedard WebKit: Support watchOS and tvOS in xcconfigs https://bugs.webkit.org/show_bug.cgi?id=212977 Reviewed by Tim Horton. No new tests, behavior unchanged. * Configurations/Base.xcconfig: Add tvOS and watchOS major version macros. * Configurations/BaseTarget.xcconfig: Include tvOS and watchOS framework stubs. * Configurations/BaseXPCService.xcconfig: Generalize excluded files for all embedded platforms. * Configurations/GPUService.xcconfig: Generalize INFOPLIST for embedded platforms. * Configurations/NetworkService.xcconfig: Ditto. * Configurations/WebContentService.xcconfig: Ditto. 2020-06-09 Alex Christensen Expose PDF file URL in shouldAllowPDFToOpenFromFrame SPI https://bugs.webkit.org/show_bug.cgi?id=212974 Reviewed by Tim Horton. * UIProcess/API/APIUIClient.h: (API::UIClient::confirmPDFOpening): * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::UIDelegate::UIClient::confirmPDFOpening): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication): (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication): 2020-06-09 Takashi Komori [Curl] Implement functions to use ResourceLoadStatistics. https://bugs.webkit.org/show_bug.cgi?id=207692 Reviewed by Don Olmstead. Implement functions which are required to implement ResourceLoadStatistics for Curl port. In NetworkDataTaskCurl.cpp we check if we should block cookies and block if needed. Tests: http/tests/resourceLoadStatistics/ * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::create): * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl): (WebKit::NetworkDataTaskCurl::createCurlRequest): (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection): (WebKit::NetworkDataTaskCurl::blockCookies): (WebKit::NetworkDataTaskCurl::unblockCookies): (WebKit::NetworkDataTaskCurl::shouldBlockCookies): (WebKit::NetworkDataTaskCurl::isThirdPartyRequest): * NetworkProcess/curl/NetworkDataTaskCurl.h: * NetworkProcess/curl/NetworkSessionCurl.cpp: (WebKit::NetworkSessionCurl::NetworkSessionCurl): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreGetAllStorageAccessEntries): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::parameters): 2020-06-09 Lauro Moura [WebDriver][WPE] Follow up WPE fix after r262703 https://bugs.webkit.org/show_bug.cgi?id=212948 Reviewed by Carlos Garcia Campos. Covered by existing tests. * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp: (WebKit::WebAutomationSession::platformWebModifiersFromRaw): 2020-06-08 David Kilzer [IPC] Adopt enum class for IPC::CFType Reviewed by Darin Adler. Summary: - Convert IPC::CFType to enum class. - Rule for new enum names is to remove "Ref" suffix from the actual type name. - Special enum CFType::Null renamed to CFType::Nullptr to differentiate from CFType::CFNull objects. * Shared/cf/ArgumentCodersCF.cpp: (IPC::tokenNullTypeRef): Delete. (IPC::tokenNullptrTypeRef): Add. - Rename tokenNullTypeRef() to tokenNullptrTypeRef(). (IPC::CFType): - Convert to enum class. (IPC::typeFromCFTypeRef): (IPC::encode): - Switch from encodeEnum() to operator<<(). (IPC::decode): - Switch from decodeEnum() to decode(). (WTF::EnumTraits): Add. * Shared/cf/ArgumentCodersCF.h: (IPC::tokenNullTypeRef): Delete. (IPC::tokenNullptrTypeRef): Add. - Rename tokenNullTypeRef() to tokenNullptrTypeRef(). * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::ArgumentCoder::encodePlatformData): (IPC::ArgumentCoder::decodePlatformData): - Switch to use tokenNullptrTypeRef(). * mac/WebKit2.order: - Update symbol name after renaming tokenNullTypeRef(). 2020-06-08 Kate Cheney ResourceLoadStatisticsDatabaseStore::domainIDFromString failed, error message: bad parameter or other API misuse https://bugs.webkit.org/show_bug.cgi?id=212916 Reviewed by Sihui Liu. Make sure m_domainIDFromStringStatement is accessed in a separate scope in ensureResourceStatisticsForRegistrableDomain() so it will be reset before being used again. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::domainID const): Add debug assert to ensure that tests catch this case. (WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForRegistrableDomain const): 2020-06-08 Chris Dumez Turn some WebPageProxy logging into error logging https://bugs.webkit.org/show_bug.cgi?id=212922 Reviewed by Geoffrey Garen. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::processDidTerminate): (WebKit::WebPageProxy::dispatchProcessDidTerminate): (WebKit::WebPageProxy::tryReloadAfterProcessTermination): (WebKit::WebPageProxy::didExceedInactiveMemoryLimitWhileActive): (WebKit::WebPageProxy::didExceedBackgroundCPULimitWhileInForeground): 2020-06-08 David Kilzer [IPC] Adopt enum class for DragOperation Reviewed by Darin Adler. * Scripts/webkit/messages.py: - Remove FIXME now that it's not needed. * Shared/API/Cocoa/_WKDragActionsInternal.h: (WebKit::coreDragOperationMask): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::kit): * UIProcess/ios/WKContentViewInteraction.mm: (dropOperationForWebCoreDragOperation): (coreDragOperationForUIDropOperation): (-[WKContentView dragDataForDropSession:dragDestinationAction:]): 2020-06-08 Commit Queue Unreviewed, reverting r262685. https://bugs.webkit.org/show_bug.cgi?id=212914 caused flakey crashes in an iOS test Reverted changeset: "Clear WebPageProxy event state between tests" https://bugs.webkit.org/show_bug.cgi?id=212864 https://trac.webkit.org/changeset/262685 2020-06-08 Sam Weinig Extended Color: Unify rounding / clamping conversions between 0-1 float components and 0-255 byte components https://bugs.webkit.org/show_bug.cgi?id=212871 Reviewed by Simon Fraser. * UIProcess/API/ios/WKWebViewIOS.mm: (scrollViewBackgroundColor): Replaces uses of colorWithAlphaUsingAlternativeRounding() with colorWithAlpha(). 2020-06-08 Richard Houle Links in NSAttributedString passed to -[WKWebView _showSafeBrowsingWarningWithURL:title:warning:details:completionHandler:] are ignored https://bugs.webkit.org/show_bug.cgi?id=212801 Reviewed by Alex Christensen. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]): Call the new detailsWithLinks implementation, asserting if an URL is non nil. (-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:details:completionHandler:]): Ditto. (-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:detailsWithLinks:completionHandler:]): Pass the URL to the completion handler when appropriate. * UIProcess/API/Cocoa/WKWebViewPrivate.h: 2020-06-08 Per Arne Vollan [Cocoa] Adopt read-only mode for preferences in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=212411 Reviewed by Darin Adler. Change name of HAVE define to match SPI name. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): 2020-06-08 Per Arne Vollan [Cocoa] CFPrefs synchronization does not always work for global preference changes https://bugs.webkit.org/show_bug.cgi?id=212783 Reviewed by Tim Horton. In CFPrefs direct mode, synchronization of global preference changes from the UI process to the WebContent process does not always work. This is caused by the KVO notification being sent to all or some of the NSUserDefault objects, which leads us to believe a non-global preference was changed. Since a global preference change always leads to some NSUserDefaults object receiving the notification, we can work around this by checking if the preference being changed really belongs to the domain of the NSUserDefaults object, or if it is a global preference. Also, stop creating NSUserDefaults object for the global domain, since this is an error according to the docs. API test: WebKit.GlobalPreferenceChangesUsingDefaultsWrite * UIProcess/Cocoa/PreferenceObserver.mm: (-[WKUserDefaults _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:]): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::WebProcess::notifyPreferencesChanged): 2020-06-08 Wenson Hsieh [iOS] Hit-testing on icloud.com is offset after closing a tab https://bugs.webkit.org/show_bug.cgi?id=212890 Reviewed by Simon Fraser. After tapping to create a new tab on the icloud.com settings page (with no other tabs open) and then closing the new tab, all hit-testing on the page is offset by -33px until the page is reloaded. This bug appears to be a corner case triggered by a combination of the following three changes: - - - (which is an iOS-specific Safari change) We start on icloud.com's settings page. When closing the newly created tab, Safari hides the tab bar, causing both the top content inset and top obscured inset to decrease by 33 points. When applying the top content inset change, Safari (after ) temporarily sets `_automaticContentOffsetAdjustmentEnabled` on `WKScrollView` to `NO`, which means that the scroll view doesn't automatically adjust its content offset to -70; instead, it remains at -103 (the content offset when the tab bar is shown). Because of this, during the next remote layer tree commit where the content size changes, `-_setContentSizePreservingContentOffsetDuringRubberband:` will believe that we're currently rubber-banding by 33px, and therefore try to adjust the content offset of the scroll view to be -103 instead of allowing it to be adjusted back to -70 (see r170463 and `-_restoreContentOffsetWithRubberbandAmount:`). This results in the scroll position on the page (`document.scrollingElement.scrollTop`) reporting -33, even though the top of the page is flush with the bottom of Safari's browser chrome. Finally, because `WKScrollView` is made unscrollable due to `overflow: hidden;` (r245006), we end up permanently stuck in this state until the next page load, rather than the next remote layer tree commit that causes any scrolling. To fix this, add an additional restriction on the rubberbanding offset restoration code in `-_setContentSizePreservingContentOffsetDuringRubberband:`, such that we only try to preserve the current rubberbanded offset if we're actually rubberbanding (that is, dragging or bouncing against the edge of the scroll view). Note that when rubberbanding against the top of the scroll view on iPad using a trackpad, the `-isDragging` property is also true, which matches behavior when panning via touch. Test: ScrollViewInsetTests.ChangeInsetWithoutAutomaticAdjustmentWhileWebProcessIsUnresponsive * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKScrollView.mm: (-[WKScrollView _setContentSizePreservingContentOffsetDuringRubberband:]): Also, split out the `CGSizeEqualToSize(currentContentSize, contentSize)` case into a separate early return that skips the call to `-setContentSize:` altogether. 2020-06-08 Andy Estes [Apple Pay] Remove -respondsToSelector: check before calling -[PKPaymentRequest setBoundInterfaceIdentifier:] https://bugs.webkit.org/show_bug.cgi?id=212884 Reviewed by Youenn Fablet. * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Relied on the definition of HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER to ensure that PKPaymentRequest will respond to -setBoundInterfaceIdentifier:. 2020-06-08 Andy Estes [Apple Pay] Remove ENABLE_APPLE_PAY_SETUP, ENABLE_APPLE_PAY_SESSION_V7, and HAVE_PASSKIT_PAYMENT_SETUP https://bugs.webkit.org/show_bug.cgi?id=212883 Reviewed by Youenn Fablet. These macros evaluate to true whenever ENABLE(APPLE_PAY) is true on platforms supported by trunk WebKit, so we can either remove them or replace them with ENABLE(APPLE_PAY). * Shared/ApplePay/ApplePayPaymentSetupFeatures.mm: * Shared/ApplePay/ApplePayPaymentSetupFeaturesWebKit.h: * Shared/ApplePay/PaymentSetupConfiguration.mm: * Shared/ApplePay/PaymentSetupConfigurationWebKit.h: * Shared/ApplePay/WebPaymentCoordinatorProxy.h: * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: * WebProcess/ApplePay/WebPaymentCoordinator.h: 2020-06-08 youenn fablet [Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder https://bugs.webkit.org/show_bug.cgi?id=206582 Reviewed by Eric Carlson. Enable RemoteMediaRecorder only for systems supporting AVAssetWriterDelegate. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::didReceiveMessage): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/webrtc/RemoteMediaRecorder.cpp: * GPUProcess/webrtc/RemoteMediaRecorder.h: * GPUProcess/webrtc/RemoteMediaRecorder.messages.in: * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp: * GPUProcess/webrtc/RemoteMediaRecorderManager.h: * GPUProcess/webrtc/RemoteMediaRecorderManager.messages.in: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: * WebProcess/GPU/webrtc/MediaRecorderProvider.cpp: (WebKit::MediaRecorderProvider::createMediaRecorderPrivate): 2020-06-07 Lauro Moura [WebDriver] Allow platform-dependent modifier keys conversion to WebEvent::Modifier https://bugs.webkit.org/show_bug.cgi?id=212848 Reviewed by Brian Burg. WebEvent::Modifier flags does not map directly to the platform flags, so we can't directly convert the modifier flags to the OptionSet. Covered by existing WebDriver tests. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::simulateMouseInteraction): Use platform-specific method to convert the modifiers. * UIProcess/Automation/WebAutomationSession.h: * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: Added conversion from GDK modifier mask to WebEvent::Modifier. (WebKit::WebAutomationSession::platformWebModifiersFromRaw): * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Added conversion from NSModifierFlag to WebEvent::Modifier. (WebKit::WebAutomationSession::platformWebModifiersFromRaw): * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp: Added conversion from wpe_input_keyboard_modifier to WebEvent::Modifier. (WebKit::WebAutomationSession::platformWebModifiersFromRaw): 2020-06-07 Lauro Moura [WPE] Behave like GDK_CURRENT_TIME when the timestamp is zero https://bugs.webkit.org/show_bug.cgi?id=212797 WebDriver tests come with zero timestamp. So behave like GDK_CURRENT_TIME and assume zero timestamp == WallTime::now(). Reviewed by Carlos Garcia Campos. Covered by existing tests. * Shared/libwpe/WebEventFactory.cpp: (WebKit::wallTimeForEventTime): 2020-06-07 Philippe Normand Remove ENABLE_VIDEO_TRACK ifdef guards https://bugs.webkit.org/show_bug.cgi?id=212568 Reviewed by Youenn Fablet. * Configurations/FeatureDefines.xcconfig: * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::dispatchMessage): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::textTrackSetMode): (WebKit::RemoteMediaPlayerProxy::notifyTrackModeChanged): * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.messages.in: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.cpp: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.messages.in: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.messages.in: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.messages.in: * Shared/WebPreferences.yaml: * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::dispatchMessage): * WebProcess/GPU/GPUProcessConnection.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::tracksChanged): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::updatePreferences): * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp: * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.h: * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp: * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h: * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.messages.in: * WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.cpp: * WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.h: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::maximumBufferingTime): 2020-06-06 Simon Fraser Clear WebPageProxy event state between tests https://bugs.webkit.org/show_bug.cgi?id=212864 Reviewed by Anders Carlsson. Make sure that event state doesn't leak between tests via events queued in WebPageProxy. * UIProcess/API/C/WKPage.cpp: (WKPageClearEventState): * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetStateAfterProcessExited): (WebKit::WebPageProxy::clearEventState): * UIProcess/WebPageProxy.h: 2020-06-06 Rob Buis Move URL scheme check to NetworkLoadChecker https://bugs.webkit.org/show_bug.cgi?id=191924 Reviewed by Joseph Pecoraro. Reduce includes for CustomHeaderFields, I guess these were needed at some point but not anymore. * Shared/WebsitePoliciesData.cpp: 2020-06-06 David Kilzer Use OptionSet for mask values Reviewed by Darin Adler. In broad strokes: - Replace use of DragOperation with OptionSet or Optional. - Rename function parameters and local variables to denote use of mask values. - Remove DragOperationNone enum value. - Replace DragOperationEvery enum value with anyDragOperation(). * Platform/spi/ios/UIKitSPI.h: (UIDragOperation): - Remove unused (and misnamed) UIDragOperation enum typedef. * Scripts/webkit/messages.py: (types_that_cannot_be_forward_declared): (headers_for_type): - Add support for WebCore::DragOperation enum. * Shared/API/Cocoa/_WKDragActionsInternal.h: (WebKit::coreDragOperationMask): Add conversion function. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): - Update to encode/decode OptionSet. * UIProcess/API/gtk/DragSource.h: (WebKit::DragSource::begin): * UIProcess/API/gtk/DragSourceGtk3.cpp: (WebKit::DragSource::begin): * UIProcess/API/gtk/DragSourceGtk4.cpp: (WebKit::DragSource::begin): * UIProcess/API/gtk/DropTarget.h: * UIProcess/API/gtk/DropTargetGtk3.cpp: (WebKit::DropTarget::didPerformAction): (WebKit::DropTarget::leaveTimerFired): * UIProcess/API/gtk/DropTargetGtk4.cpp: (WebKit::DropTarget::DropTarget): (WebKit::DropTarget::didPerformAction): * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::startDrag): * UIProcess/API/gtk/PageClientImpl.h: (WebKit::PageClientImpl::startDrag): * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseStartDrag): * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: (webkitWebViewBaseStartDrag): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::sendDragEndToPage): (WebKit::WebViewImpl::draggingEntered): (WebKit::kit): Add conversion function. (WebKit::WebViewImpl::draggingUpdated): (WebKit::WebViewImpl::draggingExited): (WebKit::WebViewImpl::performDragOperation): - Make use of coreDragOperationMask() conversion function. * UIProcess/PageClient.h: (WebKit::WebViewImpl::startDrag): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didPerformDragControllerAction): - Remove MESSAGE_CHECK now that we're using the actual type. (WebKit::WebPageProxy::startDrag): (WebKit::WebPageProxy::dragEnded): (WebKit::WebPageProxy::resetCurrentDragInformation): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::didPerformDragControllerAction): (WebKit::WebPageProxy::dragEnded): (WebKit::WebPageProxy::startDrag): (WebKit::WebPageProxy::currentDragOperation const): * UIProcess/WebPageProxy.messages.in: (WebPageProxy::DidPerformDragControllerAction): (WebPageProxy::StartDrag): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _didHandleDragStartRequest:]): (dropOperationForWebCoreDragOperation): (coreDragOperationForUIDropOperation): Add conversion function. - Note that this was not being converted from UIDropOperation to WebCore::DragOperation previously, and UIDropOperationMove (0x3) was not being properly converted to DragOperationMove (0x16). (-[WKContentView dragDataForDropSession:dragDestinationAction:]): (-[WKContentView _didPerformDragOperation:]): (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]): (-[WKContentView dragInteraction:session:didEndWithOperation:]): (-[WKContentView dropInteraction:sessionDidEnd:]): * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp: (WebKit::WebDragClient::startDrag): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::performDragControllerAction): (WebKit::WebPage::dragEnded): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::performDragControllerAction): (WebKit::WebPage::dragEnded): * WebProcess/WebPage/WebPage.messages.in: (WebPage::PerformDragControllerAction): (WebPage::DragEnded): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestAdditionalItemsForDragSession): 2020-06-06 Devin Rousso Web Inspector: unify the naming scheme for agents used by instrumentation https://bugs.webkit.org/show_bug.cgi?id=212859 Reviewed by Timothy Hatcher. Inspector agents fall into one of three categories: - "persistent" when Web Inspector is connected - "enabled" when that agent is `enable`d, such as if the corresponding tab is visible - "tracking" when that agent is part of a timeline recording. The only exception to this is the Console agent, as that exists regardless of whether Web Inspector is connected as it needs to preserve messages logged before Web Inspector connects. Also remove the "Inspector" prefix from getter/setter methods as it adds confusion if that agent also has subclasses (e.g. `InspectorRuntimeAgent` and `PageRuntimeAgent`). * UIProcess/Inspector/Agents/InspectorBrowserAgent.cpp: * UIProcess/Inspector/WebInspectorProxy.cpp: * UIProcess/Inspector/WebPageInspectorController.h: Simple naming changes elided to avoid a long ChangeLog. 2020-06-05 David Kilzer [IPC] Adopt enum class for AutocapitalizeType Reviewed by Darin Adler. Summary: - Move AutocapitalizeType into WebCore namespace. - Convert AutocapitalizeType to an enum class. - Add WTF::EnumTraits for IPC. * Shared/FocusedElementInformation.cpp: (WebKit::FocusedElementInformation::encode const): (WebKit::FocusedElementInformation::decode): - Stop using decodeEnum() and encodeEnum() now that WTF::EnumTraits exists. * Shared/FocusedElementInformation.h: * Shared/glib/InputMethodState.cpp: (WebKit::InputMethodState::addHintsForAutocapitalizeType): * Shared/glib/InputMethodState.h: * UIProcess/ios/WKContentViewInteraction.mm: (toUITextAutocapitalize): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getFocusedElementInformation): 2020-06-05 Brent Fulgham [iOS] Silence telemetry generated during download operations https://bugs.webkit.org/show_bug.cgi?id=212854 Reviewed by Per Arne Vollan. Remove reporting and telemetry for the 'com.apple.ProgressReporting' service from the Network Process sandbox, since this is a critical part of supplying download status to the WebKit UI. * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: 2020-06-05 Ryan Haddad Unreviewed, reverting r262619, r262625, and r262641. Caused mediarecorder layout test crashes. Reverted changesets: "[Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder" https://bugs.webkit.org/show_bug.cgi?id=206582 https://trac.webkit.org/changeset/262619 "[Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder" https://bugs.webkit.org/show_bug.cgi?id=206582 https://trac.webkit.org/changeset/262625 "Unreviewed, silence deprecation warning to fix build with latest SDK." https://trac.webkit.org/changeset/262641 2020-06-05 Kate Cheney ITP SQLite Database should only vacuum once per day https://bugs.webkit.org/show_bug.cgi?id=212712 Reviewed by Brent Fulgham. Followup to https://trac.webkit.org/changeset/262538/webkit. We should run incremental auto vacuum, not a full vacuum, once per-day, because it is less expensive. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::performDailyTasks): 2020-06-05 Daniel Bates -_focusTextInputContext should reposition the caret if called for an already focused text input context https://bugs.webkit.org/show_bug.cgi?id=212830 Reviewed by Wenson Hsieh. Update the code based on new feedback: the caret should now be re-positioned when -_focusTextInputContext is called on an already assisted text input context. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): (-[WKContentView _didCommitLoadForMainFrame]): Reset state. See below for why. (-[WKContentView _focusTextInputContext:placeCaretAt:completionHandler:]): I cannot simply remove the early return in -_focusTextInputContext that detects if the specified text input context is already focused because it could effect user-visible responsiveness due to an Apple internal client invoking this function more times than necessary with the same point during a text interaction. See . That radar represents a correctness issue. I didn't actually evaluate whether responsiveness is affected by this patch, but I would feel more confident that there would be 0 impact when removing the early branch after that radar is fixed without the need to even perform a responsiveness analysis. Note that there is already a comment about that radar at the top of this function. 2020-06-05 Alex Christensen Fix PDF opening after r262592 https://bugs.webkit.org/show_bug.cgi?id=212795 * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication): (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication): As Darin mentioned and I was about to discover, my last-minute switching things around got the boolean condition backwards. We want to do nothing if we're not allowed to open the PDF, and we want to open the PDF if we are allowed to.s 2020-06-05 David Kilzer [IPC] Adopt enum class for PluginLoadClientPolicy Reviewed by Alex Christensen. Summary: - Update for renamed PluginLoadClientPolicy enums. - Update to make PluginLoadClientPolicy type work with IPC. - Replace uint8_t with strongly-typed PluginLoadClientPolicy. * Scripts/webkit/messages.py: * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm: (WebKit::NetscapePluginModule::getPluginInfo): * Shared/WebProcessCreationParameters.h: * UIProcess/API/C/WKAPICast.h: (WebKit::toWKPluginLoadClientPolicy): (WebKit::toPluginLoadClientPolicy): * UIProcess/API/Cocoa/WKProcessPool.mm: (toPluginLoadClientPoliciesHashMap): (policiesHashMapToDictionary): (isPluginLoadClientPolicyAcceptable): Delete. - Replace with WTF::isValidEnum(). * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::setPluginLoadClientPolicy): (WebKit::WebProcessPool::resetPluginLoadClientPolicies): * UIProcess/WebProcessPool.h: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::pluginInfo): * WebProcess/Plugins/WebPluginInfoProvider.cpp: (WebKit::WebPluginInfoProvider::webVisiblePluginInfo): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setPluginLoadClientPolicy): (WebKit::WebProcess::resetPluginLoadClientPolicies): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2020-06-05 Alex Christensen Update header documentation for WKPreferences.fraudulentWebsiteWarningEnabled https://bugs.webkit.org/show_bug.cgi?id=212843 Reviewed by Geoffrey Garen. * UIProcess/API/Cocoa/WKPreferences.h: 2020-06-05 Brent Fulgham [iOS] Remove message filtering telemetry for expected case https://bugs.webkit.org/show_bug.cgi?id=212841 Reviewed by Per Arne Vollan. Remove unintentional telemetry being captured for expected behavior. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-06-05 Per Arne Vollan [Cocoa] Adopt read-only mode for preferences in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=212411 Reviewed by Darin Adler. The WebContent process should never write preferences. Adopt read-only mode for preferences. This will fix some sandbox violations when the UI process is notifying the WebContent process about preference changes. When notified, the WebContent process will use the preferences API to write those preferences in-process, but there should be no attempt at writing these new values to disk, which this patch will ensure. No new tests, since this is fixing a benign sandbox violation. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): 2020-06-05 Per Arne Vollan [iOS] Fix message filter sandbox violation https://bugs.webkit.org/show_bug.cgi?id=212837 Reviewed by Darin Adler. Add required message to message filter in the iOS WebContent sandbox. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-06-05 Peng Liu REGRESSION (r262456?): [macOS] media/picture-in-picture/picture-in-picture-api tests are flaky timeouts https://bugs.webkit.org/show_bug.cgi?id=212762 Reviewed by Eric Carlson. The Picture-in-Picture implementation expects the two callbacks HTMLVideoElement::didBecomeFullscreenElement() and HTMLVideoElement::setVideoFullscreenFrame() to come in order. So we need to remove the dispatch_async() and call HTMLVideoElement::didBecomeFullscreenElement() directly. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::didEnterFullscreen): 2020-06-05 Adrian Perez de Castro Non-unified build fixes, early summer 2020 edition https://bugs.webkit.org/show_bug.cgi?id=212819 Unreviewed build fix. * Shared/gtk/NativeWebMouseEventGtk.cpp: (WebKit::NativeWebMouseEvent::NativeWebMouseEvent): Add missing WebCore:: namespace to a couple of uses of WebCore::FloatSize. * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: Add missing Logging.h header. 2020-06-05 Andy Estes [Apple Pay] Remove conditionals for ENABLE_APPLE_PAY_SESSION_V(3|4) https://bugs.webkit.org/show_bug.cgi?id=212541 Reviewed by Darin Adler. APPLE_PAY_SESSION_V(3|4) is now enabled whenever APPLE_PAY itself is enabled. * Configurations/FeatureDefines.xcconfig: 2020-06-05 youenn fablet [Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder https://bugs.webkit.org/show_bug.cgi?id=206582 Reviewed by Eric Carlson. Enable RemoteMediaRecorder only for systems supporting AVAssetWriterDelegate. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::didReceiveMessage): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/webrtc/RemoteMediaRecorder.cpp: * GPUProcess/webrtc/RemoteMediaRecorder.h: * GPUProcess/webrtc/RemoteMediaRecorder.messages.in: * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp: * GPUProcess/webrtc/RemoteMediaRecorderManager.h: * GPUProcess/webrtc/RemoteMediaRecorderManager.messages.in: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: * WebProcess/GPU/webrtc/MediaRecorderProvider.cpp: (WebKit::MediaRecorderProvider::createMediaRecorderPrivate): 2020-06-05 Carlos Garcia Campos REGRESSION(r262184): [GTK] Two fast/forms tests are crashing https://bugs.webkit.org/show_bug.cgi?id=212747 Reviewed by Adrian Perez de Castro. * UIProcess/gtk/WebPopupMenuProxyGtk.cpp: (WebKit::WebPopupMenuProxyGtk::handleKeyPress): Return early if the menu has already been closed. 2020-06-05 Youenn Fablet Generate code to set the runtime settings for a service worker process https://bugs.webkit.org/show_bug.cgi?id=212467 Reviewed by Alex Christensen. Split the code generated to handle web preference changes to have one method for process wide flags and one for page settings. Make the process wide flag method static and reuse it in WebSWContextManagerConnection. Covered by existing tests. * Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::updatePreferencesStore): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): * WebProcess/WebPage/WebPage.h: 2020-06-04 David Kilzer [IPC] Adopt enum class for PluginProcessType and PluginProcessSandboxPolicy Reviewed by Darin Adler. * PluginProcess/mac/PluginProcessMac.mm: (WebKit::PluginProcess::platformInitializePluginProcess): * Scripts/webkit/messages.py: * Shared/Plugins/PluginProcessAttributes.h: (WebKit::PluginProcessType): Convert to enum class. (WebKit::PluginProcessSandboxPolicy): Ditto. * UIProcess/Plugins/PluginProcessManager.cpp: (WebKit::PluginProcessManager::fetchWebsiteData): (WebKit::PluginProcessManager::deleteWebsiteData): (WebKit::PluginProcessManager::deleteWebsiteDataForHostNames): * UIProcess/Plugins/PluginProcessProxy.cpp: (WebKit::PluginProcessProxy::didFinishLaunching): * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::findPlugin): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::createPlugin): (WebKit::WebPage::canPluginHandleResponse): 2020-06-04 Alex Christensen Add WKUIDelegate SPI to confirm before opening a PDF https://bugs.webkit.org/show_bug.cgi?id=212795 Reviewed by Tim Horton. * UIProcess/API/APIUIClient.h: (API::UIClient::confirmPDFOpening): * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::UIDelegate::UIClient::confirmPDFOpening): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication): (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication): (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::openWithNativeApplication): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::savePDFToTemporaryFolderAndOpenWithNativeApplication): * WebProcess/WebPage/WebPage.h: 2020-06-04 Chris Dumez UIProcess may crash after its prewarmed WebProcess gets terminated https://bugs.webkit.org/show_bug.cgi?id=212790 Reviewed by Geoffrey Garen. Query WebProcessProxy::isDummyProcessProxy() because trying to look up the process in m_dummyProcessProxies. The key for m_dummyProcessProxies is a sessionID but not all processes have a sessionID. In particular, prewarmed web processes have no associated WebsiteDataStore and thus not sessionID. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::disconnectProcess): 2020-06-04 Brent Fulgham Reduce telemetry and report generation for WebContent Process sandbox https://bugs.webkit.org/show_bug.cgi?id=212779 Reviewed by Per Arne Vollan. This patch cleans up a set of telemetry and reports generated during normal WebKit operation. Now that we understand the uses of these XPC services, we can reduce the logging traffic. This is important to do now, since generating the telemetry and reports has a non-zero power cost. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2020-06-04 Jiewen Tan Disable CFNetwork AppSSO interception for Mac Catalyst https://bugs.webkit.org/show_bug.cgi?id=212787 Reviewed by Chris Dumez. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): 2020-06-04 Brent Fulgham Reduce telemetry and report generation for Network Process sandbox https://bugs.webkit.org/show_bug.cgi?id=212778 Reviewed by Per Arne Vollan. This patch cleans up a set of telemetry and reports generated during normal WebKit operation. Now that we understand the uses of these XPC services, we can reduce the logging traffic. This is important to do now, since telemetry and report generation has battery life and performance impact. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: 2020-06-04 Jacob Uphoff Unreviewed, reverting r262546. This commit caused internal build failures Reverted changeset: "[Cocoa] Adopt read-only mode for preferences in the WebContent process" https://bugs.webkit.org/show_bug.cgi?id=212411 https://trac.webkit.org/changeset/262546 2020-06-04 Chris Dumez [iOS] Drop DependentProcessLink ProcessAssertion as it creates power leaks https://bugs.webkit.org/show_bug.cgi?id=212768 Reviewed by Alex Christensen. Drop DependentProcessLink ProcessAssertion since it creates a process assertion cycle between the UIProcess and the WebContent process and leads to power leaks. * 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): * UIProcess/ProcessAssertion.h: * UIProcess/ProcessThrottler.cpp: (WebKit::ProcessThrottler::assertionName const): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didSetAssertionType): * UIProcess/ios/ProcessAssertionIOS.mm: (WebKit::runningBoardNameForAssertionType): (WebKit::flagsForAssertionType): (WebKit::toBKSProcessAssertionReason): * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-06-04 Brent Fulgham Revise sandbox to support network stack telemetry without sandbox violation reports https://bugs.webkit.org/show_bug.cgi?id=212720 Reviewed by Per Arne Vollan. Telemetry captured for various networking configurations has revealed a handful of mach service connections that should be allowed in the Network Process to support troubleshooting and field diagnostics. This patch revises the sandbox to avoid logging these accesses during normal operation. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: Do not generate traces for 'com.apple.diagnosticd'. * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Ditto. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: Allow 'com.apple.osanalytics.osanalyticshelper' to be used on internal development builds. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): Update to handle both 'diagnosticd' and 'osanalyticshelper' as optional services for internal builds. (WebKit::WebProcessCreationParameters::decode): Ditto. * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::diagnosticServices): Ditto. (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Ditto. 2020-06-04 Per Arne Vollan [Cocoa] Adopt read-only mode for preferences in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=212411 Reviewed by Darin Adler. The WebContent process should never write preferences. Adopt read-only mode for preferences. This will fix some sandbox violations when the UI process is notifying the WebContent process about preference changes. When notified, the WebContent process will use the preferences API to write those preferences in-process, but there should be no attempt at writing these new values to disk, which this patch will ensure. No new tests, since this is fixing a benign sandbox violation. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): 2020-06-04 Per Arne Vollan [iOS] The WebContent process should be allowed to consume an extension to the runningboard service https://bugs.webkit.org/show_bug.cgi?id=212753 Reviewed by Chris Dumez. The WebContent process on iOS is failing to consume an extension to the runningboard service, because it is not allowed to do so. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-06-04 Tim Horton Work around broken system version macro https://bugs.webkit.org/show_bug.cgi?id=212726 Reviewed by Dan Bernstein. * Configurations/DebugRelease.xcconfig: 2020-06-04 Andy Estes [watchOS] Re-enable content filtering in the simulator build https://bugs.webkit.org/show_bug.cgi?id=212711 Reviewed by Wenson Hsieh. * Configurations/FeatureDefines.xcconfig: 2020-06-04 Kate Cheney ITP SQLite Database should only vacuum once per day https://bugs.webkit.org/show_bug.cgi?id=212712 Reviewed by Brent Fulgham. Currently the SQLite Database runs a vacuum command each time statistics are processed. This is probably too frequent, because the database rarely needs to delete large amounts of data. We can cut this down to once a day. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::performDailyTasks): 2020-06-04 Youenn Fablet Minor optimisation to RemoteAudioBusData::decode https://bugs.webkit.org/show_bug.cgi?id=212692 Reviewed by Eric Carlson. * WebProcess/GPU/media/RemoteAudioBusData.h: (WebKit::RemoteAudioBusData::decode): Use releaseNonNull to remove some count churn. 2020-06-03 Wenson Hsieh [watchOS] fast/events/watchos/change-focus-during-change-event.html crashes https://bugs.webkit.org/show_bug.cgi?id=212722 Reviewed by Andy Estes. When HAVE(QUICKBOARD_COLLECTION_VIEWS) is enabled, the codepath that's used to simulate interacting with the select menu view controller on watchOS will crash, since it tries to pretend that the user has selected an item in a table view section (`PUICQuickboardListSectionTextOptions`) that only exists when Quickboard collection views are disabled. Fix the crash by adjusting the testing codepath to select the item in the first section when HAVE(QUICKBOARD_COLLECTION_VIEWS) is defined. * UIProcess/ios/forms/WKSelectMenuListViewController.mm: (-[WKSelectMenuListViewController selectItemAtIndex:]): 2020-06-03 Jer Noble [iOS] Hide the PiP button in fullscreen mode if PiP is disabled in preferences https://bugs.webkit.org/show_bug.cgi?id=212699 Reviewed by Eric Carlson. In r260474, we hid the PiP button in fullscreen when PiP was unsupported on the current device; we must also hide the PiP button when clients have disabled PiP via preferences. * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: (-[WKFullScreenViewController videoControlsManagerDidChange]): 2020-06-03 Kate Cheney Any active sqlite transactions for the ITP database should be aborted when the network process suspends. https://bugs.webkit.org/show_bug.cgi?id=212608 Reviewed by Chris Dumez. Calls to WebResourceLoadStatisticsStore::suspend() should abort any active SQLite transactions. Unfinished transactions will hold the lock of a database file and could cause the network process to crash when suspending. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::~ResourceLoadStatisticsDatabaseStore): Store all ResourceLoadStatisticsDatabaseStore instances in a static HashSet so existing transactions can be aborted when the process is preparing to suspend. (WebKit::ResourceLoadStatisticsDatabaseStore::interrupt): * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::suspend): 2020-06-03 Chris Dumez WebProcessPool::notifyPreferencesChanged() is unsafely called on a background thread https://bugs.webkit.org/show_bug.cgi?id=212697 Reviewed by Per Arne Vollan. Make sure we dispatch to the main thread in [WKPreferenceObserver preferenceDidChange] before we iterate over the process pools and call WebProcessPool::notifyPreferencesChanged() on each one. * UIProcess/Cocoa/PreferenceObserver.mm: (-[WKPreferenceObserver preferenceDidChange:key:encodedValue:]): 2020-06-03 Brent Fulgham [iOS] Reduce sandbox logging by permitting necessary sysctl https://bugs.webkit.org/show_bug.cgi?id=212710 Reviewed by Per Arne Vollan. Telemetry indicates that we need to access "sysctl.name2oid" in the Network process during error handling for HTTP connections. Allow this access and avoid generating unnecessary logging for this case. * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: 2020-06-03 Youenn Fablet Add more logging related to service worker fetch event handling https://bugs.webkit.org/show_bug.cgi?id=212632 Unreviewed. Build fix. * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: (WebKit::WebServiceWorkerFetchTaskClient::continueDidReceiveResponse): 2020-06-03 Alex Christensen Pass WebPageProxyIdentifier to PreconnectTask https://bugs.webkit.org/show_bug.cgi?id=212648 Reviewed by Chris Dumez. Otherwise, AuthenticationManager::didReceiveAuthenticationChallenge sometimes returned early because there was no pageID. Observed connecting to real websites from my home wifi. Unable to test using local servers because connecting happens too fast. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::preconnectTo): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::preconnectTo): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::preconnectTo): 2020-06-03 Rob Buis Make generated C++ code use modern C++ https://bugs.webkit.org/show_bug.cgi?id=190714 Reviewed by Jonathan Bedard. Replace typedef usage by alias-declaration. * Scripts/test-legacyMessages.h: * Scripts/test-superclassMessages.h: * Scripts/testMessages.h: * Scripts/webkit/messages.py: 2020-06-03 Carlos Garcia Campos [GTK4] WTR: Forward key events to the active popup menu https://bugs.webkit.org/show_bug.cgi?id=212690 Reviewed by Adrian Perez de Castro. I forgot to remove the ifdefs when added support for popup menus in r262414. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSynthesizeKeyEvent): 2020-06-03 Carlos Garcia Campos [GTK4] Fix input methods https://bugs.webkit.org/show_bug.cgi?id=212317 Reviewed by Adrian Perez de Castro. Stop using GdkEvent to synthesize compositing events, add a specific NativeWebKeyboardEvent constructor for them. * Shared/NativeWebKeyboardEvent.h: * Shared/gtk/NativeWebKeyboardEventGtk.cpp: (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): * UIProcess/API/gtk/WebKitInputMethodContextImplGtk.cpp: (webkitInputMethodContextImplGtkSetClientWidget): (webkitInputMethodContextImplGtkSetClientWindow): Deleted. * UIProcess/API/gtk/WebKitInputMethodContextImplGtk.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseRealize): (webkitWebViewBaseUnrealize): (webkitWebViewBaseKeyPressEvent): (webkitWebViewBaseKeyReleaseEvent): (webkitWebViewBaseFocusEnter): (webkitWebViewBaseFocusLeave): (webkitWebViewBaseKeyPressed): (webkitWebViewBaseKeyReleased): (toplevelWindowIsActiveChanged): (webkitWebViewBaseSynthesizeCompositionKeyPress): 2020-06-03 Santosh Mahto [GTK4] Implement file chooser https://bugs.webkit.org/show_bug.cgi?id=212322 Reviewed by Carlos Garcia Campos. Port FileChooser to gtk4, Now FileChooser uses undeprecated api's. Covered by existing tests. * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (fileChooserDialogResponseCallback): (webkitWebViewRunFileChooser): 2020-06-03 Carlos Garcia Campos [GTK4] Implement emoji chooser https://bugs.webkit.org/show_bug.cgi?id=212330 Reviewed by Adrian Perez de Castro. GtkEmojiChooser is public API in GTK4, so just use that instead of our own. * UIProcess/API/gtk/WebKitEmojiChooser.cpp: (emojiActivated): Close the popover before emitting emoji-picked for consistency with GTK. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate): (_WebKitWebViewBasePrivate::releaseEmojiChooserTimerFired): (webkitWebViewBaseDispose): (emojiChooserClosed): (webkitWebViewBaseShowEmojiChooser): 2020-06-03 Youenn Fablet Add more logging related to service worker fetch event handling https://bugs.webkit.org/show_bug.cgi?id=212632 Reviewed by Chris Dumez. Add logging to identify the page ID and frame ID used by a service worker. Add logging to identify what is happening in the case of a response being buffered for navigation purposes. * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::ServiceWorkerFrameLoaderClient::ServiceWorkerFrameLoaderClient): (WebKit::WebSWContextManagerConnection::installServiceWorker): (WebKit::WebSWContextManagerConnection::continueDidReceiveFetchResponse): * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: (WebKit::WebServiceWorkerFetchTaskClient::didFail): (WebKit::WebServiceWorkerFetchTaskClient::didFinish): (WebKit::WebServiceWorkerFetchTaskClient::continueDidReceiveResponse): 2020-06-02 Chris Dumez [iOS] WKProcessAssertionBackgroundTaskManager incorrectly ignores expiration notifications for daemons https://bugs.webkit.org/show_bug.cgi?id=212619 Reviewed by Alex Christensen. WKProcessAssertionBackgroundTaskManager was incorrectly ignoring process assertion expiration notifications for daemons, because it was relying on visibility to make decisions. For daemons (or ViewServices), we would not get application visibility notifications and would therefore always assume the app is visible. As a result, _handleBackgroundTaskExpiration would think it received an outdated expiration notification for a visible app and would simply re-take the assertion right away. To address the issue, we now rely on a RunningBoard API that lets us know if the suspension timer has been started or not (and how much remains on the timer). If the suspension timer is not active when get receive the expiration notification, we know it is an outdated notification and we ignore it (release and re-take assertion right away). This can happen if we did not have time to process the expiration notification before suspended and thus only get it upon resuming. It can also happen if the user re-activates the app right after the expiration notice has been sent. * Platform/spi/ios/RunningBoardServicesSPI.h: * UIProcess/ios/ProcessAssertionIOS.mm: (processHasActiveRunTimeLimitation): (-[WKProcessAssertionBackgroundTaskManager init]): (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]): (-[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpiration]): (-[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpirationOnMainThread]): (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]): 2020-06-02 Christopher Reid REGRESSION[r260844]: [GTK][WPE] Inspector GResource no longer updated after WebInspectorUI file updates https://bugs.webkit.org/show_bug.cgi?id=212583 Reviewed by Adrian Perez de Castro. Add a cmake dependency on inspector resource stamp so the Glib Inspector resources rebuild when the stamp is updated. * InspectorGResources.cmake: 2020-06-02 Keith Rollin Revert FEATURES_DEFINES related changes https://bugs.webkit.org/show_bug.cgi?id=212664 Reviewed by Andy Estes. Bug 262310, Bug 262311, Bug 262318, and Bug 262331 involve changes to FEATURE_DEFINES and how the values there relate to those found in the Platform*.h files. Those changes break XCBuild (by removing the .xcfilelist related to UnifiedSources and the process for generating them), and so are being reverted. * Configurations/FeatureDefines.xcconfig: 2020-06-02 Ryan Haddad Unreviewed, reverting r262424. Caused webkitpy test failure Reverted changeset: "Make generated C++ code use modern C++" https://bugs.webkit.org/show_bug.cgi?id=190714 https://trac.webkit.org/changeset/262424 2020-06-02 Peng Liu Stressing webkitSetPresentationMode leads to wrong inline video dimensions https://bugs.webkit.org/show_bug.cgi?id=202425 Reviewed by Eric Carlson. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didCleanupFullscreen): 2020-06-02 Kate Cheney Assert network process is not suspended when trying to merge new ITP data https://bugs.webkit.org/show_bug.cgi?id=212663 Reviewed by Chris Dumez. Add a debug assert to check if statistics are being merged into the ITP database after prepareToSuspend() has been called. If this assert is hit, it means the ITP database thread is not being stopped when the process is suspended. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated): 2020-06-02 Per Arne Vollan REGRESSION(r261387): Introduced sandbox violations https://bugs.webkit.org/show_bug.cgi?id=212634 Reviewed by Darin Adler. The change set r261387 introduced some new mach lookup sandbox violations, when attempting to close Launch Services connections that were not open. Fix this by only attempting to close open connections, and do it while holding the extension to the database mapping service. No new tests, since this patch is fixing benign sandbox violations. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-06-02 Youenn Fablet Allow using web processes for service workers even though they loaded about URLs https://bugs.webkit.org/show_bug.cgi?id=212464 Reviewed by Chris Dumez. Before the patch, a web process that loads about:blank will not be able to run service workers. A web process that is running service workers and is loading an about:blank page will also kill its service workers. To prevent this, do not take into account about:blank URLs for the computation of the registrable domain of a process. Covered by API tests. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame): 2020-06-02 Tim Horton macCatalyst: WKWebView's tint color is not propagated to Web Content process https://bugs.webkit.org/show_bug.cgi?id=212630 Reviewed by Anders Carlsson. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/Cocoa/PageClientImplCocoa.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: 2020-06-02 Tim Horton REGRESSION (r258949): Dynamic user accent color changes are not respected by WKWebView https://bugs.webkit.org/show_bug.cgi?id=212628 Reviewed by Per Arne Vollan. Two issues with the "CFPrefs Direct Mode" mechanism caused dynamic changes to the user accent color preference to not be respected anymore: - the default change, when synchronized to the Web Content process, was written into the wrong domain, because of bug 212627. - AppKit caches the resolved accent color; the cache is invalidated when the a CoreUI notification is posted. Since we synchronize preferences ourselves, the ordering of the default change and notification are no longer guaranteed, so AppKit sometimes reads and re-caches the old accent color. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::userAccentColorPreferenceKey): (WebKit::shouldWriteToAppDomainForPreferenceKey): (WebKit::WebProcess::notifyPreferencesChanged): To fix the first problem, write the default into the standardUserDefaults. This is just a workaround, we need a more general solution to this problem for all global preferences. We know it's OK in this case, because AppKit happens to read from standardUserDefaults. (WebKit::dispatchSimulatedNotificationsForPreferenceChange): To fix the second problem, re-emit the notification once we have synchronized the preference to the Web Content process. 2020-06-02 Rob Buis Make generated C++ code use modern C++ https://bugs.webkit.org/show_bug.cgi?id=190714 Reviewed by Sam Weinig. Replace typedef usage by alias-declaration. * Scripts/webkit/messages.py: 2020-06-02 Carlos Garcia Campos [GTK4] Implement data list drop down menu https://bugs.webkit.org/show_bug.cgi?id=212333 Reviewed by Adrian Perez de Castro. Use a GtkPopover for GTK4 instead of a GtkMenu. * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::createDataListSuggestionsDropdown): * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp: (WebKit::WebDataListSuggestionsDropdownGtk::WebDataListSuggestionsDropdownGtk): (WebKit::WebDataListSuggestionsDropdownGtk::~WebDataListSuggestionsDropdownGtk): (WebKit::WebDataListSuggestionsDropdownGtk::show): * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.h: 2020-06-02 Carlos Garcia Campos [GTK4] Make popup menus work https://bugs.webkit.org/show_bug.cgi?id=211178 Reviewed by Adrian Perez de Castro. Use a GtkPopover for GTK4 instead of a GtkMenu. * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::createPopupMenuProxy): * UIProcess/API/gtk/WebKitPopupMenu.cpp: (WebKit::WebKitPopupMenu::WebKitPopupMenu): (WebKit::menuCloseCallback): (WebKit::WebKitPopupMenu::showPopupMenu): (WebKit::WebKitPopupMenu::hidePopupMenu): (WebKit::WebKitPopupMenu::cancelTracking): (WebKit::WebKitPopupMenu::activateItem): * UIProcess/API/gtk/WebKitPopupMenu.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSizeAllocate): Iterate children and call check_resize on every native one. * UIProcess/gtk/WebPopupMenuProxyGtk.cpp: (WebKit::WebPopupMenuProxyGtk::treeViewButtonReleaseEventCallback): (WebKit::WebPopupMenuProxyGtk::createPopupMenu): (WebKit::WebPopupMenuProxyGtk::showPopupMenu): (WebKit::WebPopupMenuProxyGtk::hidePopupMenu): (WebKit::WebPopupMenuProxyGtk::treeViewRowActivatedCallback): Deleted. * UIProcess/gtk/WebPopupMenuProxyGtk.h: 2020-06-01 Chris Dumez Fix thread-safety issue in [WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpiration] https://bugs.webkit.org/show_bug.cgi?id=212615 Reviewed by Geoffrey Garen. [WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpiration] may get called on a background thread by RunningBoard. When this happened it would check the _applicationIsBackgrounded flag on a background thread, which was not safe, it would also call _releaseBackgroundTask on the background thread which definitely was not safe and could lead to crashes such as the one in the radar. To address the issue, we now call callOnMainRunLoopAndWait() as soon as _handleBackgroundTaskExpiration gets called and run the whole implementation on the main thread. Previously, we were already doing a dispatch_sync() to the main thread but only for part of the implementation. * UIProcess/ios/ProcessAssertionIOS.mm: (-[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpiration]): (-[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpirationOnMainThread]): 2020-06-01 Brent Fulgham Remove unused WebContent process sandbox syscall https://bugs.webkit.org/show_bug.cgi?id=212609 Reviewed by Per Arne Vollan. After further testing we have determined that the syscall added in Bug 206260 is not always enabled. Check if the Sandbox recognizes the rule before using it. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2020-06-01 David Kilzer Don't use casts to convert between WebCore::DragDestinationAction and {Web,WK}DragDestinationAction types Reviewed by Darin Adler. * Shared/API/Cocoa/_WKDragActionsInternal.h: Add. (WebKit::coreDragDestinationActionMask): - Add conversion function to avoid casting. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::draggingEntered): (WebKit::WebViewImpl::draggingUpdated): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView dragDataForDropSession:dragDestinationAction:]): - Make use of coreDragDestinationActionMask() conversion function. - Extract `dragOperationMask` varible for future updates. * WebKit.xcodeproj/project.pbxproj: - Add _WKDragActionsInternal.h to project. 2020-06-01 Alex Christensen Fix Glib build after r262391 https://bugs.webkit.org/show_bug.cgi?id=212604 * UIProcess/API/glib/WebKitWebContext.cpp: (webkitWebContextConstructed): 2020-06-01 Alex Christensen Revert r250312 https://bugs.webkit.org/show_bug.cgi?id=212604 Reviewed by Tim Horton. r250312 was a step towards a network process singleton. We aren't there yet, so revert it until we are. There was something trying to keep HSTS storages separate, so let them keep trying. * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration setHSTSStorageDirectory:]): (-[_WKProcessPoolConfiguration hstsStorageDirectory]): * UIProcess/LegacyGlobalSettings.h: (WebKit::LegacyGlobalSettings::setHSTSStorageDirectory): Deleted. (WebKit::LegacyGlobalSettings::hstsStorageDirectory const): Deleted. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): 2020-06-01 Chris Dumez ASSERTION FAILURE (r220931): !m_function in ~CompletionHandler() after switch tabs https://bugs.webkit.org/show_bug.cgi?id=212537 Reviewed by Alex Christensen. When WebPage::markAllLayersVolatile(), it would destroy m_pageMarkingLayersAsVolatileCounter, which may not have called its completion handler yet. As a result, we would hit an assertion in the CompletionHandler destructor. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::callVolatilityCompletionHandlers): (WebKit::WebPage::markLayersVolatile): (WebKit::WebPage::cancelMarkLayersVolatile): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::markLayersVolatile): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::prepareToSuspend): (WebKit::WebProcess::markAllLayersVolatile): (WebKit::WebProcess::cancelMarkAllLayersVolatile): * WebProcess/WebProcess.h: 2020-06-01 Sam Weinig Extended Color: Replace Color constructors taking numeric values with type specific factory functions https://bugs.webkit.org/show_bug.cgi?id=212576 Reviewed by Tim Horton. Replaces all remaining implicit and explicit uses of the Color constructors taking numeric values with explicit calls to makeSimpleColor/makeSimpleColorFromFloats/makeExtendedColor, giving us a consistent way to create colors. Also addes use constexpr SimpleColors where possible. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::drawInContext): * UIProcess/API/wpe/WebKitColor.cpp: (webkitColorToWebCoreColor): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _tapHighlightColorForFastClick:]): * WebProcess/Inspector/WebInspectorClient.cpp: (WebKit::WebInspectorClient::showPaintRect): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::drawRect): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::paintSnapshotAtSize): * WebProcess/WebPage/ios/FindControllerIOS.mm: (WebKit::FindIndicatorOverlayClientIOS::drawRect): (WebKit::highlightColor): Deleted. 2020-06-01 Carlos Garcia Campos [GTK4] Add printing support https://bugs.webkit.org/show_bug.cgi?id=212320 Reviewed by Adrian Perez de Castro. Printing API hasn't changed, the only problem was that we were using gtk_dialog_run() and gdk threads deprecated API. * UIProcess/API/gtk/WebKitPrintOperation.cpp: (webkitPrintOperationRunDialog): Remove GTK4 ifdefs. * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp: (WebKit::WebPrintOperationGtk::print): Use g_idle_add_full() instead of gdk threads deprecated API. 2020-06-01 Carlos Garcia Campos [GTK4] Wheel events are always handled by the main frame view https://bugs.webkit.org/show_bug.cgi?id=212593 Reviewed by Adrian Perez de Castro. It's not possible scroll other scrollable areas with the mouse wheel. This is because we are using the given x, y delta in the scroll signal as the position. In GTK4 the scroll event doesn't include a position, so we have to use the last motion event. * Shared/NativeWebWheelEvent.h: * Shared/gtk/NativeWebWheelEventGtk.cpp: (WebKit::NativeWebWheelEvent::NativeWebWheelEvent): Add wheelTicks parameter. * Shared/gtk/WebEventFactory.cpp: (WebKit::WebEventFactory::createWebWheelEvent): New create function that receives the wheelTicks. * Shared/gtk/WebEventFactory.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseScroll): Use the x, y parameters as the delta and take the position from the last motion event. 2020-06-01 Carlos Garcia Campos [GTK4] Monitor root window to update activity state https://bugs.webkit.org/show_bug.cgi?id=212581 Reviewed by Adrian Perez de Castro. To update ActivityState::IsInWindow and ActivityState::WindowIsActive. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (toplevelWindowStateEvent): (webkitWebViewBaseSetToplevelOnScreenWindow): (webkitWebViewBaseDispose): (toplevelWindowIsActiveChanged): (toplevelWindowStateChanged): (toplevelWindowRealized): (toplevelWindowUnrealized): (webkitWebViewBaseRoot): (webkitWebViewBaseUnroot): (webkit_web_view_base_class_init): 2020-06-01 Carlos Garcia Campos [GTK4] Fix pointer lock in X11 https://bugs.webkit.org/show_bug.cgi?id=212592 Reviewed by Adrian Perez de Castro. I forgot to forward the motion events for X11 in GTK4. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (MotionEvent::MotionEvent): Add a constructor that receives the positions and state. (webkitWebViewBaseMotion): Notify the pointer lock manager about the event. Also save the last motion event and compute the movement delta. 2020-06-01 Carlos Garcia Campos [GTK4] Make inspector work https://bugs.webkit.org/show_bug.cgi?id=212321 Reviewed by Adrian Perez de Castro. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseRemoveDialog): Added instead of the generic webkitWebViewBaseRemoveChild that has been removed. (webkitWebViewBaseRemoveWebInspector): Just unparent the inspector view instead of caling webkitWebViewBaseRemoveChild. (webkitWebViewBaseDispose): Use specific functions to remove the children. (webkitWebViewBaseSnapshot): Call gtk_widget_snapshot_child() on inspector view if present. (webkitWebViewBaseRemoveChild): Deleted. * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp: (WebKit::RemoteWebInspectorProxy::platformSave): Remove GTK4 ifdefs. * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp: (WebKit::WebInspectorProxy::platformSave): Ditto. * UIProcess/Inspector/gtk/WebKitInspectorWindow.cpp: (webkit_inspector_window_init): Show title buttons in inspector window. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::snapshot): Use the texture size instead of the view size, since it's different when the inspector is attached. 2020-06-01 Carlos Garcia Campos REGRESSION(r262184): fast/forms/implicit-submission.html is crashing https://bugs.webkit.org/show_bug.cgi?id=212520 Reviewed by Adrian Perez de Castro. * UIProcess/gtk/WebPopupMenuProxyGtk.cpp: (WebKit::WebPopupMenuProxyGtk::activateSelectedItem): Return early if the popup has already been closed. 2020-06-01 Rob Buis Rename ResourceResponseBase::isHTTP to isInHTTPFamily https://bugs.webkit.org/show_bug.cgi?id=208782 Reviewed by Sam Weinig. Adapt to API change. * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::makeStoreDecision): * WebProcess/Plugins/PluginView.cpp: (WebKit::buildHTTPHeaders): 2020-06-01 Michael Catanzaro [WPE][GTK] pthread_create() fails with EPERM in the second WebKitWebProcess with sandbox on https://bugs.webkit.org/show_bug.cgi?id=212380 Reviewed by Adrian Perez de Castro. Dereference scmp_arg_cmp before use. * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::setupSeccomp): 2020-05-30 Alex Christensen Deprecate WKBundlePostSynchronousMessage https://bugs.webkit.org/show_bug.cgi?id=212536 Reviewed by Anders Carlsson. * WebProcess/InjectedBundle/API/c/WKBundle.h: 2020-05-30 Carlos Garcia Campos [GTK] WebDriver: stop using GdkEvent API in preparation for GTK4 https://bugs.webkit.org/show_bug.cgi?id=212465 Reviewed by Adrian Perez de Castro. Use the new internal API to synthesize events. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSynthesizeKeyEvent): Add type parameter, since WebDriver can send press and release events separately. Also add a parameter to indicate that keyval should be translated according to current state that is required by WebDriver. * UIProcess/API/gtk/WebKitWebViewBaseInternal.h: * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::documentLoadedForFrame): Call resetClickCount(). (WebKit::WebAutomationSession::updateClickCount): Update the click count for the given button position and maximum time and distance. (WebKit::WebAutomationSession::resetClickCount): Reset the click count. * UIProcess/Automation/WebAutomationSession.h: * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: (WebKit::WebAutomationSession::platformSimulateMouseInteraction): Use webkitWebViewBaseSynthesizeMouseEvent(). (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): Use webkitWebViewBaseSynthesizeKeyEvent(). (WebKit::WebAutomationSession::platformSimulateKeySequence): Ditto. (WebKit::doMouseEvent): Deleted. (WebKit::doMotionEvent): Deleted. (WebKit::doKeyStrokeEvent): Deleted. * UIProcess/gtk/KeyBindingTranslator.cpp: Add missing key shortcuts to predefined list. 2020-05-29 Alex Christensen Use correct encoding when converting a WTF::URL to CFURLRef https://bugs.webkit.org/show_bug.cgi?id=212486 Reviewed by Darin Adler. * Shared/API/c/cf/WKURLCF.mm: (WKURLCopyCFURL): * Shared/cf/ArgumentCodersCF.cpp: (IPC::decode): 2020-05-29 Peng Liu Replace callOnMainThread() with callOnMainRunLoop() in AudioSessionRoutingArbitratorProxyCocoa.mm https://bugs.webkit.org/show_bug.cgi?id=212553 Reviewed by Chris Dumez. Use callOnMainRunLoop() instead of callOnMainThread() in the UIProcess. Also move m_setupArbitrationOngoing flag to the end of the completion handler. No new tests, no functional change. * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm: (WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator): 2020-05-29 Brent Fulgham [Cocoa] Improve logging quality for non-ephemeral sessions https://bugs.webkit.org/show_bug.cgi?id=212551 Reviewed by David Kilzer. In Bug 209522 I switched normal mode logging to use the same privacy-protecting mode we use for ephemeral sessions. This had the unintended consequence of removing network load data used to investigate networking issues. This patch adopts the more fine-grained logging provided by the low-level 'nw_context_privacy_level' setting. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::configurationForSessionID): Adopt 'nw_context_privacy_level' setting. 2020-05-29 Andy Estes [Apple Pay] Remove conditionals for ENABLE_APPLE_PAY_SESSION_V(3|4) https://bugs.webkit.org/show_bug.cgi?id=212541 Reviewed by Darin Adler. APPLE_PAY_SESSION_V(3|4) is now enabled whenever APPLE_PAY itself is enabled. * Configurations/FeatureDefines.xcconfig: 2020-05-29 Dean Jackson iOS build fix. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::configurationForSessionID): 2020-05-29 Jer Noble [Mac,WK2] Fullscreen animation missing a few frames at beginning https://bugs.webkit.org/show_bug.cgi?id=212156 Reviewed by Eric Carlson. When starting the enter fullscreen animation, ensure that the fullscreen window is ordered front, and on top of the content, as well as having all the animations configured so that their starting state is in place before calling -[NSWindow enterFullscreenMode:]. Move all the window creation code into -beganEnterFullScreenWithInitialFrame:finalFrame: from _startEnterFullScreenAnimationWithDuration:. Re-use the existing zoomAnimation() and maskAnimation() utility methods, but give the animations a very long duration (since there is no explicit way to start and stop a CAAnimation). This initial animation will be replaced with the final one inside -_startEnterFullScreenAnimationWithDuration:. Separately, explictly disable implicit animations of the fullscreen window during -orderIn: and -orderOut:. * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController initWithWindow:webView:page:impl:]): (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]): (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]): 2020-05-29 Jan-Michael Brummer [GTK][WPE] API for WebView audio mute support https://bugs.webkit.org/show_bug.cgi?id=176119 Reviewed by Michael Catanzaro. Test implemented in TestWebKitWebView. * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewSetProperty): (webkitWebViewGetProperty): (webkit_web_view_class_init): (webkit_web_view_set_is_muted): (webkit_web_view_is_muted): * UIProcess/API/gtk/WebKitWebView.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitWebView.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::isAudioMuted const): 2020-05-29 Darin Adler Remove things from FeatureDefines.xcconfig that are covered by PlatformEnableCocoa.h https://bugs.webkit.org/show_bug.cgi?id=212418 Rubber-stamped by Simon Fraser. * Configurations/FeatureDefines.xcconfig: Add back ENABLE_CSS_CONIC_GRADIENTS, removed by accident. 2020-05-29 Peng Liu ASSERT NOT REACHED in IPC::takeAsyncReplyHandler under WebKit::AudioSessionRoutingArbitrator::beginRoutingArbitrationWithCategory https://bugs.webkit.org/show_bug.cgi?id=212533 Reviewed by Chris Dumez. When the m_inDispatchMessageMarkedToUseFullySynchronousModeForTesting flag is set, sendWithAsyncReply() may actually send the message synchronously. Therefore, we have to set the async reply handler before actually sending the message. No new tests, fixing test crashes due to assertion failures. * Platform/IPC/Connection.h: (IPC::Connection::sendWithAsyncReply): 2020-05-27 Darin Adler Remove things from FeatureDefines.xcconfig that are covered by PlatformEnableCocoa.h https://bugs.webkit.org/show_bug.cgi?id=212418 Reviewed by Andy Estes. * Configurations/FeatureDefines.xcconfig: Removed 83 of the 119 things defined in this file. There are 36 more that are slightly more complex that we can remove carefully later. 2020-05-29 Darin Adler [Cocoa] Pass all defines from Platform.h to various scripts, not just the ones from .xcconfig https://bugs.webkit.org/show_bug.cgi?id=212451 Reviewed by Sam Weinig. * DerivedSources.make: Use ":=" when calling $(shell) to make sure the same shell command is not invoked over and over again. 2020-05-29 Keith Rollin Revert switch to XCBuild https://bugs.webkit.org/show_bug.cgi?id=212530 Unreviewed build fix. Bug 209890 enabled the use of XCBuild by default. Since then, some build issues have shown up. While addressing them, temporarily turn off the use of XCBuild by default. * Configurations/WebKit.xcconfig: * WebKit.xcodeproj/project.pbxproj: 2020-05-29 Devin Rousso Web Inspector: add ITML debuggable/target type https://bugs.webkit.org/show_bug.cgi?id=203300 Reviewed by Joseph Pecoraro and Brian Burg. * UIProcess/API/Cocoa/_WKInspectorDebuggableInfo.h: * UIProcess/API/Cocoa/_WKInspectorDebuggableInfoInternal.h: (fromWKInspectorDebuggableType): (toWKInspectorDebuggableType): * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (legacyDebuggableTypeToModernDebuggableType): * UIProcess/socket/RemoteInspectorProtocolHandler.cpp: (WebKit::parseDebuggableTypeFromString): 2020-05-29 Simon Fraser Prepare for async scrolling in passive wheel event handler regions https://bugs.webkit.org/show_bug.cgi?id=212455 Reviewed by Tim Horton. Clarify the processing for wheel events by adding OptionSet, which will, in future, allow us to describe the processing for an event in the passive event handler region which does scrolling on the scrolling thread, and is then sent to the main thread for DOM event dispatch. Removed ScrollingEventResult, which conflated "handled" with "send to another thread". The thread sending behavior is now encoded in the WheelEventProcessingSteps, and we can just use a bool for handled. Scrolling tree and node handleWheelEvent() functions return a WheelEventHandlingResult, which is a tuple of OptionSet and 'handled', allowing for a node with background-attachment:fixed to add the "send to main thread" processing step. * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::handleWheelEvent): * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp: (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleWheelEvent): * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h: * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp: (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::handleWheelEvent): * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.h: * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): 2020-05-29 Carlos Garcia Campos [GTK4] Implement HTTP auth dialog https://bugs.webkit.org/show_bug.cgi?id=212319 Reviewed by Sergio Villar Senin. * UIProcess/API/gtk/WebKitAuthenticationDialog.cpp: (webkitAuthenticationDialogDestroy): (okButtonClicked): (cancelButtonClicked): (authenticationCancelled): (webkitAuthenticationDialogInitialize): (webkitAuthenticationDialogMap): (webkitAuthenticationDialogDispose): (webkitAuthenticationDialogNew): * UIProcess/API/gtk/WebKitAuthenticationDialog.h: * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (webkitWebViewAuthenticate): 2020-05-29 Carlos Garcia Campos [GTK4] Implement script dialogs https://bugs.webkit.org/show_bug.cgi?id=212318 Reviewed by Adrian Perez de Castro. Adapt to the GTK4 API and theme changes. * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp: (webkitScriptDialogImplClose): (webkitScriptDialogImplKeyPressed): (webkitScriptDialogImplMap): (webkitScriptDialogImplConstructed): (webkitScriptDialogImplDispose): (webkit_script_dialog_impl_class_init): (webkitScriptDialogImplAddButton): (webkitScriptDialogImplNew): (webkitScriptDialogImplSetEntryText): * UIProcess/API/gtk/WebKitScriptDialogImpl.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseAddDialog): (webkitWebViewBaseRemoveChild): (webkitWebViewBaseSnapshot): * UIProcess/API/gtk/WebKitWebViewDialog.cpp: (webkitWebViewDialogSnapshot): (webkitWebViewDialogSizeAllocate): (webkitWebViewDialogConstructed): (webkit_web_view_dialog_class_init): (webkitWebViewDialogSetChild): (webkitWebViewDialogGetChild): * UIProcess/API/gtk/WebKitWebViewDialog.h: * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (webkitWebViewScriptDialog): 2020-05-29 Wenson Hsieh REGRESSION (r261812): editing/async-clipboard/clipboard-item-get-type-basic.html is flaky https://bugs.webkit.org/show_bug.cgi?id=212281 Reviewed by Tim Horton. Declare `-delegateSupportsImagePaste` on UIKeyboardImpl. * Platform/spi/ios/UIKitSPI.h: 2020-05-28 Peng Liu Clean up WebKit.xcodeproj/project.pbxproj https://bugs.webkit.org/show_bug.cgi?id=212491 Reviewed by Tim Horton. A follow-up patch to add AudioSessionRoutingArbitratorProxyCocoa.mm to the unified build. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: Add AudioSessionRoutingArbitratorProxyCocoa.mm to the unified build. * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h: Fix a unified build failure. 2020-05-28 Megan Gardner Avoid unnecessary sync IPC messages when togging the callout bar for selections. https://bugs.webkit.org/show_bug.cgi?id=212508 The loupe gesture only needs to be activated and evaluated if the tap is inside an existing selectionView. We can do that test in the UIProcess without resorting to a sync IPC message. Doing that evaluation locally will eliminate unnecessary hangs in the UIProcess. Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _pointIsInsideSelectionRect:outBoundingRect:]): (-[WKContentView _shouldToggleSelectionCommandsAfterTapAt:]): (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): 2020-05-28 Tim Horton Fix the macOS build * WebKit.xcodeproj/project.pbxproj: Can't have this file in both the Xcode target and SourcesCocoa.txt... 2020-05-28 Lauro Moura [GTK][WPE] Buildfix after r262242 Unreviewed build fix. * Shared/glib/ArgumentCodersGLib.cpp: (IPC::decode): 2020-05-28 Jonathan Bedard watchOS: Upstream WKNumberPadView https://bugs.webkit.org/show_bug.cgi?id=212499 Reviewed by Wenson Hsieh. * UIProcess/ios/forms/WKNumberPadView.h: Moved from WebKitAdditions. * UIProcess/ios/forms/WKNumberPadView.mm: Ditto. 2020-05-28 Jonathan Bedard watchOS: Upstream WKTextInputListViewController https://bugs.webkit.org/show_bug.cgi?id=212495 Reviewed by Wenson Hsieh. * UIProcess/ios/forms/WKTextInputListViewController.h: Moved from WebKitAdditions. * UIProcess/ios/forms/WKTextInputListViewController.mm: Ditto. 2020-05-28 Simon Fraser Simplify EventDispatcher wheel event dispatch https://bugs.webkit.org/show_bug.cgi?id=212490 Reviewed by Tim Horton. The various cross-thread bounces and completion lambdas in EventDispatcher::wheelEvent() and ScrollingTree code made the logic very hard to follow. Moving the ScrollingThread::dispatch() into EventHandler code simplifies things a little, and allows for removal of the hokey "try to handle" ScrollingTree function, as well as the clunky completion function. Now, EventHandler call shouldHandleWheelEventSynchronously(), then does the ScrollingThread::dispatch() which allows the lambda to easily call back into EventHandler for the main thread dispatch. RemoteScrollingCoordinatorProxy/RemoteLayerTree code is unused at present, and will need work. * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::handleWheelEvent): * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp: (WebKit::RemoteScrollingTree::tryToHandleWheelEvent): Deleted. * UIProcess/RemoteLayerTree/RemoteScrollingTree.h: * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): (WebKit::EventDispatcher::dispatchWheelEventViaMainThread): * WebProcess/WebPage/EventDispatcher.h: 2020-05-28 Peng Liu Clean up WebKit.xcodeproj/project.pbxproj https://bugs.webkit.org/show_bug.cgi?id=212491 Reviewed by Simon Fraser. Remove the references to deleted files and merge duplicated folders. * WebKit.xcodeproj/project.pbxproj: 2020-05-28 Kate Cheney Minimum user interaction time in ResourceLoadStatistics should handle the case of -1 https://bugs.webkit.org/show_bug.cgi?id=212445 Reviewed by John Wilander. Tests: http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-statistics-with-no-user-interaction-database.html http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-statistics-with-no-user-interaction.html Adds a getter for mostRecentUserInteractionTime which returns WTF::nullopt if the timestamp is -1. Then does not consider this case in calculating the minimum timestamp. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::getMostRecentUserInteractionTime): (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor): Flip sign to be less than, so we hold off on deleting data if the oldest interaction was less than the minimum time between removal. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::getMostRecentUserInteractionTime): (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor): Flip sign to be less than, so we hold off on deleting data if the oldest interaction was less than the minimum time between removal. * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: 2020-05-28 Megan Gardner Do not send a second sync request for positition information to the web process if we have not recieved information since the previous sync request. https://bugs.webkit.org/show_bug.cgi?id=212289 Reviewed by Tim Horton. If we have sent a sync requests to the web process for position information, and timed out, and have not received a message with position information in the interim, do not send another sync request. The web process is likely still hung, and there is no reason to hang the UIProcess again if we suspect that it is unlikely that we will receive a reply. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): (-[WKContentView ensurePositionInformationIsUpToDate:]): (-[WKContentView _positionInformationDidChange:]): 2020-05-28 Youenn Fablet ReadableByteStream should be enabled/disabled in service workers as done in pages https://bugs.webkit.org/show_bug.cgi?id=212466 Reviewed by Alex Christensen. Introduce a WebPreference for readable byte stream. Use it for enabling it in web processes running service workers as per the given store. * Shared/WebPreferences.yaml: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::updatePreferencesStore): 2020-05-28 Michael Catanzaro [WPE][GTK] GVariant decoding must copy the serialized data https://bugs.webkit.org/show_bug.cgi?id=212441 Reviewed by Carlos Garcia Campos. I tracked this down to ArgumentCodersGLib.cpp. The problem is that we construct a GVariant using g_variant_new_from_data(), which does not copy or take ownership of the data, so here we accidentally create the GVariant using data we don't own. (Here, the data is owned by the Decoder itself in its internal m_buffer.) Anyway, this is fixable by manually copying and freeing it with the GDestroyNotify parameter, but it's easier to switch to g_variant_new_from_bytes() because GBytes takes ownership when constructed. * Shared/glib/ArgumentCodersGLib.cpp: (IPC::decode): 2020-05-28 Youenn Fablet RemoteAudio::audioSamplesAvailable should check for m_buffer to be null https://bugs.webkit.org/show_bug.cgi?id=212462 Reviewed by Eric Carlson. * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::RemoteAudio::audioSamplesAvailable): m_buffer is initialized by a StorageChanged IPC message which might not always be successful, for instance if the shared memory mapping fails. Return early if m_buffer is not yet initialized properly. 2020-05-28 Youenn Fablet RealtimeIncomingVideoSourceCocoa::OnFrame should use video frame timestamp https://bugs.webkit.org/show_bug.cgi?id=212402 Reviewed by Eric Carlson. * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp: (WebKit::RemoteSampleBufferDisplayLayer::enqueueSample): * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h: 2020-05-27 Keith Rollin Add output file specifications to "Copy Custom WebContent Resources to Framework Private Headers" build phase in WebKit/WebContent https://bugs.webkit.org/show_bug.cgi?id=212452 Reviewed by Timothy Hatcher. The "Copy Custom WebContent Resources to Framework Private Headers" build phase in the WebContent target of the WebKit project doesn't advertise the files that it produces. This has consequences on later build phases that consume those files. In particular, XCBuild is left not knowing where those files are coming from, and it fails saying that those files don't exist. Fix this by adding the output files to the "output files" section of the custom build phase. No new tests -- this is just a build fix. * WebKit.xcodeproj/project.pbxproj: 2020-05-27 Tim Horton REGRESSION (PSON): Resizing WKWebView during cross-site navigation results in the page laying out at the wrong size https://bugs.webkit.org/show_bug.cgi?id=212434 Reviewed by Chris Dumez. New API test: ProcessSwap.ResizeWebViewDuringCrossSiteProvisionalNavigation. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::swapToProvisionalPage): Set m_hasRunningProcess before calling setDrawingArea, instead of immediately after, so that setDrawingArea can call methods that check m_hasRunningProcess. (WebKit::WebPageProxy::setDrawingArea): When swapping DrawingAreas, push the current view size down. DrawingArea is initially created with a size, but the size can change while the DrawingArea is still provisional. * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::viewSize): Simplify this implementation now that we don't ever need to support WKContentView outside of WKWebView (since 2014 or so). 2020-05-27 Michael Catanzaro REGRESSION(r260318): [WPE][GTK] Uninitialized memory read in MemoryPressureMonitor https://bugs.webkit.org/show_bug.cgi?id=212412 Reviewed by Adrian Perez de Castro. I think this is a false-positive, but let's suppress the warning by zero-initializing this buffer. * UIProcess/linux/MemoryPressureMonitor.cpp: (WebKit::systemMemoryUsedAsPercentage): 2020-05-27 Kate Cheney App-bound sessions should be for iOS only https://bugs.webkit.org/show_bug.cgi?id=212426 Reviewed by Darin Adler. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::SessionWrapper::initialize): (WebKit::NetworkSessionCocoa::sessionWrapperForTask): 2020-05-27 Lauro Moura [WPE] Avoid possible WTR event timing going back in time and fix conversion from s to ms https://bugs.webkit.org/show_bug.cgi?id=212338 Reviewed by Michael Catanzaro. When converting the input timestamps to WallTime, we must somehow adjust them to give meaningful timestamps (due to Dom::Event conversion from timestamp wall time to the time origin from document loading). As WPE timestamps are just intended to be compared among themselves, we use the first processed event as the origin, comparing the following events to it to get an actual time. Test: fast/events/monotonic-event-time.html * Shared/libwpe/WebEventFactory.cpp: (WebKit::wallTimeForEventTime): 2020-05-27 Kate Cheney Make sure bundle identifier testing override is set in the network process https://bugs.webkit.org/show_bug.cgi?id=212288 Reviewed by Chris Dumez. Set the bundle identifier in the network process if a layout test updates it. This value usually only gets updated when a new network process is initialized, which does not happen for every test. So it should be set/cleared as needed. No new tests, will fix http/tests/in-app-browser-privacy/ tests. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::updateBundleIdentifierInNetworkProcess): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreUpdateBundleIdentifierInNetworkProcess): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::updateBundleIdentifierInNetworkProcess): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::updateBundleIdentifierInNetworkProcess): * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-05-27 Per Arne Vollan Unreviewed, reverting r260840. This patch is no longer needed after preferences root cause has been fixed. Reverted changeset: "[Cocoa] Global preferences are not accessible in the WebContent process when CFPrefs direct mode is enabled" https://bugs.webkit.org/show_bug.cgi?id=211075 https://trac.webkit.org/changeset/260840 2020-05-27 Michael Catanzaro Unreviewed, fix -Wcomment build warning after r261986 https://bugs.webkit.org/show_bug.cgi?id=211950 If we replace the /* with /* then GCC won't complain that it looks like a comment. * UIProcess/API/glib/WebKitSettings.cpp: (webkit_settings_class_init): 2020-05-27 Brent Fulgham Adjust HTTP3 label to the more correct HTTP/3 https://bugs.webkit.org/show_bug.cgi?id=212416 Reviewed by Darin Adler. No new tests. No change in behavior. * Shared/WebPreferences.yaml: Correct label. 2020-05-27 Devin Rousso Web Inspector: replace `featureGuard` and `availability` with a combined `condition` that accepts any macro https://bugs.webkit.org/show_bug.cgi?id=210014 Reviewed by Brian Burg. Previously, the generated InspectorBackendCommands.js would include code for things that the backend doesn't actually support. By using actual macros and preprocessing that file, we can ensure that the frontend doesn't incorrectly think that something is supported by the page being inspected: - the `Canvas` commands and events related to shader programs/pipelines should only exist when the corresponding context type exists, namely `ENABLE(WEBGL)` and `ENABLE(WEBGPU)`. - iOS doesn't support showing rulers, so create a variant of `DOM.setInspectModeEnabled` that only exists for `PLATFORM(IOS_FAMILY)` that doesn't have the `showRulers` optional parameter, as well as removing `Page.setShowRulers` entirely. - setting the forced appearance should only be possible if dark mode is supported. - web archives only exist if CF is used. * Configurations/FeatureDefines.xcconfig: Add `ENABLE_WEB_ARCHIVE` since it's always enabled in wtf/PlatformEnableCocoa.h. * DerivedSources.make: * PlatformMac.cmake: Remove `platform` as it is handled by `condition`. * UIProcess/Automation/Automation.json: 2020-05-27 Zalan Bujtas [Quirk] Remove stackoverflow.com desktop content quirk. https://bugs.webkit.org/show_bug.cgi?id=212414 Reviewed by Antti Koivisto. Mobile content is fixed now. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::desktopClassBrowsingRecommendedForRequest): 2020-05-27 Chris Dumez Crash under WebNotificationManager::removeNotificationFromContextMap() https://bugs.webkit.org/show_bug.cgi?id=212410 Reviewed by Alex Christensen. Protect the notification object in WebNotificationManager::didDestroyNotification() since removing it from m_notificationIDMap will deref it and may end up destroying the notification object otherwise. Test: http/tests/notifications/crash-on-navigation.html * WebProcess/Notifications/WebNotificationManager.cpp: (WebKit::WebNotificationManager::didDestroyNotification): 2020-05-27 Carlos Garcia Campos Unreviewed. [GTK] Make webkitWebViewBaseSnapshot static * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSnapshot): 2020-05-27 David Kilzer Use OptionSet for mask values Reviewed by Alex Christensen. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): - Switch from decodeEnum() and encodeEnum() to modern equivalents that check for valid enum values. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::draggingEntered): (WebKit::WebViewImpl::draggingUpdated): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView dragDataForDropSession:dragDestinationAction:]): * WebProcess/WebCoreSupport/WebDragClient.cpp: (WebKit::WebDragClient::willPerformDragDestinationAction): 2020-05-27 Carlos Garcia Campos [GTK4] Make PointerLock work https://bugs.webkit.org/show_bug.cgi?id=212314 Reviewed by Adrian Perez de Castro. Use XLib API for warp and grab, since they are no longer available in GTK4. The grab was not actuially needed under Wayland. Also stop using GdkEvent to keep track of motion events and create the PointerLockManager to be able to test pointer lock and movement delta. * Shared/NativeWebMouseEvent.h: * Shared/gtk/NativeWebMouseEventGtk.cpp: (WebKit::NativeWebMouseEvent::NativeWebMouseEvent): Use FloatSize instead of FloatPoint for movement delta. * Shared/gtk/WebEventFactory.cpp: (WebKit::WebEventFactory::createWebMouseEvent): Ditto. * Shared/gtk/WebEventFactory.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (MotionEvent::MotionEvent): Helper struct to keep track of motion events without using GdkEvent. (MotionEvent::delta): Return the movement delta for the given current event. (webkitWebViewBaseHandleMouseEvent): Use MotionEvent instead of GdkEvent. (webkitWebViewBaseMotionNotifyEvent): Pass the event coordinates to the pointer lock manager since that's the only thing needed. (webkitWebViewBaseRequestPointerLock): Use MotionEvent instead of GdkEvent. (webkitWebViewBaseDidLosePointerLock): Remove GTK4 ifdefs. (webkitWebViewBaseSynthesizeMouseEvent): Forward the event to the pointer lock manager if present. Also keep track of the motion event and set the movement delta. * UIProcess/gtk/PointerLockManager.cpp: (WebKit::PointerLockManager::create): Receive event information as parameters instead of using GdkEvent. (WebKit::PointerLockManager::PointerLockManager): Ditto. (WebKit::PointerLockManager::~PointerLockManager): (WebKit::PointerLockManager::lock): Remove the grab. (WebKit::PointerLockManager::unlock): Remove the ungrab. (WebKit::PointerLockManager::handleMotion): Use NativeWebMouseEvent constructor taking all information as parameters. * UIProcess/gtk/PointerLockManager.h: * UIProcess/gtk/PointerLockManagerWayland.cpp: (WebKit::PointerLockManagerWayland::PointerLockManagerWayland): Receive event information as parameters instead of using GdkEvent. (WebKit::PointerLockManagerWayland::lock): Hide the cursor. (WebKit::PointerLockManagerWayland::unlock): Unhide the cursor. * UIProcess/gtk/PointerLockManagerWayland.h: * UIProcess/gtk/PointerLockManagerX11.cpp: (WebKit::PointerLockManagerX11::PointerLockManagerX11): Receive event information as parameters instead of using GdkEvent. (WebKit::PointerLockManagerX11::lock): Use XGrabPointer. (WebKit::PointerLockManagerX11::unlock): Use XUngrabPointer. (WebKit::PointerLockManagerX11::didReceiveMotionEvent): Use XWarpPointer. * UIProcess/gtk/PointerLockManagerX11.h: 2020-05-27 Philippe Normand Unreviewed, build warning fix after r261986 * UIProcess/API/glib/WebKitSettings.cpp: A colon is needed after the transfer annotation. 2020-05-27 Peng Liu VideoFullscreenInterfaceAVKit is leaking when a video element enters and exits fullscreen/picture-in-picture https://bugs.webkit.org/show_bug.cgi?id=212293 VideoFullscreenManagerProxy::ensureInterface() makes sure a fullscreen interface object exists (an object will be created if it does not exit). That means an extra object will be created by an IPC message from the Web process after the original video fullscreen interface object has been destroyed (thats happens when a video element is returning to inline from fullscreen or picture-in-picture). Reviewed by Youenn Fablet. * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::setHasVideo): Don't call VideoFullscreenInterface[AVKit|Mac]::hasVideoChanged() before the instance of VideoFullscreenInterface[AVKit|Mac] is ready. (WebKit::VideoFullscreenManagerProxy::setVideoDimensions): Don't call VideoFullscreenInterface[AVKit|Mac]::videoDimensionsChanged() after the instance of VideoFullscreenInterface[AVKit|Mac] is destroyed. 2020-05-27 Carlos Garcia Campos [GTK][WTR] EventSender: stop using GdkEvent API in preparation for GTK4 https://bugs.webkit.org/show_bug.cgi?id=212298 Reviewed by Adrian Perez de Castro. Add internal API to WebKitWebViewBase to synthesize events, because with GTK4 it's not possible to create events. In the case of layout tests, the web view is always the target of the events, so we don't really need to send the events to GTK to process them. * Shared/NativeWebKeyboardEvent.h: Add new constructor that doesn't receive a GdkEvent. * Shared/NativeWebMouseEvent.h: Ditto. * Shared/NativeWebWheelEvent.h: Ditto. * Shared/gtk/NativeWebKeyboardEventGtk.cpp: (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): Create without a GdkEvent. * Shared/gtk/NativeWebMouseEventGtk.cpp: (WebKit::NativeWebMouseEvent::NativeWebMouseEvent): Ditto. * Shared/gtk/NativeWebWheelEventGtk.cpp: (WebKit::NativeWebWheelEvent::NativeWebWheelEvent): Ditto. * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::doneWithKeyEvent): Return early if event doesn't have a GdkEvent. (WebKit::PageClientImpl::doneWithTouchEvent): Ditto. (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): Ditto. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (toWebKitModifiers): (webkitWebViewBaseSynthesizeMouseEvent): (webkitWebViewBaseSynthesizeKeyEvent): (toWebKitWheelEventPhase): (webkitWebViewBaseSynthesizeWheelEvent): * UIProcess/API/gtk/WebKitWebViewBaseInternal.h: Added. * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::activePopupMenu const): Return the active popup menu proxy. * UIProcess/gtk/KeyBindingTranslator.cpp: (WebKit::handleKeyBindingsForMap): Make it generic by receiving the map as parameter. (WebKit::handleCustomKeyBindings): Call handleKeyBindingsForMap() passing the custom key bindings map. (WebKit::KeyBindingTranslator::commandsForKeyval): Get commands for the predefined key bindings. This is used only when synthesizing key events since we don't have a GdkEVent to forward to the GtkTextView. * UIProcess/gtk/KeyBindingTranslator.h: * UIProcess/gtk/WebContextMenuProxyGtk.cpp: (WebKit::popupMenuWidget): Take a ref of the GdkWindow when creating the GdkEvent, since the event will unref it on destroy. * UIProcess/gtk/WebPopupMenuProxyGtk.cpp: (WebKit::WebPopupMenuProxyGtk::handleKeyPress): Handle a key press event from its keyval and timestamp. (WebKit::WebPopupMenuProxyGtk::activateSelectedItem): Activate the currently selected item. (WebKit::WebPopupMenuProxyGtk::keyPressEventCallback): Call handleKeyPress(). (WebKit::WebPopupMenuProxyGtk::typeAheadFindIndex): Receive a keyval and timestamp instead of a GdkEvent. (WebKit::WebPopupMenuProxyGtk::typeAheadFind): Ditto. * UIProcess/gtk/WebPopupMenuProxyGtk.h: 2020-05-27 Keith Rollin Enable the use of XCBuild by default in Apple builds https://bugs.webkit.org/show_bug.cgi?id=209890 Unreviewed build fix. Check the value of XCODE_VERSION_ACTUAL rather than XCODE_VERSION_MAJOR when determining whether to use the XCBuild or non-XCBuild method of running header post-processing scripts. No new tests -- this is a build fix. * WebKit.xcodeproj/project.pbxproj: 2020-05-26 Zan Dobersek Unreviewed WPE build fix after r262155. * UIProcess/API/wpe/WebKitColor.cpp: (webkit_color_parse): Use CSSParser::parseColor() to do the color parsing. 2020-05-26 Fujii Hironori [WinCairo] Unreviewed clang-cl build fix after r262158 https://bugs.webkit.org/show_bug.cgi?id=211883 std::unique_ptr can't delete an incomplete type TextureMapper. * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp: * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.h: 2020-05-26 Andy Estes Fix the engineering build on internal SDKs * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Silenced a deprecation warning. 2020-05-26 Fujii Hironori [WinCairo][WK2] Use GraphicsLayerTextureMapper for Accelerated Compositing mode https://bugs.webkit.org/show_bug.cgi?id=211883 Reviewed by Don Olmstead. GraphicsLayerTextureMapper is a simple GraphicsLayer implementation using TextureMapper which is used for WinCairo WebKit1. Add a new LayerTreeHost implementation for GraphicsLayerTextureMapper by copying WinCairo WebKit1's AcceleratedCompositingContext. Windows WebKitTestRunner can't capture the window content for pixel dump tests yet. * PlatformWin.cmake: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * UIProcess/win/WebView.cpp: (WebKit::WebView::WebView): * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::setNeedsDisplayInRect): (WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode): * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp: Added. (WebKit::LayerTreeHost::prepareForRendering): (WebKit::LayerTreeHost::compositeLayersToContext): (WebKit::LayerTreeHost::flushPendingLayerChanges): (WebKit::LayerTreeHost::layerFlushTimerFired): (WebKit::LayerTreeHost::LayerTreeHost): (WebKit::LayerTreeHost::setLayerFlushSchedulingEnabled): (WebKit::LayerTreeHost::setShouldNotifyAfterNextScheduledLayerFlush): (WebKit::LayerTreeHost::scheduleLayerFlush): (WebKit::LayerTreeHost::cancelPendingLayerFlush): (WebKit::LayerTreeHost::setRootCompositingLayer): (WebKit::LayerTreeHost::setViewOverlayRootLayer): (WebKit::LayerTreeHost::setNonCompositedContentsNeedDisplay): (WebKit::LayerTreeHost::scrollNonCompositedContents): (WebKit::LayerTreeHost::flushAndRenderLayers): (WebKit::LayerTreeHost::forceRepaint): (WebKit::LayerTreeHost::forceRepaintAsync): (WebKit::LayerTreeHost::sizeDidChange): (WebKit::LayerTreeHost::pauseRendering): (WebKit::LayerTreeHost::resumeRendering): (WebKit::LayerTreeHost::graphicsLayerFactory): (WebKit::LayerTreeHost::contentsSizeChanged): (WebKit::LayerTreeHost::didChangeViewportAttributes): (WebKit::LayerTreeHost::setIsDiscardable): (WebKit::LayerTreeHost::deviceOrPageScaleFactorChanged): (WebKit::LayerTreeHost::createDisplayRefreshMonitor): (WebKit::LayerTreeHost::window): (WebKit::LayerTreeHost::enabled): (WebKit::LayerTreeHost::paintContents): (WebKit::LayerTreeHost::deviceScaleFactor const): (WebKit::LayerTreeHost::applyDeviceScaleFactor): * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.h: Added. (WebKit::LayerTreeHost::layerTreeContext const): (WebKit::LayerTreeHost::displayID const): * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::nativeWindowHandle): * WebProcess/win/WebProcessMainWin.cpp: 2020-05-25 Darin Adler Eliminate Color constructors that take strings, moving color parsing entirely into the CSS parser https://bugs.webkit.org/show_bug.cgi?id=212296 Reviewed by Sam Weinig. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageSetComposition): Use WebCore::CSSParser::parseColor. 2020-05-26 Peng Liu ASSERTION FAILED: m_clientCounts.contains(contextId) - WebKit::VideoFullscreenManagerProxy::removeClientForContext() https://bugs.webkit.org/show_bug.cgi?id=212308 Refactor the implementation of the callback hasVideoInPictureInPictureDidChange(). Reviewed by Jer Noble. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::didExitPictureInPicture): (WebKit::VideoFullscreenManagerProxy::hasVideoInPictureInPictureDidChange): Add this function to wrap m_page->uiClient().hasVideoInPictureInPictureDidChange(). (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): Remove the call to hasVideoInPictureInPictureDidChange() because it is too early to do so. (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode): Add a call to hasVideoInPictureInPictureDidChange() on Mac as well. This fixes the timeout of TestWebKitAPI.PictureInPicture.ExitPiPOnSuspendVideoElement on Mac. (WebKit::VideoFullscreenManagerProxy::fullscreenModeChanged): Remove the call to hasVideoInPictureInPictureDidChange() because it is not necessary. 2020-05-26 Keith Rollin Enable the use of XCBuild by default in Apple builds https://bugs.webkit.org/show_bug.cgi?id=209890 Reviewed by Darin Adler. Switch from the "legacy" Xcode build system to the "new" build system (also known as "XCBuild"). Switching to the new system speeds up builds by a small percentage, better validates projects for build-related issues (such as dependency cycles), lets WebKit benefit from future improvements in XCBuild such as those coming from the underlying llbuild open source project, and prepares us for any other tools built for this new ecosystem. Specific changes: - Remove Xcode project and workspace settings that selected the Build system, allowing the default to take hold (which is currently the New build system). - Updated webkitdirs.pm with a terser check for Xcode version. - Update build-webkit and Makefile.shared to be explicit when using the old build system (no longer treat it as a default or fall-back configuration). - Update various xcconfig files similarly to treat the default as using the new build system. - Update various post-processing build steps to check for Xcode 11.4 and to no longer treat the default as using the old build system. * Configurations/WebKit.xcconfig: * WebKit.xcodeproj/project.pbxproj: 2020-05-26 Carlos Garcia Campos [GTK4] Fix context menu https://bugs.webkit.org/show_bug.cgi?id=212344 Reviewed by Adrian Perez de Castro. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSizeAllocate): Call gtk_native_check_resize() on the popover to make it appear. * UIProcess/gtk/WebContextMenuProxyGtk.cpp: (WebKit::destroyMenuWidget): There's no gtk_widget_destroy() in GTK4 so we can just unparent it. (WebKit::bindModelToMenuWidget): Do not set the action namespace because that's not possible in GTK4. (WebKit::WebContextMenuProxyGtk::append): Use group.name again for the action name passed to g_menu_item_set_action_and_target_value(). (WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk): Use destroyMenuWidget(). 2020-05-25 Alex Christensen Expose more network metrics to WebCoreNSURLSession https://bugs.webkit.org/show_bug.cgi?id=212359 Reviewed by Darin Adler. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]): 2020-05-24 Sam Weinig Extended Color Cleanup: Use the name SimpleColor consistently https://bugs.webkit.org/show_bug.cgi?id=212337 Reviewed by Anders Carlsson. * UIProcess/ios/WKContentViewInteraction.mm: (compositionHighlights): Update for new name of CompositionHighlight::defaultCompositionFillColor. 2020-05-24 Rob Buis Remove NetworkProcess/FileAPI https://bugs.webkit.org/show_bug.cgi?id=212335 Reviewed by Sam Weinig. Remove NetworkProcess/FileAPI, the only file it contains is unused. It seems this could have been removed in r248593. * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp: Removed. 2020-05-24 Sam Weinig Extended Color Cleanup: Stop allowing direct access to the underlying SimpleColor (it is almost always incorrect with respect to extended colors) https://bugs.webkit.org/show_bug.cgi?id=212184 Reviewed by Dean Jackson. * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: (WebKit::animationValueFromKeyframeValue): Use toSRGBASimpleColorLossy() to get access to color components. 2020-05-24 Carlos Garcia Campos Unreviewed. Remove unused file since r261570 I forgot to remove DragAndDropHandler.h. * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: * UIProcess/gtk/DragAndDropHandler.h: Removed. 2020-05-23 Charlie Turner Error sending IPC message: Broken pipe https://bugs.webkit.org/show_bug.cgi?id=206052 Reviewed by Adrian Perez de Castro. The Connection implementation on *nix was not handling socket shutdowns gracefully, this was leading to many IPC error messages being printed. It looks like the "errors" were actually application issues, trying to send messages during socket shutdown sequences, rather than more serious message drop problems. Unclear how to autotest this, but manual testing opening lots of tabs definitely hits these codepaths. * Platform/IPC/unix/ConnectionUnix.cpp: (IPC::Connection::readyReadHandler): Handle ECONNRESET by cleanly closing the connection. (IPC::Connection::sendOutputMessage): Ditto, also handle the wrinkle that for "reasons", Linux can return EPIPE when it means ECONNRESET. 2020-05-22 James Savage Create Swift overlay for WebKit framework https://bugs.webkit.org/show_bug.cgi?id=211270 Reviewed by Brady Eidson. Provides Swift-only overlay methods for our NS_REFINED_FOR_SWIFT API. The overlay does not provide different API than its Objective-C counterparts, so overlay testing focuses on ensuring that the overlay produces the expected interface, and provides the expected mappings to and from ObjC. The overlay is defined in a separate Xcode project (from WebKit) by recommendation from the Swift team. Due to build system constraints this project cannot be a sibbling of WebKit.xcodeproj, and must live in a subdirectory. However, because it generally acts as part of the WebKit framework, it still uses the same Version.xcconfig and source file locations as standard WebKit sources. * SwiftOverlay/Configurations/Base.xcconfig: Added. Set some default warnings and product configuration. * SwiftOverlay/Configurations/WebKitSwiftOverlay-maccatalyst.xcconfig: Added. Override SDK configurations to build for Catalyst. * SwiftOverlay/Configurations/WebKitSwiftOverlay.xcconfig: Added. These flags were all provided by the Xcode template. * SwiftOverlay/Configurations/WebKitSwiftOverlayTests-maccatalyst.xcconfig: Added. See above. * SwiftOverlay/Configurations/WebKitSwiftOverlayTests.xcconfig: Added. See above. * SwiftOverlay/SwiftOverlay/install-swiftmodules.sh: Added. Provided by the Swift team. * SwiftOverlay/Tests/WebKitSwiftOverlayTests-Info.plist: Added. * SwiftOverlay/Tests/WebKitTests.swift: Added. (WebKitTests.testAPI): This ensures that the function names come through as we expect them to. It also ensures that the functions were correctly set to public visiblity. (WebKitTests.testWKPDFConfigurationRect): This does the same as the above, but also exercises the null <-> nil conversion, and that regular values are correctly round tripped to Objective-C. * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/project.pbxproj: Added. * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/xcshareddata/xcschemes/Everything (Catalyst).xcscheme: Added. * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/xcshareddata/xcschemes/Everything.xcscheme: Added. * UIProcess/API/Cocoa/WebKitSwiftOverlay.swift: Added. (WKPDFConfiguration.rect): Provide mapping of CGRect.null to nil for Swift. (WKWebView.callAsyncJavaScript(_:arguments:in:completion:)): Provide a Result in the completion handler, and default value for arguments. (WKWebView.evaluateJavaScript(_:in:completion:)): Ditto. (WKWebView.createPDF(configuration:completionHandler:)): Provide a Swift function that takes a Result instead of (Data?, Error?) tuple. Provide a default value for the configuration. (WKWebView.createWebArchiveData(completionHandler:)): See above. (WKWebView.find(_:configuration:completionHandler:)): See above. 2020-05-22 Chris Dumez RELEASE_ASSERT() that InitializeWebKit2() is getting called on the main thread https://bugs.webkit.org/show_bug.cgi?id=212283 Reviewed by Alex Christensen. RELEASE_ASSERT() that InitializeWebKit2() is getting called on the main thread, behind a linked-on-after check. In r217137, we tried to add a dispatch_sync() to the main thread to work around the issue but it was a hack and it can cause deadlocks. It is best to force developers to fix their code by crashing. * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::runInitializationCode): (WebKit::InitializeWebKit2): * UIProcess/Cocoa/VersionChecks.h: 2020-05-22 Alex Christensen Make download resume workaround forgiving of changes in CFNetwork https://bugs.webkit.org/show_bug.cgi?id=212273 Reviewed by Geoffrey Garen. They broke my workaround. See rdar://problem/63512518 * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:]): 2020-05-22 Wenson Hsieh [IPC] Add support for specifying `Async WantsConnection` in message files https://bugs.webkit.org/show_bug.cgi?id=212276 Reviewed by Alex Christensen. Augments the IPC message receiver generation script to allow for "Async WantsConnection" in `.message.in` files. Currently, specifying this in a message causes the `connection` argument to be passed twice when handling the IPC message. This is because normal async IPC messages without replies normally don't have the `IPC::Connection` argument, and use the overloaded `handleMessage(Connection& connection, ...)` version of `handleMessage` when `WantsConnection` is specified. However, in the `Async` reply case, we already pass in the `IPC::Connection`. Instead of overloading the method signature, we introduce a different method instead, named `handleMessageAsyncWantsConnection`, which forwards the given `IPC::Connection` along to the member function. Test: TestAsyncMessageWithConnection * Platform/IPC/HandleMessage.h: (IPC::handleMessageAsyncWantsConnection): Add another variant of the message receiver template, for the case where the message receiver wants a connection. This is similar to handleMessageSynchronousWantsConnection, above. * Scripts/test-superclassMessageReceiver.cpp: (Messages::WebPage::TestAsyncMessageWithConnection::callReply): (Messages::WebPage::TestAsyncMessageWithConnection::cancelReply): (Messages::WebPage::TestAsyncMessageWithConnection::send): (WebKit::WebPage::didReceiveMessage): * Scripts/test-superclassMessages.h: (Messages::WebPage::TestAsyncMessageWithConnection::name): (Messages::WebPage::TestAsyncMessageWithConnection::asyncMessageReplyName): (Messages::WebPage::TestAsyncMessageWithConnection::TestAsyncMessageWithConnection): (Messages::WebPage::TestAsyncMessageWithConnection::arguments const): * Scripts/webkit/messages.py: * Scripts/webkit/messages_unittest.py: * Scripts/webkit/test-superclass.messages.in: 2020-05-22 Tim Horton Excessive hang time in iOS Safari under waitForDidUpdateActivityState https://bugs.webkit.org/show_bug.cgi?id=212272 Reviewed by Andy Estes. * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState): Make the view state change timeout equivalent on iOS and macOS. We believe that it is preferable to paint white than block the UI process main thread for half a second. Reduce the timeout on iOS to be the same as it has been for years on macOS. 2020-05-22 Alex Christensen Add SPI to unblock third party cookies from WKWebViews with ResourceLoadStatistics turned on https://bugs.webkit.org/show_bug.cgi?id=212058 Reviewed by John Wilander. This value makes NetworkDataTaskCocoa::blockCookies() not do anything for certain WKWebViews. * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::create): * NetworkProcess/NetworkLoadParameters.h: * NetworkProcess/NetworkResourceLoadParameters.cpp: (WebKit::NetworkResourceLoadParameters::encode const): (WebKit::NetworkResourceLoadParameters::decode): * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::blockCookies): (WebKit::NetworkDataTaskCocoa::unblockCookies): (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::copy const): * UIProcess/API/APIPageConfiguration.h: (API::PageConfiguration::setAllowAllThirdPartyCookies): (API::PageConfiguration::allowAllThirdPartyCookies const): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration _allowAllThirdPartyCookies]): (-[WKWebViewConfiguration _setAllowAllThirdPartyCookies:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::addParametersShared): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): 2020-05-22 Chris Dumez Regression(r254859) DOM storage event gets fired at the frame that caused the storage modification https://bugs.webkit.org/show_bug.cgi?id=211503 Reviewed by Maciej Stachowiak. r254859 refactored StorageAreaMap's dispatchSessionStorageEvent() & dispatchLocalStorageEvent() to share more code by moving that code to a new framesForEventDispatching() static function. However, framesForEventDispatching() was always using the session storage no matter the call site. It should be using the local storage when called from dispatchLocalStorageEvent(). Test: storage/domstorage/events/storage-event-not-in-originator.html * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::framesForEventDispatching): (WebKit::StorageAreaMap::dispatchSessionStorageEvent): (WebKit::StorageAreaMap::dispatchLocalStorageEvent): 2020-05-22 Tim Horton REGRESSION (r261978): Cannot click on links with trackpad on iPad https://bugs.webkit.org/show_bug.cgi?id=212262 Reviewed by Andy Estes. No new tests; our current WKMouseGestureRecognizer testing strategy unfortunately bypasses this particular problem. * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer _hoverEntered:withEvent:]): (-[WKMouseGestureRecognizer _hoverMoved:withEvent:]): (-[WKMouseGestureRecognizer _hoverExited:withEvent:]): (-[WKMouseGestureRecognizer _hoverCancelled:withEvent:]): Don't call super in any of the hover callbacks now that we derive from UIHoverGestureRecognizer. We want to wholly own the state of the gesture, including differences from UIHoverGestureRecognizer behavior such as remaining in the recognizing state while the trackpad button is pressed. We don't need any of the code in the default implementation, so just override it entirely. This returns behavior to what it was like before r261978. 2020-05-21 Sam Weinig Extended Color Cleanup: Move Color coder definitions to Color to allow for future encaspulation improvements https://bugs.webkit.org/show_bug.cgi?id=212247 Reviewed by Simon Fraser. Move IPC encoder/decoder definitions from WebKit down into Color itself to move closer to making Color::rgb() private. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): Deleted. (IPC::ArgumentCoder::decode): Deleted. * Shared/WebCoreArgumentCoders.h: 2020-05-21 Peng Liu Fix issues of the Picture-in-Picture API under stress tests https://bugs.webkit.org/show_bug.cgi?id=212191 Reviewed by Eric Carlson. * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::enterFullscreen): Mock the behavior of the VideoFullscreenInterface[AVKit|Mac] regarding the Picture-in-Picture mode support. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didCleanupFullscreen): Add callbacks for the end of entering/exiting fullscreen. 2020-05-21 Tyler Wilcock Fix misspelling -- m_releaseNetwrokActivityTimer --> m_releaseNetworkActivityTimer https://bugs.webkit.org/show_bug.cgi?id=212237 Reviewed by Simon Fraser. No new tests required -- simply fixing a misspelling. * UIProcess/Cocoa/NavigationState.h: Rename m_releaseNetwrokActivityTimer to m_releaseNetworkActivityTimer * UIProcess/Cocoa/NavigationState.mm: Rename m_releaseNetwrokActivityTimer to m_releaseNetworkActivityTimer (WebKit::NavigationState::NavigationState): (WebKit::NavigationState::releaseNetworkActivity): (WebKit::NavigationState::didChangeIsLoading): 2020-05-21 Sam Weinig Extended Color Cleanup: Remove trivial uses of Color::rgb() https://bugs.webkit.org/show_bug.cgi?id=212231 Reviewed by Darin Adler. * UIProcess/API/ios/WKWebViewIOS.mm: (scrollViewBackgroundColor): Replace colorWithOverrideAlpha() with Color::colorWithAlphaUsingAlternativeRounding() to avoid unnecessary use of Color::rgb() 2020-05-21 Alex Christensen Use an OptionSet instead of uint8_t for MessageFlags https://bugs.webkit.org/show_bug.cgi?id=212230 Reviewed by Darin Adler. I also reduce the encoding size of OptionSet. * Platform/IPC/ArgumentCoders.h: (IPC::ArgumentCoder>::encode): (IPC::ArgumentCoder>::decode): * Platform/IPC/Decoder.cpp: (IPC::Decoder::isSyncMessage const): (IPC::Decoder::shouldDispatchMessageWhenWaitingForSyncReply const): (IPC::Decoder::shouldUseFullySynchronousModeForTesting const): * Platform/IPC/Decoder.h: * Platform/IPC/Encoder.cpp: (IPC::Encoder::isSyncMessage const): (IPC::Encoder::shouldDispatchMessageWhenWaitingForSyncReply const): (IPC::Encoder::setIsSyncMessage): (IPC::Encoder::setShouldDispatchMessageWhenWaitingForSyncReply): (IPC::Encoder::setFullySynchronousModeForTesting): (IPC::Encoder::messageFlags): (IPC::Encoder::messageFlags const): * Platform/IPC/Encoder.h: * Platform/IPC/MessageFlags.h: (): Deleted. 2020-05-21 John Wilander Storage Access API: Allow configurable storage access scope https://bugs.webkit.org/show_bug.cgi?id=212114 Reviewed by Alex Christensen. The scope of storage access as per-frame or per-page was discussed in the standards process here: https://github.com/privacycg/storage-access/issues/3 The decision was to have per-page storage access by default. Recent feedback from Google and conversation with Mozilla suggest that we might want to support the caller choosing the scope. This patch adds support for different scope configurations while keeping the existing default as per-frame. A later patch will switch the default and add test cases for per-page scope. Most of the changes is piping through the new enum WebCore::StorageAccessScope from the call side to encode per-frame and per-page access, and piping through the new struct WebCore::RequestStorageAccessResult on the return side which carries full information about the storage access request result. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::CompletionHandler [PlayStation] Add minimal WKView API to enable TestWebKitAPI https://bugs.webkit.org/show_bug.cgi?id=211868 Reviewed by Alex Christensen. Enable TestWebKitAPI * Platform/IPC/Connection.h: * Platform/IPC/unix/ConnectionUnix.cpp: (IPC::Connection::platformInvalidate): (IPC::Connection::open): Add SocketMonitor to monitor received messages. * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: Add PlayStation specific members: WebProcess and NetworkProcess paths, and user ID. * UIProcess/Launcher/ProcessLauncher.h: Add PlayStation specific members: Process path and user ID. * NetworkProcess/EntryPoint/playstation/NetworkProcessMain.cpp: Copied from Tools\TestWebKitAPI\playstation\main.cpp. (loadLibraryOrExit): (main): * PlatformPlayStation.cmake: * Shared/API/c/playstation/WKEventPlayStation.cpp: Added. (WKKeyboardEventMake): (WKMouseEventMake): (WKWheelEventMake): * Shared/API/c/playstation/WKEventPlayStation.h: Added. * UIProcess/API/C/playstation/WKAPICastPlayStation.h: (WebKit::toAPI<>): (WebKit::toImpl<>): * UIProcess/API/C/playstation/WKContextConfigurationPlayStation.cpp: Copied from Tools\TestWebKitAPI\playstation\PlatformUtilitiesPlayStation.cpp. (WKContextConfigurationSetWebProcessPath): (WKContextConfigurationCopyWebProcessPath): (WKContextConfigurationSetNetworkProcessPath): (WKContextConfigurationCopyNetworkProcessPath): (WKContextConfigurationSetUserId): (WKContextConfigurationGetUserId): * UIProcess/API/C/playstation/WKContextConfigurationPlayStation.h: Copied from Source\WebKit\UIProcess\API\C\playstation\WKView.h. * UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp: Added. (WKPageHandleKeyboardEvent): (WKPageHandleMouseEvent): (WKPageHandleWheelEvent): * UIProcess/API/C/playstation/WKPagePrivatePlayStation.h: Copied from Source\WebKit\UIProcess\API\C\playstation\WKView.h. * UIProcess/API/C/playstation/WKView.cpp: Copied from Source\WebKit\WebProcess\InjectedBundle\playstation\InjectedBundlePlayStation.cpp. (WKViewCreate): (WKViewGetPage): * UIProcess/API/C/playstation/WKView.h: * UIProcess/Launcher/playstation/ProcessLauncherPlayStation.cpp: (WebKit::defaultProcessPath): (WebKit::ProcessLauncher::launchProcess): (WebKit::ProcessLauncher::terminateProcess): (WebKit::ProcessLauncher::platformInvalidate): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::getLaunchOptions): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::getLaunchOptions): * UIProcess/playstation/PageClientImpl.cpp: Added. (WebKit::PageClientImpl::PageClientImpl): (WebKit::PageClientImpl::createDrawingAreaProxy): (WebKit::PageClientImpl::setViewNeedsDisplay): (WebKit::PageClientImpl::requestScroll): (WebKit::PageClientImpl::viewScrollPosition): (WebKit::PageClientImpl::viewSize): (WebKit::PageClientImpl::isViewWindowActive): (WebKit::PageClientImpl::isViewFocused): (WebKit::PageClientImpl::isViewVisible): (WebKit::PageClientImpl::isViewInWindow): (WebKit::PageClientImpl::processDidExit): (WebKit::PageClientImpl::didRelaunchProcess): (WebKit::PageClientImpl::pageClosed): (WebKit::PageClientImpl::preferencesDidChange): (WebKit::PageClientImpl::toolTipChanged): (WebKit::PageClientImpl::didCommitLoadForMainFrame): (WebKit::PageClientImpl::handleDownloadRequest): (WebKit::PageClientImpl::didChangeContentSize): (WebKit::PageClientImpl::setCursor): (WebKit::PageClientImpl::setCursorHiddenUntilMouseMoves): (WebKit::PageClientImpl::didChangeViewportProperties): (WebKit::PageClientImpl::registerEditCommand): (WebKit::PageClientImpl::clearAllEditCommands): (WebKit::PageClientImpl::canUndoRedo): (WebKit::PageClientImpl::executeUndoRedo): (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): (WebKit::PageClientImpl::convertToDeviceSpace): (WebKit::PageClientImpl::convertToUserSpace): (WebKit::PageClientImpl::screenToRootView): (WebKit::PageClientImpl::rootViewToScreen): (WebKit::PageClientImpl::accessibilityScreenToRootView): (WebKit::PageClientImpl::rootViewToAccessibilityScreen): (WebKit::PageClientImpl::doneWithKeyEvent): (WebKit::PageClientImpl::createPopupMenuProxy): (WebKit::PageClientImpl::enterAcceleratedCompositingMode): (WebKit::PageClientImpl::exitAcceleratedCompositingMode): (WebKit::PageClientImpl::updateAcceleratedCompositingMode): (WebKit::PageClientImpl::fullScreenManagerProxyClient): (WebKit::PageClientImpl::didFinishLoadingDataForCustomContentProvider): (WebKit::PageClientImpl::navigationGestureDidBegin): (WebKit::PageClientImpl::navigationGestureWillEnd): (WebKit::PageClientImpl::navigationGestureDidEnd): (WebKit::PageClientImpl::willRecordNavigationSnapshot): (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot): (WebKit::PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame): (WebKit::PageClientImpl::didFinishLoadForMainFrame): (WebKit::PageClientImpl::didFailLoadForMainFrame): (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame): (WebKit::PageClientImpl::didChangeBackgroundColor): (WebKit::PageClientImpl::isPlayingAudioWillChange): (WebKit::PageClientImpl::isPlayingAudioDidChange): (WebKit::PageClientImpl::refView): (WebKit::PageClientImpl::derefView): (WebKit::PageClientImpl::didRestoreScrollPosition): (WebKit::PageClientImpl::userInterfaceLayoutDirection): (WebKit::PageClientImpl::requestDOMPasteAccess): * UIProcess/playstation/PageClientImpl.h: Added. * UIProcess/playstation/WebProcessPoolPlayStation.cpp: (WebKit::WebProcessPool::platformInitialize): * UIProcess/playstation/PlayStationWebView.cpp: Copied from Source\WebKit\UIProcess\playstation\WebProcessPoolPlayStation.cpp. (WebKit::PlayStationWebView::create): (WebKit::PlayStationWebView::PlayStationWebView): (WebKit::PlayStationWebView::~PlayStationWebView): (WebKit::PlayStationWebView::isActive const): (WebKit::PlayStationWebView::isFocused const): (WebKit::PlayStationWebView::isVisible const): * UIProcess/playstation/PlayStationWebView.h: Copied from Source\WebKit\WebProcess\InjectedBundle\playstation\InjectedBundlePlayStation.cpp. (WebKit::PlayStationWebView::page): * WebProcess/EntryPoint/playstation/WebProcessMain.cpp: Copied from Tools\TestWebKitAPI\playstation\main.cpp. (loadLibraryOrExit): (main): * WebProcess/InjectedBundle/playstation/InjectedBundlePlayStation.cpp: (WebKit::InjectedBundle::initialize): (WebKit::InjectedBundle::setBundleParameter): * WebProcess/WebPage/AcceleratedSurface.cpp: (WebKit::AcceleratedSurface::create): 2020-05-21 Chris Dumez Address post review comments from Mitz after r262004. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::sandboxDataVaultParentDirectory): 2020-05-21 Chris Dumez [WK2] WebKit abandons compiled sandbox profiles https://bugs.webkit.org/show_bug.cgi?id=212177 Reviewed by Saam Barati. WebKit generates new compiled sandbox profiles whenever sandbox profiles are updated or whenever webkit directories change (which is super common for WebKitTestRunner). Previous compiled sandbox profiles do not get deleted and therefore may accumulate. To address the issue, we now save compiled sandbox profiles under _CS_DARWIN_USER_TEMP_DIR instead of _CS_DARWIN_USER_CACHE_DIR. The system takes care of deleting the files under _CS_DARWIN_USER_TEMP_DIR upon reboot or if they have not been accessed for 3 days. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::sandboxDataVaultParentDirectory): 2020-05-21 Wenson Hsieh Unreviewed, fix the iOS 13.4 build after r261978 * Platform/spi/ios/UIKitSPI.h: Only declare `_UIHoverEventRespondable` if HAVE(UI_HOVER_EVENT_RESPONDABLE) is defined. * UIProcess/ios/WKMouseGestureRecognizer.mm: If `_UIHoverEventRespondable` is not present, fall back to declaring internal methods on `UIHoverGestureRecognizer`. 2020-05-21 Yoshiaki JITSUKAWA [ConnectionUnix] Set MSG_NOSIGNAL to avoid SIGPIPE https://bugs.webkit.org/show_bug.cgi?id=211719 Reviewed by Don Olmstead. Set MSG_NOSIGNAL to sendmsg()/resvmsg() in order to avoid SIGPIPE when the other process disappears. * Platform/IPC/unix/ConnectionUnix.cpp: (IPC::readBytesFromSocket): (IPC::Connection::sendOutputMessage): 2020-05-21 Enrique Ocaña González [GStreamer][GTK][WPE] Expose and honor the media content types requiring hardware support setting https://bugs.webkit.org/show_bug.cgi?id=211950 Reviewed by Adrian Perez de Castro. Expose mediaContentTypesRequiringHardwareSupport as a setting on WPE and WebKitGTK. * UIProcess/API/glib/WebKitSettings.cpp: (_WebKitSettingsPrivate::_WebKitSettingsPrivate): (webKitSettingsSetProperty): (webKitSettingsGetProperty): (webkit_settings_class_init): (webkit_settings_get_media_content_types_requiring_hardware_support): (webkit_settings_set_media_content_types_requiring_hardware_support): * UIProcess/API/gtk/WebKitSettings.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: * UIProcess/API/wpe/WebKitSettings.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: 2020-05-20 Darin Adler Dictation context should be an object identifier, not a type-punned pointer https://bugs.webkit.org/show_bug.cgi?id=212174 Reviewed by Anders Carlsson. * Scripts/webkit/messages.py: Added DictationContext to the list of types that are not C++ classes. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): Updated for change to DictationAlternative structure. (IPC::ArgumentCoder::decode): Ditto. * UIProcess/Cocoa/PageClientImplCocoa.h: Use DictationContext instead of uint64_t. * UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::addDictationAlternatives): Ditto. (WebKit::PageClientImplCocoa::removeDictationAlternatives): Ditto. (WebKit::PageClientImplCocoa::dictationAlternatives): Ditto. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::insertDictatedTextAsync): Ditto. * UIProcess/PageClient.h: Ditto. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showDictationAlternativeUI): Ditto. (WebKit::WebPageProxy::removeDictationAlternatives): Ditto. (WebKit::WebPageProxy::dictationAlternatives): Ditto. * UIProcess/WebPageProxy.h: Ditto. * UIProcess/WebPageProxy.messages.in: Ditto. * UIProcess/ios/PageClientImplIOS.h: Ditto. * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::showDictationAlternativeUI): Ditto. * UIProcess/mac/PageClientImplMac.h: Ditto. * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::showDictationAlternativeUI): Ditto. * UIProcess/mac/WebPageProxyMac.mm: Removed unneeded include of DictationAlternative.h. * WebProcess/WebCoreSupport/WebAlternativeTextClient.h: Use DictationContext instead of uint64_t. Also marked class final and made everything private. * WebProcess/WebCoreSupport/mac/WebAlternativeTextClient.cpp: (WebKit::WebAlternativeTextClient::removeDictationAlternatives): Ditto. (WebKit::WebAlternativeTextClient::showDictationAlternativeUI): Ditto. (WebKit::WebAlternativeTextClient::dictationAlternatives): Ditto. 2020-05-20 Tim Horton WKMouseGestureRecognizer should be implemented without using UIKit internals https://bugs.webkit.org/show_bug.cgi?id=212173 Reviewed by Wenson Hsieh. * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView gestureRecognizer:shouldReceiveTouch:]): * UIProcess/ios/WKMouseGestureRecognizer.h: * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer _hoverEntered:withEvent:]): (-[WKMouseGestureRecognizer initWithTarget:action:]): Deleted. (-[WKMouseGestureRecognizer setView:]): Deleted. (-[WKMouseGestureRecognizer _wantsHoverEvents]): Deleted. (-[WKMouseGestureRecognizer canPreventGestureRecognizer:]): Deleted. (-[WKMouseGestureRecognizer canBePreventedByGestureRecognizer:]): Deleted. Reimplement WKMouseGestureRecognizer as a UIHoverGestureRecognizer subclass, so we can decouple ourselves a bit from UIKit internals. 2020-05-20 Per Arne Vollan [iOS] Fix message filter sandbox violation https://bugs.webkit.org/show_bug.cgi?id=212100 Reviewed by Brent Fulgham. A message needs to be added to the message filter in the WebContent sandbox on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-05-20 Sam Weinig Replace Color::getHSL() with sRGBToHSL to ensure it at least gives somewhat sensible results for ExtendedColors and reduce code duplication https://bugs.webkit.org/show_bug.cgi?id=212143 Reviewed by Simon Fraser. * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _updateScrollViewBackground]): Switch to using Color::lightness(). 2020-05-20 Megan Gardner Hide password echo when screen is being captured. https://bugs.webkit.org/show_bug.cgi?id=212060 Reviewed by Wenson Hsieh. Use the UIScreen state and notification to determine if the screen is being shared or captured. This flag is for all capture methods, Air Play, Screen Recording, etc. If the screen is being captured, turn off the password echo to prevent the password from being leaked. * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView _commonInitializationWithProcessPool:configuration:]): (-[WKContentView _screenCapturedDidChange:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::setIsScreenCaptured): * WebProcess/WebCoreSupport/WebEditorClient.h: * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm: (WebKit::WebEditorClient::isScreenCaptured const): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::isScreenCaptured const): * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::setIsScreenCaptured): 2020-05-20 ChangSeok Oh [GTK] Implement connected and disconnected events of GAMEPAD API with libmanette https://bugs.webkit.org/show_bug.cgi?id=133854 Reviewed by Carlos Garcia Campos. This patch brings initial GAMEPAD API support to the gtk port. We use libmanette, a simple GObject game controller library to handle gamepad connection and input. * SourcesGTK.txt: * UIProcess/Gamepad/UIGamepadProvider.cpp: Add a build flag to void default interface * UIProcess/Gamepad/gtk/UIGamepadProviderGtk.cpp: Added to retrieve WebPageProxy to which a gamepad connects. The returned WebPageProxy handles input events from the gamepad. (WebKit::getWebPageProxy): (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput): * UIProcess/Gamepad/manette/UIGamepadProviderManette.cpp: Added. (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput): (WebKit::UIGamepadProvider::platformStopMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringInput): 2020-05-20 Kate Cheney Support operating dates in ResourceLoadStatisticsDatabaseStore https://bugs.webkit.org/show_bug.cgi?id=212034 Reviewed by Brent Fulgham. Tests: http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-database.html http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed.html http/tests/resourceLoadStatistics/operating-dates-all-website-data-removed-database.html http/tests/resourceLoadStatistics/operating-dates-all-website-data-removed.html Patch to support Operating Dates in the ResourceLoadStatisticsDatabaseStore. Moves functions out of ResourceLoadStatisticsStore now that each store needs its own implementation. Adds a new function for testing which inserts an expired statistic and makes sure the proper behavior occurs depending on additional parameters. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::createTableQueries): (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::checkForMissingTablesInSchema): (WebKit::ResourceLoadStatisticsDatabaseStore::createUniqueIndices): (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema): (WebKit::ResourceLoadStatisticsDatabaseStore::getLeastRecentOperatingDate): (WebKit::ResourceLoadStatisticsDatabaseStore::mergeOperatingDates): (WebKit::ResourceLoadStatisticsDatabaseStore::includeTodayAsOperatingDateIfNecessary): (WebKit::ResourceLoadStatisticsDatabaseStore::hasStatisticsExpired const): (WebKit::ResourceLoadStatisticsDatabaseStore::insertExpiredStatisticForTesting): Migrated Operating Dates functions from ResourceLoadStatisticsStore and implemented them using SQLite instead of a vector. Functionality is identical to the original in-memory implementation. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore): (WebKit::ResourceLoadStatisticsMemoryStore::mergeOperatingDates): (WebKit::ResourceLoadStatisticsMemoryStore::includeTodayAsOperatingDateIfNecessary): (WebKit::ResourceLoadStatisticsMemoryStore::hasStatisticsExpired const): (WebKit::ResourceLoadStatisticsMemoryStore::insertExpiredStatisticForTesting): * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: Migrated Operating Dates functions from ResourceLoadStatisticsStore now that the database store does not use them. * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp: (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk): Spelling error. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore): (WebKit::ResourceLoadStatisticsStore::updateCookieBlockingForDomains): (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const): Deleted. (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates): Deleted. (WebKit::ResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary): Deleted. (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const): Deleted. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: (WebKit::OperatingDate::year const): (WebKit::OperatingDate::month const): (WebKit::OperatingDate::monthDay const): These functions should be public now that they are needed outside of this file after migrating OperatingDates functions. (WebKit::ResourceLoadStatisticsStore::parameters const): (WebKit::ResourceLoadStatisticsStore::operatingDates const): Deleted. (WebKit::ResourceLoadStatisticsStore::clearOperatingDates): Deleted. Moved OperatingDates functions to the memory store. Moved operatingDatesWindow constexpr variables to the header file so that the database and memory stores can both use them. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::insertExpiredStatisticForTesting): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::insertExpiredStatisticForTesting): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetStatisticsExpiredStatistic): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::insertExpiredStatisticForTesting): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::mergeStatisticForTesting): (WebKit::WebsiteDataStore::insertExpiredStatisticForTesting): * UIProcess/WebsiteData/WebsiteDataStore.h: Function to add expired statistic to the ITP store. 2020-05-20 Chris Dumez Deprecate WKBundlePageSetPolicyClient() Injected bundle C API https://bugs.webkit.org/show_bug.cgi?id=212166 Reviewed by Alex Christensen. Deprecate WKBundlePageSetPolicyClient() Injected bundle C API. Approving navigations from the injected bundle can lead to WebProcess terminations like in because the WebProcess is not in a position to do sandbox checks when navigating to file URLs. * WebProcess/InjectedBundle/API/c/WKBundlePage.h: 2020-05-20 Simon Fraser Plumb the display's nominal refresh rate down to ScrollingTree for use in scroll synchronization https://bugs.webkit.org/show_bug.cgi?id=212159 Reviewed by Tim Horton. Plumb an Optional down windowScreenDidChange, which contains the nominal display refresh rate (as frames per second) if available. On macOS, we get this from CVDisplayLinkGetNominalOutputVideoRefreshPeriod(). To read it, WebProcessPool::nominalFramesPerSecondForDisplay() makes a DisplayLink that doesn't get any observers, but that DisplayLink will very likely get used as soon as we schedule a rendering update. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::nominalFramesPerSecondForDisplay): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::windowDidChangeScreen): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::windowScreenDidChange): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.h: * UIProcess/mac/DisplayLink.cpp: (WebKit::DisplayLink::DisplayLink): (WebKit::DisplayLink::nominalFramesPerSecond const): * UIProcess/mac/DisplayLink.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::windowScreenDidChange): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-05-20 Myles C. Maxfield [iPadOS] -webkit-text-size-adjust:percentage doesn't work in native apps https://bugs.webkit.org/show_bug.cgi?id=212122 Reviewed by Wenson Hsieh. * 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/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies): 2020-05-20 Kate Cheney REGRESSION (r261892) [ Mac Debug ] 4 API tests failing related to ResourceLoadStatistics https://bugs.webkit.org/show_bug.cgi?id=212153 Reviewed by Sihui Liu. Accidentally deleted necessary reset() call for a SQLite statement when converting stored statements to SQLiteStatementAutoResetScope in https://trac.webkit.org/changeset/261892/webkit. This statement is used in a loop with multiple bind() calls so it must be reset. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::checkForMissingTablesInSchema): 2020-05-20 Eric Carlson Update some media logging https://bugs.webkit.org/show_bug.cgi?id=212109 Unreviewed, remove a change unintentionally included in r261899. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController _interactivePinchDismissChanged:]): 2020-05-20 Andy Estes [Mac] UI processes spin when creating the "Share" context menu item https://bugs.webkit.org/show_bug.cgi?id=212137 Reviewed by Wenson Hsieh. On Mac, WebKit has been using the +[NSMenuItem standardShareMenuItemForItems:] SPI to create the "Share" context submenu and menu item. This call performs synchronous IPC and can result in UI process spins. Where available, switch to using the asynchronous -[NSSharingServicePicker getMenuWithCompletion:] SPI instead. This method only creates the submenu, not the menu item, so when using this new method we must create the "Share" menu item ourselves. * UIProcess/mac/WebContextMenuProxyMac.h: * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::getStandardShareMenuItem): (WebKit::WebContextMenuProxyMac::getShareMenuItem): (WebKit::WebContextMenuProxyMac::getContextMenuFromItems): (WebKit::WebContextMenuProxyMac::getContextMenuItem): (WebKit::WebContextMenuProxyMac::showContextMenuWithItems): (WebKit::WebContextMenuProxyMac::createShareMenuItem): Deleted. (WebKit::WebContextMenuProxyMac::createContextMenuFromItems): Deleted. (WebKit::WebContextMenuProxyMac::createContextMenuItem): Deleted. 2020-05-20 Carlos Garcia Campos Unreviewed. Fix GTK4 build with GTK 3.98.4 * PlatformGTK.cmake: * UIProcess/API/gtk/WebKitPrintOperation.cpp: (webkitPrintOperationRunDialog): * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseAddDialog): (webkitWebViewBaseRemoveChild): (webkitWebViewBaseContainerForall): (webkitWebViewBaseAddWebInspector): (webkitWebViewBaseRemoveWebInspector): (webkitWebViewBaseDispose): (webkitWebViewBaseSizeAllocate): (webkitWebViewBaseConstructed): (webkit_web_view_base_class_init): * UIProcess/API/gtk/WebKitWebViewBase.h: Removed. * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp: (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow): (WebKit::RemoteWebInspectorProxy::platformSave): * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp: (WebKit::WebInspectorProxy::platformCreateFrontendWindow): (WebKit::WebInspectorProxy::platformAttach): (WebKit::WebInspectorProxy::platformDetach): (WebKit::WebInspectorProxy::platformSave): * UIProcess/gtk/WebContextMenuProxyGtk.cpp: (WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk): 2020-05-12 Carlos Garcia Campos [GTK4] Add support for drag and drop operations https://bugs.webkit.org/show_bug.cgi?id=211779 Reviewed by Adrian Perez de Castro. * UIProcess/API/gtk/DragSource.h: * UIProcess/API/gtk/DragSourceGtk4.cpp: (WebKit::DragSource::begin): * UIProcess/API/gtk/DropTarget.h: * UIProcess/API/gtk/DropTargetGtk4.cpp: (WebKit::DropTarget::DropTarget): (WebKit::DropTarget::~DropTarget): (WebKit::DropTarget::accept): (WebKit::DropReadAsyncData::DropReadAsyncData): (WebKit::DropTarget::loadData): (WebKit::DropTarget::didLoadData): (WebKit::DropTarget::enter): (WebKit::DropTarget::update): (WebKit::DropTarget::didPerformAction): (WebKit::DropTarget::leave): (WebKit::DropTarget::drop): 2020-05-19 Wenson Hsieh REGRESSION (r258919): fast/events/ios/key-events-comprehensive/key-events-control tests are failing https://bugs.webkit.org/show_bug.cgi?id=212124 Reviewed by Tim Horton. After the changes in r258919, WKContentView's text input traits report that we're in a single line input, even when there is no editable focused element. This prevents UIKit from allowing WebKit to handle the `CTRL + M` key command, which is interpreted at the system level as inserting a line break in a multi-line editable area. It seems odd to consider ourselves in a single line input when there isn't even an editable element focused element; for now, we can fix these failing tests by just going with the default value for the text input traits' `setIsSingleLineDocument` property, but not explicitly setting it to either `NO` or `YES` when no element is focused. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView textInputTraits]): 2020-05-19 Sam Weinig Remove almost always incorrect Color::getRGBA https://bugs.webkit.org/show_bug.cgi?id=212059 Reviewed by Darin Adler and Simon Fraser. * UIProcess/API/wpe/WebKitColor.cpp: (webkitColorFillFromWebCoreColor): * UIProcess/gtk/ViewGestureControllerGtk.cpp: (WebKit::ViewGestureController::beginSwipeGesture): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::getDocumentBackgroundColor): Replace Color::getRGBA with Color::toSRGBAComponentsLossy() 2020-05-19 Simon Fraser Use an ObjectIdentifier<> for DisplayLink observer IDs https://bugs.webkit.org/show_bug.cgi?id=212112 Reviewed by Per Arne Vollan. Replace unsigned observerID with DisplayLinkObserverID, which is a typesafe ObjectIdentifier<>. Use PlatformDisplayID in more places. * Scripts/webkit/messages.py: * Shared/DisplayLinkObserverID.h: Copied from Source/WebKit/UIProcess/mac/DisplayLink.h. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::startDisplayLink): (WebKit::WebProcessPool::stopDisplayLink): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * UIProcess/mac/DisplayLink.cpp: (WebKit::DisplayLink::addObserver): (WebKit::DisplayLink::removeObserver): * UIProcess/mac/DisplayLink.h: * UIProcess/mac/WebProcessProxyMac.mm: (WebKit::WebProcessProxy::startDisplayLink): (WebKit::WebProcessProxy::stopDisplayLink): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/mac/DrawingAreaMac.cpp: (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac): 2020-05-19 Alex Christensen Add _WKDownloadDelegate callback including totalBytesWritten https://bugs.webkit.org/show_bug.cgi?id=212110 Reviewed by Geoffrey Garen. Without this new callback, after resuming a download, a client has no way to tell whether the download was successfully resumed by a server that has proper etag and range request support or whether the download began at the beginning again. A client was guessing that the download did not restart, causing incorrect reported download sizes when the download did restart. Luckily, the data on disk was not corrupted, just the UI. This allows us to fix the UI. Testing covered by expanding the API test for resuming downloads. * NetworkProcess/Downloads/Download.cpp: (WebKit::Download::didReceiveData): * NetworkProcess/Downloads/Download.h: * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::writeDownload): * NetworkProcess/NetworkDataTaskBlob.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]): * UIProcess/API/APIDownloadClient.h: (API::DownloadClient::didReceiveData): * UIProcess/API/C/WKContext.cpp: (WKContextSetDownloadClient): * UIProcess/API/Cocoa/_WKDownloadDelegate.h: * UIProcess/Cocoa/DownloadClient.h: * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::DownloadClient): (WebKit::DownloadClient::didReceiveResponse): (WebKit::DownloadClient::didReceiveData): * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::didReceiveData): * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::expectedContentLength const): Deleted. (WebKit::DownloadProxy::setExpectedContentLength): Deleted. (WebKit::DownloadProxy::bytesLoaded const): Deleted. (WebKit::DownloadProxy::setBytesLoaded): Deleted. * UIProcess/Downloads/DownloadProxy.messages.in: 2020-05-19 Kate Cheney ITP database should finalize all prepared statements before closing https://bugs.webkit.org/show_bug.cgi?id=211929 Reviewed by John Wilander. No new tests, behavior confirmed by existing tests. Convert all SQLite statement objects to be unique pointers to better manage the lifetime of each statement object. Only initialize and prepare an object when it is needed instead of preparing all objects at once. Set each statement to null before closing the database because ~SQLiteStatement() will finalize the statement. This patch removes all reset() commands now that we initialize each statement using SQLiteStatementAutoResetScope. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::close): (WebKit::ResourceLoadStatisticsDatabaseStore::getScopedStatement const): Function to initialize and prepare a statement. (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationship): This function is not used and can be deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::checkForMissingTablesInSchema): (WebKit::ResourceLoadStatisticsDatabaseStore::isMigrationNecessary): (WebKit::ResourceLoadStatisticsDatabaseStore::openAndUpdateSchemaIfNecessary): (WebKit::ResourceLoadStatisticsDatabaseStore::isEmpty const): (WebKit::ResourceLoadStatisticsDatabaseStore::destroyStatements): (WebKit::ResourceLoadStatisticsDatabaseStore::insertObservedDomain): (WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const): (WebKit::ResourceLoadStatisticsDatabaseStore::domainID const): (WebKit::ResourceLoadStatisticsDatabaseStore::merge): (WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistic): (WebKit::CompletionHandler [iOS] Fix message filter sandbox violation https://bugs.webkit.org/show_bug.cgi?id=212100 Reviewed by Andy Estes. A message needs to be added to the message filter in the WebContent sandbox on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-05-19 Kate Cheney Revert WebKitTestRunner to reset ITP to the memory store between all tests. https://bugs.webkit.org/show_bug.cgi?id=212094 Reviewed by Chris Dumez. Changing this in https://bugs.webkit.org/show_bug.cgi?id=211637 caused test flakiness. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreStatisticsResetToConsistentState): 2020-05-19 Simon Fraser Push a PlatformDisplayID to scrolling trees, and allow the scrolling thread to get displayDidRefresh notifications https://bugs.webkit.org/show_bug.cgi?id=211034 Reviewed by Sam Weinig. Prep work for webkit.org/b210884. Have EventDispatcher call displayDidRefresh() on each scrolling tree it knows about. It calls this on the EventDispatcher thread; the scrolling tree is responsible for bouncing that to the scrolling thread. * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::displayDidRefreshOnScrollingThread): (WebKit::EventDispatcher::displayWasRefreshed): * WebProcess/WebPage/EventDispatcher.h: 2020-05-19 Wenson Hsieh [macOS] Drag and drop within a contenteditable area duplicates attachment-backed images https://bugs.webkit.org/show_bug.cgi?id=212075 Reviewed by Andy Estes. When the attachment API is enabled, starting a drag on an attachment-element-backed image within a contenteditable area sometimes causes the ranged selection to collapse. This is because `WebViewImpl::startDrag` has a separate codepath for starting a drag with attachment metadata that doesn't invoke `NSView`'s deprecated `-dragImage:at:offset:event:pasteboar:source:slideBack:` method, but instead uses `-beginDraggingSessionWithItems:event:source:`. While the former spins the runloop until the end of the drag session, the latter does not and returns immediately after beginning the drag. As a result, `WebPageProxy::didStartDrag()` is actually invoked after the drag ends when dragging non-attachment content, whereas `WebPageProxy::didStartDrag()` is invoked immediately after beginning the drag when starting a drag in an attachment or attachment-backed image element. This call to `didStartDrag()` is used to inform the web process that dragging has begun, and sets the `m_isStartingDrag` flag on `WebPage` to false. As a result, `m_isStartingDrag` is true over the course of the drag session when dragging non-attachment elements, but it's only true while starting the drag when dragging attachments. This flag is consulted in `WebPage::mouseEvent()` to determine whether we should avoid handling the incoming mouse event when beginning a drag. This prevents these incoming mouse events from triggering selection changes while dragging (for more details, refer to ). Now, if we combine this with the fact that mouse events can be queued up in the UI process (refer to ), it's possible to end up handling these queued mouse events in the web process after `m_isStartingDrag` has been set back to false when dragging an attachment. This doesn't happen when dragging non-attachment content, since we don't call `didStartDrag()` until the drag has already ended, so any queued mouse events are sent to the web process and immediately dropped on the floor since `m_isStartingDrag` is true. To address this, we make a couple of minor adjustments: 1. Invoke `didStartDrag()` right before calling into `-dragImage:at:offset:event:pasteboar:source:slideBack:`, so that we don't wait until the drag ends to set `m_isStartingDrag` to false. This makes the behavior of both codepaths for starting a drag (attachment and non-attachment) consistent, and also makes it consistent with iOS. 2. In `didStartDrag()`, discard any queued mouse events to prevent them from being handled by the page (e.g. causing the selection to change immediately after starting the drag). We already have identical logic to do this when showing a context menu, so we can factor this out into a private `WebPageProxy` helper and call it from both places. Test: WKAttachmentTestsMac.DraggingAttachmentBackedImagePreservesRangedSelection * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::startDrag): Invoke `didStartDrag()` earlier when starting a drag using the deprecated method, such that we don't wait until the drag ends to set `m_isStartingDrag` to false in the web process. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::discardQueuedMouseEvents): Refactor logic to discard all queued mouse events into a separate private helper. (WebKit::WebPageProxy::didStartDrag): Use the above helper to empty queued mouse events when starting a drag. (WebKit::WebPageProxy::showContextMenu): * UIProcess/WebPageProxy.h: 2020-05-19 Andy Estes [Apple Pay] Add testing and logging for ApplePaySetup https://bugs.webkit.org/show_bug.cgi?id=211972 Reviewed by Alex Christensen. * Shared/ApplePay/PaymentSetupConfiguration.mm: (WebKit::toPlatformConfiguration): (WebKit::PaymentSetupConfiguration::PaymentSetupConfiguration): * Shared/ApplePay/PaymentSetupConfigurationWebKit.h: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::getSetupFeatures): (WebKit::WebPaymentCoordinator::beginApplePaySetup): * WebProcess/ApplePay/WebPaymentCoordinator.h: 2020-05-19 Brent Fulgham REGRESSION(r243149): createMediaElementSource not working https://bugs.webkit.org/show_bug.cgi?id=211394 Reviewed by Per Arne Vollan. I removed access to some Audio services in r243149, because we believed they were already blocked by a global deny command. However, Sandbox rules override generic rules with explicit rules, so the imported sandbox rules were not being blocked. This patch re-adds the rules needed to support these audio routines on iOS hardware. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::mediaRelatedMachServices): 2020-05-19 Chris Dumez [iOS] Port Foreground process assertion to RunningBoard https://bugs.webkit.org/show_bug.cgi?id=211795 Reviewed by Geoffrey Garen. Port Foreground process assertion to RunningBoard now that has been fixed. * Configurations/WebKit.xcconfig: * UIProcess/ProcessAssertion.h: * UIProcess/ios/ProcessAssertionIOS.mm: (WebKit::runningBoardNameForAssertionType): (WebKit::ProcessAssertion::ProcessAssertion): (WebKit::ProcessAssertion::~ProcessAssertion): (WebKit::ProcessAssertion::isValid const): 2020-05-19 Andy Estes [Apple Pay] Add testing and logging for ApplePaySetup https://bugs.webkit.org/show_bug.cgi?id=211972 Reviewed by Alex Christensen. * Shared/ApplePay/PaymentSetupConfiguration.mm: (WebKit::toPlatformConfiguration): (WebKit::PaymentSetupConfiguration::PaymentSetupConfiguration): * Shared/ApplePay/PaymentSetupConfigurationWebKit.h: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::getSetupFeatures): (WebKit::WebPaymentCoordinator::beginApplePaySetup): * WebProcess/ApplePay/WebPaymentCoordinator.h: 2020-05-19 Michael Catanzaro [GTK] Add WEBKIT_EDITING_COMMAND_PASTE_AS_PLAIN_TEXT https://bugs.webkit.org/show_bug.cgi?id=212038 Reviewed by Carlos Garcia Campos. * UIProcess/API/gtk/WebKitEditingCommands.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitEditingCommands.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: 2020-05-18 David Kilzer Replace TextIndicatorOptions with OptionSet Reviewed by Simon Fraser. Use OptionSet everywhere TextIndicatorOptions was previously used, plus: - Make TextIndicatorOption an enum class. Remove "TextIndicatorOption" prefix so TextIndicatorOptionBar becomes TextIndicatorOption::Bar. - Remove TextIndicatorOptionDefault because OptionSet<> initializes to zero. - Replace static variables (including two globals in WebCore) with constexpr variables. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::dictionaryPopupInfoForRange): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindIndicator): * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::insertDroppedImagePlaceholders): (WebKit::WebPage::computeAndSendEditDragSnapshot): (WebKit::linkIndicatorPositionInformation): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performImmediateActionHitTestAtLocation): 2020-05-18 Andy Estes http/tests/ssl/applepay/ApplePayInstallmentConfiguration.https.html fails in public SDK builds https://bugs.webkit.org/show_bug.cgi?id=212000 Reviewed by Youenn Fablet. * Configurations/FeatureDefines.xcconfig: * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: * Shared/WebCoreArgumentCoders.h: 2020-05-18 Tim Horton Rare crash under -[WKContentView resignFirstResponderForWebView] https://bugs.webkit.org/show_bug.cgi?id=212050 Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView resignFirstResponderForWebView]): Reorganize this block so that it always takes a strong reference /before/ null checking and using the pointer. Also, add a _page null check. This is a speculative fix for an unreproducible low-rate crash. In theory the existing time-of-check race here should not be a problem, since WKWebView is supposed to be freed on the main thread, and this code runs on the main thread, but we have ample evidence of WKWebView being freed off the main thread in various clients. 2020-05-18 David Kilzer Use default initializers in TextIndicatorData Reviewed by Alex Christensen. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): - Switch from decodeEnum() and encodeEnum() to modern equivalents that check for valid enum values. 2020-05-18 Wenson Hsieh Replace uses of +self with +class https://bugs.webkit.org/show_bug.cgi?id=212041 Reviewed by Darin Adler. * Shared/API/Cocoa/_WKFrameHandle.mm: (-[_WKFrameHandle isEqual:]): (-[_WKFrameHandle initWithCoder:]): * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration _setAttachmentFileWrapperClass:]): * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): * UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::allocFileWrapperInstance const): (WebKit::PageClientImplCocoa::serializableFileWrapperClasses const): * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (+[WKTransformView layerClass]): (+[WKSimpleBackdropView layerClass]): Deleted. (+[WKShapeView layerClass]): Deleted. (-[WKRemoteView initWithFrame:contextID:]): Deleted. * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (WebKit::ScrollingTreeScrollingNodeDelegateIOS::~ScrollingTreeScrollingNodeDelegateIOS): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::resetScrollViewDelegate): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollView const): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView selectFormAccessoryPickerRow:]): (-[WKContentView selectFormPopoverTitle]): 2020-05-18 Alex Christensen WebPageProxy::DidCommitLoadForFrame should use FrameLoadType instead of casting to/from uint32_t for IPC https://bugs.webkit.org/show_bug.cgi?id=212028 Reviewed by David Kilzer. * 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-05-18 Wenson Hsieh Single selection