2019-03-05 Kocsen Chung Cherry-pick r242394. rdar://problem/48591280 Unreviewed build fix after r242378 * UIProcess/ios/EditableImageController.mm: (WebKit::EditableImageController::associateWithAttachment): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242394 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-03-04 Brent Fulgham Unreviewed build fix after r242378 * UIProcess/ios/EditableImageController.mm: (WebKit::EditableImageController::associateWithAttachment): 2019-03-05 Kocsen Chung Cherry-pick r242378. rdar://problem/48591280 Check contextIDs when handling WebContent messages https://bugs.webkit.org/show_bug.cgi?id=195289 Reviewed by Alex Christensen. The WebContent process is untrusted because it handles arbitrary markup and javascript from untrusted sources. We should handle its messages with suspicion, and make sure the arguments are valid and usable before honoring them. This patch hardens the message passing layer by performing MESSAGE_CHECK in places that had been overlooked. * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm: (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID): (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::pictureInPictureActiveChanged): (WebKit::PlaybackSessionManagerProxy::handleControlledElementIDResponse const): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): (WebKit::UserMediaCaptureManagerProxy::startProducingData): (WebKit::UserMediaCaptureManagerProxy::stopProducingData): (WebKit::UserMediaCaptureManagerProxy::end): (WebKit::UserMediaCaptureManagerProxy::capabilities): (WebKit::UserMediaCaptureManagerProxy::setMuted): (WebKit::UserMediaCaptureManagerProxy::applyConstraints): * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (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): * UIProcess/ios/EditableImageController.mm: (WebKit::EditableImageController::didCreateEditableImage): (WebKit::EditableImageController::didDestroyEditableImage): (WebKit::EditableImageController::associateWithAttachment): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242378 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-03-04 Brent Fulgham Check contextIDs when handling WebContent messages https://bugs.webkit.org/show_bug.cgi?id=195289 Reviewed by Alex Christensen. The WebContent process is untrusted because it handles arbitrary markup and javascript from untrusted sources. We should handle its messages with suspicion, and make sure the arguments are valid and usable before honoring them. This patch hardens the message passing layer by performing MESSAGE_CHECK in places that had been overlooked. * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm: (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID): (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::pictureInPictureActiveChanged): (WebKit::PlaybackSessionManagerProxy::handleControlledElementIDResponse const): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): (WebKit::UserMediaCaptureManagerProxy::startProducingData): (WebKit::UserMediaCaptureManagerProxy::stopProducingData): (WebKit::UserMediaCaptureManagerProxy::end): (WebKit::UserMediaCaptureManagerProxy::capabilities): (WebKit::UserMediaCaptureManagerProxy::setMuted): (WebKit::UserMediaCaptureManagerProxy::applyConstraints): * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (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): * UIProcess/ios/EditableImageController.mm: (WebKit::EditableImageController::didCreateEditableImage): (WebKit::EditableImageController::didDestroyEditableImage): (WebKit::EditableImageController::associateWithAttachment): 2019-02-27 Alan Coon Apply patch. rdar://problem/48429602 2019-02-27 Alex Christensen Move ephemeral local storage from WebProcess to UIProcess https://bugs.webkit.org/show_bug.cgi?id=195074 Reviewed by Geoff Garen. Before PSON, a page could navigate to another domain that navigates back and still have its local storage. Since PSON makes it unreliable to retain the state in the WebProcess, move it to the process with the rest of the local storage. If it's ephemeral, we obviously can't use the SQLite on-disk storage implementation, so use the same WebCore::StorageMap we used to in the WebProcess. * UIProcess/WebStorage/StorageManager.cpp: (WebKit::StorageManager::LocalStorageNamespace::LocalStorageNamespace): (WebKit::StorageManager::StorageManager): (WebKit::StorageManager::createLocalStorageMap): (WebKit::StorageManager::createTransientLocalStorageMap): (WebKit::StorageManager::createSessionStorageMap): (WebKit::StorageManager::destroyStorageMap): (WebKit::StorageManager::getValues): (WebKit::StorageManager::setItem): (WebKit::StorageManager::removeItem): (WebKit::StorageManager::clear): * UIProcess/WebStorage/StorageManager.h: * UIProcess/WebStorage/StorageManager.messages.in: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::WebsiteDataStore): * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::StorageAreaMap::StorageAreaMap): (WebKit::StorageAreaMap::setItem): (WebKit::StorageAreaMap::removeItem): (WebKit::StorageAreaMap::clear): (WebKit::StorageAreaMap::loadValuesIfNeeded): * WebProcess/WebStorage/StorageNamespaceImpl.cpp: (WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace): (WebKit::StorageNamespaceImpl::storageArea): (WebKit::StorageNamespaceImpl::copy): (): Deleted. (WebKit::StorageNamespaceImpl::ephemeralLocalStorageArea): Deleted. * WebProcess/WebStorage/StorageNamespaceImpl.h: 2019-02-27 Kocsen Chung Cherry-pick r242089. rdar://problem/48445620 WebPageProxy should nullify m_userMediaPermissionRequestManager after resetting the media state https://bugs.webkit.org/show_bug.cgi?id=195028 Reviewed by Eric Carlson. Source/WebKit: Covered by API test. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetState): Tools: * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242089 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-26 Youenn Fablet WebPageProxy should nullify m_userMediaPermissionRequestManager after resetting the media state https://bugs.webkit.org/show_bug.cgi?id=195028 Reviewed by Eric Carlson. Covered by API test. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetState): 2019-02-24 Babak Shafiei Cherry-pick r241963. rdar://problem/48350367 Regression(PSON) Unable to preview password-protected documents on iCloud.com https://bugs.webkit.org/show_bug.cgi?id=194954 Reviewed by Alex Christensen. Source/WebKit: Make sure the ProvisionalPageProxy forwards to the WebPageProxy the QuickLook-related IPC on iOS. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame): (WebKit::ProvisionalPageProxy::didReceiveMessage): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.h: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame): (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrameShared): Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: (-[PSONNavigationDelegate _webViewDidRequestPasswordForQuickLookDocument:]): (-[PSONNavigationDelegate _webView:didStartLoadForQuickLookDocumentInMainFrameWithFileName:uti:]): (-[PSONNavigationDelegate _webView:didFinishLoadForQuickLookDocumentInMainFrame:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241963 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-22 Chris Dumez Regression(PSON) Unable to preview password-protected documents on iCloud.com https://bugs.webkit.org/show_bug.cgi?id=194954 Reviewed by Alex Christensen. Make sure the ProvisionalPageProxy forwards to the WebPageProxy the QuickLook-related IPC on iOS. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame): (WebKit::ProvisionalPageProxy::didReceiveMessage): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.h: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame): (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrameShared): 2019-02-24 Babak Shafiei Cherry-pick r241950. rdar://problem/48317455 REGRESSION(PSON) Scroll position is sometimes not restored on history navigation https://bugs.webkit.org/show_bug.cgi?id=194924 Reviewed by Geoffrey Garen. Source/WebKit: When process-swapping, we would create a new WebPage in the new process, which would call restoreSessionInternal() to restore the HistoryItems based on the UIProcess's backforward list. The issue is that this session restoring would send HistoryItem updates back to the UIProcess. Without PSON, this would be unnecessary but harmless. With PSON though, this may end up overwriting values set by the previous process, such as the scroll position. Address the issue by temporarily disabling the HistoryItem update notifications to the UIProcess while restoring a session. * UIProcess/API/Cocoa/WKBackForwardListItem.mm: (-[WKBackForwardListItem _scrollPosition]): * UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::restoreSessionInternal): Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241950 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-22 Chris Dumez REGRESSION(PSON) Scroll position is sometimes not restored on history navigation https://bugs.webkit.org/show_bug.cgi?id=194924 Reviewed by Geoffrey Garen. When process-swapping, we would create a new WebPage in the new process, which would call restoreSessionInternal() to restore the HistoryItems based on the UIProcess's backforward list. The issue is that this session restoring would send HistoryItem updates back to the UIProcess. Without PSON, this would be unnecessary but harmless. With PSON though, this may end up overwriting values set by the previous process, such as the scroll position. Address the issue by temporarily disabling the HistoryItem update notifications to the UIProcess while restoring a session. * UIProcess/API/Cocoa/WKBackForwardListItem.mm: (-[WKBackForwardListItem _scrollPosition]): * UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::restoreSessionInternal): 2019-02-24 Babak Shafiei Cherry-pick r241928. rdar://problem/48317429 Discard cached processes when clearing website data store https://bugs.webkit.org/show_bug.cgi?id=194894 Reviewed by Chris Dumez. Source/WebKit: Clear the process cache when clearing the website data store so that there is no way to infer which site the user had visited by observing for which sites WebContent processes had been cached. There is one sublty in WebsiteDataStore::removeData that we have to delay the clearing of the web process cache until the next run loop because SuspendedPageProxy::~SuspendedPageProxy invokes WebProcessProxy::maybeShutDown in the next run loop. We also have to disable the process cache during this time as it would otherwise trigger the responsiveness check of WebContent process can take arbitrarily long time. * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _processCacheCapacity]): Added for testing. * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::addProcess): Avoid adding web processes to the cache while the suspended pages are being cleared. * UIProcess/WebProcessCache.h: (WebKit::WebProcessCache::disabled const): Added. (WebKit::WebProcessCache::setDisabled): Added. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::handleMemoryPressureWarning): (WebKit::WebProcessPool::clearSuspendedPages): Added. * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::removeData): Tools: Added a test case. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: (TestWebKitAPI.ProcessSwap.NumberOfCachedProcesses): Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241928 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-21 Ryosuke Niwa Discard cached processes when clearing website data store https://bugs.webkit.org/show_bug.cgi?id=194894 Reviewed by Chris Dumez. Clear the process cache when clearing the website data store so that there is no way to infer which site the user had visited by observing for which sites WebContent processes had been cached. There is one sublty in WebsiteDataStore::removeData that we have to delay the clearing of the web process cache until the next run loop because SuspendedPageProxy::~SuspendedPageProxy invokes WebProcessProxy::maybeShutDown in the next run loop. We also have to disable the process cache during this time as it would otherwise trigger the responsiveness check of WebContent process can take arbitrarily long time. * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _processCacheCapacity]): Added for testing. * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::addProcess): Avoid adding web processes to the cache while the suspended pages are being cleared. * UIProcess/WebProcessCache.h: (WebKit::WebProcessCache::disabled const): Added. (WebKit::WebProcessCache::setDisabled): Added. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::handleMemoryPressureWarning): (WebKit::WebProcessPool::clearSuspendedPages): Added. * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::removeData): 2019-02-24 Babak Shafiei Cherry-pick r241899. rdar://problem/48317463 Crash under RemoteLayerTreePropertyApplier::applyProperties when reattaching to old process https://bugs.webkit.org/show_bug.cgi?id=194845 Reviewed by Antti Koivisto. Source/WebKit: New test: ProcessSwap.PageOverlayLayerPersistence * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h: (WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged): Keep track of all properties that have ever changed on a layer, so we can re-send them if a layer moves between contexts. * WebProcess/WebPage/DrawingArea.cpp: (WebKit::DrawingArea::~DrawingArea): (WebKit::DrawingArea::removeMessageReceiverIfNeeded): * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::layerHostDidFlushLayers): Make it possible to tear down DrawingArea's MessageReceiver before it is destroyed, so that we can keep two DrawingAreas alive in a single process for a short time. (WebKit::DrawingArea::adoptLayersFromDrawingArea): Add adoptLayersFromDrawingArea; see below for its only useful implementation. * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp: (WebKit::GraphicsLayerCARemote::GraphicsLayerCARemote): (WebKit::GraphicsLayerCARemote::~GraphicsLayerCARemote): (WebKit::GraphicsLayerCARemote::createPlatformCALayer): (WebKit::GraphicsLayerCARemote::createPlatformCALayerForEmbeddedView): (WebKit::GraphicsLayerCARemote::moveToContext): * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h: Make it possible to move a GraphicsLayerCARemote between RemoteLayerTreeContexts. * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp: (WebKit::PlatformCALayerRemote::create): (WebKit::PlatformCALayerRemote::createForEmbeddedView): (WebKit::PlatformCALayerRemote::~PlatformCALayerRemote): (WebKit::PlatformCALayerRemote::moveToContext): * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h: * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm: (WebKit::PlatformCALayerRemoteCustom::create): (WebKit::PlatformCALayerRemoteCustom::clone const): Make it possible to move a PlatformCALayerRemote between RemoteLayerTreeContexts. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::~RemoteLayerTreeContext): (WebKit::RemoteLayerTreeContext::adoptLayersFromContext): (WebKit::RemoteLayerTreeContext::layerDidEnterContext): (WebKit::RemoteLayerTreeContext::layerWillLeaveContext): (WebKit::RemoteLayerTreeContext::graphicsLayerDidEnterContext): (WebKit::RemoteLayerTreeContext::graphicsLayerWillLeaveContext): (WebKit::RemoteLayerTreeContext::layerWasCreated): Deleted. (WebKit::RemoteLayerTreeContext::layerWillBeDestroyed): Deleted. Keep track of all GraphicsLayerCARemote instances in the context, like we do for PlatformCALayerRemote, so that we can update their context backpointers if needed. Also make it possible to move all outstanding layers to a new context. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::adoptLayersFromDrawingArea): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::reinitializeWebPage): When doing a DrawingArea swap, transition all layers from the old context to the new one. In order to do this, we temporarily keep both DrawingAreas alive, but make use of the new mechanism to remove the old one's MessageReceiver before installing the new one, so that destroying the old one later doesn't remove it (avoiding re-introducing bug 189481). Tools: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241899 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-21 Tim Horton Crash under RemoteLayerTreePropertyApplier::applyProperties when reattaching to old process https://bugs.webkit.org/show_bug.cgi?id=194845 Reviewed by Antti Koivisto. New test: ProcessSwap.PageOverlayLayerPersistence * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h: (WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged): Keep track of all properties that have ever changed on a layer, so we can re-send them if a layer moves between contexts. * WebProcess/WebPage/DrawingArea.cpp: (WebKit::DrawingArea::~DrawingArea): (WebKit::DrawingArea::removeMessageReceiverIfNeeded): * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::layerHostDidFlushLayers): Make it possible to tear down DrawingArea's MessageReceiver before it is destroyed, so that we can keep two DrawingAreas alive in a single process for a short time. (WebKit::DrawingArea::adoptLayersFromDrawingArea): Add adoptLayersFromDrawingArea; see below for its only useful implementation. * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp: (WebKit::GraphicsLayerCARemote::GraphicsLayerCARemote): (WebKit::GraphicsLayerCARemote::~GraphicsLayerCARemote): (WebKit::GraphicsLayerCARemote::createPlatformCALayer): (WebKit::GraphicsLayerCARemote::createPlatformCALayerForEmbeddedView): (WebKit::GraphicsLayerCARemote::moveToContext): * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h: Make it possible to move a GraphicsLayerCARemote between RemoteLayerTreeContexts. * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp: (WebKit::PlatformCALayerRemote::create): (WebKit::PlatformCALayerRemote::createForEmbeddedView): (WebKit::PlatformCALayerRemote::~PlatformCALayerRemote): (WebKit::PlatformCALayerRemote::moveToContext): * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h: * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm: (WebKit::PlatformCALayerRemoteCustom::create): (WebKit::PlatformCALayerRemoteCustom::clone const): Make it possible to move a PlatformCALayerRemote between RemoteLayerTreeContexts. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::~RemoteLayerTreeContext): (WebKit::RemoteLayerTreeContext::adoptLayersFromContext): (WebKit::RemoteLayerTreeContext::layerDidEnterContext): (WebKit::RemoteLayerTreeContext::layerWillLeaveContext): (WebKit::RemoteLayerTreeContext::graphicsLayerDidEnterContext): (WebKit::RemoteLayerTreeContext::graphicsLayerWillLeaveContext): (WebKit::RemoteLayerTreeContext::layerWasCreated): Deleted. (WebKit::RemoteLayerTreeContext::layerWillBeDestroyed): Deleted. Keep track of all GraphicsLayerCARemote instances in the context, like we do for PlatformCALayerRemote, so that we can update their context backpointers if needed. Also make it possible to move all outstanding layers to a new context. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::adoptLayersFromDrawingArea): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::reinitializeWebPage): When doing a DrawingArea swap, transition all layers from the old context to the new one. In order to do this, we temporarily keep both DrawingAreas alive, but make use of the new mechanism to remove the old one's MessageReceiver before installing the new one, so that destroying the old one later doesn't remove it (avoiding re-introducing bug 189481). 2019-02-24 Babak Shafiei Cherry-pick r241128. rdar://problem/48317438 [macOS] API test times out after r241026 https://bugs.webkit.org/show_bug.cgi?id=194372 Reviewed by Alex Christensen. The API test TestWebKitAPI.RenderingProgress.FirstMeaningfulPaint times out after r241026. A new function pointer, layoutMilestones, is added to WKBundlePageLoaderClient, in order for clients to decide which milestones they would like to listen for. * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (layoutMilestones): (setUpPageLoaderClient): * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: (WebKit::InjectedBundlePageLoaderClient::layoutMilestones const): * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241128 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-07 Per Arne Vollan [macOS] API test times out after r241026 https://bugs.webkit.org/show_bug.cgi?id=194372 Reviewed by Alex Christensen. The API test TestWebKitAPI.RenderingProgress.FirstMeaningfulPaint times out after r241026. A new function pointer, layoutMilestones, is added to WKBundlePageLoaderClient, in order for clients to decide which milestones they would like to listen for. * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (layoutMilestones): (setUpPageLoaderClient): * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: (WebKit::InjectedBundlePageLoaderClient::layoutMilestones const): * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: 2019-02-24 Babak Shafiei Apply patch. rdar://problem/48317433 2019-02-24 Chris Dumez REGRESSION(PSON): Google login page refreshes repeatedly in Reeder 3 app Reviewed by Alex Christensen. When we process swap, we first call removeWebPage() on the previous process and then call addExistingWebPage() on the new one. removeWebPage() would call WebProcessPool::pageEndUsingWebsiteDataStore() and then addExistingWebPage() would call WebProcessPool::pageBeginUsingWebsiteDataStore(). This was leading to loosing session cookies because the call to WebProcessPool::pageEndUsingWebsiteDataStore() would send an IPC to the Network process to destroy the session. The later call to pageBeginUsingWebsiteDataStore() would re-construct the session but it would be too late, previous cookies would be gone. To address the issue, r238828 updated removeWebPage() / addExistingWebPage() so that they no longer call pageBeginUsingWebsiteDataStore() / pageEndUsingWebsiteDataStore() in case of a process swap. This partly fixed the issue. However, I failed to notice that pageBeginUsingWebsiteDataStore() / pageEndUsingWebsiteDataStore() also send IPC to the WebProcess to construct / destroy the session. We still want this IPC to happen in case of a process-swap or the new process will not know about the session. To address this issue, I moved the WebProcess IPC sending from WebProcessPool::pageEndUsingWebsiteDataStore() / pageEndUsingWebsiteDataStore() to WebProcessProxy::removeWebPage() / addExistingWebPage() so that it happens no matter what. It is also clearer for the WebProcessProxy to send the IPC by itself. This patch is only needed on the branch since Alex refactored the code in r239737 so that the WebSiteDataStore-related IPC to the WebProcess is no longer needed on trunk. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore): (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::addExistingWebPage): (WebKit::WebProcessProxy::removeWebPage): (WebKit::WebProcessProxy::hasPageUsingSession const): 2019-02-21 Alan Coon Cherry-pick r241919. rdar://problem/48267027 Fix API test crashes after r241855. Reviewed by Ryosuke Niwa. * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::addProcessIfPossible): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241919 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-21 Chris Dumez Fix API test crashes after r241855. Reviewed by Ryosuke Niwa. * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::addProcessIfPossible): 2019-02-21 Alan Coon Cherry-pick r241868. rdar://problem/48267027 Unreviewed API test fix after r241855. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::~WebProcessProxy): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241868 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-21 Chris Dumez Unreviewed API test fix after r241855. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::~WebProcessProxy): 2019-02-21 Alan Coon Cherry-pick r241728. rdar://problem/48243264 Disable safe browsing in WKWebView and remove its WKPreferences API https://bugs.webkit.org/show_bug.cgi?id=194723 Reviewed by Geoffrey Garen. Source/WebKit: * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKPreferences.h: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences setSafeBrowsingEnabled:]): Deleted. (-[WKPreferences isSafeBrowsingEnabled]): Deleted. Tools: * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: * TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm: (TEST): (safeBrowsingView): Make tests use SPI instead of API. LayoutTests: * platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt: This test has results that depend on timing, and I need to update its results when I disable safe browsing. I've done this several times before. See r237876 for an example. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241728 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-18 Alex Christensen Disable safe browsing in WKWebView and remove its WKPreferences API https://bugs.webkit.org/show_bug.cgi?id=194723 Reviewed by Geoffrey Garen. * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKPreferences.h: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences setSafeBrowsingEnabled:]): Deleted. (-[WKPreferences isSafeBrowsingEnabled]): Deleted. 2019-02-21 Alan Coon Cherry-pick r241618. rdar://problem/48243264 Add SPI version of WKPreferences.safeBrowsingEnabled https://bugs.webkit.org/show_bug.cgi?id=194718 Rubber-stamped by Brady Eidson. * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _isSafeBrowsingEnabled]): (-[WKPreferences _setSafeBrowsingEnabled:]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241618 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-15 Alex Christensen Add SPI version of WKPreferences.safeBrowsingEnabled https://bugs.webkit.org/show_bug.cgi?id=194718 Rubber-stamped by Brady Eidson. * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _isSafeBrowsingEnabled]): (-[WKPreferences _setSafeBrowsingEnabled:]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: 2019-02-21 Alan Coon Cherry-pick r241855. rdar://problem/48267027 [PSON] Make sure hung processes are not kept alive by suspended pages or process caching https://bugs.webkit.org/show_bug.cgi?id=194881 Reviewed by Geoffrey Garen. After we construct a SuspendedPageProxy and before we send the IPC to the WebProcess to ask it to suspend, start a 10 seconds timer. If the process does not answer the request to suspend before the timer fires, we destroy the SuspendedPageProxy so that we do not keep a hung process around. For the WebProcessCache, we now call WebProcessProxy::isResponsive() on the process before adding it to the cache. Internally, this relies on an IPC handshake with the WebProcess. If the process is not responsive, we do not add it to the cache and we shut it down. If it is responsive then we proceed normally with adding it to the cache. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::SuspendedPageProxy): (WebKit::SuspendedPageProxy::didProcessRequestToSuspend): (WebKit::SuspendedPageProxy::suspensionTimedOut): * UIProcess/SuspendedPageProxy.h: * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::addProcessIfPossible): (WebKit::WebProcessCache::addProcess): * UIProcess/WebProcessCache.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): (WebKit::WebProcessProxy::maybeShutDown): (WebKit::WebProcessProxy::isResponsive): * UIProcess/WebProcessProxy.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241855 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-20 Chris Dumez [PSON] Make sure hung processes are not kept alive by suspended pages or process caching https://bugs.webkit.org/show_bug.cgi?id=194881 Reviewed by Geoffrey Garen. After we construct a SuspendedPageProxy and before we send the IPC to the WebProcess to ask it to suspend, start a 10 seconds timer. If the process does not answer the request to suspend before the timer fires, we destroy the SuspendedPageProxy so that we do not keep a hung process around. For the WebProcessCache, we now call WebProcessProxy::isResponsive() on the process before adding it to the cache. Internally, this relies on an IPC handshake with the WebProcess. If the process is not responsive, we do not add it to the cache and we shut it down. If it is responsive then we proceed normally with adding it to the cache. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::SuspendedPageProxy): (WebKit::SuspendedPageProxy::didProcessRequestToSuspend): (WebKit::SuspendedPageProxy::suspensionTimedOut): * UIProcess/SuspendedPageProxy.h: * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::addProcessIfPossible): (WebKit::WebProcessCache::addProcess): * UIProcess/WebProcessCache.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): (WebKit::WebProcessProxy::maybeShutDown): (WebKit::WebProcessProxy::isResponsive): * UIProcess/WebProcessProxy.h: 2019-02-21 Alan Coon Cherry-pick r241845. rdar://problem/48267029 Regression(PSON) "Reload without content extensions" does not work when the main resource is blocked https://bugs.webkit.org/show_bug.cgi?id=194872 Reviewed by Alex Christensen. Source/WebKit: [WKWebView _reloadWithoutContentBlockers] relies on a ReloadOption flag that is passed to WebCore instead of using WebsitePolicies.contentBlockersEnabled flag. If the reload causes a process swap due to PSON, then the new process does not know about this ReloadOption and fails to honor it. Since the modern way to do this is WebsitePolicies, and since WebsitePolicies are properly propagated cross-process in case of process swap, this patch updates _reloadWithoutContentBlockers to set a flag on the Navigation which we use to later set the WebsitePolicies.contentBlockersEnabled flag in WebPageProxy::receivedNavigationPolicyDecision(). * UIProcess/API/APINavigation.h: (API::Navigation::setUserContentExtensionsEnabled): (API::Navigation::userContentExtensionsEnabled const): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::reload): (WebKit::WebPageProxy::receivedNavigationPolicyDecision): Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241845 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-20 Chris Dumez Regression(PSON) "Reload without content extensions" does not work when the main resource is blocked https://bugs.webkit.org/show_bug.cgi?id=194872 Reviewed by Alex Christensen. [WKWebView _reloadWithoutContentBlockers] relies on a ReloadOption flag that is passed to WebCore instead of using WebsitePolicies.contentBlockersEnabled flag. If the reload causes a process swap due to PSON, then the new process does not know about this ReloadOption and fails to honor it. Since the modern way to do this is WebsitePolicies, and since WebsitePolicies are properly propagated cross-process in case of process swap, this patch updates _reloadWithoutContentBlockers to set a flag on the Navigation which we use to later set the WebsitePolicies.contentBlockersEnabled flag in WebPageProxy::receivedNavigationPolicyDecision(). * UIProcess/API/APINavigation.h: (API::Navigation::setUserContentExtensionsEnabled): (API::Navigation::userContentExtensionsEnabled const): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::reload): (WebKit::WebPageProxy::receivedNavigationPolicyDecision): 2019-02-21 Alan Coon Cherry-pick r241853. rdar://problem/48248223 Unreviewed build fix after r241823. * UIProcess/SuspendedPageProxy.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241853 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-20 Chris Dumez Unreviewed build fix after r241823. * UIProcess/SuspendedPageProxy.h: 2019-02-21 Alan Coon Cherry-pick r241823. rdar://problem/48248223 Regression(PSON) Crash under WebKit::WebPageProxy::decidePolicyForNavigationActionSync https://bugs.webkit.org/show_bug.cgi?id=194857 Reviewed by Alex Christensen. Source/WebKit: The ProvisionalPageProxy was blindly forwarding the DecidePolicyForNavigationActionSync synchronous IPC to the WebPageProxy, without passing it the process the IPC came from. As a result, WebPageProxy::decidePolicyForNavigationActionSync() would try to look up a WebFrameProxy using the provided frameID from the wrong process and we would end up hitting a RELEASE_ASSERT(). * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync): (WebKit::ProvisionalPageProxy::didReceiveSyncMessage): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationActionSync): (WebKit::WebPageProxy::decidePolicyForNavigationActionSyncShared): * UIProcess/WebPageProxy.h: Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241823 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-20 Chris Dumez Regression(PSON) Crash under WebKit::WebPageProxy::decidePolicyForNavigationActionSync https://bugs.webkit.org/show_bug.cgi?id=194857 Reviewed by Alex Christensen. The ProvisionalPageProxy was blindly forwarding the DecidePolicyForNavigationActionSync synchronous IPC to the WebPageProxy, without passing it the process the IPC came from. As a result, WebPageProxy::decidePolicyForNavigationActionSync() would try to look up a WebFrameProxy using the provided frameID from the wrong process and we would end up hitting a RELEASE_ASSERT(). * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync): (WebKit::ProvisionalPageProxy::didReceiveSyncMessage): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationActionSync): (WebKit::WebPageProxy::decidePolicyForNavigationActionSyncShared): * UIProcess/WebPageProxy.h: 2019-02-21 Alan Coon Apply patch. rdar://problem/48243214 REGRESSION (PSON): Can't access optumbank.com from myuhc.com https://bugs.webkit.org/show_bug.cgi?id=194797 Reviewed by Geoffrey Garen. Source/WebKit: The issue was caused by us mistakenly process-swapping for a same-site server side redirect. The reason we were getting it wrong is because the logic in WebProcessPool::processForNavigationInternal() was expecting page.process() to be the source process and page.pageLoadState().url() to be the source URL. Those assumptions are incorrect when a server-side redirect occurs in a provisional process. In such case, the source process is the ProvisionalPageProxy's process and the source URL is the provisional URL, not the committed one. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::didPerformServerRedirect): (WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didReceiveMessage): * UIProcess/ProvisionalPageProxy.h: Make sure the provisional page forwards IPC related to server-side redirects to the page so that the client gets informed. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::didPerformServerRedirect): (WebKit::WebPageProxy::didPerformServerRedirectShared): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigation): (WebKit::WebProcessPool::processForNavigationInternal): * UIProcess/WebProcessPool.h: Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@241752 268f45cc-cd09-0410-ab3c-d52691b4dbfc (cherry picked from commit 53ac6d765e577c36c5c5e02659ee3ca21f25599f) 2019-02-18 Chris Dumez REGRESSION (PSON): Can't access optumbank.com from myuhc.com https://bugs.webkit.org/show_bug.cgi?id=194797 Reviewed by Geoffrey Garen. The issue was caused by us mistakenly process-swapping for a same-site server side redirect. The reason we were getting it wrong is because the logic in WebProcessPool::processForNavigationInternal() was expecting page.process() to be the source process and page.pageLoadState().url() to be the source URL. Those assumptions are incorrect when a server-side redirect occurs in a provisional process. In such case, the source process is the ProvisionalPageProxy's process and the source URL is the provisional URL, not the committed one. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::didPerformServerRedirect): (WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didReceiveMessage): * UIProcess/ProvisionalPageProxy.h: Make sure the provisional page forwards IPC related to server-side redirects to the page so that the client gets informed. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::didPerformServerRedirect): (WebKit::WebPageProxy::didPerformServerRedirectShared): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigation): (WebKit::WebProcessPool::processForNavigationInternal): * UIProcess/WebProcessPool.h: 2019-02-20 Alan Coon Cherry-pick r241777. rdar://problem/48248215 Remove assertion introduced in r229683 https://bugs.webkit.org/show_bug.cgi?id=194825 Reviewed by Geoffrey Garen. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm): If we reach this code and the form's original Document's Frame has been destroyed, we have already been told to submit the form so do so, just like we do if the WebPage has been destroyed. This is a rare edge case having to do with the timing of Frame destruction and decidePolicyForNavigationAction response, which unfortunately does not reproduce with a test case unless the timing of IPC is just right. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241777 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-19 Alex Christensen Remove assertion introduced in r229683 https://bugs.webkit.org/show_bug.cgi?id=194825 Reviewed by Geoffrey Garen. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm): If we reach this code and the form's original Document's Frame has been destroyed, we have already been told to submit the form so do so, just like we do if the WebPage has been destroyed. This is a rare edge case having to do with the timing of Frame destruction and decidePolicyForNavigationAction response, which unfortunately does not reproduce with a test case unless the timing of IPC is just right. 2019-02-20 Alan Coon Cherry-pick r241721. rdar://problem/48243376 AX: PSON: Going back from apple.com to search results, cannot interact with HTML content. Disabling Swap Processes on Cross-Site Navigation resolves the issue. https://bugs.webkit.org/show_bug.cgi?id=194742 Reviewed by Chris Dumez. Source/WebCore: With the new process model, WebProcess hits a case where it tries to send the "page loaded" notification before VoiceOver had a chance to register for any notifications. This leads to those notifications being dropped (and thus this bug). This change instead asks the UIProcess to send the notification, which we know VoiceOver has registered for, and can reliably receive notifications. It also sends the notification for "load failures," which to the VO users' perspective amounts to the same thing as a successful page load. * accessibility/mac/AXObjectCacheMac.mm: (WebCore::AXObjectCache::frameLoadingEventPlatformNotification): Source/WebKit: Re-initialize the accessibility web process tokens when swapping processes. Send page load notifications from the UIProcess instead of the WebProcess to improve reliability. * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::didFinishLoadForMainFrame): (WebKit::PageClientImpl::didFailLoadForMainFrame): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::reinitializeWebPage): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/gtk/WebPageGtk.cpp: (WebKit::WebPage::platformReinitialize): (WebKit::WebPage::platformDetach): Deleted. (WebKit::WebPage::platformEditorState const): Deleted. (WebKit::WebPage::updateAccessibilityTree): Deleted. (WebKit::WebPage::performDefaultBehaviorForKeyEvent): Deleted. (WebKit::WebPage::platformCanHandleRequest): Deleted. (WebKit::WebPage::platformUserAgent const): Deleted. (WebKit::WebPage::getCenterForZoomGesture): Deleted. (WebKit::WebPage::setInputMethodState): Deleted. (WebKit::WebPage::collapseSelectionInFrame): Deleted. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::platformReinitialize): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::platformReinitialize): * WebProcess/WebPage/win/WebPageWin.cpp: (WebKit::WebPage::platformReinitialize): * WebProcess/WebPage/wpe/WebPageWPE.cpp: (WebKit::WebPage::platformReinitialize): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241721 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-18 Chris Fleizach AX: PSON: Going back from apple.com to search results, cannot interact with HTML content. Disabling Swap Processes on Cross-Site Navigation resolves the issue. https://bugs.webkit.org/show_bug.cgi?id=194742 Reviewed by Chris Dumez. Re-initialize the accessibility web process tokens when swapping processes. Send page load notifications from the UIProcess instead of the WebProcess to improve reliability. * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::didFinishLoadForMainFrame): (WebKit::PageClientImpl::didFailLoadForMainFrame): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::reinitializeWebPage): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/gtk/WebPageGtk.cpp: (WebKit::WebPage::platformReinitialize): (WebKit::WebPage::platformDetach): Deleted. (WebKit::WebPage::platformEditorState const): Deleted. (WebKit::WebPage::updateAccessibilityTree): Deleted. (WebKit::WebPage::performDefaultBehaviorForKeyEvent): Deleted. (WebKit::WebPage::platformCanHandleRequest): Deleted. (WebKit::WebPage::platformUserAgent const): Deleted. (WebKit::WebPage::getCenterForZoomGesture): Deleted. (WebKit::WebPage::setInputMethodState): Deleted. (WebKit::WebPage::collapseSelectionInFrame): Deleted. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::platformReinitialize): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::platformReinitialize): * WebProcess/WebPage/win/WebPageWin.cpp: (WebKit::WebPage::platformReinitialize): * WebProcess/WebPage/wpe/WebPageWPE.cpp: (WebKit::WebPage::platformReinitialize): 2019-02-20 Alan Coon Cherry-pick r241658. rdar://problem/48243434 https://device.login.microsoftonline.com is hanging on STP75 https://bugs.webkit.org/show_bug.cgi?id=194734 Reviewed by Jiewen Tan. Make sure to only go the XPC route if SecKeyProxyStore has credentials. Tested manually by going to the above website with and without the patch. Load hangs without the patch and completes with the patch. * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy): * UIProcess/Authentication/cocoa/SecKeyProxyStore.h: * UIProcess/Authentication/cocoa/SecKeyProxyStore.mm: (WebKit::SecKeyProxyStore::initialize): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241658 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-17 Youenn Fablet https://device.login.microsoftonline.com is hanging on STP75 https://bugs.webkit.org/show_bug.cgi?id=194734 Reviewed by Jiewen Tan. Make sure to only go the XPC route if SecKeyProxyStore has credentials. Tested manually by going to the above website with and without the patch. Load hangs without the patch and completes with the patch. * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy): * UIProcess/Authentication/cocoa/SecKeyProxyStore.h: * UIProcess/Authentication/cocoa/SecKeyProxyStore.mm: (WebKit::SecKeyProxyStore::initialize): 2019-02-20 Alan Coon Cherry-pick r241606. rdar://problem/48243273 Regression(PSON) Navigating quickly back and forth can lead to getting 'about:blank' in the backforward list https://bugs.webkit.org/show_bug.cgi?id=194717 Reviewed by Brady Eidson. Source/WebKit: When the client does a history navigation, the UIProcess sends a WebPage::GoToBackForwardItem IPC to the WebProcess and the WebProcess sends a WebPageProxy::BackForwardGoToItem IPC back to the UIProcess to update the current item in the BackForwardList. This means that there is a slight delay between the point a client requests a history navigation and the point where the BackForwardList's current item gets update. This delay is pre-existing behavior and not new to PSON. However, with PSON enabled, if we decide to process-swap for the history navigation, we'll tell the previous (committed) process to ignore the load and we ask a new (provisional) process to do the history navigation. When the previous process receives the request to ignore the history navigation, it restores the History's current item to the one previous the navigation, which sends a WebPageProxy::GoToBackForwardItem IPC to the UIProcess to update the BackForwardList as well. In parallel, the new process starts the history navigation and also sends a WebPageProxy::GoToBackForwardItem to update the BackForwardList's current item as well. We end up with a race between the 2 GoToBackForwardItem IPC messages coming from the old and new process. If the old process's message loses the race, we end up with the wrong current history item getting set in the UIProcess. Later, when we commit the provisional load and try to suspend the previous page, we would save the SuspendedPage on the *wrong* BackForwardList item. If one tries to load this BackForwardList item later, we'll use its SuspendedPage and try to unsuspend it. However, because the PageCache entry is saved on another HistoryItem than the one getting loaded in the WebProcess side, we attempt to do a regular load instead of a PageCache restore. We end up failing the load because pages cannot trigger new loads while in page cache. Because the load fails, we end up loading the initial empty document and this is how we end up with 'about:blank' in the back forward list. To address the issue, update WebPageProxy::backForwardGoToItem() to ignore messages from the old/committed WebProcess when there is a pending provisional load. If the committed processes starts a legit new load, it would clear any existing pending provisional load before attempting the call backForwardGoToItem(). As a result, ignoring such messages from the old processes when there is a pending provisional load is safe. In the future, we should probably move more of the history / backForwardList management to the UIProcess to avoid this sort of issues. This would be a much larger refactoring though so I am going with this simpler fix that is easily cherry-pickable for now. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::suspendCurrentPageIfPossible): (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::backForwardGoToItem): Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241606 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-15 Chris Dumez Regression(PSON) Navigating quickly back and forth can lead to getting 'about:blank' in the backforward list https://bugs.webkit.org/show_bug.cgi?id=194717 Reviewed by Brady Eidson. When the client does a history navigation, the UIProcess sends a WebPage::GoToBackForwardItem IPC to the WebProcess and the WebProcess sends a WebPageProxy::BackForwardGoToItem IPC back to the UIProcess to update the current item in the BackForwardList. This means that there is a slight delay between the point a client requests a history navigation and the point where the BackForwardList's current item gets update. This delay is pre-existing behavior and not new to PSON. However, with PSON enabled, if we decide to process-swap for the history navigation, we'll tell the previous (committed) process to ignore the load and we ask a new (provisional) process to do the history navigation. When the previous process receives the request to ignore the history navigation, it restores the History's current item to the one previous the navigation, which sends a WebPageProxy::GoToBackForwardItem IPC to the UIProcess to update the BackForwardList as well. In parallel, the new process starts the history navigation and also sends a WebPageProxy::GoToBackForwardItem to update the BackForwardList's current item as well. We end up with a race between the 2 GoToBackForwardItem IPC messages coming from the old and new process. If the old process's message loses the race, we end up with the wrong current history item getting set in the UIProcess. Later, when we commit the provisional load and try to suspend the previous page, we would save the SuspendedPage on the *wrong* BackForwardList item. If one tries to load this BackForwardList item later, we'll use its SuspendedPage and try to unsuspend it. However, because the PageCache entry is saved on another HistoryItem than the one getting loaded in the WebProcess side, we attempt to do a regular load instead of a PageCache restore. We end up failing the load because pages cannot trigger new loads while in page cache. Because the load fails, we end up loading the initial empty document and this is how we end up with 'about:blank' in the back forward list. To address the issue, update WebPageProxy::backForwardGoToItem() to ignore messages from the old/committed WebProcess when there is a pending provisional load. If the committed processes starts a legit new load, it would clear any existing pending provisional load before attempting the call backForwardGoToItem(). As a result, ignoring such messages from the old processes when there is a pending provisional load is safe. In the future, we should probably move more of the history / backForwardList management to the UIProcess to avoid this sort of issues. This would be a much larger refactoring though so I am going with this simpler fix that is easily cherry-pickable for now. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::suspendCurrentPageIfPossible): (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::backForwardGoToItem): 2019-02-20 Alan Coon Cherry-pick r241549. rdar://problem/48243406 AX: ARIA Reflection was disabled in error https://bugs.webkit.org/show_bug.cgi?id=194647 Reviewed by Ryosuke Niwa. Source/WebKit: * Shared/WebPreferences.yaml: Tools: Remove test override now that this feature should be enabled by default. * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetPreferencesToConsistentValues): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241549 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-14 Chris Fleizach AX: ARIA Reflection was disabled in error https://bugs.webkit.org/show_bug.cgi?id=194647 Reviewed by Ryosuke Niwa. * Shared/WebPreferences.yaml: 2019-02-18 Babak Shafiei Cherry-pick r241635. rdar://problem/48165262 [PSON] Allow tweaking WebProcess cache parameters via user defaults https://bugs.webkit.org/show_bug.cgi?id=194731 Reviewed by Geoffrey Garen. Allow tweaking WebProcess cache parameters via user defaults like so: $ defaults write com.apple.Safari WebProcessCacheCachedProcessLifetimeInSeconds 120 -> Cached processes will be evicted after 2 minutes (instead of 30) $ defaults write com.apple.Safari WebProcessCacheClearingDelayAfterApplicationResignsActiveInSeconds 60 -> Web process cache will be cleared if Safari is no longer active for 1 minutes (instead of 5). * SourcesCocoa.txt: * UIProcess/Cocoa/WebProcessCacheCocoa.mm: Copied from Source/WebKit/UIProcess/WebProcessCache.h. (WebKit::WebProcessCache::platformInitialize): * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::WebProcessCache): (WebKit::WebProcessCache::platformInitialize): * UIProcess/WebProcessCache.h: * WebKit.xcodeproj/project.pbxproj: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241635 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-15 Chris Dumez [PSON] Allow tweaking WebProcess cache parameters via user defaults https://bugs.webkit.org/show_bug.cgi?id=194731 Reviewed by Geoffrey Garen. Allow tweaking WebProcess cache parameters via user defaults like so: $ defaults write com.apple.Safari WebProcessCacheCachedProcessLifetimeInSeconds 120 -> Cached processes will be evicted after 2 minutes (instead of 30) $ defaults write com.apple.Safari WebProcessCacheClearingDelayAfterApplicationResignsActiveInSeconds 60 -> Web process cache will be cleared if Safari is no longer active for 1 minutes (instead of 5). * SourcesCocoa.txt: * UIProcess/Cocoa/WebProcessCacheCocoa.mm: Copied from Source/WebKit/UIProcess/WebProcessCache.h. (WebKit::WebProcessCache::platformInitialize): * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::WebProcessCache): (WebKit::WebProcessCache::platformInitialize): * UIProcess/WebProcessCache.h: * WebKit.xcodeproj/project.pbxproj: 2019-02-18 Babak Shafiei Cherry-pick r241631. rdar://problem/48165260 [PSON] Disable WebContent process cache on devices with less than 3GB of RAM https://bugs.webkit.org/show_bug.cgi?id=194726 Reviewed by Geoffrey Garen. * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::updateCapacity): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241631 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-15 Chris Dumez [PSON] Disable WebContent process cache on devices with less than 3GB of RAM https://bugs.webkit.org/show_bug.cgi?id=194726 Reviewed by Geoffrey Garen. * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::updateCapacity): 2019-02-18 Babak Shafiei Cherry-pick r241584. rdar://problem/48122553 Unreviewed. Fix GTK+ build after r241556 I guess this is due to unified builds after a new file being added in r241556. Patch by Carlos Garcia Campos on 2019-02-15 * UIProcess/API/C/WKAuthenticationDecisionListener.cpp: * UIProcess/API/C/WKPage.cpp: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241584 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-15 Carlos Garcia Campos Unreviewed. Fix GTK+ build after r241556 I guess this is due to unified builds after a new file being added in r241556. * UIProcess/API/C/WKAuthenticationDecisionListener.cpp: * UIProcess/API/C/WKPage.cpp: 2019-02-18 Babak Shafiei Apply patch. rdar://problem/48122553 Introduce a WebContent Process cache https://bugs.webkit.org/show_bug.cgi?id=194594 Reviewed by Geoff Garen. Source/WebCore: Update localizable strings. * en.lproj/Localizable.strings: Source/WebKit: Introduce a WebContent Process cache to reduce the number of process launches when process swap on navigation is enabled, and to reduce the power cost of the feature. If a WebProcess loaded pages from a single registrable domain then it is eligible for the cache. When process-swapping on navigation to a new registrable domain, we now attempt to retrieve a process from the cache for the domain in question instead of always launching a new one. The WebProcess cache currently has the following attributes: - It may contains 4 processes per GB of RAM the machine has, up to 30 processes. - WebProcesses automatically get evicted from the cache after 30 minutes. - If the application is no longer the active app, then the cache will get cleared after 5 minutes. - WebProcesses that are in the cache are reported as "(Cached)" in Activity Monitor. The WebProcess cache is currently disabled by default and can by enabled by the client via SPI. * Shared/WebBackForwardListItem.cpp: (WebKit::WebBackForwardListItem::WebBackForwardListItem): * Shared/WebBackForwardListItem.h: (WebKit::WebBackForwardListItem::lastProcessIdentifier const): (WebKit::WebBackForwardListItem::setLastProcessIdentifier): Add new lastProcessIdentifier data member that reflects which process this item was last loaded in. It is normally identical to the identifier of the process that created the item but it gets overriden in case of cross-site client-side redirect, since a new process takes over the item in this case. * Sources.txt: Add new source file. * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/C/WKContextConfigurationRef.cpp: (WKContextConfigurationUsesWebProcessCache): (WKContextConfigurationSetUsesWebProcessCache): * UIProcess/API/C/WKContextConfigurationRef.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration setUsesWebProcessCache:]): (-[_WKProcessPoolConfiguration usesWebProcessCache]): Add new SPI to enable the WebProcess cache. * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _webProcessCountIgnoringPrewarmedAndCached]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: Add new SPI for testing which returns the number of WebProcesses ignoring both prewarmed and cached ones. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::registerNotificationObservers): (WebKit::WebProcessPool::unregisterNotificationObservers): Add application active state observers as the WebProcess cache gets cleared when the application resigns active state for more than 5 minutes. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::loadRequest): When doing a load in a new process with the BackForwardList locked (i.e. client-side redirect), make sure we update the last process identifier for the BackForwardListItem. This is important because the logic in WebProcessPool::processForNavigation() relies on this identifier to select which process to do the history navigation into, and we want to do the load in the post-redirect process, not the pre-redirect one. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): Tell the WebProcess whenever a main frame provisional load is started, providing the URL. * UIProcess/WebProcessCache.cpp: Added. (WebKit::WebProcessCache::WebProcessCache): (WebKit::WebProcessCache::addProcess): (WebKit::WebProcessCache::takeProcess): (WebKit::WebProcessCache::updateMaximumSize): (WebKit::WebProcessCache::clear): (WebKit::WebProcessCache::setApplicationIsActive): (WebKit::WebProcessCache::evictProcess): (WebKit::WebProcessCache::CachedProcess::CachedProcess): (WebKit::WebProcessCache::CachedProcess::~CachedProcess): (WebKit::WebProcessCache::CachedProcess::takeProcess): (WebKit::WebProcessCache::CachedProcess::evictionTimerFired): * UIProcess/WebProcessCache.h: Added. (WebKit::WebProcessCache::maximumSize): (WebKit::WebProcessCache::size const): (WebKit::WebProcessCache::CachedProcess::process): Add process cache implementation. * UIProcess/WebProcessPool.cpp: (WebKit::m_webProcessCache): WebProcessCache is stored on the WebProcessPool via m_webProcessCache data member. (WebKit::WebProcessPool::~WebProcessPool): Clear the WebProcess cache in the destructor. (WebKit::WebProcessPool::setApplicationIsActive): Notify the WebProcessCache whenever the application's active state changes. (WebKit::WebProcessPool::createWebPage): If the state of PSON changes via the experimental features menu, dynamically update the WebProcessCache's size. This is needed because the cache is disabled when PSON is disabled. (WebKit::WebProcessPool::handleMemoryPressureWarning): Clear the WebProcess cache on memory pressure. (WebKit::WebProcessPool::processForNavigationInternal): Query the WebProcessCache before attempting to create a new WebProcess for a cross-site navigation. (WebKit::WebProcessPool::findReusableSuspendedPageProcess): This logic was split out of processForNavigationInternal() to reduce the size of the method. * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::setIsInProcessCache): Update the isInProcessCache flag on the WebProcessProxy and send an IPC to the WebContent process so that it can update its name in Activity Monitor. We also need to stop holding a strong reference to the WebProcessPool whenever the process is in the cache, similarly to what we do for pre-warmed processes, given that such processes should not keep the process pool alive. (WebKit::WebProcessProxy::addExistingWebPage): Assert that we never try to add a page to a cached process, it should be taken out of the cache before use. (WebKit::WebProcessProxy::hasProvisionalPageWithID const): (WebKit::WebProcessProxy::isAllowedToUpdateBackForwardItem const): (WebKit::WebProcessProxy::updateBackForwardItem): In case of client-side redirects, the previous process would sometimes send an IPC causing the UIProcess' backforward list item to get updated with the pre-redirect URL after we've already redirected. This previously would be unlikely to occur because we do not suspend client-redirect pages and their process would normally exit before getting a chance to send the IPC. However, with the process cache, the bug became obvious as the process would stay alive and send up the "bad" IPC. To address the issue, we now only let the IPC update the item if the item's page is (still) associated with the process. In the future, we may want to update the IPC so that it gets sent to the WebPageProxy instead of the WebProcessProxy. (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): If a cached WebProcess crashes, remove it from the cache so that we do not attempt to use it for a load later. (WebKit::WebProcessProxy::canBeAddedToWebProcessCache const): Only cache WebProcesses that have loaded a single registrable domain. Also prevent caching for service worker and inspector processes. (WebKit::WebProcessProxy::maybeShutDown): If the process is cacheable, add it to the cache instead of shutting it down right away. (WebKit::WebProcessProxy::canTerminateAuxiliaryProcess): Make sure we do not attempt to terminate a processes that is in the cache. (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame): Whenever a main frame provisional load starts, make sure we update the process's associated registrable domain. nullopt indicates that there is no associated domain yet. Null string indicates that the process is associated with several registrable domain and is therefore not eligible for caching. * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::registrableDomain const): (WebKit::WebProcessProxy::isInProcessCache const): (WebKit::WebProcessProxy::provisionalPageCount const): Add convenience getters. * WebKit.xcodeproj/project.pbxproj: Add new files to project. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setIsInProcessCache): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updateProcessName): Update the WebProcess' name in Activity Monitor whenever it goes into or out of the WebProcess cache. Tools: Update API tests to turn on the WebContent Process cache. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@241556 268f45cc-cd09-0410-ab3c-d52691b4dbfc (cherry picked from commit dc197d35fd5d947ff4c81c2e0f5636b9cad36b3c) 2019-02-14 Chris Dumez [PSON] Introduce a WebContent Process cache https://bugs.webkit.org/show_bug.cgi?id=194594 Reviewed by Geoff Garen. Introduce a WebContent Process cache to reduce the number of process launches when process swap on navigation is enabled, and to reduce the power cost of the feature. If a WebProcess loaded pages from a single registrable domain then it is eligible for the cache. When process-swapping on navigation to a new registrable domain, we now attempt to retrieve a process from the cache for the domain in question instead of always launching a new one. The WebProcess cache currently has the following attributes: - It may contains 4 processes per GB of RAM the machine has, up to 30 processes. - WebProcesses automatically get evicted from the cache after 30 minutes. - If the application is no longer the active app, then the cache will get cleared after 5 minutes. - WebProcesses that are in the cache are reported as "(Cached)" in Activity Monitor. The WebProcess cache is currently disabled by default and can by enabled by the client via SPI. * Shared/WebBackForwardListItem.cpp: (WebKit::WebBackForwardListItem::WebBackForwardListItem): * Shared/WebBackForwardListItem.h: (WebKit::WebBackForwardListItem::lastProcessIdentifier const): (WebKit::WebBackForwardListItem::setLastProcessIdentifier): Add new lastProcessIdentifier data member that reflects which process this item was last loaded in. It is normally identical to the identifier of the process that created the item but it gets overriden in case of cross-site client-side redirect, since a new process takes over the item in this case. * Sources.txt: Add new source file. * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/C/WKContextConfigurationRef.cpp: (WKContextConfigurationUsesWebProcessCache): (WKContextConfigurationSetUsesWebProcessCache): * UIProcess/API/C/WKContextConfigurationRef.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration setUsesWebProcessCache:]): (-[_WKProcessPoolConfiguration usesWebProcessCache]): Add new SPI to enable the WebProcess cache. * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _webProcessCountIgnoringPrewarmedAndCached]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: Add new SPI for testing which returns the number of WebProcesses ignoring both prewarmed and cached ones. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::registerNotificationObservers): (WebKit::WebProcessPool::unregisterNotificationObservers): Add application active state observers as the WebProcess cache gets cleared when the application resigns active state for more than 5 minutes. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::loadRequest): When doing a load in a new process with the BackForwardList locked (i.e. client-side redirect), make sure we update the last process identifier for the BackForwardListItem. This is important because the logic in WebProcessPool::processForNavigation() relies on this identifier to select which process to do the history navigation into, and we want to do the load in the post-redirect process, not the pre-redirect one. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): Tell the WebProcess whenever a main frame provisional load is started, providing the URL. * UIProcess/WebProcessCache.cpp: Added. (WebKit::WebProcessCache::WebProcessCache): (WebKit::WebProcessCache::addProcess): (WebKit::WebProcessCache::takeProcess): (WebKit::WebProcessCache::updateMaximumSize): (WebKit::WebProcessCache::clear): (WebKit::WebProcessCache::setApplicationIsActive): (WebKit::WebProcessCache::evictProcess): (WebKit::WebProcessCache::CachedProcess::CachedProcess): (WebKit::WebProcessCache::CachedProcess::~CachedProcess): (WebKit::WebProcessCache::CachedProcess::takeProcess): (WebKit::WebProcessCache::CachedProcess::evictionTimerFired): * UIProcess/WebProcessCache.h: Added. (WebKit::WebProcessCache::maximumSize): (WebKit::WebProcessCache::size const): (WebKit::WebProcessCache::CachedProcess::process): Add process cache implementation. * UIProcess/WebProcessPool.cpp: (WebKit::m_webProcessCache): WebProcessCache is stored on the WebProcessPool via m_webProcessCache data member. (WebKit::WebProcessPool::~WebProcessPool): Clear the WebProcess cache in the destructor. (WebKit::WebProcessPool::setApplicationIsActive): Notify the WebProcessCache whenever the application's active state changes. (WebKit::WebProcessPool::createWebPage): If the state of PSON changes via the experimental features menu, dynamically update the WebProcessCache's size. This is needed because the cache is disabled when PSON is disabled. (WebKit::WebProcessPool::handleMemoryPressureWarning): Clear the WebProcess cache on memory pressure. (WebKit::WebProcessPool::processForNavigationInternal): Query the WebProcessCache before attempting to create a new WebProcess for a cross-site navigation. (WebKit::WebProcessPool::findReusableSuspendedPageProcess): This logic was split out of processForNavigationInternal() to reduce the size of the method. * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::setIsInProcessCache): Update the isInProcessCache flag on the WebProcessProxy and send an IPC to the WebContent process so that it can update its name in Activity Monitor. We also need to stop holding a strong reference to the WebProcessPool whenever the process is in the cache, similarly to what we do for pre-warmed processes, given that such processes should not keep the process pool alive. (WebKit::WebProcessProxy::addExistingWebPage): Assert that we never try to add a page to a cached process, it should be taken out of the cache before use. (WebKit::WebProcessProxy::hasProvisionalPageWithID const): (WebKit::WebProcessProxy::isAllowedToUpdateBackForwardItem const): (WebKit::WebProcessProxy::updateBackForwardItem): In case of client-side redirects, the previous process would sometimes send an IPC causing the UIProcess' backforward list item to get updated with the pre-redirect URL after we've already redirected. This previously would be unlikely to occur because we do not suspend client-redirect pages and their process would normally exit before getting a chance to send the IPC. However, with the process cache, the bug became obvious as the process would stay alive and send up the "bad" IPC. To address the issue, we now only let the IPC update the item if the item's page is (still) associated with the process. In the future, we may want to update the IPC so that it gets sent to the WebPageProxy instead of the WebProcessProxy. (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): If a cached WebProcess crashes, remove it from the cache so that we do not attempt to use it for a load later. (WebKit::WebProcessProxy::canBeAddedToWebProcessCache const): Only cache WebProcesses that have loaded a single registrable domain. Also prevent caching for service worker and inspector processes. (WebKit::WebProcessProxy::maybeShutDown): If the process is cacheable, add it to the cache instead of shutting it down right away. (WebKit::WebProcessProxy::canTerminateAuxiliaryProcess): Make sure we do not attempt to terminate a processes that is in the cache. (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame): Whenever a main frame provisional load starts, make sure we update the process's associated registrable domain. nullopt indicates that there is no associated domain yet. Null string indicates that the process is associated with several registrable domain and is therefore not eligible for caching. * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::registrableDomain const): (WebKit::WebProcessProxy::isInProcessCache const): (WebKit::WebProcessProxy::provisionalPageCount const): Add convenience getters. * WebKit.xcodeproj/project.pbxproj: Add new files to project. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setIsInProcessCache): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updateProcessName): Update the WebProcess' name in Activity Monitor whenever it goes into or out of the WebProcess cache. 2019-02-13 Babak Shafiei Apply patch. rdar://problem/47673836 2019-02-13 Brent Fulgham [iOS] Revert ability to set programmatic focus when hardware keyboard is attached https://bugs.webkit.org/show_bug.cgi?id=194570 Reviewed by Dan Bates. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::platformEditorState const): 2019-02-13 Babak Shafiei Cherry-pick r241500. rdar://problem/48065631 Crash in WKBundleFrameGetParentFrame when called inside didRemoveFrameFromHierarchy https://bugs.webkit.org/show_bug.cgi?id=194641 Reviewed by Geoffrey Garen. Source/WebKit: Fixed the bug by adding a null check to WebFrame::parentFrame. * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::parentFrame const): Tools: Added a call to WKBundleFrameGetParentFrame to an existing test for didRemoveFrameFromHierarchy so that the test would fail without this fix. * TestWebKitAPI/Tests/WebKit/DidRemoveFrameFromHiearchyInPageCache_Bundle.cpp: (TestWebKitAPI::didRemoveFrameFromHierarchyCallback): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241500 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-13 Ryosuke Niwa Crash in WKBundleFrameGetParentFrame when called inside didRemoveFrameFromHierarchy https://bugs.webkit.org/show_bug.cgi?id=194641 Reviewed by Geoffrey Garen. Fixed the bug by adding a null check to WebFrame::parentFrame. * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::parentFrame const): 2019-02-13 Babak Shafiei Cherry-pick r241481. rdar://problem/48065616 Encrypted PDFs inside or crash the Web Content process https://bugs.webkit.org/show_bug.cgi?id=194605 Reviewed by Andy Estes. Source/WebKit: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createPasswordEntryForm): Don't try to create a password form field if we can't make form fields. This means you will be left with a useless embedded PDF, but at least the Web Content process won't crash. We'll need to find an alternative implementation of PDF embedded form fields that is compatible with and if we want to support this. Currently we piggy-back off the fact that we can just insert s into the PluginDocument's DOM, but we can't do that if there is no PluginDocument, just a main document, like in the case. LayoutTests: * fast/replaced/encrypted-pdf-as-object-and-embed-expected.txt: Added. * fast/replaced/encrypted-pdf-as-object-and-embed.html: Added. * fast/replaced/resources/encrypted-image.pdf: Added. Add a test ensuring that we don't crash with encrypted PDF in or . git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241481 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-13 Tim Horton Encrypted PDFs inside or crash the Web Content process https://bugs.webkit.org/show_bug.cgi?id=194605 Reviewed by Andy Estes. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createPasswordEntryForm): Don't try to create a password form field if we can't make form fields. This means you will be left with a useless embedded PDF, but at least the Web Content process won't crash. We'll need to find an alternative implementation of PDF embedded form fields that is compatible with and if we want to support this. Currently we piggy-back off the fact that we can just insert s into the PluginDocument's DOM, but we can't do that if there is no PluginDocument, just a main document, like in the case. 2019-02-13 Babak Shafiei Cherry-pick r241480. rdar://problem/48065618 Further restricting webarchive loads https://bugs.webkit.org/show_bug.cgi?id=194567 Reviewed by Youenn Fablet. Source/WebCore: This patch futher restricts main frame webarchive loads to the followings: 1) loaded by clients; 2) loaded by drag; 3) reloaded from any of the previous two. It moves setAlwaysAllowLocalWebarchive, which is used for testing only, from Document to FrameLoader such that the option is remembered during redirections. Covered by API tests. * dom/Document.h: (WebCore::Document::setAlwaysAllowLocalWebarchive): Deleted. (WebCore::Document::alwaysAllowLocalWebarchive const): Deleted. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::disallowWebArchive const): * loader/DocumentLoader.h: (WebCore::DocumentLoader::setAllowsWebArchiveForMainFrame): (WebCore::DocumentLoader::allowsWebArchiveForMainFrame): * loader/FrameLoadRequest.h: (WebCore::FrameLoadRequest::setIsRequestFromClientOrUserInput): (WebCore::FrameLoadRequest::isRequestFromClientOrUserInput): * loader/FrameLoader.cpp: (WebCore::FrameLoader::load): (WebCore::FrameLoader::reload): * loader/FrameLoader.h: (WebCore::FrameLoader::setAlwaysAllowLocalWebarchive): (WebCore::FrameLoader::alwaysAllowLocalWebarchive const): * page/DragController.cpp: (WebCore::DragController::performDragOperation): * testing/Internals.cpp: (WebCore::Internals::setAlwaysAllowLocalWebarchive const): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadRequest): Set a flag to indicate a load is started from clients. Tools: Besides adding API tests, this patch also enhances DragAndDropSimulator to allow navigations on drop. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/mac/LoadWebArchive.mm: Added. (-[TestLoadWebArchiveNavigationDelegate webView:didFinishNavigation:]): (-[TestLoadWebArchiveNavigationDelegate webView:didFailProvisionalNavigation:withError:]): (-[TestLoadWebArchiveNavigationDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]): (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/mac/helloworld.webarchive: Added. * TestWebKitAPI/Tests/mac/load-web-archive-1.html: Added. * TestWebKitAPI/Tests/mac/load-web-archive-2.html: Added. * TestWebKitAPI/cocoa/DragAndDropSimulator.h: * TestWebKitAPI/mac/DragAndDropSimulatorMac.mm: (-[DragAndDropSimulator initWithWebViewFrame:configuration:]): (-[DragAndDropSimulator _webView:dragDestinationActionMaskForDraggingInfo:]): LayoutTests: * platform/mac/fast/loader/webarchive-encoding-respected.html: * webarchive/loading/cache-expired-subresource.html: * webarchive/loading/javascript-url-iframe-crash.html: * webarchive/loading/mainresource-null-mimetype-crash.html: * webarchive/loading/missing-data.html: * webarchive/loading/object.html: * webarchive/loading/test-loading-archive-subresource-null-mimetype.html: * webarchive/loading/test-loading-archive-subresource.html: * webarchive/loading/test-loading-archive.html: * webarchive/loading/test-loading-top-archive.html: * webarchive/loading/video-in-webarchive.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241480 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-12 Jiewen Tan Further restricting webarchive loads https://bugs.webkit.org/show_bug.cgi?id=194567 Reviewed by Youenn Fablet. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadRequest): Set a flag to indicate a load is started from clients. 2019-02-13 Babak Shafiei Cherry-pick r241453. rdar://problem/48065612 Fix -Wformat warning from r241401 https://bugs.webkit.org/show_bug.cgi?id=194584 * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setActivityState): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241453 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-13 Michael Catanzaro Fix -Wformat warning from r241401 https://bugs.webkit.org/show_bug.cgi?id=194584 * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setActivityState): 2019-02-13 Babak Shafiei Cherry-pick r241448. rdar://problem/48065637 Crash in WebKit::CacheStorage::Engine::cachesRootPath https://bugs.webkit.org/show_bug.cgi?id=194588 Reviewed by Youenn Fablet. * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::cachesRootPath): Salt may have not been initialized yet when the Engine is destroyed. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241448 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-13 Antti Koivisto Crash in WebKit::CacheStorage::Engine::cachesRootPath https://bugs.webkit.org/show_bug.cgi?id=194588 Reviewed by Youenn Fablet. * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::cachesRootPath): Salt may have not been initialized yet when the Engine is destroyed. 2019-02-13 Babak Shafiei Cherry-pick r241401. rdar://problem/48065612 Crash in Page::setActivityState because m_page is null https://bugs.webkit.org/show_bug.cgi?id=194584 Reviewed by Antti Koivisto. Add a null check to avoid the crash. Also add a debug assertion to help diagnose this in the future. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setActivityState): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241401 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-13 Ryosuke Niwa Crash in Page::setActivityState because m_page is null https://bugs.webkit.org/show_bug.cgi?id=194584 Reviewed by Antti Koivisto. Add a null check to avoid the crash. Also add a debug assertion to help diagnose this in the future. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setActivityState): 2019-02-13 Babak Shafiei Cherry-pick r241349. rdar://problem/48065639 Null deref in userInterfaceLayoutDirection under ViewGestureController::handleSwipeGesture https://bugs.webkit.org/show_bug.cgi?id=194569 Reviewed by Wenson Hsieh. * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::handleSwipeGesture): It is conceivable that we could get here if the client closes the page e.g. in the callback from willEndSwipeGesture. We already guarded against this ... one line too late! Rearrange the lines so we don't call into WebPageProxy at all if we don't have a drawing area (which is a strict subset of the time that isValid would return true). This is a speculative fix, since I can no longer reproduce the crash on demand. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241349 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-12 Tim Horton Null deref in userInterfaceLayoutDirection under ViewGestureController::handleSwipeGesture https://bugs.webkit.org/show_bug.cgi?id=194569 Reviewed by Wenson Hsieh. * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::handleSwipeGesture): It is conceivable that we could get here if the client closes the page e.g. in the callback from willEndSwipeGesture. We already guarded against this ... one line too late! Rearrange the lines so we don't call into WebPageProxy at all if we don't have a drawing area (which is a strict subset of the time that isValid would return true). This is a speculative fix, since I can no longer reproduce the crash on demand. 2019-02-13 Babak Shafiei Cherry-pick r241336. rdar://problem/48065621 Regression(PSON) MESSAGE_CHECK() hit under WebPageProxy::didFailProvisionalLoadForFrameShared() https://bugs.webkit.org/show_bug.cgi?id=194568 Reviewed by Ryosuke Niwa. Source/WebKit: When the provisional process crashes, it is unsafe to call ProvisionalPageProxy::cancel() because the WebProcessProxy clears its frame map as soon as the process crashes. Calling cancel() after that would call WebPageProxy::didFailProvisionalLoadForFrameShared(), which would try to look up the frame by ID and MESSAGE_CHECK() that the frame is not null. We would fail this check since the frame has been removed from the WebProcessProxy at this point. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _provisionalWebProcessIdentifier]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): (WebKit::WebPageProxy::provisionalProcessDidTerminate): Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: (-[PSONNavigationDelegate webView:didStartProvisionalNavigation:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241336 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-12 Chris Dumez Regression(PSON) MESSAGE_CHECK() hit under WebPageProxy::didFailProvisionalLoadForFrameShared() https://bugs.webkit.org/show_bug.cgi?id=194568 Reviewed by Ryosuke Niwa. When the provisional process crashes, it is unsafe to call ProvisionalPageProxy::cancel() because the WebProcessProxy clears its frame map as soon as the process crashes. Calling cancel() after that would call WebPageProxy::didFailProvisionalLoadForFrameShared(), which would try to look up the frame by ID and MESSAGE_CHECK() that the frame is not null. We would fail this check since the frame has been removed from the WebProcessProxy at this point. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _provisionalWebProcessIdentifier]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): (WebKit::WebPageProxy::provisionalProcessDidTerminate): 2019-02-13 Alan Coon Apply patch. rdar://problem/40966400 2019-02-13 Brent Fulgham Branch-Only: Use Async message infrastructure for storageAccess API https://bugs.webkit.org/show_bug.cgi?id=194511 Back-port the trunk async message handling implementation of the StorageAccess API methods. The generated async message handling code does a better job of managing the bookkeeping and error handling of cross-process message passing, and gives us fewer opportunities to make coding errors that might lead to dropped messages or sending messages multiple times. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::hasStorageAccess): (WebKit::WebPageProxy::requestStorageAccess): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::hasStorageAccess): (WebKit::WebPage::requestStorageAccess): (WebKit::nextRequestStorageAccessContextId): Deleted. (WebKit::WebPage::storageAccessResponse): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2019-02-13 Alan Coon Cherry-pick r241352. rdar://problem/48038900 Release assert in PolicyCheckIdentifier::isValidFor via WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction https://bugs.webkit.org/show_bug.cgi?id=194582 Reviewed by Antti Koivisto. Source/WebCore: Check the zero-ness of m_policyCheck first so that we can differentiate process ID being wrong from the non-generated identifier being sent to us as it was the case in this failure. * loader/PolicyChecker.cpp: (WebCore::PolicyCheckIdentifier::isValidFor): Source/WebKit: The bug was caused by WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction invoking the callback with responseIdentifier even when we had failed to send the policy check IPC. Clearly, responseIdentifier is invalid in that case, and we should be using requestIdentifier instead. Unfortunately no new tests since I'm not aware of a way to make sendSync fail in this case. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241352 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-13 Ryosuke Niwa Release assert in PolicyCheckIdentifier::isValidFor via WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction https://bugs.webkit.org/show_bug.cgi?id=194582 Reviewed by Antti Koivisto. The bug was caused by WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction invoking the callback with responseIdentifier even when we had failed to send the policy check IPC. Clearly, responseIdentifier is invalid in that case, and we should be using requestIdentifier instead. Unfortunately no new tests since I'm not aware of a way to make sendSync fail in this case. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): 2019-02-12 Alan Coon Apply patch. rdar://problem/48009995 2019-02-12 Alex Christensen WebPage::close needs to remove all message receivers associated with that WebPage, not WebPage::~WebPage https://bugs.webkit.org/show_bug.cgi?id=194522 Reviewed by Chris Dumez. The InjectedBundle SPI can retain the WebPage or wrapping objects (WKWebProcessPlugInBrowserContextController/WKBundlePageRef). This can make it so WebPage::close is called before WebPage::~WebPage, and if the SuspendedPageProxy is reused for a subsequent navigation to the same domain, the WebProcess is reused with a different WebPage instance with the same PageID, which causes problems when another WebPage registers message handlers and then the previous WebPage is destroyed, which removes both message handlers. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::~WebPage): (WebKit::WebPage::close): (WebKit::WebPage::mainFrameDidLayout): * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.h: (WebKit::WebProcess::eventDispatcher): 2019-02-07 Babak Shafiei Cherry-pick r241171. rdar://problem/47908156 [iOS] Clicking links in Safari using Apple Pencil is much more difficult after r238475 https://bugs.webkit.org/show_bug.cgi?id=194415 Reviewed by Tim Horton. Source/WebKit: Fix the bug by not firing the Apple-pencil-exclusive tap gesture recognizer in the case where editable images are disabled. This gesture recognizer is only used for inserting editable images, and currently conflicts with the synthetic click gesture recognizer used to recognize clicks from generic digitizer inputs. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView gestureRecognizerShouldBegin:]): (-[WKContentView _stylusSingleTapRecognized:]): LayoutTests: Add a layout test to verify that a stylus tap dispatches clicks. * fast/events/touch/ios/pencil-tap-dispatches-click-expected.txt: Added. * fast/events/touch/ios/pencil-tap-dispatches-click.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241171 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-07 Wenson Hsieh [iOS] Clicking links in Safari using Apple Pencil is much more difficult after r238475 https://bugs.webkit.org/show_bug.cgi?id=194415 Reviewed by Tim Horton. Fix the bug by not firing the Apple-pencil-exclusive tap gesture recognizer in the case where editable images are disabled. This gesture recognizer is only used for inserting editable images, and currently conflicts with the synthetic click gesture recognizer used to recognize clicks from generic digitizer inputs. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView gestureRecognizerShouldBegin:]): (-[WKContentView _stylusSingleTapRecognized:]): 2019-02-07 Babak Shafiei Cherry-pick r241143. rdar://problem/47908161 Permit additional IOKit Properties needed by Media PlugIns on older Mac Hardware https://bugs.webkit.org/show_bug.cgi?id=194412 Reviewed by Per Arne Vollan. * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241143 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-07 Brent Fulgham Permit additional IOKit Properties needed by Media PlugIns on older Mac Hardware https://bugs.webkit.org/show_bug.cgi?id=194412 Reviewed by Per Arne Vollan. * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: 2019-02-07 Babak Shafiei Cherry-pick r241142. rdar://problem/47908158 Permit additional IOKit Properties needed by older Mac Hardware https://bugs.webkit.org/show_bug.cgi?id=194410 Reviewed by Per Arne Vollan. * WebProcess/com.apple.WebProcess.sb.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241142 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-07 Brent Fulgham Permit additional IOKit Properties needed by older Mac Hardware https://bugs.webkit.org/show_bug.cgi?id=194410 Reviewed by Per Arne Vollan. * WebProcess/com.apple.WebProcess.sb.in: 2019-02-07 Alan Coon Cherry-pick r241131. rdar://problem/47893578 Print backgrounds preference should be honored instead of WKWebViewConfiguration value https://bugs.webkit.org/show_bug.cgi?id=194364 Reviewed by Tim Horton. Without this patch, changing the preference for printing the background has no effect. This patch fixes that, and I verified it manually by checking "Print backgrounds" in Safari's print menu. Unfortunately, the only way to test this is actually printing because only values from WebPageProxy::preferences or WebPageProxy::configuration's preferences are exposed to the API, but values from WebPageProxy::preferencesStore are used when printing. Actually printing verifies this change fixes the bug. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241131 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-07 Alex Christensen Print backgrounds preference should be honored instead of WKWebViewConfiguration value https://bugs.webkit.org/show_bug.cgi?id=194364 Reviewed by Tim Horton. Without this patch, changing the preference for printing the background has no effect. This patch fixes that, and I verified it manually by checking "Print backgrounds" in Safari's print menu. Unfortunately, the only way to test this is actually printing because only values from WebPageProxy::preferences or WebPageProxy::configuration's preferences are exposed to the API, but values from WebPageProxy::preferencesStore are used when printing. Actually printing verifies this change fixes the bug. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): 2019-02-07 Alan Coon Cherry-pick r241124. rdar://problem/47893586 Shrink and hyphenate safe browsing warning text on watchOS https://bugs.webkit.org/show_bug.cgi?id=194361 Reviewed by Geoffrey Garen. Some internationalizations use long words that didn't fit on small watches. * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: (fontOfSize): (-[WKSafeBrowsingWarning addContent]): (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241124 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-07 Alex Christensen Shrink and hyphenate safe browsing warning text on watchOS https://bugs.webkit.org/show_bug.cgi?id=194361 Reviewed by Geoffrey Garen. Some internationalizations use long words that didn't fit on small watches. * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: (fontOfSize): (-[WKSafeBrowsingWarning addContent]): (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]): 2019-02-07 Alan Coon Cherry-pick r241105. rdar://problem/47893571 [Payment Request] It should be possible to require a phonetic name for shipping contacts https://bugs.webkit.org/show_bug.cgi?id=194311 Reviewed by Alex Christensen. Source/WebCore: It should be possible to require that a shipping contact has a phonetic name in Payment Request. To accomplish this, move requiredShippingContactFields from ApplePayPaymentRequest to ApplePayRequestBase so that it can be used as part of an Apple Pay payment method data. Since required shipping contact fields can now be specified both in requiredShippingContactFields and PaymentOptions, we merge the required fields from these two sources such that, e.g., email is required if it is specified in either place. So that clients can detect this new feature, the API version number is bumped from 5 to 6. Added test cases to ApplePayRequestShippingContact.https.html and ApplePayRequestShippingContactV3.https.html. * DerivedSources.make: * Modules/applepay/ApplePayPaymentRequest.h: * Modules/applepay/ApplePayPaymentRequest.idl: * Modules/applepay/ApplePayRequestBase.cpp: (WebCore::convertAndValidate): * Modules/applepay/ApplePayRequestBase.h: * Modules/applepay/ApplePayRequestBase.idl: * Modules/applepay/ApplePaySession.cpp: (WebCore::convertAndValidate): * Modules/applepay/PaymentCoordinatorClient.cpp: Added. (WebCore::PaymentCoordinatorClient::supportsVersion): * Modules/applepay/PaymentCoordinatorClient.h: * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::mergePaymentOptions): (WebCore::ApplePayPaymentHandler::show): * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * loader/EmptyClients.cpp: * testing/MockPaymentContactFields.h: Added. (WebCore::MockPaymentContactFields::MockPaymentContactFields): * testing/MockPaymentContactFields.idl: Added. * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::showPaymentUI): (WebCore::MockPaymentCoordinator::supportsVersion): Deleted. * testing/MockPaymentCoordinator.h: * testing/MockPaymentCoordinator.idl: Source/WebKit: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::supportsVersion): Deleted. * WebProcess/ApplePay/WebPaymentCoordinator.h: Source/WebKitLegacy/mac: * WebCoreSupport/WebPaymentCoordinatorClient.h: * WebCoreSupport/WebPaymentCoordinatorClient.mm: (WebPaymentCoordinatorClient::supportsVersion): Deleted. LayoutTests: * http/tests/ssl/applepay/ApplePayRequestShippingContact.https-expected.txt: * http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html: * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https-expected.txt: * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html: * http/tests/ssl/applepay/PaymentRequest.https-expected.txt: * http/tests/ssl/applepay/PaymentRequest.https.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241105 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-06 Andy Estes [Payment Request] It should be possible to require a phonetic name for shipping contacts https://bugs.webkit.org/show_bug.cgi?id=194311 Reviewed by Alex Christensen. * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::supportsVersion): Deleted. * WebProcess/ApplePay/WebPaymentCoordinator.h: 2019-02-07 Alan Coon Cherry-pick r241026. rdar://problem/47774548 Roll out parts of r238819 since it is a PLT performance regression. https://bugs.webkit.org/show_bug.cgi?id=194346 Unreviewed performance fix. * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (didStartProvisionalLoadForFrame): (didReceiveServerRedirectForProvisionalLoadForFrame): (didFinishLoadForFrame): (globalObjectIsAvailableForFrame): (didRemoveFrameFromHierarchy): (didCommitLoadForFrame): (didFinishDocumentLoadForFrame): (didFailProvisionalLoadWithErrorForFrame): (didFailLoadWithErrorForFrame): (didSameDocumentNavigationForFrame): (didLayoutForFrame): (didReachLayoutMilestone): (didFirstVisuallyNonEmptyLayoutForFrame): (didHandleOnloadEventsForFrame): (userAgentForURL): (setUpPageLoaderClient): (willSendRequestForFrame): (didInitiateLoadForResource): (didFinishLoadForResource): (didFailLoadForResource): (setUpResourceLoadClient): (-[WKWebProcessPlugInBrowserContextController setLoadDelegate:]): (ResourceLoadClient::ResourceLoadClient): Deleted. (ResourceLoadClient::loadDelegate const): Deleted. (ResourceLoadClient::pluginContextController const): Deleted. (PageLoaderClient::PageLoaderClient): Deleted. (PageLoaderClient::loadDelegate const): Deleted. (PageLoaderClient::pluginContextController const): Deleted. (PageLoaderClient::didStartProvisionalLoadForFrame): Deleted. (PageLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame): Deleted. (PageLoaderClient::didFinishLoadForFrame): Deleted. (PageLoaderClient::globalObjectIsAvailableForFrame): Deleted. (PageLoaderClient::didRemoveFrameFromHierarchy): Deleted. (PageLoaderClient::didCommitLoadForFrame): Deleted. (PageLoaderClient::didFinishDocumentLoadForFrame): Deleted. (PageLoaderClient::didFailProvisionalLoadWithErrorForFrame): Deleted. (PageLoaderClient::didFailLoadWithErrorForFrame): Deleted. (PageLoaderClient::didSameDocumentNavigationForFrame): Deleted. (PageLoaderClient::didLayoutForFrame): Deleted. (PageLoaderClient::didReachLayoutMilestone): Deleted. (PageLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame): Deleted. (PageLoaderClient::layoutMilestones const): Deleted. (PageLoaderClient::didHandleOnloadEventsForFrame): Deleted. (PageLoaderClient::userAgentForURL const): Deleted. (ResourceLoadClient::willSendRequestForFrame): Deleted. (ResourceLoadClient::didInitiateLoadForResource): Deleted. (ResourceLoadClient::didFinishLoadForResource): Deleted. (ResourceLoadClient::didFailLoadForResource): Deleted. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241026 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-06 Per Arne Vollan Roll out parts of r238819 since it is a PLT performance regression. https://bugs.webkit.org/show_bug.cgi?id=194346 Unreviewed performance fix. * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (didStartProvisionalLoadForFrame): (didReceiveServerRedirectForProvisionalLoadForFrame): (didFinishLoadForFrame): (globalObjectIsAvailableForFrame): (didRemoveFrameFromHierarchy): (didCommitLoadForFrame): (didFinishDocumentLoadForFrame): (didFailProvisionalLoadWithErrorForFrame): (didFailLoadWithErrorForFrame): (didSameDocumentNavigationForFrame): (didLayoutForFrame): (didReachLayoutMilestone): (didFirstVisuallyNonEmptyLayoutForFrame): (didHandleOnloadEventsForFrame): (userAgentForURL): (setUpPageLoaderClient): (willSendRequestForFrame): (didInitiateLoadForResource): (didFinishLoadForResource): (didFailLoadForResource): (setUpResourceLoadClient): (-[WKWebProcessPlugInBrowserContextController setLoadDelegate:]): (ResourceLoadClient::ResourceLoadClient): Deleted. (ResourceLoadClient::loadDelegate const): Deleted. (ResourceLoadClient::pluginContextController const): Deleted. (PageLoaderClient::PageLoaderClient): Deleted. (PageLoaderClient::loadDelegate const): Deleted. (PageLoaderClient::pluginContextController const): Deleted. (PageLoaderClient::didStartProvisionalLoadForFrame): Deleted. (PageLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame): Deleted. (PageLoaderClient::didFinishLoadForFrame): Deleted. (PageLoaderClient::globalObjectIsAvailableForFrame): Deleted. (PageLoaderClient::didRemoveFrameFromHierarchy): Deleted. (PageLoaderClient::didCommitLoadForFrame): Deleted. (PageLoaderClient::didFinishDocumentLoadForFrame): Deleted. (PageLoaderClient::didFailProvisionalLoadWithErrorForFrame): Deleted. (PageLoaderClient::didFailLoadWithErrorForFrame): Deleted. (PageLoaderClient::didSameDocumentNavigationForFrame): Deleted. (PageLoaderClient::didLayoutForFrame): Deleted. (PageLoaderClient::didReachLayoutMilestone): Deleted. (PageLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame): Deleted. (PageLoaderClient::layoutMilestones const): Deleted. (PageLoaderClient::didHandleOnloadEventsForFrame): Deleted. (PageLoaderClient::userAgentForURL const): Deleted. (ResourceLoadClient::willSendRequestForFrame): Deleted. (ResourceLoadClient::didInitiateLoadForResource): Deleted. (ResourceLoadClient::didFinishLoadForResource): Deleted. (ResourceLoadClient::didFailLoadForResource): Deleted. 2019-02-07 Alan Coon Cherry-pick r240808. rdar://problem/47774548 Revert r238819 which is unneeded and caused a performance regression. https://bugs.webkit.org/show_bug.cgi?id=192272 Source/WebCore: * loader/EmptyFrameLoaderClient.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::prepareForLoadStart): (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): (WebCore::FrameLoader::loadProvisionalItemFromCachedPage): * loader/FrameLoader.h: * loader/FrameLoaderClient.h: Source/WebKit: * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h: (API::InjectedBundle::PageLoaderClient::didStartProvisionalLoadForFrame): * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h: * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (PageLoaderClient::didStartProvisionalLoadForFrame): * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: (WebKit::InjectedBundlePageLoaderClient::didStartProvisionalLoadForFrame): * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: Source/WebKitLegacy/mac: * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::dispatchDidStartProvisionalLoad): Source/WebKitLegacy/win: * WebCoreSupport/WebFrameLoaderClient.cpp: (WebFrameLoaderClient::dispatchDidStartProvisionalLoad): * WebCoreSupport/WebFrameLoaderClient.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/ParserYieldTokenPlugIn.mm: (-[ParserYieldTokenPlugIn webProcessPlugInBrowserContextController:didCommitLoadForFrame:]): (-[ParserYieldTokenPlugIn webProcessPlugInBrowserContextController:willStartProvisionalLoadForFrame:completionHandler:]): Deleted. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240808 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-31 Alex Christensen Revert r238819 which is unneeded and caused a performance regression. https://bugs.webkit.org/show_bug.cgi?id=192272 * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h: (API::InjectedBundle::PageLoaderClient::didStartProvisionalLoadForFrame): * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h: * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (PageLoaderClient::didStartProvisionalLoadForFrame): * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: (WebKit::InjectedBundlePageLoaderClient::didStartProvisionalLoadForFrame): * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2019-02-07 Alan Coon Cherry-pick r239697. rdar://problem/47776479 Web Inspector: Remote inspector can crash if attempting to navigate inspector page https://bugs.webkit.org/show_bug.cgi?id=193204 Patch by Joseph Pecoraro on 2019-01-07 Reviewed by Devin Rousso. * UIProcess/mac/RemoteWebInspectorProxyMac.mm: (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow): * UIProcess/mac/WKInspectorViewController.mm: (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239697 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-07 Joseph Pecoraro Web Inspector: Remote inspector can crash if attempting to navigate inspector page https://bugs.webkit.org/show_bug.cgi?id=193204 Reviewed by Devin Rousso. * UIProcess/mac/RemoteWebInspectorProxyMac.mm: (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow): * UIProcess/mac/WKInspectorViewController.mm: (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]): 2019-02-06 Alan Coon Apply patch. rdar://problem/47822019 2019-02-06 Ryosuke Niwa Validate navigation policy decisions to avoid crashes in continueLoadAfterNavigationPolicy https://bugs.webkit.org/show_bug.cgi?id=194189 Reviewed by Geoffrey Garen. Pass the policy check identifier around functions and store it in PolicyDecisionSender so that we can send it back to WebCore with the navigation policy decision. We also store it in WebFrame in the case the policy decision had to be invalidated before the decision was received (via WebFrame::invalidatePolicyListener). * Scripts/webkit/messages.py: * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync): (WebKit::ProvisionalPageProxy::decidePolicyForResponse): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::PolicyDecisionSender): Added PolicyCheckIdentifier as a member. (WebKit::WebPageProxy::PolicyDecisionSender::create): (WebKit::WebPageProxy::PolicyDecisionSender::send): (WebKit::WebPageProxy::PolicyDecisionSender::PolicyDecisionSender): (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNavigationActionSync): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponse): (WebKit::WebPageProxy::decidePolicyForResponseShared): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::setUpPolicyListener): (WebKit::WebFrame::invalidatePolicyListener): (WebKit::WebFrame::didReceivePolicyDecision): * WebProcess/WebPage/WebFrame.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didReceivePolicyDecision): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2019-02-06 Alan Coon Cherry-pick r239845. rdar://problem/47776472 [macOS] Add name of IORegistry key in sandbox. https://bugs.webkit.org/show_bug.cgi?id=193335 Reviewed by Alexey Proskuryakov. The property IOGVAHEVCDecodeCapabilities was added in https://bugs.webkit.org/show_bug.cgi?id=193324. Also, the property IOGVAHEVCEncodeCapabilities needs to be added. * WebProcess/com.apple.WebProcess.sb.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239845 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-10 Per Arne Vollan [macOS] Add name of IORegistry key in sandbox. https://bugs.webkit.org/show_bug.cgi?id=193335 Reviewed by Alexey Proskuryakov. The property IOGVAHEVCDecodeCapabilities was added in https://bugs.webkit.org/show_bug.cgi?id=193324. Also, the property IOGVAHEVCEncodeCapabilities needs to be added. * WebProcess/com.apple.WebProcess.sb.in: 2019-02-06 Alan Coon Cherry-pick r239834. rdar://problem/47776472 [macOS] Add name of IORegistry key in sandbox. https://bugs.webkit.org/show_bug.cgi?id=193324 Reviewed by Brent Fulgham. IOGVAVTCapabilities key has been changed to IOGVAHEVCDecodeCapabilities. * WebProcess/com.apple.WebProcess.sb.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239834 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-10 Per Arne Vollan [macOS] Add name of IORegistry key in sandbox. https://bugs.webkit.org/show_bug.cgi?id=193324 Reviewed by Brent Fulgham. IOGVAVTCapabilities key has been changed to IOGVAHEVCDecodeCapabilities. * WebProcess/com.apple.WebProcess.sb.in: 2019-02-06 Alan Coon Cherry-pick r240995. rdar://problem/47843415 Reproducible crash under WKShareSheet presentWithParameters when cancelling a share https://bugs.webkit.org/show_bug.cgi?id=194301 Reviewed by Beth Dakin. * UIProcess/Cocoa/WKShareSheet.mm: (-[WKShareSheet presentWithParameters:completionHandler:]): NSSharingServicePicker's delegate callbacks can be called synchronously. We release the WKShareSheet (which holds our reference to the NSSharingServicePicker) under sharingServicePicker:didChooseSharingService:. On older versions of macOS, there was nothing keeping the NSSharingServicePicker alive inside showRelativeToRect:ofView:preferredEdge:, thus the whole chain of references would fall and result in sending a message to a released NSSharingServicePicker. To resolve this, keep an extra reference to the WKShareSheet until presentation is complete. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240995 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-05 Tim Horton Reproducible crash under WKShareSheet presentWithParameters when cancelling a share https://bugs.webkit.org/show_bug.cgi?id=194301 Reviewed by Beth Dakin. * UIProcess/Cocoa/WKShareSheet.mm: (-[WKShareSheet presentWithParameters:completionHandler:]): NSSharingServicePicker's delegate callbacks can be called synchronously. We release the WKShareSheet (which holds our reference to the NSSharingServicePicker) under sharingServicePicker:didChooseSharingService:. On older versions of macOS, there was nothing keeping the NSSharingServicePicker alive inside showRelativeToRect:ofView:preferredEdge:, thus the whole chain of references would fall and result in sending a message to a released NSSharingServicePicker. To resolve this, keep an extra reference to the WKShareSheet until presentation is complete. 2019-02-05 Alan Coon Cherry-pick r240928. rdar://problem/47810458 Capture state should be managed consistently when doing process swapping https://bugs.webkit.org/show_bug.cgi?id=194122 Reviewed by Eric Carlson. Source/WebKit: When doing PSON, WebPageProxy::resetState is called. It resets the media state, but does not call the client delegates. Instead of directly updating the media state, call the routine used to update it so that client delegates are called. Covered by new API test and layout test. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _mediaCaptureState]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetState): (WebKit::WebPageProxy::isPlayingMediaDidChange): (WebKit::WebPageProxy::updatePlayingMediaDidChange): * UIProcess/WebPageProxy.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: (-[GetUserMediaUIDelegate _webView:requestUserMediaAuthorizationForDevices:url:mainFrameURL:decisionHandler:]): (-[GetUserMediaUIDelegate _webView:checkUserMediaPermissionForURL:mainFrameURL:frameIdentifier:decisionHandler:]): (-[GetUserMediaUIDelegate _webView:mediaCaptureStateDidChange:]): * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::isDoingMediaCapture const): * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::isDoingMediaCapture const): * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::TestController::isDoingMediaCapture const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240928 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-04 Youenn Fablet Capture state should be managed consistently when doing process swapping https://bugs.webkit.org/show_bug.cgi?id=194122 Reviewed by Eric Carlson. When doing PSON, WebPageProxy::resetState is called. It resets the media state, but does not call the client delegates. Instead of directly updating the media state, call the routine used to update it so that client delegates are called. Covered by new API test and layout test. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _mediaCaptureState]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetState): (WebKit::WebPageProxy::isPlayingMediaDidChange): (WebKit::WebPageProxy::updatePlayingMediaDidChange): * UIProcess/WebPageProxy.h: 2019-02-05 Alan Coon Apply patch. rdar://problem/47810458 fix-194122 2019-02-04 Youenn Fablet Capture state should be managed consistently when doing process swapping https://bugs.webkit.org/show_bug.cgi?id=194122 When doing PSON, WebPageProxy::resetState is called. It resets the media state, but does not call the client delegates. Instead of directly updating the media state, call the routine used to update it so that client delegates are called. Covered by new API test and layout test. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _mediaCaptureState]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetState): (WebKit::WebPageProxy::isPlayingMediaDidChange): (WebKit::WebPageProxy::updatePlayingMediaDidChange): * UIProcess/WebPageProxy.h: 2019-02-05 Alan Coon Cherry-pick r239752. rdar://problem/47776478 [WebAuthN] Support U2F HID Authenticators on macOS https://bugs.webkit.org/show_bug.cgi?id=191535 Reviewed by Brent Fulgham. Source/WebCore: This patch changes U2fCommandConstructor to produce register commands with enforcing test of user presence. Otherwise, authenticators would silently generate credentials. It also renames readFromU2fSignResponse to readU2fSignResponse. Tests: http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html http/wpt/webauthn/public-key-credential-create-success-u2f.https.html http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html http/wpt/webauthn/public-key-credential-get-success-u2f.https.html * Modules/webauthn/fido/U2fCommandConstructor.cpp: (fido::WebCore::constructU2fRegisterCommand): * Modules/webauthn/fido/U2fResponseConverter.cpp: (fido::readU2fSignResponse): (fido::readFromU2fSignResponse): Deleted. * Modules/webauthn/fido/U2fResponseConverter.h: Source/WebKit: This patch implements the support for U2F authenticators, and enables it for hid devices. It follows the CTAP spec to map WebAuthN requests to U2F commands and return the responses: https://fidoalliance.org/specs/fido-v2.0-id-20180227/fido-client-to-authenticator-protocol-v2.0-id-20180227.html#u2f-interoperability Most of the parts are done before this patch, this patch focues on: 7.2.2 and 7.3.2. Besides implementing the U2fHidAuthenticator, this patch also adds support in the mocking environment for U2F authenticators. It is done by extending the stages in MockHidConnection from 4 to indefinite as multi-round communications are expected to map WebAuthN requests to U2F requests. * Sources.txt: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): * UIProcess/WebAuthentication/Cocoa/HidService.mm: (WebKit::HidService::continueAddDeviceAfterGetInfo): * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp: (WebKit::CtapHidDriver::continueAfterChannelAllocated): * UIProcess/WebAuthentication/fido/CtapHidDriver.h: (WebKit::CtapHidDriver::setProtocol): * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp: Added. (WebKit::U2fHidAuthenticator::U2fHidAuthenticator): (WebKit::U2fHidAuthenticator::makeCredential): (WebKit::U2fHidAuthenticator::checkExcludeList): (WebKit::U2fHidAuthenticator::issueRegisterCommand): (WebKit::U2fHidAuthenticator::getAssertion): (WebKit::U2fHidAuthenticator::issueSignCommand): (WebKit::U2fHidAuthenticator::issueNewCommand): (WebKit::U2fHidAuthenticator::issueCommand): (WebKit::U2fHidAuthenticator::responseReceived): (WebKit::U2fHidAuthenticator::continueRegisterCommandAfterResponseReceived): (WebKit::U2fHidAuthenticator::continueCheckOnlyCommandAfterResponseReceived): (WebKit::U2fHidAuthenticator::continueBogusCommandAfterResponseReceived): (WebKit::U2fHidAuthenticator::continueSignCommandAfterResponseReceived): * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h: Added. * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::parseRequest): (WebKit::MockHidConnection::feedReports): * UIProcess/WebAuthentication/Mock/MockHidConnection.h: * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: * WebKit.xcodeproj/project.pbxproj: Tools: This patch: 1) adds support for U2F mocking mechanism; 2) updates tests to reflect U2fCommandConstructor changes. * TestWebKitAPI/Tests/WebCore/CtapResponseTest.cpp: (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebCore/FidoTestData.h: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setWebAuthenticationMockConfiguration): LayoutTests: Besiding adding tests for U2F authenticators, it also changes payloadBase64 from a string to a vector of strings. New tests are skipped for iOS. * http/wpt/webauthn/ctap-hid-failure.https.html: * http/wpt/webauthn/ctap-hid-success.https.html: * http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html: * http/wpt/webauthn/public-key-credential-create-failure-hid.https.html: * http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html: Added. * http/wpt/webauthn/public-key-credential-create-failure-u2f.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html: Added. * http/wpt/webauthn/public-key-credential-create-success-hid.https.html: * http/wpt/webauthn/public-key-credential-create-success-u2f.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-create-success-u2f.https.html: Copied from LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https.html. * http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html: * http/wpt/webauthn/public-key-credential-get-failure-hid.https.html: * http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html: Added. * http/wpt/webauthn/public-key-credential-get-failure-u2f.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html: Added. * http/wpt/webauthn/public-key-credential-get-success-hid.https.html: * http/wpt/webauthn/public-key-credential-get-success-u2f.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-get-success-u2f.https.html: Added. * http/wpt/webauthn/resources/util.js: * platform/ios-wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239752 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-08 Jiewen Tan [WebAuthN] Support U2F HID Authenticators on macOS https://bugs.webkit.org/show_bug.cgi?id=191535 Reviewed by Brent Fulgham. This patch implements the support for U2F authenticators, and enables it for hid devices. It follows the CTAP spec to map WebAuthN requests to U2F commands and return the responses: https://fidoalliance.org/specs/fido-v2.0-id-20180227/fido-client-to-authenticator-protocol-v2.0-id-20180227.html#u2f-interoperability Most of the parts are done before this patch, this patch focues on: 7.2.2 and 7.3.2. Besides implementing the U2fHidAuthenticator, this patch also adds support in the mocking environment for U2F authenticators. It is done by extending the stages in MockHidConnection from 4 to indefinite as multi-round communications are expected to map WebAuthN requests to U2F requests. * Sources.txt: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): * UIProcess/WebAuthentication/Cocoa/HidService.mm: (WebKit::HidService::continueAddDeviceAfterGetInfo): * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp: (WebKit::CtapHidDriver::continueAfterChannelAllocated): * UIProcess/WebAuthentication/fido/CtapHidDriver.h: (WebKit::CtapHidDriver::setProtocol): * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp: Added. (WebKit::U2fHidAuthenticator::U2fHidAuthenticator): (WebKit::U2fHidAuthenticator::makeCredential): (WebKit::U2fHidAuthenticator::checkExcludeList): (WebKit::U2fHidAuthenticator::issueRegisterCommand): (WebKit::U2fHidAuthenticator::getAssertion): (WebKit::U2fHidAuthenticator::issueSignCommand): (WebKit::U2fHidAuthenticator::issueNewCommand): (WebKit::U2fHidAuthenticator::issueCommand): (WebKit::U2fHidAuthenticator::responseReceived): (WebKit::U2fHidAuthenticator::continueRegisterCommandAfterResponseReceived): (WebKit::U2fHidAuthenticator::continueCheckOnlyCommandAfterResponseReceived): (WebKit::U2fHidAuthenticator::continueBogusCommandAfterResponseReceived): (WebKit::U2fHidAuthenticator::continueSignCommandAfterResponseReceived): * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h: Added. * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::parseRequest): (WebKit::MockHidConnection::feedReports): * UIProcess/WebAuthentication/Mock/MockHidConnection.h: * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: * WebKit.xcodeproj/project.pbxproj: 2019-02-05 Alan Coon Cherry-pick r240974. rdar://problem/47830620 Protect globalWebSocketStreamMap with a Lock https://bugs.webkit.org/show_bug.cgi?id=194224 Reviewed by Ryosuke Niwa. * WebProcess/Network/WebSocketStream.cpp: (WebKit::WebSocketStream::streamWithIdentifier): (WebKit::WebSocketStream::networkProcessCrashed): (WebKit::WebSocketStream::WebSocketStream): (WebKit::WebSocketStream::~WebSocketStream): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240974 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-05 Alex Christensen Protect globalWebSocketStreamMap with a Lock https://bugs.webkit.org/show_bug.cgi?id=194224 Reviewed by Ryosuke Niwa. * WebProcess/Network/WebSocketStream.cpp: (WebKit::WebSocketStream::streamWithIdentifier): (WebKit::WebSocketStream::networkProcessCrashed): (WebKit::WebSocketStream::WebSocketStream): (WebKit::WebSocketStream::~WebSocketStream): 2019-02-05 Alan Coon Cherry-pick r240925. rdar://problem/47774545 Unreviewed, avoid -Wswitch warnings introduced in r240880 https://bugs.webkit.org/show_bug.cgi?id=193740 * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240925 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-04 Michael Catanzaro Unreviewed, avoid -Wswitch warnings introduced in r240880 https://bugs.webkit.org/show_bug.cgi?id=193740 * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): 2019-02-05 Alan Coon Cherry-pick r240880. rdar://problem/47774545 REGRESSION: Flaky ASSERTION FAILED: m_uncommittedState.state == State::Committed on http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html https://bugs.webkit.org/show_bug.cgi?id=193740 Reviewed by Alex Christensen. Source/WebCore: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): (WebCore::DocumentLoader::continueAfterContentPolicy): * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): * loader/FrameLoader.h: * loader/FrameLoaderTypes.h: * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): (WebCore::PolicyChecker::checkNewWindowPolicy): * loader/PolicyChecker.h: Source/WebKit: The issue was happening when the page is triggering a cross-site navigation while in the middle of parsing. This would cause us to start a new provisional load in a new process before the previous process sends the DidFinishLoadForFrame() IPC to the UIProcess. Getting such IPC after a provisional load has started would mess up our state machine and trip assertions. This patch restores non-PSON behavior which is that the previous load in the old process now gets stopped so that no DidFinishLoadForFrame() / DidFailLoadForFrame() gets sent. To achieve this behavior, I introduced a new "StopAllLoads" PolicyAction that we now send the old process when the load is continuing in a new process, instead of sending it "Ignore". * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (toNSURLSessionResponseDisposition): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240880 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-01 Chris Dumez REGRESSION: Flaky ASSERTION FAILED: m_uncommittedState.state == State::Committed on http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html https://bugs.webkit.org/show_bug.cgi?id=193740 Reviewed by Alex Christensen. The issue was happening when the page is triggering a cross-site navigation while in the middle of parsing. This would cause us to start a new provisional load in a new process before the previous process sends the DidFinishLoadForFrame() IPC to the UIProcess. Getting such IPC after a provisional load has started would mess up our state machine and trip assertions. This patch restores non-PSON behavior which is that the previous load in the old process now gets stopped so that no DidFinishLoadForFrame() / DidFailLoadForFrame() gets sent. To achieve this behavior, I introduced a new "StopAllLoads" PolicyAction that we now send the old process when the load is continuing in a new process, instead of sending it "Ignore". * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (toNSURLSessionResponseDisposition): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): 2019-02-05 Alan Coon Cherry-pick r240818. rdar://problem/47774549 Page zoom level is lost after a process swap or a crash https://bugs.webkit.org/show_bug.cgi?id=194105 Reviewed by Alex Christensen. Source/WebKit: Previously, when the client would call setPageAndTextZoomFactors() on the WebPageProxy, we would update the WebPageProxy's corresponding data members and send an IPC to the WebProcess to apply the zoom factors. The issue is that on process crash or process-swap, we never communicate those zoom factors to the new WebProcess. Even if the client were to call setPageAndTextZoomFactors() with the same factors again, it would be a no-op since the WebPageProxy's data members already reflect the expected values. To address the issue, pass both the page zoom and the text zoom factors to the WebProcess via WebPageCreationParameters. This way, there is no need to send an extra IPC and we're sure the WebPageProxy's factors are properly applied to the WebPage on WebContent process side upon creation (whether after a crash or a process swap). * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/WebPage.cpp: Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: (-[PSONNavigationDelegate webView:didCommitNavigation:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240818 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-31 Chris Dumez Page zoom level is lost after a process swap or a crash https://bugs.webkit.org/show_bug.cgi?id=194105 Reviewed by Alex Christensen. Previously, when the client would call setPageAndTextZoomFactors() on the WebPageProxy, we would update the WebPageProxy's corresponding data members and send an IPC to the WebProcess to apply the zoom factors. The issue is that on process crash or process-swap, we never communicate those zoom factors to the new WebProcess. Even if the client were to call setPageAndTextZoomFactors() with the same factors again, it would be a no-op since the WebPageProxy's data members already reflect the expected values. To address the issue, pass both the page zoom and the text zoom factors to the WebProcess via WebPageCreationParameters. This way, there is no need to send an extra IPC and we're sure the WebPageProxy's factors are properly applied to the WebPage on WebContent process side upon creation (whether after a crash or a process swap). * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/WebPage.cpp: 2019-02-05 Alan Coon Cherry-pick r240803. rdar://problem/47774506 Regression(PSON) Crash under WebProcessProxy::canTerminateChildProcess() https://bugs.webkit.org/show_bug.cgi?id=194094 Reviewed by Ryosuke Niwa. If a SuspendedPageProxy gets destroyed while a WebPageProxy is waiting for its to finish to suspend, call the "failure to suspend" completion handler asynchronously instead of synchronouly to make sure the completion handler cannot try and use the suspended page proxy while it is being destroyed. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::~SuspendedPageProxy): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240803 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-31 Chris Dumez Regression(PSON) Crash under WebProcessProxy::canTerminateChildProcess() https://bugs.webkit.org/show_bug.cgi?id=194094 Reviewed by Ryosuke Niwa. If a SuspendedPageProxy gets destroyed while a WebPageProxy is waiting for its to finish to suspend, call the "failure to suspend" completion handler asynchronously instead of synchronouly to make sure the completion handler cannot try and use the suspended page proxy while it is being destroyed. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::~SuspendedPageProxy): 2019-02-05 Alan Coon Cherry-pick r240772. rdar://problem/47774490 iOS: Crash in InteractiveUpdateHandler set by ViewGestureController::beginSwipeGesture https://bugs.webkit.org/show_bug.cgi?id=194083 Reviewed by Tim Horton. We think this crash is a regression from r236966. Prior to r236966, we could only called removeSwipeSnapshot() only when m_provisionalOrSameDocumentLoadCallback was set but now we can call it either when m_snapshotRemovalTracker::start was called, or it had been reset. This can result in m_webPageProxyForBackForwardListForCurrentSwipe getting cleared before InteractiveUpdateHandler is called by UIGestureRecognizer, resulting in the crash. This patch tries to restore the behavior prior to r236966 by only invoking removeSwipeSnapshot() when SnapshotRemovalTracker has a valid removal callback set. Unfortunately no new tests since there is no reproducible test case, and neither API tests nor layout tests seem to have the capability to trigger swipe gestures via UIGestureRecognizer, which is required for this crash to occur. Notably, back-forward swipe tests I enabled in r240765 bypass UIKit and emulates the action instead. * UIProcess/Cocoa/ViewGestureController.cpp: (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState): * UIProcess/Cocoa/ViewGestureController.h: (WebKit::ViewGestureController::SnapshotRemovalTracker::hasRemovalCallback const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240772 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-31 Ryosuke Niwa iOS: Crash in InteractiveUpdateHandler set by ViewGestureController::beginSwipeGesture https://bugs.webkit.org/show_bug.cgi?id=194083 Reviewed by Tim Horton. We think this crash is a regression from r236966. Prior to r236966, we could only called removeSwipeSnapshot() only when m_provisionalOrSameDocumentLoadCallback was set but now we can call it either when m_snapshotRemovalTracker::start was called, or it had been reset. This can result in m_webPageProxyForBackForwardListForCurrentSwipe getting cleared before InteractiveUpdateHandler is called by UIGestureRecognizer, resulting in the crash. This patch tries to restore the behavior prior to r236966 by only invoking removeSwipeSnapshot() when SnapshotRemovalTracker has a valid removal callback set. Unfortunately no new tests since there is no reproducible test case, and neither API tests nor layout tests seem to have the capability to trigger swipe gestures via UIGestureRecognizer, which is required for this crash to occur. Notably, back-forward swipe tests I enabled in r240765 bypass UIKit and emulates the action instead. * UIProcess/Cocoa/ViewGestureController.cpp: (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState): * UIProcess/Cocoa/ViewGestureController.h: (WebKit::ViewGestureController::SnapshotRemovalTracker::hasRemovalCallback const): 2019-02-05 Alan Coon Cherry-pick r240757. rdar://problem/47774493 [iOS] REGRESSION (r238635): Text area fails to re-focus after dismissal of keyboard on support.apple.com https://bugs.webkit.org/show_bug.cgi?id=193987 Reviewed by Tim Horton. It is unnecessary to relinquish first responder status when a user explicitly dismissing the keyboard. Moreover, doing so prevents key commands from being intercepted when a hardware keyboard is subsequently attached. Following r238635 a page becomes focused (accepting of keyboard input) and defocused when the WKContentView becomes first responder and resigns first responder, respectively. When a user explicitly dismisses the keyboard by tapping Done (iPhone) or the hide keyboard button (iPad) then UIKit tells WKContentView to resign its first responder status only to make its superview, WKWebView, first responder. When a person subsequently taps on the page again, the WKContentView requests to become the first responder. However changes to page focus are not guaranteed to be sent to the WebProcess immediately (WebPageProxy::activityStateDidChange() will schedule an update). In particular, they are not guaranteed to be sent before the WebProcess is told about a tap. Therefore, the WebProcess has out-of-date information on focus state of the page. Instead we should detect when WKWebView is being asked to resign as a result of the keyboard dismissal and refuse the request, taking care to end the current editing session, blur the focused element, and dismiss the on-screen keyboard. * Platform/spi/ios/UIKitSPI.h: Expose some SPI. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): Register to receive notifications whenever a user explicitly dismisses the keyboard. (-[WKContentView resignFirstResponderForWebView]): If we are being asked to resign as a result of a user explicitly dismissing the keyboard then refuse to resign. (-[WKContentView _keyboardDidRequestDismissal:]): Update state, if applicable. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240757 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-30 Daniel Bates [iOS] REGRESSION (r238635): Text area fails to re-focus after dismissal of keyboard on support.apple.com https://bugs.webkit.org/show_bug.cgi?id=193987 Reviewed by Tim Horton. It is unnecessary to relinquish first responder status when a user explicitly dismissing the keyboard. Moreover, doing so prevents key commands from being intercepted when a hardware keyboard is subsequently attached. Following r238635 a page becomes focused (accepting of keyboard input) and defocused when the WKContentView becomes first responder and resigns first responder, respectively. When a user explicitly dismisses the keyboard by tapping Done (iPhone) or the hide keyboard button (iPad) then UIKit tells WKContentView to resign its first responder status only to make its superview, WKWebView, first responder. When a person subsequently taps on the page again, the WKContentView requests to become the first responder. However changes to page focus are not guaranteed to be sent to the WebProcess immediately (WebPageProxy::activityStateDidChange() will schedule an update). In particular, they are not guaranteed to be sent before the WebProcess is told about a tap. Therefore, the WebProcess has out-of-date information on focus state of the page. Instead we should detect when WKWebView is being asked to resign as a result of the keyboard dismissal and refuse the request, taking care to end the current editing session, blur the focused element, and dismiss the on-screen keyboard. * Platform/spi/ios/UIKitSPI.h: Expose some SPI. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): Register to receive notifications whenever a user explicitly dismisses the keyboard. (-[WKContentView resignFirstResponderForWebView]): If we are being asked to resign as a result of a user explicitly dismissing the keyboard then refuse to resign. (-[WKContentView _keyboardDidRequestDismissal:]): Update state, if applicable. 2019-02-05 Alan Coon Cherry-pick r240725. rdar://problem/47774554 Regression(PSON) Load hang can occur on history navigation https://bugs.webkit.org/show_bug.cgi?id=194030 Reviewed by Antti Koivisto. Source/WebKit: We do not support having more than one WebPage in a WebProcess with the same page ID. As a result, if we decide to reuse an existing process on process-swap, we need to make sure that we either use its suspended page (when possible, meaning that it is for the right HistoryItem / page) or we need make sure we drop the existing suspended page for this process / pagePID combination, so that the WebPage on WebProcess side gets closed before we attempt to do the new load. We were doing this correctly in 2 places in WebProcessPool::processForNavigationInternal() but failed to do so in a third place, when doing back to a HistoryItem which does not have a SuspendedPage but whose process is still alive (presumably because it is kept alive by another suspended page). This patch fixes this third place to remove any suspended page in the process for the current page before reusing the process. An assertion was also added to the call site in WebPageProxy::receivedNavigationPolicyDecision() to make sure we catch this more easily in the future. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigationInternal): (WebKit::WebProcessPool::removeAllSuspendedPagesForPage): (WebKit::WebProcessPool::hasSuspendedPageFor const): * UIProcess/WebProcessPool.h: Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240725 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-30 Chris Dumez Regression(PSON) Load hang can occur on history navigation https://bugs.webkit.org/show_bug.cgi?id=194030 Reviewed by Antti Koivisto. We do not support having more than one WebPage in a WebProcess with the same page ID. As a result, if we decide to reuse an existing process on process-swap, we need to make sure that we either use its suspended page (when possible, meaning that it is for the right HistoryItem / page) or we need make sure we drop the existing suspended page for this process / pagePID combination, so that the WebPage on WebProcess side gets closed before we attempt to do the new load. We were doing this correctly in 2 places in WebProcessPool::processForNavigationInternal() but failed to do so in a third place, when doing back to a HistoryItem which does not have a SuspendedPage but whose process is still alive (presumably because it is kept alive by another suspended page). This patch fixes this third place to remove any suspended page in the process for the current page before reusing the process. An assertion was also added to the call site in WebPageProxy::receivedNavigationPolicyDecision() to make sure we catch this more easily in the future. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigationInternal): (WebKit::WebProcessPool::removeAllSuspendedPagesForPage): (WebKit::WebProcessPool::hasSuspendedPageFor const): * UIProcess/WebProcessPool.h: 2019-02-05 Alan Coon Cherry-pick r240717. rdar://problem/47774504 Crash in WebKit::RemoteLayerTreePropertyApplier::updateChildren https://bugs.webkit.org/show_bug.cgi?id=193897 Reviewed by Simon Fraser. There has been some null pointer crashes where we fail to find a remote layer tree node that matches the transaction properties. * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm: (WebKit::RemoteLayerTreePropertyApplier::updateChildren): Null check the nodes. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240717 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-30 Antti Koivisto Crash in WebKit::RemoteLayerTreePropertyApplier::updateChildren https://bugs.webkit.org/show_bug.cgi?id=193897 Reviewed by Simon Fraser. There has been some null pointer crashes where we fail to find a remote layer tree node that matches the transaction properties. * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm: (WebKit::RemoteLayerTreePropertyApplier::updateChildren): Null check the nodes. 2019-02-05 Alan Coon Cherry-pick r240702. rdar://problem/47774503 iOS: Nullptr crash in WebPage::getPositionInformation dereferencing an input element for data list https://bugs.webkit.org/show_bug.cgi?id=193996 Reviewed by Wenson Hsieh. Added a missing nullptr check. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getPositionInformation): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240702 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-29 Ryosuke Niwa iOS: Nullptr crash in WebPage::getPositionInformation dereferencing an input element for data list https://bugs.webkit.org/show_bug.cgi?id=193996 Reviewed by Wenson Hsieh. Added a missing nullptr check. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getPositionInformation): 2019-02-05 Alan Coon Cherry-pick r240675. rdar://problem/47776350 Regression (r240046): [PSON] Spurious changes to [WKWebView url] and [WKWebView loading] after [WKWebView loadRequest] https://bugs.webkit.org/show_bug.cgi?id=193967 Reviewed by Alex Christensen. Source/WebKit: Update WebPageProxy::receivedPolicyDecision() to no longer clear the pending URL when we send PolicyAction::Ignore to the old process when the load is continuing in a new process due to PSON. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::receivedPolicyDecision): * UIProcess/WebPageProxy.h: Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: (-[PSONLoadingObserver observeValueForKeyPath:ofObject:change:context:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240675 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-29 Chris Dumez Regression (r240046): [PSON] Spurious changes to [WKWebView url] and [WKWebView loading] after [WKWebView loadRequest] https://bugs.webkit.org/show_bug.cgi?id=193967 Reviewed by Alex Christensen. Update WebPageProxy::receivedPolicyDecision() to no longer clear the pending URL when we send PolicyAction::Ignore to the old process when the load is continuing in a new process due to PSON. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::receivedPolicyDecision): * UIProcess/WebPageProxy.h: 2019-02-05 Alan Coon Cherry-pick r240663. rdar://problem/47774492 REGRESSION (PSON): Flash on link navigation on Mac https://bugs.webkit.org/show_bug.cgi?id=193961 Reviewed by Chris Dumez. The target page sends EnterAcceleratedCompositingMode message too early, before we have a valid layer tree. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attach): Deleted. Not needed anymore. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::reinitializeWebPage): (WebKit::WebPage::didCompletePageTransition): (WebKit::m_shouldAttachDrawingAreaOnPageTransition): Deleted. Move message sending logic fully to TiledCoreAnimationDrawingArea. Unfreezing the layer tree is sufficient to trigger the message. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): There is no need to treat process swap case differently. (WebKit::TiledCoreAnimationDrawingArea::sendEnterAcceleratedCompositingModeIfNeeded): Send this after the first successful layer flush with the root layer set. (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::attach): Deleted. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240663 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-29 Antti Koivisto REGRESSION (PSON): Flash on link navigation on Mac https://bugs.webkit.org/show_bug.cgi?id=193961 Reviewed by Chris Dumez. The target page sends EnterAcceleratedCompositingMode message too early, before we have a valid layer tree. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attach): Deleted. Not needed anymore. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::reinitializeWebPage): (WebKit::WebPage::didCompletePageTransition): (WebKit::m_shouldAttachDrawingAreaOnPageTransition): Deleted. Move message sending logic fully to TiledCoreAnimationDrawingArea. Unfreezing the layer tree is sufficient to trigger the message. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): There is no need to treat process swap case differently. (WebKit::TiledCoreAnimationDrawingArea::sendEnterAcceleratedCompositingModeIfNeeded): Send this after the first successful layer flush with the root layer set. (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::attach): Deleted. 2019-02-05 Alan Coon Cherry-pick r240660. rdar://problem/47774552 REGRESSION (PSON): Twitter link gets stuck at t.co after navigating back in tab https://bugs.webkit.org/show_bug.cgi?id=193932 Reviewed by Brady Eidson. Source/WebKit: When doing a client side redirect from origin A to origin B, we would swap process and create a SuspendedPageProxy and save it on the source BackForwardListItem. The issue is that the BackForwardList is locked for such redirect so we end up updating the current BackForwardListItem with origin B's URL while origin A's suspended page remained on the item. When going to another URL in the same origin A, we would not create a suspended page since no process-swap would occur. When pressing the back button, we would go back to the previous BackForwardListItem and use its SuspendedPageProxy, which is for the wrong URL (The pre-client redirect one). To address the issue, we no longer create a SuspendedPageProxy for cross-site client side redirects. There will be no way no go back to this suspended page anyway since the back/forward list item will be updated with the redirection URL. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::suspendCurrentPageIfPossible): Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240660 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-29 Chris Dumez REGRESSION (PSON): Twitter link gets stuck at t.co after navigating back in tab https://bugs.webkit.org/show_bug.cgi?id=193932 Reviewed by Brady Eidson. When doing a client side redirect from origin A to origin B, we would swap process and create a SuspendedPageProxy and save it on the source BackForwardListItem. The issue is that the BackForwardList is locked for such redirect so we end up updating the current BackForwardListItem with origin B's URL while origin A's suspended page remained on the item. When going to another URL in the same origin A, we would not create a suspended page since no process-swap would occur. When pressing the back button, we would go back to the previous BackForwardListItem and use its SuspendedPageProxy, which is for the wrong URL (The pre-client redirect one). To address the issue, we no longer create a SuspendedPageProxy for cross-site client side redirects. There will be no way no go back to this suspended page anyway since the back/forward list item will be updated with the redirection URL. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::suspendCurrentPageIfPossible): 2019-02-05 Alan Coon Cherry-pick r239895. rdar://problem/47776475 Allow WebContent process access to some drawing-related IOKit properties https://bugs.webkit.org/show_bug.cgi?id=193086 Reviewed by Eric Carlson. Add one missing IOKit property, and revise the regexp used for another. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239895 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-11 Brent Fulgham Allow WebContent process access to some drawing-related IOKit properties https://bugs.webkit.org/show_bug.cgi?id=193086 Reviewed by Eric Carlson. Add one missing IOKit property, and revise the regexp used for another. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-02-05 Alan Coon Cherry-pick r239881. rdar://problem/47776480 [iOS] Precision drop state thrashes when dragging near the top edge of an editable element https://bugs.webkit.org/show_bug.cgi?id=193364 Reviewed by Tim Horton. Source/WebCore: Add a new helper method on DragCaretController to compute the bounds of the editable element around the drop caret position. This is either the enclosing form control (in the case of text fields and text areas), or the highest editable root. See WebKit ChangeLog for more details. Test: DragAndDropTests.AvoidPreciseDropNearTopOfTextArea * editing/FrameSelection.cpp: (WebCore::DragCaretController::editableElementRectInRootViewCoordinates const): * editing/FrameSelection.h: Source/WebKit: On iOS, marking a UIDropProposal as precise offsets the hit-testing location of the drop by a small distance either upwards or downwards from the actual location of the user's finger. When dragging over an editable element, WebKit currently marks the drop proposal as precise; however, when dragging over the top edge of an editable element, what happens is that the hit-testing location is offset to a location outside of the editable element, which causes us to turn off precision drop mode; subsequently, turning off precision drop mode removes the offset, which causes us to hit-test within the editable element once again and re-enable precision mode, and the cycle continues. In order to mitigate this, bail out of precision drop mode when dragging near the top or bottom edges of the highest editable root that contains the current drop caret position (or, if the drop caret is inside of a text form control, use the form control as the editable element instead). * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didPerformDragControllerAction): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::currentDragCaretEditableElementRect const): * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView dropInteraction:sessionDidUpdate:]): Avoid precise mode when we're less than 25pt away from the top and bottom edge of the editable element rect. Since the drag location offset amount is a fixed offset in window coordinates, we first convert this minimum distance to the content view's coordinate space by dividing by the content scale factor. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::performDragControllerAction): Tools: Add a test to verify that dragging near the top of a textarea element does not flag the drop proposal as precise, whereas dragging near the middle of the textarea does. * TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm: (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239881 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-11 Wenson Hsieh [iOS] Precision drop state thrashes when dragging near the top edge of an editable element https://bugs.webkit.org/show_bug.cgi?id=193364 Reviewed by Tim Horton. On iOS, marking a UIDropProposal as precise offsets the hit-testing location of the drop by a small distance either upwards or downwards from the actual location of the user's finger. When dragging over an editable element, WebKit currently marks the drop proposal as precise; however, when dragging over the top edge of an editable element, what happens is that the hit-testing location is offset to a location outside of the editable element, which causes us to turn off precision drop mode; subsequently, turning off precision drop mode removes the offset, which causes us to hit-test within the editable element once again and re-enable precision mode, and the cycle continues. In order to mitigate this, bail out of precision drop mode when dragging near the top or bottom edges of the highest editable root that contains the current drop caret position (or, if the drop caret is inside of a text form control, use the form control as the editable element instead). * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didPerformDragControllerAction): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::currentDragCaretEditableElementRect const): * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView dropInteraction:sessionDidUpdate:]): Avoid precise mode when we're less than 25pt away from the top and bottom edge of the editable element rect. Since the drag location offset amount is a fixed offset in window coordinates, we first convert this minimum distance to the content view's coordinate space by dividing by the content scale factor. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::performDragControllerAction): 2019-02-05 Alan Coon Apply patch. rdar://problem/47774509 fix-194106 2019-01-31 Youenn Fablet Add an API test to cover UIClient checkUserMediaPermissionForOrigin being nullptr https://bugs.webkit.org/show_bug.cgi?id=194106 Make sure handler is not called after being moved. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo): 2019-01-30 Babak Shafiei Cherry-pick r240633. rdar://problem/47682687 [watchOS] Enable Parental Controls content filtering https://bugs.webkit.org/show_bug.cgi?id=193939 Reviewed by Ryosuke Niwa. Source/JavaScriptCore: * Configurations/FeatureDefines.xcconfig: Source/WebCore: * Configurations/FeatureDefines.xcconfig: Source/WebCore/PAL: * Configurations/FeatureDefines.xcconfig: Source/WebKit: * Configurations/FeatureDefines.xcconfig: Source/WebKitLegacy/mac: * Configurations/FeatureDefines.xcconfig: Source/WTF: * wtf/Platform.h: Tools: * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240633 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-28 Andy Estes [watchOS] Enable Parental Controls content filtering https://bugs.webkit.org/show_bug.cgi?id=193939 Reviewed by Ryosuke Niwa. * Configurations/FeatureDefines.xcconfig: 2019-01-30 Babak Shafiei Cherry-pick r240729. rdar://problem/47685553 Ensure image picker sourceType is set before cameraDevice https://bugs.webkit.org/show_bug.cgi?id=193998 Reviewed by Beth Dakin. * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240729 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-29 Conrad Shultz Ensure image picker sourceType is set before cameraDevice https://bugs.webkit.org/show_bug.cgi?id=193998 Reviewed by Beth Dakin. * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]): 2019-01-30 Babak Shafiei Cherry-pick r240578. rdar://problem/47685372 WebUserContentController::removeUserScriptMessageHandlerInternal may deref and delete itself https://bugs.webkit.org/show_bug.cgi?id=193901 Reviewed by David Kilzer. Don't know how to repro. * WebProcess/UserContent/WebUserContentController.cpp: (WebKit::WebUserContentController::removeUserScriptMessageHandlerInternal): Calling userMessageHandlers.removeFirstMatching() may remove the last ref to this (because WebUserMessageHandlerDescriptorProxy refs WebUserContentController). Fix by protecting this over the function. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240578 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-28 Antti Koivisto WebUserContentController::removeUserScriptMessageHandlerInternal may deref and delete itself https://bugs.webkit.org/show_bug.cgi?id=193901 Reviewed by David Kilzer. Don't know how to repro. * WebProcess/UserContent/WebUserContentController.cpp: (WebKit::WebUserContentController::removeUserScriptMessageHandlerInternal): Calling userMessageHandlers.removeFirstMatching() may remove the last ref to this (because WebUserMessageHandlerDescriptorProxy refs WebUserContentController). Fix by protecting this over the function. 2019-01-30 Alan Coon Cherry-pick r240733. rdar://problem/47683434 [macOS] Sandbox fails to compile on 10.12 https://bugs.webkit.org/show_bug.cgi?id=194035 Reviewed by Brent Fulgham. This was caused by the commit , which is only valid for 10.14 and later. * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: * WebProcess/com.apple.WebProcess.sb.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240733 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-30 Per Arne Vollan [macOS] Sandbox fails to compile on 10.12 https://bugs.webkit.org/show_bug.cgi?id=194035 Reviewed by Brent Fulgham. This was caused by the commit , which is only valid for 10.14 and later. * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2019-01-29 Alan Coon Cherry-pick r240659. rdar://problem/47639406 Regression(r240046) VoiceOver is no longer working after a process swap https://bugs.webkit.org/show_bug.cgi?id=193953 Reviewed by Alex Christensen. ProvisionalPageProxy used to forward the RegisterWebProcessAccessibilityToken IPC from the provisional WebProcess to the WebPageProxy right away. This in turn would notify the PageClient whose logic would rely on WebPageProxy::process(), which returns the committed process instead of the provisional one. To address the issue, the ProvisionalPageProxy now stores the token sent by the provisional WebProcess and we only call registerWebProcessAccessibilityToken() on the WebPageProxy *after* we've swapped to the provisional process. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::registerWebProcessAccessibilityToken): (WebKit::ProvisionalPageProxy::didReceiveMessage): * UIProcess/ProvisionalPageProxy.h: (WebKit::ProvisionalPageProxy::takeAccessibilityToken): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::commitProvisionalPage): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240659 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-29 Chris Dumez Regression(r240046) VoiceOver is no longer working after a process swap https://bugs.webkit.org/show_bug.cgi?id=193953 Reviewed by Alex Christensen. ProvisionalPageProxy used to forward the RegisterWebProcessAccessibilityToken IPC from the provisional WebProcess to the WebPageProxy right away. This in turn would notify the PageClient whose logic would rely on WebPageProxy::process(), which returns the committed process instead of the provisional one. To address the issue, the ProvisionalPageProxy now stores the token sent by the provisional WebProcess and we only call registerWebProcessAccessibilityToken() on the WebPageProxy *after* we've swapped to the provisional process. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::registerWebProcessAccessibilityToken): (WebKit::ProvisionalPageProxy::didReceiveMessage): * UIProcess/ProvisionalPageProxy.h: (WebKit::ProvisionalPageProxy::takeAccessibilityToken): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::commitProvisionalPage): 2019-01-28 Alan Coon Cherry-pick r240599. rdar://problem/47609799 Regression(PSON) Crash under WebPageProxy::didStartProgress() https://bugs.webkit.org/show_bug.cgi?id=193915 Reviewed by Alex Christensen. Source/WebKit: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::close): Make sure we destroy the ProvisionalPageProxy if the page gets closed as we do not want to keep receiving IPC after this or even worse, commit the provisional page. (WebKit::WebPageProxy::didStartProgress): Add an assertion in didStartProgress() to make sure we do not receive this IPC after the page has been closed. Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240599 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-28 Chris Dumez Regression(PSON) Crash under WebPageProxy::didStartProgress() https://bugs.webkit.org/show_bug.cgi?id=193915 Reviewed by Alex Christensen. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::close): Make sure we destroy the ProvisionalPageProxy if the page gets closed as we do not want to keep receiving IPC after this or even worse, commit the provisional page. (WebKit::WebPageProxy::didStartProgress): Add an assertion in didStartProgress() to make sure we do not receive this IPC after the page has been closed. 2019-01-28 Babak Shafiei Cherry-pick r240516. rdar://problem/47586889 Add SPI to inform an application that "Go Back" has been clicked from a safe browsing warning https://bugs.webkit.org/show_bug.cgi?id=193802 Reviewed by Andy Estes. Source/WebKit: * UIProcess/API/APIUIClient.h: (API::UIClient::didClickGoBackFromSafeBrowsingWarning): * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::UIDelegate::UIClient::didClickGoBackFromSafeBrowsingWarning): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): Tools: * TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm: (-[SafeBrowsingNavigationDelegate _webViewDidClickGoBackFromSafeBrowsingWarning:]): (TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240516 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-25 Alex Christensen Add SPI to inform an application that "Go Back" has been clicked from a safe browsing warning https://bugs.webkit.org/show_bug.cgi?id=193802 Reviewed by Andy Estes. * UIProcess/API/APIUIClient.h: (API::UIClient::didClickGoBackFromSafeBrowsingWarning): * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::UIDelegate::UIClient::didClickGoBackFromSafeBrowsingWarning): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): 2019-01-28 Babak Shafiei Cherry-pick r240533. rdar://problem/47586823 REGRESSION: Some USDz from 3rd party websites don't go directly to AR QL https://bugs.webkit.org/show_bug.cgi?id=193831 Reviewed by Chris Dumez. Source/WebKit: A System Preview () displays in a modal and doesn't trigger a navigation. If the link was cross origin, it was causing a process swap, which meant that the response defaulted back to a navigation. The fix is to not cause a PSON when the navigation is a system preview. * UIProcess/API/APINavigation.h: (API::Navigation::shouldForceDownload const): This is now just tracking the "download" attribute, and not including System Preview. (API::Navigation::isSystemPreview const): New method to check for a navigation triggered as a System Preview. * UIProcess/WebPageProxy.cpp: Move the code from receivedPolicyDecision to receivedNavigationPolicyDecision, so that downloads and System Previews are detected before we decide to change process. (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::receivedPolicyDecision): Tools: Two new tests that exercise cross-origin and same-origin System Previews. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240533 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-25 Dean Jackson REGRESSION: Some USDz from 3rd party websites don't go directly to AR QL https://bugs.webkit.org/show_bug.cgi?id=193831 Reviewed by Chris Dumez. A System Preview () displays in a modal and doesn't trigger a navigation. If the link was cross origin, it was causing a process swap, which meant that the response defaulted back to a navigation. The fix is to not cause a PSON when the navigation is a system preview. * UIProcess/API/APINavigation.h: (API::Navigation::shouldForceDownload const): This is now just tracking the "download" attribute, and not including System Preview. (API::Navigation::isSystemPreview const): New method to check for a navigation triggered as a System Preview. * UIProcess/WebPageProxy.cpp: Move the code from receivedPolicyDecision to receivedNavigationPolicyDecision, so that downloads and System Previews are detected before we decide to change process. (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::receivedPolicyDecision): 2019-01-28 Babak Shafiei Cherry-pick r240484. rdar://problem/47591281 Drop WebKit::WebKitPolicyAction type as it is no longer needed https://bugs.webkit.org/show_bug.cgi?id=193827 Reviewed by Antti Koivisto. Drop WebKit::WebKitPolicyAction type as it is no longer needed. It is now identical to WebCore::PolicyAction. * Shared/WebPolicyAction.h: Removed. * UIProcess/WebFramePolicyListenerProxy.cpp: (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults): (WebKit::WebFramePolicyListenerProxy::use): (WebKit::WebFramePolicyListenerProxy::download): (WebKit::WebFramePolicyListenerProxy::ignore): * UIProcess/WebFramePolicyListenerProxy.h: * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::setUpPolicyListenerProxy): * UIProcess/WebFrameProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::receivedPolicyDecision): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNavigationActionSync): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponseShared): * UIProcess/WebPageProxy.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::didReceivePolicyDecision): (WebKit::toPolicyAction): Deleted. * WebProcess/WebPage/WebFrame.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didReceivePolicyDecision): * WebProcess/WebPage/WebPage.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240484 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-25 Chris Dumez Drop WebKit::WebKitPolicyAction type as it is no longer needed https://bugs.webkit.org/show_bug.cgi?id=193827 Reviewed by Antti Koivisto. Drop WebKit::WebKitPolicyAction type as it is no longer needed. It is now identical to WebCore::PolicyAction. * Shared/WebPolicyAction.h: Removed. * UIProcess/WebFramePolicyListenerProxy.cpp: (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults): (WebKit::WebFramePolicyListenerProxy::use): (WebKit::WebFramePolicyListenerProxy::download): (WebKit::WebFramePolicyListenerProxy::ignore): * UIProcess/WebFramePolicyListenerProxy.h: * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::setUpPolicyListenerProxy): * UIProcess/WebFrameProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::receivedPolicyDecision): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNavigationActionSync): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponseShared): * UIProcess/WebPageProxy.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::didReceivePolicyDecision): (WebKit::toPolicyAction): Deleted. * WebProcess/WebPage/WebFrame.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didReceivePolicyDecision): * WebProcess/WebPage/WebPage.h: 2019-01-28 Babak Shafiei Cherry-pick r240542. rdar://problem/47586850 REGRESSION (r238818): Snapshot is removed too late after swiping back on Twitter https://bugs.webkit.org/show_bug.cgi?id=193860 Reviewed by Antti Koivisto. * UIProcess/Cocoa/ViewGestureController.cpp: (WebKit::ViewGestureController::didStartProvisionalOrSameDocumentLoadForMainFrame): (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame): (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame): * UIProcess/Cocoa/ViewGestureController.h: Treat provisional load and same document load the same: they already both unpause the snapshot removal tracker, request render tree size notifications, but same-document navigation was missing the call to dispatchAfterEnsuringDrawing and thus would get stuck waiting for RepaintAfterNavigation. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240542 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-25 Tim Horton REGRESSION (r238818): Snapshot is removed too late after swiping back on Twitter https://bugs.webkit.org/show_bug.cgi?id=193860 Reviewed by Antti Koivisto. * UIProcess/Cocoa/ViewGestureController.cpp: (WebKit::ViewGestureController::didStartProvisionalOrSameDocumentLoadForMainFrame): (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame): (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame): * UIProcess/Cocoa/ViewGestureController.h: Treat provisional load and same document load the same: they already both unpause the snapshot removal tracker, request render tree size notifications, but same-document navigation was missing the call to dispatchAfterEnsuringDrawing and thus would get stuck waiting for RepaintAfterNavigation. 2019-01-28 Babak Shafiei Cherry-pick r240497. rdar://problem/47586863 iOS: inputmode="none" disables hardware keyboard's globe key https://bugs.webkit.org/show_bug.cgi?id=193811 Reviewed by Wenson Hsieh. Source/WebKit: Removed the support for inputmode="none" for now since we need a new SPI from UIKit to properly implement this feature some time in the future. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _zoomToRevealFocusedElement]): (-[WKContentView inputView]): (-[WKContentView requiresAccessoryView]): (-[WKContentView textInputTraits]): LayoutTests: Updated and renamed the test expecting the keyboard to update upon inputmode content attribute changed to use inputmode="decimal" instead of inputmode="none", and updated another test to expect inputmode="none" has no effect instead of hiding the keyboard. * fast/forms/ios/inputmode-change-update-keyboard-expected.txt: Renamed from inputmode-none-removed-expected.txt. * fast/forms/ios/inputmode-change-update-keyboard.html: Renamed from inputmode-none-removed.html. * fast/forms/ios/inputmode-none-expected.txt: * fast/forms/ios/inputmode-none.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240497 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-25 Ryosuke Niwa iOS: inputmode="none" disables hardware keyboard's globe key https://bugs.webkit.org/show_bug.cgi?id=193811 Reviewed by Wenson Hsieh. Removed the support for inputmode="none" for now since we need a new SPI from UIKit to properly implement this feature some time in the future. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _zoomToRevealFocusedElement]): (-[WKContentView inputView]): (-[WKContentView requiresAccessoryView]): (-[WKContentView textInputTraits]): 2019-01-28 Babak Shafiei Cherry-pick r240493. rdar://problem/47586905 REGRESSION (PSON): After swipe back, first few attempts to swipe forward not recognized as swipe gestures https://bugs.webkit.org/show_bug.cgi?id=193818 Reviewed by Tim Horton. We don't hit the RenderTreeSizeThreshold milestone to remove the snapshot and allow interaction because we request it from a wrong process (the one we are leaving behind). * UIProcess/Cocoa/ViewGestureController.cpp: (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame): Request the RenderTreeSizeThreshold notification when the load has started and we know the process to use. (WebKit::ViewGestureController::SnapshotRemovalTracker::hasOutstandingEvent): * UIProcess/Cocoa/ViewGestureController.h: (WebKit::ViewGestureController::SnapshotRemovalTracker::renderTreeSizeThreshold const): (WebKit::ViewGestureController::SnapshotRemovalTracker::setRenderTreeSizeThreshold): * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::endSwipeGesture): Don't request immediately, save the threshold to SnapshotRemovalTracker. (WebKit::ViewGestureController::requestRenderTreeSizeNotificationIfNeeded): Do the request to the right process. * WebProcess/WebPage/ViewGestureGeometryCollector.cpp: (WebKit::ViewGestureGeometryCollector::setRenderTreeSizeNotificationThreshold): Ensure we send the notification even if we reached the threshold before it was requested. (WebKit::ViewGestureGeometryCollector::sendDidHitRenderTreeSizeThresholdIfNeeded): (WebKit::ViewGestureGeometryCollector::mainFrameDidLayout): * WebProcess/WebPage/ViewGestureGeometryCollector.h: (WebKit::ViewGestureGeometryCollector::setRenderTreeSizeNotificationThreshold): Deleted. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240493 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-25 Antti Koivisto REGRESSION (PSON): After swipe back, first few attempts to swipe forward not recognized as swipe gestures https://bugs.webkit.org/show_bug.cgi?id=193818 Reviewed by Tim Horton. We don't hit the RenderTreeSizeThreshold milestone to remove the snapshot and allow interaction because we request it from a wrong process (the one we are leaving behind). * UIProcess/Cocoa/ViewGestureController.cpp: (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame): Request the RenderTreeSizeThreshold notification when the load has started and we know the process to use. (WebKit::ViewGestureController::SnapshotRemovalTracker::hasOutstandingEvent): * UIProcess/Cocoa/ViewGestureController.h: (WebKit::ViewGestureController::SnapshotRemovalTracker::renderTreeSizeThreshold const): (WebKit::ViewGestureController::SnapshotRemovalTracker::setRenderTreeSizeThreshold): * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::endSwipeGesture): Don't request immediately, save the threshold to SnapshotRemovalTracker. (WebKit::ViewGestureController::requestRenderTreeSizeNotificationIfNeeded): Do the request to the right process. * WebProcess/WebPage/ViewGestureGeometryCollector.cpp: (WebKit::ViewGestureGeometryCollector::setRenderTreeSizeNotificationThreshold): Ensure we send the notification even if we reached the threshold before it was requested. (WebKit::ViewGestureGeometryCollector::sendDidHitRenderTreeSizeThresholdIfNeeded): (WebKit::ViewGestureGeometryCollector::mainFrameDidLayout): * WebProcess/WebPage/ViewGestureGeometryCollector.h: (WebKit::ViewGestureGeometryCollector::setRenderTreeSizeNotificationThreshold): Deleted. 2019-01-28 Babak Shafiei Cherry-pick r240490. rdar://problem/47586864 WKWebView.goBack should reload if there is a safe browsing warning https://bugs.webkit.org/show_bug.cgi?id=193805 Reviewed by Geoff Garen. Source/WebKit: If a WKWebView is showing a safe browsing warning and the user clicks a back button in the app which calls WKWebView.goBack, the WKWebView is in a state where it has not navigated yet, so actually going back will appear to the user to go back twice. We can't just do nothing because the app is in a state where it is expecting a navigation to happen. Reloading achieves what the user expects and makes the app work like the app expects. * UIProcess/API/C/WKPage.cpp: (WKPageGoBack): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView goBack]): * UIProcess/PageClient.h: (WebKit::PageClient::hasSafeBrowsingWarning const): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::hasSafeBrowsingWarning const): Tools: * TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm: (+[Simple3LookupContext sharedLookupContext]): (-[Simple3LookupContext lookUpURL:completionHandler:]): (-[WKWebViewGoBackNavigationDelegate webView:didFinishNavigation:]): (TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240490 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-25 Alex Christensen WKWebView.goBack should reload if there is a safe browsing warning https://bugs.webkit.org/show_bug.cgi?id=193805 Reviewed by Geoff Garen. If a WKWebView is showing a safe browsing warning and the user clicks a back button in the app which calls WKWebView.goBack, the WKWebView is in a state where it has not navigated yet, so actually going back will appear to the user to go back twice. We can't just do nothing because the app is in a state where it is expecting a navigation to happen. Reloading achieves what the user expects and makes the app work like the app expects. * UIProcess/API/C/WKPage.cpp: (WKPageGoBack): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView goBack]): * UIProcess/PageClient.h: (WebKit::PageClient::hasSafeBrowsingWarning const): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::hasSafeBrowsingWarning const): 2019-01-28 Babak Shafiei Cherry-pick r240485. rdar://problem/47586895 Regression(PSON) cross-site provisional page is not canceled if a new same-site one is started https://bugs.webkit.org/show_bug.cgi?id=193788 Reviewed by Alex Christensen. Source/WebKit: When the page starts a new provisional load, make sure we cancel any pending one in the provisional process, as it would have happened in the first provisional load happened in the same process. Without this, we could have 2 parallel loads happening, one in the committed process and another in the provisional one, leading to assertion failures in debug. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: (-[PSONNavigationDelegate webView:didStartProvisionalNavigation:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240485 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-25 Chris Dumez Regression(PSON) cross-site provisional page is not canceled if a new same-site one is started https://bugs.webkit.org/show_bug.cgi?id=193788 Reviewed by Alex Christensen. When the page starts a new provisional load, make sure we cancel any pending one in the provisional process, as it would have happened in the first provisional load happened in the same process. Without this, we could have 2 parallel loads happening, one in the committed process and another in the provisional one, leading to assertion failures in debug. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): 2019-01-28 Babak Shafiei Cherry-pick r240477. rdar://problem/47586845 Regression(PSON?) Crash under NavigationState::NavigationClient::decidePolicyForNavigationAction() https://bugs.webkit.org/show_bug.cgi?id=193779 Reviewed by Antti Koivisto. Source/WebKit: * UIProcess/Cocoa/NavigationState.mm: (WebKit::tryAppLink): (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): We were crashing when trying to get the URL of the main frame, which was sad because we never ended up using the main frame URL. Therefore, this patch drops the code in question. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync): Add assertion to make sure that the DecidePolicyForNavigationActionAsync IPC it is getting from the process is related to its main frame. Tools: Add API test that quickly navigates forward to a previous process without waiting for it to suspend. I suspect the crash could have been happening due to receiving leftover IPC from the process' previous page when reconnecting the it for the forward navigation. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240477 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-25 Chris Dumez Regression(PSON?) Crash under NavigationState::NavigationClient::decidePolicyForNavigationAction() https://bugs.webkit.org/show_bug.cgi?id=193779 Reviewed by Antti Koivisto. * UIProcess/Cocoa/NavigationState.mm: (WebKit::tryAppLink): (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): We were crashing when trying to get the URL of the main frame, which was sad because we never ended up using the main frame URL. Therefore, this patch drops the code in question. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync): Add assertion to make sure that the DecidePolicyForNavigationActionAsync IPC it is getting from the process is related to its main frame. 2019-01-28 Babak Shafiei Cherry-pick r240443. rdar://problem/47586900 [PSON] Flash on back navigation on Mac https://bugs.webkit.org/show_bug.cgi?id=193716 Reviewed by Chris Dumez. Source/WebKit: We close the page immediately if we fail to suspend. Layers disappear and we get a flash. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::~SuspendedPageProxy): (WebKit::SuspendedPageProxy::close): Track closed state so we don't send the message twice, causing unhandled message errors in web process. (WebKit::SuspendedPageProxy::didProcessRequestToSuspend): Close the suspended page if the suspension fails. Skip this if we are using web process side compositing on Mac. * UIProcess/SuspendedPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::enterAcceleratedCompositingMode): On Mac, close the failed SuspendedPageProxy when entering compositing mode. At this point we don't need it to keep layers alive. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::closeFailedSuspendedPagesForPage): * UIProcess/WebProcessPool.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::suspendForProcessSwap): Don't close the page on suspension failure. This is now managed by the UI process. Tools: * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: Closing of the previous page is delayed so waiting for didFinishNavigation is not sufficient to guarantee we have received all the messages. Wait for them. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240443 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-24 Antti Koivisto [PSON] Flash on back navigation on Mac https://bugs.webkit.org/show_bug.cgi?id=193716 Reviewed by Chris Dumez. We close the page immediately if we fail to suspend. Layers disappear and we get a flash. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::~SuspendedPageProxy): (WebKit::SuspendedPageProxy::close): Track closed state so we don't send the message twice, causing unhandled message errors in web process. (WebKit::SuspendedPageProxy::didProcessRequestToSuspend): Close the suspended page if the suspension fails. Skip this if we are using web process side compositing on Mac. * UIProcess/SuspendedPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::enterAcceleratedCompositingMode): On Mac, close the failed SuspendedPageProxy when entering compositing mode. At this point we don't need it to keep layers alive. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::closeFailedSuspendedPagesForPage): * UIProcess/WebProcessPool.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::suspendForProcessSwap): Don't close the page on suspension failure. This is now managed by the UI process. 2019-01-28 Babak Shafiei Cherry-pick r240442. rdar://problem/47586826 Regression(PSON) Back/Forward list items' URL sometimes gets replaced with the URL of a subframe https://bugs.webkit.org/show_bug.cgi?id=193761 Reviewed by Alex Christensen. Source/WebKit: When doing a history navigation cross-process, the UIProcess would first send the back/forward list items to the destination WebProcess via WebPage::updateBackForwardListForReattach(), then ask the process to navigate to the expected back/forward list item. WebPage::updateBackForwardListForReattach() would call restoreSessionInternal(), which would call toHistoryItem() on each BackForwardListItem. This may end up creating more than one HistoryItem for each BackForwardListItem because HistoryItems are part of a tree (each frame has its own list of history items). Note that BackForwardListItems and HistoryItem share a BackForwardItemIdentifier which is a (processIdentifier, itemIdentifier) pair. We normally generate the HistoryItem's identifier from inside its constructor like so: `{ Process::identifier(), generateObjectIdentifier() }` However, when calling updateBackForwardListForReattach() and constructing children HistoryItem, applyFrameState() would generate the identifier by itself and passing it to the HistoryItem constructor. Its genegates the ID the exact same way so this would in theory not be a problem. Unfortunately, both calls to generateObjectIdentifier() get inlined and both call sites end up with their own static counter to generate ids. As a result, we may end up with conflicts as HistoryItems for child frames (restored by restoreSessionInternal()) can end up with the same identifier as HistoryItems for top frames. This confusion would lead to the WebContent process sending the UIProcess bad information and the URL of subframes could end up as the WebBackForwardListItem's mainframe URL. * WebProcess/WebCoreSupport/SessionStateConversion.cpp: (WebKit::applyFrameState): Stop calling generateObjectIdentifier() explicitly and let the HistoryItem constructor take care of it. Calling generateObjectIdentifier() for the same type from different places is not safe due to inlining. Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240442 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-24 Chris Dumez Regression(PSON) Back/Forward list items' URL sometimes gets replaced with the URL of a subframe https://bugs.webkit.org/show_bug.cgi?id=193761 Reviewed by Alex Christensen. When doing a history navigation cross-process, the UIProcess would first send the back/forward list items to the destination WebProcess via WebPage::updateBackForwardListForReattach(), then ask the process to navigate to the expected back/forward list item. WebPage::updateBackForwardListForReattach() would call restoreSessionInternal(), which would call toHistoryItem() on each BackForwardListItem. This may end up creating more than one HistoryItem for each BackForwardListItem because HistoryItems are part of a tree (each frame has its own list of history items). Note that BackForwardListItems and HistoryItem share a BackForwardItemIdentifier which is a (processIdentifier, itemIdentifier) pair. We normally generate the HistoryItem's identifier from inside its constructor like so: `{ Process::identifier(), generateObjectIdentifier() }` However, when calling updateBackForwardListForReattach() and constructing children HistoryItem, applyFrameState() would generate the identifier by itself and passing it to the HistoryItem constructor. Its genegates the ID the exact same way so this would in theory not be a problem. Unfortunately, both calls to generateObjectIdentifier() get inlined and both call sites end up with their own static counter to generate ids. As a result, we may end up with conflicts as HistoryItems for child frames (restored by restoreSessionInternal()) can end up with the same identifier as HistoryItems for top frames. This confusion would lead to the WebContent process sending the UIProcess bad information and the URL of subframes could end up as the WebBackForwardListItem's mainframe URL. * WebProcess/WebCoreSupport/SessionStateConversion.cpp: (WebKit::applyFrameState): Stop calling generateObjectIdentifier() explicitly and let the HistoryItem constructor take care of it. Calling generateObjectIdentifier() for the same type from different places is not safe due to inlining. 2019-01-24 Alan Coon Cherry-pick r240461. rdar://problem/47536283 [iOS] Silence MediaPlayer compile warnings https://bugs.webkit.org/show_bug.cgi?id=193780 Reviewed by Jer Noble. Source/WebCore/PAL: * pal/spi/ios/MediaPlayerSPI.h: Source/WebKit: * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240461 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-24 Eric Carlson [iOS] Silence MediaPlayer compile warnings https://bugs.webkit.org/show_bug.cgi?id=193780 Reviewed by Jer Noble. * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: 2019-01-23 Alan Coon Cherry-pick r240325. rdar://problem/47494727 Regression(r240178) Some API tests are crashing https://bugs.webkit.org/show_bug.cgi?id=193680 Reviewed by Alex Christensen. r240178 made sure that userScripts / scriptMessageHandlers / contentExtensions are always properly populated in the WebPageCreationParameters. This was needed in case we need to reconstruct the WebUserContentController on the WebProcess side. However, this caused a regression in the case we reuse a process where the WebUserContentController still exists (because it was kept alive, e.g. by the WebPageGroup). In that case, we would add duplicate entries to the existing WebUserContentController instance because its "add" methods did not have duplicate checks. To address the issue, this patch adds duplicate checks to the WebUserContentController "add" methods. * WebProcess/UserContent/WebUserContentController.cpp: (WebKit::WebUserContentController::addUserScriptMessageHandlerInternal): (WebKit::WebUserContentController::removeUserScriptMessageHandlerInternal): (WebKit::WebUserContentController::addUserScriptInternal): (WebKit::WebUserContentController::removeUserScriptInternal): (WebKit::WebUserContentController::addUserStyleSheetInternal): (WebKit::WebUserContentController::removeUserStyleSheetInternal): (WebKit::WebUserContentController::forEachUserMessageHandler const): * WebProcess/UserContent/WebUserContentController.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240325 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-22 Chris Dumez Regression(r240178) Some API tests are crashing https://bugs.webkit.org/show_bug.cgi?id=193680 Reviewed by Alex Christensen. r240178 made sure that userScripts / scriptMessageHandlers / contentExtensions are always properly populated in the WebPageCreationParameters. This was needed in case we need to reconstruct the WebUserContentController on the WebProcess side. However, this caused a regression in the case we reuse a process where the WebUserContentController still exists (because it was kept alive, e.g. by the WebPageGroup). In that case, we would add duplicate entries to the existing WebUserContentController instance because its "add" methods did not have duplicate checks. To address the issue, this patch adds duplicate checks to the WebUserContentController "add" methods. * WebProcess/UserContent/WebUserContentController.cpp: (WebKit::WebUserContentController::addUserScriptMessageHandlerInternal): (WebKit::WebUserContentController::removeUserScriptMessageHandlerInternal): (WebKit::WebUserContentController::addUserScriptInternal): (WebKit::WebUserContentController::removeUserScriptInternal): (WebKit::WebUserContentController::addUserStyleSheetInternal): (WebKit::WebUserContentController::removeUserStyleSheetInternal): (WebKit::WebUserContentController::forEachUserMessageHandler const): * WebProcess/UserContent/WebUserContentController.h: 2019-01-23 Alan Coon Cherry-pick r240298. rdar://problem/47494772 [iOS] Flash when swiping back to Google search result page https://bugs.webkit.org/show_bug.cgi?id=193668 Reviewed by Simon Fraser. If the google page is scrolled, there is sometimes a short flash. When restoring the page state we also restore exposedContentRect which is used to determine which part of the page to create layers for. Scroll position is restored by the UI process later so we rely on this to get the right layers for the initial view update. A viewport configuration update may sometimes trample over the restored exposedContentRect, moving it to top left. In this case the initial layer tree unfreeze commit may not have layers to cover the actual visible view position. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::restorePageState): Set a bit to indicate we have already restored the exposedContentRect. (WebKit::WebPage::viewportConfigurationChanged): Only reset exposedContentRect if wasn't already set by restorePageState. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240298 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-22 Antti Koivisto [iOS] Flash when swiping back to Google search result page https://bugs.webkit.org/show_bug.cgi?id=193668 Reviewed by Simon Fraser. If the google page is scrolled, there is sometimes a short flash. When restoring the page state we also restore exposedContentRect which is used to determine which part of the page to create layers for. Scroll position is restored by the UI process later so we rely on this to get the right layers for the initial view update. A viewport configuration update may sometimes trample over the restored exposedContentRect, moving it to top left. In this case the initial layer tree unfreeze commit may not have layers to cover the actual visible view position. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::restorePageState): Set a bit to indicate we have already restored the exposedContentRect. (WebKit::WebPage::viewportConfigurationChanged): Only reset exposedContentRect if wasn't already set by restorePageState. 2019-01-23 Alan Coon Cherry-pick r240178. rdar://problem/47494727 Regression(PSON) Content blockers are sometimes lost on back navigation cross-site https://bugs.webkit.org/show_bug.cgi?id=193588 Reviewed by Alex Christensen. Source/WebKit: When the WebPageProxy needs to create initialization parameters for its WebPage in the WebContent process, it calls WebProcessProxy::addWebUserContentControllerProxy() which calls WebUserContentControllerProxy::addProcess(). This last call is supposed to register the WebProcessProxy with the WebUserContentControllerProxy and adding the contentRuleLists to the WebPageCreationParameters. The issue is that if the WebUserContentControllerProxy already knows about this WebProcessProxy, it would return early and not populate the WebPageCreationParameters. In PSON world, when navigating back to a page that failed to enter page cache, we reuse the process where we previously loaded the page but re-create a new WebPage on the WebContent process site. When this happens, WebUserContentControllerProxy would not add the contentRuleLists to the WebPageCreationParameters and the new WebPage in the previously-suspended process would be missing them. * UIProcess/UserContent/WebUserContentControllerProxy.cpp: (WebKit::WebUserContentControllerProxy::addProcess): Tools: Add layout test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240178 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-18 Chris Dumez Regression(PSON) Content blockers are sometimes lost on back navigation cross-site https://bugs.webkit.org/show_bug.cgi?id=193588 Reviewed by Alex Christensen. When the WebPageProxy needs to create initialization parameters for its WebPage in the WebContent process, it calls WebProcessProxy::addWebUserContentControllerProxy() which calls WebUserContentControllerProxy::addProcess(). This last call is supposed to register the WebProcessProxy with the WebUserContentControllerProxy and adding the contentRuleLists to the WebPageCreationParameters. The issue is that if the WebUserContentControllerProxy already knows about this WebProcessProxy, it would return early and not populate the WebPageCreationParameters. In PSON world, when navigating back to a page that failed to enter page cache, we reuse the process where we previously loaded the page but re-create a new WebPage on the WebContent process site. When this happens, WebUserContentControllerProxy would not add the contentRuleLists to the WebPageCreationParameters and the new WebPage in the previously-suspended process would be missing them. * UIProcess/UserContent/WebUserContentControllerProxy.cpp: (WebKit::WebUserContentControllerProxy::addProcess): 2019-01-23 Alan Coon Cherry-pick r239994. rdar://problem/47295338 Add allow directive for MTLCompilerService.xpc to PluginProcess and WebContent https://bugs.webkit.org/show_bug.cgi?id=193453 Reviewed by Brent Fulgham. * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239994 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-15 Per Arne Vollan Add allow directive for MTLCompilerService.xpc to PluginProcess and WebContent https://bugs.webkit.org/show_bug.cgi?id=193453 Reviewed by Brent Fulgham. * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2019-01-23 Alan Coon Cherry-pick r239947. rdar://problem/47295371 Re-enable ability to build --cloop builds. https://bugs.webkit.org/show_bug.cgi?id=192955 Source/JavaScriptCore: Reviewed by Saam barati and Keith Miller. * Configurations/FeatureDefines.xcconfig: Source/WebCore: Reviewed by Saam barati and Keith Miller. * Configurations/FeatureDefines.xcconfig: Source/WebCore/PAL: Reviewed by Saam barati and Keith Miller. * Configurations/FeatureDefines.xcconfig: Source/WebKit: Reviewed by Saam barati and Keith Miller. * Configurations/FeatureDefines.xcconfig: Source/WebKitLegacy/mac: Reviewed by Saam barati and Keith Miller. * Configurations/FeatureDefines.xcconfig: Tools: Reviewed by Saam barati and Keith Miller. The --cloop build option was being ignored this whole time since r236381. This patch makes it possible to build CLoop builds again. * Scripts/build-jsc: * Scripts/webkitperl/FeatureList.pm: * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239947 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-14 Mark Lam Re-enable ability to build --cloop builds. https://bugs.webkit.org/show_bug.cgi?id=192955 Reviewed by Saam barati and Keith Miller. * Configurations/FeatureDefines.xcconfig: 2019-01-23 Alan Coon Revert r239619. rdar://problem/47465051 2019-01-23 Kocsen Chung Cherry-pick r240010. rdar://problem/47457965 Cannot tab out of WKWebView on macOS https://bugs.webkit.org/show_bug.cgi?id=161448 Reviewed by Dean Jackson. Source/WebCore/PAL: * pal/spi/mac/NSViewSPI.h: * pal/spi/mac/NSWindowSPI.h: Move some SPI declarations in here from WebKitLegacy. Source/WebKit: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::takeFocus): If the UIDelegate doesn't implement takeFocus, provide a simple default implementation that just uses AppKit's key view loop to move the focus. * UIProcess/API/APIUIClient.h: (API::UIClient::takeFocus): * UIProcess/API/C/WKPage.cpp: (WKPageSetPageUIClient): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::takeFocus): Make API::UIClient's takeFocus return a bool indicating whether the client implements it or not. * UIProcess/PageClient.h: * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::takeFocus): Plumb takeFocus to WebViewImpl. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::takeFocus): Borrow the relevant portion of WebKitLegacy's implementation of takeFocus, shifting focus to the next/previous key view in the window. Source/WebKitLegacy/mac: * WebCoreSupport/WebChromeClient.mm: * WebView/WebView.mm: Make use of SPI headers. Tools: Add a test that tabbing into and out of WKWebView works correctly. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKitCocoa/CommandBackForward.mm: (WebKit2_CommandBackForwardTest::SetUp): (-[CommandBackForwardOffscreenWindow isKeyWindow]): Deleted. (-[CommandBackForwardOffscreenWindow isVisible]): Deleted. * TestWebKitAPI/Tests/WebKitCocoa/TabOutOfWebView.mm: Added. (-[FocusableView canBecomeKeyView]): (TEST): * TestWebKitAPI/mac/OffscreenWindow.h: Added. * TestWebKitAPI/mac/OffscreenWindow.mm: Added. (-[OffscreenWindow initWithSize:]): (-[OffscreenWindow isKeyWindow]): (-[OffscreenWindow isVisible]): * TestWebKitAPI/mac/PlatformWebViewMac.mm: (TestWebKitAPI::PlatformWebView::initialize): (-[ActiveOffscreenWindow isKeyWindow]): Deleted. (-[ActiveOffscreenWindow isVisible]): Deleted. Factor ActiveOffscreenWindow out into OffscreenWindow and share it. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240010 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-15 Tim Horton Cannot tab out of WKWebView on macOS https://bugs.webkit.org/show_bug.cgi?id=161448 Reviewed by Dean Jackson. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::takeFocus): If the UIDelegate doesn't implement takeFocus, provide a simple default implementation that just uses AppKit's key view loop to move the focus. * UIProcess/API/APIUIClient.h: (API::UIClient::takeFocus): * UIProcess/API/C/WKPage.cpp: (WKPageSetPageUIClient): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::takeFocus): Make API::UIClient's takeFocus return a bool indicating whether the client implements it or not. * UIProcess/PageClient.h: * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::takeFocus): Plumb takeFocus to WebViewImpl. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::takeFocus): Borrow the relevant portion of WebKitLegacy's implementation of takeFocus, shifting focus to the next/previous key view in the window. 2019-01-23 Alan Coon Cherry-pick r240161. rdar://problem/47458286 Regression(PSON) Scroll position is not always restored properly when navigating back https://bugs.webkit.org/show_bug.cgi?id=193578 Reviewed by Tim Horton. Source/WebKit: Fix issues causing the scroll position to not be restored at all (or incorrectly) when navigating back cross-site with PSON enabled. Also make sure that the swipe gesture snapshot really stays up until we've restored the scroll position. Note that even after those changes, I can still sometimes reproduce a white flash when swiping back to Google search results (scroll position being correct now). This is tracked by and happens even if I disable PSON entirely. * Shared/SessionState.cpp: (WebKit::FrameState::encode const): (WebKit::FrameState::decode): * Shared/SessionState.h: * WebProcess/WebCoreSupport/SessionStateConversion.cpp: (WebKit::toFrameState): (WebKit::applyFrameState): obscuredInsets is present on the HistoryItem in the WebProcess but was never passed to or stored by the UIProcess on the WebBackForwardListItem. obscuredInsets is needed to properly restore the scrollPosition (position was 70px off on my iPad without this). With PSON enabled, if you swipe back cross-process and the previous page was not put into PageCache, then the HistoryItem is gone on the WebProcess side. What happens is that the UIProcess sends its WebBackForwardListItem to the WebProcess, which restores the HistoryItem there, and then asks it to load it. The obscuredInsets was getting lost in the process since the UIProcess never knew about it. * UIProcess/Cocoa/ViewGestureController.cpp: (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState): Drop logic that was causing the ViewGestureController to not wait for the scroll position to be restored before taking down the snapshot, when UI-side compositing is enabled. If you look at the comment above the code, you'll see that the code in question was meant to impact only the non-UI side compositing code path. As a matter of fact, when the code was reviewed at https://bugs.webkit.org/show_bug.cgi?id=151224, it was protected by a #if PLATFORM(MAC), before getting modified the wrong way before landing. In practice, we would have often restored the scroll position by the time the load is finished so it would not cause a flash in most cases. However, with PSON enabled and the layer tree freezing we do on process-swap, the first post-scroll restoration layer tree commit may now occur a little bit later and we would lose the race more often. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::updateBackForwardItem): * UIProcess/WebProcessProxy.h: When adding PageCache support to PSON, we used to navigate the "suspended" page to about:blank. This would lead to unwanted WebProcessProxy::updateBackForwardItem() calls from the WebProcess which we wanted to ignore. We thus added logic to ignore updateBackForwardItem() IPC from the old WebProcess after a swap. The issue with this is that we sometimes miss/ignore legit updates to the HistoryItem from the old process, in particular with regards to the scroll position and the pageScaleFactor. So if you swiped and then quickly enough did a cross-site navigation, the UIProcess' WebBackForwardList would not get updated with the latest scroll position and we would thus fail to restore it later on. To address the issue, we now stop ignoring updates from the old WebProcess after a swap. This logic is no longer needed since we no longer navigate the old page to about:blank after a swap, we merely suspend it "in place". Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240161 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-18 Chris Dumez Regression(PSON) Scroll position is not always restored properly when navigating back https://bugs.webkit.org/show_bug.cgi?id=193578 Reviewed by Tim Horton. Fix issues causing the scroll position to not be restored at all (or incorrectly) when navigating back cross-site with PSON enabled. Also make sure that the swipe gesture snapshot really stays up until we've restored the scroll position. Note that even after those changes, I can still sometimes reproduce a white flash when swiping back to Google search results (scroll position being correct now). This is tracked by and happens even if I disable PSON entirely. * Shared/SessionState.cpp: (WebKit::FrameState::encode const): (WebKit::FrameState::decode): * Shared/SessionState.h: * WebProcess/WebCoreSupport/SessionStateConversion.cpp: (WebKit::toFrameState): (WebKit::applyFrameState): obscuredInsets is present on the HistoryItem in the WebProcess but was never passed to or stored by the UIProcess on the WebBackForwardListItem. obscuredInsets is needed to properly restore the scrollPosition (position was 70px off on my iPad without this). With PSON enabled, if you swipe back cross-process and the previous page was not put into PageCache, then the HistoryItem is gone on the WebProcess side. What happens is that the UIProcess sends its WebBackForwardListItem to the WebProcess, which restores the HistoryItem there, and then asks it to load it. The obscuredInsets was getting lost in the process since the UIProcess never knew about it. * UIProcess/Cocoa/ViewGestureController.cpp: (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState): Drop logic that was causing the ViewGestureController to not wait for the scroll position to be restored before taking down the snapshot, when UI-side compositing is enabled. If you look at the comment above the code, you'll see that the code in question was meant to impact only the non-UI side compositing code path. As a matter of fact, when the code was reviewed at https://bugs.webkit.org/show_bug.cgi?id=151224, it was protected by a #if PLATFORM(MAC), before getting modified the wrong way before landing. In practice, we would have often restored the scroll position by the time the load is finished so it would not cause a flash in most cases. However, with PSON enabled and the layer tree freezing we do on process-swap, the first post-scroll restoration layer tree commit may now occur a little bit later and we would lose the race more often. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::updateBackForwardItem): * UIProcess/WebProcessProxy.h: When adding PageCache support to PSON, we used to navigate the "suspended" page to about:blank. This would lead to unwanted WebProcessProxy::updateBackForwardItem() calls from the WebProcess which we wanted to ignore. We thus added logic to ignore updateBackForwardItem() IPC from the old WebProcess after a swap. The issue with this is that we sometimes miss/ignore legit updates to the HistoryItem from the old process, in particular with regards to the scroll position and the pageScaleFactor. So if you swiped and then quickly enough did a cross-site navigation, the UIProcess' WebBackForwardList would not get updated with the latest scroll position and we would thus fail to restore it later on. To address the issue, we now stop ignoring updates from the old WebProcess after a swap. This logic is no longer needed since we no longer navigate the old page to about:blank after a swap, we merely suspend it "in place". 2019-01-23 Alan Coon Cherry-pick r240087. rdar://problem/47458394 Revert r239938 https://bugs.webkit.org/show_bug.cgi?id=193267 * Configurations/WebContent-iOS.entitlements: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240087 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-16 Alex Christensen Revert r239938 https://bugs.webkit.org/show_bug.cgi?id=193267 * Configurations/WebContent-iOS.entitlements: 2019-01-23 Alan Coon Cherry-pick r240045. rdar://problem/47458249 Frequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded() https://bugs.webkit.org/show_bug.cgi?id=193468 Reviewed by Zalan Bujtas. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded): Adjust the null-check a bit; Zalan pointed out that the layout could be responsible for the Frame/RenderView going away, so we should bail *after* layout, not before. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240045 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-16 Tim Horton Frequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded() https://bugs.webkit.org/show_bug.cgi?id=193468 Reviewed by Zalan Bujtas. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded): Adjust the null-check a bit; Zalan pointed out that the layout could be responsible for the Frame/RenderView going away, so we should bail *after* layout, not before. 2019-01-23 Alan Coon Cherry-pick r240016. rdar://problem/47458249 Frequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded() https://bugs.webkit.org/show_bug.cgi?id=193468 Reviewed by Beth Dakin. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded): I'm not sure why this got *worse*, but we should null-check RenderView. It's OK to bail from scaleViewToFitDocumentIfNeeded, we'll re-do it the next time we paint (which will surely happen if we gain a RenderView). git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240016 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-15 Tim Horton Frequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded() https://bugs.webkit.org/show_bug.cgi?id=193468 Reviewed by Beth Dakin. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded): I'm not sure why this got *worse*, but we should null-check RenderView. It's OK to bail from scaleViewToFitDocumentIfNeeded, we'll re-do it the next time we paint (which will surely happen if we gain a RenderView). 2019-01-22 Alan Coon Cherry-pick r240055. rdar://problem/47099573 Regression(r240046) Several API tests are crashing https://bugs.webkit.org/show_bug.cgi?id=193509 Reviewed by Geoffrey Garen. The crashes would happen because loadRequestShared() would take a WebProcessProxy& in parameter but then call reattachToWebProcess() if the page is not valid, which would replace m_process and invalidate our process reference. To address the issue, move the reattachToWebProcess() call to loadRequest(), before calling loadRequestShared(). Also, update *Shared() methods to take a Ref&& instead of a WebProcessProxy& in parameter. Since we call client delegates, we need to make sure our process stays alive. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::loadData): (WebKit::ProvisionalPageProxy::loadRequest): (WebKit::ProvisionalPageProxy::didCreateMainFrame): (WebKit::ProvisionalPageProxy::didPerformClientRedirect): (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData): (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame): (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync): (WebKit::ProvisionalPageProxy::decidePolicyForResponse): (WebKit::ProvisionalPageProxy::startURLSchemeTask): (WebKit::ProvisionalPageProxy::backForwardGoToItem): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadRequest): (WebKit::WebPageProxy::loadRequestWithNavigationShared): (WebKit::WebPageProxy::loadData): (WebKit::WebPageProxy::loadDataWithNavigationShared): (WebKit::WebPageProxy::didPerformDragControllerAction): (WebKit::WebPageProxy::findPlugin): (WebKit::WebPageProxy::didCreateMainFrame): (WebKit::WebPageProxy::didCreateSubframe): (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared): (WebKit::WebPageProxy::willPerformClientRedirectForFrame): (WebKit::WebPageProxy::didCancelClientRedirectForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared): (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::didReceiveTitleForFrame): (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame): (WebKit::WebPageProxy::didDisplayInsecureContentForFrame): (WebKit::WebPageProxy::didRunInsecureContentForFrame): (WebKit::WebPageProxy::frameDidBecomeFrameSet): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNavigationActionSync): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponse): (WebKit::WebPageProxy::decidePolicyForResponseShared): (WebKit::WebPageProxy::unableToImplementPolicy): (WebKit::WebPageProxy::willSubmitForm): (WebKit::WebPageProxy::didNavigateWithNavigationData): (WebKit::WebPageProxy::didNavigateWithNavigationDataShared): (WebKit::WebPageProxy::didPerformClientRedirect): (WebKit::WebPageProxy::didPerformClientRedirectShared): (WebKit::WebPageProxy::didPerformServerRedirect): (WebKit::WebPageProxy::didUpdateHistoryTitle): (WebKit::WebPageProxy::createNewPage): (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): (WebKit::WebPageProxy::unavailablePluginButtonClicked): (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): (WebKit::WebPageProxy::runOpenPanel): (WebKit::WebPageProxy::printFrame): (WebKit::WebPageProxy::backForwardGoToItem): (WebKit::WebPageProxy::backForwardGoToItemShared): (WebKit::WebPageProxy::learnWord): (WebKit::WebPageProxy::ignoreWord): (WebKit::WebPageProxy::didReceiveEvent): (WebKit::WebPageProxy::editingRangeCallback): (WebKit::WebPageProxy::rectForCharacterRangeCallback): (WebKit::WebPageProxy::focusedFrameChanged): (WebKit::WebPageProxy::frameSetLargestFrameChanged): (WebKit::WebPageProxy::exceededDatabaseQuota): (WebKit::WebPageProxy::requestGeolocationPermissionForFrame): (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): (WebKit::WebPageProxy::enumerateMediaDevicesForFrame): (WebKit::WebPageProxy::startURLSchemeTask): (WebKit::WebPageProxy::startURLSchemeTaskShared): (WebKit::WebPageProxy::stopURLSchemeTask): (WebKit::WebPageProxy::loadSynchronousURLSchemeTask): * UIProcess/WebPageProxy.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240055 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-16 Chris Dumez Regression(r240046) Several API tests are crashing https://bugs.webkit.org/show_bug.cgi?id=193509 Reviewed by Geoffrey Garen. The crashes would happen because loadRequestShared() would take a WebProcessProxy& in parameter but then call reattachToWebProcess() if the page is not valid, which would replace m_process and invalidate our process reference. To address the issue, move the reattachToWebProcess() call to loadRequest(), before calling loadRequestShared(). Also, update *Shared() methods to take a Ref&& instead of a WebProcessProxy& in parameter. Since we call client delegates, we need to make sure our process stays alive. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::loadData): (WebKit::ProvisionalPageProxy::loadRequest): (WebKit::ProvisionalPageProxy::didCreateMainFrame): (WebKit::ProvisionalPageProxy::didPerformClientRedirect): (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData): (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame): (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync): (WebKit::ProvisionalPageProxy::decidePolicyForResponse): (WebKit::ProvisionalPageProxy::startURLSchemeTask): (WebKit::ProvisionalPageProxy::backForwardGoToItem): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadRequest): (WebKit::WebPageProxy::loadRequestWithNavigationShared): (WebKit::WebPageProxy::loadData): (WebKit::WebPageProxy::loadDataWithNavigationShared): (WebKit::WebPageProxy::didPerformDragControllerAction): (WebKit::WebPageProxy::findPlugin): (WebKit::WebPageProxy::didCreateMainFrame): (WebKit::WebPageProxy::didCreateSubframe): (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared): (WebKit::WebPageProxy::willPerformClientRedirectForFrame): (WebKit::WebPageProxy::didCancelClientRedirectForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared): (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::didReceiveTitleForFrame): (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame): (WebKit::WebPageProxy::didDisplayInsecureContentForFrame): (WebKit::WebPageProxy::didRunInsecureContentForFrame): (WebKit::WebPageProxy::frameDidBecomeFrameSet): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNavigationActionSync): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponse): (WebKit::WebPageProxy::decidePolicyForResponseShared): (WebKit::WebPageProxy::unableToImplementPolicy): (WebKit::WebPageProxy::willSubmitForm): (WebKit::WebPageProxy::didNavigateWithNavigationData): (WebKit::WebPageProxy::didNavigateWithNavigationDataShared): (WebKit::WebPageProxy::didPerformClientRedirect): (WebKit::WebPageProxy::didPerformClientRedirectShared): (WebKit::WebPageProxy::didPerformServerRedirect): (WebKit::WebPageProxy::didUpdateHistoryTitle): (WebKit::WebPageProxy::createNewPage): (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): (WebKit::WebPageProxy::unavailablePluginButtonClicked): (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): (WebKit::WebPageProxy::runOpenPanel): (WebKit::WebPageProxy::printFrame): (WebKit::WebPageProxy::backForwardGoToItem): (WebKit::WebPageProxy::backForwardGoToItemShared): (WebKit::WebPageProxy::learnWord): (WebKit::WebPageProxy::ignoreWord): (WebKit::WebPageProxy::didReceiveEvent): (WebKit::WebPageProxy::editingRangeCallback): (WebKit::WebPageProxy::rectForCharacterRangeCallback): (WebKit::WebPageProxy::focusedFrameChanged): (WebKit::WebPageProxy::frameSetLargestFrameChanged): (WebKit::WebPageProxy::exceededDatabaseQuota): (WebKit::WebPageProxy::requestGeolocationPermissionForFrame): (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): (WebKit::WebPageProxy::enumerateMediaDevicesForFrame): (WebKit::WebPageProxy::startURLSchemeTask): (WebKit::WebPageProxy::startURLSchemeTaskShared): (WebKit::WebPageProxy::stopURLSchemeTask): (WebKit::WebPageProxy::loadSynchronousURLSchemeTask): * UIProcess/WebPageProxy.h: 2019-01-22 Alan Coon Cherry-pick r240046. rdar://problem/47099573 Regression(PSON) View becomes blank after click a cross-site download link https://bugs.webkit.org/show_bug.cgi?id=193361 Reviewed by Geoffrey Garen. Source/WebCore: * loader/FrameLoader.cpp: (WebCore::FrameLoader::commitProvisionalLoad): When restoring from PageCache, make sure we notify the client that the load was committed *before* we tell it that the navigation is complete. This would confuse the ProvisionalPageProxy logic in the UIProcess. Source/WebKit: The issue tracked by rdar://problem/47099573 is that a provisional load may get canceled (or converted into a download) *after* we've decided to process-swap. In such cases, the view should keep displaying the current site and it should still be interactive. However, with the previous PSON model, the view (pageProxy) would have already swapped to the new process and would end up displaying the initially empty document. To address the issue, this patch introduces the concept of a provisional load in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the provisional page until after the load was committed in the new process. This means that the view / WebPageProxy keeps using the old process and displays the current content until a load has committed in the provisional page. If no load commits in the provisional process (e.g. because the load is cancelled or converted into a download), then we merely destroy the ProvisionalPageProxy and terminate its process, without impacting the WebPageProxy. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to delay attaching the drawing area in case of a process-swap, no matter what now that the previous process is kept alive until the provisional load is committed in the new process. * Shared/WebPolicyAction.h: Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of process-swap, we now tell the previous process to simply ignore the load, while we create a ProvisionalPageProxy to do the new load in a new process. Suspension of the previous page in the old process, happens later, when a load is actually committed in the new process. * Sources.txt: Add new ProvisionalPageProxy file. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _killWebContentProcessAndResetState]): When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current process and the provisional one, to maintain previous behavior in our API tests. * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/API/gtk/PageClientImpl.h: * UIProcess/API/wpe/PageClientImpl.cpp: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/API/wpe/PageClientImpl.h: * UIProcess/AcceleratedDrawingAreaProxy.cpp: (WebKit::AcceleratedDrawingAreaProxy::AcceleratedDrawingAreaProxy): (WebKit::AcceleratedDrawingAreaProxy::didUpdateBackingStoreState): (WebKit::AcceleratedDrawingAreaProxy::sendUpdateBackingStoreState): (WebKit::AcceleratedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState): (WebKit::AcceleratedDrawingAreaProxy::setNativeSurfaceHandleForCompositing): (WebKit::AcceleratedDrawingAreaProxy::destroyNativeSurfaceHandleForCompositing): * UIProcess/AcceleratedDrawingAreaProxy.h: * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::createDrawingAreaProxy): * UIProcess/DrawingAreaProxy.cpp: (WebKit::DrawingAreaProxy::DrawingAreaProxy): (WebKit::DrawingAreaProxy::~DrawingAreaProxy): (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired): * UIProcess/DrawingAreaProxy.h: (WebKit::DrawingAreaProxy::process): * UIProcess/DrawingAreaProxyImpl.cpp: (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl): (WebKit::DrawingAreaProxyImpl::update): * UIProcess/DrawingAreaProxyImpl.h: * UIProcess/PageClient.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy): (WebKit::RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy): (WebKit::RemoteLayerTreeDrawingAreaProxy::deviceScaleFactorDidChange): (WebKit::RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry): (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidStart): (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidEnd): (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay): (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState): (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing): * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/ios/WKContentView.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView _createDrawingAreaProxy:]): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h: * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: (WebKit::TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy): (WebKit::TiledCoreAnimationDrawingAreaProxy::deviceScaleFactorDidChange): (WebKit::TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange): (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState): (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence): (WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry): (WebKit::TiledCoreAnimationDrawingAreaProxy::adjustTransientZoom): (WebKit::TiledCoreAnimationDrawingAreaProxy::commitTransientZoom): (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing): * UIProcess/mac/WebPageProxyMac.mm: * UIProcess/win/PageClientImpl.cpp: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/win/PageClientImpl.h: * UIProcess/win/PageClientImpl.cpp: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/win/PageClientImpl.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): Pass the drawing area's associated process when constructing it and store it as a member in addition to the page. This is necessary now that a page can be associated with 2 WebProcesses at a time, each having its own drawing area. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): Pass the process. * UIProcess/ProvisionalPageProxy.cpp: Added. (WebKit::ProvisionalPageProxy::ProvisionalPageProxy): (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy): (WebKit::ProvisionalPageProxy::processDidTerminate): (WebKit::ProvisionalPageProxy::takeDrawingArea): (WebKit::ProvisionalPageProxy::cancel): (WebKit::ProvisionalPageProxy::processDidFinishLaunching): (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): (WebKit::ProvisionalPageProxy::initializeWebPage): (WebKit::ProvisionalPageProxy::loadData): (WebKit::ProvisionalPageProxy::loadRequest): (WebKit::ProvisionalPageProxy::goToBackForwardItem): (WebKit::ProvisionalPageProxy::didCreateMainFrame): (WebKit::ProvisionalPageProxy::didPerformClientRedirect): (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didCommitLoadForFrame): (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData): (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame): (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync): (WebKit::ProvisionalPageProxy::decidePolicyForResponse): (WebKit::ProvisionalPageProxy::startURLSchemeTask): (WebKit::ProvisionalPageProxy::backForwardGoToItem): (WebKit::ProvisionalPageProxy::didReceiveMessage): (WebKit::ProvisionalPageProxy::didReceiveSyncMessage): * UIProcess/ProvisionalPageProxy.h: Added. (WebKit::ProvisionalPageProxy::page): (WebKit::ProvisionalPageProxy::mainFrame const): (WebKit::ProvisionalPageProxy::process): (WebKit::ProvisionalPageProxy::processSwapRequestedByClient const): (WebKit::ProvisionalPageProxy::navigationID const): (WebKit::ProvisionalPageProxy::drawingArea const): New WebPageProxy-like class which is owned by the WebPageProxy and proxies IPC from the provisional process. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::~SuspendedPageProxy): (WebKit::SuspendedPageProxy::unsuspend): (WebKit::SuspendedPageProxy::didProcessRequestToSuspend): Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy which tries to register itself as an IPC message receiver for the same pageID when a process-swap occurs and we're switching to a suspended page. * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::isMainFrame const): WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame. Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's m_mainFrame to maintain previous behavior. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::provisionalDrawingArea const): Add getter for the provisional drawing area. We normally only deal with the page's current drawing area, but the ViewGestureController needs access to the provisional once to display the swipe gesture snapshot. (WebKit::WebPageProxy::swapToWebProcess): swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess() later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs to initialize some data members such as the drawing area and the main frame as it is transferring them over from the ProvisionalPageProxy which started the provisional load. (WebKit::WebPageProxy::finishAttachingToWebProcess): We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been committed in the provisional process. (WebKit::WebPageProxy::setDrawingArea): (WebKit::WebPageProxy::initializeWebPage): - We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been committed in the provisional process. - Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess(). (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle): (WebKit::WebPageProxy::loadRequest): (WebKit::WebPageProxy::loadRequestWithNavigationShared): Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not Yes. This avoids hitting some assertions as this was already called during the first API call if needed. (WebKit::WebPageProxy::loadData): (WebKit::WebPageProxy::loadDataWithNavigationShared): (WebKit::WebPageProxy::stopLoading): (WebKit::WebPageProxy::reload): (WebKit::WebPageProxy::didPerformDragControllerAction): (WebKit::WebPageProxy::findPlugin): (WebKit::WebPageProxy::receivedNavigationPolicyDecision): In case of process swap, tell the previous process to ignore the load instead of suspending it right away. Suspension now happens later, only if we end up committing the provisional load in the new process. Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used to happen a bit later but it is clearer if we do this as early as possible I think. (WebKit::WebPageProxy::commitProvisionalPage): When the load is committed in the new process, we call WebPageProxy::commitProvisionalPage(). It takes care of: - Actually swapping the WebPageProxy to the new process by calling processDidTerminate() / swapToWebProcess(). - Suspending the current page. - Letting the client know the load is comitted - Destroy the ProvisionalPageProxy. This work used to happen earlier in continueNavigationInNewProcess(). (WebKit::WebPageProxy::continueNavigationInNewProcess): Moved some of the logic to commitProvisionalPage(). We now merely start the load in a new ProvisionalPageProxy, without actually having the WebPageProxy switch to the new process yet. (WebKit::WebPageProxy::didCreateMainFrame): (WebKit::WebPageProxy::didCreateSubframe): (WebKit::WebPageProxy::didCreateWindow): Drop some code that is no longer needed, now that the ProvisionalPageProxy takes care of this. (WebKit::WebPageProxy::didDestroyNavigation): On process-swap, when telling the previous process to ignore the load and starting the new load in a new ProvisionalPageProxy, the previous WebPage attempts to destroy the navigation. In this case, we ignore the call since the navigation is merely taken over by the ProvisionalPageProxy. (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): Moved some PSON logic to the ProvisionalPageProxy instead. (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared): (WebKit::WebPageProxy::willPerformClientRedirectForFrame): (WebKit::WebPageProxy::didCancelClientRedirectForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared): (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): When didFailProvisionalLoadForFrame() is called for a ProvisionalPageProxy, destroy it. (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::didReceiveTitleForFrame): (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame): (WebKit::WebPageProxy::didDisplayInsecureContentForFrame): (WebKit::WebPageProxy::didRunInsecureContentForFrame): (WebKit::WebPageProxy::frameDidBecomeFrameSet): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNavigationActionSync): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponse): (WebKit::WebPageProxy::decidePolicyForResponseShared): (WebKit::WebPageProxy::unableToImplementPolicy): (WebKit::WebPageProxy::willSubmitForm): (WebKit::WebPageProxy::didNavigateWithNavigationData): (WebKit::WebPageProxy::didNavigateWithNavigationDataShared): (WebKit::WebPageProxy::didPerformClientRedirect): (WebKit::WebPageProxy::didPerformClientRedirectShared): (WebKit::WebPageProxy::didPerformServerRedirect): (WebKit::WebPageProxy::didUpdateHistoryTitle): (WebKit::WebPageProxy::createNewPage): (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): (WebKit::WebPageProxy::unavailablePluginButtonClicked): (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): (WebKit::WebPageProxy::runOpenPanel): (WebKit::WebPageProxy::printFrame): (WebKit::WebPageProxy::backForwardGoToItem): (WebKit::WebPageProxy::backForwardGoToItemShared): (WebKit::WebPageProxy::learnWord): (WebKit::WebPageProxy::ignoreWord): (WebKit::WebPageProxy::didReceiveEvent): (WebKit::WebPageProxy::editingRangeCallback): (WebKit::WebPageProxy::rectForCharacterRangeCallback): (WebKit::WebPageProxy::focusedFrameChanged): (WebKit::WebPageProxy::frameSetLargestFrameChanged): (WebKit::WebPageProxy::provisionalProcessDidTerminate): Cancel the provisiona load and destroy the ProvisionalPageProxy if the provisional process crashes. (WebKit::WebPageProxy::resetState): Drop some code that is no longer needed. (WebKit::WebPageProxy::creationParameters): - Move the hasRegisteredServiceWorkers flag initialization from the call site to here now that we have more than one call site. This was just some bad factoring. - Take the process in parameter now that we page can be associated with several processes at a time. (WebKit::WebPageProxy::exceededDatabaseQuota): (WebKit::WebPageProxy::requestGeolocationPermissionForFrame): (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): (WebKit::WebPageProxy::enumerateMediaDevicesForFrame): (WebKit::WebPageProxy::startURLSchemeTask): (WebKit::WebPageProxy::startURLSchemeTaskShared): (WebKit::WebPageProxy::stopURLSchemeTask): (WebKit::WebPageProxy::loadSynchronousURLSchemeTask): (WebKit::WebPageProxy::checkURLReceivedFromCurrentOrPreviousWebProcess): (WebKit::WebPageProxy::willAcquireUniversalFileReadSandboxExtension): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::visitedLinkStore): (WebKit::WebPageProxy::provisionalPageProxy const): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::hasProvisionalPageWithID const): (WebKit::WebProcessProxy::updateBackForwardItem): (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): (WebKit::WebProcessProxy::didFinishLaunching): (WebKit::WebProcessProxy::canTerminateChildProcess): * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::addProvisionalPageProxy): (WebKit::WebProcessProxy::removeProvisionalPageProxy): Before updating a BackForwardListItem, we normally make sure the process has a WebPageProxy with the item's pageID. We have to tweak the logic because there may now be no WebPageProxy with this pageID associated with this process yet, because it is still a ProvisionalPageProxy. * UIProcess/WebURLSchemeHandler.cpp: (WebKit::WebURLSchemeHandler::startTask): * UIProcess/WebURLSchemeHandler.h: * UIProcess/WebURLSchemeTask.cpp: (WebKit::WebURLSchemeTask::create): (WebKit::WebURLSchemeTask::WebURLSchemeTask): (WebKit::WebURLSchemeTask::didPerformRedirection): (WebKit::WebURLSchemeTask::didReceiveResponse): (WebKit::WebURLSchemeTask::didReceiveData): (WebKit::WebURLSchemeTask::didComplete): (WebKit::WebURLSchemeTask::pageDestroyed): * UIProcess/WebURLSchemeTask.h: Pass the process when constructing a WebURLSchemeTask and store it as a data member in addition to the page. This is necessary now that a WebPageProxy can be associated with several WebProcesses. * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::endSwipeGesture): Use the provisional drawing area to display the swipe snapshot as it may differ from the one currently associated with the page in case of process swap. * WebKit.xcodeproj/project.pbxproj: Add ProvisionalPageProxy class. * WebProcess/WebPage/WebFrame.cpp: (WebKit::toPolicyAction): (WebKit::WebFrame::didReceivePolicyDecision): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_shouldAttachDrawingAreaOnPageTransition): (WebKit::WebPage::reinitializeWebPage): (WebKit::WebPage::didReceivePolicyDecision): Stop dealing with WebPolicyAction::Suspend as it no longer exists. (WebKit::WebPage::didCompletePageTransition): (WebKit::WebPage::setIsSuspended): Suspend the Page when setIsSuspended(true) is called, now that there is no longer a WebPolicyAction::Suspend. setIsSuspended(true) IPC is sent when we actually commit the provisional page. * WebProcess/WebPage/WebPage.h: Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: (-[PSONNavigationDelegate webView:decidePolicyForNavigationResponse:decisionHandler:]): LayoutTests: Skip test testing the cross-process DOMWindow API as I broke it with this patch. The feature is far from ready and off by default anyway. I will add support back in a follow-up. * platform/wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240046 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-16 Chris Dumez Regression(PSON) View becomes blank after click a cross-site download link https://bugs.webkit.org/show_bug.cgi?id=193361 Reviewed by Geoffrey Garen. The issue tracked by rdar://problem/47099573 is that a provisional load may get canceled (or converted into a download) *after* we've decided to process-swap. In such cases, the view should keep displaying the current site and it should still be interactive. However, with the previous PSON model, the view (pageProxy) would have already swapped to the new process and would end up displaying the initially empty document. To address the issue, this patch introduces the concept of a provisional load in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the provisional page until after the load was committed in the new process. This means that the view / WebPageProxy keeps using the old process and displays the current content until a load has committed in the provisional page. If no load commits in the provisional process (e.g. because the load is cancelled or converted into a download), then we merely destroy the ProvisionalPageProxy and terminate its process, without impacting the WebPageProxy. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to delay attaching the drawing area in case of a process-swap, no matter what now that the previous process is kept alive until the provisional load is committed in the new process. * Shared/WebPolicyAction.h: Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of process-swap, we now tell the previous process to simply ignore the load, while we create a ProvisionalPageProxy to do the new load in a new process. Suspension of the previous page in the old process, happens later, when a load is actually committed in the new process. * Sources.txt: Add new ProvisionalPageProxy file. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _killWebContentProcessAndResetState]): When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current process and the provisional one, to maintain previous behavior in our API tests. * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/API/gtk/PageClientImpl.h: * UIProcess/API/wpe/PageClientImpl.cpp: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/API/wpe/PageClientImpl.h: * UIProcess/AcceleratedDrawingAreaProxy.cpp: (WebKit::AcceleratedDrawingAreaProxy::AcceleratedDrawingAreaProxy): (WebKit::AcceleratedDrawingAreaProxy::didUpdateBackingStoreState): (WebKit::AcceleratedDrawingAreaProxy::sendUpdateBackingStoreState): (WebKit::AcceleratedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState): (WebKit::AcceleratedDrawingAreaProxy::setNativeSurfaceHandleForCompositing): (WebKit::AcceleratedDrawingAreaProxy::destroyNativeSurfaceHandleForCompositing): * UIProcess/AcceleratedDrawingAreaProxy.h: * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::createDrawingAreaProxy): * UIProcess/DrawingAreaProxy.cpp: (WebKit::DrawingAreaProxy::DrawingAreaProxy): (WebKit::DrawingAreaProxy::~DrawingAreaProxy): (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired): * UIProcess/DrawingAreaProxy.h: (WebKit::DrawingAreaProxy::process): * UIProcess/DrawingAreaProxyImpl.cpp: (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl): (WebKit::DrawingAreaProxyImpl::update): * UIProcess/DrawingAreaProxyImpl.h: * UIProcess/PageClient.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy): (WebKit::RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy): (WebKit::RemoteLayerTreeDrawingAreaProxy::deviceScaleFactorDidChange): (WebKit::RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry): (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidStart): (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidEnd): (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay): (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState): (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing): * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/ios/WKContentView.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView _createDrawingAreaProxy:]): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h: * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: (WebKit::TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy): (WebKit::TiledCoreAnimationDrawingAreaProxy::deviceScaleFactorDidChange): (WebKit::TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange): (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState): (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence): (WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry): (WebKit::TiledCoreAnimationDrawingAreaProxy::adjustTransientZoom): (WebKit::TiledCoreAnimationDrawingAreaProxy::commitTransientZoom): (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing): * UIProcess/mac/WebPageProxyMac.mm: * UIProcess/win/PageClientImpl.cpp: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/win/PageClientImpl.h: * UIProcess/win/PageClientImpl.cpp: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/win/PageClientImpl.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): Pass the drawing area's associated process when constructing it and store it as a member in addition to the page. This is necessary now that a page can be associated with 2 WebProcesses at a time, each having its own drawing area. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): Pass the process. * UIProcess/ProvisionalPageProxy.cpp: Added. (WebKit::ProvisionalPageProxy::ProvisionalPageProxy): (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy): (WebKit::ProvisionalPageProxy::processDidTerminate): (WebKit::ProvisionalPageProxy::takeDrawingArea): (WebKit::ProvisionalPageProxy::cancel): (WebKit::ProvisionalPageProxy::processDidFinishLaunching): (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): (WebKit::ProvisionalPageProxy::initializeWebPage): (WebKit::ProvisionalPageProxy::loadData): (WebKit::ProvisionalPageProxy::loadRequest): (WebKit::ProvisionalPageProxy::goToBackForwardItem): (WebKit::ProvisionalPageProxy::didCreateMainFrame): (WebKit::ProvisionalPageProxy::didPerformClientRedirect): (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didCommitLoadForFrame): (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData): (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame): (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync): (WebKit::ProvisionalPageProxy::decidePolicyForResponse): (WebKit::ProvisionalPageProxy::startURLSchemeTask): (WebKit::ProvisionalPageProxy::backForwardGoToItem): (WebKit::ProvisionalPageProxy::didReceiveMessage): (WebKit::ProvisionalPageProxy::didReceiveSyncMessage): * UIProcess/ProvisionalPageProxy.h: Added. (WebKit::ProvisionalPageProxy::page): (WebKit::ProvisionalPageProxy::mainFrame const): (WebKit::ProvisionalPageProxy::process): (WebKit::ProvisionalPageProxy::processSwapRequestedByClient const): (WebKit::ProvisionalPageProxy::navigationID const): (WebKit::ProvisionalPageProxy::drawingArea const): New WebPageProxy-like class which is owned by the WebPageProxy and proxies IPC from the provisional process. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::~SuspendedPageProxy): (WebKit::SuspendedPageProxy::unsuspend): (WebKit::SuspendedPageProxy::didProcessRequestToSuspend): Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy which tries to register itself as an IPC message receiver for the same pageID when a process-swap occurs and we're switching to a suspended page. * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::isMainFrame const): WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame. Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's m_mainFrame to maintain previous behavior. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::provisionalDrawingArea const): Add getter for the provisional drawing area. We normally only deal with the page's current drawing area, but the ViewGestureController needs access to the provisional once to display the swipe gesture snapshot. (WebKit::WebPageProxy::swapToWebProcess): swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess() later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs to initialize some data members such as the drawing area and the main frame as it is transferring them over from the ProvisionalPageProxy which started the provisional load. (WebKit::WebPageProxy::finishAttachingToWebProcess): We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been committed in the provisional process. (WebKit::WebPageProxy::setDrawingArea): (WebKit::WebPageProxy::initializeWebPage): - We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been committed in the provisional process. - Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess(). (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle): (WebKit::WebPageProxy::loadRequest): (WebKit::WebPageProxy::loadRequestWithNavigationShared): Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not Yes. This avoids hitting some assertions as this was already called during the first API call if needed. (WebKit::WebPageProxy::loadData): (WebKit::WebPageProxy::loadDataWithNavigationShared): (WebKit::WebPageProxy::stopLoading): (WebKit::WebPageProxy::reload): (WebKit::WebPageProxy::didPerformDragControllerAction): (WebKit::WebPageProxy::findPlugin): (WebKit::WebPageProxy::receivedNavigationPolicyDecision): In case of process swap, tell the previous process to ignore the load instead of suspending it right away. Suspension now happens later, only if we end up committing the provisional load in the new process. Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used to happen a bit later but it is clearer if we do this as early as possible I think. (WebKit::WebPageProxy::commitProvisionalPage): When the load is committed in the new process, we call WebPageProxy::commitProvisionalPage(). It takes care of: - Actually swapping the WebPageProxy to the new process by calling processDidTerminate() / swapToWebProcess(). - Suspending the current page. - Letting the client know the load is comitted - Destroy the ProvisionalPageProxy. This work used to happen earlier in continueNavigationInNewProcess(). (WebKit::WebPageProxy::continueNavigationInNewProcess): Moved some of the logic to commitProvisionalPage(). We now merely start the load in a new ProvisionalPageProxy, without actually having the WebPageProxy switch to the new process yet. (WebKit::WebPageProxy::didCreateMainFrame): (WebKit::WebPageProxy::didCreateSubframe): (WebKit::WebPageProxy::didCreateWindow): Drop some code that is no longer needed, now that the ProvisionalPageProxy takes care of this. (WebKit::WebPageProxy::didDestroyNavigation): On process-swap, when telling the previous process to ignore the load and starting the new load in a new ProvisionalPageProxy, the previous WebPage attempts to destroy the navigation. In this case, we ignore the call since the navigation is merely taken over by the ProvisionalPageProxy. (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): Moved some PSON logic to the ProvisionalPageProxy instead. (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared): (WebKit::WebPageProxy::willPerformClientRedirectForFrame): (WebKit::WebPageProxy::didCancelClientRedirectForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared): (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): When didFailProvisionalLoadForFrame() is called for a ProvisionalPageProxy, destroy it. (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::didReceiveTitleForFrame): (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame): (WebKit::WebPageProxy::didDisplayInsecureContentForFrame): (WebKit::WebPageProxy::didRunInsecureContentForFrame): (WebKit::WebPageProxy::frameDidBecomeFrameSet): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNavigationActionSync): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponse): (WebKit::WebPageProxy::decidePolicyForResponseShared): (WebKit::WebPageProxy::unableToImplementPolicy): (WebKit::WebPageProxy::willSubmitForm): (WebKit::WebPageProxy::didNavigateWithNavigationData): (WebKit::WebPageProxy::didNavigateWithNavigationDataShared): (WebKit::WebPageProxy::didPerformClientRedirect): (WebKit::WebPageProxy::didPerformClientRedirectShared): (WebKit::WebPageProxy::didPerformServerRedirect): (WebKit::WebPageProxy::didUpdateHistoryTitle): (WebKit::WebPageProxy::createNewPage): (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): (WebKit::WebPageProxy::unavailablePluginButtonClicked): (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): (WebKit::WebPageProxy::runOpenPanel): (WebKit::WebPageProxy::printFrame): (WebKit::WebPageProxy::backForwardGoToItem): (WebKit::WebPageProxy::backForwardGoToItemShared): (WebKit::WebPageProxy::learnWord): (WebKit::WebPageProxy::ignoreWord): (WebKit::WebPageProxy::didReceiveEvent): (WebKit::WebPageProxy::editingRangeCallback): (WebKit::WebPageProxy::rectForCharacterRangeCallback): (WebKit::WebPageProxy::focusedFrameChanged): (WebKit::WebPageProxy::frameSetLargestFrameChanged): (WebKit::WebPageProxy::provisionalProcessDidTerminate): Cancel the provisiona load and destroy the ProvisionalPageProxy if the provisional process crashes. (WebKit::WebPageProxy::resetState): Drop some code that is no longer needed. (WebKit::WebPageProxy::creationParameters): - Move the hasRegisteredServiceWorkers flag initialization from the call site to here now that we have more than one call site. This was just some bad factoring. - Take the process in parameter now that we page can be associated with several processes at a time. (WebKit::WebPageProxy::exceededDatabaseQuota): (WebKit::WebPageProxy::requestGeolocationPermissionForFrame): (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): (WebKit::WebPageProxy::enumerateMediaDevicesForFrame): (WebKit::WebPageProxy::startURLSchemeTask): (WebKit::WebPageProxy::startURLSchemeTaskShared): (WebKit::WebPageProxy::stopURLSchemeTask): (WebKit::WebPageProxy::loadSynchronousURLSchemeTask): (WebKit::WebPageProxy::checkURLReceivedFromCurrentOrPreviousWebProcess): (WebKit::WebPageProxy::willAcquireUniversalFileReadSandboxExtension): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::visitedLinkStore): (WebKit::WebPageProxy::provisionalPageProxy const): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::hasProvisionalPageWithID const): (WebKit::WebProcessProxy::updateBackForwardItem): (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): (WebKit::WebProcessProxy::didFinishLaunching): (WebKit::WebProcessProxy::canTerminateChildProcess): * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::addProvisionalPageProxy): (WebKit::WebProcessProxy::removeProvisionalPageProxy): Before updating a BackForwardListItem, we normally make sure the process has a WebPageProxy with the item's pageID. We have to tweak the logic because there may now be no WebPageProxy with this pageID associated with this process yet, because it is still a ProvisionalPageProxy. * UIProcess/WebURLSchemeHandler.cpp: (WebKit::WebURLSchemeHandler::startTask): * UIProcess/WebURLSchemeHandler.h: * UIProcess/WebURLSchemeTask.cpp: (WebKit::WebURLSchemeTask::create): (WebKit::WebURLSchemeTask::WebURLSchemeTask): (WebKit::WebURLSchemeTask::didPerformRedirection): (WebKit::WebURLSchemeTask::didReceiveResponse): (WebKit::WebURLSchemeTask::didReceiveData): (WebKit::WebURLSchemeTask::didComplete): (WebKit::WebURLSchemeTask::pageDestroyed): * UIProcess/WebURLSchemeTask.h: Pass the process when constructing a WebURLSchemeTask and store it as a data member in addition to the page. This is necessary now that a WebPageProxy can be associated with several WebProcesses. * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::endSwipeGesture): Use the provisional drawing area to display the swipe snapshot as it may differ from the one currently associated with the page in case of process swap. * WebKit.xcodeproj/project.pbxproj: Add ProvisionalPageProxy class. * WebProcess/WebPage/WebFrame.cpp: (WebKit::toPolicyAction): (WebKit::WebFrame::didReceivePolicyDecision): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_shouldAttachDrawingAreaOnPageTransition): (WebKit::WebPage::reinitializeWebPage): (WebKit::WebPage::didReceivePolicyDecision): Stop dealing with WebPolicyAction::Suspend as it no longer exists. (WebKit::WebPage::didCompletePageTransition): (WebKit::WebPage::setIsSuspended): Suspend the Page when setIsSuspended(true) is called, now that there is no longer a WebPolicyAction::Suspend. setIsSuspended(true) IPC is sent when we actually commit the provisional page. * WebProcess/WebPage/WebPage.h: 2019-01-22 Alan Coon Revert r240258. rdar://problem/47099573 2019-01-22 Alan Coon Revert r240259. rdar://problem/47099573 2019-01-22 Alan Coon Revert r240260. rdar://problem/47099573 2019-01-22 Alan Coon Revert r240262. rdar://problem/47099573 2019-01-22 Alan Coon Revert r240263. rdar://problem/47099573 2019-01-22 Alan Coon Revert r240264. rdar://problem/47099573 2019-01-22 Alan Coon Cherry-pick r240055. rdar://problem/47099573 Regression(r240046) Several API tests are crashing https://bugs.webkit.org/show_bug.cgi?id=193509 Reviewed by Geoffrey Garen. The crashes would happen because loadRequestShared() would take a WebProcessProxy& in parameter but then call reattachToWebProcess() if the page is not valid, which would replace m_process and invalidate our process reference. To address the issue, move the reattachToWebProcess() call to loadRequest(), before calling loadRequestShared(). Also, update *Shared() methods to take a Ref&& instead of a WebProcessProxy& in parameter. Since we call client delegates, we need to make sure our process stays alive. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::loadData): (WebKit::ProvisionalPageProxy::loadRequest): (WebKit::ProvisionalPageProxy::didCreateMainFrame): (WebKit::ProvisionalPageProxy::didPerformClientRedirect): (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData): (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame): (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync): (WebKit::ProvisionalPageProxy::decidePolicyForResponse): (WebKit::ProvisionalPageProxy::startURLSchemeTask): (WebKit::ProvisionalPageProxy::backForwardGoToItem): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadRequest): (WebKit::WebPageProxy::loadRequestWithNavigationShared): (WebKit::WebPageProxy::loadData): (WebKit::WebPageProxy::loadDataWithNavigationShared): (WebKit::WebPageProxy::didPerformDragControllerAction): (WebKit::WebPageProxy::findPlugin): (WebKit::WebPageProxy::didCreateMainFrame): (WebKit::WebPageProxy::didCreateSubframe): (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared): (WebKit::WebPageProxy::willPerformClientRedirectForFrame): (WebKit::WebPageProxy::didCancelClientRedirectForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared): (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::didReceiveTitleForFrame): (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame): (WebKit::WebPageProxy::didDisplayInsecureContentForFrame): (WebKit::WebPageProxy::didRunInsecureContentForFrame): (WebKit::WebPageProxy::frameDidBecomeFrameSet): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNavigationActionSync): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponse): (WebKit::WebPageProxy::decidePolicyForResponseShared): (WebKit::WebPageProxy::unableToImplementPolicy): (WebKit::WebPageProxy::willSubmitForm): (WebKit::WebPageProxy::didNavigateWithNavigationData): (WebKit::WebPageProxy::didNavigateWithNavigationDataShared): (WebKit::WebPageProxy::didPerformClientRedirect): (WebKit::WebPageProxy::didPerformClientRedirectShared): (WebKit::WebPageProxy::didPerformServerRedirect): (WebKit::WebPageProxy::didUpdateHistoryTitle): (WebKit::WebPageProxy::createNewPage): (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): (WebKit::WebPageProxy::unavailablePluginButtonClicked): (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): (WebKit::WebPageProxy::runOpenPanel): (WebKit::WebPageProxy::printFrame): (WebKit::WebPageProxy::backForwardGoToItem): (WebKit::WebPageProxy::backForwardGoToItemShared): (WebKit::WebPageProxy::learnWord): (WebKit::WebPageProxy::ignoreWord): (WebKit::WebPageProxy::didReceiveEvent): (WebKit::WebPageProxy::editingRangeCallback): (WebKit::WebPageProxy::rectForCharacterRangeCallback): (WebKit::WebPageProxy::focusedFrameChanged): (WebKit::WebPageProxy::frameSetLargestFrameChanged): (WebKit::WebPageProxy::exceededDatabaseQuota): (WebKit::WebPageProxy::requestGeolocationPermissionForFrame): (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): (WebKit::WebPageProxy::enumerateMediaDevicesForFrame): (WebKit::WebPageProxy::startURLSchemeTask): (WebKit::WebPageProxy::startURLSchemeTaskShared): (WebKit::WebPageProxy::stopURLSchemeTask): (WebKit::WebPageProxy::loadSynchronousURLSchemeTask): * UIProcess/WebPageProxy.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240055 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-16 Chris Dumez Regression(r240046) Several API tests are crashing https://bugs.webkit.org/show_bug.cgi?id=193509 Reviewed by Geoffrey Garen. The crashes would happen because loadRequestShared() would take a WebProcessProxy& in parameter but then call reattachToWebProcess() if the page is not valid, which would replace m_process and invalidate our process reference. To address the issue, move the reattachToWebProcess() call to loadRequest(), before calling loadRequestShared(). Also, update *Shared() methods to take a Ref&& instead of a WebProcessProxy& in parameter. Since we call client delegates, we need to make sure our process stays alive. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::loadData): (WebKit::ProvisionalPageProxy::loadRequest): (WebKit::ProvisionalPageProxy::didCreateMainFrame): (WebKit::ProvisionalPageProxy::didPerformClientRedirect): (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData): (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame): (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync): (WebKit::ProvisionalPageProxy::decidePolicyForResponse): (WebKit::ProvisionalPageProxy::startURLSchemeTask): (WebKit::ProvisionalPageProxy::backForwardGoToItem): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadRequest): (WebKit::WebPageProxy::loadRequestWithNavigationShared): (WebKit::WebPageProxy::loadData): (WebKit::WebPageProxy::loadDataWithNavigationShared): (WebKit::WebPageProxy::didPerformDragControllerAction): (WebKit::WebPageProxy::findPlugin): (WebKit::WebPageProxy::didCreateMainFrame): (WebKit::WebPageProxy::didCreateSubframe): (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared): (WebKit::WebPageProxy::willPerformClientRedirectForFrame): (WebKit::WebPageProxy::didCancelClientRedirectForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared): (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::didReceiveTitleForFrame): (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame): (WebKit::WebPageProxy::didDisplayInsecureContentForFrame): (WebKit::WebPageProxy::didRunInsecureContentForFrame): (WebKit::WebPageProxy::frameDidBecomeFrameSet): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNavigationActionSync): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponse): (WebKit::WebPageProxy::decidePolicyForResponseShared): (WebKit::WebPageProxy::unableToImplementPolicy): (WebKit::WebPageProxy::willSubmitForm): (WebKit::WebPageProxy::didNavigateWithNavigationData): (WebKit::WebPageProxy::didNavigateWithNavigationDataShared): (WebKit::WebPageProxy::didPerformClientRedirect): (WebKit::WebPageProxy::didPerformClientRedirectShared): (WebKit::WebPageProxy::didPerformServerRedirect): (WebKit::WebPageProxy::didUpdateHistoryTitle): (WebKit::WebPageProxy::createNewPage): (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): (WebKit::WebPageProxy::unavailablePluginButtonClicked): (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): (WebKit::WebPageProxy::runOpenPanel): (WebKit::WebPageProxy::printFrame): (WebKit::WebPageProxy::backForwardGoToItem): (WebKit::WebPageProxy::backForwardGoToItemShared): (WebKit::WebPageProxy::learnWord): (WebKit::WebPageProxy::ignoreWord): (WebKit::WebPageProxy::didReceiveEvent): (WebKit::WebPageProxy::editingRangeCallback): (WebKit::WebPageProxy::rectForCharacterRangeCallback): (WebKit::WebPageProxy::focusedFrameChanged): (WebKit::WebPageProxy::frameSetLargestFrameChanged): (WebKit::WebPageProxy::exceededDatabaseQuota): (WebKit::WebPageProxy::requestGeolocationPermissionForFrame): (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): (WebKit::WebPageProxy::enumerateMediaDevicesForFrame): (WebKit::WebPageProxy::startURLSchemeTask): (WebKit::WebPageProxy::startURLSchemeTaskShared): (WebKit::WebPageProxy::stopURLSchemeTask): (WebKit::WebPageProxy::loadSynchronousURLSchemeTask): * UIProcess/WebPageProxy.h: 2019-01-22 Alan Coon Cherry-pick r240046. rdar://problem/47099573 Regression(PSON) View becomes blank after click a cross-site download link https://bugs.webkit.org/show_bug.cgi?id=193361 Reviewed by Geoffrey Garen. Source/WebCore: * loader/FrameLoader.cpp: (WebCore::FrameLoader::commitProvisionalLoad): When restoring from PageCache, make sure we notify the client that the load was committed *before* we tell it that the navigation is complete. This would confuse the ProvisionalPageProxy logic in the UIProcess. Source/WebKit: The issue tracked by rdar://problem/47099573 is that a provisional load may get canceled (or converted into a download) *after* we've decided to process-swap. In such cases, the view should keep displaying the current site and it should still be interactive. However, with the previous PSON model, the view (pageProxy) would have already swapped to the new process and would end up displaying the initially empty document. To address the issue, this patch introduces the concept of a provisional load in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the provisional page until after the load was committed in the new process. This means that the view / WebPageProxy keeps using the old process and displays the current content until a load has committed in the provisional page. If no load commits in the provisional process (e.g. because the load is cancelled or converted into a download), then we merely destroy the ProvisionalPageProxy and terminate its process, without impacting the WebPageProxy. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to delay attaching the drawing area in case of a process-swap, no matter what now that the previous process is kept alive until the provisional load is committed in the new process. * Shared/WebPolicyAction.h: Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of process-swap, we now tell the previous process to simply ignore the load, while we create a ProvisionalPageProxy to do the new load in a new process. Suspension of the previous page in the old process, happens later, when a load is actually committed in the new process. * Sources.txt: Add new ProvisionalPageProxy file. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _killWebContentProcessAndResetState]): When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current process and the provisional one, to maintain previous behavior in our API tests. * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/API/gtk/PageClientImpl.h: * UIProcess/API/wpe/PageClientImpl.cpp: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/API/wpe/PageClientImpl.h: * UIProcess/AcceleratedDrawingAreaProxy.cpp: (WebKit::AcceleratedDrawingAreaProxy::AcceleratedDrawingAreaProxy): (WebKit::AcceleratedDrawingAreaProxy::didUpdateBackingStoreState): (WebKit::AcceleratedDrawingAreaProxy::sendUpdateBackingStoreState): (WebKit::AcceleratedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState): (WebKit::AcceleratedDrawingAreaProxy::setNativeSurfaceHandleForCompositing): (WebKit::AcceleratedDrawingAreaProxy::destroyNativeSurfaceHandleForCompositing): * UIProcess/AcceleratedDrawingAreaProxy.h: * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::createDrawingAreaProxy): * UIProcess/DrawingAreaProxy.cpp: (WebKit::DrawingAreaProxy::DrawingAreaProxy): (WebKit::DrawingAreaProxy::~DrawingAreaProxy): (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired): * UIProcess/DrawingAreaProxy.h: (WebKit::DrawingAreaProxy::process): * UIProcess/DrawingAreaProxyImpl.cpp: (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl): (WebKit::DrawingAreaProxyImpl::update): * UIProcess/DrawingAreaProxyImpl.h: * UIProcess/PageClient.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy): (WebKit::RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy): (WebKit::RemoteLayerTreeDrawingAreaProxy::deviceScaleFactorDidChange): (WebKit::RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry): (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidStart): (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidEnd): (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay): (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState): (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing): * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/ios/WKContentView.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView _createDrawingAreaProxy:]): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h: * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: (WebKit::TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy): (WebKit::TiledCoreAnimationDrawingAreaProxy::deviceScaleFactorDidChange): (WebKit::TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange): (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState): (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence): (WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry): (WebKit::TiledCoreAnimationDrawingAreaProxy::adjustTransientZoom): (WebKit::TiledCoreAnimationDrawingAreaProxy::commitTransientZoom): (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing): * UIProcess/mac/WebPageProxyMac.mm: * UIProcess/win/PageClientImpl.cpp: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/win/PageClientImpl.h: * UIProcess/win/PageClientImpl.cpp: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/win/PageClientImpl.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): Pass the drawing area's associated process when constructing it and store it as a member in addition to the page. This is necessary now that a page can be associated with 2 WebProcesses at a time, each having its own drawing area. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): Pass the process. * UIProcess/ProvisionalPageProxy.cpp: Added. (WebKit::ProvisionalPageProxy::ProvisionalPageProxy): (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy): (WebKit::ProvisionalPageProxy::processDidTerminate): (WebKit::ProvisionalPageProxy::takeDrawingArea): (WebKit::ProvisionalPageProxy::cancel): (WebKit::ProvisionalPageProxy::processDidFinishLaunching): (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): (WebKit::ProvisionalPageProxy::initializeWebPage): (WebKit::ProvisionalPageProxy::loadData): (WebKit::ProvisionalPageProxy::loadRequest): (WebKit::ProvisionalPageProxy::goToBackForwardItem): (WebKit::ProvisionalPageProxy::didCreateMainFrame): (WebKit::ProvisionalPageProxy::didPerformClientRedirect): (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didCommitLoadForFrame): (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData): (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame): (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync): (WebKit::ProvisionalPageProxy::decidePolicyForResponse): (WebKit::ProvisionalPageProxy::startURLSchemeTask): (WebKit::ProvisionalPageProxy::backForwardGoToItem): (WebKit::ProvisionalPageProxy::didReceiveMessage): (WebKit::ProvisionalPageProxy::didReceiveSyncMessage): * UIProcess/ProvisionalPageProxy.h: Added. (WebKit::ProvisionalPageProxy::page): (WebKit::ProvisionalPageProxy::mainFrame const): (WebKit::ProvisionalPageProxy::process): (WebKit::ProvisionalPageProxy::processSwapRequestedByClient const): (WebKit::ProvisionalPageProxy::navigationID const): (WebKit::ProvisionalPageProxy::drawingArea const): New WebPageProxy-like class which is owned by the WebPageProxy and proxies IPC from the provisional process. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::~SuspendedPageProxy): (WebKit::SuspendedPageProxy::unsuspend): (WebKit::SuspendedPageProxy::didProcessRequestToSuspend): Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy which tries to register itself as an IPC message receiver for the same pageID when a process-swap occurs and we're switching to a suspended page. * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::isMainFrame const): WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame. Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's m_mainFrame to maintain previous behavior. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::provisionalDrawingArea const): Add getter for the provisional drawing area. We normally only deal with the page's current drawing area, but the ViewGestureController needs access to the provisional once to display the swipe gesture snapshot. (WebKit::WebPageProxy::swapToWebProcess): swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess() later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs to initialize some data members such as the drawing area and the main frame as it is transferring them over from the ProvisionalPageProxy which started the provisional load. (WebKit::WebPageProxy::finishAttachingToWebProcess): We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been committed in the provisional process. (WebKit::WebPageProxy::setDrawingArea): (WebKit::WebPageProxy::initializeWebPage): - We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been committed in the provisional process. - Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess(). (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle): (WebKit::WebPageProxy::loadRequest): (WebKit::WebPageProxy::loadRequestWithNavigationShared): Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not Yes. This avoids hitting some assertions as this was already called during the first API call if needed. (WebKit::WebPageProxy::loadData): (WebKit::WebPageProxy::loadDataWithNavigationShared): (WebKit::WebPageProxy::stopLoading): (WebKit::WebPageProxy::reload): (WebKit::WebPageProxy::didPerformDragControllerAction): (WebKit::WebPageProxy::findPlugin): (WebKit::WebPageProxy::receivedNavigationPolicyDecision): In case of process swap, tell the previous process to ignore the load instead of suspending it right away. Suspension now happens later, only if we end up committing the provisional load in the new process. Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used to happen a bit later but it is clearer if we do this as early as possible I think. (WebKit::WebPageProxy::commitProvisionalPage): When the load is committed in the new process, we call WebPageProxy::commitProvisionalPage(). It takes care of: - Actually swapping the WebPageProxy to the new process by calling processDidTerminate() / swapToWebProcess(). - Suspending the current page. - Letting the client know the load is comitted - Destroy the ProvisionalPageProxy. This work used to happen earlier in continueNavigationInNewProcess(). (WebKit::WebPageProxy::continueNavigationInNewProcess): Moved some of the logic to commitProvisionalPage(). We now merely start the load in a new ProvisionalPageProxy, without actually having the WebPageProxy switch to the new process yet. (WebKit::WebPageProxy::didCreateMainFrame): (WebKit::WebPageProxy::didCreateSubframe): (WebKit::WebPageProxy::didCreateWindow): Drop some code that is no longer needed, now that the ProvisionalPageProxy takes care of this. (WebKit::WebPageProxy::didDestroyNavigation): On process-swap, when telling the previous process to ignore the load and starting the new load in a new ProvisionalPageProxy, the previous WebPage attempts to destroy the navigation. In this case, we ignore the call since the navigation is merely taken over by the ProvisionalPageProxy. (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): Moved some PSON logic to the ProvisionalPageProxy instead. (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared): (WebKit::WebPageProxy::willPerformClientRedirectForFrame): (WebKit::WebPageProxy::didCancelClientRedirectForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared): (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): When didFailProvisionalLoadForFrame() is called for a ProvisionalPageProxy, destroy it. (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::didReceiveTitleForFrame): (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame): (WebKit::WebPageProxy::didDisplayInsecureContentForFrame): (WebKit::WebPageProxy::didRunInsecureContentForFrame): (WebKit::WebPageProxy::frameDidBecomeFrameSet): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNavigationActionSync): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponse): (WebKit::WebPageProxy::decidePolicyForResponseShared): (WebKit::WebPageProxy::unableToImplementPolicy): (WebKit::WebPageProxy::willSubmitForm): (WebKit::WebPageProxy::didNavigateWithNavigationData): (WebKit::WebPageProxy::didNavigateWithNavigationDataShared): (WebKit::WebPageProxy::didPerformClientRedirect): (WebKit::WebPageProxy::didPerformClientRedirectShared): (WebKit::WebPageProxy::didPerformServerRedirect): (WebKit::WebPageProxy::didUpdateHistoryTitle): (WebKit::WebPageProxy::createNewPage): (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): (WebKit::WebPageProxy::unavailablePluginButtonClicked): (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): (WebKit::WebPageProxy::runOpenPanel): (WebKit::WebPageProxy::printFrame): (WebKit::WebPageProxy::backForwardGoToItem): (WebKit::WebPageProxy::backForwardGoToItemShared): (WebKit::WebPageProxy::learnWord): (WebKit::WebPageProxy::ignoreWord): (WebKit::WebPageProxy::didReceiveEvent): (WebKit::WebPageProxy::editingRangeCallback): (WebKit::WebPageProxy::rectForCharacterRangeCallback): (WebKit::WebPageProxy::focusedFrameChanged): (WebKit::WebPageProxy::frameSetLargestFrameChanged): (WebKit::WebPageProxy::provisionalProcessDidTerminate): Cancel the provisiona load and destroy the ProvisionalPageProxy if the provisional process crashes. (WebKit::WebPageProxy::resetState): Drop some code that is no longer needed. (WebKit::WebPageProxy::creationParameters): - Move the hasRegisteredServiceWorkers flag initialization from the call site to here now that we have more than one call site. This was just some bad factoring. - Take the process in parameter now that we page can be associated with several processes at a time. (WebKit::WebPageProxy::exceededDatabaseQuota): (WebKit::WebPageProxy::requestGeolocationPermissionForFrame): (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): (WebKit::WebPageProxy::enumerateMediaDevicesForFrame): (WebKit::WebPageProxy::startURLSchemeTask): (WebKit::WebPageProxy::startURLSchemeTaskShared): (WebKit::WebPageProxy::stopURLSchemeTask): (WebKit::WebPageProxy::loadSynchronousURLSchemeTask): (WebKit::WebPageProxy::checkURLReceivedFromCurrentOrPreviousWebProcess): (WebKit::WebPageProxy::willAcquireUniversalFileReadSandboxExtension): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::visitedLinkStore): (WebKit::WebPageProxy::provisionalPageProxy const): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::hasProvisionalPageWithID const): (WebKit::WebProcessProxy::updateBackForwardItem): (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): (WebKit::WebProcessProxy::didFinishLaunching): (WebKit::WebProcessProxy::canTerminateChildProcess): * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::addProvisionalPageProxy): (WebKit::WebProcessProxy::removeProvisionalPageProxy): Before updating a BackForwardListItem, we normally make sure the process has a WebPageProxy with the item's pageID. We have to tweak the logic because there may now be no WebPageProxy with this pageID associated with this process yet, because it is still a ProvisionalPageProxy. * UIProcess/WebURLSchemeHandler.cpp: (WebKit::WebURLSchemeHandler::startTask): * UIProcess/WebURLSchemeHandler.h: * UIProcess/WebURLSchemeTask.cpp: (WebKit::WebURLSchemeTask::create): (WebKit::WebURLSchemeTask::WebURLSchemeTask): (WebKit::WebURLSchemeTask::didPerformRedirection): (WebKit::WebURLSchemeTask::didReceiveResponse): (WebKit::WebURLSchemeTask::didReceiveData): (WebKit::WebURLSchemeTask::didComplete): (WebKit::WebURLSchemeTask::pageDestroyed): * UIProcess/WebURLSchemeTask.h: Pass the process when constructing a WebURLSchemeTask and store it as a data member in addition to the page. This is necessary now that a WebPageProxy can be associated with several WebProcesses. * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::endSwipeGesture): Use the provisional drawing area to display the swipe snapshot as it may differ from the one currently associated with the page in case of process swap. * WebKit.xcodeproj/project.pbxproj: Add ProvisionalPageProxy class. * WebProcess/WebPage/WebFrame.cpp: (WebKit::toPolicyAction): (WebKit::WebFrame::didReceivePolicyDecision): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_shouldAttachDrawingAreaOnPageTransition): (WebKit::WebPage::reinitializeWebPage): (WebKit::WebPage::didReceivePolicyDecision): Stop dealing with WebPolicyAction::Suspend as it no longer exists. (WebKit::WebPage::didCompletePageTransition): (WebKit::WebPage::setIsSuspended): Suspend the Page when setIsSuspended(true) is called, now that there is no longer a WebPolicyAction::Suspend. setIsSuspended(true) IPC is sent when we actually commit the provisional page. * WebProcess/WebPage/WebPage.h: Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: (-[PSONNavigationDelegate webView:decidePolicyForNavigationResponse:decisionHandler:]): LayoutTests: Skip test testing the cross-process DOMWindow API as I broke it with this patch. The feature is far from ready and off by default anyway. I will add support back in a follow-up. * platform/wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240046 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-16 Chris Dumez Regression(PSON) View becomes blank after click a cross-site download link https://bugs.webkit.org/show_bug.cgi?id=193361 Reviewed by Geoffrey Garen. The issue tracked by rdar://problem/47099573 is that a provisional load may get canceled (or converted into a download) *after* we've decided to process-swap. In such cases, the view should keep displaying the current site and it should still be interactive. However, with the previous PSON model, the view (pageProxy) would have already swapped to the new process and would end up displaying the initially empty document. To address the issue, this patch introduces the concept of a provisional load in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the provisional page until after the load was committed in the new process. This means that the view / WebPageProxy keeps using the old process and displays the current content until a load has committed in the provisional page. If no load commits in the provisional process (e.g. because the load is cancelled or converted into a download), then we merely destroy the ProvisionalPageProxy and terminate its process, without impacting the WebPageProxy. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to delay attaching the drawing area in case of a process-swap, no matter what now that the previous process is kept alive until the provisional load is committed in the new process. * Shared/WebPolicyAction.h: Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of process-swap, we now tell the previous process to simply ignore the load, while we create a ProvisionalPageProxy to do the new load in a new process. Suspension of the previous page in the old process, happens later, when a load is actually committed in the new process. * Sources.txt: Add new ProvisionalPageProxy file. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _killWebContentProcessAndResetState]): When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current process and the provisional one, to maintain previous behavior in our API tests. * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/API/gtk/PageClientImpl.h: * UIProcess/API/wpe/PageClientImpl.cpp: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/API/wpe/PageClientImpl.h: * UIProcess/AcceleratedDrawingAreaProxy.cpp: (WebKit::AcceleratedDrawingAreaProxy::AcceleratedDrawingAreaProxy): (WebKit::AcceleratedDrawingAreaProxy::didUpdateBackingStoreState): (WebKit::AcceleratedDrawingAreaProxy::sendUpdateBackingStoreState): (WebKit::AcceleratedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState): (WebKit::AcceleratedDrawingAreaProxy::setNativeSurfaceHandleForCompositing): (WebKit::AcceleratedDrawingAreaProxy::destroyNativeSurfaceHandleForCompositing): * UIProcess/AcceleratedDrawingAreaProxy.h: * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::createDrawingAreaProxy): * UIProcess/DrawingAreaProxy.cpp: (WebKit::DrawingAreaProxy::DrawingAreaProxy): (WebKit::DrawingAreaProxy::~DrawingAreaProxy): (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired): * UIProcess/DrawingAreaProxy.h: (WebKit::DrawingAreaProxy::process): * UIProcess/DrawingAreaProxyImpl.cpp: (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl): (WebKit::DrawingAreaProxyImpl::update): * UIProcess/DrawingAreaProxyImpl.h: * UIProcess/PageClient.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy): (WebKit::RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy): (WebKit::RemoteLayerTreeDrawingAreaProxy::deviceScaleFactorDidChange): (WebKit::RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry): (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidStart): (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidEnd): (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay): (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState): (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing): * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/ios/WKContentView.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView _createDrawingAreaProxy:]): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h: * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: (WebKit::TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy): (WebKit::TiledCoreAnimationDrawingAreaProxy::deviceScaleFactorDidChange): (WebKit::TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange): (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState): (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence): (WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry): (WebKit::TiledCoreAnimationDrawingAreaProxy::adjustTransientZoom): (WebKit::TiledCoreAnimationDrawingAreaProxy::commitTransientZoom): (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing): * UIProcess/mac/WebPageProxyMac.mm: * UIProcess/win/PageClientImpl.cpp: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/win/PageClientImpl.h: * UIProcess/win/PageClientImpl.cpp: (WebKit::PageClientImpl::createDrawingAreaProxy): * UIProcess/win/PageClientImpl.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): Pass the drawing area's associated process when constructing it and store it as a member in addition to the page. This is necessary now that a page can be associated with 2 WebProcesses at a time, each having its own drawing area. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): Pass the process. * UIProcess/ProvisionalPageProxy.cpp: Added. (WebKit::ProvisionalPageProxy::ProvisionalPageProxy): (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy): (WebKit::ProvisionalPageProxy::processDidTerminate): (WebKit::ProvisionalPageProxy::takeDrawingArea): (WebKit::ProvisionalPageProxy::cancel): (WebKit::ProvisionalPageProxy::processDidFinishLaunching): (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): (WebKit::ProvisionalPageProxy::initializeWebPage): (WebKit::ProvisionalPageProxy::loadData): (WebKit::ProvisionalPageProxy::loadRequest): (WebKit::ProvisionalPageProxy::goToBackForwardItem): (WebKit::ProvisionalPageProxy::didCreateMainFrame): (WebKit::ProvisionalPageProxy::didPerformClientRedirect): (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didCommitLoadForFrame): (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData): (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame): (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync): (WebKit::ProvisionalPageProxy::decidePolicyForResponse): (WebKit::ProvisionalPageProxy::startURLSchemeTask): (WebKit::ProvisionalPageProxy::backForwardGoToItem): (WebKit::ProvisionalPageProxy::didReceiveMessage): (WebKit::ProvisionalPageProxy::didReceiveSyncMessage): * UIProcess/ProvisionalPageProxy.h: Added. (WebKit::ProvisionalPageProxy::page): (WebKit::ProvisionalPageProxy::mainFrame const): (WebKit::ProvisionalPageProxy::process): (WebKit::ProvisionalPageProxy::processSwapRequestedByClient const): (WebKit::ProvisionalPageProxy::navigationID const): (WebKit::ProvisionalPageProxy::drawingArea const): New WebPageProxy-like class which is owned by the WebPageProxy and proxies IPC from the provisional process. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::~SuspendedPageProxy): (WebKit::SuspendedPageProxy::unsuspend): (WebKit::SuspendedPageProxy::didProcessRequestToSuspend): Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy which tries to register itself as an IPC message receiver for the same pageID when a process-swap occurs and we're switching to a suspended page. * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::isMainFrame const): WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame. Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's m_mainFrame to maintain previous behavior. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::provisionalDrawingArea const): Add getter for the provisional drawing area. We normally only deal with the page's current drawing area, but the ViewGestureController needs access to the provisional once to display the swipe gesture snapshot. (WebKit::WebPageProxy::swapToWebProcess): swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess() later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs to initialize some data members such as the drawing area and the main frame as it is transferring them over from the ProvisionalPageProxy which started the provisional load. (WebKit::WebPageProxy::finishAttachingToWebProcess): We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been committed in the provisional process. (WebKit::WebPageProxy::setDrawingArea): (WebKit::WebPageProxy::initializeWebPage): - We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been committed in the provisional process. - Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess(). (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle): (WebKit::WebPageProxy::loadRequest): (WebKit::WebPageProxy::loadRequestWithNavigationShared): Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not Yes. This avoids hitting some assertions as this was already called during the first API call if needed. (WebKit::WebPageProxy::loadData): (WebKit::WebPageProxy::loadDataWithNavigationShared): (WebKit::WebPageProxy::stopLoading): (WebKit::WebPageProxy::reload): (WebKit::WebPageProxy::didPerformDragControllerAction): (WebKit::WebPageProxy::findPlugin): (WebKit::WebPageProxy::receivedNavigationPolicyDecision): In case of process swap, tell the previous process to ignore the load instead of suspending it right away. Suspension now happens later, only if we end up committing the provisional load in the new process. Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used to happen a bit later but it is clearer if we do this as early as possible I think. (WebKit::WebPageProxy::commitProvisionalPage): When the load is committed in the new process, we call WebPageProxy::commitProvisionalPage(). It takes care of: - Actually swapping the WebPageProxy to the new process by calling processDidTerminate() / swapToWebProcess(). - Suspending the current page. - Letting the client know the load is comitted - Destroy the ProvisionalPageProxy. This work used to happen earlier in continueNavigationInNewProcess(). (WebKit::WebPageProxy::continueNavigationInNewProcess): Moved some of the logic to commitProvisionalPage(). We now merely start the load in a new ProvisionalPageProxy, without actually having the WebPageProxy switch to the new process yet. (WebKit::WebPageProxy::didCreateMainFrame): (WebKit::WebPageProxy::didCreateSubframe): (WebKit::WebPageProxy::didCreateWindow): Drop some code that is no longer needed, now that the ProvisionalPageProxy takes care of this. (WebKit::WebPageProxy::didDestroyNavigation): On process-swap, when telling the previous process to ignore the load and starting the new load in a new ProvisionalPageProxy, the previous WebPage attempts to destroy the navigation. In this case, we ignore the call since the navigation is merely taken over by the ProvisionalPageProxy. (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): Moved some PSON logic to the ProvisionalPageProxy instead. (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared): (WebKit::WebPageProxy::willPerformClientRedirectForFrame): (WebKit::WebPageProxy::didCancelClientRedirectForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared): (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): When didFailProvisionalLoadForFrame() is called for a ProvisionalPageProxy, destroy it. (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::didReceiveTitleForFrame): (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame): (WebKit::WebPageProxy::didDisplayInsecureContentForFrame): (WebKit::WebPageProxy::didRunInsecureContentForFrame): (WebKit::WebPageProxy::frameDidBecomeFrameSet): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNavigationActionSync): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponse): (WebKit::WebPageProxy::decidePolicyForResponseShared): (WebKit::WebPageProxy::unableToImplementPolicy): (WebKit::WebPageProxy::willSubmitForm): (WebKit::WebPageProxy::didNavigateWithNavigationData): (WebKit::WebPageProxy::didNavigateWithNavigationDataShared): (WebKit::WebPageProxy::didPerformClientRedirect): (WebKit::WebPageProxy::didPerformClientRedirectShared): (WebKit::WebPageProxy::didPerformServerRedirect): (WebKit::WebPageProxy::didUpdateHistoryTitle): (WebKit::WebPageProxy::createNewPage): (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): (WebKit::WebPageProxy::unavailablePluginButtonClicked): (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): (WebKit::WebPageProxy::runOpenPanel): (WebKit::WebPageProxy::printFrame): (WebKit::WebPageProxy::backForwardGoToItem): (WebKit::WebPageProxy::backForwardGoToItemShared): (WebKit::WebPageProxy::learnWord): (WebKit::WebPageProxy::ignoreWord): (WebKit::WebPageProxy::didReceiveEvent): (WebKit::WebPageProxy::editingRangeCallback): (WebKit::WebPageProxy::rectForCharacterRangeCallback): (WebKit::WebPageProxy::focusedFrameChanged): (WebKit::WebPageProxy::frameSetLargestFrameChanged): (WebKit::WebPageProxy::provisionalProcessDidTerminate): Cancel the provisiona load and destroy the ProvisionalPageProxy if the provisional process crashes. (WebKit::WebPageProxy::resetState): Drop some code that is no longer needed. (WebKit::WebPageProxy::creationParameters): - Move the hasRegisteredServiceWorkers flag initialization from the call site to here now that we have more than one call site. This was just some bad factoring. - Take the process in parameter now that we page can be associated with several processes at a time. (WebKit::WebPageProxy::exceededDatabaseQuota): (WebKit::WebPageProxy::requestGeolocationPermissionForFrame): (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): (WebKit::WebPageProxy::enumerateMediaDevicesForFrame): (WebKit::WebPageProxy::startURLSchemeTask): (WebKit::WebPageProxy::startURLSchemeTaskShared): (WebKit::WebPageProxy::stopURLSchemeTask): (WebKit::WebPageProxy::loadSynchronousURLSchemeTask): (WebKit::WebPageProxy::checkURLReceivedFromCurrentOrPreviousWebProcess): (WebKit::WebPageProxy::willAcquireUniversalFileReadSandboxExtension): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::visitedLinkStore): (WebKit::WebPageProxy::provisionalPageProxy const): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::hasProvisionalPageWithID const): (WebKit::WebProcessProxy::updateBackForwardItem): (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): (WebKit::WebProcessProxy::didFinishLaunching): (WebKit::WebProcessProxy::canTerminateChildProcess): * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::addProvisionalPageProxy): (WebKit::WebProcessProxy::removeProvisionalPageProxy): Before updating a BackForwardListItem, we normally make sure the process has a WebPageProxy with the item's pageID. We have to tweak the logic because there may now be no WebPageProxy with this pageID associated with this process yet, because it is still a ProvisionalPageProxy. * UIProcess/WebURLSchemeHandler.cpp: (WebKit::WebURLSchemeHandler::startTask): * UIProcess/WebURLSchemeHandler.h: * UIProcess/WebURLSchemeTask.cpp: (WebKit::WebURLSchemeTask::create): (WebKit::WebURLSchemeTask::WebURLSchemeTask): (WebKit::WebURLSchemeTask::didPerformRedirection): (WebKit::WebURLSchemeTask::didReceiveResponse): (WebKit::WebURLSchemeTask::didReceiveData): (WebKit::WebURLSchemeTask::didComplete): (WebKit::WebURLSchemeTask::pageDestroyed): * UIProcess/WebURLSchemeTask.h: Pass the process when constructing a WebURLSchemeTask and store it as a data member in addition to the page. This is necessary now that a WebPageProxy can be associated with several WebProcesses. * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::endSwipeGesture): Use the provisional drawing area to display the swipe snapshot as it may differ from the one currently associated with the page in case of process swap. * WebKit.xcodeproj/project.pbxproj: Add ProvisionalPageProxy class. * WebProcess/WebPage/WebFrame.cpp: (WebKit::toPolicyAction): (WebKit::WebFrame::didReceivePolicyDecision): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_shouldAttachDrawingAreaOnPageTransition): (WebKit::WebPage::reinitializeWebPage): (WebKit::WebPage::didReceivePolicyDecision): Stop dealing with WebPolicyAction::Suspend as it no longer exists. (WebKit::WebPage::didCompletePageTransition): (WebKit::WebPage::setIsSuspended): Suspend the Page when setIsSuspended(true) is called, now that there is no longer a WebPolicyAction::Suspend. setIsSuspended(true) IPC is sent when we actually commit the provisional page. * WebProcess/WebPage/WebPage.h: 2019-01-22 Alan Coon Cherry-pick r240015. rdar://problem/47099573 Unreviewed, rolling out r239993, r239995, r239997, and r239999. Caused assertions under ViewGestureController::disconnectFromProcess() Reverted changesets: "Regression(PSON) View becomes blank after click a cross-site download link" https://bugs.webkit.org/show_bug.cgi?id=193361 https://trac.webkit.org/changeset/239993 "Unreviewed iOS build fix after r239993." https://trac.webkit.org/changeset/239995 "Fix iOS build after r239993" https://bugs.webkit.org/show_bug.cgi?id=193361 https://trac.webkit.org/changeset/239997 "Unreviewed, revert part of r239997 as it is not needed to fix the build." https://trac.webkit.org/changeset/239999 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240015 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-15 Chris Dumez Unreviewed, rolling out r239993, r239995, r239997, and r239999. Caused assertions under ViewGestureController::disconnectFromProcess() Reverted changesets: "Regression(PSON) View becomes blank after click a cross-site download link" https://bugs.webkit.org/show_bug.cgi?id=193361 https://trac.webkit.org/changeset/239993 "Unreviewed iOS build fix after r239993." https://trac.webkit.org/changeset/239995 "Fix iOS build after r239993" https://bugs.webkit.org/show_bug.cgi?id=193361 https://trac.webkit.org/changeset/239997 "Unreviewed, revert part of r239997 as it is not needed to fix the build." https://trac.webkit.org/changeset/239999 2019-01-22 Alan Coon Cherry-pick r239997. rdar://problem/47099573 Fix iOS build after r239993 https://bugs.webkit.org/show_bug.cgi?id=193361 Source/WebKit: * UIProcess/ProvisionalPageProxy.h: * UIProcess/SuspendedPageProxy.h: Source/WTF: * wtf/RefCounter.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239997 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-15 Alex Christensen Fix iOS build after r239993 https://bugs.webkit.org/show_bug.cgi?id=193361 * UIProcess/ProvisionalPageProxy.h: * UIProcess/SuspendedPageProxy.h: 2019-01-22 Alan Coon Cherry-pick r239995. rdar://problem/47099573 Unreviewed iOS build fix after r239993. * UIProcess/SuspendedPageProxy.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239995 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-15 Chris Dumez Unreviewed iOS build fix after r239993. * UIProcess/SuspendedPageProxy.h: 2019-01-22 Alan Coon Cherry-pick r239993. rdar://problem/47099573 Regression(PSON) View becomes blank after click a cross-site download link https://bugs.webkit.org/show_bug.cgi?id=193361 Reviewed by Geoff Garen. Source/WebCore: * loader/FrameLoader.cpp: (WebCore::FrameLoader::commitProvisionalLoad): When restoring from PageCache, make sure we notify the client that the load was committed *before* we tell it that the navigation is complete. This would confuse the ProvisionalPageProxy logic in the UIProcess. Source/WebKit: The issue tracked by rdar://problem/47099573 is that a provisional load may get canceled (or converted into a download) *after* we've decided to process-swap. In such cases, the view should keep displaying the current site and it should still be interactive. However, with the previous PSON model, the view (pageProxy) would have already swapped to the new process and would end up displaying the initially empty document. To address the issue, this patch introduces the concept of a provisional load in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the provisional page until after the load was committed in the new process. This means that the view / WebPageProxy keeps using the old process and displays the current content until a load has committed in the provisional page. If no load commits in the provisional process (e.g. because the load is cancelled or converted into a download), then we merely destroy the ProvisionalPageProxy and terminate its process, without impacting the WebPageProxy. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to delay attaching the drawing area in case of a process-swap, no matter what now that the previous process is kept alive until the provisional load is committed in the new process. * Shared/WebPolicyAction.h: Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of process-swap, we now tell the previous process to simply ignore the load, while we create a ProvisionalPageProxy to do the new load in a new process. Suspension of the previous page in the old process, happens later, when a load is actually committed in the new process. * Sources.txt: Add new ProvisionalPageProxy file. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _killWebContentProcessAndResetState]): When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current process and the provisional one, to maintain previous behavior in our API tests. * UIProcess/PageClient.h: Tiny build fix. * UIProcess/ProvisionalPageProxy.cpp: Added. (WebKit::ProvisionalPageProxy::ProvisionalPageProxy): (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy): (WebKit::ProvisionalPageProxy::takeDrawingArea): (WebKit::ProvisionalPageProxy::cancel): (WebKit::ProvisionalPageProxy::initializeWebPage): (WebKit::ProvisionalPageProxy::loadDataWithNavigation): (WebKit::ProvisionalPageProxy::loadRequestWithNavigation): (WebKit::ProvisionalPageProxy::goToBackForwardItem): (WebKit::ProvisionalPageProxy::didCreateMainFrame): (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didCommitLoadForFrame): (WebKit::ProvisionalPageProxy::didReceiveMessage): (WebKit::ProvisionalPageProxy::didReceiveSyncMessage): * UIProcess/ProvisionalPageProxy.h: Added. (WebKit::ProvisionalPageProxy::page): (WebKit::ProvisionalPageProxy::mainFrame const): (WebKit::ProvisionalPageProxy::process): (WebKit::ProvisionalPageProxy::processSwapRequestedByClient const): (WebKit::ProvisionalPageProxy::navigationID const): Add new ProvisionalPageProxy class to wrap the provisional load in the new process after a swap. The provisional page is owned by the WebPageProxy and we only commit the provisional page when the load is committed. Until then, the WebPageProxy keeps using the old process and displaying the current content. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::~SuspendedPageProxy): (WebKit::SuspendedPageProxy::unsuspend): (WebKit::SuspendedPageProxy::didProcessRequestToSuspend): Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy which tries to register itself as an IPC message receiver for the same pageID when a process-swap occurs and we're switching to a suspended page. * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::isMainFrame const): WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame. Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's m_mainFrame to maintain previous behavior. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::swapToWebProcess): swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess() later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs to initialize some data members such as the drawing area and the main frame as it is transferring them over from the ProvisionalPageProxy which started the provisional load. (WebKit::WebPageProxy::finishAttachingToWebProcess): We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been committed in the provisional process. (WebKit::WebPageProxy::initializeWebPage): - We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been committed in the provisional process. - Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess(). (WebKit::WebPageProxy::loadRequestWithNavigation): Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not Yes. This avoids hitting some assertions as this was already called during the first API call if needed. (WebKit::WebPageProxy::receivedNavigationPolicyDecision): In case of process swap, tell the previous process to ignore the load instead of suspending it right away. Suspension now happens later, only if we end up committing the provisional load in the new process. Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used to happen a bit later but it is clearer if we do this as early as possible I think. (WebKit::WebPageProxy::commitProvisionalPage): When the load is committed in the new process, we call WebPageProxy::commitProvisionalPage(). It takes care of: - Actually swapping the WebPageProxy to the new process by calling processDidTerminate() / swapToWebProcess(). - Suspending the current page. - Letting the client know the load is comitted - Destroy the ProvisionalPageProxy. This work used to happen earlier in continueNavigationInNewProcess(). (WebKit::WebPageProxy::continueNavigationInNewProcess): Moved some of the logic to commitProvisionalPage(). We now merely start the load in a new ProvisionalPageProxy, without actually having the WebPageProxy switch to the new process yet. (WebKit::WebPageProxy::didCreateMainFrame): (WebKit::WebPageProxy::didCreateWindow): Drop some code that is no longer needed, now that the ProvisionalPageProxy takes care of this. (WebKit::WebPageProxy::didDestroyNavigation): On process-swap, when telling the previous process to ignore the load and starting the new load in a new ProvisionalPageProxy, the previous WebPage attempts to destroy the navigation. In this case, we ignore the call since the navigation is merely taken over by the ProvisionalPageProxy. (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): Moved some PSON logic to the ProvisionalPageProxy instead. (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): When didFailProvisionalLoadForFrame() is called for a ProvisionalPageProxy, destroy it. (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync): (WebKit::WebPageProxy::decidePolicyForResponse): Capture the process in the lambda, to make sure we send the policy decision to the same process that asked for it, so as to not get confused by process swaps. (WebKit::WebPageProxy::resetState): Drop some code that is no longer needed. (WebKit::WebPageProxy::creationParameters): Move the hasRegisteredServiceWorkers flag initialization from the call site to here now that we have more than one call site. This was just some bad factoring. (WebKit::WebPageProxy::PageProcessOverride::PageProcessOverride): (WebKit::WebPageProxy::PageProcessOverride::~PageProcessOverride): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::temporarilyOverrideProcess): Add utility class to temporarily override the WebPageProxy's m_process with the provisional one when the ProvisionalPageProxy interacts with the WebPageProxy. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::hasProvisionalPageWithID const): (WebKit::WebProcessProxy::updateBackForwardItem): Before updating a BackForwardListItem, we normally make sure the process has a WebPageProxy with the item's pageID. We have to tweak the logic because there may now be no WebPageProxy with this pageID associated with this process yet, because it is still a ProvisionalPageProxy. (WebKit::WebProcessProxy::canTerminateChildProcess): Do not terminate the WebProcess if there are ProvisionalPageProxy objects using it. * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::addProvisionalPageProxy): (WebKit::WebProcessProxy::removeProvisionalPageProxy): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebFrame.cpp: (WebKit::toPolicyAction): (WebKit::WebFrame::didReceivePolicyDecision): Stop dealing with WebPolicyAction::Suspend as it no longer exists. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::reinitializeWebPage): (WebKit::WebPage::didReceivePolicyDecision): (WebKit::WebPage::setIsSuspended): Suspend the Page when setIsSuspended(true) is called, now that there is no longer a WebPolicyAction::Suspend. setIsSuspended(true) IPC is sent when we actually commit the provisional page. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: (-[PSONNavigationDelegate webView:decidePolicyForNavigationResponse:decisionHandler:]): LayoutTests: Skip test testing the cross-process DOMWindow API as I broke it with this patch. The feature is far from ready and off by default anyway. I will add support back in a follow-up. * platform/wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239993 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-15 Chris Dumez Regression(PSON) View becomes blank after click a cross-site download link https://bugs.webkit.org/show_bug.cgi?id=193361 Reviewed by Geoff Garen. The issue tracked by rdar://problem/47099573 is that a provisional load may get canceled (or converted into a download) *after* we've decided to process-swap. In such cases, the view should keep displaying the current site and it should still be interactive. However, with the previous PSON model, the view (pageProxy) would have already swapped to the new process and would end up displaying the initially empty document. To address the issue, this patch introduces the concept of a provisional load in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the provisional page until after the load was committed in the new process. This means that the view / WebPageProxy keeps using the old process and displays the current content until a load has committed in the provisional page. If no load commits in the provisional process (e.g. because the load is cancelled or converted into a download), then we merely destroy the ProvisionalPageProxy and terminate its process, without impacting the WebPageProxy. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to delay attaching the drawing area in case of a process-swap, no matter what now that the previous process is kept alive until the provisional load is committed in the new process. * Shared/WebPolicyAction.h: Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of process-swap, we now tell the previous process to simply ignore the load, while we create a ProvisionalPageProxy to do the new load in a new process. Suspension of the previous page in the old process, happens later, when a load is actually committed in the new process. * Sources.txt: Add new ProvisionalPageProxy file. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _killWebContentProcessAndResetState]): When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current process and the provisional one, to maintain previous behavior in our API tests. * UIProcess/PageClient.h: Tiny build fix. * UIProcess/ProvisionalPageProxy.cpp: Added. (WebKit::ProvisionalPageProxy::ProvisionalPageProxy): (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy): (WebKit::ProvisionalPageProxy::takeDrawingArea): (WebKit::ProvisionalPageProxy::cancel): (WebKit::ProvisionalPageProxy::initializeWebPage): (WebKit::ProvisionalPageProxy::loadDataWithNavigation): (WebKit::ProvisionalPageProxy::loadRequestWithNavigation): (WebKit::ProvisionalPageProxy::goToBackForwardItem): (WebKit::ProvisionalPageProxy::didCreateMainFrame): (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didCommitLoadForFrame): (WebKit::ProvisionalPageProxy::didReceiveMessage): (WebKit::ProvisionalPageProxy::didReceiveSyncMessage): * UIProcess/ProvisionalPageProxy.h: Added. (WebKit::ProvisionalPageProxy::page): (WebKit::ProvisionalPageProxy::mainFrame const): (WebKit::ProvisionalPageProxy::process): (WebKit::ProvisionalPageProxy::processSwapRequestedByClient const): (WebKit::ProvisionalPageProxy::navigationID const): Add new ProvisionalPageProxy class to wrap the provisional load in the new process after a swap. The provisional page is owned by the WebPageProxy and we only commit the provisional page when the load is committed. Until then, the WebPageProxy keeps using the old process and displaying the current content. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::~SuspendedPageProxy): (WebKit::SuspendedPageProxy::unsuspend): (WebKit::SuspendedPageProxy::didProcessRequestToSuspend): Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy which tries to register itself as an IPC message receiver for the same pageID when a process-swap occurs and we're switching to a suspended page. * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::isMainFrame const): WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame. Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's m_mainFrame to maintain previous behavior. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::swapToWebProcess): swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess() later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs to initialize some data members such as the drawing area and the main frame as it is transferring them over from the ProvisionalPageProxy which started the provisional load. (WebKit::WebPageProxy::finishAttachingToWebProcess): We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been committed in the provisional process. (WebKit::WebPageProxy::initializeWebPage): - We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been committed in the provisional process. - Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess(). (WebKit::WebPageProxy::loadRequestWithNavigation): Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not Yes. This avoids hitting some assertions as this was already called during the first API call if needed. (WebKit::WebPageProxy::receivedNavigationPolicyDecision): In case of process swap, tell the previous process to ignore the load instead of suspending it right away. Suspension now happens later, only if we end up committing the provisional load in the new process. Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used to happen a bit later but it is clearer if we do this as early as possible I think. (WebKit::WebPageProxy::commitProvisionalPage): When the load is committed in the new process, we call WebPageProxy::commitProvisionalPage(). It takes care of: - Actually swapping the WebPageProxy to the new process by calling processDidTerminate() / swapToWebProcess(). - Suspending the current page. - Letting the client know the load is comitted - Destroy the ProvisionalPageProxy. This work used to happen earlier in continueNavigationInNewProcess(). (WebKit::WebPageProxy::continueNavigationInNewProcess): Moved some of the logic to commitProvisionalPage(). We now merely start the load in a new ProvisionalPageProxy, without actually having the WebPageProxy switch to the new process yet. (WebKit::WebPageProxy::didCreateMainFrame): (WebKit::WebPageProxy::didCreateWindow): Drop some code that is no longer needed, now that the ProvisionalPageProxy takes care of this. (WebKit::WebPageProxy::didDestroyNavigation): On process-swap, when telling the previous process to ignore the load and starting the new load in a new ProvisionalPageProxy, the previous WebPage attempts to destroy the navigation. In this case, we ignore the call since the navigation is merely taken over by the ProvisionalPageProxy. (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): Moved some PSON logic to the ProvisionalPageProxy instead. (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): When didFailProvisionalLoadForFrame() is called for a ProvisionalPageProxy, destroy it. (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync): (WebKit::WebPageProxy::decidePolicyForResponse): Capture the process in the lambda, to make sure we send the policy decision to the same process that asked for it, so as to not get confused by process swaps. (WebKit::WebPageProxy::resetState): Drop some code that is no longer needed. (WebKit::WebPageProxy::creationParameters): Move the hasRegisteredServiceWorkers flag initialization from the call site to here now that we have more than one call site. This was just some bad factoring. (WebKit::WebPageProxy::PageProcessOverride::PageProcessOverride): (WebKit::WebPageProxy::PageProcessOverride::~PageProcessOverride): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::temporarilyOverrideProcess): Add utility class to temporarily override the WebPageProxy's m_process with the provisional one when the ProvisionalPageProxy interacts with the WebPageProxy. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::hasProvisionalPageWithID const): (WebKit::WebProcessProxy::updateBackForwardItem): Before updating a BackForwardListItem, we normally make sure the process has a WebPageProxy with the item's pageID. We have to tweak the logic because there may now be no WebPageProxy with this pageID associated with this process yet, because it is still a ProvisionalPageProxy. (WebKit::WebProcessProxy::canTerminateChildProcess): Do not terminate the WebProcess if there are ProvisionalPageProxy objects using it. * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::addProvisionalPageProxy): (WebKit::WebProcessProxy::removeProvisionalPageProxy): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebFrame.cpp: (WebKit::toPolicyAction): (WebKit::WebFrame::didReceivePolicyDecision): Stop dealing with WebPolicyAction::Suspend as it no longer exists. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::reinitializeWebPage): (WebKit::WebPage::didReceivePolicyDecision): (WebKit::WebPage::setIsSuspended): Suspend the Page when setIsSuspended(true) is called, now that there is no longer a WebPolicyAction::Suspend. setIsSuspended(true) IPC is sent when we actually commit the provisional page. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): 2019-01-18 Tim Horton REGRESSION (r236935): Holding down arrow key does not cause repeated DOM keydown events on device https://bugs.webkit.org/show_bug.cgi?id=191408 Rubber-stamped by Simon Fraser. * SourcesCocoa.txt: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _scrollByContentOffset:]): * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): (-[WKContentView cleanupInteraction]): (-[WKContentView scrollViewWillStartPanOrPinchGesture]): (-[WKContentView canPerformActionForWebView:withSender:]): (-[WKContentView keyCommands]): (-[WKContentView _arrowKeyForWebView:]): (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): (-[WKContentView _scrollOffsetForEvent:]): (-[WKContentView _interpretKeyEvent:isCharEvent:]): (-[WKContentView isScrollableForKeyboardScrollViewAnimator:]): Deleted. (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:]): Deleted. (-[WKContentView keyboardScrollViewAnimatorWillScroll:]): Deleted. (-[WKContentView keyboardScrollViewAnimatorDidFinishScrolling:]): Deleted. * UIProcess/ios/WKKeyboardScrollingAnimator.h: Removed. * UIProcess/ios/WKKeyboardScrollingAnimator.mm: Removed. * UIProcess/ios/WKPDFView.mm: (-[WKPDFView dealloc]): (-[WKPDFView web_handleKeyEvent:]): (-[WKPDFView web_initWithFrame:webView:mimeType:]): * WebKit.xcodeproj/project.pbxproj: Revert WKKeyboardScrollingAnimator. 2019-01-16 Alan Coon Apply patch. rdar://problem/47260377 Cherry-pick r239887. rdar://problem/47260377 IndexedDB: leak WebIDBConnectionToClient for retain cycle https://bugs.webkit.org/show_bug.cgi?id=193097 Reviewed by Brady Eidson. Source/WebCore: Let IDBConnectionToClient hold a WeakPtr of IDBConnectionToClientDelegate. * Modules/indexeddb/server/IDBConnectionToClient.cpp: (WebCore::IDBServer::IDBConnectionToClient::IDBConnectionToClient): (WebCore::IDBServer::IDBConnectionToClient::identifier const): (WebCore::IDBServer::IDBConnectionToClient::didDeleteDatabase): (WebCore::IDBServer::IDBConnectionToClient::didOpenDatabase): (WebCore::IDBServer::IDBConnectionToClient::didAbortTransaction): (WebCore::IDBServer::IDBConnectionToClient::didCreateObjectStore): (WebCore::IDBServer::IDBConnectionToClient::didDeleteObjectStore): (WebCore::IDBServer::IDBConnectionToClient::didRenameObjectStore): (WebCore::IDBServer::IDBConnectionToClient::didClearObjectStore): (WebCore::IDBServer::IDBConnectionToClient::didCreateIndex): (WebCore::IDBServer::IDBConnectionToClient::didDeleteIndex): (WebCore::IDBServer::IDBConnectionToClient::didRenameIndex): (WebCore::IDBServer::IDBConnectionToClient::didPutOrAdd): (WebCore::IDBServer::IDBConnectionToClient::didGetRecord): (WebCore::IDBServer::IDBConnectionToClient::didGetAllRecords): (WebCore::IDBServer::IDBConnectionToClient::didGetCount): (WebCore::IDBServer::IDBConnectionToClient::didDeleteRecord): (WebCore::IDBServer::IDBConnectionToClient::didOpenCursor): (WebCore::IDBServer::IDBConnectionToClient::didIterateCursor): (WebCore::IDBServer::IDBConnectionToClient::didCommitTransaction): (WebCore::IDBServer::IDBConnectionToClient::fireVersionChangeEvent): (WebCore::IDBServer::IDBConnectionToClient::didStartTransaction): (WebCore::IDBServer::IDBConnectionToClient::didCloseFromServer): (WebCore::IDBServer::IDBConnectionToClient::notifyOpenDBRequestBlocked): (WebCore::IDBServer::IDBConnectionToClient::didGetAllDatabaseNames): * Modules/indexeddb/server/IDBConnectionToClient.h: * Modules/indexeddb/server/IDBConnectionToClientDelegate.h: Source/WebKit: Let WebIDBConnectionToClient hold reference to IPC::Connection instead of NetworkConnectionToWebProcess to break the cycle. * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: (WebKit::WebIDBConnectionToClient::create): (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient): (WebKit::WebIDBConnectionToClient::messageSenderConnection): * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@239887 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-16 David Kilzer Cherry-pick r239887. rdar://problem/47260377 2019-01-11 Sihui Liu IndexedDB: leak WebIDBConnectionToClient for retain cycle https://bugs.webkit.org/show_bug.cgi?id=193097 Reviewed by Brady Eidson. Let WebIDBConnectionToClient hold reference to IPC::Connection instead of NetworkConnectionToWebProcess to break the cycle. * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: (WebKit::WebIDBConnectionToClient::create): (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient): (WebKit::WebIDBConnectionToClient::messageSenderConnection): * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer): 2019-01-16 Alan Coon Cherry-pick r239852. rdar://problem/47260195 [WebAuthN] Change the nonce in the CTAP kInit command to weak random values https://bugs.webkit.org/show_bug.cgi?id=192061 Reviewed by Chris Dumez. Change the nonce in the CTAP kInit command to weak random values as the nonce is mainly for being a probabilistically unique global identifier for hand shakes, instead of preventing replay attacks. Otherwise, it might exhaust system entropy unnecessarily. The patch also removes all logging when debugging the test case flakiness. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::respondReceived): (WebKit::AuthenticatorManager::initTimeOutTimer): (WebKit::AuthenticatorManager::timeOutTimerFired): * UIProcess/WebAuthentication/Cocoa/HidService.mm: (WebKit::HidService::deviceAdded): * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: (WebKit::MockAuthenticatorManager::respondReceivedInternal): * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::send): * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp: (WebKit::CtapHidAuthenticator::makeCredential): (WebKit::CtapHidAuthenticator::getAssertion): * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp: (WebKit::CtapHidDriver::Worker::write): (WebKit::CtapHidDriver::Worker::read): (WebKit::CtapHidDriver::Worker::returnMessage): (WebKit::CtapHidDriver::transact): (WebKit::CtapHidDriver::continueAfterChannelAllocated): (WebKit::CtapHidDriver::continueAfterResponseReceived): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239852 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-10 Jiewen Tan [WebAuthN] Change the nonce in the CTAP kInit command to weak random values https://bugs.webkit.org/show_bug.cgi?id=192061 Reviewed by Chris Dumez. Change the nonce in the CTAP kInit command to weak random values as the nonce is mainly for being a probabilistically unique global identifier for hand shakes, instead of preventing replay attacks. Otherwise, it might exhaust system entropy unnecessarily. The patch also removes all logging when debugging the test case flakiness. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::respondReceived): (WebKit::AuthenticatorManager::initTimeOutTimer): (WebKit::AuthenticatorManager::timeOutTimerFired): * UIProcess/WebAuthentication/Cocoa/HidService.mm: (WebKit::HidService::deviceAdded): * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: (WebKit::MockAuthenticatorManager::respondReceivedInternal): * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::send): * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp: (WebKit::CtapHidAuthenticator::makeCredential): (WebKit::CtapHidAuthenticator::getAssertion): * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp: (WebKit::CtapHidDriver::Worker::write): (WebKit::CtapHidDriver::Worker::read): (WebKit::CtapHidDriver::Worker::returnMessage): (WebKit::CtapHidDriver::transact): (WebKit::CtapHidDriver::continueAfterChannelAllocated): (WebKit::CtapHidDriver::continueAfterResponseReceived): 2019-01-16 Alan Coon Cherry-pick r239757. rdar://problem/47260195 [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky https://bugs.webkit.org/show_bug.cgi?id=192061 Reviewed by Dewei Zhu. Part 6. Add some additional temporary logging info to determine if data is actually sent. Once the bug is determined and fixed, we should remove all logging added in this patch. * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::send): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239757 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-08 Jiewen Tan [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky https://bugs.webkit.org/show_bug.cgi?id=192061 Reviewed by Dewei Zhu. Part 6. Add some additional temporary logging info to determine if data is actually sent. Once the bug is determined and fixed, we should remove all logging added in this patch. * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::send): 2019-01-10 Jiewen Tan [WebAuthN] Change the nonce in the CTAP kInit command to weak random values https://bugs.webkit.org/show_bug.cgi?id=192061 Reviewed by Chris Dumez. Change the nonce in the CTAP kInit command to weak random values as the nonce is mainly for being a probabilistically unique global identifier for hand shakes, instead of preventing replay attacks. Otherwise, it might exhaust system entropy unnecessarily. The patch also removes all logging when debugging the test case flakiness. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::respondReceived): (WebKit::AuthenticatorManager::initTimeOutTimer): (WebKit::AuthenticatorManager::timeOutTimerFired): * UIProcess/WebAuthentication/Cocoa/HidService.mm: (WebKit::HidService::deviceAdded): * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: (WebKit::MockAuthenticatorManager::respondReceivedInternal): * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::send): * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp: (WebKit::CtapHidAuthenticator::makeCredential): (WebKit::CtapHidAuthenticator::getAssertion): * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp: (WebKit::CtapHidDriver::Worker::write): (WebKit::CtapHidDriver::Worker::read): (WebKit::CtapHidDriver::Worker::returnMessage): (WebKit::CtapHidDriver::transact): (WebKit::CtapHidDriver::continueAfterChannelAllocated): (WebKit::CtapHidDriver::continueAfterResponseReceived): 2019-01-15 Alan Coon Cherry-pick r239904. rdar://problem/4726030 Have prefers-color-scheme: light always match on macOS versions before Mojave. https://bugs.webkit.org/show_bug.cgi?id=191655 rdar://problem/46074680 Reviewed by Megan Gardner. Source/JavaScriptCore: * Configurations/FeatureDefines.xcconfig: ENABLE_DARK_MODE_CSS_macosx for all OS versions. Source/WebCore: Tests: css-dark-mode/older-systems/prefers-color-scheme.html css-dark-mode/older-systems/supported-color-schemes-css.html css-dark-mode/older-systems/supported-color-schemes.html Use new HAVE(OS_DARK_MODE_SUPPORT) to make it easier to find code. Added HAVE(OS_DARK_MODE_SUPPORT) around more bits to make it work on older systems. * Configurations/FeatureDefines.xcconfig: * dom/Document.cpp: (WebCore::Document::useDarkAppearance const): * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::enable): * page/Page.cpp: (WebCore::Page::setUseDarkAppearance): (WebCore::Page::useDarkAppearance const): (WebCore::Page::setUseDarkAppearanceOverride): * platform/mac/LocalDefaultSystemAppearance.h: (WebCore::LocalDefaultSystemAppearance::usingDarkAppearance const): * platform/mac/LocalDefaultSystemAppearance.mm: (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): * platform/mac/ScrollAnimatorMac.mm: * rendering/RenderThemeMac.mm: (-[WebCoreTextFieldCell _adjustedCoreUIDrawOptionsForDrawingBordersOnly:]): (-[WebListButtonCell drawWithFrame:inView:]): (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const): (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const): (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const): (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const): (WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const): (WebCore::RenderThemeMac::systemColor const): Source/WebCore/PAL: * Configurations/FeatureDefines.xcconfig: ENABLE_DARK_MODE_CSS_macosx for all OS versions. Source/WebKit: * Configurations/FeatureDefines.xcconfig: ENABLE_DARK_MODE_CSS_macosx for all OS versions. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::effectiveAppearanceIsDark): * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: Source/WebKitLegacy/mac: * Configurations/FeatureDefines.xcconfig: ENABLE_DARK_MODE_CSS_macosx for all OS versions. * WebView/WebView.mm: (-[WebView _effectiveAppearanceIsDark]): Source/WTF: * wtf/Platform.h: Define HAVE_OS_DARK_MODE_SUPPORT on macOS 10.14. Tools: * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: ENABLE_DARK_MODE_CSS_macosx for all OS versions. * TestWebKitAPI/Tests/WebKit/mac/ForceLightAppearanceInBundle.mm: LayoutTests: * css-dark-mode/older-systems/prefers-color-scheme-expected.txt: Added. * css-dark-mode/older-systems/prefers-color-scheme.html: Added. * css-dark-mode/older-systems/supported-color-schemes-css-expected.txt: Added. * css-dark-mode/older-systems/supported-color-schemes-css.html: Added. * css-dark-mode/older-systems/supported-color-schemes-expected.txt: Added. * css-dark-mode/older-systems/supported-color-schemes.html: Added. * platform/mac/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239904 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-12 Timothy Hatcher Have prefers-color-scheme: light always match on macOS versions before Mojave. https://bugs.webkit.org/show_bug.cgi?id=191655 rdar://problem/46074680 Reviewed by Megan Gardner. * Configurations/FeatureDefines.xcconfig: ENABLE_DARK_MODE_CSS_macosx for all OS versions. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::effectiveAppearanceIsDark): * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: 2019-01-15 Alan Coon Cherry-pick r239888. rdar://problem/47260286 Compile out Web API Statistics Collection https://bugs.webkit.org/show_bug.cgi?id=193370 Reviewed by Brent Fulgham. Source/JavaScriptCore: * Configurations/FeatureDefines.xcconfig: Defined ENABLE_WEB_API_STATISTICS, off by default. Source/WebCore: No new tests. This patch disables functionality. The associated tests are skipped. These functions are now no-ops unless web API statistics is enabled. * Configurations/FeatureDefines.xcconfig: * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::logFontLoad): (WebCore::ResourceLoadObserver::logCanvasRead): (WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure): (WebCore::ResourceLoadObserver::logNavigatorAPIAccessed): (WebCore::ResourceLoadObserver::logScreenAPIAccessed): * loader/ResourceLoadStatistics.cpp: (WebCore::ResourceLoadStatistics::encode const): (WebCore::ResourceLoadStatistics::decode): (WebCore::ResourceLoadStatistics::toString const): (WebCore::ResourceLoadStatistics::merge): * loader/ResourceLoadStatistics.h: The associated struct members are skipped unless web API statistics is enabled. Source/WebCore/PAL: * Configurations/FeatureDefines.xcconfig: Defined ENABLE_WEB_API_STATISTICS, off by default. Source/WebKit: * Configurations/FeatureDefines.xcconfig: Defined ENABLE_WEB_API_STATISTICS, off by default. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): Skipped encoding of web API statistics. (IPC::ArgumentCoder::decode): Skipped decoding of web API statistics. Source/WebKitLegacy/mac: * Configurations/FeatureDefines.xcconfig: Defined ENABLE_WEB_API_STATISTICS, off by default. Tools: * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: Defined ENABLE_WEB_API_STATISTICS, off by default. LayoutTests: * platform/ios-wk2/TestExpectations: http/tests/webAPIStatistics skipped. * platform/mac-wk2/TestExpectations: http/tests/webAPIStatistics skipped. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239888 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-11 John Wilander Compile out Web API Statistics Collection https://bugs.webkit.org/show_bug.cgi?id=193370 Reviewed by Brent Fulgham. * Configurations/FeatureDefines.xcconfig: Defined ENABLE_WEB_API_STATISTICS, off by default. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): Skipped encoding of web API statistics. (IPC::ArgumentCoder::decode): Skipped decoding of web API statistics. 2019-01-15 Alan Coon Cherry-pick r239880. rdar://problem/47260310 REGRESSION (PSON): Firefox app lacks Open in New Tab in menu https://bugs.webkit.org/show_bug.cgi?id=193366 Reviewed by Simon Fraser. Source/WebCore: * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isFirefox): Add a Firefox Mobile bundle check. Source/WebKit: A pair of unrelated changes broke Firefox's use of WKWebView internals to override the long-press menu. Maintain binary compatibility by introducing linked-on-or-after checks. * UIProcess/Cocoa/VersionChecks.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::createWebPage): Disable PSON in Firefox when linked against an SDK where PSON wasn't enabled by default. Because gestures are very stateful, we always swap them out when swapping processes (changing that behavior is fairly risky). Also, we don't always inform the client when we swap processes (only when the process actually crashes), so they currently don't re-adjust the gesture recognizers when a PSON swap occurs. * UIProcess/ios/WKContentView.mm: (-[WKContentView _commonInitializationWithProcessPool:configuration:]): Synchronously install gesture recognizers under -init when linked against an SDK before the version that introduces lazy gesture recognizer installation. r237331 is an optimization that made us lazily install gestures when the view is parented, but Firefox (and potentially other clients) depend on them being installed synchronously in order to find and override them. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239880 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-11 Tim Horton REGRESSION (PSON): Firefox app lacks Open in New Tab in menu https://bugs.webkit.org/show_bug.cgi?id=193366 Reviewed by Simon Fraser. A pair of unrelated changes broke Firefox's use of WKWebView internals to override the long-press menu. Maintain binary compatibility by introducing linked-on-or-after checks. * UIProcess/Cocoa/VersionChecks.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::createWebPage): Disable PSON in Firefox when linked against an SDK where PSON wasn't enabled by default. Because gestures are very stateful, we always swap them out when swapping processes (changing that behavior is fairly risky). Also, we don't always inform the client when we swap processes (only when the process actually crashes), so they currently don't re-adjust the gesture recognizers when a PSON swap occurs. * UIProcess/ios/WKContentView.mm: (-[WKContentView _commonInitializationWithProcessPool:configuration:]): Synchronously install gesture recognizers under -init when linked against an SDK before the version that introduces lazy gesture recognizer installation. r237331 is an optimization that made us lazily install gestures when the view is parented, but Firefox (and potentially other clients) depend on them being installed synchronously in order to find and override them. 2019-01-15 Alan Coon Cherry-pick r239851. rdar://problem/47260326 Add WKBundlePage SPI to temporarily force light or dark appearance on a page. https://bugs.webkit.org/show_bug.cgi?id=193327 rdar://problem/47093222 Reviewed by Tim Horton. Source/WebKit: Tests: WebKit.ForceLightAppearanceInBundle API Test * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageSetUseDarkAppearance): Added. (WKBundlePageIsUsingDarkAppearance): Added. * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: Tools: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKit/mac/ForceLightAppearanceInBundle.mm: Added. (TestWebKitAPI::didFinishNavigation): (TestWebKitAPI::didReceiveMessageFromInjectedBundle): (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebKit/mac/ForceLightAppearanceInBundle_Bundle.mm: Added. (TestWebKitAPI::ForceLightAppearanceInBundleTest::ForceLightAppearanceInBundleTest): (TestWebKitAPI::ForceLightAppearanceInBundleTest::didCreatePage): (TestWebKitAPI::ForceLightAppearanceInBundleTest::didReceiveMessage): * TestWebKitAPI/Tests/WebKit/mac/dark-mode.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239851 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-10 Timothy Hatcher Add WKBundlePage SPI to temporarily force light or dark appearance on a page. https://bugs.webkit.org/show_bug.cgi?id=193327 rdar://problem/47093222 Reviewed by Tim Horton. Tests: WebKit.ForceLightAppearanceInBundle API Test * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageSetUseDarkAppearance): Added. (WKBundlePageIsUsingDarkAppearance): Added. * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: 2019-01-15 Alan Coon Cherry-pick r239850. rdar://problem/47260243 DeviceID hash salt manager can be NULL https://bugs.webkit.org/show_bug.cgi?id=193334 Reviewed by Youenn Fablet. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): No need to NULL-check websiteDataStore.deviceIdHashSaltStorage, it is a Ref. (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): Ditto. (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo): Ditto. (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): Ditto. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::WebsiteDataStore): m_deviceIdHashSaltStorage is a Ref. (WebKit::WebsiteDataStore::fetchDataAndApply): Ditto. (WebKit::WebsiteDataStore::removeData): Ditto. * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::deviceIdHashSaltStorage): Ditto. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239850 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-10 Eric Carlson DeviceID hash salt manager can be NULL https://bugs.webkit.org/show_bug.cgi?id=193334 Reviewed by Youenn Fablet. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): No need to NULL-check websiteDataStore.deviceIdHashSaltStorage, it is a Ref. (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): Ditto. (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo): Ditto. (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): Ditto. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::WebsiteDataStore): m_deviceIdHashSaltStorage is a Ref. (WebKit::WebsiteDataStore::fetchDataAndApply): Ditto. (WebKit::WebsiteDataStore::removeData): Ditto. * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::deviceIdHashSaltStorage): Ditto. 2019-01-15 Alan Coon Cherry-pick r239843. rdar://problem/47260277 REGRESSION (r237658): Tap highlight limits cause the highlight to no longer show with legitimate button sizes https://bugs.webkit.org/show_bug.cgi?id=193294 Reviewed by Simon Fraser. Input type elements should always paint tap highlight (ignore size heuristic). * UIProcess/PageClient.h: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::didGetTapHighlightGeometries): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _showTapHighlight]): (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:nodeHasBuiltInClickHandling:]): (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]): Deleted. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::didGetTapHighlightGeometries): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::sendTapHighlightForNodeIfNecessary): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239843 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-10 Zalan Bujtas REGRESSION (r237658): Tap highlight limits cause the highlight to no longer show with legitimate button sizes https://bugs.webkit.org/show_bug.cgi?id=193294 Reviewed by Simon Fraser. Input type elements should always paint tap highlight (ignore size heuristic). * UIProcess/PageClient.h: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::didGetTapHighlightGeometries): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _showTapHighlight]): (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:nodeHasBuiltInClickHandling:]): (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]): Deleted. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::didGetTapHighlightGeometries): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::sendTapHighlightForNodeIfNecessary): 2019-01-15 Alan Coon Cherry-pick r239832. rdar://problem/47260343 Override the session configuration for cookieAcceptPolicy https://bugs.webkit.org/show_bug.cgi?id=190925 Patch by John Wilander on 2019-01-10 Reviewed by Alexey Proskuryakov and Alex Christensen. Source/WebCore/PAL: * pal/spi/cf/CFNetworkSPI.h: Declaration of _overrideSessionCookieAcceptPolicy on NSHTTPCookieStorage. Source/WebKit: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Now sets cookieStorage._overrideSessionCookieAcceptPolicy to YES. Source/WTF: * wtf/Platform.h: Definition of HAVE_CFNETWORK_OVERRIDE_SESSION_COOKIE_ACCEPT_POLICY. Tools: Test infrastructure for setting a first-party-only cookie policy. * DumpRenderTree/TestRunner.cpp: (setOnlyAcceptFirstPartyCookiesCallback): (TestRunner::staticFunctions): * DumpRenderTree/TestRunner.h: * DumpRenderTree/mac/TestRunnerMac.mm: (TestRunner::setOnlyAcceptFirstPartyCookies): * DumpRenderTree/win/TestRunnerWin.cpp: (TestRunner::setOnlyAcceptFirstPartyCookies): * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setOnlyAcceptFirstPartyCookies): * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): LayoutTests: * TestExpectations: Skipped since this cookie policy is only supported on Cocoa platforms. * http/tests/cookies/only-accept-first-party-cookies-expected.txt: Added. * http/tests/cookies/only-accept-first-party-cookies.html: Added. * http/tests/cookies/resources/reset-cookies.html: Added. To support reset of third-party cookies in an iframe. * http/tests/cookies/resources/set-cookie-and-redirect-back.php: Added. A simple bounce to set a cookie. * platform/ios/TestExpectations: Skipped for now. Will be fixed in . * platform/mac/TestExpectations: Skipped for now. Will be fixed in . git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239832 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-10 John Wilander Override the session configuration for cookieAcceptPolicy https://bugs.webkit.org/show_bug.cgi?id=190925 Reviewed by Alexey Proskuryakov and Alex Christensen. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Now sets cookieStorage._overrideSessionCookieAcceptPolicy to YES. 2019-01-15 Alan Coon Apply patch. rdar://problem/47260255 2019-01-15 Chris Dumez Better disable Automatic HTTPS upgrade Reviewed by Geoff Garen. Drop database file from the bundle as it is currently huge and increases our project size unnecessarily. Also hide the feature from the experimental feature menu since enabling it will not do anything without its database. * DerivedSources.make: * Shared/WebPreferences.yaml: * WebKit.xcodeproj/project.pbxproj: 2019-01-15 Alan Coon Revert r239446. rdar://problem/47125351 2019-01-09 Kocsen Chung Cherry-pick r239777. rdar://problem/47158629 [PSON] Flash of blank content while transitioning from page A to page B. https://bugs.webkit.org/show_bug.cgi?id=193283 Reviewed by Chris Dumez. Layer tree is not frozen during WebPage construction. If the flush timer (started for the initial empty document) manages to run before the actual page load starts, we'll get a flash. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Rename shouldDelayAttachingDrawingArea bit to isSwapFromSuspended and make it available on all platforms. * UIProcess/RemoteLayerTree/mac/ScrollerMac.h: Removed. * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: Removed. * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.h: Removed. * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: Removed. * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp: Removed. * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h: Removed. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::swapToWebProcess): (WebKit::WebPageProxy::finishAttachingToWebProcess): (WebKit::WebPageProxy::initializeWebPage): (WebKit::WebPageProxy::continueNavigationInNewProcess): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_shouldAttachDrawingAreaOnPageTransition): Freeze the layer tree in WebPage constructor if this is a swap from a suspended process. (WebKit::WebPage::reinitializeWebPage): (WebKit::WebPage::didCompletePageTransition): Unfreeze on first non-initial empty document page transition. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239777 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-09 Antti Koivisto [PSON] Flash of blank content while transitioning from page A to page B. https://bugs.webkit.org/show_bug.cgi?id=193283 Reviewed by Chris Dumez. Layer tree is not frozen during WebPage construction. If the flush timer (started for the initial empty document) manages to run before the actual page load starts, we'll get a flash. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Rename shouldDelayAttachingDrawingArea bit to isSwapFromSuspended and make it available on all platforms. * UIProcess/RemoteLayerTree/mac/ScrollerMac.h: Removed. * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: Removed. * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.h: Removed. * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: Removed. * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp: Removed. * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h: Removed. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::swapToWebProcess): (WebKit::WebPageProxy::finishAttachingToWebProcess): (WebKit::WebPageProxy::initializeWebPage): (WebKit::WebPageProxy::continueNavigationInNewProcess): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_shouldAttachDrawingAreaOnPageTransition): Freeze the layer tree in WebPage constructor if this is a swap from a suspended process. (WebKit::WebPage::reinitializeWebPage): (WebKit::WebPage::didCompletePageTransition): Unfreeze on first non-initial empty document page transition. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): 2019-01-09 Kocsen Chung Cherry-pick r239694. rdar://problem/47158722 Deactivate audio session whenever possible https://bugs.webkit.org/show_bug.cgi?id=193188 Reviewed by Jer Noble. Source/WebCore: Test: media/deactivate-audio-session.html * platform/audio/AudioSession.cpp: (WebCore::AudioSession::tryToSetActive): (WebCore::AudioSession::tryToSetActiveInternal): * platform/audio/AudioSession.h: (WebCore::AudioSession::isActive const): * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::removeSession): (WebCore::deactivateAudioSession): (WebCore::PlatformMediaSessionManager::shouldDeactivateAudioSession): (WebCore::PlatformMediaSessionManager::setShouldDeactivateAudioSession): * platform/audio/PlatformMediaSessionManager.h: * platform/audio/ios/AudioSessionIOS.mm: (WebCore::AudioSession::tryToSetActiveInternal): (WebCore::AudioSession::tryToSetActive): Deleted. * platform/audio/mac/AudioSessionMac.cpp: (WebCore::AudioSession::tryToSetActiveInternal): (WebCore::AudioSession::tryToSetActive): Deleted. * testing/Internals.cpp: (WebCore::Internals::audioSessionActive const): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): LayoutTests: * TestExpectations: Skip the new test. * media/deactivate-audio-session-expected.txt: Added. * media/deactivate-audio-session.html: Added. * platform/ios/TestExpectations: Run the new test. * platform/mac-wk2/TestExpectations: Ditto. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239694 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-07 Eric Carlson Deactivate audio session whenever possible https://bugs.webkit.org/show_bug.cgi?id=193188 Reviewed by Jer Noble. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): 2019-01-09 Kocsen Chung Cherry-pick r239691. rdar://problem/47158674 [Cocoa] Add SPI to check if a WKWebView has an inspector frontend https://bugs.webkit.org/show_bug.cgi?id=193162 Patch by Joseph Pecoraro on 2019-01-07 Reviewed by Alex Christensen. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _hasInspectorFrontend]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::hasInspectorFrontend const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239691 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-07 Joseph Pecoraro [Cocoa] Add SPI to check if a WKWebView has an inspector frontend https://bugs.webkit.org/show_bug.cgi?id=193162 Reviewed by Alex Christensen. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _hasInspectorFrontend]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::hasInspectorFrontend const): 2019-01-09 Kocsen Chung Cherry-pick r239686. rdar://problem/47158659 Unwanted page navigation after showing & dismissing contextual menu with control-click https://bugs.webkit.org/show_bug.cgi?id=192912 Reviewed by Timothy Hatcher. After the conversion to use a mouse event queue, this behavior was observed rarely, especially when CPU is under load and lots of things are going on in the page. In other words, it's racy. Based on NSEvent logging, it seems that when the system is under load, we simply take too long to enter the nested runloop that AppKit uses to handle events when the context menu is present. AppKit doesn't care whether or not the MouseDown triggered a nested runloop; on my machine it delivers the MouseUp event about 130ms after the MouseDown event. If we haven't show the context menu in that time, then the MouseUp is enqueued as a normal mouse event. If the Ctrl-click is on a link, then the MouseUp will be interpreted by EventHandler as a click event, which in the simplest case will initiate a main frame navigation. When the context menu is dismissed and the nested runloop is torn down, the navigation IPC message is handled in UIProcess and the page navigates away. We can't do much to change AppKit's inherently racy behavior, but we can avoid processing mouse events that are delivered whilst we are processing the context menu-initiating event. From the WebProcess point of view, there is no race anymore because it does not receive the MouseUp event. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showContextMenu): If new events come in, drop them on the floor. Based on testing, the nested runloop will discard the unpaired MouseUp event anyway, so this does not cause a change in behavior. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239686 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-07 Brian Burg Unwanted page navigation after showing & dismissing contextual menu with control-click https://bugs.webkit.org/show_bug.cgi?id=192912 Reviewed by Timothy Hatcher. After the conversion to use a mouse event queue, this behavior was observed rarely, especially when CPU is under load and lots of things are going on in the page. In other words, it's racy. Based on NSEvent logging, it seems that when the system is under load, we simply take too long to enter the nested runloop that AppKit uses to handle events when the context menu is present. AppKit doesn't care whether or not the MouseDown triggered a nested runloop; on my machine it delivers the MouseUp event about 130ms after the MouseDown event. If we haven't show the context menu in that time, then the MouseUp is enqueued as a normal mouse event. If the Ctrl-click is on a link, then the MouseUp will be interpreted by EventHandler as a click event, which in the simplest case will initiate a main frame navigation. When the context menu is dismissed and the nested runloop is torn down, the navigation IPC message is handled in UIProcess and the page navigates away. We can't do much to change AppKit's inherently racy behavior, but we can avoid processing mouse events that are delivered whilst we are processing the context menu-initiating event. From the WebProcess point of view, there is no race anymore because it does not receive the MouseUp event. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showContextMenu): If new events come in, drop them on the floor. Based on testing, the nested runloop will discard the unpaired MouseUp event anyway, so this does not cause a change in behavior. 2019-01-09 Alan Coon Cherry-pick r239776. rdar://problem/47147610 WebKit Networking process crashes if the HTTPSUpgradeList is not found in the bundle https://bugs.webkit.org/show_bug.cgi?id=193285 Reviewed by Geoffrey Garen. * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp: (WebKit::networkHTTPSUpgradeCheckerDatabasePath): (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239776 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-09 Chris Dumez WebKit Networking process crashes if the HTTPSUpgradeList is not found in the bundle https://bugs.webkit.org/show_bug.cgi?id=193285 Reviewed by Geoffrey Garen. * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp: (WebKit::networkHTTPSUpgradeCheckerDatabasePath): (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker): 2019-01-07 Alex Christensen Modernize CacheModel and disk cache fetching and clearing https://bugs.webkit.org/show_bug.cgi?id=193164 Reviewed by Joseph Pecoraro. fetchDiskCacheEntries and clearDiskCacheEntries now use an early-return model. CacheModel is now an enum class. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::NetworkProcess): (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::fetchDiskCacheEntries): (WebKit::NetworkProcess::fetchWebsiteData): (WebKit::clearDiskCacheEntries): (WebKit::NetworkProcess::setCacheModel): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::initializeShareableResourceHandleFromStorageRecord const): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::clearDiskCache): * Shared/CacheModel.cpp: (WebKit::calculateMemoryCacheSizes): (WebKit::calculateURLCacheSizes): * Shared/CacheModel.h: (): Deleted. * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::createWithLegacyOptions): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/C/WKAPICast.h: (WebKit::toCacheModel): (WebKit::toAPI): * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration pageCacheEnabled]): (-[_WKProcessPoolConfiguration setPageCacheEnabled:]): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): (WebKit::WebProcess::setCacheModel): (WebKit::WebProcess::clearResourceCaches): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2019-01-06 Jiewen Tan [WebAuthN] Import U2F command/response converters from Chromium https://bugs.webkit.org/show_bug.cgi?id=193150 Reviewed by Brent Fulgham. Moves helper functions to WebAuthenticationUtils. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticatorInternal::produceHashSet): (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested): (): Deleted. (WebKit::LocalAuthenticatorInternal::buildAuthData): Deleted. * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::feedReports): 2019-01-04 Joseph Pecoraro Web Inspector: Use save sheet instead of dialog where possible https://bugs.webkit.org/show_bug.cgi?id=193160 Reviewed by Devin Rousso. * UIProcess/mac/RemoteWebInspectorProxyMac.mm: (WebKit::RemoteWebInspectorProxy::platformSave): * UIProcess/mac/WebInspectorProxyMac.mm: (WebKit::WebInspectorProxy::platformSave): 2019-01-04 Jer Noble [WebKitLegacy] Media playback pauses on scroll https://bugs.webkit.org/show_bug.cgi?id=192829 Reviewed by Eric Carlson. Add a new WebPage, WebPageProxy, & WKWebView SPI to stop, suspend, and resume all existing media playback in the page. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _stopAllMediaPlayback]): (-[WKWebView _suspendAllMediaPlayback]): (-[WKWebView _resumeAllMediaPlayback]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::stopAllMediaPlayback): (WebKit::WebPageProxy::suspendAllMediaPlayback): (WebKit::WebPageProxy::resumeAllMediaPlayback): * UIProcess/WebPageProxy.h: * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: (-[WKFullScreenViewController _showPhishingAlert]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::stopAllMediaPlayback): (WebKit::WebPage::suspendAllMediaPlayback): (WebKit::WebPage::resumeAllMediaPlayback): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2019-01-04 Chris Dumez Add support for toggling device orientation API support per site https://bugs.webkit.org/show_bug.cgi?id=193143 Reviewed by Alex Christensen. Add support for toggling device orientation API support per site via _WKWebsitePolicies. * Shared/WebsitePoliciesData.cpp: (WebKit::WebsitePoliciesData::encode const): (WebKit::WebsitePoliciesData::decode): (WebKit::WebsitePoliciesData::applyToDocumentLoader): * Shared/WebsitePoliciesData.h: * UIProcess/API/APIWebsitePolicies.cpp: (API::WebsitePolicies::data): * UIProcess/API/APIWebsitePolicies.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _simulateDeviceOrientationChangeWithAlpha:beta:gamma:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/_WKWebsitePolicies.h: * UIProcess/API/Cocoa/_WKWebsitePolicies.mm: (-[_WKWebsitePolicies setDeviceOrientationEventEnabled:]): (-[_WKWebsitePolicies deviceOrientationEventEnabled]): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::simulateDeviceOrientationChange): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::simulateDeviceOrientationChange): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2019-01-04 Chris Dumez Crash under WebPageProxy::continueNavigationInNewProcess() https://bugs.webkit.org/show_bug.cgi?id=193113 Reviewed by Brady Eidson. The crash was happening in continueNavigationInNewProcess() when dereferencing the Optional<> value returned by API::Navigation::backForwardFrameLoadType(), after verifying that API::Navigation::targetItem() is not null. When constructing an API::Navigation object with a targetItem, you HAVE to pass in a backForwardFrameLoadType as well so this normally is not possible. However, it can happen because API::Navigation::setTargetItem() can get called later on and set a target item on a Navigation object which potentially does not have a backForwardFrameLoadType. This setter was only called in one place in decidePolicyForNavigationAction() to update an existing Navigation object using the targetItem provided by a NavigationAction. This logic was added with PSON support. Because I was unable to write a test case reproducing this and because I do not know how it can happen in practice that we'd have a NavigationAction with a targetItem even though the Navigation object itself is not for a back/forward navigation, I have chosen to drop the unsafe API::Navigation::setTargetItem() setter and the call site. When the call site was added, with ProcessSwap.NavigateToDataURLThenBack API test, the intention was to create a back/forward navigation object instead of a standard load navigation one if there is currently no existing Navigation object in the UIProcess. This can happen when the back/forward navigation is triggered by the WebProcess via JS (e.g. history.back()) and this is what the API test covers. The part of the logic that updates an existing Navigation object with a targetItem coming from the NavigationAction is untested and I have no evidence it does anything useful. However, we DO have evidence that it can cause crashes. * UIProcess/API/APINavigation.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): 2019-01-04 Tim Horton Remove some nonexistent files from the WebKit Xcode project * WebKit.xcodeproj/project.pbxproj: r238468 and r237205 forgot to remove some files from the project. 2019-01-04 Youenn Fablet CSP violation reports should bypass CSP checks https://bugs.webkit.org/show_bug.cgi?id=192857 Reviewed by Chris Dumez. * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::startPingLoad): * WebProcess/Network/WebLoaderStrategy.h: 2019-01-04 Alex Christensen Use WebsiteDataStoreParameters instead of NetworkProcessCreationParameters for IndexedDB directories https://bugs.webkit.org/show_bug.cgi?id=193114 Reviewed by Brady Eidson. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): 2019-01-04 Alex Christensen Deprecate WKContextCreate https://bugs.webkit.org/show_bug.cgi?id=193118 Reviewed by Brady Eidson. It has only one use that is being removed in rdar://problem/47030792 This is a step towards removing ProcessPoolConfiguration::createWithLegacyOptions. Also make WKContextCreateWithConfiguration accept a null configuration to make it easier to use. * UIProcess/API/C/WKContext.cpp: (WKContextCreateWithConfiguration): * UIProcess/API/C/WKContext.h: 2019-01-04 Tim Horton Fix the build * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanupInteraction]): 2019-01-04 Tim Horton Share ink choice and ruler between all editable images https://bugs.webkit.org/show_bug.cgi?id=193130 Reviewed by Wenson Hsieh. * SourcesCocoa.txt: Add WKDrawingCoordinator, which maintains WKWebView-wide drawing state, and manages a single shared ink picker. * UIProcess/PageClient.h: (WebKit::PageClient::createDrawingView): * UIProcess/ios/EditableImageController.mm: (WebKit::EditableImageController::ensureEditableImage): * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::createDrawingView): Plumb WKDrawingView creation through PageClient, so that it can be instantiated with knowledge of its owning WKContentView. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): (-[WKContentView _elementDidBlur]): (-[WKContentView _drawingCoordinator]): (-[WKContentView _installInkPickerForDrawingViewWithID:]): Deleted. (-[WKContentView _uninstallInkPicker]): Deleted. Move ink picker management into WKDrawingCoordinator. * UIProcess/ios/WKDrawingView.h: * UIProcess/ios/WKDrawingView.mm: (-[WKDrawingView initWithEmbeddedViewID:contentView:]): (-[WKDrawingView _canvasViewWillBeginDrawing:]): (-[WKDrawingView invalidateAttachment]): (-[WKDrawingView didChangeRulerState:]): (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]): Deleted. (-[WKDrawingView canvasView]): Deleted. Use a shared ruler, owned by WKDrawingCoordinator. Update the editable image's ink when drawing begins. This way, we don't have to push ink changes to all drawings as they happen. * UIProcess/ios/WKInkPickerView.h: * UIProcess/ios/WKInkPickerView.mm: (-[WKInkPickerView initWithContentView:]): (-[WKInkPickerView inlineInkPickerDidToggleRuler:]): (-[WKInkPickerView viewControllerForPopoverPresentationFromInlineInkPicker:]): (-[WKInkPickerView setInk:]): (-[WKInkPickerView ink]): (-[WKInkPickerView initWithDrawingView:]): Deleted. (-[WKInkPickerView didPickInk]): Deleted. (-[WKInkPickerView inlineInkPicker:didSelectTool:]): Deleted. (-[WKInkPickerView inlineInkPicker:didSelectColor:]): Deleted. * WebKit.xcodeproj/project.pbxproj: 2019-01-04 Wenson Hsieh [Cocoa] Merge WebEditCommandProxy::nameForEditAction and undoNameForEditAction into a single function https://bugs.webkit.org/show_bug.cgi?id=193129 Reviewed by Tim Horton. Remove WebEditCommandProxy::nameForEditAction and use WebCore::nameForUndoRedo instead. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::registerEditCommand): * UIProcess/WebEditCommandProxy.cpp: (WebKit::WebEditCommandProxy::WebEditCommandProxy): (WebKit::WebEditCommandProxy::~WebEditCommandProxy): (WebKit::WebEditCommandProxy::nameForEditAction): Deleted. * UIProcess/WebEditCommandProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::addEditCommand): (WebKit::WebPageProxy::removeEditCommand): (WebKit::WebPageProxy::isValidEditCommand): Deleted. Bit of drive-by refactoring: remove an unused function, and make addEditCommand and removeEditCommand take references instead of pointers, since these are assumed to be nonnull. * UIProcess/WebPageProxy.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::registerEditCommand): 2019-01-03 Matt Rajca Make DidPlayMediaPreventedFromPlaying autoplay event more generic. https://bugs.webkit.org/show_bug.cgi?id=193128 rdar://34554231 Reviewed by Jer Noble. Today, the "DidPlayMediaPreventedFromPlaying" autoplay event is only sent for media prevented from autoplaying. It could be generalized to a "DidPlayMediaWithUserGesture" event along with a flag that indicates whether or not autoplay was actually prevented. Tests: existing API tests were updated to reflect the new names. New API tests were added for the new case in which the "DidPlayMediaWithUserGesture" event is sent. * Shared/WebCoreArgumentCoders.h: Take into account new flags. * UIProcess/API/C/WKPage.cpp: Ditto. (WKPageSetPageUIClient): * UIProcess/API/C/WKPageUIClient.h: Ditto. * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Ditto. * UIProcess/Cocoa/UIDelegate.mm: Ditto. (WebKit::toWKAutoplayEventFlags): (WebKit::toWKAutoplayEvent): 2019-01-04 Fujii Hironori [curl] Move cookiePersistentStorageFile from NetworkProcessCreationParameters to NetworkSessionCreationParameters https://bugs.webkit.org/show_bug.cgi?id=192970 Reviewed by Alex Christensen. * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): Removed code for cookiePersistentStorageFile. (WebKit::NetworkProcessCreationParameters::decode): Ditto. * NetworkProcess/NetworkProcessCreationParameters.h: Ditto. * NetworkProcess/curl/NetworkProcessCurl.cpp: (WebKit::NetworkProcess::platformInitializeNetworkProcess): Ditto. * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::privateSessionParameters): Added code for cookiePersistentStorageFile. (WebKit::NetworkSessionCreationParameters::encode const): Ditto. (WebKit::NetworkSessionCreationParameters::decode): Ditto. * NetworkProcess/NetworkSessionCreationParameters.h: Ditto. * NetworkProcess/curl/NetworkSessionCurl.cpp: (WebKit::NetworkSessionCurl::NetworkSessionCurl): Ditto. * NetworkProcess/Cookies/WebCookieManager.h: Removed setCookiePersistentStorage method of curl port extension. * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp: (WebKit::WebCookieManager::setCookiePersistentStorage): Deleted. 2019-01-04 Chris Dumez [PSON] Calling history.back() from inside the load event handler prevents process-swapping https://bugs.webkit.org/show_bug.cgi?id=193120 Reviewed by Alex Christensen. A HistoryItem is created only *after* we've fired the load event. As a result, if you call history.back() in JS from inside the load event handler, the current HistoryItem and and the target HistoryItem will be the same. This is normally not an issue. However, there was logic inside of WebProcessPool::processForNavigationInternal() which would compare the processID of the source and destination BackForwardListItems and which would force a process reuse if both BackForwardListItems came from the same WebContent process. So even though we swapped when doing a standard load from site A to site B, we would fail to swap if site B called history.back() from inside its load event handler. To address the issue, stop relying on the source backforward item's processID. Instead, just use the WebContent process matching the destination backforward item's processID if it still exists. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigationInternal): 2019-01-04 Keith Rollin Bring back parent processID for logging https://bugs.webkit.org/show_bug.cgi?id=193121 Reviewed by Alex Christensen. Bug 192961 removes presentingApplicationPID from NetworkProcessCreationParameters because it was (a) stored in some global state, the use of which is being minimized, and (b) it was largely unused. However, it was actually still being used in some useful logging in order to tie together child processes with their parent process. Re-introduce this value in NetworkLoadParameters so that we can log it. * NetworkProcess/NetworkLoadParameters.h: * NetworkProcess/NetworkResourceLoadParameters.cpp: (WebKit::NetworkResourceLoadParameters::encode const): (WebKit::NetworkResourceLoadParameters::decode): * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::start): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): (WebKit::WebLoaderStrategy::loadResourceSynchronously): (WebKit::WebLoaderStrategy::startPingLoad): (WebKit::WebLoaderStrategy::preconnectTo): 2019-01-04 Youenn Fablet Make RestrictedHTTPResponseAccess an internal flag https://bugs.webkit.org/show_bug.cgi?id=193145 Reviewed by Chris Dumez. * Shared/WebPreferences.yaml: This will ease debugging. 2019-01-04 Per Arne Vollan [iOS] Enable logging for services in sandbox https://bugs.webkit.org/show_bug.cgi?id=192705 Reviewed by Brent Fulgham. When running layout tests, we didn’t see 107 services being looked up through launchd. We should add logging to these services to determine which services we actually need in the sandbox. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-01-04 Commit Queue Unreviewed, rolling out r239603. https://bugs.webkit.org/show_bug.cgi?id=193146 Breaks shipping tests (Requested by bfulgha__ on #webkit). Reverted changeset: "[iOS] Update sandbox profile to use iconservices instead of lsdiconservice" https://bugs.webkit.org/show_bug.cgi?id=193115 https://trac.webkit.org/changeset/239603 2019-01-04 Chris Dumez Crash under WebProcessPool::addSuspendedPage() https://bugs.webkit.org/show_bug.cgi?id=193110 Reviewed by Youenn Fablet. When PageCache is disabled, WebProcessPool::m_maxSuspendedPageCount is 0 and WebProcessPool::addSuspendedPage() would call m_suspendedPages.removeFirst() even though m_suspendedPages is empty, causing a crash. Do an early return when m_maxSuspendedPageCount is 0 since we do not want to add any suspended page in this case. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::addSuspendedPage): 2019-01-03 Brent Fulgham [iOS] Silently deny access to mail settings triggered by MessageUI framework https://bugs.webkit.org/show_bug.cgi?id=193123 Reviewed by Alexey Proskuryakov. Remove unhelpful logging generated when we block access to non-WebKit preferences. These invalid checks are done by an system framework that we cannot modify. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-01-03 Brent Fulgham [iOS] Update sandbox profile to use iconservices instead of lsdiconservice https://bugs.webkit.org/show_bug.cgi?id=193115 Reviewed by Eric Carlson. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2019-01-03 Brent Fulgham Remove logic handling DNT header during redirects https://bugs.webkit.org/show_bug.cgi?id=193082 Reviewed by Chris Dumez. Test: http/wpt/fetch/dnt-header-after-redirection.html. Don't bother looking for (or passing along) DNT headers during redirects. * NetworkProcess/NetworkLoadChecker.cpp: (WebKit::NetworkLoadChecker::check): (WebKit::NetworkLoadChecker::prepareRedirectedRequest): Deleted. * NetworkProcess/NetworkLoadChecker.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::restartNetworkLoad): (WebKit::NetworkResourceLoader::continueWillSendRequest): * NetworkProcess/PingLoad.cpp: (WebKit::PingLoad::willPerformHTTPRedirection): 2019-01-03 Chris Dumez Add release logging to help debug HTTPS upgrade issues https://bugs.webkit.org/show_bug.cgi?id=193075 Reviewed by Alex Christensen. Add release logging to help debug HTTPS upgrade issues like Bug 193026. * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp: (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker): (WebKit::NetworkHTTPSUpgradeChecker::query): 2019-01-03 Alex Christensen NetworkProcess should initialize its default NetworkSession with parameters from the UIProcess https://bugs.webkit.org/show_bug.cgi?id=192967 Reviewed by Brent Fulgham. I moved 3 of the NetworkProcessCreationParameters to use corresponding values of a WebsiteDataStoreParameters. More will be moved in the near future, like indexedDatabaseDirectory. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): 2019-01-03 Wenson Hsieh [iOS] REGRESSION (r239441): Tab cycling to offscreen https://bugs.webkit.org/show_bug.cgi?id=188174 Reviewed by Fujii Hironori. Add support for saving the search terms for to a SQLite database, replacing the CF-based implementation for Windows and adding support for non-legacy WebKit. * UIProcess/win/WebPageProxyWin.cpp: (WebKit::WebPageProxy::saveRecentSearches): Use SQLite database implementation in WebCore::SearchPopupMenuDB to save search terms (WebKit::WebPageProxy::loadRecentSearches): Use SQLite database implementation in WebCore::SearchPopupMenuDB to load search terms 2018-10-19 Alex Christensen WebDataListSuggestionsDropdown should use a WeakPtr https://bugs.webkit.org/show_bug.cgi?id=190763 Reviewed by Tim Horton. Nothing suspicious here. It's just good practice to not keep raw pointers that aren't reset when the object they point to are destroyed. * UIProcess/WebDataListSuggestionsDropdown.cpp: (WebKit::WebDataListSuggestionsDropdown::WebDataListSuggestionsDropdown): (WebKit::WebDataListSuggestionsDropdown::close): * UIProcess/WebDataListSuggestionsDropdown.h: (WebKit::WebDataListSuggestionsDropdown::Client::~Client): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/ios/WebDataListSuggestionsDropdownIOS.h: * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm: (WebKit::WebDataListSuggestionsDropdownIOS::create): (WebKit::WebDataListSuggestionsDropdownIOS::WebDataListSuggestionsDropdownIOS): (WebKit::WebDataListSuggestionsDropdownIOS::close): (WebKit::WebDataListSuggestionsDropdownIOS::didSelectOption): * UIProcess/mac/WebDataListSuggestionsDropdownMac.h: * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm: (WebKit::WebDataListSuggestionsDropdownMac::create): (WebKit::WebDataListSuggestionsDropdownMac::WebDataListSuggestionsDropdownMac): (WebKit::WebDataListSuggestionsDropdownMac::didSelectOption): (WebKit::WebDataListSuggestionsDropdownMac::selectOption): 2018-10-19 Wenson Hsieh [iOS] [Datalist] Can't pick datalist suggestions in a stock WKWebView https://bugs.webkit.org/show_bug.cgi?id=190621 Reviewed by Tim Horton. Fixes the bug by refactoring datalist suggestion information on iOS; currently, we override text suggestions on _WKFormInputSession. This only works for a few internal clients (including Safari) that set a _WKInputDelegate and also implement either -_webView:willStartInputSession: or -_webView:didStartInputSession:, which is necessary in order to ensure that WebKit creates and maintains a form input session. The two pieces of information that datalist code needs to vend to WKContentView are a list of UITextSuggestions and a custom input view, which are both currently properties of _WKFormInputSession. This patch lifts these out of the input session and makes them properties of WKContentView, which are used in WebDataListSuggestionsDropdownIOS. Test: fast/forms/datalist/datalist-textinput-suggestions-order.html * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: Add new properties to WKContentView: an input view for datalist suggestions, and a list of text suggestions. (-[WKFormInputSession setSuggestions:]): (-[WKContentView setupInteraction]): (-[WKContentView cleanupInteraction]): (-[WKContentView _endEditing]): Pull out common logic when resigning first responder or tabbing to the next or previous text field into a new helper. This helper notifies `_inputPeripheral`, `_formInputSession`, and `_dataListTextSuggestionsInputView` when editing has ended; the input peripheral and suggestions input view use this chance to send the value of the form control to the web process. (-[WKContentView resignFirstResponderForWebView]): (-[WKContentView inputView]): If a custom input view is not set but we have an input view for a datalist's text suggestions, use the datalist input view. (-[WKContentView accessoryTab:]): (-[WKContentView _stopAssistingNode]): Clear datalist state on WKContentView. (-[WKContentView dataListTextSuggestionsInputView]): (-[WKContentView dataListTextSuggestions]): (-[WKContentView setDataListTextSuggestionsInputView:]): (-[WKContentView setDataListTextSuggestions:]): (-[WKContentView updateTextSuggestionsForInputDelegate]): Pull out logic for setting suggestions on UIKit's `inputDelegate` (i.e. UIKeyboardImpl). We now first consult internally-vended text suggestions from _WKFormInputSession; if an internal client has not overridden our text suggestions, then we simply use suggestions from the current datalist (if present). * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm: (-[WKDataListSuggestionsPicker updateWithInformation:]): (-[WKDataListSuggestionsPicker showSuggestionsDropdown:activationType:]): (-[WKDataListSuggestionsPicker invalidate]): (-[WKDataListSuggestionsPopover updateWithInformation:]): (-[WKDataListSuggestionsPopover showSuggestionsDropdown:activationType:]): (-[WKDataListSuggestionsPopover didSelectOptionAtIndex:]): Change all the places that currently manipulate WKContentView's form input session to directly set text suggestions and the text suggestion input view on the content view instead. 2018-10-19 John Wilander Only cap lifetime of persistent cookies created client-side through document.cookie when resource load statistics is enabled https://bugs.webkit.org/show_bug.cgi?id=190687 Reviewed by Alex Christensen. This patch adds the following: - The WebProcessPool now tells the WebsiteDataStore when a network process has been created. - The WebsiteDataStore in turn tells the WebResourceLoadStatisticsStore when a network process has been created. - The WebResourceLoadStatisticsStore makes sure to update the network processes with its cookie policy when it's notified that a network process has been created. In addition, this patch changes the following: - The ResourceLoadStatisticsMemoryStore no longer keeps track of which domains it has told the network process to block cookies for. The reason is that we cannot assume that there is only one network process so we should always send complete blocking data. - The ResourceLoadStatisticsMemoryStore's functions for communicating cookie blocking state to the network process no longer take and forward the "clear first" parameter. This is because complete data is sent every time and thus the network process' set is always cleared on an update. - Removes WebsiteDataStore::networkProcessDidCrash() and WebResourceLoadStatisticsStore::scheduleCookieBlockingStateReset() since the call site---WebProcessPool::ensureNetworkProcess()---now calls WebsiteDataStore::didCreateNetworkProcess() after a network process crash and the state sync for cookie blocking is triggered. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor): (WebKit::NetworkProcess::setShouldCapLifetimeForClientSideCookies): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor): (WebKit::NetworkProcessProxy::setShouldCapLifetimeForClientSideCookies): (WebKit::NetworkProcessProxy::didSetShouldCapLifetimeForClientSideCookies): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::clear): (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking): (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlockingForDomains): (WebKit::ResourceLoadStatisticsMemoryStore::clearBlockingStateForDomains): (WebKit::ResourceLoadStatisticsMemoryStore::resetCookieBlockingState): Deleted. * UIProcess/ResourceLoadStatisticsMemoryStore.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::didCreateNetworkProcess): (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains): (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent): (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler): (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingStateReset): Deleted. * UIProcess/WebResourceLoadStatisticsStore.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor): (WebKit::WebsiteDataStore::setShouldCapLifetimeForClientSideCookies): (WebKit::WebsiteDataStore::didCreateNetworkProcess): (WebKit::WebsiteDataStore::networkProcessDidCrash): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.h: 2018-10-19 Alex Christensen Rebase python tests. * Scripts/webkit/messages_unittest.py: 2018-10-19 Alex Christensen Rebase python tests. * Scripts/Makefile: * Scripts/webkit/MessageReceiver-expected.cpp: * Scripts/webkit/Messages-expected.h: 2018-10-19 Alex Christensen Mark LegacySync IPC messages https://bugs.webkit.org/show_bug.cgi?id=190759 Reviewed by Tim Horton. * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: * Platform/IPC/HandleMessage.h: (IPC::handleMessageLegacySync): * PluginProcess/PluginControllerProxy.messages.in: * Scripts/webkit/messages.py: * Shared/Plugins/NPObjectMessageReceiver.messages.in: * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in: * UIProcess/Plugins/PluginProcessProxy.messages.in: * UIProcess/WebFullScreenManagerProxy.messages.in: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebPasteboardProxy.messages.in: * UIProcess/WebProcessPool.messages.in: * UIProcess/WebProcessProxy.messages.in: * UIProcess/WebStorage/StorageManager.messages.in: * UIProcess/mac/SecItemShimProxy.messages.in: * WebProcess/Plugins/PluginProcessConnection.messages.in: * WebProcess/Plugins/PluginProxy.messages.in: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebProcess.messages.in: 2018-10-19 Alex Christensen Update and add python tests after r237294 https://bugs.webkit.org/show_bug.cgi?id=190746 * Scripts/Makefile: Added to help updating expectations. * Scripts/webkit/LegacyMessageReceiver-expected.cpp: * Scripts/webkit/MessageReceiverSuperclass-expected.cpp: (Messages::WebPage::TestAsyncMessage::callReply): (Messages::WebPage::TestAsyncMessage::cancelReply): (Messages::WebPage::TestAsyncMessage::send): (WebKit::WebPage::didReceiveMessage): * Scripts/webkit/MessagesSuperclass-expected.h: (Messages::WebPage::TestAsyncMessage::receiverName): (Messages::WebPage::TestAsyncMessage::name): (Messages::WebPage::TestAsyncMessage::asyncMessageReplyName): (Messages::WebPage::TestAsyncMessage::TestAsyncMessage): (Messages::WebPage::TestAsyncMessage::arguments const): * Scripts/webkit/test-superclass-messages.in: Adding the extra newline made python tests fail. I also added more tests for the new functionality introduced in r237924. 2018-10-19 Alex Christensen Introduce CompletionHandler-based Async IPC messages with replies https://bugs.webkit.org/show_bug.cgi?id=190746 Reviewed by Tim Horton. Before this patch, to make an asynchronous IPC message with a reply you had to find two objects that can talk to each other, make two new message types, send a generated identifier, keep track of that identifier, make a HashMap somewhere to store the object waiting for the response, and hook it all up. What a mess. No wonder people take shortcuts and make strange design decisions. Now, you can just use a CompletionHandler and mark the reply as Async in *.messages.in. I've adopted this with a message whose behavior is covered by the storage/indexeddb/modern/blob-cursor.html layout test and many others. I intent to refine and further adopt this incrementally. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::getSandboxExtensionsForBlobFiles): (WebKit::NetworkProcess::didGetSandboxExtensionsForBlobFiles): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: This is representative of how code will be simplified with greater adoption. * NetworkProcess/NetworkResourceLoadParameters.cpp: (WebKit::NetworkResourceLoadParameters::decode): Modernize HandleArray decoding. * Platform/IPC/Connection.cpp: (IPC::Connection::dispatchMessage): (IPC::nextAsyncReplyHandlerID): (IPC::asyncReplyHandlerMap): Handle async replies when looking at incoming messages from the sending process. * Platform/IPC/Connection.h: (IPC::Connection::sendWithAsyncReply): Send a message with an async reply and prepare the reply receiver. * Platform/IPC/Encoder.h: Make the uint64_t encoder public so we can use it when encoding the listenerID. * Platform/IPC/HandleMessage.h: (IPC::handleMessageAsync): Handle an asynchronous message with a reply from the receiving process. This is similar to how DelayedReply messages are handled, but the listenerID is automatically captured and sent back. * Scripts/webkit/messages.py: Generate code for async message replies. * Shared/Databases/IndexedDB/WebIDBResult.cpp: (WebKit::WebIDBResult::decode): * Shared/SandboxExtension.h: (WebKit::SandboxExtension::HandleArray::at): (WebKit::SandboxExtension::HandleArray::decode): * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::decode): * Shared/mac/SandboxExtensionMac.mm: (WebKit::SandboxExtension::HandleArray::decode): Modernize the decoding of HandleArray to work with generated decoding. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::getSandboxExtensionsForBlobFiles): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: This is also representative of how code will be simplified with greater adoption. * WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp: (WebKit::MediaDeviceSandboxExtensions::decode): Modernize HandleArray decoding. 2018-10-19 Chris Dumez [PSON] WebPageProxy::didCompletePageTransition() may interact with a SuspendedPageProxy from a previous navigation https://bugs.webkit.org/show_bug.cgi?id=190717 Reviewed by Antti Koivisto. WebPageProxy::didCompletePageTransition() may interact with a SuspendedPageProxy from a previous navigation. We need to reset m_lastSuspendedPage whenever the page starts a new navigation as m_lastSuspendedPage is only updated when we process-swap otherwise. Also rename the data member to m_pageSuspendedDueToCurrentNavigation for clarity. In a follow-up, I will see if I can get rid of this data member entirely or maybe move it to the Navigation object. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::suspendCurrentPageIfPossible): (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::didCompletePageTransition): (WebKit::WebPageProxy::enterAcceleratedCompositingMode): 2018-10-18 Eric Carlson [MediaStream] Allow ports to optionally do screen capture in the UI process https://bugs.webkit.org/show_bug.cgi?id=190728 Reviewed by Jer Noble and Tim Horton. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): Encode shouldCaptureDisplayInUIProcess. (WebKit::WebProcessCreationParameters::decode): Decode shouldCaptureDisplayInUIProcess. * Shared/WebProcessCreationParameters.h: * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): Copy shouldCaptureDisplayInUIProcess. * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::SourceProxy::remoteVideoSampleAvailable): (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): Remove RealtimeMediaSource::Type parameter, CaptureDevice has the same information. Deal with display capture "devices". * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): Copy shouldCaptureDisplayInUIProcess. * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::Source::Source): Only allocate a ring buffer for Audio sources. (WebKit::UserMediaCaptureManager::Source::~Source): Same for deallocate. (WebKit::UserMediaCaptureManager::Source::storage): m_ringBuffer is a pointer. (WebKit::UserMediaCaptureManager::Source::setStorage): Ditto. (WebKit::UserMediaCaptureManager::Source::setRingBufferFrameBounds): Ditto. (WebKit::UserMediaCaptureManager::Source::audioSamplesAvailable): Ditto. (WebKit::UserMediaCaptureManager::Source::remoteVideoSampleAvailable): Create a PixelBuffer-backed media sample and call videoSampleAvailable. (WebKit::UserMediaCaptureManager::~UserMediaCaptureManager): Clear the audio and display capture factory overrides. (WebKit::UserMediaCaptureManager::initialize): Set the audio and display capture factory overrides. (WebKit::UserMediaCaptureManager::createCaptureSource): (WebKit::UserMediaCaptureManager::remoteVideoSampleAvailable): * WebProcess/cocoa/UserMediaCaptureManager.h: * WebProcess/cocoa/UserMediaCaptureManager.messages.in: 2018-10-18 Truitt Savell Unreviewed, rolling out r237272. Broke on device iOS builds and Windows builds Reverted changeset: "[MediaStream] Allow ports to optionally do screen capture in the UI process" https://bugs.webkit.org/show_bug.cgi?id=190728 https://trac.webkit.org/changeset/237272 2018-10-18 Jer Noble Enable WKPreferences._lowPowerVideoAudioBufferSizeEnabled by default https://bugs.webkit.org/show_bug.cgi?id=190315 Reviewed by Eric Carlson. This preference is disabled for WebKitLegacy because it can interact poorly with clients' own use of audio. It can be enabled for WebKit since it will only affect the WebProcess and not the client process. * Shared/WebPreferences.yaml: 2018-10-18 Eric Carlson [MediaStream] Allow ports to optionally do screen capture in the UI process https://bugs.webkit.org/show_bug.cgi?id=190728 Reviewed by Jer Noble and Tim Horton. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): Encode shouldCaptureDisplayInUIProcess. (WebKit::WebProcessCreationParameters::decode): Decode shouldCaptureDisplayInUIProcess. * Shared/WebProcessCreationParameters.h: * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): Copy shouldCaptureDisplayInUIProcess. * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::SourceProxy::remoteVideoSampleAvailable): (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): Remove RealtimeMediaSource::Type parameter, CaptureDevice has the same information. Deal with display capture "devices". * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): Copy shouldCaptureDisplayInUIProcess. * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::Source::Source): Only allocate a ring buffer for Audio sources. (WebKit::UserMediaCaptureManager::Source::~Source): Same for deallocate. (WebKit::UserMediaCaptureManager::Source::storage): m_ringBuffer is a pointer. (WebKit::UserMediaCaptureManager::Source::setStorage): Ditto. (WebKit::UserMediaCaptureManager::Source::setRingBufferFrameBounds): Ditto. (WebKit::UserMediaCaptureManager::Source::audioSamplesAvailable): Ditto. (WebKit::UserMediaCaptureManager::Source::remoteVideoSampleAvailable): Create a PixelBuffer-backed media sample and call videoSampleAvailable. (WebKit::UserMediaCaptureManager::~UserMediaCaptureManager): Clear the audio and display capture factory overrides. (WebKit::UserMediaCaptureManager::initialize): Set the audio and display capture factory overrides. (WebKit::UserMediaCaptureManager::createCaptureSource): (WebKit::UserMediaCaptureManager::remoteVideoSampleAvailable): * WebProcess/cocoa/UserMediaCaptureManager.h: * WebProcess/cocoa/UserMediaCaptureManager.messages.in: 2018-10-18 Chris Dumez [PSON] SuspendedPages do not report meaningful domains in Activity Monitor https://bugs.webkit.org/show_bug.cgi?id=190721 Reviewed by Alex Christensen. SuspendedPages do not report meaningful domains in Activity Monitor, which makes debugging harder. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::origin): (WebKit::WebProcess::updateActivePages): 2018-10-18 Alexey Proskuryakov Switch from PLATFORM(IOS) to PLATFORM(IOS_FAMILY) https://bugs.webkit.org/show_bug.cgi?id=190729 Reviewed by Tim Horton. * DerivedSources.make: * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::resume): * NetworkProcess/NetworkActivityTracker.h: * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cache/NetworkCacheFileSystem.cpp: (WebKit::NetworkCache::isSafeToUseMemoryMapForPath): * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::updateTaskWithFirstPartyForSameSiteCookies): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): (WebKit::NetworkProcess::sourceApplicationAuditData const): (WebKit::NetworkProcess::platformSyncAllCookies): * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * NetworkProcess/ios/NetworkProcessIOS.mm: * Platform/IPC/mac/ConnectionMac.mm: (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog): (IPC::Connection::receiveSourceEventHandler): (IPC::AccessibilityProcessSuspendedNotification): * Platform/ios/AccessibilityIOS.mm: * Platform/mac/LayerHostingContext.mm: (WebKit::LayerHostingContext::createForExternalHostingProcess): * Platform/spi/Cocoa/DeviceIdentitySPI.h: * Platform/spi/ios/CelestialSPI.h: * Platform/spi/ios/FrontBoardServicesSPI.h: * PluginProcess/mac/PluginProcessShim.mm: * Shared/API/Cocoa/WKDataDetectorTypesInternal.h: * Shared/API/Cocoa/WebKit.m: * Shared/AssistedNodeInformation.cpp: * Shared/AssistedNodeInformation.h: * Shared/CacheModel.cpp: (WebKit::calculateURLCacheSizes): * Shared/ChildProcess.cpp: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::runInitializationCode): * Shared/DrawingAreaInfo.h: * Shared/EditorState.cpp: (WebKit::EditorState::encode const): (WebKit::EditorState::decode): (WebKit::EditorState::PostLayoutData::encode const): (WebKit::EditorState::PostLayoutData::decode): (WebKit::operator<<): * Shared/EditorState.h: * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm: (WebKit::XPCServiceInitializerDelegate::checkEntitlements): * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): * Shared/NativeWebKeyboardEvent.h: * Shared/NativeWebMouseEvent.h: * Shared/NativeWebTouchEvent.h: * Shared/PrintInfo.cpp: (WebKit::PrintInfo::encode const): (WebKit::PrintInfo::decode): * Shared/PrintInfo.h: * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h: * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm: (WebKit::RemoteLayerTreePropertyApplier::applyProperties): * Shared/SessionState.cpp: (WebKit::FrameState::encode const): (WebKit::FrameState::decode): * Shared/SessionState.h: * Shared/WebCoreArgumentCoders.cpp: * Shared/WebCoreArgumentCoders.h: * Shared/WebEvent.h: * Shared/WebEventConversion.cpp: (WebKit::WebKit2PlatformTouchEvent::WebKit2PlatformTouchEvent): * Shared/WebKeyboardEvent.cpp: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * Shared/WebPlatformTouchPoint.cpp: * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.cpp: (defaultPassiveTouchListenersAsDefaultOnDocument): (defaultCustomPasteboardDataEnabled): * Shared/WebPreferencesDefaultValues.h: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * Shared/WebTouchEvent.cpp: * Shared/cf/ArgumentCodersCF.cpp: (IPC::encode): (IPC::decode): * Shared/cf/ArgumentCodersCF.h: * Shared/ios/ChildProcessIOS.mm: * Shared/ios/InteractionInformationAtPosition.h: * Shared/ios/InteractionInformationAtPosition.mm: * Shared/ios/InteractionInformationRequest.cpp: * Shared/ios/InteractionInformationRequest.h: * Shared/ios/NativeWebKeyboardEventIOS.mm: * Shared/ios/NativeWebMouseEventIOS.mm: * Shared/ios/NativeWebTouchEventIOS.mm: * Shared/ios/WebIOSEventFactory.h: * Shared/ios/WebIOSEventFactory.mm: * Shared/ios/WebIconUtilities.h: * Shared/ios/WebIconUtilities.mm: * Shared/mac/ArgumentCodersMac.h: * Shared/mac/ArgumentCodersMac.mm: * Shared/mac/SandboxExtensionMac.mm: * Shared/mac/SecItemShim.cpp: (WebKit::initializeSecItemShim): * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::copy const): * UIProcess/API/APIPageConfiguration.h: * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/APIUIClient.h: * UIProcess/API/C/WKInspector.cpp: * UIProcess/API/C/WKPage.cpp: (WKPageSetIgnoresViewportScaleLimits): * UIProcess/API/C/mac/WKContextPrivateMac.mm: (WKContextIsPlugInUpdateAvailable): * UIProcess/API/Cocoa/APIAttachmentCocoa.mm: * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm: (API::WebsiteDataStore::defaultApplicationCacheDirectory): (API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory): (API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory): * UIProcess/API/Cocoa/WKNavigationAction.mm: (-[WKNavigationAction description]): * UIProcess/API/Cocoa/WKPreviewActionItemIdentifiers.mm: * UIProcess/API/Cocoa/WKPreviewElementInfo.mm: * UIProcess/API/Cocoa/WKProcessGroup.mm: (IGNORE_WARNINGS_BEGIN): * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _pluginProcessCount]): * UIProcess/API/Cocoa/WKWebView.mm: (shouldRequireUserGestureToLoadVideo): (validate): (-[WKWebView _initializeWithConfiguration:]): (-[WKWebView _setUpSQLiteDatabaseTrackerClient]): (-[WKWebView dealloc]): (-[WKWebView allowsLinkPreview]): (-[WKWebView setAllowsLinkPreview:]): (-[WKWebView _countStringMatches:options:maxCount:]): (-[WKWebView _findString:options:maxCount:]): (-[WKWebView _hideFindUI]): (-[WKWebView _scrollPerformanceData]): (-[WKWebView _allowsMediaDocumentInlinePlayback]): (-[WKWebView _setAllowsMediaDocumentInlinePlayback:]): (-[WKWebView _contentsOfUserInterfaceItem:]): (-[WKWebView _internalDoAfterNextPresentationUpdate:withoutWaitingForPainting:withoutWaitingForAnimatedResize:]): (-[WKWebView _doAfterNextVisibleContentRectUpdate:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): (-[WKWebViewConfiguration encodeWithCoder:]): (-[WKWebViewConfiguration initWithCoder:]): (-[WKWebViewConfiguration copyWithZone:]): (defaultApplicationNameForUserAgent): * UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h: * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm: (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:userInfo:]): * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h: * UIProcess/API/Cocoa/_WKAttachment.mm: * UIProcess/API/Cocoa/_WKContextMenuElementInfo.mm: * UIProcess/API/Cocoa/_WKElementAction.mm: * UIProcess/API/Cocoa/_WKElementActionInternal.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (-[WKPaymentAuthorizationViewControllerDelegate invalidate]): (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]): (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]): (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]): (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]): (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard): (WebKit::toPKPaymentRequest): (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession): (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection): (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection): (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection): * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: * UIProcess/ApplicationStateTracker.h: * UIProcess/ApplicationStateTracker.mm: * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm: * UIProcess/Automation/ios/WebAutomationSessionIOS.mm: * UIProcess/BackgroundProcessResponsivenessTimer.cpp: (WebKit::BackgroundProcessResponsivenessTimer::shouldBeActive const): * UIProcess/ChildProcessProxy.cpp: (WebKit::ChildProcessProxy::shutDownProcess): * UIProcess/Cocoa/DownloadClient.h: * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::takeActivityToken): (WebKit::DownloadClient::releaseActivityTokenIfNecessary): * UIProcess/Cocoa/LayerRepresentation.h: * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationState): (WebKit::NavigationState::didChangeIsLoading): * UIProcess/Cocoa/PlaybackSessionManagerProxy.h: * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in: * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm: * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): * UIProcess/Cocoa/VersionChecks.h: * UIProcess/Cocoa/VersionChecks.mm: (WebKit::linkedOnOrAfter): * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): (WebKit::VideoFullscreenManagerProxy::exitFullscreen): (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline): (WebKit::VideoFullscreenManagerProxy::setVideoLayerFrame): * UIProcess/Cocoa/ViewGestureController.h: * UIProcess/Cocoa/WKShareSheet.mm: (-[WKShareSheet presentWithParameters:completionHandler:]): * UIProcess/Cocoa/WKWebViewContentProvider.h: * UIProcess/Cocoa/WKWebViewContentProviderRegistry.h: * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm: * UIProcess/Cocoa/WebPageProxyCocoa.mm: * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions): (WebKit::WebProcessPool::platformInitializeWebProcess): (WebKit::WebProcessPool::platformInitializeNetworkProcess): (WebKit::WebProcessPool::registerNotificationObservers): (WebKit::WebProcessPool::unregisterNotificationObservers): * UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm: (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): * UIProcess/Gamepad/ios/UIGamepadProviderIOS.mm: * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::shouldLeakBoost): (WebKit::systemDirectoryPath): (WebKit::ProcessLauncher::launchProcess): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didFinishLaunching): * UIProcess/PageClient.h: * UIProcess/ProcessAssertion.cpp: * UIProcess/ProcessAssertion.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy): (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree): (WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorLocation const): (WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator): (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay): (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState): * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm: (WebKit::RemoteLayerTreeHost::clearLayers): (WebKit::RemoteLayerTreeHost::detachRootLayer): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp: (WebKit::RemoteScrollingTree::createScrollingTreeNode): * UIProcess/RemoteLayerTree/RemoteScrollingTree.h: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm: * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h: * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm: * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp: * UIProcess/WKImagePreviewViewController.h: * UIProcess/WKImagePreviewViewController.mm: * UIProcess/WKInspectorHighlightView.h: * UIProcess/WKInspectorHighlightView.mm: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticatorInternal::buildAuthData): (WebKit::LocalAuthenticator::makeCredential): (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented): (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested): (WebKit::LocalAuthenticator::getAssertion): (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented): * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: (WebKit::LocalConnection::getUserConsent const): (WebKit::LocalConnection::getAttestation const): * UIProcess/WebAuthentication/Cocoa/LocalService.mm: (WebKit::LocalService::isAvailable): * UIProcess/WebFullScreenManagerProxy.cpp: (WebKit::WebFullScreenManagerProxy::supportsFullScreen): * UIProcess/WebGeolocationManagerProxy.cpp: * UIProcess/WebGeolocationManagerProxy.h: * UIProcess/WebInspectorProxy.cpp: * UIProcess/WebOpenPanelResultListenerProxy.cpp: * UIProcess/WebOpenPanelResultListenerProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::m_resetRecentCrashCountTimer): (WebKit::WebPageProxy::finishAttachingToWebProcess): (WebKit::WebPageProxy::initializeWebPage): (WebKit::WebPageProxy::close): (WebKit::WebPageProxy::viewDidLeaveWindow): (WebKit::WebPageProxy::updateThrottleState): (WebKit::WebPageProxy::waitForDidUpdateActivityState): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::exitFullscreenImmediately): (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): (WebKit::WebPageProxy::pageDidScroll): (WebKit::WebPageProxy::processDidTerminate): (WebKit::WebPageProxy::resetState): (WebKit::WebPageProxy::resetStateAfterProcessExited): (WebKit::WebPageProxy::creationParameters): (WebKit::WebPageProxy::requestGeolocationPermissionForFrame): (WebKit::WebPageProxy::hasActiveVideoForControlsManager const): (WebKit::WebPageProxy::requestControlledElementID const): (WebKit::WebPageProxy::isPlayingVideoInEnhancedFullscreen const): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebPasteboardProxy.h: * UIProcess/WebPasteboardProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): (WebKit::WebProcessPool::initializeNewWebProcess): (WebKit::WebProcessPool::updateProcessAssertions): (WebKit::WebProcessPool::reinstateNetworkProcessAssertionState): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::isMainThreadOrCheckDisabled): (WebKit::WebProcessProxy::didFinishLaunching): (WebKit::WebProcessProxy::didSetAssertionState): * UIProcess/WebProcessProxy.h: * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp: (WebKit::LocalStorageDatabaseTracker::databasePath const): * UIProcess/WebStorage/LocalStorageDatabaseTracker.h: * UIProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm: * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: * UIProcess/_WKWebViewPrintFormatter.mm: * UIProcess/_WKWebViewPrintFormatterInternal.h: * UIProcess/ios/DragDropInteractionState.h: * UIProcess/ios/DragDropInteractionState.mm: * UIProcess/ios/InputViewUpdateDeferrer.h: * UIProcess/ios/InputViewUpdateDeferrer.mm: * UIProcess/ios/LayerRepresentation.mm: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: * UIProcess/ios/ProcessAssertionIOS.mm: * UIProcess/ios/ResourceLoadStatisticsPersistentStorageIOS.mm: * UIProcess/ios/SmartMagnificationController.h: * UIProcess/ios/SmartMagnificationController.messages.in: * UIProcess/ios/SmartMagnificationController.mm: * UIProcess/ios/TextCheckerIOS.mm: * UIProcess/ios/ViewGestureControllerIOS.mm: * UIProcess/ios/WKActionSheet.h: * UIProcess/ios/WKActionSheet.mm: * UIProcess/ios/WKActionSheetAssistant.h: * UIProcess/ios/WKActionSheetAssistant.mm: * UIProcess/ios/WKApplicationStateTrackingView.h: * UIProcess/ios/WKApplicationStateTrackingView.mm: * UIProcess/ios/WKContentView.mm: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: * UIProcess/ios/WKGeolocationProviderIOS.h: * UIProcess/ios/WKGeolocationProviderIOS.mm: * UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm: * UIProcess/ios/WKInspectorNodeSearchGestureRecognizer.h: * UIProcess/ios/WKInspectorNodeSearchGestureRecognizer.mm: * UIProcess/ios/WKKeyboardScrollingAnimator.h: * UIProcess/ios/WKKeyboardScrollingAnimator.mm: * UIProcess/ios/WKPDFPageNumberIndicator.h: * UIProcess/ios/WKPDFPageNumberIndicator.mm: * UIProcess/ios/WKPasswordView.h: * UIProcess/ios/WKPasswordView.mm: * UIProcess/ios/WKScrollView.h: * UIProcess/ios/WKScrollView.mm: * UIProcess/ios/WKSyntheticClickTapGestureRecognizer.h: * UIProcess/ios/WKSyntheticClickTapGestureRecognizer.m: * UIProcess/ios/WKWebEvent.h: * UIProcess/ios/WKWebEvent.mm: * UIProcess/ios/WebDataListSuggestionsDropdownIOS.h: * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm: * UIProcess/ios/WebPageProxyIOS.mm: * UIProcess/ios/WebProcessProxyIOS.mm: * UIProcess/ios/forms/WKAirPlayRoutePicker.h: * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: * UIProcess/ios/forms/WKFileUploadPanel.h: * UIProcess/ios/forms/WKFileUploadPanel.mm: * UIProcess/ios/forms/WKFormColorControl.h: * UIProcess/ios/forms/WKFormColorControl.mm: * UIProcess/ios/forms/WKFormColorPicker.h: * UIProcess/ios/forms/WKFormColorPicker.mm: * UIProcess/ios/forms/WKFormInputControl.h: * UIProcess/ios/forms/WKFormInputControl.mm: * UIProcess/ios/forms/WKFormPopover.h: * UIProcess/ios/forms/WKFormPopover.mm: * UIProcess/ios/forms/WKFormSelectControl.h: * UIProcess/ios/forms/WKFormSelectControl.mm: * UIProcess/ios/forms/WKFormSelectPicker.h: * UIProcess/ios/forms/WKFormSelectPicker.mm: * UIProcess/ios/forms/WKFormSelectPopover.h: * UIProcess/ios/forms/WKFormSelectPopover.mm: * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.cpp: * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.h: * UIProcess/ios/fullscreen/WKFullScreenViewController.h: * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h: * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: * UIProcess/ios/fullscreen/WKFullscreenStackView.h: * UIProcess/ios/fullscreen/WKFullscreenStackView.mm: * UIProcess/mac/LegacySessionStateCoding.cpp: (WebKit::encodeFrameStateNode): (WebKit::decodeBackForwardTreeNode): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h: * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: * UIProcess/mac/ViewSnapshotStore.mm: * UIProcess/mac/WKFullScreenWindowController.mm: * WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm: (WebContentServiceInitializer): * WebProcess/FullScreen/WebFullScreenManager.cpp: (WebKit::WebFullScreenManager::videoControlsManagerDidChange): (WebKit::WebFullScreenManager::willEnterFullScreen): (WebKit::WebFullScreenManager::didEnterFullScreen): (WebKit::WebFullScreenManager::willExitFullScreen): * WebProcess/Geolocation/WebGeolocationManager.cpp: * WebProcess/Geolocation/WebGeolocationManager.h: * WebProcess/Geolocation/WebGeolocationManager.messages.in: * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: * WebProcess/InjectedBundle/API/c/mac/WKBundlePageBannerMac.mm: * WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): * WebProcess/WebCoreSupport/SessionStateConversion.cpp: (WebKit::toFrameState): (WebKit::applyFrameState): * WebProcess/WebCoreSupport/WebAlternativeTextClient.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::windowRect): (WebKit::WebChromeClient::enterVideoFullscreenForVideoElement): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebEditorClient.cpp: * WebProcess/WebCoreSupport/WebEditorClient.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidLayout): (WebKit::WebFrameLoaderClient::saveViewStateToItem): (WebKit::WebFrameLoaderClient::restoreViewState): (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): (WebKit::WebFrameLoaderClient::objectContentType): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: * WebProcess/WebCoreSupport/WebPlatformStrategies.h: * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm: * WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm: * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: * WebProcess/WebPage/DrawingArea.cpp: (WebKit::DrawingArea::create): * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::findString): * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm: (WebKit::PlatformCALayerRemoteCustom::PlatformCALayerRemoteCustom): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): * WebProcess/WebPage/ViewGestureGeometryCollector.cpp: (WebKit::ViewGestureGeometryCollector::dispatchDidCollectGeometryForSmartMagnificationGesture): (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture): (WebKit::ViewGestureGeometryCollector::mainFrameDidLayout): * WebProcess/WebPage/ViewGestureGeometryCollector.h: * WebProcess/WebPage/ViewGestureGeometryCollector.messages.in: * WebProcess/WebPage/ViewUpdateDispatcher.cpp: * WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.h: * WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.mm: * WebProcess/WebPage/WebFrame.h: * WebProcess/WebPage/WebOpenPanelResultListener.cpp: * WebProcess/WebPage/WebOpenPanelResultListener.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_cpuLimit): (WebKit::WebPage::~WebPage): (WebKit::WebPage::scalePage): (WebKit::WebPage::setUseFixedLayout): (WebKit::WebPage::disabledAdaptationsDidChange): (WebKit::WebPage::viewportPropertiesDidChange): (WebKit::WebPage::pageDidScroll): (WebKit::WebPage::mouseEvent): (WebKit::WebPage::updatePreferences): (WebKit::WebPage::willCommitLayerTree): (WebKit::WebPage::didFlushLayerTreeAtTime): (WebKit::WebPage::mainFrameDidLayout): (WebKit::WebPage::resetAssistedNodeForFrame): (WebKit::WebPage::elementDidFocus): (WebKit::WebPage::elementDidBlur): (WebKit::WebPage::willReplaceMultipartContent): (WebKit::WebPage::didReplaceMultipartContent): (WebKit::WebPage::didCommitLoad): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/WebPageIOS.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): * WebProcess/WebPage/mac/WebPageMac.mm: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::WebProcess): (WebKit::WebProcess::initializeConnection): (WebKit::WebProcess::initializeWebProcess): (WebKit::WebProcess::actualPrepareToSuspend): (WebKit::WebProcess::cancelPrepareToSuspend): (WebKit::WebProcess::processDidResume): * WebProcess/WebProcess.h: * WebProcess/cocoa/PlaybackSessionManager.h: * WebProcess/cocoa/PlaybackSessionManager.messages.in: * WebProcess/cocoa/PlaybackSessionManager.mm: * WebProcess/cocoa/VideoFullscreenManager.h: * WebProcess/cocoa/VideoFullscreenManager.messages.in: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::supportsVideoFullscreen const): (WebKit::VideoFullscreenManager::supportsVideoFullscreenStandby const): (WebKit::VideoFullscreenManager::didSetupFullscreen): (WebKit::VideoFullscreenManager::didExitFullscreen): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::WebProcess::initializeProcessName): (WebKit::registerWithAccessibility): (WebKit::WebProcess::sourceApplicationAuditData const): (WebKit::WebProcess::initializeSandbox): * WebProcess/mac/SecItemShimLibrary.mm: * config.h: 2018-10-18 Alex Christensen Clean up FrameLoader two-state enums https://bugs.webkit.org/show_bug.cgi?id=190731 Reviewed by Chris Dumez. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * Shared/WebCoreArgumentCoders.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::willPerformClientRedirectForFrame): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2018-10-18 Youenn Fablet Handle MDNS resolution of candidates through libwebrtc directly https://bugs.webkit.org/show_bug.cgi?id=190681 Reviewed by Eric Carlson. Add support for AsyncResolver to resolve MDNS. This basically reuse the code path used to resolve STUN server addresses. Removed MDNS specific resolution. Use existing CFHost resolution mechanism to do the actual resolution. * NetworkProcess/webrtc/NetworkMDNSRegister.cpp: (WebKit::NetworkMDNSRegister::registerMDNSName): * NetworkProcess/webrtc/NetworkMDNSRegister.messages.in: * WebProcess/Network/webrtc/LibWebRTCProvider.cpp: (WebKit::LibWebRTCProvider::createPeerConnection): * WebProcess/Network/webrtc/LibWebRTCProvider.h: * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h: * WebProcess/Network/webrtc/WebMDNSRegister.cpp: * WebProcess/Network/webrtc/WebMDNSRegister.h: * WebProcess/Network/webrtc/WebMDNSRegister.messages.in: 2018-10-18 Chris Dumez [PSON] Cap number of SuspendedPageProxy objects and allow a WebPageProxy to have more than one https://bugs.webkit.org/show_bug.cgi?id=190688 Reviewed by Antti Koivisto. Cap number of SuspendedPageProxy objects to 3 to avoid accumulating too many "suspended" processes. Also allow a WebPageProxy to have more than one SuspendedPageProxy so that PageCache now works for more than 1 history navigation (up to 3 with the suspended page limit in this patch). The following cleanup / refactoring was made to support this: - The SuspendedPageProxy objects are now owned by the WebProcessPool instead of the WebPageProxy. The WebProcessPool is in charge of limiting the number of SuspendedPageProxy objects by dropping the oldest one whenever a WebPageProxy tries to add a new one and we've already reached the limit. - WebProcessProxy no longer needs to know anything about suspended pages, which simplifies the code quite a bit. Instead, the SuspendedPageProxy objects now register themselves as IPC::MessageReceivers with their WebProcessProxy. The SuspendedPageProxy also take care of calling maybeShutdown() on their WebProcessProxy when they get destroyed. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::~SuspendedPageProxy): (WebKit::SuspendedPageProxy::tearDownDrawingAreaInWebProcess): (WebKit::SuspendedPageProxy::unsuspend): (WebKit::SuspendedPageProxy::didFinishLoad): (WebKit::SuspendedPageProxy::didReceiveSyncMessage): * UIProcess/SuspendedPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::suspendCurrentPageIfPossible): (WebKit::WebPageProxy::swapToWebProcess): (WebKit::WebPageProxy::close): (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::didCompletePageTransition): (WebKit::WebPageProxy::enterAcceleratedCompositingMode): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::disconnectProcess): (WebKit::WebProcessPool::processForNavigationInternal): (WebKit::WebProcessPool::addSuspendedPageProxy): (WebKit::WebProcessPool::removeAllSuspendedPageProxiesForPage): (WebKit::WebProcessPool::takeSuspendedPageProxy): (WebKit::WebProcessPool::hasSuspendedPageProxyFor): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didReceiveMessage): (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): (WebKit::WebProcessProxy::canTerminateChildProcess): (WebKit::WebProcessProxy::requestTermination): * UIProcess/WebProcessProxy.h: 2018-10-17 Wenson Hsieh Enable the datalist element by default on iOS and macOS https://bugs.webkit.org/show_bug.cgi?id=190594 Reviewed by Ryosuke Niwa and Tim Horton. * Configurations/FeatureDefines.xcconfig: * Platform/spi/ios/UIKitSPI.h: Add SPI to UITextSuggestion. * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.h: * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm: (-[WKDataListSuggestionCell setText:]): (-[WKDataListSuggestionTable initWithElementRect:]): Fix the 32-bit macOS build with ENABLE(DATALIST_ELEMENT). 2018-10-17 Andy Estes [Apple Pay] Increment the API version to 5 https://bugs.webkit.org/show_bug.cgi?id=190686 Reviewed by Simon Fraser. * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::supportsVersion): 2018-10-17 Alex Christensen BackForwardClient needs to be able to support UIProcess-only back/forward lists https://bugs.webkit.org/show_bug.cgi?id=190675 Reviewed by Chris Dumez. * UIProcess/WebBackForwardList.cpp: (WebKit::WebBackForwardList::itemAtIndex const): (WebKit::WebBackForwardList::backListCount const): (WebKit::WebBackForwardList::forwardListCount const): * UIProcess/WebBackForwardList.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::backForwardBackListCount): (WebKit::WebPageProxy::backForwardForwardListCount): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/WebBackForwardListProxy.cpp: (WebKit::WebBackForwardListProxy::itemAtIndex): (WebKit::WebBackForwardListProxy::backListCount const): (WebKit::WebBackForwardListProxy::forwardListCount const): * WebProcess/WebPage/WebBackForwardListProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::dumpHistoryForTesting): 2018-10-17 Ali Juma Flaky IntersectionObserver web platform tests involving style updates https://bugs.webkit.org/show_bug.cgi?id=189091 Reviewed by Simon Fraser. Add a WebPage::willDisplayPage bottleneck that gets called when flushing layers or, in the non-composited case, when rendering the page into a bitmap. * WebProcess/WebPage/AcceleratedDrawingArea.cpp: (WebKit::AcceleratedDrawingArea::updateBackingStoreState): * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp: (WebKit::CoordinatedLayerTreeHost::layerFlushTimerFired): * WebProcess/WebPage/DrawingAreaImpl.cpp: (WebKit::DrawingAreaImpl::display): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::flushLayers): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::willDisplayPage): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::flushLayers): 2018-10-16 Patrick Griffis [GTK][WPE] Fix xdg-desktop-portal permissions from a sandbox https://bugs.webkit.org/show_bug.cgi?id=190619 Reviewed by Michael Catanzaro. We have to generate a /.flatpak-info file for xdg-desktop-portal to properly treat us as a sandboxed application. * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::createSealedMemFdWithData): (WebKit::argsToFd): (WebKit::XDGDBusProxyLauncher::setPermissions): (WebKit::createFlatpakInfo): (WebKit::bubblewrapSpawn): 2018-10-16 Sihui Liu Add a switch for Web SQL https://bugs.webkit.org/show_bug.cgi?id=190271 Reviewed by Ryosuke Niwa. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetWebSQLDisabled): (WKPreferencesGetWebSQLDisabled): * UIProcess/API/C/WKPreferencesRef.h: 2018-10-16 Alex Christensen Remove InjectedBundleBackForwardList https://bugs.webkit.org/show_bug.cgi?id=190640 Reviewed by Chris Dumez. These objects are only used in testing now, so I made a replacement to be used for testing, WKBundlePageDumpHistoryForTesting and WKBundleClearHistoryForTesting. The existence of these objects is problematic with process swapping and the true back/forward list being in the UIProcess. * Sources.txt: * WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp: (WKBundleBackForwardListGetTypeID): (WKBundleBackForwardListCopyItemAtIndex): (WKBundleBackForwardListGetBackListCount): (WKBundleBackForwardListGetForwardListCount): (WKBundleBackForwardListClear): * WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h: * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp: (WKBundleBackForwardListItemGetTypeID): (WKBundleBackForwardListItemIsSame): (WKBundleBackForwardListItemCopyURL): (WKBundleBackForwardListItemCopyTarget): (WKBundleBackForwardListItemIsTargetItem): (WKBundleBackForwardListItemCopyChildren): * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageDumpHistoryForTesting): (WKBundleClearHistoryForTesting): (WKBundlePageGetBackForwardList): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: * WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp: Removed. * WebProcess/InjectedBundle/InjectedBundleBackForwardList.h: Removed. * WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp: Removed. * WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.h: Removed. * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::~WebPage): (WebKit::dumpHistoryItem): (WebKit::WebPage::dumpHistoryForTesting): (WebKit::WebPage::clearHistory): (WebKit::WebPage::didReceiveSyncMessage): (WebKit::WebPage::backForwardList): Deleted. * WebProcess/WebPage/WebPage.h: 2018-10-16 Timothy Hatcher Add to control what color schemes the page supports https://bugs.webkit.org/show_bug.cgi?id=190526 rdar://problem/45230140 Reviewed by Dean Jackson. * UIProcess/mac/WKPrintingView.mm: (-[WKPrintingView drawRect:]): Update use of LocalDefaultSystemAppearance. * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp: (WebKit::InjectedBundleRangeHandle::renderedImage): Ditto. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::paintControlForLayerInContext): Ditto. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::drawRect): Ditto. 2018-10-16 Justin Michaud Implement feature flag and bindings for CSS Painting API https://bugs.webkit.org/show_bug.cgi?id=190237 Reviewed by Ryosuke Niwa. * Configurations/FeatureDefines.xcconfig: * Shared/WebPreferences.yaml: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): 2018-10-16 Philippe Normand [GLib] Build error with RemoteInspector disabled https://bugs.webkit.org/show_bug.cgi?id=190623 Reviewed by Michael Catanzaro. Compilation guards added to ensure the build still works when the Remote WebInspector has been disabled. * UIProcess/API/glib/WebKitAutomationSession.cpp: * UIProcess/API/glib/WebKitAutomationSessionPrivate.h: * UIProcess/RemoteWebInspectorProxy.cpp: 2018-10-16 Patrick Griffis [GTK][WPE] Fix sandbox on distros with suid bubblewrap https://bugs.webkit.org/show_bug.cgi?id=190616 Reviewed by Michael Catanzaro. * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::bubblewrapSpawn): 2018-10-16 Alex Christensen Replace HistoryItem* with HistoryItem& where possible https://bugs.webkit.org/show_bug.cgi?id=190617 Reviewed by Chris Dumez. * WebProcess/WebCoreSupport/SessionStateConversion.h: * WebProcess/WebPage/WebBackForwardListProxy.cpp: (WebKit::WK2NotifyHistoryItemChanged): (WebKit::WebBackForwardListProxy::goToItem): * WebProcess/WebPage/WebBackForwardListProxy.h: 2018-10-16 Philippe Normand Unreviewed, another GTK build fix after r237146 * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp: (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow): 2018-10-15 Justin Fan Add WebGPU 2018 feature flag and experimental feature flag https://bugs.webkit.org/show_bug.cgi?id=190509 Reviewed by Dean Jackson. Re-add ENABLE_WEBGPU, an experimental feature flag, and a RuntimeEnabledFeature for the 2018 WebGPU prototype. * Configurations/FeatureDefines.xcconfig: * Shared/WebPreferences.yaml: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): 2018-10-15 Alex Christensen Fix API tests after r237146 * Shared/WebPageGroupData.cpp: (WebKit::WebPageGroupData::decode): I accidentally changed the decoder. 2018-10-15 Sihui Liu HSTS cache entries cannot be removed by origin https://bugs.webkit.org/show_bug.cgi?id=190455 Reviewed by Chris Dumez. The SPI _CFNetworkResetHSTS does not recognize url without protocol, so we need to add protocol manually. * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): 2018-10-15 Alex Christensen Fix GTK build, even though bots are not working right now. * UIProcess/gtk/WebInspectorProxyGtk.cpp: (WebKit::WebInspectorProxy::platformCreateFrontendPage): 2018-10-15 Alex Christensen Fix WinCairo build after r237146 * UIProcess/win/WebInspectorProxyWin.cpp: (WebKit::WebInspectorProxy::platformCreateFrontendPage): 2018-10-15 Chris Dumez REGRESSION (r236512): [ Mac WK2 ] Layout Test editing/undo/undo-smart-delete-word.html is flaky https://bugs.webkit.org/show_bug.cgi?id=190375 Reviewed by Ryosuke Niwa. The test is doing the following: > document.execCommand("Delete"); document.execCommand("Undo"); Both operation are synchronous and rely on synchronous IPC from the WebProcess to the UIProcess. However, for the undo operation to succeed, the first command need to have been registered with with the UIProcess via the WebPageProxy::RegisterEditCommandForUndo IPC to the UIProcess, which is asynchronous. After r236512, the UIProcess no longer processes incoming sync / async IPC in order and thus, it is possible for the WebPageProxy::ExecuteUndoRedo synchronous IPC to get processed by the UIProcess *before* the WebPageProxy::RegisterEditCommandForUndo asynchronous IPC for the previous "Delete" command. As a result, canUndo would return false and we would fail to undo. To address the issue, use SendOption::DispatchMessageEvenWhenWaitingForSyncReply flag when sending the WebPageProxy::RegisterEditCommandForUndo IPC, so that it gets processed in order with regards to surrounding synchronous IPC. * WebProcess/WebCoreSupport/WebEditorClient.cpp: (WebKit::WebEditorClient::registerUndoStep): 2018-10-15 Alex Christensen Modernize BackForwardClient.h https://bugs.webkit.org/show_bug.cgi?id=190610 Reviewed by Chris Dumez. * WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp: (WebKit::InjectedBundleBackForwardList::clear): * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::installServiceWorker): * WebProcess/WebPage/WebBackForwardListProxy.cpp: (WebKit::WebBackForwardListProxy::WebBackForwardListProxy): (WebKit::WebBackForwardListProxy::backListCount const): (WebKit::WebBackForwardListProxy::forwardListCount const): (WebKit::WebBackForwardListProxy::backListCount): Deleted. (WebKit::WebBackForwardListProxy::forwardListCount): Deleted. * WebProcess/WebPage/WebBackForwardListProxy.h: (WebKit::WebBackForwardListProxy::create): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_cpuLimit): (WebKit::WebPage::restoreSessionInternal): 2018-10-15 Timothy Hatcher Add support for prefers-color-scheme media query https://bugs.webkit.org/show_bug.cgi?id=190499 rdar://problem/45212025 Reviewed by Dean Jackson. * Configurations/FeatureDefines.xcconfig: Added ENABLE_DARK_MODE_CSS. * Shared/WebPreferences.yaml: Added DarkModeCSSEnabled as experimental. 2018-10-15 Patrick Griffis Remove StorageProcess leftover https://bugs.webkit.org/show_bug.cgi?id=190591 Reviewed by Michael Catanzaro. The process was deleted. * Shared/ChildProcess.h: * Shared/mac/ChildProcessMac.mm: (WebKit::processStorageClass): (WebKit::sandboxDirectory): * UIProcess/ChildProcessProxy.cpp: (WebKit::ChildProcessProxy::getLaunchOptions): * UIProcess/Launcher/ProcessLauncher.h: * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::serviceName): 2018-10-15 Alex Christensen Remove unused parameters of WebPageGroupData https://bugs.webkit.org/show_bug.cgi?id=190600 Reviewed by Chris Dumez. visibleToInjectedBundle and visibleToHistoryClient are both always true. This removes a mysterious check in the history code. * Shared/WebPageGroupData.cpp: (WebKit::WebPageGroupData::encode const): (WebKit::WebPageGroupData::decode): * Shared/WebPageGroupData.h: * UIProcess/WebPageGroup.cpp: (WebKit::WebPageGroup::create): (WebKit::pageGroupData): (WebKit::WebPageGroup::WebPageGroup): * UIProcess/WebPageGroup.h: (WebKit::WebPageGroup::WebPageGroup): (WebKit::WebPageGroup::create): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::updateGlobalHistory): (WebKit::WebFrameLoaderClient::updateGlobalHistoryRedirectLinks): (WebKit::WebFrameLoaderClient::setTitle): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::create): (WebKit::WebPage::close): * WebProcess/WebPage/WebPageGroupProxy.cpp: (WebKit::WebPageGroupProxy::create): * WebProcess/WebPage/WebPageGroupProxy.h: (WebKit::WebPageGroupProxy::pageGroupID const): (WebKit::WebPageGroupProxy::isVisibleToInjectedBundle const): Deleted. (WebKit::WebPageGroupProxy::isVisibleToHistoryClient const): Deleted. 2018-10-15 Chris Dumez Experiment: target=_blank on anchors should imply rel=noopener https://bugs.webkit.org/show_bug.cgi?id=190481 Reviewed by Alex Christensen. * Shared/WebPreferences.yaml: 2018-10-15 Alex Christensen Remove unused parameters from FrameLoaderClient::createFrame https://bugs.webkit.org/show_bug.cgi?id=190587 Reviewed by Chris Dumez. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::createFrame): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2018-10-15 Wenson Hsieh [iOS] Can't select text after dismissing the keyboard when changing focus https://bugs.webkit.org/show_bug.cgi?id=190563 Reviewed by Tim Horton. In r230686, we switched from using UIWKSelectionAssistant to UIWKTextInteractionAssistant for handling selection in non-editable content on iOS; as such, when an editable element loses focus, instead of switching from the text interaction assistant to the web selection assistant as we've previously done, we now reset our text interaction assistant by calling `-[UIWKTextInteractionAssistant setGestureRecognizers]`, which removes all of the current text selection gesture recognizers from WKContentView and regenerates them by building up a tree of `UITextInteraction`s and adding them to the assistant (see `-[UITextInteractionAssistant addGestureRecognizersToView:]`). In particular, `_UITextSelectionForceGesture` is the gesture recognizer used to trigger text selection when long pressing. After dismissing the keyboard by tapping the "Done" button, the UITextInteractions and gesture recognizers on the interaction assistant include: <_UIKeyboardBasedNonEditableTextSelectionInteraction> ↳ "_UIKeyboardTextSelectionGestureForcePress" → <_UITextSelectionForceGesture> However, after the keyboard dismisses due to an editable element losing focus, the UITextInteractions on the interaction assistant look like this: Subsequently, the lack of a `_UIKeyboardBasedNonEditableTextSelectionInteraction` makes text selection by long pressing impossible, since the `_UITextSelectionForceGesture` is never introduced to `WKContentView`. In UIKit, `UITextIndirectNonEditableInteraction` only adds `_UIKeyboardBasedNonEditableTextSelectionInteraction` as a child if the text input view — in our case, WKContentView — is missing an input delegate (see `-initWithView:`). In the case where the Done button is used to dismiss the keyboard, WKContentView loses first responder, and the input delegate of WKContentView is cleared out early on, before we call `-stopAssistingKeyboard`: -[WKContentView(WKInteraction) setInputDelegate:] -[UIKeyboardImpl setDelegate:force:] -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:] -[UIResponder _finishResignFirstResponder] -[UIResponder resignFirstResponder] -[WKContentView(WKInteraction) resignFirstResponderForWebView] -[UIKeyboardImpl dismissKeyboard] However, in the case where the focused element is blurred, we end up clearing out the delegate in `-_stopAssistingNode`, *after* we've already called `-setGestureRecognizers` on the interaction assistant. This means UIKit will skip adding `_UIKeyboardBasedNonEditableTextSelectionInteraction` to the text interaction assistant. -[WKContentView(WKInteraction) setInputDelegate:] -[UIKeyboardImpl setDelegate:force:] -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:] -[UIResponder(UIResponderInputViewAdditions) reloadInputViews] -[WKContentView(WKInteraction) _stopAssistingNode] To fix this, we simply reset our `inputDelegate` earlier in `_stopAssistingKeyboard` instead of waiting until we reload input views. This ensures that UIKit sets up the text interaction assistant's gestures when changing focus in the same way as we would when the keyboard is dismissed via `-resignFirstResponder` (e.g. when pressing the Done button). Test: editing/selection/ios/select-text-after-changing-focus.html * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): (-[WKContentView setUpTextSelectionAssistant]): (-[WKContentView _startAssistingKeyboard]): (-[WKContentView _stopAssistingKeyboard]): (-[WKContentView useSelectionAssistantWithGranularity:]): Deleted. Additionally rename this to -setUpTextSelectionAssistant and remove the selection granularity argument. This was previously used to switch between web and text interaction assistants. 2018-10-15 Remy Demarest Web Inspector: RDM: Toolbar hidden in when Inspector is docked to side. https://bugs.webkit.org/show_bug.cgi?id=190545 rdar://problem/44674500 Reviewed by Brian Burg. When the inspector is placed next to the web view it uses its _topContentInset and _totalHeightOfBanners to lay out the inspector so it does not underlap the window toolbar, but this technique does not work when in responsive design mode because of the different attachment view. This patch fixes the issue by using -[NSWindow contentLayoutRect] to figure out the height of the inspector instead of relying on the content insets of the web view. This requires observing -contentLayoutRect and ensure we only observe its changes when the view is actually on the screen. * UIProcess/WebInspectorProxy.h: Declare helpers to add/remove observer on the attached inspector window. * UIProcess/mac/WKInspectorViewController.h: * UIProcess/mac/WKInspectorViewController.mm: (-[WKInspectorViewController inspectorWKWebView:willMoveToWindow:]): (-[WKInspectorViewController inspectorWKWebViewDidMoveToWindow:]): * UIProcess/mac/WKInspectorWKWebView.h: * UIProcess/mac/WKInspectorWKWebView.mm: (-[WKInspectorWKWebView viewWillMoveToWindow:]): (-[WKInspectorWKWebView viewDidMoveToWindow]): * UIProcess/mac/WebInspectorProxyMac.mm: (-[WKWebInspectorProxyObjCAdapter observeValueForKeyPath:ofObject:change:context:]): Update inspector layout whenever the contentLayoutRect changes. Except when live resizing since the attachment view also sends notifications at the same time. (-[WKWebInspectorProxyObjCAdapter inspectorViewController:willMoveToWindow:]): (-[WKWebInspectorProxyObjCAdapter inspectorViewControllerDidMoveToWindow:]): (WebKit::WebInspectorProxy::attachmentWillMoveFromWindow): Remove the observer only if we set it up before. (WebKit::WebInspectorProxy::attachmentDidMoveToWindow): Set up the observer and immediately update the frame of the inspector since it just moved to its final destination. (WebKit::WebInspectorProxy::inspectedViewFrameDidChange): Adjust the frame of the attached inspector based on the contentLayoutRect of the window rather than the topContentInset of the web view. 2018-10-15 Wenson Hsieh Changing view scale should zoom to initial scale if the page is already at initial scale https://bugs.webkit.org/show_bug.cgi?id=190570 Reviewed by Tim Horton. r237087 added support for changing the view scale on iOS, by making it possible to let the minimum layout size be a factor of the view size; this allows internal clients to change page zoom levels on iOS. Currently, changing the page zoom level automatically zooms to the new initial scale only if the user has not manually scaled the page before, even if the page is already at initial scale (e.g. after the user double taps to zoom on a small element, and double taps again to zoom back out to initial scale). This patch makes some minor adjustments to automatically zoom to the new initial scale after changing the view scale, as long as the page was at initial scale when changing zoom levels. Test: fast/viewport/ios/initial-scale-after-changing-view-scale.html * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::areEssentiallyEqualAsFloat): Move this function further up in the file, so that we can use it in `setViewportConfigurationViewLayoutSize`. (WebKit::WebPage::setViewportConfigurationViewLayoutSize): If the page is near initial scale and the zoom level changes, zoom to the new initial scale. (WebKit::WebPage::viewportConfigurationChanged): Make this take a new enum argument that determines whether we want to zoom to initial scale as a result of the viewport configuration change (`No` by default). 2018-10-15 Chris Dumez Restrict browsing context lookup by name to frames that are related to one another https://bugs.webkit.org/show_bug.cgi?id=190475 Reviewed by Alex Christensen. * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::performJavaScriptURLRequest): 2018-10-15 Alex Christensen Fix assertion after r237102 https://bugs.webkit.org/show_bug.cgi?id=190459 * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: (WebKit::InjectedBundlePageLoaderClient::InjectedBundlePageLoaderClient): Shipping Safari still uses shouldGoToBackForwardListItem, so only assert on newer platforms like we do in WKPageSetPageLoaderClient. 2018-10-15 Alex Christensen Shrink more enum classes https://bugs.webkit.org/show_bug.cgi?id=190540 Reviewed by Chris Dumez. * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkDataTask.h: * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * Shared/Authentication/AuthenticationChallengeDisposition.h: * Shared/Authentication/AuthenticationManager.h: * Shared/Authentication/AuthenticationManager.messages.in: * Shared/DragControllerAction.h: * Shared/LayerTreeContext.h: * Shared/UndoOrRedo.h: * UIProcess/Authentication/AuthenticationDecisionListener.h: * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/Notifications/WebNotification.h: * UIProcess/Notifications/WebNotificationManagerProxy.h: * UIProcess/PageClient.h: * UIProcess/UserContent/WebUserContentControllerProxy.h: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/forms/WKAirPlayRoutePicker.h: * WebProcess/Automation/WebAutomationSessionProxy.messages.in: * WebProcess/MediaStream/UserMediaPermissionRequestManager.h: * WebProcess/Storage/WebSWClientConnection.messages.in: * WebProcess/UserContent/InjectUserScriptImmediately.h: * WebProcess/UserContent/WebUserContentController.h: * WebProcess/UserContent/WebUserContentController.messages.in: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2018-10-15 Michael Catanzaro Add new files missing from previous commit. * Source/cmake/FindLibseccomp.cmake: Added. 2018-10-15 Patrick Griffis [GTK][WPE] Implement subprocess sandboxing https://bugs.webkit.org/show_bug.cgi?id=188568 Reviewed by Michael Catanzaro. This implements sandboxing of WebKitWebProcesses. The sandbox is opt-in at runtime as it is a behavior change. See webkit_web_context_set_sandbox_enabled() and the WEBKIT_FORCE_SANDBOX env var for developers. This is Linux specific using Namespaces, Seccomp, and a DBus proxy service. This introduces three new dependencies: - bwrap executable - libseccomp library - xdg-dbus-proxy executable The use of xdg-dbus-proxy will ideally be replaced once upstream DBus gains the same filtering abilities which is a work in progress. Currently the sandbox is not completed and there are a few large holes: - Pulseaudio: The Pipewire project will solve this. - DRI device access: No immediate solutions planned. - Webcam device access: Pipewire will also solve this. - Webprocess network access: Will require GStreamer changes. - DConf access: Custom proxy planned. - X11 access: Wayland solves this. That is not an exhaustive list but are the noteworthy ones. Filesystem access is still an evolving list as problems are found as is specific DBus name access. * PlatformGTK.cmake: * PlatformWPE.cmake: * SourcesGTK.txt: * SourcesWPE.txt: * UIProcess/API/glib/WebKitWebContext.cpp: (webkit_web_context_set_sandbox_enabled): (webkit_web_context_get_sandbox_enabled): * UIProcess/API/gtk/WebKitWebContext.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitWebContext.h: * UIProcess/ChildProcessProxy.cpp: (WebKit::ChildProcessProxy::getLaunchOptions): * UIProcess/ChildProcessProxy.h: (WebKit::ChildProcessProxy::platformGetLaunchOptions): * UIProcess/Launcher/ProcessLauncher.h: * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: Added. (WebKit::memfd_create): (WebKit::argsToFd): (WebKit::XDGDBusProxyLauncher::setAddress): (WebKit::XDGDBusProxyLauncher::isRunning const): (WebKit::XDGDBusProxyLauncher::path const): (WebKit::XDGDBusProxyLauncher::proxyPath const): (WebKit::XDGDBusProxyLauncher::setPermissions): (WebKit::XDGDBusProxyLauncher::launch): (WebKit::XDGDBusProxyLauncher::childSetupFunc): (WebKit::XDGDBusProxyLauncher::makeProxyPath): (WebKit::XDGDBusProxyLauncher::dbusAddressToPath): (WebKit::bindIfExists): (WebKit::bindDBusSession): (WebKit::bindX11): (WebKit::bindDconf): (WebKit::bindWayland): (WebKit::bindPulse): (WebKit::bindFonts): (WebKit::bindGtkData): (WebKit::bindA11y): (WebKit::bindPathVar): (WebKit::bindGStreamerData): (WebKit::bindOpenGL): (WebKit::bindV4l): (WebKit::bindSymlinksRealPath): (WebKit::setupSeccomp): (WebKit::bubblewrapSpawn): * UIProcess/Launcher/glib/BubblewrapLauncher.h: Added. * UIProcess/Launcher/glib/FlatpakLauncher.cpp: Added. (WebKit::flatpakSpawn): * UIProcess/Launcher/glib/FlatpakLauncher.h: Added. * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp: (WebKit::isInsideFlatpak): (WebKit::ProcessLauncher::launchProcess): * UIProcess/Plugins/PluginProcessProxy.cpp: (WebKit::PluginProcessProxy::getLaunchOptions): * UIProcess/Plugins/PluginProcessProxy.h: * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes): * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp: (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::platformGetLaunchOptions): * UIProcess/WebProcessProxy.h: * UIProcess/glib/WebProcessProxyGLib.cpp: Added. (WebKit::WebProcessProxy::platformGetLaunchOptions): 2018-10-15 Alex Christensen Add a temporarily off by default preference for doing safe browsing checks https://bugs.webkit.org/show_bug.cgi?id=190522 Reviewed by Chris Dumez. Safe browsing development has taken longer than anticipated. To prevent the unused possible contacting the safe browsing provider for no benefit, make this off by default for now. I'll make it on by default when it's actually used. * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _setSafeBrowsingEnabled:]): (-[WKPreferences _safeBrowsingEnabled]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): 2018-10-15 Alex Christensen Include EnumTraits.h less https://bugs.webkit.org/show_bug.cgi?id=190535 Reviewed by Chris Dumez. * NetworkProcess/NetworkSessionCreationParameters.h: * Shared/Authentication/AuthenticationChallengeDisposition.h: * Shared/CoordinateSystem.h: * Shared/LayerTreeContext.h: * Shared/UndoOrRedo.h: * Shared/WebsiteAutoplayPolicy.h: * Shared/WebsitePopUpPolicy.h: * UIProcess/API/APIWebsitePolicies.h: * WebProcess/UserContent/InjectUserScriptImmediately.h: 2018-10-15 Alex Christensen Remove InjectedBundle processing of back/forward lists https://bugs.webkit.org/show_bug.cgi?id=190459 Reviewed by Chris Dumez. * Shared/API/c/WKDeprecated.h: * UIProcess/API/APINavigationClient.h: (API::NavigationClient::willGoToBackForwardListItem): * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::willGoToBackForwardListItem): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::willGoToBackForwardListItem): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h: (API::InjectedBundle::PageLoaderClient::shouldGoToBackForwardListItem): Deleted. * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp: (WKBundleBackForwardListItemCopyOriginalURL): (WKBundleBackForwardListItemCopyTitle): (WKBundleBackForwardListItemIsTargetItem): (WKBundleBackForwardListItemIsInPageCache): (WKBundleBackForwardListItemHasCachedPageExpired): * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h: * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h: * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: (WebKit::InjectedBundlePageLoaderClient::InjectedBundlePageLoaderClient): (WebKit::InjectedBundlePageLoaderClient::shouldGoToBackForwardListItem): Deleted. * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::shouldGoToHistoryItem const): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2018-10-15 Alex Christensen WebPageProxy should always have a HistoryClient https://bugs.webkit.org/show_bug.cgi?id=190450 Reviewed by Chris Dumez. This will make it so we don't forget to null check it. No change in behavior because the default HistoryClient does nothing. * UIProcess/API/APIHistoryClient.h: * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::createHistoryClient): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::WebPageProxy): (WebKit::WebPageProxy::setHistoryClient): (WebKit::WebPageProxy::didNavigateWithNavigationData): (WebKit::WebPageProxy::didPerformClientRedirect): (WebKit::WebPageProxy::didPerformServerRedirect): (WebKit::WebPageProxy::didUpdateHistoryTitle): * UIProcess/WebPageProxy.h: 2018-10-15 Alex Christensen Use std::optional for a WebBackForwardList's current index https://bugs.webkit.org/show_bug.cgi?id=190448 Reviewed by Chris Dumez. Also remove m_capacity, which was immutable. * UIProcess/WebBackForwardList.cpp: (WebKit::WebBackForwardList::WebBackForwardList): (WebKit::WebBackForwardList::~WebBackForwardList): (WebKit::WebBackForwardList::pageClosed): (WebKit::WebBackForwardList::addItem): (WebKit::WebBackForwardList::goToItem): (WebKit::WebBackForwardList::currentItem const): (WebKit::WebBackForwardList::backItem const): (WebKit::WebBackForwardList::forwardItem const): (WebKit::WebBackForwardList::itemAtIndex const): (WebKit::WebBackForwardList::backListCount const): (WebKit::WebBackForwardList::forwardListCount const): (WebKit::WebBackForwardList::backListAsAPIArrayWithLimit const): (WebKit::WebBackForwardList::forwardListAsAPIArrayWithLimit const): (WebKit::WebBackForwardList::removeAllItems): (WebKit::WebBackForwardList::clear): (WebKit::WebBackForwardList::backForwardListState const): (WebKit::WebBackForwardList::restoreFromState): (WebKit::WebBackForwardList::loggingString): * UIProcess/WebBackForwardList.h: (WebKit::WebBackForwardList::currentIndex const): Deleted. 2018-10-14 Yusuke Suzuki [JSC] Remove Option::useAsyncIterator https://bugs.webkit.org/show_bug.cgi?id=190567 Reviewed by Saam Barati. * Configurations/FeatureDefines.xcconfig: 2018-10-12 Wenson Hsieh [iOS] Allow SPI clients to lay out at arbitrarily scaled sizes and scale to fit the view https://bugs.webkit.org/show_bug.cgi?id=190504 Reviewed by Tim Horton. Add support for _setViewScale: and _viewScale on iOS. While similar in concept to macOS, changing this property on iOS uses viewport configurations to change the minimum layout size of the document and apply view scaling. Setting the view scale on iOS to a value `s` multiplies the minimium layout size by a factor `1 / s`, but also multiplies the initial, minimum and maximum scales by a factor of `s`. The net effect of applying this scale causes the page to lay out at a larger width and shrink (or a smaller width and expand) to fit the viewport. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Send `viewportConfigurationLayoutSizeScaleFactor` alongside `viewportConfigurationViewLayoutSize`. (-[WKWebView _dispatchSetViewLayoutSize:]): (-[WKWebView _viewScale]): (-[WKWebView _setViewScale:]): Provide a different implementation of `_setViewScale:` on iOS, by scaling the effective minimum layout size. (See above for more detail). * UIProcess/API/Cocoa/WKWebViewPrivate.h: Add missing API availability annotations for the _viewScale property. * UIProcess/API/mac/WKView.mm: (-[WKView _setViewScale:]): * UIProcess/Cocoa/WebViewImpl.mm: Both -[WKView _setViewScale:] and -[WKWebView _setViewScale:] throw Objective C exceptions upon receiving a bad argument (e.g. scale <= 0). However, logic for throwing this exception is specific to iOS in WKWebView, and handled in WebViewImpl on macOS. To make this less confusing, move the exception throwing code out of !PLATFORM(MAC) in WKWebView, and move the path for raising this exception in WKView on macOS from WebViewImpl to WKView. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::layoutSizeScaleFactor const): Tie the notion of "view scale" on iOS to `layoutSizeScaleFactor`. As its name suggests, this is a scale factor by which we transform the layout size. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize): * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Plumb the layout size scale factor over to the web process, along with the layout size. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::setViewportConfigurationViewLayoutSize): 2018-10-12 Alex Christensen Allow encoding of small enum classes https://bugs.webkit.org/show_bug.cgi?id=190531 Reviewed by Tim Horton. * NetworkProcess/NetworkLoadClient.h: * Scripts/webkit/messages.py: * Scripts/webkit/parser.py: (parse_parameters_string): * UIProcess/API/APINavigation.h: * UIProcess/WebFramePolicyListenerProxy.h: * UIProcess/WebNavigationState.h: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/WebPage.messages.in: 2018-10-12 Rob Buis Solve the confusion around blankURL() and isBlankURL() in URL https://bugs.webkit.org/show_bug.cgi?id=158988 Reviewed by Alex Christensen. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::continueWillSendRequest): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigationInternal): * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::logUserInteraction): (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction): (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction): (WebKit::WebResourceLoadStatisticsStore::setLastSeen): (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource): (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource): (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource): (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource): (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource): (WebKit::WebResourceLoadStatisticsStore::setGrandfathered): (WebKit::WebResourceLoadStatisticsStore::isGrandfathered): (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin): (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin): (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo): (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom): (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo): (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom): 2018-10-12 Youenn Fablet Cache API tests are flaky due to file writing failing from time to time https://bugs.webkit.org/show_bug.cgi?id=190321 Reviewed by Chris Dumez. Make NetworkCache::Storage::store callback return an error in case of writing failure. Use this to surface this error at Cache API level. Minor clean-up to make Storage::clear take a completion handler. Make also sure to create the folder before writing the file in CacheStorageEngine. As can be seen from some logging, it does happen that writing the 'origin' file sometimes fail with Posix error 9, which might mean the folder is not present. Changes are covered by current tests, flaky tests like http/wpt/cache-storage/cache-put-keys.https.any.worker.html will show a "failed writing data to the file system" error message. * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::writeFile): * NetworkProcess/cache/CacheStorageEngine.h: * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::storeOrigin): (WebKit::CacheStorage::Caches::writeCachesToDisk): (WebKit::CacheStorage::Caches::writeRecord): * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::WriteOperation::WriteOperation): (WebKit::NetworkCache::Storage::dispatchWriteOperation): (WebKit::NetworkCache::Storage::finishWriteOperation): (WebKit::NetworkCache::Storage::store): (WebKit::NetworkCache::Storage::clear): * NetworkProcess/cache/NetworkCacheStorage.h: (WebKit::NetworkCache::Storage::store): 2018-10-11 Youenn Fablet IOS 12 - Service worker cache not shared when added to homescreen https://bugs.webkit.org/show_bug.cgi?id=190269 Reviewed by Alex Christensen. NetworkProcessProxy does not always have all its stores in its hash map. Make sure to check for the default web process pool store when grabbing cache storage parameters from a given session ID. Add a way to remove the default website data for testing. This is used in the new API test. * UIProcess/API/APIWebsiteDataStore.cpp: (API::WebsiteDataStore::deleteDefaultDataStoreForTesting): * UIProcess/API/APIWebsiteDataStore.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (+[WKWebsiteDataStore _deleteDefaultDataStoreForTesting]): * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::retrieveCacheStorageParameters): 2018-10-10 Simon Fraser Hide RenderLayer z-order and normal flow lists behind iterators https://bugs.webkit.org/show_bug.cgi?id=190457 Reviewed by Zalan Bujtas. Expose the positive z-order, negative z-order and normal flow lists from RenderLayer as iterators rather than vectors of raw pointers. Use a lambda function to get access to the private constructor, while not having to refer to the nested RenderLayer::LayerIterator class in the header. * Shared/WebRenderLayer.cpp: (WebKit::WebRenderLayer::WebRenderLayer): (WebKit::WebRenderLayer::createArrayFromLayerList): Deleted. * Shared/WebRenderLayer.h: 2018-10-11 Tim Horton iOS: Scrolling using the arrow keys doesn't show the scroll indicator like it does on macOS https://bugs.webkit.org/show_bug.cgi?id=190478 Reviewed by Megan Gardner. * Platform/spi/ios/UIKitSPI.h: Add some SPI. * UIProcess/ios/WKKeyboardScrollingAnimator.mm: (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]): Do a persistent flash when scrolling continuously. (-[WKKeyboardScrollViewAnimator scrollWithScrollToExtentAnimationTo:]): Do a single flash when doing a scroll-to-top/bottom. 2018-10-11 Tim Horton Clicking on bookmarklet crashes at NavigationState::willRecordNavigationSnapshot https://bugs.webkit.org/show_bug.cgi?id=190476 Reviewed by Megan Gardner. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _saveBackForwardSnapshotForItem:]): The WKBackForwardListItem can be nil. Then we retrieve a reference from it. An Objective-C method that returns a reference is a great way to get a null reference. Other code then assumes it's not null and crashes. Add a nil check. 2018-10-11 Tim Horton Hardware keyboard arrow keys/spacebar don't scroll PDFs (works for web content) https://bugs.webkit.org/show_bug.cgi?id=190495 Reviewed by Andy Estes. Hook up WKKeyboardScrollViewAnimator to the scroll view when WKPDFView is installed. * Platform/spi/ios/UIKitSPI.h: Move _inputFlags to the IPI section so we can remove it from WKContentViewInteraction. * SourcesCocoa.txt: * UIProcess/ios/WKWebEvent.h: * UIProcess/ios/WKWebEvent.mm: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView handleKeyEvent:]): (-[WKWebEvent dealloc]): Deleted. * WebKit.xcodeproj/project.pbxproj: Move WKWebEvent out of WKContentViewInteraction. We tend to prefer one file per class. Also, move the code to make a WKWebEvent from a UIEvent into -initWithEvent:, instead of being ad-hoc in WKContentViewInteraction. Adopt RetainPtr for the WKWebEvent's uiEvent property. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _handleKeyUIEvent:]): * UIProcess/Cocoa/WKWebViewContentProvider.h: Plumb hardware keyboard events to custom content views, if they want them. * UIProcess/ios/WKPDFView.mm: (-[WKPDFView dealloc]): (-[WKPDFView web_handleKeyEvent:]): (-[WKPDFView web_initWithFrame:webView:mimeType:]): Install a WKKeyboardScrollViewAnimator and plumb key events to it. 2018-10-11 Antoine Quint [Web Animations] Allow iOS to also control toggling Web Animations CSS Integration https://bugs.webkit.org/show_bug.cgi?id=190489 Reviewed by Tim Horton. * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _setWebAnimationsCSSIntegrationEnabled:]): (-[WKPreferences _webAnimationsCSSIntegrationEnabled]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: 2018-10-11 Keith Rollin CURRENT_ARCH should not be used in Run Script phase. https://bugs.webkit.org/show_bug.cgi?id=190407 Reviewed by Alexey Proskuryakov. CURRENT_ARCH is used in a number of Xcode Run Script phases. However, CURRENT_ARCH is not well-defined during this phase (and may even have the value "undefined") since this phase is run just once per build rather than once per supported architecture. Migrate away from CURRENT_ARCH in favor of ARCHS, either by iterating over ARCHS and performing an operation for each value, or by picking the first entry in ARCHS and using that as a representative value. * DerivedSources.make: When forming TARGET_TRIPLE_FLAGS, grab the first entry in ARCHS rather than use CURRENT_ARCH. 2018-10-11 Chris Dumez Regression(PSON): Deal with the drawing area potentially being null under WebChromeClient::contentsSizeChanged() https://bugs.webkit.org/show_bug.cgi?id=190474 Reviewed by Geoffrey Garen. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::contentsSizeChanged const): 2018-10-11 Alejandro G. Castro [GTK][WPE] Add mediaDevices.enumerateDevices support https://bugs.webkit.org/show_bug.cgi?id=185761 Reviewed by Youenn Fablet. Implemented the enumerateDevices API using a new WebKit class (DeviceIdHashSaltStorage) that generates and stores the device ids hash salts per origin, used to avoid fingerprinting in the webpages. The patch also adds a new type of data for the WebsiteDataStore. That way the users can call the WebsiteDataStore to show what origins have hash salt generated and remove them at some point. For the moment just GTK+ and WPE ports are using this class to generate the hash salts. The patch adds code to the checkUserMediaPermissionForOrigin API implementation, it was empty until now for these ports. In this function we create an instance of a new class WebKitDeviceInfoPermissionRequest that implements the WebKitPermissionRequestIface interface, that allows the ports to use the current permission managers implemented in the embedders to handle this new kind of request the way they like it. The default implementation is deny. The class WebKitDeviceInfoPermissionRequest takes care of contacting the DeviceIdHashSaltStorage and request/regenerate the hash salts accordingly. Persistency is still not implemented, we will add it in a future patch. * Shared/WebsiteData/WebsiteDataType.h: Added the new type of webside data: DeviceIdHashSalt. * Sources.txt: Added new files to compilation. * SourcesGTK.txt: Ditto. * SourcesWPE.txt: Ditto. * UIProcess/API/glib/WebKitDeviceInfoPermissionRequest.cpp: Added this class to represent a request of permission to access the devices information. This is specific for glib ports and implements the policies regarding the hash salts when the embedder allows or denies the access using the DeviceIdHashSaltStorage class. (webkitDeviceInfoPermissionRequestAllow): Get the device hash salt when the origin is allowed and set it in the original request. (webkitDeviceInfoPermissionRequestDeny): Regenerate the device id hash salt when the user does not allow to access the device information. (webkit_permission_request_interface_init): (webkitDeviceInfoPermissionRequestDispose): (webkit_device_info_permission_request_class_init): (webkitDeviceInfoPermissionRequestCreate): Create the class using the proxy request from the webprocess and a reference to the DeviceIdHashSaltStorage. * UIProcess/API/glib/WebKitDeviceInfoPermissionRequestPrivate.h: Ditto. * UIProcess/API/glib/WebKitUIClient.cpp: Added the implementation for the checkUserMediaPermissionForOrigin API for the glib ports, it creates the device info request and calls the permission request API. * UIProcess/API/glib/WebKitWebsiteData.cpp: (recordContainsSupportedDataTypes): Added the DeviceIdHashSalt type. (toWebKitWebsiteDataTypes): Added the conversion from the WebKit types to the glib types for the WebsiteDataType::DeviceIdHashSalt. * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (toWebsiteDataTypes): Added the conversion from the glib type WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT to the WebKit type. (webkit_website_data_manager_remove): Make sure we remote the DeviceIdHashSalt if the Cookies are selected. * UIProcess/API/gtk/WebKitDeviceInfoPermissionRequest.h: Added this new class that represents a permission request for the device information in the GTK+ port. * UIProcess/API/gtk/WebKitWebsiteData.h: Added the new type of website that in the GTK+ port: WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT. * UIProcess/API/wpe/WebKitDeviceInfoPermissionRequest.h: Added this new class that represents a permission request for the device information in the WPE port. * UIProcess/API/wpe/WebKitWebsiteData.h: Added the new type of website that in the WPE port: WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT. * UIProcess/DeviceIdHashSaltStorage.cpp: Added this new class that handles how to generate and store the hash salts inside WebKit. Persistency is still not implemented, we will add it in a future patch. (WebKit::DeviceIdHashSaltStorage::create): (WebKit::DeviceIdHashSaltStorage::deviceIdentifierHashSaltForOrigin): Check the map to get the hash salt for an origin, if there is none create a new random one. (WebKit::DeviceIdHashSaltStorage::regenerateDeviceIdentifierHashSaltForOrigin): Delete the hash salt of an origin if it already exists and create a new one. (WebKit::DeviceIdHashSaltStorage::getDeviceIdHashSaltOrigins): Returns the list of origins that have a hash salt generated for them. It is used in the WebsiteDataStore. (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltForOrigins): Deletes the hash salts in the map for an origin. (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltOriginsModifiedSince): Delete the origins that have not been modified since a time. * UIProcess/DeviceIdHashSaltStorage.h: Ditto. * UIProcess/UserMediaPermissionCheckProxy.h: Remove uneeded class definition. * UIProcess/WebsiteData/WebsiteDataStore.cpp: Added support to return and remove the origins with a generate hash salt used to generate the device ids. (WebKit::WebsiteDataStore::WebsiteDataStore): Added the new reference to the DeviceIdHashSaltStorage class, used to handle the hash salts. (WebKit::WebsiteDataStore::fetchDataAndApply): Get the list of origins with a hash salts in the DeviceIdHashSaltStorage. (WebKit::WebsiteDataStore::removeData): Remove the hash salts in DeviceIdHashSaltStorage for an origin. * UIProcess/WebsiteData/WebsiteDataStore.h: Ditto. (WebKit::WebsiteDataStore::deviceIdHashSaltStorage): * WebKit.xcodeproj/project.pbxproj: Added the DeviceIdHashSaltStorage to the compilation. 2018-10-10 Tim Horton Safari crashes when attempting to share a YouTube video while in full-screen https://bugs.webkit.org/show_bug.cgi?id=190456 Reviewed by Wenson Hsieh. * Platform/spi/ios/UIKitSPI.h: * UIProcess/Cocoa/WKShareSheet.mm: (-[WKShareSheet presentWithParameters:completionHandler:]): Allow the share sheet to present centered, since we don't have enough context to put it in a more sensible place. 2018-10-10 Tim Horton REGRESSION (r236935): Layout test fast/events/ios/keyboard-scrolling-distance.html is timing out https://bugs.webkit.org/show_bug.cgi?id=190444 Reviewed by Simon Fraser. There's a race in WKKeyboardScrollingAnimator that's exacerbated by HIDEventGenerator being much faster than a human finger. We get our "begin" events from interpretKeyEvent, after the Web Content process has had its way with it, but currently the back-channel "handle" events (e.g. for key up, which doesn't go to interpretKeyEvent) are retrieved from handleKeyWebEvent in the UI process, which is *before* the Web Content process has had a swing at it. If you lose the race (an insanely short tap like you get from HIDEventGenerator, or with a very busy Web Content process), we see handle(keyDown), handle(keyUp), begin(keyDown), and get stuck scrolling! Instead, retrieve the out-of-band "handle" events from _didHandleKeyEvent, so that they're sensibly and strictly ordered with respect to the timing of interpretKeyEvent/"begin". Also, hook up didFinishScrolling, so that UIScriptController's callbacks work correctly. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView handleKeyWebEvent:]): (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): (-[WKContentView keyboardScrollViewAnimatorDidFinishScrolling:]): * UIProcess/ios/WKKeyboardScrollingAnimator.h: * UIProcess/ios/WKKeyboardScrollingAnimator.mm: (-[WKKeyboardScrollingAnimator handleKeyEvent:]): (-[WKKeyboardScrollingAnimator displayLinkFired:]): (-[WKKeyboardScrollViewAnimator setDelegate:]): (-[WKKeyboardScrollViewAnimator handleKeyEvent:]): (-[WKKeyboardScrollViewAnimator didFinishScrolling]): 2018-10-10 Tim Horton Share more WKShareSheet code between macOS and iOS, and fix a few bugs https://bugs.webkit.org/show_bug.cgi?id=190420 Reviewed by Simon Fraser. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _resolutionForShareSheetImmediateCompletionForTesting]): (-[WKWebView _setShareSheetCompletesImmediatelyWithResolutionForTesting:]): (-[WKWebView _invokeShareSheetWithResolution:]): Deleted. Add a new mechanism to tell the share sheet up-front that it should immediately dismiss with a particular resolution, for testing. See the Tools ChangeLog for justification. We keep the bit on WKWebView instead of WKShareSheet so that it can be called prior to invoking the share sheet. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/WKShareSheet.h: * UIProcess/Cocoa/WKShareSheet.mm: (-[WKShareSheet initWithView:]): (-[WKShareSheet presentWithParameters:completionHandler:]): (-[WKShareSheet sharingServicePicker:didChooseSharingService:]): (-[WKShareSheet _didCompleteWithSuccess:]): (-[WKShareSheet dismiss]): (-[WKShareSheet dispatchDidDismiss]): (-[WKShareSheet initWithView:initWithView:]): Deleted. (-[WKShareSheet _dispatchDidDismiss]): Deleted. (-[WKShareSheet _cancel]): Deleted. (-[WKShareSheet _dismissDisplayAnimated:]): Deleted. (-[WKShareSheet _presentFullscreenViewController:animated:]): Deleted. (-[WKShareSheet invokeShareSheetWithResolution:]): Deleted. Reduce the number of extraneous members, methods, and #ifdefs. Try to share as much of WKShareSheet between the platforms as makes sense. The interface is now totally identical on the two platforms. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::showShareSheet): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _showShareSheet:completionHandler:]): (-[WKContentView invokeShareSheetWithResolution:]): Deleted. Instead of silently failing (without even calling the completion handler!) if we try to present one share sheet on top of another, dismiss the first and present the new one. This is important because there are (separately filed) bugs on both platforms where the completion handler is not called; now, instead of a tab getting stuck forever, we'll reject the promise when another share takes place. 2018-10-10 Tim Horton REGRESSION (r236678): Keyboard scrolling with arrow keys doesn't work on iOS https://bugs.webkit.org/show_bug.cgi?id=190433 Reviewed by Simon Fraser. * UIProcess/ios/WKKeyboardScrollingAnimator.mm: (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]): (-[WKKeyboardScrollingAnimator beginWithEvent:]): Deleted. (-[WKKeyboardScrollViewAnimator beginWithEvent:]): Deleted. r236678 changes the characters in charactersIgnoringModifiers to match AppKit. We similarly need to update WKKeyboardScrollingAnimator's comparison. 2018-10-10 Yusuke Suzuki [JSC] Rename createXXX to tryCreateXXX if it can return RefPtr https://bugs.webkit.org/show_bug.cgi?id=190429 Reviewed by Saam Barati. Use `tryCreate` or new `create`. If we use new `create`, we can use Ref<> and remove null check. * Shared/API/c/WKString.cpp: (WKStringCopyJSString): * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::toJSValue): (WebKit::callPropertyFunction): (WebKit::WebAutomationSessionProxy::scriptObjectForFrame): (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::runScriptsInPDFDocument): 2018-10-10 Chris Dumez Regression(PSON): Assertion hit under WebPageProxy::didNavigateWithNavigationData() https://bugs.webkit.org/show_bug.cgi?id=190418 Reviewed by Geoffrey Garen. When process swapping and "suspending" the previous WebProcess in a SuspendedPageProxy, we need to keep around the main frame's ID that still exists on in this process. This is needed so that we can re-create a UI-side WebFrameProxy for the WebFrame that exists in the WebProcess, if we ever swap back to this suspended process (see login in WebPageProxy::swapToWebProcess()). The bug was that the main frame ID was stored on the WebPageProxy via m_mainFrameID instead of the SuspendedPageProxy. This means that m_mainFrameID would get overriden when navigating in the new WebProcess with the value 1 (because WebFrame identifiers start at 1 and are per-WebProcess). This would lead to us constructing a WebFrameProxy with the wrong frame identifier in WebPageProxy::swapToWebProcess(), which would override an existing unrelated WebFrame in the WebProcessProxy's HashMap of frames. This would lead to crashes later on as the WebFrame would not be associated to the WebPageProxy we expect. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::SuspendedPageProxy): * UIProcess/SuspendedPageProxy.h: (WebKit::SuspendedPageProxy::mainFrameID const): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::maybeCreateSuspendedPage): (WebKit::WebPageProxy::swapToWebProcess): (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::didCreateMainFrame): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::suspendWebPageProxy): * UIProcess/WebProcessProxy.h: 2018-10-10 Antti Koivisto Do domain prewarming for processes for new tabs https://bugs.webkit.org/show_bug.cgi?id=190425 Reviewed by Chris Dumez. We currently only do domain prewarming for navigation process swaps. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigationInternal): Do domain prewarming when using an existing but so far unused process. (WebKit::WebProcessPool::tryPrewarmWithDomainInformation): Factor into a function. * UIProcess/WebProcessPool.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::close): This didn't usually get invoked. (WebKit::WebPage::didReceivePolicyDecision): (WebKit::WebPage::didFinishLoad): Update prewarm information when a top level load finishes. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::sendPrewarmInformation): * WebProcess/WebProcess.h: 2018-10-09 Antoine Quint Remove the frames() timing function https://bugs.webkit.org/show_bug.cgi?id=190034 Reviewed by Dean Jackson. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): Deleted. (IPC::ArgumentCoder::decode): Deleted. * Shared/WebCoreArgumentCoders.h: * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: (WebKit::PlatformCAAnimationRemote::Properties::encode const): (WebKit::PlatformCAAnimationRemote::Properties::decode): 2018-10-09 Youenn Fablet ASSERTION FAILED: m_cachesLocks.contains(sessionID) in WebKit::CacheStorageEngineConnection::dereference(PAL::SessionID, unsigned long long) https://bugs.webkit.org/show_bug.cgi?id=190373 Reviewed by Alex Christensen. This assertion can be hit if: - WebProcess has a DOMCache - NetworkProcess crashes - WebProcess navigates and dereference DOMCache. Remove this assertion as it is hit when a test is using testRunner.terminateNetworkProcess(). * NetworkProcess/cache/CacheStorageEngineConnection.cpp: (WebKit::CacheStorageEngineConnection::dereference): 2018-10-09 Jer Noble Crash when closing WKWebView during enter fullscreen animation https://bugs.webkit.org/show_bug.cgi?id=190412 Reviewed by Brian Burg. We need a valid _webView if, during -[NSWindow close], we catch a notification saying we failed to enter fullscreen and try to replace the placeholder with the actual _webView. * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController close]): 2018-10-09 Alex Christensen REGRESSION(r231663) loading in hidden WKWebViews stalls because WebProcess is suspended https://bugs.webkit.org/show_bug.cgi?id=190417 Reviewed by Chris Dumez. * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::didChangeIsLoading): Revert r321663, but keep the change to TestWKWebView.mm because that made the tests more reliable. 2018-10-09 Chris Dumez Allow behavior when the parent process IPC::Connection closes to be overridden by ChildProcess subclasses https://bugs.webkit.org/show_bug.cgi?id=190294 Reviewed by Geoffrey Garen. Allow behavior when the parent process IPC::Connection closes to be overridden by ChildProcess subclasses. This will be useful to allow the NetworkProcess to not exit if it still has pending downloads. * NetworkProcess/NetworkProcess.cpp: (WebKit::callExitSoon): (WebKit::NetworkProcess::initializeConnection): * NetworkProcess/NetworkProcess.h: * PluginProcess/PluginProcess.cpp: (WebKit::callExit): (WebKit::PluginProcess::initializeConnection): * PluginProcess/PluginProcess.h: * Shared/ChildProcess.cpp: (WebKit::ChildProcess::didClose): (WebKit::ChildProcess::initialize): (WebKit::callExitNow): Deleted. (WebKit::callExitSoon): Deleted. * Shared/ChildProcess.h: (WebKit::ChildProcess::shouldCallExitWhenConnectionIsClosed const): Deleted. * WebProcess/WebProcess.cpp: (WebKit::callExit): (WebKit::WebProcess::initializeConnection): 2018-10-09 Jer Noble WebDriver: thrown ObjC exception under -[WKFullScreenWindowController windowDidFailToEnterFullScreen:] when session is terminated https://bugs.webkit.org/show_bug.cgi?id=190098 Reviewed by Brian Burg. Forcibly exit fullscreen in resetState(), while the VideoFullscreenManagerProxy is still valid. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetState): 2018-10-09 Daniel Bates [iOS] Ignore some deprecated declarations https://bugs.webkit.org/show_bug.cgi?id=190371 Reviewed by Dan Bernstein. * UIProcess/ios/WKActionSheet.mm: (-[WKActionSheet init]): (-[WKActionSheet presentSheet:]): * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant presentSheet]): * UIProcess/ios/WKContentViewInteraction.mm: * UIProcess/ios/forms/WKFormSelectPicker.mm: (-[WKMultipleSelectPicker initWithView:]): * UIProcess/ios/forms/WKFormSelectPopover.mm: (-[WKSelectTableViewController initWithView:hasGroups:]): 2018-10-09 Claudio Saavedra [WPE] Explicitly link against gmodule where used https://bugs.webkit.org/show_bug.cgi?id=190398 Reviewed by Michael Catanzaro. * PlatformWPE.cmake: 2018-10-09 Chris Dumez PSON: Doing a cross-site navigation via the URL bar does not swap process on iOS https://bugs.webkit.org/show_bug.cgi?id=190378 Reviewed by Geoffrey Garen. Process swapping was sometimes not happening via URL bar navigation on iOS due to top-hit preloading, which would use a new WKWebView for the speculative load and rely on the _relatedWebView SPI to use the same WebContent process as the view currently on screen. To address the issue, if the source URL is empty and the page has a related page, use the related page's URL as source URL when doing the process-swap decision. * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::relatedPage const): (API::PageConfiguration::relatedPage): Deleted. * UIProcess/API/APIPageConfiguration.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigationInternal): 2018-10-09 Andy Estes [iOS] Replace @"UIPreviewDataAttachmentListIsContentManaged" with a UIKit constant https://bugs.webkit.org/show_bug.cgi?id=190400 Reviewed by Wenson Hsieh. Also fixed the iOS version check in WKContentViewInteraction.mm. * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _dataForPreviewItemController:atPosition:type:]): 2018-10-09 Tim Horton REGRESSION (r232416): Can not scroll after swiping back on quoteunquoteapps.com https://bugs.webkit.org/show_bug.cgi?id=190377 Reviewed by Andy Estes. Introduce the notion of 'pausing' to SnapshotRemovalTracker. Reimplement r232416 in terms of this: the SnapshotRemovalTracker starts out paused (not accepting events), and un-pauses when we get a provisional load or same-document navigation. This way, we don't lose the watchdog timer in cases where we get no provisional load, same-document navigation, or main frame load (which is the separate root cause for this bug -- this just papers over it with a timeout). * UIProcess/Cocoa/ViewGestureController.cpp: (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame): (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame): Resume the snapshot removal tracker. (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState): If we didn't see a provisional load or same document navigation, but somehow got to the terminal load state, immediately remove the snapshot. (WebKit::ViewGestureController::SnapshotRemovalTracker::resume): (WebKit::ViewGestureController::SnapshotRemovalTracker::start): Start the SnapshotRemovalTracker out in the paused state; it will be resumed in the same places we previously would call the provisionalOrSameDocumentLoadCallback. (WebKit::ViewGestureController::SnapshotRemovalTracker::stopWaitingForEvent): Ignore (but debug log) incoming events while paused. * UIProcess/Cocoa/ViewGestureController.h: (WebKit::ViewGestureController::SnapshotRemovalTracker::pause): (WebKit::ViewGestureController::SnapshotRemovalTracker::isPaused const): Add the pausing bit. * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::endSwipeGesture): * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::endSwipeGesture): Remove m_provisionalOrSameDocumentLoadCallback. 2018-10-09 Antti Koivisto Prewarm FontDatabase on process swap https://bugs.webkit.org/show_bug.cgi?id=190312 Reviewed by Chris Dumez. Add mechanism for caching prewarm information per domain on UI process side. This information is then passed to newly initialized web processes that are being used for the same domain. * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigationInternal): Pass prewarm information on process swap to the new process. (WebKit::WebProcessPool::didCollectPrewarmInformation): UI process side cache. * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didCollectPrewarmInformation): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::close): (WebKit::WebPage::didReceivePolicyDecision): Collect and cache prewarm information for the previous process on process swap. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::prewarmGlobally): Renamed for clarity. (WebKit::WebProcess::prewarmWithDomainInformation): (WebKit::WebProcess::sendPrewarmInformation): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2018-10-08 Wenson Hsieh [Cocoa] [WK2] Add support for text alignment and text lists in font attributes https://bugs.webkit.org/show_bug.cgi?id=190342 Reviewed by Tim Horton. Add encoding and decoding for text alignment and text lists in FontAttributes. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): 2018-10-08 Justin Fan WebGPU: Rename old WebGPU prototype to WebMetal https://bugs.webkit.org/show_bug.cgi?id=190325 Reviewed by Dean Jackson. Rename WebGPU prototype files to WebMetal in preparation for implementing the new (Oct 2018) WebGPU interface. * Configurations/FeatureDefines.xcconfig: * Shared/WebPreferences.yaml: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): 2018-10-08 Wenson Hsieh Followup to r236942: Make input type=color an internal feature https://bugs.webkit.org/show_bug.cgi?id=189162 Rubber-stamped by Dean Jackson. I've learned from Dean that an internal feature is more suitable than an experimental feature in this scenario. * Shared/WebPreferences.yaml: 2018-10-08 Aditya Keerthi Make a runtime enabled (on-by-default) feature https://bugs.webkit.org/show_bug.cgi?id=189162 Reviewed by Wenson Hsieh and Tim Horton. * Configurations/FeatureDefines.xcconfig: * Shared/WebPreferences.yaml: Add an experimental feature flag for input type=color. * UIProcess/mac/WebColorPickerMac.mm: (-[WKPopoverColorWell webDelegate]): (-[WKPopoverColorWell setWebDelegate:]): 2018-10-08 Tim Horton Try to fix the build * UIProcess/ios/WKKeyboardScrollingAnimator.mm: 2018-10-08 Brian Burg [Mac] Web Automation: some keyboard interactions don't generate events, causing event simulation to stall https://bugs.webkit.org/show_bug.cgi?id=190316 Reviewed by Tim Horton. Some users have reported that Cmd-A for Select All no longer works in safaridriver. Instead, this hangs the session. This happens because the WebAutomationSession class assumes that each call to simulateKeyboardInteraction causes keyboard events to be processed, but in corner cases like Cmd-A, some events that we simulate are swallowed by AppKit and never make it back to WebKit. Because the session never gets the "keyboard events flushed" callback, it assumes the interaction is still ongoing, and never returns, causing a hang. This patch consists of two parts: - Add logging of important state changes and events when simulating user input. - Make code more robust when simulating key actions that generate no events on macOS. This change progresses WPT test key_shortcuts.py::test_mod_a_and_backspace_deletes_all_text on Mac. * Platform/Logging.h: Add a logging channel. * UIProcess/Automation/SimulatedInputDispatcher.cpp: (WebKit::SimulatedInputDispatcher::keyFrameTransitionDurationTimerFired): (WebKit::SimulatedInputDispatcher::transitionBetweenKeyFrames): (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): (WebKit::SimulatedInputDispatcher::run): (WebKit::SimulatedInputDispatcher::finishDispatching): Add a bunch of logging so its easier to figure out where things get stuck. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::simulateKeyboardInteraction): In some cases, no keyboard events need to be processed for the simulated interaction. When that happens, early exit rather than waiting for keyboard events to be flushed. * UIProcess/Automation/mac/WebAutomationSessionMac.mm: (WebKit::WebAutomationSession::sendSynthesizedEventsToPage): Logging. (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): On Mac, if you tap a character key while Command is held down, only a KeyDown event is forwarded to the first responder by AppKit, even if you send a KeyUp event too. In this case don't send an NSEvent since it won't ever be delivered back to WebKit. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::isProcessingKeyboardEvents const): Expose this state for keyboard events too. 2018-10-08 Youenn Fablet NetworkCache::Storage should be WTF::DestructionThread::Main https://bugs.webkit.org/show_bug.cgi?id=190324 Reviewed by Alex Christensen. Use WTF::DestructionThread::Main to make sure that Storage is destroyed in the main thread. Remove the code that was making sure that any ref was destroyed in the main thread. * NetworkProcess/cache/CacheStorageEngineCaches.cpp: Make sure the completion handler is not null. * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::TraverseOperation::TraverseOperation): Make it clear that a ref is taken. (WebKit::NetworkCache::Storage::Storage): (WebKit::NetworkCache::Storage::synchronize): Protect 'this' when dispatching back to the main thread. Move the code that was after dispatch before dispatch to allow moving protectedThis in the dispatch lambda. (WebKit::NetworkCache::Storage::remove): (WebKit::NetworkCache::Storage::traverse): (WebKit::NetworkCache::Storage::clear): (WebKit::NetworkCache::Storage::deleteOldVersions): * NetworkProcess/cache/NetworkCacheStorage.h: 2018-10-08 Tim Horton Adjust keyboard scrolling animator to springy and semiphysical https://bugs.webkit.org/show_bug.cgi?id=190345 Reviewed by Simon Fraser. Introduce WKKeyboardScrollViewAnimator, which wraps WKKeyboardScrollingAnimator and provides a reasonable set of default behaviors for UIScrollView. This is the first step on the way to WKKeyboardScrollingAnimator being platform- and toolkit-agnostic, and helps avoid adding a whole bunch of code to WKContentView. Adopt UIKit's scroll-to-top animation curve for whole-document scrolls. Adjust WKKeyboardScrollingAnimator's physics; it now simulates a spring attached to the page when decelerating. When a key is pressed, it applies a constant force to the page (up to some maximum velocity). When released, the spring causes the page to decelerate smoothly. Add rubber-banding to keyboard scrolling, based on the same spring that decelerates the page. Remove the initial bounce on keydown before starting the smooth scroll. Remove arrow key commands from WKContentView; this avoids double-processing incoming arrow key events, makes the event stream make more sense, and was entirely unnecessary. * Platform/spi/ios/UIKitSPI.h: Add a wide variety of useful SPI. * UIProcess/API/Cocoa/WKWebView.mm: * UIProcess/API/Cocoa/WKWebViewInternal.h: Remove _scrollByContentOffset:animated: because it's only used by the keyboard scrolling mechanism. Remove _arrowKey because we're removing the arrow key commands. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): Create a WKKeyboardScrollViewAnimator (which knows how to directly manipulate a UIScrollView) instead of a WKKeyboardScrollingAnimator (which requires its clients to implement everything in terms of an abstract interface. (-[WKContentView scrollViewWillStartPanOrPinchGesture]): Inform the keyboard scrolling animator that the user is going to start an interactive gesture that needs control of the scroll view, so it can stop its current animated scroll. (-[WKContentView canPerformActionForWebView:withSender:]): (-[WKContentView keyCommands]): (-[WKContentView _arrowKeyForWebView:]): Deleted. Remove arrow key commands. (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:]): Scale from content to WKWebView coordinate space; the keyboard scrolling animator operates in WKWebView coordinates. This was broken before. (-[WKContentView keyboardScrollViewAnimatorWillScroll:]): (-[WKContentView isScrollableForKeyboardScrollViewAnimator:]): (-[WKContentView isKeyboardScrollable]): Deleted. (-[WKContentView distanceForScrollingIncrement:]): Deleted. (-[WKContentView scrollByContentOffset:animated:]): Deleted. Reimplement these as keyboardScrollViewAnimator delegate methods. * UIProcess/ios/WKKeyboardScrollingAnimator.h: Add WKKeyboardScrollViewAnimator, hide the interface for WKKeyboardScrollingAnimator itself in the implementation file. * UIProcess/ios/WKKeyboardScrollingAnimator.mm: (-[WKKeyboardScrollingAnimator initWithScrollable:]): (-[WKKeyboardScrollingAnimator parameters]): (-[WKKeyboardScrollingAnimator invalidate]): (unitVector): Return a unit vector in the given direction. (perpendicularAbsoluteUnitVector): Return a positive unit vector perpendicular to the axis of the given direction. Useful for multiplying with another vector to remove the component in the axis of the given direction. (boxSide): Convert ScrollingDirection to WebCore::PhysicalBoxSide, for use with RectEdges. (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]): Instead of just returning the desired increment, compute everything we'll need for the lifetime of the scroll (including the force applied, maximum velocity, etc.) and return them together. (-[WKKeyboardScrollingAnimator beginWithEvent:]): Use the scrollable's native scroll-to-extent animation (e.g. UIScrollView's scroll-to-top curve) for whole-document scrolls. Remove the first discrete scroll; start the smooth scroll immediately. (-[WKKeyboardScrollingAnimator handleKeyEvent:]): (farthestPointInDirection): (-[WKKeyboardScrollingAnimator stopAnimatedScroll]): Stop the current scroll. Let the spring coast to its natural stopping point given the system's current energy, unless that stopping point is less than one increment from the starting point. In that case, we attach the spring to /that/ point and let it run. (-[WKKeyboardScrollingAnimator startDisplayLinkIfNeeded]): (-[WKKeyboardScrollingAnimator stopDisplayLink]): (-[WKKeyboardScrollingAnimator willStartInteractiveScroll]): Immediately stop all motion if the user touches the screen to scroll or zoom with fingers. (-[WKKeyboardScrollingAnimator displayLinkFired:]): Update the position of the scrollable based on the applied force and spring. See the comments in this function for more details. (-[WKKeyboardScrollViewAnimator init]): (-[WKKeyboardScrollViewAnimator initWithScrollView:]): (-[WKKeyboardScrollViewAnimator dealloc]): (-[WKKeyboardScrollViewAnimator invalidate]): (-[WKKeyboardScrollViewAnimator setDelegate:]): (-[WKKeyboardScrollViewAnimator willStartInteractiveScroll]): (-[WKKeyboardScrollViewAnimator beginWithEvent:]): (-[WKKeyboardScrollViewAnimator handleKeyEvent:]): (-[WKKeyboardScrollViewAnimator isKeyboardScrollable]): (-[WKKeyboardScrollViewAnimator distanceForIncrement:]): (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]): (-[WKKeyboardScrollViewAnimator scrollWithScrollToExtentAnimationTo:]): (-[WKKeyboardScrollViewAnimator contentOffset]): (-[WKKeyboardScrollViewAnimator boundedContentOffset:]): (-[WKKeyboardScrollViewAnimator interactiveScrollVelocity]): (-[WKKeyboardScrollViewAnimator scrollableDirectionsFromOffset:]): (-[WKKeyboardScrollViewAnimator rubberbandableDirections]): Add WKKeyboardScrollViewAnimator, which wraps WKKeyboardScrollingAnimator and provides animated keyboard scrolling for a UIScrollView without much additional plumbing work. It contains reasonable default behaviors, with a few optional delegate methods for customization. (-[WKKeyboardScrollingAnimator _scrollOffsetForEvent:]): Deleted. (-[WKKeyboardScrollingAnimator startAnimatedScroll]): Deleted. 2018-10-08 Jeremy Jones Remove dead code: VideoFullscreenModel::isVisible() https://bugs.webkit.org/show_bug.cgi?id=190356 Reviewed by Jon Lee. Remove isVisible since it is no longer used. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenModelContext::isVisible const): Deleted. (WebKit::VideoFullscreenManagerProxy::isVisible const): Deleted. 2018-10-08 Jeremy Jones Remove dead code: resetMediaState. https://bugs.webkit.org/show_bug.cgi?id=190355 Reviewed by Jon Lee. Remove resetMediaState since it is no longer used. * UIProcess/Cocoa/PlaybackSessionManagerProxy.h: * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in: * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm: (WebKit::PlaybackSessionManagerProxy::resetMediaState): Deleted. * WebProcess/cocoa/PlaybackSessionManager.h: * WebProcess/cocoa/PlaybackSessionManager.mm: (WebKit::PlaybackSessionInterfaceContext::resetMediaState): Deleted. 2018-10-08 Jeremy Jones Use MediaPlayerEnums::VideoGravity in VideoFullscreenModel. https://bugs.webkit.org/show_bug.cgi?id=190357 Reviewed by Jon Lee. Use MediaPlayerEnums::VideoGravity instead of creating another identical enum in VideoFullscreenModel. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenModelContext::setVideoLayerGravity): (WebKit::VideoFullscreenManagerProxy::setVideoLayerGravity): * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::setVideoLayerGravityEnum): 2018-10-08 Alex Christensen Remove WKBundleFileHandleRef https://bugs.webkit.org/show_bug.cgi?id=190360 Reviewed by Tim Horton. WKBundleFrameGetJavaScriptWrapperForFileForWorld and WKBundleFileHandleCreateWithPath were only used in Mail and were removed in rdar://problem/44955158 I need to remove them for rdar://problem/24576194 * Shared/API/APIObject.h: * Shared/API/c/WKDeprecated.h: * Shared/API/c/WKDeprecatedFunctions.cpp: (WKBundleFrameGetJavaScriptWrapperForFileForWorld): (WKBundleFileHandleCreateWithPath): * Sources.txt: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.cpp: Removed. * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h: * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: (WKBundleFrameGetJavaScriptWrapperForFileForWorld): Deleted. * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: * WebProcess/InjectedBundle/DOM/InjectedBundleFileHandle.cpp: Removed. * WebProcess/InjectedBundle/DOM/InjectedBundleFileHandle.h: Removed. * WebProcess/WebPage/WebFrame.cpp: * WebProcess/WebPage/WebFrame.h: 2018-10-08 Konstantin Tokarev Validation in Connection::readBytesFromSocket() is too aggressive https://bugs.webkit.org/show_bug.cgi?id=190281 Reviewed by Michael Catanzaro. Since r217206 Connection::readBytesFromSocket() validates size of control message. However, it compares cmsg_len with attachmentMaxAmount, while Connection::sendOutgoingMessage() computes it as CMSG_LEN(sizeof(int) * attachmentFDBufferLength) where attachmentFDBufferLength <= attachmentMaxAmount. This mismatch between sender and receiver leads to possibility of assertion failure with large number of attachments, e.g. here 62 attachments have cmsg_length == 264. * Platform/IPC/unix/ConnectionUnix.cpp: (IPC::readBytesFromSocket): 2018-10-08 Chris Dumez Have DOMWindowProperty get is frame from its associated DOMWindow https://bugs.webkit.org/show_bug.cgi?id=190341 Reviewed by Alex Christensen. * WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.cpp: (WebKit::InjectedBundleDOMWindowExtension::InjectedBundleDOMWindowExtension): 2018-10-07 Dan Bernstein Tried to fix HAVE(LINK_PREVIEW) iOS builds. * UIProcess/WKImagePreviewViewController.mm: (-[WKImagePreviewViewController previewActions]): 2018-10-06 Dan Bernstein Tried to fix the macOS Mojave build. * UIProcess/API/Cocoa/LegacyBundleForClass.mm: 2018-10-06 Dan Bernstein WebKit part of [Xcode] Update some build settings as recommended by Xcode 10 https://bugs.webkit.org/show_bug.cgi?id=190250 Reviewed by Andy Estes. * Configurations/Base.xcconfig: Enabled CLANG_WARN_COMMA, CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS, CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF, and CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED. * WebKit.xcodeproj/project.pbxproj: Let Xcode update LastUpgradeCheck. * UIProcess/API/Cocoa/WKBrowsingContextController.mm: * UIProcess/API/Cocoa/WKBrowsingContextGroup.mm: * UIProcess/API/Cocoa/WKConnection.mm: * UIProcess/API/Cocoa/WKNavigationData.mm: * UIProcess/API/Cocoa/WKProcessGroup.mm: * UIProcess/API/Cocoa/WKTypeRefWrapper.mm: * UIProcess/API/Cocoa/WKWebView.mm: * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm: * UIProcess/API/mac/WKView.mm: * WebProcess/Plugins/PDF/PDFPlugin.mm: * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: Suppressed -Wdeprecated-implementations around some class, category and method implementations the above files. 2018-10-05 Alex Christensen REGRESSION(r236154) Page loads are not drawn when loaded in shipped Safari11/12 https://bugs.webkit.org/show_bug.cgi?id=190202 Reviewed by Youenn Fablet. Safari11/12 had a WKPageLoaderClient and a WKPageNavigationClient. It did not actually draw the page until its WKPageNavigationClient.renderingProgressDidChange was called. r236154 made it so we only call WKPageLoaderClient.didLayout if an application has both clients. This fixes open source WebKit running with shipped Safari. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didReachLayoutMilestone): 2018-10-05 Chris Dumez [PSON] Drop snapshotting workaround introduced in r235898 https://bugs.webkit.org/show_bug.cgi?id=190314 Reviewed by Geoffrey Garen. Drop snapshotting workaround introduced in r235898 as it is no longer needed now that the flashing bug has been fixed. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::continueNavigationInNewProcess): 2018-10-05 Eric Carlson [MediaStream] RealtimeMediaSource should be able to vend hashed IDs https://bugs.webkit.org/show_bug.cgi?id=190142 Reviewed by Youenn Fablet. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in: * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::Source::Source): (WebKit::UserMediaCaptureManager::createCaptureSource): * WebProcess/cocoa/UserMediaCaptureManager.h: 2018-10-03 Jer Noble Add support for reporting "display composited video frames" through the VideoPlaybackQuality object. https://bugs.webkit.org/show_bug.cgi?id=190266 Reviewed by Eric Carlson. Add a new preference to control the visibility of displayCompositedVideoFrames in the VideoPlaybackQualityObject. * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _setVideoQualityIncludesDisplayCompositingEnabled:]): (-[WKPreferences _videoQualityIncludesDisplayCompositingEnabled]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: 2018-10-05 Ryan Haddad Unreviewed, rolling out r236866. Breaks internal builds. Reverted changeset: "Add support for reporting "display composited video frames" through the VideoPlaybackQuality object." https://bugs.webkit.org/show_bug.cgi?id=190266 https://trac.webkit.org/changeset/236866 2018-10-05 Zach Li Expose whether WKWebProcessPlugInNodeHandle is a select element to clients https://bugs.webkit.org/show_bug.cgi?id=190302 Reviewed by Tim Horton. * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h: Introduce a new property `isSelectElement`. * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm: (-[WKWebProcessPlugInNodeHandle isSelectElement]): * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: (WebKit::InjectedBundleNodeHandle::isSelectElement const): Check whether the node is a select element. * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h: 2018-10-04 Wenson Hsieh [iOS] [WK2] Expose some more editing SPI on WKWebView https://bugs.webkit.org/show_bug.cgi?id=190232 Reviewed by Tim Horton. Exposes a few additional editing commands as SPI on WKWebView, by defining a new extension on WKWebView that also conforms to . This patch implements nearly all of the remaining unimplemented methods on UIResponderStandardEditActions, and the new extension augments this set of editing methods by adding additional editing helpers that don't currently exist on iOS (e.g. toggleStrikeThrough and insertUnorderedList). The names of these new methods have been largely been borrowed from their counterparts on macOS (see: `NSResponder.h`). The new edit actions are added in this patch on iOS are: ``` - (void)alignCenter:(id)sender; - (void)alignJustified:(id)sender; - (void)alignLeft:(id)sender; - (void)alignRight:(id)sender; - (void)indent:(id)sender; - (void)insertOrderedList:(id)sender; - (void)insertUnorderedList:(id)sender; - (void)outdent:(id)sender; - (void)toggleStrikeThrough:(id)sender; - (void)setFont:(UIFont *)font sender:(id)sender; - (void)setFontSize:(CGFloat)fontSize sender:(id)sender; - (void)setTextColor:(UIColor *)color sender:(id)sender; ``` Tests: WKWebViewEditActions.ListInsertion WKWebViewEditActions.ChangeIndentation WKWebViewEditActions.SetAlignment WKWebViewEditActions.ToggleStrikeThrough WKWebViewEditActions.ChangeFontSize WKWebViewEditActions.SetTextColor WKWebViewEditActions.SetFontFamily * Platform/spi/ios/UIKitSPI.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView canPerformAction:withSender:]): Update this to handle the new editing actions. For now, we simply treat all of the new edit actions in the same way as we currently treat bold, italic and underline: that is, they are enabled only when the user is in a richly contenteditable element. (-[WKWebView setFont:sender:]): (-[WKWebView setFontSize:sender:]): Construct and send a set of FontChanges. (-[WKWebView setTextColor:sender:]): Invoke "ForeColor" with the serialized color representation. This allows us to handle `rgba()` color values, which hex format would not permit. * UIProcess/API/Cocoa/WKWebViewPrivate.h: Add the new SPI. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::changeFontAttributes): (WebKit::WebPageProxy::changeFont): Pull logic for applying font and font attribute style changes out of macOS-specific code, and into platform-agnostic code in WebPage and WebPageProxy. * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.h: Add the new supported editing commands as supported actions in WKWebView. The only new editing commands that aren't present in this list are -setFont:sender:, -setColor:sender:, and -setFontSize:sender: which are manually handled in places where the `FOR_EACH_WKCONTENTVIEW_ACTION` macro is otherwise used. In a followup, we could consider augmenting `FOR_EACH_WKCONTENTVIEW_ACTION` to handle actions with multiple arguments. * UIProcess/ios/WKContentViewInteraction.mm: Define a new helper macro here to define boilerplate implementations of the -…ForWebView edit command implementations that turn around and invoke `_page->executeEditCommand` with no additional arguments, and an edit command name matching that of the WebCore edit command. (-[WKContentView toggleStrikeThroughForWebView:]): (-[WKContentView increaseSizeForWebView:]): (-[WKContentView decreaseSizeForWebView:]): (-[WKContentView setFontForWebView:sender:]): (-[WKContentView setFontSizeForWebView:sender:]): (-[WKContentView setTextColorForWebView:sender:]): (-[WKContentView canPerformActionForWebView:sender:]): Add …ForWebView plumbing for the new editing actions, so they turn around and call into WKContentView by default, but behavior may be overridden in WKWebView. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::changeFontAttributes): Deleted. (WebKit::WebPageProxy::changeFont): Deleted. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::changeFontAttributes): (WebKit::WebPage::changeFont): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::changeFontAttributes): Deleted. (WebKit::WebPage::changeFont): Deleted. 2018-10-04 Jer Noble Add support for reporting "display composited video frames" through the VideoPlaybackQuality object. https://bugs.webkit.org/show_bug.cgi?id=190266 Reviewed by Eric Carlson. Add a new preference to control the visibility of displayCompositedVideoFrames in the VideoPlaybackQualityObject. * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _setVideoQualityIncludesDisplayCompositingEnabled:]): (-[WKPreferences _videoQualityIncludesDisplayCompositingEnabled]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: 2018-10-04 Wenson Hsieh [Cocoa] Add SPI to expose typing attributes at the current selection on WKWebView https://bugs.webkit.org/show_bug.cgi?id=190119 Reviewed by Tim Horton. Add support for new WebKit2 SPI to notify the UI delegate about font attributes when the editor state changes (e.g. due to selection changes, or executing an edit command). See below for more detail. Test: FontAttributes.FontAttributesAfterChangingSelection * Shared/EditorState.cpp: (WebKit::EditorState::PostLayoutData::encode const): (WebKit::EditorState::PostLayoutData::decode): * Shared/EditorState.h: Add a new optional `FontAttributes` member to EditorState's post-layout data. FontAttributes are computed and sent over IPC only if the UI delegate implements the new delegate hook which requires information about font attributes. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Add a new flag for the UI process to let a new web page know whether it should additionally compute font attributes when computing editor state. * UIProcess/API/APIUIClient.h: (API::UIClient::needsFontAttributes const): (API::UIClient::didChangeFontAttributes): * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _didChangeEditorState]): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::UIDelegate::UIClient::didChangeFontAttributes): Call out to the UI delegate with a font attribute dictionary, created via FontAttributes on EditorState's post-layout data. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setUIClient): Update whether or not the UI process needs to know about font attributes. The UI process only requires font attribute information if the UI delegate implements `-_webView:didChangeFontAttributes:`. (WebKit::WebPageProxy::setNeedsFontAttributes): (WebKit::WebPageProxy::creationParameters): * UIProcess/WebPageProxy.h: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::editorStateChanged): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::editorStateChanged): Update the cached font attributes in the UI process when receiving a new editor state update. * WebProcess/WebPage/WebPage.cpp: (WebKit::m_cpuLimit): (WebKit::WebPage::editorState const): (WebKit::WebPage::setNeedsFontAttributes): Add a new IPC hook to update whether or not the page should additionally compute font attributes. In the case where the UI delegate changes from something that does not require font attributes to one that does, we additionally schedule an editor state update. (WebKit::WebPage::updateFontAttributesAfterEditorStateChange): Private helper function to plumb FontAttributes to the UI client after an editor state change. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2018-10-04 Jeremy Jones Unify implementation in VideoFullscreenInterfaceAVKit https://bugs.webkit.org/show_bug.cgi?id=190091 rdar://problem/44734523 Reviewed by Jer Noble. Unified code in VideoFullscreenInterfaceAVKit now that new code path is proven and include any changes that had been made in the old path. * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::supportsVideoFullscreenStandby const): (WebKit::VideoFullscreenManager::didSetupFullscreen): (WebKit::VideoFullscreenManager::didExitFullscreen): 2018-10-04 Matt Lewis Unreviewed, rolling out r236730. This caused a consistent crash in test http/tests/media/media- stream/get-display-media-prompt.html. Reverted changeset: "[MediaStream] RealtimeMediaSource should be able to vend hashed IDs" https://bugs.webkit.org/show_bug.cgi?id=190142 https://trac.webkit.org/changeset/236730 2018-10-04 Brian Burg Web Automation: clear pending callbacks when the session terminates https://bugs.webkit.org/show_bug.cgi?id=190259 Reviewed by Joseph Pecoraro. WebAutomationSession::terminate() can be called at any time to nuke the session. However, it's possible that the session is in the midst of simulating keyboard/mouse events. While in that state, there are some CompletionHandler objects waiting for key/mouse events to be flushed. We need to empty out callback maps with CompletionHandler instances so that they do not assert because they were never called. I was able to test this manually by running a test that erroneously hangs while waiting for keyboard input. While the test was hung, I killed the NetworkProcess manually to trigger WebAutomationSession::terminate(). From there, I saw that the Perform Actions REST API call gets cancelled with the appropriate error code. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::terminate): 2018-10-04 Jiewen Tan [WebAuthN] Move time out control from WebProcess to UIProcess https://bugs.webkit.org/show_bug.cgi?id=189642 Reviewed by Chris Dumez. Besides adding a time out timer in the AuthenticatorManager, this patch also adds a new option in MockWebAuthenticationConfiguration to turn on silent failure which is the default policy of treating authenticators' error as suggested by spec. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManagerInternal::collectTransports): (WebKit::AuthenticatorManager::makeCredential): (WebKit::AuthenticatorManager::getAssertion): (WebKit::AuthenticatorManager::respondReceived): (WebKit::AuthenticatorManager::initTimeOutTimer): * UIProcess/WebAuthentication/AuthenticatorManager.h: (WebKit::AuthenticatorManager::requestTimeOutTimer): * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: (WebKit::MockAuthenticatorManager::respondReceivedInternal): * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: 2018-10-04 Yuhan Wu runtime flag and IDL for MediaRecorder https://bugs.webkit.org/show_bug.cgi?id=190018 Reviewed by Youenn Fablet and Chris Dumez. * Shared/WebPreferences.yaml: 2018-10-03 Dan Bernstein Tried to fix non-Cocoa, ENABLE(ATTACHMENT_ELEMENT) builds after r236822. * UIProcess/PageClient.h: 2018-10-03 Dan Bernstein [Cocoa] Let clients specify an NSFileWrapper subclassed to be used for _WKAttachment https://bugs.webkit.org/show_bug.cgi?id=190270 Reviewed by Wenson Hsieh. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration copyWithZone:]): Copy new _attachmentFileWrapperClass ivar. (-[WKWebViewConfiguration _attachmentFileWrapperClass]): Added this getter. (-[WKWebViewConfiguration _setAttachmentFileWrapperClass:]): Added this setter, which raises an exception if the argument is not an NSFileWrapper subclass. * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: Declared new property. * UIProcess/Cocoa/PageClientImplCocoa.h: * UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::allocFileWrapperInstance): Added. Allocates an instance of the class specified in the configuration, or NSFileWrapper if no custom class is specified. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::platformRegisterAttachment): Use PageClient::allocFileWrapperInstance instead of allocating an NSFileWrapper instance. * UIProcess/PageClient.h: (WebKit::PageClient::allocFileWrapperInstance): Defined new function. The default implementation returns nil. 2018-10-03 Youenn Fablet Add VP8 support to WebRTC https://bugs.webkit.org/show_bug.cgi?id=189976 Reviewed by Eric Carlson. * Shared/WebPreferences.yaml: 2018-10-03 Zamiul Haque Search does not cancel after number of matching terms exceed set max limit https://bugs.webkit.org/show_bug.cgi?id=190020 Reviewed by Andy Estes. When searching a PDF document on MobileSafari, the maximum number of matching terms are limited to a set constant. Beyond this limit, a PDF document should not be searched, since the UI will not be updated correspondingly. To this effect, a new SPI was made to cancel a search when the maximum limit of matching terms is reached. This is done without clearing the highlighting for the all the terms that were found under the limit. This bug was a result of not having implemented the new SPI in WKPDFView. This will be tested in a follow-up patch, after re-enabling WKPDFView tests on iOS 12. * UIProcess/ios/WKPDFView.mm: (-[WKPDFView pdfHostViewController:findStringUpdate:done:]): 2018-10-03 Brian Burg [Cocoa] REGRESSION: web content process paused in debugger is considered to be unresponsive if WebKit client is sandboxed https://bugs.webkit.org/show_bug.cgi?id=190256 Reviewed by Alexey Proskuryakov. Instead of giving up when the client is sandboxed, check whether it has the exception that's necessary to get process information. If it is possible, proceed to check whether the web content process has a debugger attached. * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::platformIsBeingDebugged const): Check 'process-info-pidinfo' to see if the sysctl call would be allowed. 2018-10-03 Michael Catanzaro [WPE][GTK] Enable MSE by default https://bugs.webkit.org/show_bug.cgi?id=190243 Reviewed by Xabier Rodriguez-Calvar. * UIProcess/API/glib/WebKitSettings.cpp: (webkit_settings_class_init): 2018-10-02 Alex Christensen Deprecate WKConnection https://bugs.webkit.org/show_bug.cgi?id=190147 Reviewed by Andy Estes. * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * UIProcess/API/Cocoa/WKConnection.h: * UIProcess/API/Cocoa/WKConnection.mm: (didReceiveMessage): (didClose): * UIProcess/API/Cocoa/WKConnectionInternal.h: * UIProcess/API/Cocoa/WKProcessGroup.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm: 2018-10-01 Dean Jackson [macOS] Switching to discrete GPU should be done in the UI process https://bugs.webkit.org/show_bug.cgi?id=189361 Reviewed by Simon Fraser. Implement the UI-side process for triggering a GPU mux. * Platform/Logging.h: Add a WebGL logging channel. * SourcesCocoa.txt: Add the new files: WebSwitchingGPUClient and HighPerformanceGPUManager. * UIProcess/Cocoa/WebProcessProxyCocoa.mm: UI process calls that use HighPerformanceGPUManager to keep track of whether or not this process needs the high-performance GPU. (WebKit::WebProcessProxy::requestHighPerformanceGPU): (WebKit::WebProcessProxy::releaseHighPerformanceGPU): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::~WebProcessProxy): Make sure to unregister with the HighPerformanceGPUManager as the process disappears without manually removing itself (e.g. crashes). * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: New messages. * UIProcess/mac/HighPerformanceGPUManager.cpp: New class that copies most of what used to live in GraphicsContext3DManager. It creates a CGLPixelFormat object when it sees that at least one process needs the high-performance GPU. (WebKit::HighPerformanceGPUManager::singleton): (WebKit::HighPerformanceGPUManager::addProcessRequiringHighPerformance): (WebKit::HighPerformanceGPUManager::removeProcessRequiringHighPerformance): (WebKit::HighPerformanceGPUManager::updateState): * UIProcess/mac/HighPerformanceGPUManager.h: Added. * WebKit.xcodeproj/project.pbxproj: Add new files. * WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.cpp: Implementation of the SwitchingGPUClient for WebCore, which sends messages to the UI process. (WebKit::WebSwitchingGPUClient::singleton): (WebKit::WebSwitchingGPUClient::requestHighPerformanceGPU): (WebKit::WebSwitchingGPUClient::releaseHighPerformanceGPU): * WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.h: Added. * WebProcess/cocoa/WebProcessCocoa.mm: Register the GPUClient. (WebKit::WebProcess::platformInitializeProcess): 2018-10-02 Sihui Liu Fix a potential crash in NetworkProcess::deleteWebsiteDataForOrigins https://bugs.webkit.org/show_bug.cgi?id=190220 Reviewed by Chris Dumez. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): 2018-10-02 Wenson Hsieh [WebKit2] Format > Bold and Format > Italic don't toggle between bold and italic style https://bugs.webkit.org/show_bug.cgi?id=179787 Reviewed by Tim Horton. Fixes the bug by relaxing our policy in WebViewImpl::updateFontManagerIfNeeded. Instead of updating only when the font panel is visible, update when either the font panel is visible, or the selection is in a richly editable area. In the latter case, an up-to-date NSFontManager state is needed in order for certain font formatting menu items, such as bold and italic, to correctly toggle state. Test: FontManagerTests.ToggleBoldAndItalicWithMenuItems * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (-[WKWindowVisibilityObserver observeValueForKeyPath:ofObject:change:context:]): (WebKit::WebViewImpl::selectionDidChange): (WebKit::WebViewImpl::updateFontManagerIfNeeded): Rename updateFontPanelIfNeeded to updateFontManagerIfNeeded, to reflect the new behavior. (WebKit::WebViewImpl::changeFontAttributesFromSender): (WebKit::WebViewImpl::changeFontFromFontManager): (WebKit::WebViewImpl::updateFontPanelIfNeeded): Deleted. 2018-10-02 Alex Christensen Remove ParsedURLString https://bugs.webkit.org/show_bug.cgi?id=190154 Reviewed by Chris Dumez. * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp: (WebKit::NetworkBlobRegistry::writeBlobToFilePath): * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles): * PluginProcess/PluginControllerProxy.cpp: (WebKit::PluginControllerProxy::streamWillSendRequest): (WebKit::PluginControllerProxy::streamDidReceiveResponse): (WebKit::PluginControllerProxy::manualStreamDidReceiveResponse): * Shared/API/APIUserContentURLPattern.h: (API::UserContentURLPattern::matchesURL const): * Shared/WebBackForwardListItem.cpp: (WebKit::WebBackForwardListItem::itemIsInSameDocument const): * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp: (WebKit::RemoteInspectorProtocolHandler::handleRequest): (WebKit::RemoteInspectorProtocolHandler::targetListChanged): * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: (WebKit::PluginProcessProxy::openURL): * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::SuspendedPageProxy): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadFile): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::createNewPage): (WebKit::WebPageProxy::processDidTerminate): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::addProcessToOriginCacheSet): (WebKit::WebProcessPool::processForNavigationInternal): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::WebContextMenuProxyMac::createShareMenuItem): * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::addUserScript): (WebKit::InjectedBundle::addUserStyleSheet): (WebKit::InjectedBundle::removeUserScript): (WebKit::InjectedBundle::removeUserStyleSheet): * WebProcess/Plugins/Plugin.cpp: (WebKit::Plugin::Parameters::decode): * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::url): (WebKit::WebPlatformStrategies::readURLFromPasteboard): 2018-10-01 Dean Jackson Remove CSS Animation Triggers https://bugs.webkit.org/show_bug.cgi?id=190175 Reviewed by Simon Fraser. * Configurations/FeatureDefines.xcconfig: 2018-10-02 Michael Catanzaro REGRESSION(r236662): Fix -Wformat warnings in CacheStorageEngineCaches.cpp https://bugs.webkit.org/show_bug.cgi?id=190205 Reviewed by Chris Dumez. Passing enums to %d is not kosher, at least not according to GCC's -Wformat. Avoid it. * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::initialize): (WebKit::CacheStorage::Caches::readCachesFromDisk): (WebKit::CacheStorage::Caches::writeCachesToDisk): 2018-10-02 Commit Queue Unreviewed, rolling out r236624 and r236671. https://bugs.webkit.org/show_bug.cgi?id=190207 The change in r236624 introduced crashes on the bots (Requested by ryanhaddad on #webkit). Reverted changesets: "Refactoring: eliminate raw pointer usage in Fullscreen code" https://bugs.webkit.org/show_bug.cgi?id=188747 https://trac.webkit.org/changeset/236624 "Unify implementation in VideoFullscreenInterfaceAVKit" https://bugs.webkit.org/show_bug.cgi?id=190091 https://trac.webkit.org/changeset/236671 2018-10-02 Antti Koivisto WebPageProxy::reattachToWebProcess cleanups https://bugs.webkit.org/show_bug.cgi?id=189881 Reviewed by Chris Dumez. Change the factoring to separate swap and crash code paths into different functions. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::reattachToWebProcess): (WebKit::WebPageProxy::swapToWebProcess): Separate function for the swap case. (WebKit::WebPageProxy::finishAttachingToWebProcess): Factor the common parts here. (WebKit::WebPageProxy::continueNavigationInNewProcess): * UIProcess/WebPageProxy.h: 2018-10-02 Adrian Perez de Castro [GTK] Theming of authentication dialog breaks with themes other than Adwaita https://bugs.webkit.org/show_bug.cgi?id=190117 Reviewed by Michael Catanzaro. Adds the missing GTK_STYLE_CLASS_BACKGROUND to the WebKitWebViewDialog widget, which was missing for GTK+ 3.20 or newer, and set the widget as app-paintable to avoid the base class paint method to add an opaque background. Thanks to Benjamin Otte for the guidance to debug the theming issues. * UIProcess/API/gtk/WebKitWebViewDialog.cpp: (webkitWebViewDialogDraw): Remove the style context save/restore, it is unneeded because the style classes are set at widget construction time and not changed ever after. (webkitWebViewDialogConstructed): Mark the widget as app-paintable to avoid the base widget paint operation to fill the whole background, because the dialog widget paints the translucent overlay itself; and also add the missing GTK_STYLE_CLASS_BACKGROUND class at construction when building against GTK+ 3.20 or newer. 2018-10-02 Eric Carlson [MediaStream] RealtimeMediaSource should be able to vend hashed IDs https://bugs.webkit.org/show_bug.cgi?id=190142 Reviewed by Youenn Fablet. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in: * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::Source::Source): (WebKit::UserMediaCaptureManager::createCaptureSource): * WebProcess/cocoa/UserMediaCaptureManager.h: 2018-10-02 Wenson Hsieh [macOS] Implement a way for the UI process to request typing attributes at the current selection https://bugs.webkit.org/show_bug.cgi?id=189983 Reviewed by Ryosuke Niwa. Implements `-[WKWebView typingAttributesWithCompletionHandler:]`, which asynchronously retrieves an NSDictionary containing the typing attributes at the start of the current selection. This is a new asynchronous text input client hook on macOS that is needed in order to support NSInspectorBar on WKWebView. At a high level, this patch builds on top of refactoring done in r236445 to make it possible to send typing attributes from the web process to the UI process, and then adds plumbing in the WebKit2 client layer to surface typing attributes to WKWebView on macOS. Tests: FontManagerTests.TypingAttributesAfterSubscriptAndSuperscript FontManagerTests.ChangeTypingAttributesWithInspectorBar FontManagerTests.ChangeAttributesWithFontEffectsBox * Platform/spi/mac/AppKitSPI.h: * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): Implement IPC coding support for FontAttributes. * Shared/WebCoreArgumentCoders.h: * Shared/mac/ArgumentCodersMac.h: * Shared/mac/ArgumentCodersMac.mm: (IPC::encode): (IPC::decode): Add the ability to encode and decode UIFont. This allows Cocoa platforms to send `FontAttributes.font` over IPC with a single call to IPC::encode/IPC::decode. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView typingAttributesWithCompletionHandler:]): Add plumbing to WebViewImpl. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::selectionDidChange): Update the NSInspectorBar on selection change, but only if it is present and visible, and WKWebView is currently first responder. (WebKit::WebViewImpl::typingAttributesWithCompletionHandler): Call into WebPageProxy to retrieve FontAttributes from the web process, and invoke the callback with an NSDictionary constructed from the retrieved FontAttributes. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart): (WebKit::WebPageProxy::fontAttributesCallback): Add plumbing to retrieve FontAttributes from the web process at the current selection. Additionally, cache the font attributes to avoid doing extra work during subsequent requests. (WebKit::WebPageProxy::resetStateAfterProcessExited): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::cachedFontAttributesAtSelectionStart const): * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::editorStateChanged): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::editorStateChanged): Invalidate cached font attributes. * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::requestFontAttributesAtSelectionStart): Use the currently focused frame's Editor to compute FontAttributes at the current selection, and send the computed FontAttributes back to the UI process. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2018-10-01 Devin Rousso Web Inspector: remove analyzer manager https://bugs.webkit.org/show_bug.cgi?id=190162 Reviewed by Joseph Pecoraro. * InspectorGResources.cmake: Remove eslint. 2018-09-30 Ryosuke Niwa Add a new variant of serializePreservingVisualAppearance which takes VisibleSelection https://bugs.webkit.org/show_bug.cgi?id=190108 Reviewed by Wenson Hsieh. Adopt the new variant which directly takes VisibleSelection. * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp: (WebKit::WebEditorClient::updateGlobalSelection): 2018-10-01 Andy Estes [watchOS] Adopt NSURLSessionCompanionProxyPreference https://bugs.webkit.org/show_bug.cgi?id=190177 Reviewed by Wenson Hsieh. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): 2018-10-01 Chris Dumez [Mac] The UIProcess should listen to memory pressure signals https://bugs.webkit.org/show_bug.cgi?id=190166 Reviewed by Simon Fraser. The UIProcess should listen to memory pressure signals on Mac in order to free memory, similarly to what we already do on iOS. The memory pressure handler currently discards view snapshots and prewarmed processes. * SourcesCocoa.txt: * UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.h: Renamed from Source/WebKit/UIProcess/ios/WebMemoryPressureHandlerIOS.h. * UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.mm: Renamed from Source/WebKit/UIProcess/ios/WebMemoryPressureHandlerIOS.mm. (WebKit::installMemoryPressureHandler): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitialize): * WebKit.xcodeproj/project.pbxproj: 2018-10-01 Sihui Liu Fix Internal iOS Build after r236690 https://bugs.webkit.org/show_bug.cgi?id=190171 Reviewed by Alex Christensen. * Platform/ExtraPrivateSymbolsForTAPI.h: 2018-10-01 Wenson Hsieh [iOS] Add SPI to customize the input accessory view when focusing an element https://bugs.webkit.org/show_bug.cgi?id=190152 Reviewed by Dan Bernstein. Adds SPI on WKFormInputSession to customize the input accessory view, alongside the input view. See below for more details. Test: KeyboardInputTests.CustomInputViewAndInputAccessoryView * UIProcess/API/Cocoa/_WKFormInputSession.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKFormInputSession customInputAccessoryView]): (-[WKFormInputSession setCustomInputAccessoryView:]): Reload input views when the custom input accessory view changes. (-[WKContentView requiresAccessoryView]): If a custom input accessory view is specified, return YES. (-[WKContentView inputAccessoryView]): Return the custom input accessory view if present, and fall back to the default web form accessory view. 2018-10-01 Sihui Liu Remove StorageProcess https://bugs.webkit.org/show_bug.cgi?id=189975 Reviewed by Geoffrey Garen. * CMakeLists.txt: * Configurations/Storage-OSX-sandbox.entitlements: Removed. * Configurations/StorageService.xcconfig: Removed. * Configurations/WebKit.xcconfig: * DerivedSources.make: * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: (WebKit::WebIDBConnectionToClient::putOrAdd): * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer): * PlatformGTK.cmake: * PlatformMac.cmake: * PlatformWPE.cmake: * PlatformWin.cmake: * Shared/ProcessExecutablePath.h: * Shared/Storage/StorageProcessCreationParameters.cpp: Removed. * Shared/Storage/StorageProcessCreationParameters.h: Removed. * Shared/glib/ProcessExecutablePathGLib.cpp: (WebKit::executablePathOfStorageProcess): Deleted. * Sources.txt: * SourcesCocoa.txt: * SourcesGTK.txt: * SourcesWPE.txt: * StorageProcess/EntryPoint/mac/XPCService/StorageService/Info.plist: Removed. * StorageProcess/EntryPoint/mac/XPCService/StorageServiceEntryPoint.mm: Removed. * StorageProcess/EntryPoint/unix/StorageProcessMain.cpp: Removed. * StorageProcess/EntryPoint/win/StorageProcessMain.cpp: Removed. * StorageProcess/StorageProcess.cpp: Removed. * StorageProcess/StorageProcess.h: Removed. * StorageProcess/StorageProcess.messages.in: Removed. * StorageProcess/StorageToWebProcessConnection.cpp: Removed. * StorageProcess/StorageToWebProcessConnection.h: Removed. * StorageProcess/StorageToWebProcessConnection.messages.in: Removed. * StorageProcess/glib/StorageProcessMainGLib.cpp: Removed. * StorageProcess/ios/StorageProcessIOS.mm: Removed. * StorageProcess/mac/StorageProcessMac.mm: Removed. * StorageProcess/mac/com.apple.WebKit.Storage.sb.in: Removed. * StorageProcess/unix/StorageProcessMainUnix.h: Removed. * StorageProcess/win/StorageProcessMainWin.cpp: Removed. * StorageProcess/win/StorageProcessMainWin.h: Removed. * UIProcess/API/C/WKContext.cpp: (WKContextTerminateStorageProcess): Deleted. (WKContextGetDatabaseProcessIdentifier): Deleted. * UIProcess/API/C/WKContext.h: * UIProcess/API/C/WKContextPrivate.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _terminateStorageProcess]): Deleted. (-[WKProcessPool _storageProcessIdentifier]): Deleted. * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp: (WebKit::ProcessLauncher::launchProcess): * UIProcess/Launcher/win/ProcessLauncherWin.cpp: (WebKit::processName): * UIProcess/Storage/StorageProcessProxy.cpp: Removed. * UIProcess/Storage/StorageProcessProxy.h: Removed. * UIProcess/Storage/StorageProcessProxy.messages.in: Removed. * UIProcess/WebContextClient.cpp: (WebKit::WebContextClient::storageProcessDidCrash): Deleted. * UIProcess/WebContextClient.h: * UIProcess/WebContextSupplement.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::sendMemoryPressureEvent): (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled): (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore): Deleted. (WebKit::WebProcessPool::getStorageProcessConnection): Deleted. (WebKit::WebProcessPool::storageProcessCrashed): Deleted. (WebKit::WebProcessPool::storageProcessIdentifier): Deleted. (WebKit::WebProcessPool::terminateStorageProcessForTesting): Deleted. * UIProcess/WebProcessPool.h: (WebKit::WebProcessPool::sendToStorageProcess): Deleted. (WebKit::WebProcessPool::sendToStorageProcessRelaunchingIfNecessary): Deleted. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::getStorageProcessConnection): Deleted. * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::~WebsiteDataStore): (WebKit::WebsiteDataStore::storageProcessParameters): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h: * WebProcess/Storage/WebServiceWorkerProvider.cpp: * WebProcess/Storage/WebToStorageProcessConnection.cpp: Removed. * WebProcess/Storage/WebToStorageProcessConnection.h: Removed. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess): (WebKit::WebProcess::webToStorageProcessConnectionClosed): Deleted. (WebKit::WebProcess::ensureWebToStorageProcessConnection): Deleted. * WebProcess/WebProcess.h: * webkitglib-symbols.map: 2018-10-01 David Quesada Add missing Objective-C versions of downloads SPI https://bugs.webkit.org/show_bug.cgi?id=190149 rdar://problem/44915592 Reviewed by Alex Christensen. * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _downloadURLRequest:]): (-[WKProcessPool _resumeDownloadFromData:path:]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/_WKDownload.h: * UIProcess/API/Cocoa/_WKDownload.mm: (-[_WKDownload resumeData]): * UIProcess/API/Cocoa/_WKDownloadInternal.h: * UIProcess/Cocoa/DownloadClient.mm: Move the DownloadProxy's WrapperTraits out of DownloadClient, and into the internal header so it can be used from other classes (i.e. WKProcessPool here). 2018-10-01 Alex Christensen Fix internal build after r236665 https://bugs.webkit.org/show_bug.cgi?id=189850 * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h: * WebKit.xcodeproj/project.pbxproj: 2018-10-01 Jiewen Tan [WebAuthN] Import a JS CBOR coder https://bugs.webkit.org/show_bug.cgi?id=189877 Reviewed by Chris Dumez. Update MockWebAuthenticationConfiguration to have userCertificateBase64 and intermediateCACertificateBase64 as Local's memeber such that tests can pass those certificates to MockLocalConnection instead of letting it holds some static ones. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::getAttestation const): * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: 2018-10-01 Chris Dumez Regression(r236512): http/tests/navigation/keyboard-events-during-provisional-navigation.html is flaky https://bugs.webkit.org/show_bug.cgi?id=190052 Reviewed by Ryosuke Niwa. * Platform/IPC/Connection.cpp: (IPC::Connection::sendMessage): * Platform/IPC/Connection.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePagePostMessageIgnoringFullySynchronousMode): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::postMessageIgnoringFullySynchronousMode): * WebProcess/WebPage/WebPage.h: 2018-10-01 Daniel Bates [iOS] Special keys are misidentified in DOM keyboard events https://bugs.webkit.org/show_bug.cgi?id=189974 Reviewed by Wenson Hsieh. Take the key code of WebEvent to be the key code for the new WebKeyboardEvent verbatim now that we normalize the character strings of the WebEvent to account for the special UIKit input strings. * Shared/ios/WebIOSEventFactory.mm: (WebIOSEventFactory::createWebKeyboardEvent): 2018-10-01 Alex Christensen Fix an internal build after r236665 https://bugs.webkit.org/show_bug.cgi?id=189850 * WebKit.xcodeproj/project.pbxproj: Make WKNSURLAuthenticationChallenge.h a private header. 2018-10-01 Alex Christensen URL should not use TextEncoding internally https://bugs.webkit.org/show_bug.cgi?id=190111 Reviewed by Andy Estes. * UIProcess/WebInspectorProxy.cpp: 2018-10-01 Jeremy Jones Unify implementation in VideoFullscreenInterfaceAVKit https://bugs.webkit.org/show_bug.cgi?id=190091 rdar://problem/44734523 Reviewed by Jer Noble. Unified code in VideoFullscreenInterfaceAVKit now that new code path is proven and include any changes that had been made in the old path. * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::supportsVideoFullscreenStandby const): (WebKit::VideoFullscreenManager::didSetupFullscreen): (WebKit::VideoFullscreenManager::didExitFullscreen): 2018-10-01 Daniel Bates [iOS] Wrong key event may be sent to UIKit https://bugs.webkit.org/show_bug.cgi?id=189992 Reviewed by Simon Fraser. Retain a clone of a received UIEvent if it is for a hardware key event so as to ensure that we notify the UIKit keyboard code of the correct keyboard event. Currently the UIProcess retains the UIEvent associated with a keyboard event so as to defer notifying the UIKit keyboard code (via -_handleKeyUIEvent) about a received keyboard event until after the WebProcess has processed the raw key event. If this UIEvent is for a hardware keyboard event then it is not sufficient to retain it to preserve its value because UIKit uses a singleton UIEvent for all hardware keyboard events ;=> its value will be clobbered as each hardware keyboard event is received. Instead we need to explicitly clone a UIEvent for a hardware key event before retaining it. * Platform/spi/ios/UIKitSPI.h: Forward declare SPI. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView handleKeyEvent:]): Clone the UIEvent if it is for a hardware key event. 2018-10-01 Alex Christensen Deprecate ObjC SPI in Deprecated Xcode group https://bugs.webkit.org/show_bug.cgi?id=189850 Reviewed by Andy Estes. * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * Shared/mac/ObjCObjectGraph.mm: (WebKit::typeFromObject): (WebKit::ObjCObjectGraph::encode): (WebKit::ObjCObjectGraph::decode): * UIProcess/API/Cocoa/WKBrowsingContextController.h: * UIProcess/API/Cocoa/WKBrowsingContextController.mm: (didStartProvisionalNavigation): (didReceiveServerRedirectForProvisionalNavigation): (didFailProvisionalNavigation): (didCommitNavigation): (didFinishNavigation): (didFailNavigation): (canAuthenticateAgainstProtectionSpace): (didReceiveAuthenticationChallenge): (processDidCrash): (setUpPagePolicyClient): * UIProcess/API/Cocoa/WKBrowsingContextGroup.h: * UIProcess/API/Cocoa/WKBrowsingContextGroupInternal.h: * UIProcess/API/Cocoa/WKBrowsingContextHistoryDelegate.h: * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegate.h: * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h: * UIProcess/API/Cocoa/WKBrowsingContextPolicyDelegate.h: * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h: * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm: (-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]): (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]): (-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]): (-[WKNSURLAuthenticationChallengeSender performDefaultHandlingForAuthenticationChallenge:]): (-[WKNSURLAuthenticationChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]): * UIProcess/API/Cocoa/WKNavigationData.h: * UIProcess/API/Cocoa/WKNavigationDataInternal.h: * UIProcess/API/Cocoa/WKProcessGroup.h: * UIProcess/API/Cocoa/WKProcessGroup.mm: (didCreateConnection): (getInjectedBundleInitializationUserData): (didNavigateWithNavigationData): (didPerformClientRedirect): (didPerformServerRedirect): (didUpdateHistoryTitle): * UIProcess/API/Cocoa/WKTypeRefWrapper.h: * UIProcess/API/Cocoa/WKView.h: (WK_CLASS_DEPRECATED_WITH_REPLACEMENT): * UIProcess/API/Cocoa/_WKThumbnailView.h: * UIProcess/API/Cocoa/_WKThumbnailView.mm: * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::transformHandlesToObjects): (WebKit::WebProcessProxy::transformObjectsToHandles): * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm: (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput): * UIProcess/ios/WKContentView.h: * UIProcess/mac/WebInspectorProxyMac.mm: (WebKit::WebInspectorProxy::inspectedViewFrameDidChange): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::transformHandlesToObjects): (WebKit::WebProcess::transformObjectsToHandles): 2018-10-01 Youenn Fablet [macOS Sierra] Layout Test http/wpt/cache-storage/cache-put-keys.https.any.worker.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=184204 Reviewed by Chris Dumez. NetworkCache::Storage by default limits the length to read to 1500 milliseconds. This is good for the HTTP cache since networking might be faster. It does not work for DOM cache which needs to get these resources even if it takes a long time. Since this is disabled by a Mode::Testing option, use it for DOMCache after renaming it to Mode::AvoidRandomness. Add a bunch of release logging to help debugging error cases. * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::retrieveOriginFromDirectory): (WebKit::CacheStorage::Caches::initialize): (WebKit::CacheStorage::Caches::writeCachesToDisk): (WebKit::CacheStorage::Caches::readRecord): * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::open): * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::dispatchReadOperation): (WebKit::NetworkCache::Storage::shrinkIfNeeded): * NetworkProcess/cache/NetworkCacheStorage.h: 2018-10-01 Olivier Blin [WPE] Remove WebKit2InspectorGResourceBundle.xml https://bugs.webkit.org/show_bug.cgi?id=190132 Reviewed by Michael Catanzaro. * UIProcess/API/wpe/WebKit2InspectorGResourceBundle.xml: Removed. This is unused since legacy INSPECTOR_SERVER implementation has been removed in r217924. 2018-09-30 Eric Carlson [MediaStream] Clean up RealtimeMediaSource settings change handling https://bugs.webkit.org/show_bug.cgi?id=189998 Reviewed by Youenn Fablet. * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::Source::setSettings): 2018-09-30 Eric Carlson [MediaStream] Use display-specific capture factories https://bugs.webkit.org/show_bug.cgi?id=190043 Reviewed by Youenn Fablet. * WebProcess/cocoa/UserMediaCaptureManager.h: 2018-09-29 Commit Queue Unreviewed, rolling out r236631. https://bugs.webkit.org/show_bug.cgi?id=190112 Caused various eventSender tests, including fast/css/pseudo- active-style-sharing*, to fail (Requested by smfr on #webkit). Reverted changeset: "Regression(r236512): http/tests/navigation/keyboard-events- during-provisional-navigation.html is flaky" https://bugs.webkit.org/show_bug.cgi?id=190052 https://trac.webkit.org/changeset/236631 2018-09-29 Chris Dumez [PSON] Deal with the drawing area potentially being null in WebFrameLoaderClient::transitionToCommittedForNewPage() https://bugs.webkit.org/show_bug.cgi?id=190084 Reviewed by Antti Koivisto. Deal with the drawing area potentially being null in WebFrameLoaderClient::transitionToCommittedForNewPage(), as a result of calling WebPage::tearDownDrawingAreaForSuspend(). * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): 2018-09-28 Wenson Hsieh No DOM API to instantiate an attachment for an img element https://bugs.webkit.org/show_bug.cgi?id=189934 Reviewed by Ryosuke Niwa. Makes some adjustments to support using _WKAttachment's file wrapper to change the contents of any image element hosting the attachment in its shadow root. To do this, we add some plumbing to allow the UI process to update an attachment element's enclosing image with data from its file wrapper. * UIProcess/API/APIAttachment.cpp: (API::Attachment::isEmpty const): (API::Attachment::enclosingImageData const): Helper method that creates a SharedBuffer representing image data for the attachment. Only returns a non-null value for attachment elements that are enclosed within an image. * UIProcess/API/APIAttachment.h: * UIProcess/API/Cocoa/APIAttachmentCocoa.mm: (API::Attachment::enclosingImageData const): (API::Attachment::isEmpty const): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _attachmentForIdentifier:]): Add new SPI to request a _WKAttachment for a given unique identifier. Currently, this is only used for testing. * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::platformRegisterAttachment): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::updateAttachmentAttributes): (WebKit::WebPageProxy::registerAttachmentIdentifier): (WebKit::WebPageProxy::didInsertAttachmentWithIdentifier): Plumb whether or not the attachment is enclosed by an image from the web process to the UI process. (WebKit::WebPageProxy::didRemoveAttachmentWithIdentifier): (WebKit::WebPageProxy::didInsertAttachment): Deleted. (WebKit::WebPageProxy::didRemoveAttachment): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebEditorClient.cpp: (WebKit::WebEditorClient::registerAttachmentIdentifier): (WebKit::WebEditorClient::didInsertAttachmentWithIdentifier): Update attachment attributes after inserting an attachment. This ensures that an attachment that was created and later inserted via script into the document will be synced with state in the UI process, if the client has changed the contents of the attachment. * WebProcess/WebCoreSupport/WebEditorClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateAttachmentAttributes): Plumb attachment data from the UI process to the web process. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2018-09-28 Chris Dumez Regression(r236512): http/tests/navigation/keyboard-events-during-provisional-navigation.html is flaky https://bugs.webkit.org/show_bug.cgi?id=190052 Reviewed by Ryosuke Niwa. Introduce a new IPC::SendOption indicating that the IPC should always be sent asynchronously, even if the connection is in fully synchronous mode. This is used by WebKitTestRunner for all text outputting (e.g. console.log) is asynchronous, and thus in order. * Platform/IPC/Connection.cpp: (IPC::Connection::sendMessage): * Platform/IPC/Connection.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePagePostMessageIgnoringFullySynchronousMode): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::postMessageIgnoringFullySynchronousMode): * WebProcess/WebPage/WebPage.h: 2018-09-28 John Wilander Skip debug assertion in ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain() https://bugs.webkit.org/show_bug.cgi?id=190097 Reviewed by Chris Dumez. The change in https://bugs.webkit.org/show_bug.cgi?id=190055 causes a re-classification that may trigger a debug assertion in ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain(). We should skip the assertion for statistics model version 14 to avoid this. * UIProcess/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain const): 2018-09-28 Devin Rousso Web Inspector: crash in InspectorNetworkAgent::didReceiveResponse when loading denied x-frame resources https://bugs.webkit.org/show_bug.cgi?id=190046 Reviewed by Joseph Pecoraro. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::didReceiveResponse): (WebKit::NetworkResourceLoader::didRetrieveCacheEntry): Send the sanitized `ResourceResponse` with the message so WebInspector is able to access it. * WebProcess/Network/WebResourceLoader.h: * WebProcess/Network/WebResourceLoader.cpp: * WebProcess/Network/WebResourceLoader.messages.in: (WebKit::WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied): 2018-09-28 Jiewen Tan [WebAuthN] Polish WebAuthN auto-test environment https://bugs.webkit.org/show_bug.cgi?id=189283 Reviewed by Chris Dumez. This patch changes MockWebAuthenticationConfiguration.local to optional such that tests can express absence of local authenticators. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::getUserConsent const): (WebKit::MockLocalConnection::getAttestation const): * UIProcess/WebAuthentication/Mock/MockLocalService.cpp: (WebKit::MockLocalService::platformStartDiscovery const): * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: 2018-09-28 Jer Noble Refactoring: eliminate raw pointer usage in Fullscreen code https://bugs.webkit.org/show_bug.cgi?id=188747 Reviewed by Alex Christensen. Adopt those Ref and WeakPtr changes made in WebCore. * UIProcess/Cocoa/PlaybackSessionManagerProxy.h: * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm: (WebKit::PlaybackSessionModelContext::addClient): (WebKit::PlaybackSessionModelContext::removeClient): (WebKit::PlaybackSessionModelContext::durationChanged): (WebKit::PlaybackSessionModelContext::currentTimeChanged): (WebKit::PlaybackSessionModelContext::bufferedTimeChanged): (WebKit::PlaybackSessionModelContext::rateChanged): (WebKit::PlaybackSessionModelContext::seekableRangesChanged): (WebKit::PlaybackSessionModelContext::canPlayFastReverseChanged): (WebKit::PlaybackSessionModelContext::audioMediaSelectionOptionsChanged): (WebKit::PlaybackSessionModelContext::legibleMediaSelectionOptionsChanged): (WebKit::PlaybackSessionModelContext::audioMediaSelectionIndexChanged): (WebKit::PlaybackSessionModelContext::legibleMediaSelectionIndexChanged): (WebKit::PlaybackSessionModelContext::externalPlaybackChanged): (WebKit::PlaybackSessionModelContext::wirelessVideoPlaybackDisabledChanged): (WebKit::PlaybackSessionModelContext::mutedChanged): (WebKit::PlaybackSessionModelContext::volumeChanged): (WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged): (WebKit::PlaybackSessionManagerProxy::invalidate): (WebKit::PlaybackSessionManagerProxy::createModelAndInterface): (WebKit::PlaybackSessionManagerProxy::removeClientForContext): * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenModelContext::create): (WebKit::VideoFullscreenModelContext::VideoFullscreenModelContext): (WebKit::VideoFullscreenModelContext::addClient): (WebKit::VideoFullscreenModelContext::removeClient): (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::willExitPictureInPicture): (WebKit::VideoFullscreenModelContext::didExitPictureInPicture): (WebKit::VideoFullscreenManagerProxy::invalidate): (WebKit::VideoFullscreenManagerProxy::createModelAndInterface): (WebKit::VideoFullscreenManagerProxy::removeClientForContext): (WebKit::VideoFullscreenModelContext::~VideoFullscreenModelContext): Deleted. * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface): (WKFullScreenViewControllerVideoFullscreenModelClient::setInterface): (-[WKFullScreenViewController videoControlsManagerDidChange]): (-[WKFullScreenViewController _togglePiPAction:]): * UIProcess/mac/WKFullScreenWindowController.mm: (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface): * WebProcess/cocoa/PlaybackSessionManager.h: * WebProcess/cocoa/PlaybackSessionManager.mm: (WebKit::PlaybackSessionInterfaceContext::PlaybackSessionInterfaceContext): (WebKit::PlaybackSessionManager::~PlaybackSessionManager): (WebKit::PlaybackSessionManager::createModelAndInterface): (WebKit::PlaybackSessionManager::removeContext): (WebKit::PlaybackSessionInterfaceContext::~PlaybackSessionInterfaceContext): Deleted. * WebProcess/cocoa/VideoFullscreenManager.h: (WebKit::VideoFullscreenInterfaceContext::create): (WebKit::VideoFullscreenInterfaceContext::createWeakPtr): * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenInterfaceContext::VideoFullscreenInterfaceContext): (WebKit::VideoFullscreenManager::~VideoFullscreenManager): (WebKit::VideoFullscreenManager::createModelAndInterface): (WebKit::VideoFullscreenManager::removeContext): 2018-09-28 Chris Dumez Drop support for cross-origin-window-policy header https://bugs.webkit.org/show_bug.cgi?id=190081 Reviewed by Ryosuke Niwa. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: * UIProcess/API/C/WKPreferencesRef.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::frameBecameRemote): 2018-09-28 Chris Dumez Do not do automatic process prewarming while under memory pressure https://bugs.webkit.org/show_bug.cgi?id=190082 Reviewed by Geoffrey Garen. Do not do automatic process prewarming while under memory pressure and also terminate any prewarmed process when receiving a memory warning. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::prewarmProcess): (WebKit::WebProcessPool::didReachGoodTimeToPrewarm): (WebKit::WebProcessPool::handleMemoryPressureWarning): * UIProcess/WebProcessPool.h: * UIProcess/ios/WebMemoryPressureHandlerIOS.mm: (WebKit::installMemoryPressureHandler): 2018-09-28 Daniel Bates [iOS] Allow programmatic focus when hardware keyboard is attached https://bugs.webkit.org/show_bug.cgi?id=190017 Reviewed by Wenson Hsieh. Make the experience of using iOS with a hardware keyboard more desktop-like by allowing programmatic focusing of editable elements. * Platform/spi/ios/UIKitSPI.h: Forward declare SPI. * Shared/NativeWebKeyboardEvent.h: * Shared/ios/NativeWebKeyboardEventIOS.mm: (WebKit::isInHardwareKeyboardMode): Returns whether we are in hardware keyboard mode. In DumpRenderTree and WebKitTestRunner this function always returns false to keep test results deterministic. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): Allow starting an input session if we are in hardware keyboard mode. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::platformEditorState const): Send the full editor state if we are in hardware keyboard mode regardless of whether layout has been performed so that UIProcess can update UI, including the position of the caret, immediately. 2018-09-28 Ryosuke Niwa Rename createMarkup to serializePreservingVisualAppearance https://bugs.webkit.org/show_bug.cgi?id=190086 Reviewed by Wenson Hsieh. * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp: (WebKit::WebEditorClient::updateGlobalSelection): 2018-09-28 Commit Queue Unreviewed, rolling out r236605. https://bugs.webkit.org/show_bug.cgi?id=190087 caused three API test timeouts (Requested by jernoble on #webkit). Reverted changeset: "Refactoring: eliminate raw pointer usage in Fullscreen code" https://bugs.webkit.org/show_bug.cgi?id=188747 https://trac.webkit.org/changeset/236605 2018-09-28 Jer Noble Refactoring: eliminate raw pointer usage in Fullscreen code https://bugs.webkit.org/show_bug.cgi?id=188747 Reviewed by Alex Christensen. Adopt those Ref and WeakPtr changes made in WebCore. * UIProcess/Cocoa/PlaybackSessionManagerProxy.h: * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm: (WebKit::PlaybackSessionModelContext::addClient): (WebKit::PlaybackSessionModelContext::removeClient): (WebKit::PlaybackSessionModelContext::durationChanged): (WebKit::PlaybackSessionModelContext::currentTimeChanged): (WebKit::PlaybackSessionModelContext::bufferedTimeChanged): (WebKit::PlaybackSessionModelContext::rateChanged): (WebKit::PlaybackSessionModelContext::seekableRangesChanged): (WebKit::PlaybackSessionModelContext::canPlayFastReverseChanged): (WebKit::PlaybackSessionModelContext::audioMediaSelectionOptionsChanged): (WebKit::PlaybackSessionModelContext::legibleMediaSelectionOptionsChanged): (WebKit::PlaybackSessionModelContext::audioMediaSelectionIndexChanged): (WebKit::PlaybackSessionModelContext::legibleMediaSelectionIndexChanged): (WebKit::PlaybackSessionModelContext::externalPlaybackChanged): (WebKit::PlaybackSessionModelContext::wirelessVideoPlaybackDisabledChanged): (WebKit::PlaybackSessionModelContext::mutedChanged): (WebKit::PlaybackSessionModelContext::volumeChanged): (WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged): (WebKit::PlaybackSessionManagerProxy::invalidate): (WebKit::PlaybackSessionManagerProxy::createModelAndInterface): (WebKit::PlaybackSessionManagerProxy::removeClientForContext): * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenModelContext::create): (WebKit::VideoFullscreenModelContext::VideoFullscreenModelContext): (WebKit::VideoFullscreenModelContext::addClient): (WebKit::VideoFullscreenModelContext::removeClient): (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::willExitPictureInPicture): (WebKit::VideoFullscreenModelContext::didExitPictureInPicture): (WebKit::VideoFullscreenManagerProxy::invalidate): (WebKit::VideoFullscreenManagerProxy::createModelAndInterface): (WebKit::VideoFullscreenManagerProxy::removeClientForContext): (WebKit::VideoFullscreenModelContext::~VideoFullscreenModelContext): Deleted. * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface): (WKFullScreenViewControllerVideoFullscreenModelClient::setInterface): (-[WKFullScreenViewController videoControlsManagerDidChange]): (-[WKFullScreenViewController _togglePiPAction:]): * UIProcess/mac/WKFullScreenWindowController.mm: (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface): * WebProcess/cocoa/PlaybackSessionManager.h: * WebProcess/cocoa/PlaybackSessionManager.mm: (WebKit::PlaybackSessionInterfaceContext::PlaybackSessionInterfaceContext): (WebKit::PlaybackSessionManager::~PlaybackSessionManager): (WebKit::PlaybackSessionManager::createModelAndInterface): (WebKit::PlaybackSessionManager::removeContext): (WebKit::PlaybackSessionInterfaceContext::~PlaybackSessionInterfaceContext): Deleted. * WebProcess/cocoa/VideoFullscreenManager.h: (WebKit::VideoFullscreenInterfaceContext::create): (WebKit::VideoFullscreenInterfaceContext::createWeakPtr): * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenInterfaceContext::VideoFullscreenInterfaceContext): (WebKit::VideoFullscreenManager::~VideoFullscreenManager): (WebKit::VideoFullscreenManager::createModelAndInterface): (WebKit::VideoFullscreenManager::removeContext): 2018-09-28 Fujii Hironori [WinCairo] error C2027: use of undefined type 'WTF::EnumTraits' while compiling AuthenticationChallengeProxy.cpp https://bugs.webkit.org/show_bug.cgi?id=190071 Unreviewed build fix for WinCairo port. AuthenticationChallengeDisposition was not defined in this file. * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: Include "AuthenticationChallengeDisposition.h". 2018-09-26 Ryosuke Niwa Use enum class in createMarkup arguments https://bugs.webkit.org/show_bug.cgi?id=190028 Reviewed by Wenson Hsieh. * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp: (WebKit::WebEditorClient::updateGlobalSelection): 2018-09-27 John Wilander Resource Load Statistics: Non-redirected top frame navigation should not get captured in statistics https://bugs.webkit.org/show_bug.cgi?id=190055 Reviewed by Chris Dumez. * UIProcess/ResourceLoadStatisticsMemoryStore.cpp: Bumped the statisticsModelVersion to 14 to be able to correct legacy statistics. (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation): Now skips capture if it's the main frame. 2018-09-27 Brent Fulgham [iOS] Allow access to VoiceServices features needed for accessibility https://bugs.webkit.org/show_bug.cgi?id=190019 Reviewed by Chris Fleizach. Revise the sandbox to allow access to relevant WebSpeech features. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2018-09-27 Sihui Liu Fix IOSMAC build https://bugs.webkit.org/show_bug.cgi?id=190021 Reviewed by Alex Christensen. * NetworkProcess/mac/NetworkProcessMac.mm: (WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const): 2018-09-27 John Wilander Resource Load Statistics: Remove temporary compatibility fix for auto-dismiss popups https://bugs.webkit.org/show_bug.cgi?id=189980 Reviewed by Alex Christensen. The change in https://bugs.webkit.org/show_bug.cgi?id=183620 was a temporary compatibility fix as explained in: https://webkit.org/blog/8311/intelligent-tracking-prevention-2-0/. We should remove it. These changes remove the parameter isTriggeredByUserGesture since it's no longer needed. * UIProcess/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener): * UIProcess/ResourceLoadStatisticsMemoryStore.h: * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener): * UIProcess/WebResourceLoadStatisticsStore.h: * UIProcess/WebResourceLoadStatisticsStore.messages.in: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::WebProcess): 2018-09-27 Ryan Haddad Unreviewed, rolling out r236557. Really roll out r236557 this time because it breaks internal builds. Reverted changeset: "Add VP8 support to WebRTC" https://bugs.webkit.org/show_bug.cgi?id=189976 https://trac.webkit.org/changeset/236557 2018-09-27 Youenn Fablet Add VP8 support to WebRTC https://bugs.webkit.org/show_bug.cgi?id=189976 Reviewed by Eric Carlson. * Shared/WebPreferences.yaml: 2018-09-27 Chris Dumez The WebContent process should not process incoming IPC while waiting for a sync IPC reply https://bugs.webkit.org/show_bug.cgi?id=184183 Reviewed by Ryosuke Niwa. In recent years, we have experienced re-entrancy bugs/crashes in WebCore due to the WebContent process processing unrelated incoming synchronous IPC when waiting for a reply to one of its synchronous IPC to another process. In order to deal with this, we introduced a DoNotProcessIncomingMessagesWhenWaitingForSyncReply IPC::SendOption which we used on sendSync() calls where we knew re-entering would be unsafe. However, it turns out to be needed for a lot of the WebProcess's sync IPC and it is error-prone. In order to address the issue, we've decided to update the WebContent process behavior so that it processes all its IPC in order (not matter if synchronous or not) and thus so that we never dispatch unrelated synchronous IPC while waiting for a synchronous IPC reply, expect in cases where it would cause a deadlock. As a result, this patch also drops support for the DoNotProcessIncomingMessagesWhenWaitingForSyncReply IPC::SendOption which is no longer needed and has some code complexity. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess): * Platform/IPC/Connection.cpp: (IPC::Connection::sendSyncMessage): (IPC::Connection::waitForSyncReply): * Platform/IPC/Connection.h: (IPC::Connection::sendSync): * PluginProcess/WebProcessConnection.cpp: (WebKit::WebProcessConnection::WebProcessConnection): * StorageProcess/StorageToWebProcessConnection.cpp: (WebKit::StorageToWebProcessConnection::StorageToWebProcessConnection): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::connectionWillOpen): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::postSynchronousMessage): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::loadResourceSynchronously): (WebKit::WebLoaderStrategy::responseFromResourceLoadIdentifier): (WebKit::WebLoaderStrategy::intermediateLoadInformationFromResourceLoadIdentifier): (WebKit::WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier): * WebProcess/Plugins/PluginProxy.cpp: (WebKit::PluginProxy::destroy): (WebKit::PluginProxy::supportsSnapshotting const): * WebProcess/Plugins/WebPluginInfoProvider.cpp: (WebKit::WebPluginInfoProvider::populatePluginCache): * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::WebSWClientConnection): * WebProcess/WebCoreSupport/WebChromeClient.cpp: * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame): * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::rootViewToScreen): * WebProcess/WebProcess.cpp: (WebKit::getNetworkProcessConnection): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2018-09-27 Antoine Quint [Web Animations] Turn Web Animations with CSS integration on https://bugs.webkit.org/show_bug.cgi?id=184819 Reviewed by Dean Jackson. * Shared/WebPreferences.yaml: 2018-09-26 James Savage Allow override of viewport configuration. https://bugs.webkit.org/show_bug.cgi?id=188772. . Reviewed by Simon Fraser. * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _setShouldIgnoreMetaViewport:]): (-[WKPreferences _shouldIgnoreMetaViewport]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::viewportPropertiesDidChange): If we are ignoring the viewport, short circuit calling setViewportArguments() and do not do any updates. (WebKit::WebPage::didCommitLoad): Ditto. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::resetViewportDefaultConfiguration): Select the default configuration based on UIProcess setting. 2018-09-26 Chris Dumez Regression(r236512): WKWebViewCandidateTests.SoftSpaceReplacementAfterCandidateInsertionWithoutReplacement API test is failing https://bugs.webkit.org/show_bug.cgi?id=190007 Reviewed by Alex Christensen. Drop DispatchMessageEvenWhenWaitingForSyncReply SendOption from EditorStateChanged IPC calls to restore pre-r236512 behavior. Before r236512, this option had no effect on IPC from the WebContent to the UIProcess because the m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage flag was set on that IPC::Connection. However, after r236512, m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage is no longer set on the connection, and the DispatchMessageEvenWhenWaitingForSyncReply SendOption was causing this message to get processed out of order with regards to other async IPC, thus causing the API test failure. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::sendEditorStateUpdate): (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate): 2018-09-26 Alex Christensen Fix UAF after r236463 https://bugs.webkit.org/show_bug.cgi?id=190011 Reviewed by Chris Dumez. I had removed an early return in NetworkResourceLoader::continueDidReceiveResponse. Reading the (probably) null m_responseCompletionHandler was reading after the object had been destroyed. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::continueDidReceiveResponse): 2018-09-26 Ryosuke Niwa Selection should work across shadow boundary when initiated by a mouse drag https://bugs.webkit.org/show_bug.cgi?id=151380 Reviewed by Antti Koivisto. Added SelectionAcrossShadowBoundariesEnabled as an internal debug feature, and moved CSSCustomPropertiesAndValuesEnabled to where other experimental features are located. * Shared/WebPreferences.yaml: 2018-09-26 Chris Dumez Unreviewed, apply post-landing review comments after r236512. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCreateMainFrame): (WebKit::WebPageProxy::didCreateSubframe): 2018-09-26 Chris Dumez UIProcess should process incoming sync IPC from WebProcess when waiting for a sync IPC reply from it https://bugs.webkit.org/show_bug.cgi?id=189927 Reviewed by Geoffrey Garen. UIProcess should process incoming sync IPC from WebProcess when waiting for a sync IPC reply from it in order to avoid deadlocks. This is not an issue currently because the WebProcess does process incoming sync IPC when waiting for a sync IPC reply. However, we plan to change this in the future in order to avoid bugs caused by re-entering WebCore at unsafe times. The reason the UIProcess previously did not do out of order sync IPC process was to avoid processing a synchronous policy decision IPC for a frameID it did not know about yet, due to the DidCreateMainFrame / DidCreateSubframe IPC messages being asynchronous. To address this issue, the decidePolicyForNavigationActionSync IPC handler now calls didCreateMainFrame() / didCreateSubframe() as needed if it does not know about the frame yet. Note that synchronous policy decisions are rare and are currently only needed by initial about:blank and fragment navigations. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCreateMainFrame): (WebKit::WebPageProxy::didCreateSubframe): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNavigationActionSync): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::createWithCoreMainFrame): (WebKit::WebFrame::createSubframe): Drop DispatchMessageEvenWhenWaitingForSyncReply SendOption when sending the DidCreateMainFrame / DidCreateSubframe IPC. Previously, this SendOption has no effect because the IPC::Connection would have the m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage flag set to true. However, now that we stop setting this flag on the IPC connection from the WebProcess to the UIProcess, it would lead to those IPC messages getting processed out of order with regards to the DecidePolicyForNavigationAsync asynchronous IPC. DidCreateMainFrame would sometimes get processed *after* the DecidePolicyForNavigationAsync IPC and we would not know about the frameID yet. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeConnection): 2018-09-26 Antti Koivisto REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on iOS https://bugs.webkit.org/show_bug.cgi?id=189695 Reviewed by Simon Fraser. Freeze the layers on UI process side during process swap. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _processWillChange]): Shared work of _processWillSwap and _processDidExit. (-[WKWebView _processWillSwap]): (-[WKWebView _processDidExit]): Split into two functions. Don't reset scroll position and similar when doing navigation swap. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy): (WebKit::RemoteLayerTreeDrawingAreaProxy::detachRemoteLayerTreeHost): Add to way to detach RemoteLayerTreeHost from the drawing area. Inert RemoteLayerTreeHost will host the frozen layers. (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree): (WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator): (WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilPendingUpdate): (WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilAnyUpdate): (WebKit::RemoteLayerTreeDrawingAreaProxy::prepareForAppSuspension): (WebKit::RemoteLayerTreeDrawingAreaProxy::hasVisibleContent const): (WebKit::RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting const): * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm: (WebKit::RemoteLayerTreeHost::RemoteLayerTreeHost): (WebKit::RemoteLayerTreeHost::updateLayerTree): (WebKit::RemoteLayerTreeHost::animationDidStart): (WebKit::RemoteLayerTreeHost::animationDidEnd): (WebKit::RemoteLayerTreeHost::detachFromDrawingArea): Clear the DrawingArea backpointer. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::resetState): Detach and save the current RemoteLayerTreeHost on navigation swap. * UIProcess/WebPageProxy.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::processWillSwap): Avoid reseting the scroll position. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer): Drop the frozen layers after setting the new root layer. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer): For completeness do this also on Mac (where remote layers are currently not used). 2018-09-25 Ryosuke Niwa Make frame flattening an internal debug feature https://bugs.webkit.org/show_bug.cgi?id=189984 Reviewed by Simon Fraser. Made frame flattening a runtime switchable from internal debug menu. To avoid having to enumerate three distinct values in the settings, made it a boolean flag in WKPreference. That's what's exposd as an API anyway. * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.h: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetFrameFlatteningEnabled): (WKPreferencesGetFrameFlatteningEnabled): * UIProcess/API/glib/WebKitSettings.cpp: (webkit_settings_get_enable_frame_flattening): (webkit_settings_set_enable_frame_flattening): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): 2018-09-25 Eric Carlson [MediaStream] Add Mac window capture source https://bugs.webkit.org/show_bug.cgi?id=189958 Reviewed by Youenn Fablet. * UIProcess/UserMediaPermissionRequestManagerProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::beginMonitoringCaptureDevices): Sync with webcore prefs before listening to device changes so we listen on the correct devices. 2018-09-25 Chris Dumez Unreviewed, rolling out r236471 and r236480. Seems to be causing some flaky crashes Reverted changesets: "UIProcess should process incoming sync IPC from WebProcess when waiting for a sync IPC reply from it" https://bugs.webkit.org/show_bug.cgi?id=189927 https://trac.webkit.org/changeset/236471 "Revert some of the changes in r236471" https://bugs.webkit.org/show_bug.cgi?id=189973 https://trac.webkit.org/changeset/236480 2018-09-25 Conrad Shultz Enable customization of the file upload panel https://bugs.webkit.org/show_bug.cgi?id=189970 Reviewed by Wenson Hsieh. With this change, platform implementations can override, or implement in a category, +[WKContentView _fileUploadPanelClass] as needed. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _showRunOpenPanel:resultListener:]): 2018-09-25 Chris Dumez Unreviewed, rolling out r236420 and r236458. This change is not fully correct Reverted changesets: "Do not do early processing of incoming sync IPC unless we're waiting for a sync IPC reply" https://bugs.webkit.org/show_bug.cgi?id=186941 https://trac.webkit.org/changeset/236420 "Unreviewed, update bug number of http/tests/misc/blob- size.html crash on Windows" https://trac.webkit.org/changeset/236458 2018-09-25 Jiewen Tan Unreviewed, a quick fix after r236481. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setMockWebAuthenticationConfiguration): Add an early return, so we don't end up with setting MockWebAuthenticationConfiguration twice. 2018-09-25 John Wilander Change from HAVE(CFNETWORK_STORAGE_PARTITIONING) to ENABLE(RESOURCE_LOAD_STATISTICS) https://bugs.webkit.org/show_bug.cgi?id=189959 Reviewed by Chris Dumez. We no longer make use of CFNetwork's cookie partitioning so we should change the compile-time flag to something that makes sense. This should also make it easier/cleaner for other ports. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::cookiesForDOM): (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM): (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame): (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::didFinishLoading): (WebKit::NetworkResourceLoader::sendResultForCacheEntry): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::retrieve): * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy): (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): (WebKit::WebProcessPool::platformInitializeNetworkProcess): * UIProcess/Network/NetworkProcessProxy.cpp: * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler): (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler): (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess): (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap): (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler): (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources): (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources): (WebKit::WebsiteDataStore::networkProcessDidCrash): * UIProcess/WebsiteData/WebsiteDataStore.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::detachedFromParent2): (WebKit::WebFrameLoaderClient::dispatchWillChangeDocument): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): 2018-09-25 Philippe Normand [WPE] Export jsc_ symbols https://bugs.webkit.org/show_bug.cgi?id=189964 Reviewed by Michael Catanzaro. * webkitglib-symbols.map: Keep jsc_* symbols as visible so they can be used by applications depending on WPE. 2018-09-25 Jiewen Tan [WebAuthN] Make AuthenticatorManager https://bugs.webkit.org/show_bug.cgi?id=189279 Reviewed by Chris Dumez. This patch introduces AuthenticatorManager which is the central of WebAuthentication that 1) handles web requests, 2) discovers authenticators, 3) manages authetnicators and 4) in the future interacts with UI. The lifetime of the AuthenticatorManager is managed by WebsiteDataStore such that it is almost a singleton per UI Process. 1) Requests come from WebAuthenticatorCoordinatorProxy and then cached in AuthenticatorManager which will then distribute requests whenever a new authenticator is discovered. 2) An ABC AuthenticatorTransportService is provided as an interface for AuthenticatorManager to invoke startDiscovery. Actual work will be done in corresponding derived classes, say, LocalService. LocalService is the one that discover attached platform authenticators, for example, TouchID or FaceID. Eache service is unique per AuthetnicatorManager, which means we will have at most 4 services, Local, USB, NFC, and BLE. The latter three will be implemented soon. Also, AuthenticatorManager serves as an observer to *Service, so the latter can inform the former whenever an authenticator is added or removed. When a new authenticator is discovered, the corresponding service will create an Authetnicator object that binds to the physical authenticator device through a *Connection object. There is no ABC for connection for now as I forsee every *Connection will be quite different. The *Connection object is the one that send/receive messages from the physicla device. So far, a LocalConnection is provided even though normally local authenticators are attached. This class is provided solely for separating UI and network traffic from LocalAuthenticator's request handling process. So we can override them in a mock test environment. I will talk about this in the next section. 3) An ABC Authenticator is provided as an interface for AuthenticatorManager to distribute requests on. Requests will then be handled by the derived classes, say, LocalAuthenticator. Each authenticator object is a FSM that works asynchronously. For LocalAuthenticator, it has 4 states for MakeCredential: Init => RequestReceived => UserConsented => Attested => End, and 3 states for GetAssertion: Init => RequestReceived => UserConsented => End. In the transit from RequestReceived to UserConsented, it will invoke LocalConnection to talk to LocalAuthentication.framework that prompt users for TouchID or FaceID. And then the transit from UserConsented => Attested, it will invoke LocalConnection to talk to DeviceIdentity.framework that does Apple attestation. Most of the work are from the original LocalAuthenticator implementation, and this patch converts it to a FSM and simplify the callback and threading model. When a respond is ready, each authenticator will notify their observer which is the AuthenticatorManager. AuthenticatorManager will only reply to Web Process whenever there is a valid respond or a terminating error. Otherwise, the request will time out. I will explore the time out mechanism in a more detailed manner in Bug 189642. The above is a briefing of the AuthetnicatorManager architecture in functional. The asynchronous model is explained here: 1) Since most discovery and request handling processes are asynchronous, I enforced them to be executed asyncrhonous in the interface of the ABC. 2) There is no dedicated secondary threads here. However, underlying framework might decide to perform works on a dedicated thread and then execute the provided callback. Whenever such situation happens, the policy here is to wrap the actual callback into a callback that will post the actual callback back to the main thread and pass the wrapping callback to the APIs. Hence, weak pointers in the actual callback are guaranteed to work. 3) Callbacks are used only if it is one way, and they are CompletionHandlers. 4) Potential multi ways asynchronous operations are encapsulated in regarding Observer interfaces. Finally, let me explain how the mock test works: 1) Mock testing is done in WebKitTestRunner instead of Internals because a considerable large portion of work is in UIProcess instead of WebProcess, says, the AuthenticatorManager. 2) The basic idea is to override functionality of *Connection classes and then make them thin such that we can get the best possible coverage in auto tests. 3) In order to enable layout tests to configure the Mock*Connection classes, a MockWebAuthenticationConfiguration struct is provided. A corresponding JS dictionary will be created by each test and passed from the TestRunner to the connection object. 4) To bridge the above tunnel, a MockAuthenticatorManager is constructed. It is instrumented to return every error. 5) Also, Mock*Service classes are made to mock the discovery process as well. 6) Noted, every mock overrided methods are made thin. * CMakeLists.txt: * Configurations/WebKit.xcconfig: * Platform/spi/Cocoa/DeviceIdentitySPI.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h. * SourcesCocoa.txt: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/WebAuthentication/Authenticator.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h. (WebKit::Authenticator::handleRequest): (WebKit::Authenticator::receiveRespond const): * UIProcess/WebAuthentication/Authenticator.h: Renamed from Source/WebCore/Modules/webauthn/cocoa/LocalAuthenticator.h. (WebKit::Authenticator::setObserver): (WebKit::Authenticator::observer const): (WebKit::Authenticator::requestData const): * UIProcess/WebAuthentication/AuthenticatorManager.cpp: Added. (WebKit::AuthenticatorManagerInternal::collectTransports): (WebKit::AuthenticatorManager::makeCredential): (WebKit::AuthenticatorManager::getAssertion): (WebKit::AuthenticatorManager::clearState): (WebKit::AuthenticatorManager::authenticatorAdded): (WebKit::AuthenticatorManager::respondReceived): (WebKit::AuthenticatorManager::createService const): (WebKit::AuthenticatorManager::respondReceivedInternal): (WebKit::AuthenticatorManager::startDiscovery): * UIProcess/WebAuthentication/AuthenticatorManager.h: Added. (WebKit::AuthenticatorManager::pendingCompletionHandler): * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h. (WebKit::AuthenticatorTransportService::create): (WebKit::AuthenticatorTransportService::createMock): (WebKit::AuthenticatorTransportService::AuthenticatorTransportService): (WebKit::AuthenticatorTransportService::startDiscovery const): * UIProcess/WebAuthentication/AuthenticatorTransportService.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h. (WebKit::AuthenticatorTransportService::observer const): * UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: Added. (WebKit::LocalAuthenticatorInternal::buildAuthData): (WebKit::LocalAuthenticatorInternal::transportsContain): (WebKit::LocalAuthenticatorInternal::produceHashSet): (WebKit::LocalAuthenticatorInternal::toVector): (WebKit::LocalAuthenticator::LocalAuthenticator): (WebKit::LocalAuthenticator::makeCredential): (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented): (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested): (WebKit::LocalAuthenticator::getAssertion): (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented): * UIProcess/WebAuthentication/Cocoa/LocalConnection.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h. * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: Added. (WebKit::LocalConnection::getUserConsent const): (WebKit::LocalConnection::getAttestation const): * UIProcess/WebAuthentication/Cocoa/LocalService.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h. * UIProcess/WebAuthentication/Cocoa/LocalService.mm: Renamed from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h. (WebKit::LocalService::LocalService): (WebKit::LocalService::isAvailable): (WebKit::LocalService::startDiscoveryInternal const): (WebKit::LocalService::platformStartDiscovery const): (WebKit::LocalService::createLocalConnection const): * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h. (WebKit::MockAuthenticatorManager::MockAuthenticatorManager): (WebKit::MockAuthenticatorManager::createService const): (WebKit::MockAuthenticatorManager::respondReceivedInternal): * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h. * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h. * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: Added. (WebKit::MockLocalConnection::MockLocalConnection): (WebKit::MockLocalConnection::getUserConsent const): (WebKit::MockLocalConnection::getAttestation const): * UIProcess/WebAuthentication/Mock/MockLocalService.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h. (WebKit::MockLocalService::MockLocalService): (WebKit::MockLocalService::platformStartDiscovery const): (WebKit::MockLocalService::createLocalConnection const): * UIProcess/WebAuthentication/Mock/MockLocalService.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h. * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h. * UIProcess/WebAuthentication/WebAuthenticationRequestData.h: Renamed from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h. * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp: (WebKit::WebAuthenticatorCoordinatorProxy::WebAuthenticatorCoordinatorProxy): (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential): (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion): (WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable): (WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailableReply): Deleted. * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::WebsiteDataStore): (WebKit::WebsiteDataStore::setMockWebAuthenticationConfiguration): * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::authenticatorManager): * WebKit.xcodeproj/project.pbxproj: 2018-09-25 Chris Dumez Revert some of the changes in r236471 https://bugs.webkit.org/show_bug.cgi?id=189973 Reviewed by Alex Christensen. Revert some of the changes in r236471 as they should not be needed. In particular, it should not be possible for the DecidePolicyForNavigationActionSync IPC to get processed *before* the DidCreateMainFrame / DidCreateSubframe ones because those use IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply. They are thus processed early when necessary, the same way as synchronous IPC messages. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCreateMainFrame): (WebKit::WebPageProxy::didCreateSubframe): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNavigationActionSync): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::createWithCoreMainFrame): (WebKit::WebFrame::createSubframe): 2018-09-25 Sihui Liu Move Service Worker Management from Storage Process to Network Process https://bugs.webkit.org/show_bug.cgi?id=189422 Reviewed by Youenn Fablet. After r236035, this is another piece to move functionality of storage process to network process. When we enable Service Workers, network process instead of storage process will be launched. This patch will not change the behavior of Service Worker. * CMakeLists.txt: * DerivedSources.make: * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess): (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): (WebKit::NetworkConnectionToWebProcess::didClose): (WebKit::NetworkConnectionToWebProcess::unregisterSWConnections): (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didReceiveMessage): (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::createNetworkConnectionToWebProcess): (WebKit::NetworkProcess::addWebsiteDataStore): (WebKit::NetworkProcess::destroySession): (WebKit::NetworkProcess::fetchWebsiteData): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::connectionToContextProcessFromIPCConnection): (WebKit::NetworkProcess::connectionToContextProcessWasClosed): (WebKit::NetworkProcess::needsServerToContextConnectionForOrigin const): (WebKit::NetworkProcess::swServerForSession): (WebKit::NetworkProcess::swOriginStoreForSession): (WebKit::NetworkProcess::existingSWOriginStoreForSession const): (WebKit::NetworkProcess::serverToContextConnectionForOrigin): (WebKit::NetworkProcess::createServerToContextConnection): (WebKit::NetworkProcess::didFailFetch): (WebKit::NetworkProcess::didNotHandleFetch): (WebKit::NetworkProcess::didReceiveFetchResponse): (WebKit::NetworkProcess::didReceiveFetchData): (WebKit::NetworkProcess::didReceiveFetchFormData): (WebKit::NetworkProcess::didFinishFetch): (WebKit::NetworkProcess::postMessageToServiceWorkerClient): (WebKit::NetworkProcess::postMessageToServiceWorker): (WebKit::NetworkProcess::registerSWServerConnection): (WebKit::NetworkProcess::unregisterSWServerConnection): (WebKit::NetworkProcess::swContextConnectionMayNoLongerBeNeeded): (WebKit::NetworkProcess::disableServiceWorkerProcessTerminationDelay): (WebKit::NetworkProcess::addServiceWorkerSession): * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const): * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/ServiceWorker/WebSWOriginStore.cpp: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWOriginStore.cpp. (WebKit::WebSWOriginStore::WebSWOriginStore): (WebKit::WebSWOriginStore::addToStore): (WebKit::WebSWOriginStore::removeFromStore): (WebKit::WebSWOriginStore::clearStore): (WebKit::WebSWOriginStore::importComplete): (WebKit::WebSWOriginStore::registerSWServerConnection): (WebKit::WebSWOriginStore::unregisterSWServerConnection): (WebKit::WebSWOriginStore::sendStoreHandle): (WebKit::WebSWOriginStore::didInvalidateSharedMemory): * NetworkProcess/ServiceWorker/WebSWOriginStore.h: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWOriginStore.h. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp. (WebKit::WebSWServerConnection::WebSWServerConnection): (WebKit::WebSWServerConnection::~WebSWServerConnection): (WebKit::WebSWServerConnection::rejectJobInClient): (WebKit::WebSWServerConnection::resolveRegistrationJobInClient): (WebKit::WebSWServerConnection::resolveUnregistrationJobInClient): (WebKit::WebSWServerConnection::startScriptFetchInClient): (WebKit::WebSWServerConnection::updateRegistrationStateInClient): (WebKit::WebSWServerConnection::fireUpdateFoundEvent): (WebKit::WebSWServerConnection::setRegistrationLastUpdateTime): (WebKit::WebSWServerConnection::setRegistrationUpdateViaCache): (WebKit::WebSWServerConnection::notifyClientsOfControllerChange): (WebKit::WebSWServerConnection::updateWorkerStateInClient): (WebKit::WebSWServerConnection::cancelFetch): (WebKit::WebSWServerConnection::startFetch): (WebKit::WebSWServerConnection::postMessageToServiceWorker): (WebKit::WebSWServerConnection::scheduleJobInServer): (WebKit::WebSWServerConnection::didReceiveFetchResponse): (WebKit::WebSWServerConnection::didReceiveFetchData): (WebKit::WebSWServerConnection::didReceiveFetchFormData): (WebKit::WebSWServerConnection::didFinishFetch): (WebKit::WebSWServerConnection::didFailFetch): (WebKit::WebSWServerConnection::didNotHandleFetch): (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient): (WebKit::WebSWServerConnection::matchRegistration): (WebKit::WebSWServerConnection::registrationReady): (WebKit::WebSWServerConnection::getRegistrations): (WebKit::WebSWServerConnection::registerServiceWorkerClient): (WebKit::WebSWServerConnection::unregisterServiceWorkerClient): (WebKit::WebSWServerConnection::sendToContextProcess): * NetworkProcess/ServiceWorker/WebSWServerConnection.h: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h. (WebKit::WebSWServerConnection::ipcConnection const): (WebKit::WebSWServerConnection::sessionID const): * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in. * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp. (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection): (WebKit::WebSWServerToContextConnection::messageSenderConnection): (WebKit::WebSWServerToContextConnection::messageSenderDestinationID): (WebKit::WebSWServerToContextConnection::connectionClosed): (WebKit::WebSWServerToContextConnection::installServiceWorkerContext): (WebKit::WebSWServerToContextConnection::fireInstallEvent): (WebKit::WebSWServerToContextConnection::fireActivateEvent): (WebKit::WebSWServerToContextConnection::terminateWorker): (WebKit::WebSWServerToContextConnection::syncTerminateWorker): (WebKit::WebSWServerToContextConnection::findClientByIdentifierCompleted): (WebKit::WebSWServerToContextConnection::matchAllCompleted): (WebKit::WebSWServerToContextConnection::claimCompleted): (WebKit::WebSWServerToContextConnection::didFinishSkipWaiting): (WebKit::WebSWServerToContextConnection::connectionMayNoLongerBeNeeded): (WebKit::WebSWServerToContextConnection::terminate): * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.h. (WebKit::WebSWServerToContextConnection::create): (WebKit::WebSWServerToContextConnection::ipcConnection const): * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in. * NetworkProcess/ios/NetworkProcessIOS.mm: (WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const): * Shared/Storage/StorageProcessCreationParameters.cpp: (WebKit::StorageProcessCreationParameters::encode const): (WebKit::StorageProcessCreationParameters::decode): * Shared/Storage/StorageProcessCreationParameters.h: (): Deleted. * Shared/WebsiteDataStoreParameters.cpp: (WebKit::WebsiteDataStoreParameters::encode const): (WebKit::WebsiteDataStoreParameters::decode): (WebKit::WebsiteDataStoreParameters::privateSessionParameters): * Shared/WebsiteDataStoreParameters.h: * Sources.txt: * StorageProcess/StorageProcess.cpp: (WebKit::StorageProcess::didReceiveMessage): (WebKit::StorageProcess::initializeWebsiteDataStore): (WebKit::StorageProcess::createStorageToWebProcessConnection): (WebKit::StorageProcess::destroySession): (WebKit::StorageProcess::fetchWebsiteData): (WebKit::StorageProcess::deleteWebsiteData): (WebKit::StorageProcess::deleteWebsiteDataForOrigins): (WebKit::StorageProcess::connectionToContextProcessFromIPCConnection): Deleted. (WebKit::StorageProcess::connectionToContextProcessWasClosed): Deleted. (WebKit::StorageProcess::needsServerToContextConnectionForOrigin const): Deleted. (WebKit::StorageProcess::swServerForSession): Deleted. (WebKit::StorageProcess::swOriginStoreForSession): Deleted. (WebKit::StorageProcess::existingSWOriginStoreForSession const): Deleted. (WebKit::StorageProcess::serverToContextConnectionForOrigin): Deleted. (WebKit::StorageProcess::createServerToContextConnection): Deleted. (WebKit::StorageProcess::didFailFetch): Deleted. (WebKit::StorageProcess::didNotHandleFetch): Deleted. (WebKit::StorageProcess::didReceiveFetchResponse): Deleted. (WebKit::StorageProcess::didReceiveFetchData): Deleted. (WebKit::StorageProcess::didReceiveFetchFormData): Deleted. (WebKit::StorageProcess::didFinishFetch): Deleted. (WebKit::StorageProcess::postMessageToServiceWorkerClient): Deleted. (WebKit::StorageProcess::postMessageToServiceWorker): Deleted. (WebKit::StorageProcess::registerSWServerConnection): Deleted. (WebKit::StorageProcess::unregisterSWServerConnection): Deleted. (WebKit::StorageProcess::swContextConnectionMayNoLongerBeNeeded): Deleted. (WebKit::StorageProcess::disableServiceWorkerProcessTerminationDelay): Deleted. * StorageProcess/StorageProcess.h: (WebKit::StorageProcess::parentProcessHasServiceWorkerEntitlement const): Deleted. (): Deleted. * StorageProcess/StorageProcess.messages.in: * StorageProcess/StorageToWebProcessConnection.cpp: (WebKit::StorageToWebProcessConnection::~StorageToWebProcessConnection): (WebKit::StorageToWebProcessConnection::didReceiveMessage): (WebKit::StorageToWebProcessConnection::didReceiveSyncMessage): (WebKit::StorageToWebProcessConnection::didClose): (WebKit::StorageToWebProcessConnection::unregisterSWConnections): Deleted. (WebKit::StorageToWebProcessConnection::establishSWServerConnection): Deleted. * StorageProcess/StorageToWebProcessConnection.h: * StorageProcess/StorageToWebProcessConnection.messages.in: * StorageProcess/ios/StorageProcessIOS.mm: (WebKit::StorageProcess::parentProcessHasServiceWorkerEntitlement const): Deleted. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::getNetworkProcessConnection): (WebKit::NetworkProcessProxy::networkProcessCrashed): (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess): (WebKit::NetworkProcessProxy::didFinishLaunching): (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess): (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcessForExplicitSession): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/ServiceWorkerProcessProxy.cpp: (WebKit::ServiceWorkerProcessProxy::start): * UIProcess/Storage/StorageProcessProxy.cpp: (WebKit::StorageProcessProxy::getStorageProcessConnection): (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcess): Deleted. (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcessForExplicitSession): Deleted. * UIProcess/Storage/StorageProcessProxy.h: * UIProcess/Storage/StorageProcessProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): (WebKit::WebProcessPool::networkProcessCrashed): (WebKit::WebProcessPool::getNetworkProcessConnection): (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore): (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess): (WebKit::WebProcessPool::disableServiceWorkerProcessTerminationDelay): (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore): (WebKit::WebProcessPool::registerURLSchemeServiceWorkersCanHandle): (WebKit::WebProcessPool::postMessageToServiceWorkerClient): (WebKit::WebProcessPool::postMessageToServiceWorker): (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess): Deleted. * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::getNetworkProcessConnection): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::computeNetworkProcessAccessTypeForDataFetch): (WebKit::WebsiteDataStore::fetchDataAndApply): (WebKit::computeNetworkProcessAccessTypeForDataRemoval): (WebKit::WebsiteDataStore::removeData): (WebKit::WebsiteDataStore::storageProcessParameters): (WebKit::WebsiteDataStore::parameters): * WebKit.xcodeproj/project.pbxproj: * WebProcess/Network/NetworkProcessConnection.cpp: (WebKit::NetworkProcessConnection::didReceiveMessage): (WebKit::NetworkProcessConnection::didReceiveSyncMessage): (WebKit::NetworkProcessConnection::didClose): (WebKit::NetworkProcessConnection::serviceWorkerConnectionForSession): * WebProcess/Network/NetworkProcessConnection.h: (WebKit::NetworkProcessConnection::existingServiceWorkerConnectionForSession): * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::WebSWClientConnection): * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection): (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage): (WebKit::WebSWContextManagerConnection::startFetch): (WebKit::WebSWContextManagerConnection::didFinishInstall): (WebKit::WebSWContextManagerConnection::didFinishActivation): (WebKit::WebSWContextManagerConnection::setServiceWorkerHasPendingEvents): (WebKit::WebSWContextManagerConnection::skipWaiting): (WebKit::WebSWContextManagerConnection::setScriptResource): (WebKit::WebSWContextManagerConnection::workerTerminated): (WebKit::WebSWContextManagerConnection::findClientByIdentifier): (WebKit::WebSWContextManagerConnection::matchAll): (WebKit::WebSWContextManagerConnection::claim): * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: (WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse): (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData): (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish): (WebKit::WebServiceWorkerFetchTaskClient::didReceiveBlobChunk): (WebKit::WebServiceWorkerFetchTaskClient::didFail): (WebKit::WebServiceWorkerFetchTaskClient::didFinish): (WebKit::WebServiceWorkerFetchTaskClient::didNotHandle): * WebProcess/Storage/WebServiceWorkerProvider.cpp: (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession): (WebKit::WebServiceWorkerProvider::existingServiceWorkerConnectionForSession): (WebKit::WebServiceWorkerProvider::handleFetch): * WebProcess/Storage/WebToStorageProcessConnection.cpp: (WebKit::WebToStorageProcessConnection::didReceiveMessage): (WebKit::WebToStorageProcessConnection::didReceiveSyncMessage): (WebKit::WebToStorageProcessConnection::didClose): (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession): Deleted. * WebProcess/Storage/WebToStorageProcessConnection.h: (WebKit::WebToStorageProcessConnection::existingServiceWorkerConnectionForSession): Deleted. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::networkProcessConnectionClosed): (WebKit::WebProcess::webToStorageProcessConnectionClosed): (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess): (WebKit::WebProcess::establishWorkerContextConnectionToStorageProcess): Deleted. * WebProcess/WebProcess.h: (WebKit::WebProcess::existingNetworkProcessConnection): (WebKit::WebProcess::existingWebToStorageProcessConnection): Deleted. * WebProcess/WebProcess.messages.in: 2018-09-25 Chris Dumez UIProcess should process incoming sync IPC from WebProcess when waiting for a sync IPC reply from it https://bugs.webkit.org/show_bug.cgi?id=189927 Reviewed by Alex Christensen. UIProcess should process incoming sync IPC from WebProcess when waiting for a sync IPC reply from it in order to avoid deadlocks. This is not an issue currently because the WebProcess does process incoming sync IPC when waiting for a sync IPC reply. However, we plan to change this in the future in order to avoid bugs caused by re-entering WebCore at unsafe times. The reason the UIProcess previously did not do out of order sync IPC process was to avoid processing a synchronous policy decision IPC for a frameID it did not know about yet, due to the DidCreateMainFrame / DidCreateSubframe IPC messages being asynchronous. To address this issue, the decidePolicyForNavigationActionSync IPC handler now calls didCreateMainFrame() / didCreateSubframe() as needed if it does not know about the frame yet. Note that synchronous policy decisions are rare and are currently only needed by initial about:blank and fragment navigations. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCreateMainFrame): (WebKit::WebPageProxy::didCreateSubframe): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNavigationActionSync): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeConnection): 2018-09-25 Chris Dumez Extending the lifetime of a NetworkProcessProxy / StorageProcessProxy may cause it to have a stale WebProcessPool pointer https://bugs.webkit.org/show_bug.cgi?id=189851 Reviewed by Alex Christensen. Extending the lifetime of a NetworkProcessProxy / StorageProcessProxy may cause it to have a stale WebProcessPool pointer: - NetworkProcessProxy::m_processPool - StorageProcessProxy::m_processPool Those data members are C++ references because it is expected that the WebProcessPool owns the NetworkProcessProxy and StorageProcessProxy. However, since NetworkProcessProxy / StorageProcessProxy are refcounted, it has happened that code extends the lifetime of those past their process pool, leading to stale prrocess pool usage. The fix for these crashes so far as been to ref the WebProcessPool instead of the NetworkProcessProxy / StorageProcessProxy. However, it is very tempting for people to simply ref the NetworkProcessProxy / StorageProcessProxy given that they are refcounted. For this reason, this patch updates NetworkProcessProxy / StorageProcessProxy so that they are no longer RefCounted and so that the WebProcessPool truly owns them via std::unique_ptr<>. * UIProcess/ChildProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::networkProcessCrashed): (WebKit::NetworkProcessProxy::didClose): (WebKit::NetworkProcessProxy::create): Deleted. * UIProcess/Network/NetworkProcessProxy.h: (WebKit::NetworkProcessProxy::throttler): Deleted. (WebKit::NetworkProcessProxy::processPool): Deleted. * UIProcess/Plugins/PluginProcessProxy.h: (WebKit::PluginProcessProxy::pluginProcessAttributes const): Deleted. (WebKit::PluginProcessProxy::pluginProcessToken const): Deleted. (WebKit::PluginProcessProxy::isValid const): Deleted. * UIProcess/Storage/StorageProcessProxy.cpp: (WebKit::StorageProcessProxy::create): Deleted. * UIProcess/Storage/StorageProcessProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore): (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.h: 2018-09-25 Alex Christensen NetworkLoad::didReceiveResponse should pass its completion handler to its client https://bugs.webkit.org/show_bug.cgi?id=188701 Reviewed by Michael Catanzaro. Right now we have a confusing enum ShouldContinueDidReceiveResponse and a complicated flow that involves many objects and implicitly using NetworkLoad's destructor as part of the loading flow. This makes the responsibilities of the objects clear. * NetworkProcess/Downloads/PendingDownload.cpp: (WebKit::PendingDownload::didReceiveResponse): * NetworkProcess/Downloads/PendingDownload.h: * NetworkProcess/NetworkCORSPreflightChecker.cpp: (WebKit::NetworkCORSPreflightChecker::didReceiveResponse): (WebKit::NetworkCORSPreflightChecker::didReceiveResponseNetworkSession): Deleted. * NetworkProcess/NetworkCORSPreflightChecker.h: * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::didReceiveResponse): * NetworkProcess/NetworkDataTask.h: * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::~NetworkLoad): (WebKit::NetworkLoad::convertTaskToDownload): (WebKit::NetworkLoad::didReceiveResponse): (WebKit::NetworkLoad::notifyDidReceiveResponse): (WebKit::NetworkLoad::continueDidReceiveResponse): Deleted. (WebKit::NetworkLoad::didReceiveResponseNetworkSession): Deleted. * NetworkProcess/NetworkLoad.h: * NetworkProcess/NetworkLoadClient.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::~NetworkResourceLoader): (WebKit::NetworkResourceLoader::didReceiveResponse): (WebKit::NetworkResourceLoader::didFinishWithRedirectResponse): (WebKit::NetworkResourceLoader::continueDidReceiveResponse): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/PingLoad.cpp: (WebKit::PingLoad::didReceiveResponse): (WebKit::PingLoad::didReceiveResponseNetworkSession): Deleted. * NetworkProcess/PingLoad.h: * NetworkProcess/PreconnectTask.cpp: (WebKit::PreconnectTask::didReceiveResponse): * NetworkProcess/PreconnectTask.h: * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp: (WebKit::NetworkCache::SpeculativeLoad::didReceiveResponse): * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h: * NetworkProcess/capture/NetworkDataTaskReplay.cpp: (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse): 2018-09-24 Alex Christensen Build fix. https://bugs.webkit.org/show_bug.cgi?id=189929 * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h: 2018-09-24 Alex Christensen Prepare to replace WKBundleFileHandleCreateWithPath with a version that takes a WKBundlePageRef https://bugs.webkit.org/show_bug.cgi?id=189929 Reviewed by Andy Estes. This will be needed for rdar://problem/24576194 * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.cpp: (WKBundleFileHandleCreateWithPathForPage): * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h: 2018-09-24 Alex Christensen Begin deprecating C API https://bugs.webkit.org/show_bug.cgi?id=189810 Reviewed by Andy Estes. * Shared/API/c/WKDeprecated.h: Added. * UIProcess/API/C/WKPage.h: * UIProcess/API/Cocoa/WKBrowsingContextController.mm: (setUpPagePolicyClient): (-[WKBrowsingContextController setPolicyDelegate:]): * WebKit.xcodeproj/project.pbxproj: 2018-09-24 Chris Dumez Unreviewed, rolling out r236368. Caused WebKit.NetworkProcessCrashWithPendingConnection API test to crash (Bug 189926) Reverted changeset: "Extending the lifetime of a NetworkProcessProxy / StorageProcessProxy may cause it to have a stale WebProcessPool pointer" https://bugs.webkit.org/show_bug.cgi?id=189851 https://trac.webkit.org/changeset/236368 2018-09-21 Simon Fraser Remove the old "AcceleratedCompositingForOverflowScroll" code https://bugs.webkit.org/show_bug.cgi?id=189870 Reviewed by Zalan Bujtas. The "AcceleratedCompositingForOverflowScroll" code was added to allow overflow:scroll to use composited scrolling if an overflow:scroll could be made a stacking context without affecting z-order. We need overflow:scroll to be accelerated always, so a different approach is needed. Remove this old code (unused by any platform?) to make working on new code easier. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetAcceleratedCompositingForOverflowScrollEnabled): Deleted. (WKPreferencesGetAcceleratedCompositingForOverflowScrollEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: 2018-09-24 Chris Dumez Do not do early processing of incoming sync IPC unless we're waiting for a sync IPC reply https://bugs.webkit.org/show_bug.cgi?id=186941 Reviewed by Alex Christensen. The comment was claiming we were processing incoming sync messages while waiting for a sync IPC reply to prevent deadlocks. However, the code was failing to check if we were waiting for a sync IPC reply. As a result, incoming sync IPC messages would get processed early no matter what, jumping the line. This was the source of the flakiness in the blob tests since the IPC to register the blob in the network process was async and the follow-up IPC to ask the network process for the blob size was sync. The sync message to get the blob size would jump the line and get processed before the async message to register the blob. As a result, the network process would not know about the blob yet and return size 0. Of course, this could happen if the network process was sending sync IPC at the time. However, the network process never sends any sync IPC and therefore, should never process incoming IPC messages out of order. * Platform/IPC/Connection.cpp: (IPC::Connection::processIncomingMessage): 2018-09-24 Daniel Bates [iOS] Key code is 0 for many hardware keyboard keys https://bugs.webkit.org/show_bug.cgi?id=189604 Reviewed by Wenson Hsieh. For a hardware keyboard-generated event (an event with a non-nill event._hidEvent) pass the key code for the event. Otherwise, do what we do now and pass 0 as the event is likely a software keyboard-generated event. * Platform/spi/ios/UIKitSPI.h: Add some more SPI. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView handleKeyEvent:]): 2018-09-24 Brian Burg Web Inspector: topContentInset is not accounted for when inspecting a WKWebView and docked to side https://bugs.webkit.org/show_bug.cgi?id=189859 Reviewed by Joseph Pecoraro. * UIProcess/mac/WebInspectorProxyMac.mm: (WebKit::WebInspectorProxy::inspectedViewFrameDidChange): Add special cases for inspecting a WKWebView. We already special-case for WKView. 2018-09-24 Miguel Gomez [GTK][WPE] Compositing indicators are not working https://bugs.webkit.org/show_bug.cgi?id=189915 Reviewed by Žan Doberšek. Pass the debugBorder and repaintCount parameters to the TextureMapperLayer when required. * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp: (WebKit::CoordinatedGraphicsScene::updateSceneState): 2018-09-21 Dean Jackson Add PointerEvent, plus feature flag, plus Web Platform Tests https://bugs.webkit.org/show_bug.cgi?id=189867 Reviewed by Simon Fraser. Add PointerEvents as an experimental feature. * Shared/WebPreferences.yaml: 2018-09-21 Brian Burg Web Inspector: dock buttons disappear if Web Inspector goes fullscreen https://bugs.webkit.org/show_bug.cgi?id=189865 Reviewed by Matt Baker. When a fullscreen Safari tab has a docked Inspector, and the "detach" button is clicked, Inspector goes into its own fullscreen window. In that window, there are no buttons for docking to side or bottom. It turns out that we always send setDockingUnavailable(true) if the inspector window is fullscreen. This eventually causes the inspector to reflect that by hiding the docking-related buttons. * UIProcess/mac/WebInspectorProxyMac.mm: (WebKit::WebInspectorProxy::platformCanAttach): This early exit does not seem to serve any purpose, so remove it. 2018-09-21 Chris Dumez Extending the lifetime of a NetworkProcessProxy / StorageProcessProxy may cause it to have a stale WebProcessPool pointer https://bugs.webkit.org/show_bug.cgi?id=189851 Reviewed by Alex Christensen. Extending the lifetime of a NetworkProcessProxy / StorageProcessProxy may cause it to have a stale WebProcessPool pointer: - NetworkProcessProxy::m_processPool - StorageProcessProxy::m_processPool Those data members are C++ references because it is expected that the WebProcessPool owns the NetworkProcessProxy and StorageProcessProxy. However, since NetworkProcessProxy / StorageProcessProxy are refcounted, it has happened that code extends the lifetime of those past their process pool, leading to stale prrocess pool usage. The fix for these crashes so far as been to ref the WebProcessPool instead of the NetworkProcessProxy / StorageProcessProxy. However, given how error-prone this is, this patch updates NetworkProcessProxy / StorageProcessProxy so that they forward their refcounting to the WebProcessPool. * UIProcess/ChildProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::ref): (WebKit::NetworkProcessProxy::deref): (WebKit::NetworkProcessProxy::didClose): (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor): (WebKit::NetworkProcessProxy::create): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Plugins/PluginProcessProxy.h: * UIProcess/Storage/StorageProcessProxy.cpp: (WebKit::StorageProcessProxy::ref): (WebKit::StorageProcessProxy::deref): (WebKit::StorageProcessProxy::create): Deleted. * UIProcess/Storage/StorageProcessProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.h: 2018-09-21 Alex Christensen Use a Variant for FormDataElement https://bugs.webkit.org/show_bug.cgi?id=189777 Reviewed by Chris Dumez. * NetworkProcess/NetworkResourceLoadParameters.cpp: (WebKit::NetworkResourceLoadParameters::encode const): * NetworkProcess/NetworkResourceLoader.cpp: * Shared/SessionState.h: * WebProcess/WebCoreSupport/SessionStateConversion.cpp: (WebKit::toHTTPBody): 2018-09-21 Alex Christensen Simply authentication code even more! https://bugs.webkit.org/show_bug.cgi?id=189719 Reviewed by Andy Estes. Just when you thought it couldn't get simpler and more elegant, it can! * NetworkProcess/Downloads/Download.cpp: * NetworkProcess/NetworkCORSPreflightChecker.cpp: * NetworkProcess/NetworkLoad.cpp: * NetworkProcess/PingLoad.cpp: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: * Shared/Authentication/AuthenticationChallengeDisposition.h: Added. * Shared/Authentication/AuthenticationManager.cpp: (WebKit::AuthenticationManager::completeAuthenticationChallenge): (WebKit::AuthenticationManager::useCredentialForChallenge): Deleted. (WebKit::AuthenticationManager::useCredentialForSingleChallenge): Deleted. (WebKit::AuthenticationManager::continueWithoutCredentialForChallenge): Deleted. (WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge): Deleted. (WebKit::AuthenticationManager::cancelChallenge): Deleted. (WebKit::AuthenticationManager::cancelSingleChallenge): Deleted. (WebKit::AuthenticationManager::performDefaultHandling): Deleted. (WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge): Deleted. (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinue): Deleted. (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge): Deleted. * Shared/Authentication/AuthenticationManager.h: * Shared/Authentication/AuthenticationManager.messages.in: * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm: (WebKit::AuthenticationManager::initializeConnection): * UIProcess/API/C/WKAuthenticationDecisionListener.cpp: (WKAuthenticationDecisionListenerUseCredential): * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm: (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]): * UIProcess/API/glib/WebKitAuthenticationRequest.cpp: (webkit_authentication_request_authenticate): * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy): * UIProcess/Authentication/AuthenticationDecisionListener.cpp: (WebKit::AuthenticationDecisionListener::AuthenticationDecisionListener): (WebKit::AuthenticationDecisionListener::~AuthenticationDecisionListener): (WebKit::AuthenticationDecisionListener::useCredential): (WebKit::AuthenticationDecisionListener::cancel): (WebKit::AuthenticationDecisionListener::performDefaultHandling): (WebKit::AuthenticationDecisionListener::rejectProtectionSpaceAndContinue): * UIProcess/Authentication/AuthenticationDecisionListener.h: (WebKit::AuthenticationDecisionListener::create): * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::didReceiveAuthenticationChallenge): * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge): * WebKit.xcodeproj/project.pbxproj: 2018-09-21 Chris Dumez Regression(Mojave): Resuming a WK2 download crashes https://bugs.webkit.org/show_bug.cgi?id=189838 Reviewed by Alex Christensen. Update our workaround to tweak the download resume data to include the actual download path so that it works on macOS Mojave and up. Unfortunately, the resume data internal representation has changed, causing our previous workaround to fail. * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::resume): 2018-09-21 Youenn Fablet Whitelist two additional plugins https://bugs.webkit.org/show_bug.cgi?id=189832 Reviewed by Brent Fulgham. * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed): 2018-09-21 Woodrow Wang Clear persistent storage between tests for resourceLoadStatistics https://bugs.webkit.org/show_bug.cgi?id=189684 Reviewed by Chris Dumez. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreStatisticsResetToConsistentState): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didClose): (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor): * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent): Remove function only called in testing for resetting statistics to consistent state. (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor): (WebKit::WebsiteDataStore::removeAllStorageAccessHandler): 2018-09-20 Ryan Haddad Unreviewed, rolling out r236289. Caused 8 TestWebKitAPI.ContentFiltering test failures. Reverted changeset: "InjectedBundle parameters often need initialization function called before unarchiving" https://bugs.webkit.org/show_bug.cgi?id=189709 https://trac.webkit.org/changeset/236289 2018-09-20 Youenn Fablet Allow additional plug-ins to run unsandboxed https://bugs.webkit.org/show_bug.cgi?id=189791 Reviewed by Brent Fulgham. * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed): 2018-09-20 Brent Fulgham InjectedBundle parameters often need initialization function called before unarchiving https://bugs.webkit.org/show_bug.cgi?id=189709 Reviewed by Chris Dumez. Handle the case where the InjectedBundle parameters do not successfully decode because they contain an unexpected class from the embedding program. If this happens, try decoding the bundle parameters after the bundle initialiation function runs, which gives the embedding program the opportunity to register additional classes that are safe for serialization. Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'. This new method returns 'true' if the serialization was successful, otherwise it returns false. Revise 'initialize' to call this new method and check the return value. If it fails, try decoding the bundle parameters after the bundle's initialization function is called. * WebProcess/InjectedBundle/InjectedBundle.h: * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm: (WebKit::InjectedBundle::initialize): Use the new method. (WebKit::InjectedBundle::decodeBundleParameters): Added. (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete 'classesForCoder' method to unarchive the passed bundle parameters, rather than the NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the NSDictionary object may itself hold other kinds of objects. 2018-09-20 Jer Noble Enable Modern EME by default https://bugs.webkit.org/show_bug.cgi?id=189794 Reviewed by Jon Lee. * Shared/WebPreferences.yaml: 2018-09-20 Thibault Saunier [GTK][WPE] Make sure MediaDeviceEnabled and PeerConnectionEnabled are always synced with enable-media-stream https://bugs.webkit.org/show_bug.cgi?id=188704 By default m_isMediaDevicesEnabled and m_isScreenCaptureEnabled are false but m_isMediaStreamEnabled is true meaning that in the WPE minibrowser getUserMedia was disabled even if we explicitly set `"enable-media-stream", TRUE`. Reviewed by Michael Catanzaro. * UIProcess/API/glib/WebKitSettings.cpp: (webKitSettingsConstructed): 2018-09-20 Justin Michaud Implement CSS Custom Properties and Values Skeleton https://bugs.webkit.org/show_bug.cgi?id=189694 Reviewed by Simon Fraser. Add feature flag for CSS custom properties and values api * Shared/WebPreferences.yaml: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): 2018-09-19 Dean Jackson Temporarily move fullscreen back to experimental features https://bugs.webkit.org/show_bug.cgi?id=189770 Revert this change now that there is a commit to cherry-pick. * Shared/WebPreferences.yaml: 2018-09-20 Chris Dumez Unreviewed crash fix after r236226. We need to protect |this| in WebProcessProxy::requestTermination(). * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::requestTermination): 2018-09-20 Antti Koivisto REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on Mac https://bugs.webkit.org/show_bug.cgi?id=189663 Reviewed by Geoff Garen and Chris Dumez. We need to keep the layer tree of the previous page alive and visible until we have something to render on the new page. With PSON on Mac this means that we should keep displaying the layer tree from the previus process. This patch moves the management of 'attaching' the drawing area (Mac only concept) from web process to UI process. This is when we parent the layer tree to the view root layer. It also ensures that the layer tree is not deleted too early on process swap and that it still eventually gets deleted. * UIProcess/DrawingAreaProxy.h: (WebKit::DrawingAreaProxy::attachInWebProcess): * UIProcess/SuspendedPageProxy.cpp: (WebKit::messageNamesToIgnoreWhileSuspended): (WebKit::SuspendedPageProxy::tearDownDrawingAreaInWebProcess): We no longer tear down drawing area (layer tree) for suspended pages automatically. Send an explicit message for it. * UIProcess/SuspendedPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCompletePageTransition): Attach the drawing area if appropriate. (WebKit::WebPageProxy::resetStateAfterProcessExited): Call PageClien::processWillSwap instead of processDidExit when appropriate. (WebKit::WebPageProxy::enterAcceleratedCompositingMode): This is called when we have switched to the new layer tree. Tear down the drawing area in the previus process. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::processWillSwap): On iOS this just call processDidExit for now. * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::processWillSwap): (WebKit::PageClientImpl::processDidExit): Add processWillSwap separately from processDidExit. They are currently the same except processWillSwap doesn't clear the root layer. * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h: * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: (WebKit::TiledCoreAnimationDrawingAreaProxy::attachInWebProcess): Send a message to the web process to attach the drawing area. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attach): (WebKit::DrawingArea::attachDrawingArea): Deleted. Rename to be less redundant. * WebProcess/WebPage/DrawingArea.messages.in: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::reinitializeWebPage): Don't attach drawing area automatically. It will be done by a message from UI process. (WebKit::WebPage::setLayerTreeStateIsFrozen): Layer tree is always frozen in a suspended process (if it exists). (WebKit::WebPage::didReceivePolicyDecision): Suspend immediately when receiving policy decision to avoid flash on 'about:blank' loading. (WebKit::WebPage::didStartPageTransition): (WebKit::WebPage::didCompletePageTransition): Notify UI process of transition completion. (WebKit::WebPage::setIsSuspended): (WebKit::WebPage::tearDownDrawingAreaForSuspend): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): Don't attach drawing area automatically. It will be done by a message from UI process. (WebKit::TiledCoreAnimationDrawingArea::attach): (WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Deleted. 2018-09-20 Tomas Popela [GTK] Always prints in portrait when landscape is requested https://bugs.webkit.org/show_bug.cgi?id=189543 Reviewed by Michael Catanzaro. We have to change the surface size based on the requested orientation. Otherwise only portrait will be printed as it's hardcoded. * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp: 2018-09-19 Dean Jackson Temporarily move fullscreen back to experimental features https://bugs.webkit.org/show_bug.cgi?id=189770 Reviewed by Simon Fraser. Make fullscreen an experimental feature again. * Shared/WebPreferences.yaml: 2018-09-19 Dawei Fenton Unreviewed, rolling out r236229. caused API timouts on mac and ios Reverted changeset: "Clear persistent storage between tests for resourceLoadStatistics" https://bugs.webkit.org/show_bug.cgi?id=189684 https://trac.webkit.org/changeset/236229 2018-09-19 Alex Christensen REGRESSION(236154) C API clients not using WKPageSetPageNavigationClient couldn't complete HTTPS requests https://bugs.webkit.org/show_bug.cgi?id=189771 Reviewed by Tim Horton. * UIProcess/API/APINavigationClient.h: (API::NavigationClient::didReceiveAuthenticationChallenge): Perform default behavior if there's an authentication challenge but we're using the default navigation client. I wish we had infrastructure to test this but WebKitTestRunner uses WKPageSetNavigationClient and we don't have the ability to do networking from API tests. This is a growing problem I intend to solve. 2018-09-19 Woodrow Wang Clear persistent storage between tests for resourceLoadStatistics https://bugs.webkit.org/show_bug.cgi?id=189684 Reviewed by Chris Dumez. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreStatisticsResetToConsistentState): * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent): Remove function only called in testing for resetting statistics to consistent state. (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory): Deleted. 2018-09-19 Chris Dumez Crash under WebPageProxy::decidePolicyForNavigationAction() https://bugs.webkit.org/show_bug.cgi?id=189763 Reviewed by Alex Christensen. Update WebNavigationState::navigation() / WebNavigationState::takeNavigation() to return a pointer instead of a reference as we have evidence that they can return null. I kept the debug assertions to try and catch the cases where we return null but at least we stop crashing in release builds. * UIProcess/WebNavigationState.cpp: (WebKit::WebNavigationState::navigation): (WebKit::WebNavigationState::takeNavigation): * UIProcess/WebNavigationState.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForResponse): 2018-09-19 Chris Dumez Crash under WebProcessProxy::suspendedPageWasDestroyed(WebKit::SuspendedPageProxy&) https://bugs.webkit.org/show_bug.cgi?id=189721 Reviewed by Geoffrey Garen. Fix crash when destroying a SuspendedPageProxy whose WebProcessProxy was already destroyed. * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::SuspendedPageProxy): (WebKit::SuspendedPageProxy::~SuspendedPageProxy): * UIProcess/SuspendedPageProxy.h: (WebKit::SuspendedPageProxy::process const): Update SuspendedPageProxy::m_process to be a RefPtr<> instead of a raw pointer, similarly to what we do in WebPageProxy. Relying on the WebProcessProxy to not get destroyed is risky as this crash demonstrates. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::requestTermination): When a WebProcessProxy is terminated (by client or WebKit due to memory / cpu usage), call webProcessDidClose() on all SuspendedPages, similarly to what we do in case of a crash in processDidTerminateOrFailedToLaunch(). Failing to do so means that the SuspendedPageProxy may still have a pointer to this WebProcessProxy, even though WebProcessProxy::shutDown() has been called (which may destroy the WebProcessProxy). 2018-09-19 John Wilander Resource Load Statistics: Add optional cap on partitioned cache max age https://bugs.webkit.org/show_bug.cgi?id=189711 Reviewed by Antti Koivisto and Chris Dumez. These changes add the capability to set a max age cap for prevalent resources and consults it when retrieving cache entries. If an entry is capped and found to be too old, it will not be used but instead removed from the cache. This functionality is off by default because no cap is set by default. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::setCacheMaxAgeCapForPrevalentResources): (WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources): Infrastructure for testing. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::retrieveCacheEntry): Now sends in the session ID in the retrieve call. * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::hasReachedPrevalentResourceAgeCap): Static convenience function. (WebKit::NetworkCache::makeUseDecision): Now receives an optional maxAge parameter and checks hasReachedPrevalentResourceAgeCap() first. (WebKit::NetworkCache::Cache::retrieve): Now takes a session ID. * NetworkProcess/cache/NetworkCache.h: * NetworkProcess/cache/NetworkCacheStatistics.cpp: (WebKit::NetworkCache::cachedEntryReuseFailureToDiagnosticKey): Added UseDecision::NoDueToPrevalentResourceAgeCap which causes a return of WebCore::DiagnosticLoggingKeys::otherKey(). * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetStatisticsCacheMaxAgeCap): (WKWebsiteDataStoreStatisticsResetToConsistentState): Infrastructure for testing. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm: (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded): Now supports a user default ResourceLoadStatisticsCacheMaxAgeCap. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::hasStorageAccessForFrame): (WebKit::NetworkProcessProxy::grantStorageAccess): (WebKit::NetworkProcessProxy::removeAllStorageAccess): (WebKit::NetworkProcessProxy::getAllStorageAccessEntries): (WebKit::NetworkProcessProxy::setCacheMaxAgeCapForPrevalentResources): (WebKit::NetworkProcessProxy::didSetCacheMaxAgeCapForPrevalentResources): (WebKit::NetworkProcessProxy::resetCacheMaxAgeCapForPrevalentResources): (WebKit::NetworkProcessProxy::didResetCacheMaxAgeCapForPrevalentResources): (WebKit::nextRequestStorageAccessContextId): Deleted. Deleted this to make all code use the generic generateCallbackID(). * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: Used to transfer the setting from the UI process to the network process. * UIProcess/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::setCacheMaxAgeCap): * UIProcess/ResourceLoadStatisticsMemoryStore.h: * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap): * UIProcess/WebResourceLoadStatisticsStore.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources): (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources): * UIProcess/WebsiteData/WebsiteDataStore.h: 2018-09-18 Brent Fulgham [iOS] Allow WebContent process to check the "Protocol Characteristics" of files to which it has access https://bugs.webkit.org/show_bug.cgi?id=189712 Reviewed by Alex Christensen. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2018-09-18 Chris Dumez [iOS] Crash under WebPageProxy::navigationGestureSnapshotWasRemoved() https://bugs.webkit.org/show_bug.cgi?id=189714 Reviewed by Tim Horton. The ViewGestureController::removeSwipeSnapshot() implementation for iOS calls navigationGestureSnapshotWasRemoved() on m_webPageProxyForBackForwardListForCurrentSwipe. m_webPageProxyForBackForwardListForCurrentSwipe can differ from m_webPageProxy, and is a RefPtr<>. This means that this WebPageProxy's WKWebView might have been deallocated, in which case we'll crash when trying to use the pageClient in WebPageProxy::navigationGestureSnapshotWasRemoved(). To address the issue, we now return early in WebPageProxy::navigationGestureSnapshotWasRemoved() if m_isClosed is true, after resetting m_isShowingNavigationGestureSnapshot to false but *before* trying to use the pageClient. When a WKWebView is deallocated, it calls WebPageProxy::close(), which sets m_isClosed to true. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved): 2018-09-18 Basuke Suzuki [Curl] Limit capturing extra metrics for Web Inspector when not required. https://bugs.webkit.org/show_bug.cgi?id=189520 Reviewed by Alex Christensen. Respect the value of NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics() to reduce the process time when they are not needed. * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::createCurlRequest): 2018-09-18 Alex Christensen Make WebPageProxy always have a API::NavigationClient instead of always having a API::LoaderClient and API::PolicyClient https://bugs.webkit.org/show_bug.cgi?id=189012 Reviewed by Andy Estes. When WebKit2 was being developed, we initially made the C API WKPageSetPagePolicyClient and WKPageSetPageLoaderClient. When we released WKWebView, it was using WKNavigationDelegate, equivalent to WKPageSetPageNavigationClient. To support one or the other, we would use the navigation client if it was present, but if not we would fall back to the loader or policy client. Since the loader and policy clients are now being minimally supported only until legacy software migrates to the navigation client, we are adding new functionality to the navigation client. Making the navigation client the default and using the loader or policy client only if they are present supports the legacy software and makes us have fewer forgotten null checks when adding new functionality to the navigation client. * UIProcess/API/C/WKPage.cpp: (WKPageSetPageNavigationClient): * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::createNavigationClient): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::WebPageProxy): (WebKit::WebPageProxy::setNavigationClient): (WebKit::WebPageProxy::setLoaderClient): (WebKit::WebPageProxy::setPolicyClient): (WebKit::WebPageProxy::close): (WebKit::WebPageProxy::didChangeBackForwardList): (WebKit::WebPageProxy::willGoToBackForwardListItem): (WebKit::WebPageProxy::findPlugin): (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): (WebKit::WebPageProxy::willPerformClientRedirectForFrame): (WebKit::WebPageProxy::didCancelClientRedirectForFrame): (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::didReachLayoutMilestone): (WebKit::WebPageProxy::didDisplayInsecureContentForFrame): (WebKit::WebPageProxy::didRunInsecureContentForFrame): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponse): (WebKit::WebPageProxy::contentRuleListNotification): (WebKit::WebPageProxy::webGLPolicyForURL): (WebKit::WebPageProxy::resolveWebGLPolicyForURL): (WebKit::WebPageProxy::processDidBecomeUnresponsive): (WebKit::WebPageProxy::processDidBecomeResponsive): (WebKit::WebPageProxy::dispatchProcessDidTerminate): (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy): (WebKit::WebPageProxy::wrapCryptoKey): (WebKit::WebPageProxy::unwrapCryptoKey): (WebKit::WebPageProxy::signedPublicKeyAndChallengeString): (WebKit::WebPageProxy::navigationGestureDidBegin): (WebKit::WebPageProxy::navigationGestureWillEnd): (WebKit::WebPageProxy::navigationGestureDidEnd): (WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved): * UIProcess/WebPageProxy.h: 2018-09-18 Alex Christensen Clean up AuthenticationChallengeProxy https://bugs.webkit.org/show_bug.cgi?id=189668 Reviewed by Youenn Fablet. At its core, it's a CompletionHandler with some information. Make it more elegant and simple with no change in behavior and reduce the complexity of this security-sensitive object. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (toNSURLSessionAuthChallengeDisposition): * Shared/Authentication/AuthenticationManager.cpp: (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge): * Shared/Authentication/AuthenticationManager.h: * UIProcess/API/C/WKAuthenticationChallenge.cpp: (WKAuthenticationChallengeGetDecisionListener): (WKAuthenticationChallengeGetProtectionSpace): (WKAuthenticationChallengeGetProposedCredential): (WKAuthenticationChallengeGetPreviousFailureCount): * UIProcess/API/C/WKPage.cpp: (WKPageSetPageNavigationClient): * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm: (-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]): (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]): (-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]): (-[WKNSURLAuthenticationChallengeSender performDefaultHandlingForAuthenticationChallenge:]): (-[WKNSURLAuthenticationChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]): * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy): (WebKit::AuthenticationChallengeProxy::~AuthenticationChallengeProxy): Deleted. (WebKit::AuthenticationChallengeProxy::useCredential): Deleted. (WebKit::AuthenticationChallengeProxy::cancel): Deleted. (WebKit::AuthenticationChallengeProxy::performDefaultHandling): Deleted. (WebKit::AuthenticationChallengeProxy::rejectProtectionSpaceAndContinue): Deleted. (WebKit::AuthenticationChallengeProxy::proposedCredential const): Deleted. (WebKit::AuthenticationChallengeProxy::protectionSpace const): Deleted. (WebKit::AuthenticationChallengeProxy::setSecKeyProxyStore): Deleted. * UIProcess/Authentication/AuthenticationChallengeProxy.h: (WebKit::AuthenticationChallengeProxy::create): (WebKit::AuthenticationChallengeProxy::listener const): (WebKit::AuthenticationChallengeProxy::previousFailureCount const): Deleted. * UIProcess/Authentication/AuthenticationDecisionListener.cpp: (WebKit::AuthenticationDecisionListener::AuthenticationDecisionListener): (WebKit::AuthenticationDecisionListener::~AuthenticationDecisionListener): (WebKit::AuthenticationDecisionListener::useCredential): (WebKit::AuthenticationDecisionListener::cancel): (WebKit::AuthenticationDecisionListener::performDefaultHandling): (WebKit::AuthenticationDecisionListener::rejectProtectionSpaceAndContinue): (WebKit::AuthenticationDecisionListener::detachChallenge): Deleted. * UIProcess/Authentication/AuthenticationDecisionListener.h: (WebKit::AuthenticationDecisionListener::create): * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm: (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc): (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc const): Deleted. * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::didReceiveAuthenticationChallenge): * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge): * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::didReceiveAuthenticationChallenge): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge): * UIProcess/ServiceWorkerProcessProxy.cpp: (WebKit::ServiceWorkerProcessProxy::didReceiveAuthenticationChallenge): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::secKeyProxyStore): (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy): * UIProcess/WebPageProxy.h: 2018-09-18 Ben Richards Add script to generate WebContent service resource files and change XPC service main SPI to have it's own header https://bugs.webkit.org/show_bug.cgi?id=188601 Reviewed by Dan Bernstein. Added a script to the process entitlements build phase of the WebContent service that copies resource files to WebKit.framework/PrivateHeaders/CustomWebContentResources. These resource files are to be used by clients who would like to make a custom WebContent service. * Scripts/copy-webcontent-resources-to-private-headers.sh: Added. * WebKit.xcodeproj/project.pbxproj: * WebProcess/API/Cocoa/WKWebProcess.h: Drive-by fix to make this header compileable alone. 2018-09-18 Ryan Haddad Unreviewed, rolling out r236138. Caused API test and layout test failures on iOS. Reverted changeset: "REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on Mac" https://bugs.webkit.org/show_bug.cgi?id=189663 https://trac.webkit.org/changeset/236138 2018-09-18 Eric Carlson Always log when granting/revoking capture sandbox extensions https://bugs.webkit.org/show_bug.cgi?id=189701 Reviewed by Youenn Fablet. * UIProcess/UserMediaProcessManager.cpp: (WebKit::UserMediaProcessManager::willCreateMediaStream): Always log. (WebKit::UserMediaProcessManager::endedCaptureSession): Ditto. * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp: (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Ditto. (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): Ditto. 2018-09-18 Youenn Fablet Enable Unified Plan by default https://bugs.webkit.org/show_bug.cgi?id=189675 Reviewed by Eric Carlson. * Shared/WebPreferences.yaml: 2018-09-18 Antti Koivisto REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on Mac https://bugs.webkit.org/show_bug.cgi?id=189663 Reviewed by Geoff Garen. We need to keep the layer tree of the previous page alive and visible until we have something to render on the new page. With PSON on Mac this means that we should keep displaying the layer tree from the previus process. This patch moves the management of 'attaching' the drawing area (Mac only concept) from web process to UI process. This is when we parent the layer tree to the view root layer. It also ensures that the layer tree is not deleted too early on process swap and that it still eventually gets deleted. * UIProcess/DrawingAreaProxy.h: (WebKit::DrawingAreaProxy::attachInWebProcess): * UIProcess/SuspendedPageProxy.cpp: (WebKit::messageNamesToIgnoreWhileSuspended): (WebKit::SuspendedPageProxy::tearDownDrawingAreaInWebProcess): We no longer tear down drawing area (layer tree) for suspended pages automatically. Send an explicit message for it. * UIProcess/SuspendedPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::reattachToWebProcess): Only call didRelaunchProcess when process actually relaunched (not navigation process launch) to match not calling processDidExit in resetStateAfterProcessExited. (WebKit::WebPageProxy::didCompletePageTransition): Attach the drawing area if appropriate. (WebKit::WebPageProxy::decidePolicyForNavigationAction): Send suspend message to WebPage immediately instead waiting for the runloop callback. This is needed so we can avoid flashing the initial empty document load when the new Page object is created. (WebKit::WebPageProxy::resetStateAfterProcessExited): Don't call processDidExit when suspending, not exiting the process (this function needs a new name or rafactoring). This avoids clearing the drawing area and flashing to black. (WebKit::WebPageProxy::enterAcceleratedCompositingMode): This is called when we have switched to the new layer tree. Tear down the drawing area in the previus process. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h: * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: (WebKit::TiledCoreAnimationDrawingAreaProxy::attachInWebProcess): Send a message to the web process to attach the drawing area. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attach): (WebKit::DrawingArea::attachDrawingArea): Deleted. Rename to be less redundant. * WebProcess/WebPage/DrawingArea.messages.in: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::reinitializeWebPage): Don't attach drawing area automatically. It will be done by a message from UI process. (WebKit::WebPage::setLayerTreeStateIsFrozen): Layer tree is always frozen in a suspended process (if it exists). (WebKit::WebPage::didStartPageTransition): (WebKit::WebPage::didCompletePageTransition): Notify UI process of transition completion. (WebKit::WebPage::setIsSuspended): (WebKit::WebPage::tearDownDrawingAreaForSuspend): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): Don't attach drawing area automatically. It will be done by a message from UI process. (WebKit::TiledCoreAnimationDrawingArea::attach): (WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Deleted. 2018-09-18 Claudio Saavedra [WPE] Implement mouse event modifiers https://bugs.webkit.org/show_bug.cgi?id=189697 Reviewed by Carlos Garcia Campos. Only "CapsLocks" is missing, as WPE doesn't support that modifier. * Shared/wpe/WebEventFactory.cpp: (WebKit::modifiersForEventModifiers): (WebKit::WebEventFactory::createWebKeyboardEvent): (WebKit::WebEventFactory::createWebMouseEvent): (WebKit::modifiersForEvent): Deleted. 2018-09-17 Zan Dobersek Unreviewed build fix after r236101. * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore): Correct a BinarySemaphore::wait() call which now accepts no arguments. 2018-09-17 Yusuke Suzuki [WTF] Use Semaphore and BinarySemaphore instead of dispatch_semaphore_t https://bugs.webkit.org/show_bug.cgi?id=185339 Reviewed by Mark Lam. * Platform/IPC/Connection.cpp: (IPC::Connection::SyncMessageState::wait): * Shared/mac/SecItemShim.cpp: (WebKit::sendSecItemRequest): Use BinarySemaphore. * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp: (WebKit::ResourceLoadStatisticsPersistentStorage::finishAllPendingWorkSynchronously): * UIProcess/WebStorage/StorageManager.cpp: (WebKit::StorageManager::applicationWillTerminate): * UIProcess/ios/WKActionSheetAssistant.mm: (appLinkForURL): Use BinarySemaphore to wait for async completion handler. We also fix memory leak since the old code does not call dispatch_release for the used semaphore. 2018-09-17 Simon Fraser Many modern media control tests leak documents in testing https://bugs.webkit.org/show_bug.cgi?id=189437 Reviewed by Darin Adler. In order to accurately detect leaks in media controls tests which use lots of SVGImages, we have to: - Fire a zero-delay timer after the postTask, in order for ImagesLoader's m_derefElementTimer to clear references to elements. - Have releaseCriticalMemory() call CachedResourceLoader's garbageCollectDocumentResources() to drop the last handle to the CachedResource for an SVGImage. - Call WKBundleReleaseMemory() after the GC and timer, since we need garbageCollectDocumentResources() to run again after that timer has fired. This should fix most of the spurious leak reports involving SVGImage documents. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageCallAfterTasksAndTimers): (WKBundlePagePostTask): Deleted. * WebProcess/InjectedBundle/API/c/WKBundlePage.h: 2018-09-17 Dan Bernstein Try to fix Apple internal builds with the iOS 12.0 SDK. * Configurations/WebKit.xcconfig: Disable framework header postprocessing for iOS 12.0. 2018-09-17 Ryan Haddad Unreviewed, rolling out r236092 because it breaks internal builds. Also, remove stray '+' character from ChangeLog file. * Scripts/copy-webcontent-resources-to-private-headers.sh: Removed. * WebKit.xcodeproj/project.pbxproj: 2018-08-17 Ben Richards Add script to generate WebContent service resource files and change XPC service main SPI to have it's own header https://bugs.webkit.org/show_bug.cgi?id=188601 Reviewed by Dan Bernstein. Added a script to the process entitlements build phase of the WebContent service that copies resource files to WebKit.framework/PrivateHeaders/CustomWebContentResources. These resource files are to be used by clients who would like to make a custom WebContent service. * Scripts/copy-webcontent-resources-to-private-headers.sh: Added. * WebKit.xcodeproj/project.pbxproj: 2018-09-17 Simon Fraser Add more Fullscreen logging https://bugs.webkit.org/show_bug.cgi?id=189656 Reviewed by Jer Noble. Add some fullscreen logging so I can tell whether WebFullScreenManager ever releases the fullscreen element. * WebProcess/FullScreen/WebFullScreenManager.cpp: (WebKit::WebFullScreenManager::WebFullScreenManager): (WebKit::WebFullScreenManager::videoControlsManagerDidChange): (WebKit::WebFullScreenManager::setPIPStandbyElement): (WebKit::WebFullScreenManager::enterFullScreenForElement): (WebKit::WebFullScreenManager::exitFullScreenForElement): (WebKit::WebFullScreenManager::willEnterFullScreen): (WebKit::WebFullScreenManager::didEnterFullScreen): (WebKit::WebFullScreenManager::willExitFullScreen): (WebKit::WebFullScreenManager::didExitFullScreen): (WebKit::WebFullScreenManager::close): * WebProcess/FullScreen/WebFullScreenManager.h: 2018-09-17 Tim Horton Swipe snapshot can get stuck if swiping is disabled while it is visible https://bugs.webkit.org/show_bug.cgi?id=189667 Reviewed by Simon Fraser. If navigation gestures are disabled while a swipe snapshot is visible, WKWebView will tear down the ViewGestureController, which means that the SnapshotRemovalTracker will no longer be around to ever remove the snapshot. It's currently very hard to write a test for this because we have yet to come up with a good mechanism for testing swiping on iOS. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView setAllowsBackForwardNavigationGestures:]): Instead of tearing down the ViewGestureController when navigation gestures are disabled, just set a bit on it that disables gestures. * UIProcess/Cocoa/ViewGestureController.cpp: (WebKit::ViewGestureController::canSwipeInDirection const): * UIProcess/Cocoa/ViewGestureController.h: (WebKit::ViewGestureController::setSwipeGestureEnabled): (WebKit::ViewGestureController::isSwipeGestureEnabled): Add a bit to ViewGestureController that makes starting new gestures always fail, but allows e.g. snapshots from existing swipes to continue their usual behavior. 2018-09-17 Alex Christensen Expose WKWebProcess.h as a private header https://bugs.webkit.org/show_bug.cgi?id=189636 * WebKit.xcodeproj/project.pbxproj: 2018-09-17 Alex Christensen Expose XPCServiceMain in a WebProcess header rather than WKProcessPool https://bugs.webkit.org/show_bug.cgi?id=189636 Reviewed by Dan Bernstein. Fix a few build failures along the way. * PluginProcess/mac/PluginControllerProxyMac.mm: (WebKit::PluginControllerProxy::windowAndViewFramesChanged): (WebKit::PluginControllerProxy::updateLayerHostingContext): * PluginProcess/mac/PluginProcessMac.mm: (WebKit::replacedNSWorkspace_launchApplicationAtURL_options_configuration_error): (WebKit::PluginProcess::platformInitializeProcess): * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h: * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): (main): * SourcesCocoa.txt: * UIProcess/API/Cocoa/WKProcessPool.mm: (+[WKProcessPool _webContentProcessXPCMain]): Deleted. * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/API: Added. * WebProcess/API/Cocoa: Added. * WebProcess/API/Cocoa/WKWebProcess.cpp: Added. (WKWebProcessMain): * WebProcess/API/Cocoa/WKWebProcess.h: Added. * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject convertScreenPointToRootView:]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]): (-[WKAccessibilityWebPageObject accessibilityHitTest:]): 2018-09-17 Basuke Suzuki [Curl] Respond with requested authentication scheme for authentication challenge. https://bugs.webkit.org/show_bug.cgi?id=189318 Reviewed by Alex Christensen. Curl port depends on libcurl's authentication handling by enabling CURLAUTH_ANY. With this mode, the round-trip communication between the client and the server is handled by libcurl internally. That's okay for many cases. But when initial request has a credentials (i.e. XMLHttpRequest), there's no valid chance to store credential to the storage because the returned response is not 401. * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl): (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection): (WebKit::NetworkDataTaskCurl::tryHttpAuthentication): (WebKit::NetworkDataTaskCurl::tryProxyAuthentication): (WebKit::NetworkDataTaskCurl::restartWithCredential): * NetworkProcess/curl/NetworkDataTaskCurl.h: 2018-09-17 Woodrow Wang Clear pending resource load statistics' writes after tests https://bugs.webkit.org/show_bug.cgi?id=189632 Reviewed by Chris Dumez. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreStatisticsResetToConsistentState): 2018-09-17 Chris Dumez PSON: window.open() with 'noopener' should only process-swap cross-site, not cross-origin https://bugs.webkit.org/show_bug.cgi?id=189602 Reviewed by Geoff Garen. The following fixes were made to our process swap on navigation logic: - Browsing contexts opened via window.open() with 'noopener' option now only same if they are cross-site, instead of doing a stricter cross-origin check. - Support process swapping when opening a new window via that is cross-site. In order to support this, the following changes were made: - Stop passing a 'isCrossOriginWindowOpenNavigation' flag to the UIProcess when navigating because: - This is specific to window.open() and does not apply to other windows opened by DOM - This forces the origin check to happens on WebContent process side instead of relying on the one in WebProcessPool in the UIProcess - Pass the origin of the requester to the UIProcess when navigating, so that the WebProcessPool can use the requester's host for the cross-site check for the initial navigation in a new window created by DOM. - Add 2 flags to WebPageProxy which indicate if the page was created by the DOM and if any provisional loads have been committed. The WebProcessPool uses theses flags to recognize initial loads in new windows created by the DOM, so that it uses the requester's origin for the cross-site check. * Shared/NavigationActionData.cpp: (WebKit::NavigationActionData::encode const): (WebKit::NavigationActionData::decode): * Shared/NavigationActionData.h: * UIProcess/API/APINavigation.h: (API::Navigation::setRequesterOrigin): (API::Navigation::requesterOrigin const): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::createNewPage): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::setOpenedByDOM): (WebKit::WebPageProxy::openedByDOM const): (WebKit::WebPageProxy::hasCommittedAnyProvisionalLoads const): * UIProcess/WebProcessPool.cpp: (WebKit::shouldUseSameProcessBasedOnURLs): (WebKit::WebProcessPool::processForNavigationInternal): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): 2018-09-17 Alexey Proskuryakov Revert https://trac.webkit.org/r235910, because the new test times out. Crash under PlatformPopupMenuData::encode when interacting with a select menu that has variable fonts https://bugs.webkit.org/show_bug.cgi?id=188008 * Shared/cf/ArgumentCodersCF.cpp: (IPC::encode): (IPC::decode): 2018-09-17 Alex Christensen Refactoring related to Safe Browsing https://bugs.webkit.org/show_bug.cgi?id=189631 Reviewed by Tim Horton. Make SafeBrowsingResult RefCounted. Move logic from an unnamed lambda to WebPageProxy::receivedNavigationPolicyDecision. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::beginSafeBrowsingCheck): (WebKit::WebPageProxy::contentFilterDidBlockLoadForFrame): Deleted. (WebKit::WebPageProxy::addPlatformLoadParameters): Deleted. (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): Deleted. (WebKit::WebPageProxy::startDrag): Deleted. (WebKit::WebPageProxy::setPromisedDataForImage): Deleted. (WebKit::WebPageProxy::setDragCaretRect): Deleted. (WebKit::WebPageProxy::platformRegisterAttachment): Deleted. (WebKit::WebPageProxy::platformCloneAttachment): Deleted. * UIProcess/SafeBrowsingResult.h: (WebKit::SafeBrowsingResult::create): * UIProcess/WebFramePolicyListenerProxy.cpp: (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults): * UIProcess/WebFramePolicyListenerProxy.h: * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::setUpPolicyListenerProxy): * UIProcess/WebFrameProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponse): * UIProcess/WebPageProxy.h: 2018-09-17 Darin Adler Use OpaqueJSString rather than JSRetainPtr inside WebKit https://bugs.webkit.org/show_bug.cgi?id=189652 Reviewed by Saam Barati. * Shared/API/c/WKString.cpp: Removed unneeded include of JSStringRef.h. * WebProcess/Automation/WebAutomationSessionProxy.cpp: Removed unneeded include of JSRetainPtr. (WebKit::toJSString): Deleted. (WebKit::toJSValue): Use OpaqueJSString::create. (WebKit::callPropertyFunction): Ditto. (WebKit::evaluate): Use adoptRef. (WebKit::evaluateJavaScriptCallback): Ditto. (WebKit::WebAutomationSessionProxy::scriptObjectForFrame): Use OpaqueJSString::create. (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Use String rather than JSStringRef. * WebProcess/Plugins/PDF/PDFPlugin.mm: Removed unneeded includes. (WebKit::PDFPlugin::runScriptsInPDFDocument): Use OpaqueJSString::create. 2018-09-17 Michael Catanzaro Unreviewed, fix incorrect WPE build fix made in r236009 This isn't the right place to add the typedef. I failed to notice that the WebKitWebView type is not actually used anywhere in this header. Actually, the problematic function is no longer declared or used anywhere and was just missed when WebKitScriptDialog was refactored, so remove it. * UIProcess/API/wpe/WebKitScriptDialog.h: * UIProcess/API/wpe/WebKitScriptDialogWPE.cpp: (webkitScriptDialogRun): Deleted. 2018-09-17 Sihui Liu Move IndexedDB to Network Process https://bugs.webkit.org/show_bug.cgi?id=189415 Reviewed by Chris Dumez. We are going to eliminate storage process and move its functionality to network process. The reasons why we want to do this: 1. Lower resource usage of having an additional process for storage operations, especially memory. Single storage process takes about 5MB memory on macOS. 2. Reduce latency of Service Workers. After enabling Service Workers, we've seen regression in app launch. The launch time of storage process is partly attributed to this: Service Workers delay page loading until receiving response from storage process. 3. We choose network process because UI process may have broader access in file system that we don't want the storage operations to have. This patch is the first piece towards the goal. It mainly moves indexedDB from storage process to corresponding components of network process. Moving of Service Worker and stopping to launch storage process will be done in following patches. We expect to see the higher cpu and memory usage of network process as it is taking more work, but the overall gain in memory and latency after we completely remove storage process should be positive. * CMakeLists.txt: * DerivedSources.make: * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp. (WebKit::WebIDBConnectionToClient::create): (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient): (WebKit::WebIDBConnectionToClient::~WebIDBConnectionToClient): (WebKit::WebIDBConnectionToClient::disconnectedFromWebProcess): (WebKit::WebIDBConnectionToClient::messageSenderConnection): (WebKit::WebIDBConnectionToClient::connectionToClient): (WebKit::WebIDBConnectionToClient::didDeleteDatabase): (WebKit::WebIDBConnectionToClient::didOpenDatabase): (WebKit::WebIDBConnectionToClient::didAbortTransaction): (WebKit::WebIDBConnectionToClient::didCommitTransaction): (WebKit::WebIDBConnectionToClient::didCreateObjectStore): (WebKit::WebIDBConnectionToClient::didDeleteObjectStore): (WebKit::WebIDBConnectionToClient::didRenameObjectStore): (WebKit::WebIDBConnectionToClient::didClearObjectStore): (WebKit::WebIDBConnectionToClient::didCreateIndex): (WebKit::WebIDBConnectionToClient::didDeleteIndex): (WebKit::WebIDBConnectionToClient::didRenameIndex): (WebKit::WebIDBConnectionToClient::didPutOrAdd): (WebKit::WebIDBConnectionToClient::handleGetResult): (WebKit::WebIDBConnectionToClient::didGetRecord): (WebKit::WebIDBConnectionToClient::didGetAllRecords): (WebKit::WebIDBConnectionToClient::didGetCount): (WebKit::WebIDBConnectionToClient::didDeleteRecord): (WebKit::WebIDBConnectionToClient::didOpenCursor): (WebKit::WebIDBConnectionToClient::didIterateCursor): (WebKit::WebIDBConnectionToClient::fireVersionChangeEvent): (WebKit::WebIDBConnectionToClient::didStartTransaction): (WebKit::WebIDBConnectionToClient::didCloseFromServer): (WebKit::WebIDBConnectionToClient::notifyOpenDBRequestBlocked): (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNames): (WebKit::WebIDBConnectionToClient::deleteDatabase): (WebKit::WebIDBConnectionToClient::openDatabase): (WebKit::WebIDBConnectionToClient::abortTransaction): (WebKit::WebIDBConnectionToClient::commitTransaction): (WebKit::WebIDBConnectionToClient::didFinishHandlingVersionChangeTransaction): (WebKit::WebIDBConnectionToClient::createObjectStore): (WebKit::WebIDBConnectionToClient::deleteObjectStore): (WebKit::WebIDBConnectionToClient::renameObjectStore): (WebKit::WebIDBConnectionToClient::clearObjectStore): (WebKit::WebIDBConnectionToClient::createIndex): (WebKit::WebIDBConnectionToClient::deleteIndex): (WebKit::WebIDBConnectionToClient::renameIndex): (WebKit::WebIDBConnectionToClient::putOrAdd): (WebKit::WebIDBConnectionToClient::getRecord): (WebKit::WebIDBConnectionToClient::getAllRecords): (WebKit::WebIDBConnectionToClient::getCount): (WebKit::WebIDBConnectionToClient::deleteRecord): (WebKit::WebIDBConnectionToClient::openCursor): (WebKit::WebIDBConnectionToClient::iterateCursor): (WebKit::WebIDBConnectionToClient::establishTransaction): (WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose): (WebKit::WebIDBConnectionToClient::databaseConnectionClosed): (WebKit::WebIDBConnectionToClient::abortOpenAndUpgradeNeeded): (WebKit::WebIDBConnectionToClient::didFireVersionChangeEvent): (WebKit::WebIDBConnectionToClient::openDBRequestCancelled): (WebKit::WebIDBConnectionToClient::confirmDidCloseFromServer): (WebKit::WebIDBConnectionToClient::getAllDatabaseNames): * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.h. * NetworkProcess/IndexedDB/WebIDBConnectionToClient.messages.in: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.messages.in. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): Code moved from StorageToWebProcessConnection::didReceiveMessage. (WebKit::NetworkConnectionToWebProcess::didClose): (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles): Network process receives and stores sandbox extension of temporary files for later indexedDB use. (WebKit::NetworkConnectionToWebProcess::didClose): (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles): (WebKit::generateIDBConnectionToServerIdentifier): (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer): (WebKit::NetworkConnectionToWebProcess::removeIDBConnectionToServer): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::NetworkProcess): (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::addWebsiteDataStore): (WebKit::NetworkProcess::fetchWebsiteData): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::idbServer): (WebKit::NetworkProcess::ensurePathExists): (WebKit::NetworkProcess::postStorageTask): (WebKit::NetworkProcess::performNextStorageTask): (WebKit::NetworkProcess::prepareForAccessToTemporaryFile): (WebKit::NetworkProcess::accessToTemporaryFileComplete): (WebKit::NetworkProcess::indexedDatabaseOrigins): (WebKit::NetworkProcess::addIndexedDatabaseSession): (WebKit::NetworkProcess::getSandboxExtensionsForBlobFiles): Instead of asking UI process to grant sandbox extension to storage process, now network process just asks for sandbox extension fot itself. (WebKit::NetworkProcess::didGetSandboxExtensionsForBlobFiles): (WebKit::NetworkProcess::updateTemporaryFileSandboxExtensions): (WebKit::NetworkProcess::grantSandboxExtensionsToStorageProcessForBlobs): Deleted. (WebKit::NetworkProcess::didGrantSandboxExtensionsToStorageProcessForBlobs): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * Shared/Storage/StorageProcessCreationParameters.cpp: (WebKit::StorageProcessCreationParameters::encode const): (WebKit::StorageProcessCreationParameters::decode): * Shared/Storage/StorageProcessCreationParameters.h: * Shared/WebsiteDataStoreParameters.cpp: (WebKit::WebsiteDataStoreParameters::encode const): (WebKit::WebsiteDataStoreParameters::decode): (WebKit::WebsiteDataStoreParameters::privateSessionParameters): * Shared/WebsiteDataStoreParameters.h: * Sources.txt: * StorageProcess/StorageProcess.cpp: (WebKit::StorageProcess::initializeWebsiteDataStore): (WebKit::StorageProcess::fetchWebsiteData): (WebKit::StorageProcess::deleteWebsiteData): (WebKit::StorageProcess::deleteWebsiteDataForOrigins): (WebKit::StorageProcess::idbServer): Deleted. (WebKit::StorageProcess::grantSandboxExtensionsForBlobs): Deleted. (WebKit::StorageProcess::prepareForAccessToTemporaryFile): Deleted. (WebKit::StorageProcess::accessToTemporaryFileComplete): Deleted. (WebKit::StorageProcess::indexedDatabaseOrigins): Deleted. (WebKit::StorageProcess::getSandboxExtensionsForBlobFiles): Deleted. (WebKit::StorageProcess::didGetSandboxExtensionsForBlobFiles): Deleted. * StorageProcess/StorageProcess.h: (WebKit::StorageProcess::queue): Deleted. * StorageProcess/StorageProcess.messages.in: * StorageProcess/StorageToWebProcessConnection.cpp: (WebKit::StorageToWebProcessConnection::didReceiveMessage): (WebKit::StorageToWebProcessConnection::didClose): (WebKit::generateIDBConnectionToServerIdentifier): Deleted. (WebKit::StorageToWebProcessConnection::establishIDBConnectionToServer): Deleted. (WebKit::StorageToWebProcessConnection::removeIDBConnectionToServer): Deleted. * StorageProcess/StorageToWebProcessConnection.h: * StorageProcess/StorageToWebProcessConnection.messages.in: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::getSandboxExtensionsForBlobFiles): (WebKit::NetworkProcessProxy::grantSandboxExtensionsToStorageProcessForBlobs): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/Storage/StorageProcessProxy.cpp: (WebKit::StorageProcessProxy::getSandboxExtensionsForBlobFiles): Deleted. * UIProcess/Storage/StorageProcessProxy.h: * UIProcess/Storage/StorageProcessProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore): (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::computeNetworkProcessAccessTypeForDataFetch): (WebKit::WebsiteDataStore::fetchDataAndApply): (WebKit::computeNetworkProcessAccessTypeForDataRemoval): (WebKit::WebsiteDataStore::removeData): (WebKit::WebsiteDataStore::storageProcessParameters): (WebKit::WebsiteDataStore::parameters): * WebKit.xcodeproj/project.pbxproj: * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp: (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer): (WebKit::WebIDBConnectionToServer::~WebIDBConnectionToServer): (WebKit::WebIDBConnectionToServer::messageSenderConnection): * WebProcess/Databases/WebDatabaseProvider.cpp: (WebKit::WebDatabaseProvider::idbConnectionToServerForSession): * WebProcess/Network/NetworkProcessConnection.cpp: (WebKit::NetworkProcessConnection::didReceiveMessage): (WebKit::NetworkProcessConnection::didClose): (WebKit::NetworkProcessConnection::idbConnectionToServerForSession): * WebProcess/Network/NetworkProcessConnection.h: (WebKit::NetworkProcessConnection::existingIDBConnectionToServerForIdentifier const): * WebProcess/Storage/WebToStorageProcessConnection.cpp: (WebKit::WebToStorageProcessConnection::didReceiveMessage): (WebKit::WebToStorageProcessConnection::didClose): (WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession): Deleted. * WebProcess/Storage/WebToStorageProcessConnection.h: (WebKit::WebToStorageProcessConnection::existingIDBConnectionToServerForIdentifier): Deleted. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::networkProcessConnectionClosed): (WebKit::WebProcess::webToStorageProcessConnectionClosed): 2018-09-08 Darin Adler Streamline JSRetainPtr, fix leaks of JSString and JSGlobalContext https://bugs.webkit.org/show_bug.cgi?id=189455 Reviewed by Keith Miller. * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::toJSString): Use adopt function instead of adopt construuctor. (WebKit::evaluate): Ditto. (WebKit::evaluateJavaScriptCallback): Ditto. (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Ditto. 2018-09-14 Matt Lewis Unreviewed, rolling out r236020. This caused an api failure on High Sierra Reverted changeset: "Refactoring related to Safe Browsing" https://bugs.webkit.org/show_bug.cgi?id=189631 https://trac.webkit.org/changeset/236020 2018-09-14 Basuke Suzuki [Curl] Bug fix on some inaccurate values in NetworkLoadMetrics. https://bugs.webkit.org/show_bug.cgi?id=189530 Reviewed by Alex Christensen. Curl port uses the start time libcurl provided. But there's a lug between main thread and Curl thread. Record the start time of request instead of libcurl's start timing and use it to measure the metrics. * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl): (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection): (WebKit::NetworkDataTaskCurl::restartWithCredential): * NetworkProcess/curl/NetworkDataTaskCurl.h: 2018-09-14 Alex Christensen Refactoring related to Safe Browsing https://bugs.webkit.org/show_bug.cgi?id=189631 Reviewed by Tim Horton. Make SafeBrowsingResult RefCounted. Move logic from an unnamed lambda to WebPageProxy::receivedNavigationPolicyDecision. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::beginSafeBrowsingCheck): (WebKit::WebPageProxy::contentFilterDidBlockLoadForFrame): Deleted. (WebKit::WebPageProxy::addPlatformLoadParameters): Deleted. (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): Deleted. (WebKit::WebPageProxy::startDrag): Deleted. (WebKit::WebPageProxy::setPromisedDataForImage): Deleted. (WebKit::WebPageProxy::setDragCaretRect): Deleted. (WebKit::WebPageProxy::platformRegisterAttachment): Deleted. (WebKit::WebPageProxy::platformCloneAttachment): Deleted. * UIProcess/SafeBrowsingResult.h: (WebKit::SafeBrowsingResult::create): * UIProcess/WebFramePolicyListenerProxy.cpp: (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults): * UIProcess/WebFramePolicyListenerProxy.h: * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::setUpPolicyListenerProxy): * UIProcess/WebFrameProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponse): * UIProcess/WebPageProxy.h: 2018-09-14 Geoffrey Garen Clarify the configuration used by WKUIDelegate's createWebViewWithConfiguration https://bugs.webkit.org/show_bug.cgi?id=189634 Reviewed by Tim Horton. * UIProcess/API/Cocoa/WKUIDelegate.h: 2018-09-11 Simon Fraser Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings https://bugs.webkit.org/show_bug.cgi?id=189521 Reviewed by Tim Horton. Make GraphicsLayer be RefCounted. GraphicsLayers own their children, via a Vector>. RenderLayerBacking and other holders of GraphicsLayers use RefPtr. Added some helper functions to null out a RefPtr after removing from the tree, clearing the client. GraphicsLayer.m_client becomes a pointer, so it can be set to point to a singleton empty client when a GraphicsLayer gets detached from its owner. More explicit layer unparenting, and removed some unnecessary parent checks, and redundant unparenting. Other changes are just to adapt to the new ownership patterns. I verified that no GraphicsLayers were leaked or abandoned after this change. * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::~WebInspectorClient): (WebKit::WebInspectorClient::showPaintRect): (WebKit::WebInspectorClient::animationEndedForLayer): * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::createGraphicsLayer): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): 2018-09-14 Eric Carlson Support arbitrary video resolution in getUserMedia API https://bugs.webkit.org/show_bug.cgi?id=178109 Reviewed by Youenn Fablet. * WebProcess/cocoa/UserMediaCaptureManager.cpp: 2018-09-14 Basuke Suzuki [Curl][WebKit] Bug fix for continuously retrying with empty credentials. https://bugs.webkit.org/show_bug.cgi?id=189601 Reviewed by Alex Christensen. Added stop condition for empty credentials passed by client. * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse): (WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse): (WebKit::NetworkDataTaskCurl::tryHttpAuthentication): (WebKit::NetworkDataTaskCurl::tryProxyAuthentication): * NetworkProcess/curl/NetworkDataTaskCurl.h: 2018-09-14 Jer Noble Turn SourceBufferChangeTypeEnabled on by default https://bugs.webkit.org/show_bug.cgi?id=189527 Reviewed by Eric Carlson. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferencesRefPrivate.h: 2018-09-14 Michael Catanzaro Unreviewed, speculative WPE build fix after r236004 https://bugs.webkit.org/show_bug.cgi?id=189545 * UIProcess/API/wpe/WebKitScriptDialog.h: 2018-09-14 Carlos Garcia Campos [GTK] Make script dialogs modal to the current web view only https://bugs.webkit.org/show_bug.cgi?id=189545 Reviewed by Michael Catanzaro. Change the default implementation of script dialogs to use an embedded window, like the HTTP auth dialog, instead of a GtkMessageDialog. This patch adds a base class WebKitWebViewDialog shared by WebKitAuthenticationDialog and the new WebKitScriptDialogImpl. * SourcesGTK.txt: Add new files to compilation. * UIProcess/API/glib/WebKitScriptDialogPrivate.h: * UIProcess/API/gtk/WebKitAuthenticationDialog.cpp: (webkitAuthenticationDialogInitialize): Do not use a frame and use a better styled title. (webkit_authentication_dialog_class_init): Remove implementation of vfuncs that are now implemented by the parent. * UIProcess/API/gtk/WebKitAuthenticationDialog.h: * UIProcess/API/gtk/WebKitScriptDialogGtk.cpp: (webkitScriptDialogAccept): Use WebKitScriptDialogImpl API. (webkitScriptDialogDismiss): Ditto. (webkitScriptDialogSetUserInput): Ditto. * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp: Added. (webkitScriptDialogImplClose): (webkitScriptDialogImplKeyPressEvent): (webkitScriptDialogImplMap): (webkitScriptDialogImplConstructed): (webkitScriptDialogImplDispose): (webkit_script_dialog_impl_class_init): (webkitScriptDialogImplAddButton): (webkitScriptDialogImplNew): (webkitScriptDialogImplCancel): (webkitScriptDialogImplConfirm): (webkitScriptDialogImplSetEntryText): * UIProcess/API/gtk/WebKitScriptDialogImpl.h: Added. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewChildIsInternalWidget): Rename authenticationDialog as just dialog. (webkitWebViewBaseAddDialog): Ditto. (webkitWebViewBaseContainerRemove): Ditto. (webkitWebViewBaseContainerForall): Ditto. (webkitWebViewBaseConstructed): Ditto. (webkitWebViewBaseSizeAllocate): Ditto. (webkitWebViewBaseKeyPressEvent): Ditto. (webkitWebViewBaseHandleMouseEvent): Ditto. (webkitWebViewBaseButtonPressEvent): Ditto. (webkitWebViewBaseButtonReleaseEvent): Ditto. (webkitWebViewBaseHandleWheelEvent): Ditto. (webkitWebViewBaseScrollEvent): Ditto. (webkitWebViewBaseMotionNotifyEvent): Ditto. (webkitWebViewBaseCrossingNotifyEvent): Ditto. (webkitWebViewBaseTouchEvent): Ditto. (webkitWebViewBaseFocus): Ditto. (webkitWebViewBaseDestroy): Ditto. * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: * UIProcess/API/gtk/WebKitWebViewDialog.cpp: Added. (webkitWebViewDialogDraw): (webkitWebViewDialogSizeAllocate): (webkitWebViewDialogConstructed): (webkit_web_view_dialog_class_init): * UIProcess/API/gtk/WebKitWebViewDialog.h: Added. * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (webkitWebViewAuthenticate): (webkitWebViewScriptDialog): 2018-09-13 Ryan Haddad Unreviewed, rolling out r235954. Breaks the watchOS build. Reverted changeset: "Move IndexedDB to Network Process" https://bugs.webkit.org/show_bug.cgi?id=189415 https://trac.webkit.org/changeset/235954 2018-09-13 Chris Dumez Regression(PSON): setting window.opener to null allows process swapping in cases that are not web-compatible https://bugs.webkit.org/show_bug.cgi?id=189590 Reviewed by Geoffrey Garen. If script calls window.open() without 'noopener' and the newly navigated window gets navigated cross-site, we are currently unable to process-swap because the opener has a WindowProxy handle to this new Window and may interact with it (which we currently do not support cross-process). We were dealing with this by not process-swapping if window.opener is not null. This works most of the time but is not sufficient because the opener may get nulled out, while the opener still has a valid WindowProxy handle to its openee. Therefore, we now also check for a flag indicating if the frame was opened via window.open() without 'nooopener'. We still need to check if the browsing context has an opener for browsing context created via for example (the opener does not have a handle to the new window but the openee has access to its opener). * Shared/NavigationActionData.cpp: (WebKit::NavigationActionData::encode const): (WebKit::NavigationActionData::decode): * Shared/NavigationActionData.h: * UIProcess/API/APINavigation.h: (API::Navigation::openedViaWindowOpenWithOpener const): (API::Navigation::setOpenedViaWindowOpenWithOpener): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigationInternal): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): 2018-09-13 Dean Jackson Generate warnings for Preferences files https://bugs.webkit.org/show_bug.cgi?id=189573 Reviewed by Sam Weinig. Generate the "DO NOT EDIT" warnings, rather than have them in the template (which was confusing). While here, simplify some of the templating generation code to avoid duplication. * Scripts/GeneratePreferences.rb: * Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesKeys.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesKeys.h.erb: * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb: 2018-09-13 Keith Rollin WebPageProxy::reportPageLoadResult can crash on some code paths https://bugs.webkit.org/show_bug.cgi?id=189568 Reviewed by Chris Dumez. WebPageProxy::reportPageLoadResult (which is called from WebPageProxy::didFinishLoadForFrame) can sometimes crash when accessing m_pageLoadStart (a std::optional) in its unloaded state. Normally, m_pageLoadStart is initialized in WebPageProxy::didStartProvisionalLoadForFrame, which one would expect would be called before WebPageProxy::didFinishLoadForFrame. But that turns out to not always be the case. It's not apparent under what conditions didStartProvisionalLoadForFrame will not be called, but it's happening in the wild, leading to crashes now that std::optional asserts in release builds on bad accesses (see https://bugs.webkit.org/show_bug.cgi?id=189568). Fix this by checking m_pageLoadState on entry to reportPageLoadResult. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::reportPageLoadResult): 2018-09-13 Chris Dumez ProcessSwap.BackWithoutSuspendedPage API test hits assertion under WebPageProxy::didCreateMainFrame() https://bugs.webkit.org/show_bug.cgi?id=189599 Reviewed by Geoffrey Garen. The code in WebPageProxy::reattachToWebProcess() was re-initializing m_mainFrame unconditionally in case of a HistoryNavigation. The reason we need to initialize m_mainFrame in reattachToWebProcess() is if the process we're reattaching to already has a WebPage (with a main frame), in which case WebPageProxy::didCreateMainFrame() would not get called to initialize WebPageProxy::m_mainFrame. The process we're reattaching to can be in such a state only if it comes from a SuspendedPageProxy (we detached the WebProcessProxy from the WebPageProxy but kept the WebPage in the "suspended" WebProcess). It is true that we're only reattaching to a SuspendedPageProxy's process in the event of history navigations. However, it is not true that all history navigations will use a SuspendedPageProxy's process. For example, no SuspendedPageProxy may be available for the history navigation because the history was restored to a new view from disk, or because the WebBackForwardListItem no longer has a SuspendedPageProxy (we currently only keep a single SuspendedPageProxy for the last HistoryItem). Therefore, unconditionally initializating m_mainFrame in reattachToWebProcess() for history navigations is incorrect and we should instead check if we're reattaching to a SuspendedPage's process. Change is covered by ProcessSwap.BackWithoutSuspendedPage API test which is no longer crashes and existing Back/Forward PSON API tests which are still passing. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::reattachToWebProcess): (WebKit::WebPageProxy::continueNavigationInNewProcess): * UIProcess/WebPageProxy.h: 2018-09-13 Chris Dumez Add release logging to help debug PSON issues https://bugs.webkit.org/show_bug.cgi?id=189562 Reviewed by Ryosuke Niwa. Add release logging to help debug issues related to process swap on navigation. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigation): (WebKit::WebProcessPool::processForNavigationInternal): * UIProcess/WebProcessPool.h: 2018-09-13 Chris Dumez Add null check for drawing area in WebPage::didCompletePageTransition() after r235867 https://bugs.webkit.org/show_bug.cgi?id=189587 Reviewed by Geoffrey Garen. Add null check for drawing area in WebPage::didCompletePageTransition() after r235867 as this is causing crashes on the bots. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCompletePageTransition): 2018-09-13 Ryan Haddad Unreviewed, rolling out r235953. Caused layout test crashes under GuardMalloc. Reverted changeset: "Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings" https://bugs.webkit.org/show_bug.cgi?id=189521 https://trac.webkit.org/changeset/235953 2018-09-13 Carlos Garcia Campos [GTK][WPE] Allow to run script dialogs asynchronously in the UI process https://bugs.webkit.org/show_bug.cgi?id=189544 Reviewed by Michael Catanzaro. Script dialogs are sync in the WebProcess, but we don't need to block the UI process while they are running. Our current API doesn't allow it, because it always expects the dialog to be closed in the signal handler. API changes are backwards compatible. * UIProcess/API/glib/WebKitScriptDialog.cpp: (webkitScriptDialogCreate): Added to heap allocate a WebKitScriptDialog. (webkitScriptDialogIsRunning): Common implementation here, a script dialog is considered to be running if it has a competion handler pending. (webkit_script_dialog_ref): WebKitScriptDialog is now refcounted. (webkit_script_dialog_unref): Ditto. (webkit_script_dialog_close): New method to notify that we are done with the dialog. * UIProcess/API/glib/WebKitScriptDialogPrivate.h: (_WebKitScriptDialog::_WebKitScriptDialog): Use a single constructor and keep the completion handler. * UIProcess/API/glib/WebKitUIClient.cpp: Do not call the completion handler, pass it to the web view. * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewDispose): Close the current script dialog if there's any. (webkit_web_view_class_init): Document how to handle dialogs asynchronously. (webkitWebViewRunJavaScriptAlert): Do not stack allocate the WebKitScriptDialog, create it with webkitScriptDialogCreate() passing the completion handler. (webkitWebViewRunJavaScriptConfirm): Ditto. (webkitWebViewRunJavaScriptPrompt): Ditto. (webkitWebViewRunJavaScriptBeforeUnloadConfirm): Ditto. * UIProcess/API/glib/WebKitWebViewPrivate.h: * UIProcess/API/gtk/WebKitScriptDialog.h: * UIProcess/API/gtk/WebKitScriptDialogGtk.cpp: (scriptDialogResponseCallback): Hnadle the response callback. (webkitScriptDialogRun): Do not use gtk_dialog_run(), connect to response signal and show the dialogs instead. * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: * UIProcess/API/wpe/WebKitScriptDialogWPE.cpp: 2018-09-12 Dan Bernstein Update availability annotations to match the macOS and iOS SDKs in the Xcode 10 GM seed https://bugs.webkit.org/show_bug.cgi?id=189561 Reviewed by Tim Horton. Changed WK_MAC_TBA and WK_IOS_TBA to 10.14 and 12.0, respectively, in all declarations that appear in the GM seed SDKs. * Shared/API/Cocoa/_WKRenderingProgressEvents.h: * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h: * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h: * UIProcess/API/Cocoa/WKViewPrivate.h: * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/API/Cocoa/_WKAttachment.h: * UIProcess/API/Cocoa/_WKAutomationDelegate.h: * UIProcess/API/Cocoa/_WKAutomationSession.h: * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h: * UIProcess/API/Cocoa/_WKFormInputSession.h: * UIProcess/API/Cocoa/_WKInputDelegate.h: * UIProcess/API/Cocoa/_WKLinkIconParameters.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKWebsitePolicies.h: * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.h: * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h: 2018-09-12 Dan Bernstein [Cocoa] Complete support for Paste as Quotation https://bugs.webkit.org/show_bug.cgi?id=189504 Reviewed by Wenson Hsieh. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView canPerformAction:withSender:]): Handle _pasteAsQuotation:. It’s not included in FOR_EACH_WKCONTENTVIEW_ACTION, because it’s declared and implemented in the WKPrivate category. If we add more actions in the category, it could make sense to fold them into a new FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION. (-[WKWebView targetForAction:withSender:]): Handle _pasteAsQuotation:. (-[WKWebView _pasteAsQuotation:]): Send to the WebViewImpl or the WKContentView. * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declared a new _pasteAsQuotation: action. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::selectorExceptionMap): Added a custom mapping from the new selector to the PasteAsQuotation command. * UIProcess/ios/WKContentViewInteraction.h: Declare methods for the new action. * UIProcess/ios/WKContentViewInteraction.mm: Forward _pasteAsQuotation: to the WKWebView so that clients get a chance to override its behavior. (-[WKContentView _pasteAsQuotationForWebView:]): Send the command to the page. 2018-09-12 Sihui Liu Move IndexedDB to Network Process https://bugs.webkit.org/show_bug.cgi?id=189415 Reviewed by Geoffrey Garen. We are going to eliminate storage process and move its functionality to network process. The reasons why we want to do this: 1. Lower resource usage of having an additional process for storage operations, especially memory. Single storage process takes about 5MB memory on macOS. 2. Reduce latency of Service Workers. After enabling Service Workers, we've seen regression in app launch. The launch time of storage process is partly attributed to this: Service Workers delay page loading until receiving response from storage process. 3. We choose network process because UI process may have broader access in file system that we don't want the storage operations to have. This patch is the first piece towards the goal. It mainly moves indexedDB from storage process to corresponding components of network process. Moving of Service Worker and stopping to launch storage process will be done in following patches. We expect to see the higher cpu and memory usage of network process as it is taking more work, but the overall gain in memory and latency after we completely remove storage process should be positive. * CMakeLists.txt: * DerivedSources.make: * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp. (WebKit::WebIDBConnectionToClient::create): (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient): (WebKit::WebIDBConnectionToClient::~WebIDBConnectionToClient): (WebKit::WebIDBConnectionToClient::disconnectedFromWebProcess): (WebKit::WebIDBConnectionToClient::messageSenderConnection): (WebKit::WebIDBConnectionToClient::connectionToClient): (WebKit::WebIDBConnectionToClient::didDeleteDatabase): (WebKit::WebIDBConnectionToClient::didOpenDatabase): (WebKit::WebIDBConnectionToClient::didAbortTransaction): (WebKit::WebIDBConnectionToClient::didCommitTransaction): (WebKit::WebIDBConnectionToClient::didCreateObjectStore): (WebKit::WebIDBConnectionToClient::didDeleteObjectStore): (WebKit::WebIDBConnectionToClient::didRenameObjectStore): (WebKit::WebIDBConnectionToClient::didClearObjectStore): (WebKit::WebIDBConnectionToClient::didCreateIndex): (WebKit::WebIDBConnectionToClient::didDeleteIndex): (WebKit::WebIDBConnectionToClient::didRenameIndex): (WebKit::WebIDBConnectionToClient::didPutOrAdd): (WebKit::WebIDBConnectionToClient::handleGetResult): (WebKit::WebIDBConnectionToClient::didGetRecord): (WebKit::WebIDBConnectionToClient::didGetAllRecords): (WebKit::WebIDBConnectionToClient::didGetCount): (WebKit::WebIDBConnectionToClient::didDeleteRecord): (WebKit::WebIDBConnectionToClient::didOpenCursor): (WebKit::WebIDBConnectionToClient::didIterateCursor): (WebKit::WebIDBConnectionToClient::fireVersionChangeEvent): (WebKit::WebIDBConnectionToClient::didStartTransaction): (WebKit::WebIDBConnectionToClient::didCloseFromServer): (WebKit::WebIDBConnectionToClient::notifyOpenDBRequestBlocked): (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNames): (WebKit::WebIDBConnectionToClient::deleteDatabase): (WebKit::WebIDBConnectionToClient::openDatabase): (WebKit::WebIDBConnectionToClient::abortTransaction): (WebKit::WebIDBConnectionToClient::commitTransaction): (WebKit::WebIDBConnectionToClient::didFinishHandlingVersionChangeTransaction): (WebKit::WebIDBConnectionToClient::createObjectStore): (WebKit::WebIDBConnectionToClient::deleteObjectStore): (WebKit::WebIDBConnectionToClient::renameObjectStore): (WebKit::WebIDBConnectionToClient::clearObjectStore): (WebKit::WebIDBConnectionToClient::createIndex): (WebKit::WebIDBConnectionToClient::deleteIndex): (WebKit::WebIDBConnectionToClient::renameIndex): (WebKit::WebIDBConnectionToClient::putOrAdd): (WebKit::WebIDBConnectionToClient::getRecord): (WebKit::WebIDBConnectionToClient::getAllRecords): (WebKit::WebIDBConnectionToClient::getCount): (WebKit::WebIDBConnectionToClient::deleteRecord): (WebKit::WebIDBConnectionToClient::openCursor): (WebKit::WebIDBConnectionToClient::iterateCursor): (WebKit::WebIDBConnectionToClient::establishTransaction): (WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose): (WebKit::WebIDBConnectionToClient::databaseConnectionClosed): (WebKit::WebIDBConnectionToClient::abortOpenAndUpgradeNeeded): (WebKit::WebIDBConnectionToClient::didFireVersionChangeEvent): (WebKit::WebIDBConnectionToClient::openDBRequestCancelled): (WebKit::WebIDBConnectionToClient::confirmDidCloseFromServer): (WebKit::WebIDBConnectionToClient::getAllDatabaseNames): * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.h. * NetworkProcess/IndexedDB/WebIDBConnectionToClient.messages.in: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.messages.in. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): Code moved from StorageToWebProcessConnection::didReceiveMessage. (WebKit::NetworkConnectionToWebProcess::didClose): (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles): Network process receives and stores sandbox extension of temporary files for later indexedDB use. (WebKit::generateIDBConnectionToServerIdentifier): (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer): (WebKit::NetworkConnectionToWebProcess::removeIDBConnectionToServer): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::NetworkProcess): (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::addWebsiteDataStore): (WebKit::NetworkProcess::fetchWebsiteData): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::idbServer): (WebKit::NetworkProcess::ensurePathExists): (WebKit::NetworkProcess::postStorageTask): (WebKit::NetworkProcess::performNextStorageTask): (WebKit::NetworkProcess::prepareForAccessToTemporaryFile): (WebKit::NetworkProcess::accessToTemporaryFileComplete): (WebKit::NetworkProcess::indexedDatabaseOrigins): (WebKit::NetworkProcess::addIndexedDatabaseSession): (WebKit::NetworkProcess::getSandboxExtensionsForBlobFiles): Instead of asking UI process to grant sandbox extension to storage process, now network process just asks for sandbox extension fot itself. (WebKit::NetworkProcess::didGetSandboxExtensionsForBlobFiles): (WebKit::NetworkProcess::updateTemporaryFileSandboxExtensions): (WebKit::NetworkProcess::grantSandboxExtensionsToStorageProcessForBlobs): Deleted. (WebKit::NetworkProcess::didGrantSandboxExtensionsToStorageProcessForBlobs): Deleted. * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::queue): * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * Shared/Storage/StorageProcessCreationParameters.cpp: (WebKit::StorageProcessCreationParameters::encode const): (WebKit::StorageProcessCreationParameters::decode): * Shared/Storage/StorageProcessCreationParameters.h: * Shared/WebsiteDataStoreParameters.cpp: (WebKit::WebsiteDataStoreParameters::encode const): (WebKit::WebsiteDataStoreParameters::decode): (WebKit::WebsiteDataStoreParameters::privateSessionParameters): * Shared/WebsiteDataStoreParameters.h: * Sources.txt: * StorageProcess/StorageProcess.cpp: (WebKit::StorageProcess::initializeWebsiteDataStore): (WebKit::StorageProcess::fetchWebsiteData): (WebKit::StorageProcess::deleteWebsiteData): (WebKit::StorageProcess::deleteWebsiteDataForOrigins): (WebKit::StorageProcess::idbServer): Deleted. (WebKit::StorageProcess::grantSandboxExtensionsForBlobs): Deleted. (WebKit::StorageProcess::prepareForAccessToTemporaryFile): Deleted. (WebKit::StorageProcess::accessToTemporaryFileComplete): Deleted. (WebKit::StorageProcess::indexedDatabaseOrigins): Deleted. (WebKit::StorageProcess::getSandboxExtensionsForBlobFiles): Deleted. (WebKit::StorageProcess::didGetSandboxExtensionsForBlobFiles): Deleted. * StorageProcess/StorageProcess.h: (WebKit::StorageProcess::queue): Deleted. * StorageProcess/StorageProcess.messages.in: * StorageProcess/StorageToWebProcessConnection.cpp: (WebKit::StorageToWebProcessConnection::didReceiveMessage): (WebKit::StorageToWebProcessConnection::didClose): (WebKit::generateIDBConnectionToServerIdentifier): Deleted. (WebKit::StorageToWebProcessConnection::establishIDBConnectionToServer): Deleted. (WebKit::StorageToWebProcessConnection::removeIDBConnectionToServer): Deleted. * StorageProcess/StorageToWebProcessConnection.h: * StorageProcess/StorageToWebProcessConnection.messages.in: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::getSandboxExtensionsForBlobFiles): (WebKit::NetworkProcessProxy::grantSandboxExtensionsToStorageProcessForBlobs): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/Storage/StorageProcessProxy.cpp: (WebKit::StorageProcessProxy::getSandboxExtensionsForBlobFiles): Deleted. * UIProcess/Storage/StorageProcessProxy.h: * UIProcess/Storage/StorageProcessProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore): (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::computeNetworkProcessAccessTypeForDataFetch): (WebKit::WebsiteDataStore::fetchDataAndApply): (WebKit::computeNetworkProcessAccessTypeForDataRemoval): (WebKit::WebsiteDataStore::removeData): (WebKit::WebsiteDataStore::storageProcessParameters): (WebKit::WebsiteDataStore::parameters): * WebKit.xcodeproj/project.pbxproj: * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp: (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer): (WebKit::WebIDBConnectionToServer::~WebIDBConnectionToServer): (WebKit::WebIDBConnectionToServer::messageSenderConnection): * WebProcess/Databases/WebDatabaseProvider.cpp: (WebKit::WebDatabaseProvider::idbConnectionToServerForSession): * WebProcess/Network/NetworkProcessConnection.cpp: (WebKit::NetworkProcessConnection::didReceiveMessage): (WebKit::NetworkProcessConnection::didClose): (WebKit::NetworkProcessConnection::idbConnectionToServerForSession): * WebProcess/Network/NetworkProcessConnection.h: (WebKit::NetworkProcessConnection::existingIDBConnectionToServerForIdentifier): * WebProcess/Storage/WebToStorageProcessConnection.cpp: (WebKit::WebToStorageProcessConnection::didReceiveMessage): Code moved from WebToStorageProcessConnection::didReceiveMessage. (WebKit::WebToStorageProcessConnection::didClose): (WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession): Deleted. * WebProcess/Storage/WebToStorageProcessConnection.h: (WebKit::WebToStorageProcessConnection::existingIDBConnectionToServerForIdentifier): Deleted. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::networkProcessConnectionClosed): (WebKit::WebProcess::webToStorageProcessConnectionClosed): 2018-09-11 Simon Fraser Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings https://bugs.webkit.org/show_bug.cgi?id=189521 Reviewed by Tim Horton. Make GraphicsLayer be RefCounted. GraphicsLayers own their children, via a Vector>. RenderLayerBacking and other holders of GraphicsLayers use RefPtr. All the other changes are just to adapt to the new ownership patterns. I verified that no GraphicsLayers were leaked or abandoned after this change. * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::~WebInspectorClient): (WebKit::WebInspectorClient::showPaintRect): (WebKit::WebInspectorClient::animationEndedForLayer): * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::createGraphicsLayer): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): 2018-09-12 Chris Dumez PSON: No process swap on back navigation after URL bar navigation https://bugs.webkit.org/show_bug.cgi?id=189557 Reviewed by Alex Christensen. Our logic in WebProcessPool::processForNavigationInternal() was wrongly using WebBackForwardList::currentItem() as source item of the navigation, instead of using Navigation::fromItem(). In case of back navigation, by the time processForNavigation() is called, the WebBackForwardList's currentItem has already been updated to be the target item, via a Sync IPC from the WebProcess. As a result, the source and target items would be the same in the following check: ` if (currentItem->itemID().processIdentifier == backForwardListItem->itemID().processIdentifier)` This would cause us to reuse the same process incorrectly. Our existing API test coverage did not catch this because our target HistoryItem usually has a SuspendedPage and we decide to use the SuspendedPage's process a few lines above in WebProcessPool::processForNavigationInternal(). * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigationInternal): 2018-09-12 Alex Christensen Make IPC::SharedBufferDataReference a type that decodes into but does not inherit from IPC::DataReference https://bugs.webkit.org/show_bug.cgi?id=189519 Reviewed by Chris Dumez. * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::bufferingTimerFired): (WebKit::NetworkResourceLoader::sendBuffer): * Platform/IPC/DataReference.cpp: (IPC::SharedBufferDataReference::encode const): Deleted. * Platform/IPC/DataReference.h: (IPC::SharedBufferDataReference::SharedBufferDataReference): Deleted. * Platform/IPC/HandleMessage.h: * Platform/IPC/SharedBufferDataReference.h: Added. (IPC::SharedBufferDataReference::SharedBufferDataReference): (IPC::SharedBufferDataReference::encode const): * Scripts/webkit/messages.py: * Shared/API/APIData.h: * StorageProcess/StorageProcess.messages.in: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebURLSchemeTask.cpp: (WebKit::WebURLSchemeTask::didReceiveData): * WebKit.xcodeproj/project.pbxproj: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::storeDerivedDataToCache): * WebProcess/Network/WebResourceLoader.messages.in: * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData): (WebKit::WebServiceWorkerFetchTaskClient::didReceiveBlobChunk): * WebProcess/WebCoreSupport/WebEditorClient.cpp: (WebKit::WebEditorClient::registerAttachmentIdentifier): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::getContentsAsMHTMLData): (WebKit::WebPage::getSelectionAsWebArchiveData): (WebKit::WebPage::getMainResourceDataOfFrame): (WebKit::WebPage::getResourceDataFromFrame): (WebKit::WebPage::getWebArchiveOfFrame): (WebKit::WebPage::drawPagesToPDF): * WebProcess/WebPage/WebPage.messages.in: 2018-09-11 Dean Jackson Header parsing for experimental and internal debug features https://bugs.webkit.org/show_bug.cgi?id=189486 Reviewed by Tim Horton. Provide key-based (string) access to experimental and internal features. * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetExperimentalFeatureForKey): (WKPreferencesResetAllInternalDebugFeatures): (WKPreferencesSetInternalDebugFeatureForKey): * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/WebPreferences.h: 2018-09-10 Matt Rajca Expose a few WebPlaybackControlsManager-driven PIP APIs to clients https://bugs.webkit.org/show_bug.cgi?id=189478 Reviewed by Eric Carlson. This patch exposes APIs necessary to toggle PIP and query its status from clients of WKWebView. The existing PIP test has been updated to use the new APIs instead of simulating mouse clicks. I also increased the size of the video element in the test page so it gets picked up by the main content heuristics. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _updateMediaPlaybackControlsManager]): Create a media playback controls manager if necessary. (-[WKWebView _isPictureInPictureActive]): Return true if the "active" media element is in PIP. (-[WKWebView _togglePictureInPicture]): Toggle PIP on the "active" media element. (-[WKWebView _canTogglePictureInPicture]): Renamed from... (-[WKWebView _canTogglePictureInPictureForTesting]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::isPictureInPictureActive): Return true if the "active" media element is in PIP. (WebKit::WebViewImpl::togglePictureInPicture): Toggle PIP on the "active" media element. (WebKit::WebViewImpl::updateMediaPlaybackControlsManager): Let clients create a playback controls manager even when there is no Touch Bar present. (WebKit::WebViewImpl::updateMediaTouchBar): Extract some code into a helper method. (WebKit::WebViewImpl::canTogglePictureInPicture): Renamed from... (WebKit::WebViewImpl::canTogglePictureInPictureForTesting): 2018-09-12 Fujii Hironori [Win][Clang] error: non-constant-expression cannot be narrowed from type 'int' to 'SHORT' https://bugs.webkit.org/show_bug.cgi?id=189542 Reviewed by Alex Christensen. * UIProcess/win/WebInspectorProxyWin.cpp: (WebKit::WebInspectorProxy::platformCreateFrontendPage): Narrowed initialWindowWidth and initialWindowHeight by using static_cast. 2018-09-12 Chris Dumez Clean up SuspendedPageProxy https://bugs.webkit.org/show_bug.cgi?id=189517 Reviewed by Alex Christensen. Clean up SuspendedPageProxy: 1. SuspendedPageProxy does not need to be RefCounted. It is even dangerous given that WebPageProxy owns the SuspendedPageProxy and SuspendedPageProxy has a WebPageProxy& data member. We definitely do not want it to outlive its WebPageProxy. 2. The SuspendedPageProxy destructor does not need to be virtual. 3. Have WebBackForwardListItem keep a WeakPtr instead of a SuspendedPageProxy*. This is safer and avoid having to explicitly clear the pointer. 4. m_finishedSuspending data member does not need a getter and is only needed if !LOG_DISABLED. * Shared/WebBackForwardListItem.cpp: (WebKit::WebBackForwardListItem::setSuspendedPage): * Shared/WebBackForwardListItem.h: (WebKit::WebBackForwardListItem::suspendedPage const): * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::SuspendedPageProxy): (WebKit::SuspendedPageProxy::~SuspendedPageProxy): (WebKit::SuspendedPageProxy::webProcessDidClose): (WebKit::SuspendedPageProxy::didFinishLoad): * UIProcess/SuspendedPageProxy.h: (WebKit::SuspendedPageProxy::process const): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::maybeCreateSuspendedPage): (WebKit::WebPageProxy::reattachToWebProcess): * UIProcess/WebPageProxy.h: 2018-09-12 Guillaume Emont Add IGNORE_WARNING_.* macros https://bugs.webkit.org/show_bug.cgi?id=188996 Reviewed by Michael Catanzaro. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::statelessCookieStorage): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformSyncAllCookies): * PluginProcess/mac/PluginProcessMac.mm: (WebKit::beginModal): * PluginProcess/mac/PluginProcessShim.mm: * Shared/Plugins/Netscape/NetscapePluginModule.cpp: (WebKit::NetscapePluginModule::tryLoad): * Shared/ios/ChildProcessIOS.mm: (WebKit::ChildProcess::initializeSandbox): * Shared/mac/ChildProcessMac.mm: (WebKit::compileAndApplySandboxSlowCase): * Shared/mac/ColorSpaceData.mm: (WebKit::ColorSpaceData::decode): * Shared/mac/SandboxExtensionMac.mm: (WebKit::SandboxExtensionImpl::sandboxExtensionForType): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _web_superAccessibilityAttributeValue:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm: * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewRunAsModal): * UIProcess/API/mac/WKView.mm: (-[WKView _web_superAccessibilityAttributeValue:]): * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::decideDestinationWithSuggestedFilename): * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm: (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]): * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/Cocoa/WebViewImpl.mm: (-[WKTextListTouchBarViewController initWithWebViewImpl:]): (WebKit::WebViewImpl::updateWindowAndViewFrames): (WebKit::WebViewImpl::sendDragEndToPage): (WebKit::WebViewImpl::startDrag): (WebKit::WebViewImpl::characterIndexForPoint): * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: (WebKit::PluginProcessProxy::getPluginProcessSerialNumber): (WebKit::PluginProcessProxy::makePluginProcessTheFrontProcess): (WebKit::PluginProcessProxy::makeUIProcessTheFrontProcess): (WebKit::PluginProcessProxy::exitFullscreen): * UIProcess/ios/SmartMagnificationController.mm: * UIProcess/ios/WKGeolocationProviderIOS.mm: * UIProcess/ios/WKLegacyPDFView.mm: * UIProcess/ios/WKPDFPageNumberIndicator.mm: (-[WKPDFPageNumberIndicator _makeRoundedCorners]): * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel _presentPopoverWithContentViewController:animated:]): * UIProcess/ios/forms/WKFormColorControl.mm: (-[WKColorPopover initWithView:]): * UIProcess/ios/forms/WKFormInputControl.mm: (-[WKDateTimePopover initWithView:datePickerMode:]): * UIProcess/ios/forms/WKFormPopover.h: * UIProcess/ios/forms/WKFormPopover.mm: * UIProcess/ios/forms/WKFormSelectPopover.mm: (-[WKSelectPopover initWithView:hasGroups:]): * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::screenToRootView): (WebKit::PageClientImpl::rootViewToScreen): * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController enterFullScreen:]): (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): (-[WKFullScreenWindowController exitFullScreen]): (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]): (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]): (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]): (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]): * UIProcess/mac/WKPrintingView.mm: (-[WKPrintingView _setAutodisplay:]): (-[WKPrintingView _drawPDFDocument:page:atPoint:]): (-[WKPrintingView _drawPreview:]): (-[WKPrintingView drawRect:]): * UIProcess/mac/WKTextInputWindowController.mm: (-[WKTextInputPanel _interpretKeyEvent:usingLegacyCocoaTextInput:string:]): (-[WKTextInputPanel _hasMarkedText]): * UIProcess/mac/WebPopupMenuProxyMac.mm: (WebKit::WebPopupMenuProxyMac::showPopupMenu): * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: (WebKit::initializeEventRecord): (WebKit::NetscapePlugin::sendComplexTextInput): (WebKit::makeCGLPresentLayerOpaque): (WebKit::NetscapePlugin::nullEventTimerFired): * WebProcess/Plugins/PDF/PDFPlugin.mm: (-[WKPDFPluginAccessibilityObject accessibilityFocusedUIElement]): (-[WKPDFLayerControllerDelegate writeItemsToPasteboard:withTypes:]): (WebKit::PDFPlugin::handleEditingCommand): (WebKit::PDFPlugin::setActiveAnnotation): (WebKit:: const): * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.h: * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm: (WebKit::PDFPluginChoiceAnnotation::createAnnotationElement): * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h: * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: (WebKit::PDFPluginTextAnnotation::createAnnotationElement): * WebProcess/WebCoreSupport/WebAlternativeTextClient.h: * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: (WebKit::convertImageToBitmap): (WebKit::WebDragClient::declareAndWriteDragImage): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::drawPDFPage): 2018-09-11 Olivia Barnett Implement the Web Share API for mac https://bugs.webkit.org/show_bug.cgi?id=189443 Reviewed by Tim Horton. * Shared/WebPreferencesDefaultValues.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView shareSheetDidDismiss:]): * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/mac/WKView.mm: (-[WKView shareSheetDidDismiss:]): * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::showShareSheet): (WebKit::WebViewImpl::shareSheetDidDismiss): Implemented function for WKShareSheetDelegate. * UIProcess/Cocoa/WKShareSheet.h: * UIProcess/Cocoa/WKShareSheet.mm: (-[WKShareSheet initWithView:initWithView:]): (-[WKShareSheet presentWithParameters:completionHandler:]): (-[WKShareSheet sharingServicePicker:didChooseSharingService:]): (-[WKShareSheet _cancel]): (-[WKShareSheet dismiss]): (-[WKShareSheet _dismissDisplayAnimated:]): (-[WKShareSheet invokeShareSheetWithResolution:]): (-[WKShareSheet initWithView:]): Deleted. Added mac platform checks and share sheet functionality. * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::showShareSheet): Allows macos to invoke the system share sheet. 2018-09-07 Dean Jackson Add and expose Internal features from WebKit https://bugs.webkit.org/show_bug.cgi?id=189442 Reviewed by Simon Fraser. Experimental features have become a mess. People are using them for anything that they want to be easily toggled from a host app (e.g. Safari), which means the user-facing menu has become large and confusing. Introduce the idea of Internal features, that will be exposed in a way that end-users are not expected to ever see (unless they really want to). * CMakeLists.txt: Add new files. * Sources.txt: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * DerivedSources.make: Add new generated files. * Scripts/GeneratePreferences.rb: Generate the preferences stuff for Internal Debug features. * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb: Added. * Shared/API/APIObject.h: New API object for InternalDebugFeature. * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * Shared/WebPreferences.yaml: Change some of the existing experimental features to "internal". * UIProcess/API/APIInternalDebugFeature.cpp: New API type - just like APIExperimentalFeature. (API::InternalDebugFeature::create): (API::InternalDebugFeature::InternalDebugFeature): (API::InternalDebugFeature::~InternalDebugFeature): * UIProcess/API/APIInternalDebugFeature.h: * UIProcess/API/C/WKAPICast.h: * UIProcess/API/Cocoa/WKPreferences.mm: Change the naming of the experimental feature API so that it won't clash with internal debug features. We can remove the old API once Safari has adopted. (+[WKPreferences _internalDebugFeatures]): (-[WKPreferences _isEnabledForInternalDebugFeature:]): (-[WKPreferences _setEnabled:forInternalDebugFeature:]): (-[WKPreferences _isEnabledForFeature:]): (-[WKPreferences _setEnabled:forFeature:]): (-[WKPreferences _isEnabledForExperimentalFeature:]): (-[WKPreferences _setEnabled:forExperimentalFeature:]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * UIProcess/API/Cocoa/_WKInternalDebugFeature.h: New object - same as _WKExperimentalFeature. * UIProcess/API/Cocoa/_WKInternalDebugFeature.mm: (-[_WKInternalDebugFeature dealloc]): (-[_WKInternalDebugFeature description]): (-[_WKInternalDebugFeature name]): (-[_WKInternalDebugFeature key]): (-[_WKInternalDebugFeature details]): (-[_WKInternalDebugFeature defaultValue]): (-[_WKInternalDebugFeature isHidden]): (-[_WKInternalDebugFeature _apiObject]): * UIProcess/API/Cocoa/_WKInternalDebugFeatureInternal.h: * UIProcess/WebPreferences.cpp: Add support for Internal Debug features. (WebKit::WebPreferences::updateBoolValueForInternalDebugFeatureKey): (WebKit::WebPreferences::updateBoolValueForExperimentalFeatureKey): * UIProcess/WebPreferences.h: * UIProcess/WebProcessPool.cpp: Change a comment now that it is an internal feature. (WebKit::WebProcessPool::createWebPage): 2018-09-11 Eric Carlson WebPage::close should clear UserMediaPermissionRequestManager https://bugs.webkit.org/show_bug.cgi?id=189369 Reviewed by Youenn Fablet. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::close): Clear m_userMediaPermissionRequestManager. 2018-09-11 Wenson Hsieh [macOS] [WK2] Support changing foreground colors via color panel https://bugs.webkit.org/show_bug.cgi?id=189382 Reviewed by Ryosuke Niwa. Adds support for changing font color in a richly editable element in WebKit2 via NSColorPanel. See below for more detail, as well as the WebCore ChangeLog. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView changeColor:]): Implement this selector; AppKit calls into this when changing font color using NSColorPanel. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::changeFontColorFromSender): Creates and populates new FontAttributeChanges, with only the foreground color determined by asking the sender object for its -color. * WebProcess/WebPage/mac/WebPageMac.mm: Use the relevant EditAction for the incoming FontAttributeChanges, instead of always specifying EditAction::ChangeAttributes. (WebKit::WebPage::changeFontAttributes): 2018-09-11 Myles C. Maxfield Crash under PlatformPopupMenuData::encode when interacting with a select menu that has variable fonts https://bugs.webkit.org/show_bug.cgi?id=188008 Reviewed by Alex Christensen. This patch is a follow-up to https://bugs.webkit.org/show_bug.cgi?id=180307. Variable fonts have CFDictionaries with non-string keys. We need to support that in our IPC code. * Shared/cf/ArgumentCodersCF.cpp: (IPC::encode): (IPC::decode): 2018-09-11 Adrian Perez de Castro [WPE][GTK] API documentation is unclear about how to modify requests before sending them https://bugs.webkit.org/show_bug.cgi?id=189505 Reviewed by Michael Catanzaro. Add notes to the API documentation to make explicit where modification of WebKitURIRequest instances affects the request data sent over the network. * UIProcess/API/glib/WebKitNavigationAction.cpp: Clarify that modifications to the associated WebKitURIRequest do not affect the actual request. Point to WebKitPage::send-request instead. * UIProcess/API/glib/WebKitResponsePolicyDecision.cpp: Ditto. * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_class_init): Ditto for the description of the WebKitWebView::decide-policy signal. Also fix the syntax of example. * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: (webkit_web_page_class_init): Indicate that modifications to the WebKitURIRequest will change the actual network request data. 2018-09-11 Michael Catanzaro Unreviewed, attempt to fix Apple builds after r235903 https://bugs.webkit.org/show_bug.cgi?id=188872 If it really needs to be inlined, it will need to move to the header.... * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::pageClient const): 2018-09-11 Michael Catanzaro Unreviewed, fix build after r235903 https://bugs.webkit.org/show_bug.cgi?id=188872 This broke all ports except GTK. Need to add a missing header. * UIProcess/PageClient.h: 2018-09-11 Pablo Saavedra Add missing #if ENABLE(VIDEO) WebProcess/FullScreen/WebFullScreenManager.cpp https://bugs.webkit.org/show_bug.cgi?id=189506 Reviewed by Tim Horton. m_pipStandbyElement is only defined in WebKit/WebProcess/FullScreen/WebFullScreenManager.h only when ENABLE(VIDEO) (see https://bugs.webkit.org/show_bug.cgi?id=181338) * WebProcess/FullScreen/WebFullScreenManager.cpp: (WebKit::WebFullScreenManager::setPIPStandbyElement): 2018-09-11 Michael Catanzaro WebPageProxy should hold a WeakPtr to its PageClient https://bugs.webkit.org/show_bug.cgi?id=188872 Reviewed by Ryosuke Niwa. This ensures the PageClient reference is always valid when used. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::startDrag): (WebKit::WebPageProxy::setDragCaretRect): * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::PageClientProtector::PageClientProtector): (WebKit::PageClientProtector::~PageClientProtector): (WebKit::WebPageProxy::WebPageProxy): (WebKit::m_resetRecentCrashCountTimer): (WebKit::WebPageProxy::pageClient const): (WebKit::WebPageProxy::reattachToWebProcess): (WebKit::WebPageProxy::initializeWebPage): (WebKit::WebPageProxy::close): (WebKit::WebPageProxy::didChangeBackForwardList): (WebKit::WebPageProxy::willGoToBackForwardListItem): (WebKit::WebPageProxy::shouldKeepCurrentBackForwardListItemInList): (WebKit::WebPageProxy::setViewNeedsDisplay): (WebKit::WebPageProxy::requestScroll): (WebKit::WebPageProxy::viewScrollPosition const): (WebKit::WebPageProxy::updateActivityState): (WebKit::WebPageProxy::activityStateDidChange): (WebKit::WebPageProxy::viewDidEnterWindow): (WebKit::WebPageProxy::dispatchActivityStateChange): (WebKit::WebPageProxy::layerHostingModeDidChange): (WebKit::WebPageProxy::viewSize const): (WebKit::WebPageProxy::startDrag): (WebKit::WebPageProxy::didPerformDragOperation): (WebKit::WebPageProxy::processNextQueuedMouseEvent): (WebKit::WebPageProxy::findPlugin): (WebKit::WebPageProxy::handleTouchEventSynchronously): (WebKit::WebPageProxy::handleTouchEvent): (WebKit::WebPageProxy::preferencesDidChange): (WebKit::WebPageProxy::didCreateMainFrame): (WebKit::WebPageProxy::didCreateSubframe): (WebKit::WebPageProxy::didStartProgress): (WebKit::WebPageProxy::didChangeProgress): (WebKit::WebPageProxy::didFinishProgress): (WebKit::WebPageProxy::didDestroyNavigation): (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): (WebKit::WebPageProxy::willPerformClientRedirectForFrame): (WebKit::WebPageProxy::didCancelClientRedirectForFrame): (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::didReceiveTitleForFrame): (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame): (WebKit::WebPageProxy::didReachLayoutMilestone): (WebKit::WebPageProxy::didDisplayInsecureContentForFrame): (WebKit::WebPageProxy::didRunInsecureContentForFrame): (WebKit::WebPageProxy::frameDidBecomeFrameSet): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponse): (WebKit::WebPageProxy::unableToImplementPolicy): (WebKit::WebPageProxy::didNavigateWithNavigationData): (WebKit::WebPageProxy::didPerformClientRedirect): (WebKit::WebPageProxy::didPerformServerRedirect): (WebKit::WebPageProxy::didUpdateHistoryTitle): (WebKit::WebPageProxy::closePage): (WebKit::WebPageProxy::setWindowFrame): (WebKit::WebPageProxy::getWindowFrame): (WebKit::WebPageProxy::getWindowFrameWithCallback): (WebKit::WebPageProxy::screenToRootView): (WebKit::WebPageProxy::rootViewToScreen): (WebKit::WebPageProxy::syncRootViewToScreen): (WebKit::WebPageProxy::accessibilityScreenToRootView): (WebKit::WebPageProxy::rootViewToAccessibilityScreen): (WebKit::WebPageProxy::didChangeViewportProperties): (WebKit::WebPageProxy::runOpenPanel): (WebKit::WebPageProxy::showShareSheet): (WebKit::WebPageProxy::handleDownloadRequest): (WebKit::WebPageProxy::didChangeContentSize): (WebKit::WebPageProxy::showColorPicker): (WebKit::WebPageProxy::showDataListSuggestions): (WebKit::WebPageProxy::compositionWasCanceled): (WebKit::WebPageProxy::registerInsertionUndoGrouping): (WebKit::WebPageProxy::canUndoRedo): (WebKit::WebPageProxy::executeUndoRedo): (WebKit::WebPageProxy::clearAllEditCommands): (WebKit::WebPageProxy::setTextIndicator): (WebKit::WebPageProxy::clearTextIndicator): (WebKit::WebPageProxy::setTextIndicatorAnimationProgress): (WebKit::WebPageProxy::showPopupMenu): (WebKit::WebPageProxy::showContextMenu): (WebKit::WebPageProxy::registerEditCommand): (WebKit::WebPageProxy::canUndo): (WebKit::WebPageProxy::canRedo): (WebKit::WebPageProxy::setToolTip): (WebKit::WebPageProxy::setCursor): (WebKit::WebPageProxy::setCursorHiddenUntilMouseMoves): (WebKit::WebPageProxy::didReceiveEvent): (WebKit::WebPageProxy::resetState): (WebKit::WebPageProxy::resetStateAfterProcessExited): (WebKit::WebPageProxy::creationParameters): (WebKit::WebPageProxy::enterAcceleratedCompositingMode): (WebKit::WebPageProxy::exitAcceleratedCompositingMode): (WebKit::WebPageProxy::updateAcceleratedCompositingMode): (WebKit::WebPageProxy::requestGeolocationPermissionForFrame): (WebKit::WebPageProxy::recommendedScrollbarStyleDidChange): (WebKit::WebPageProxy::didChangeScrollOffsetPinningForMainFrame): (WebKit::WebPageProxy::didFinishLoadingDataForCustomContentProvider): (WebKit::WebPageProxy::updateBackingStoreDiscardableState): (WebKit::WebPageProxy::showCorrectionPanel): (WebKit::WebPageProxy::dismissCorrectionPanel): (WebKit::WebPageProxy::dismissCorrectionPanelSoon): (WebKit::WebPageProxy::recordAutocorrectionResponse): (WebKit::WebPageProxy::useDarkAppearance const): (WebKit::WebPageProxy::showDictationAlternativeUI): (WebKit::WebPageProxy::removeDictationAlternatives): (WebKit::WebPageProxy::dictationAlternatives): (WebKit::WebPageProxy::setEditableElementIsFocused): (WebKit::WebPageProxy::takeViewSnapshot): (WebKit::WebPageProxy::wrapCryptoKey): (WebKit::WebPageProxy::unwrapCryptoKey): (WebKit::WebPageProxy::signedPublicKeyAndChallengeString): (WebKit::WebPageProxy::navigationGestureDidBegin): (WebKit::WebPageProxy::navigationGestureWillEnd): (WebKit::WebPageProxy::navigationGestureDidEnd): (WebKit::WebPageProxy::willRecordNavigationSnapshot): (WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved): (WebKit::WebPageProxy::isPlayingMediaDidChange): (WebKit::WebPageProxy::videoControlsManagerDidChange): (WebKit::WebPageProxy::handleControlledElementIDResponse const): (WebKit::WebPageProxy::didPerformImmediateActionHitTest): (WebKit::WebPageProxy::immediateActionAnimationControllerForHitTestResult): (WebKit::WebPageProxy::didHandleAcceptedCandidate): (WebKit::WebPageProxy::addPlaybackTargetPickerClient): (WebKit::WebPageProxy::removePlaybackTargetPickerClient): (WebKit::WebPageProxy::showPlaybackTargetPicker): (WebKit::WebPageProxy::playbackTargetPickerClientStateDidChange): (WebKit::WebPageProxy::setMockMediaPlaybackTargetPickerEnabled): (WebKit::WebPageProxy::setMockMediaPlaybackTargetPickerState): (WebKit::WebPageProxy::didChangeBackgroundColor): (WebKit::WebPageProxy::didRestoreScrollPosition): (WebKit::WebPageProxy::userInterfaceLayoutDirection): (WebKit::WebPageProxy::didInsertAttachment): (WebKit::WebPageProxy::didRemoveAttachment): * UIProcess/WebPageProxy.h: * UIProcess/gstreamer/WebPageProxyGStreamer.cpp: (WebKit::WebPageProxy::requestInstallMissingMediaPlugins): * UIProcess/gtk/WebPageProxyGtk.cpp: (WebKit::WebPageProxy::viewWidget): (WebKit::WebPageProxy::editorStateChanged): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::computeCustomFixedPositionRect const): (WebKit::WebPageProxy::overflowScrollViewWillStartPanGesture): (WebKit::WebPageProxy::overflowScrollViewDidScroll): (WebKit::WebPageProxy::overflowScrollWillStartScroll): (WebKit::WebPageProxy::overflowScrollDidEndScroll): (WebKit::WebPageProxy::didCommitLayerTree): (WebKit::WebPageProxy::layerTreeCommitComplete): (WebKit::WebPageProxy::didReceivePositionInformation): (WebKit::WebPageProxy::saveImageToLibrary): (WebKit::WebPageProxy::interpretKeyEvent): (WebKit::WebPageProxy::registerWebProcessAccessibilityToken): (WebKit::WebPageProxy::couldNotRestorePageState): (WebKit::WebPageProxy::restorePageState): (WebKit::WebPageProxy::restorePageCenterAndScale): (WebKit::WebPageProxy::didGetTapHighlightGeometries): (WebKit::WebPageProxy::startAssistingNode): (WebKit::WebPageProxy::stopAssistingNode): (WebKit::WebPageProxy::showInspectorHighlight): (WebKit::WebPageProxy::hideInspectorHighlight): (WebKit::WebPageProxy::showInspectorIndication): (WebKit::WebPageProxy::hideInspectorIndication): (WebKit::WebPageProxy::enableInspectorNodeSearch): (WebKit::WebPageProxy::disableInspectorNodeSearch): (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer): (WebKit::WebPageProxy::showPlaybackTargetPicker): (WebKit::WebPageProxy::commitPotentialTapFailed): (WebKit::WebPageProxy::didNotHandleTapAsClick): (WebKit::WebPageProxy::didCompleteSyntheticClick): (WebKit::WebPageProxy::disableDoubleTapGesturesDuringTapIfNecessary): (WebKit::WebPageProxy::editorStateChanged): (WebKit::WebPageProxy::showValidationMessage): (WebKit::WebPageProxy::didHandleStartDataInteractionRequest): (WebKit::WebPageProxy::didHandleAdditionalDragItemsRequest): (WebKit::WebPageProxy::didConcludeEditDataInteraction): (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::windowAndViewFramesChanged): (WebKit::WebPageProxy::insertDictatedTextAsync): (WebKit::WebPageProxy::setPromisedDataForImage): (WebKit::WebPageProxy::didPerformDictionaryLookup): (WebKit::WebPageProxy::registerWebProcessAccessibilityToken): (WebKit::WebPageProxy::makeFirstResponder): (WebKit::WebPageProxy::assistiveTechnologyMakeFirstResponder): (WebKit::WebPageProxy::colorSpace): (WebKit::WebPageProxy::pluginFocusOrWindowFocusChanged): (WebKit::WebPageProxy::setPluginComplexTextInputState): (WebKit::WebPageProxy::executeSavedCommandBySelector): (WebKit::WebPageProxy::intrinsicContentSizeDidChange): (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer): (WebKit::WebPageProxy::acceleratedCompositingRootLayer const): (WebKit::WebPageProxy::showPDFContextMenu): (WebKit::WebPageProxy::showTelephoneNumberMenu): (WebKit::WebPageProxy::boundsOfLayerInLayerBackedWindowCoordinates const): (WebKit::WebPageProxy::editorStateChanged): (WebKit::WebPageProxy::startWindowDrag): (WebKit::WebPageProxy::platformWindow): (WebKit::WebPageProxy::rootViewToWindow): (WebKit::WebPageProxy::showValidationMessage): (WebKit::WebPageProxy::inspectorAttachmentView): (WebKit::WebPageProxy::remoteObjectRegistry): * UIProcess/win/WebPageProxyWin.cpp: (WebKit::WebPageProxy::viewWidget): * UIProcess/wpe/WebPageProxyWPE.cpp: (WebKit::WebPageProxy::viewBackend): 2018-09-11 Chris Dumez Regression(PSON): "Swipe back" snapshot is missing when navigating back cross-process https://bugs.webkit.org/show_bug.cgi?id=189482 Reviewed by Geoffrey Garen. The issue was that when we swap process on navigation, we: 1. Call processDidTerminate() which calls resetState() and clears the displayed content 2. Reattach the WebPageProxy to a new WebProcess 3. Trigger the navigation 4. Take the navigation snapshot When the navigation snapshot occurs at step 4, the view is already blank in the case of process swap. To avoid the issue, we take the navigation snapshot earlier, before calling processDidTerminate() and we suppress the next navigation snapshot as it would be blank. At some point, we will likely want to display the previous' WebProcess content longer, until the new WebProcess has something interesting to display. Once this is implemented, we'll likely be able to drop the early snapshotting logic. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::recordAutomaticNavigationSnapshot): (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::restoreFromSessionState): (WebKit::WebPageProxy::didCommitLoadForFrame): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::suppressNextAutomaticNavigationSnapshot): 2018-09-11 Woodrow Wang Add Web API Statistics Collection https://bugs.webkit.org/show_bug.cgi?id=187773 Reviewed by Brent Fulgham. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * UIProcess/ResourceLoadStatisticsMemoryStore.cpp: == Rolled over to ChangeLog-2018-09-11 ==