haikuwebkit/Source/WebCore/loader/ShouldTreatAsContinuingLoad.h

47 lines
1.8 KiB
C
Raw Permalink Normal View History

Go to back/forward list items after a process-swapped navigation. <rdar://problem/38690544> and https://bugs.webkit.org/show_bug.cgi?id=183920 Reviewed by Andy Estes. Source/WebCore: Covered by new API test. Most of the changes to WebCore are teaching HistoryItem navigations to know when they should do a policy check or not. * WebCore.xcodeproj/project.pbxproj: * history/BackForwardController.cpp: (WebCore::BackForwardController::goBackOrForward): (WebCore::BackForwardController::goBack): (WebCore::BackForwardController::goForward): * history/HistoryItem.cpp: (WebCore::HistoryItem::setStateObject): Actually push state object changes to the UIProcess. This was a long standing bug that made it difficult to effectively test this change. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURLIntoChildFrame): (WebCore::FrameLoader::loadDifferentDocumentItem): (WebCore::FrameLoader::loadItem): (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad): * loader/FrameLoader.h: * loader/FrameLoaderTypes.h: * loader/HistoryController.cpp: (WebCore::HistoryController::goToItem): (WebCore::HistoryController::setDefersLoading): (WebCore::HistoryController::recursiveGoToItem): * loader/HistoryController.h: * loader/NavigationPolicyCheck.h: * page/Page.cpp: (WebCore::Page::goToItem): * page/Page.h: Source/WebKit: This takes the initial work of "process swap a normal navigation" and extends it to process swapping for back/forward item navigations. * Scripts/webkit/messages.py: Make sure state objects are serialized to the UI Process back/forward list items, as otherwise they will be lost in process-swap scenarios: * Shared/SessionState.cpp: (WebKit::PageState::encode const): (WebKit::PageState::decode): * Shared/SessionState.h: Make a new variant of APINavigation specifically for back/forward list items. * UIProcess/API/APINavigation.cpp: (API::Navigation::Navigation): (API::Navigation::loggingURL const): * UIProcess/API/APINavigation.h: (API::Navigation::create): (API::Navigation::backForwardListItem): (API::Navigation::backForwardFrameLoadType const): * UIProcess/API/C/WKPage.cpp: (WKPageGoToBackForwardListItem): * UIProcess/API/Cocoa/WKBrowsingContextController.mm: (-[WKBrowsingContextController goToBackForwardListItem:]): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView goToBackForwardListItem:]): * UIProcess/WebNavigationState.cpp: (WebKit::WebNavigationState::createLoadRequestNavigation): (WebKit::WebNavigationState::createBackForwardNavigation): * UIProcess/WebNavigationState.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::reattachToWebProcessForReload): (WebKit::WebPageProxy::reattachToWebProcessWithItem): (WebKit::WebPageProxy::goForward): (WebKit::WebPageProxy::goBack): (WebKit::WebPageProxy::goToBackForwardItem): (WebKit::WebPageProxy::receivedPolicyDecision): (WebKit::WebPageProxy::continueNavigationInNewProcess): Handle back/forward navigations differently than others. (WebKit::WebPageProxy::restoreFromSessionState): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::addOrUpdateBackForwardItem): Renamed from "addBackForwardItem" for clarity (WebKit::WebProcessProxy::addBackForwardItem): Deleted. * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::endSwipeGesture): * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::endSwipeGesture): * WebProcess/WebCoreSupport/SessionStateConversion.cpp: (WebKit::toPageState): (WebKit::toHistoryItem): * WebProcess/WebPage/WebBackForwardListProxy.cpp: (WebKit::updateBackForwardItem): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::goToBackForwardItem): Combined "goBack" and "goForward" with this method, passing the appropriate FrameLoadType around as needed to remember the specific type. (WebKit::WebPage::goForward): Deleted. (WebKit::WebPage::goBack): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Source/WebKitLegacy/mac: * WebView/WebView.mm: (-[WebView _loadBackForwardListFromOtherView:]): (-[WebView goToBackForwardItem:]): Source/WebKitLegacy/win: * WebView.cpp: (WebView::goToBackForwardItem): (WebView::loadBackForwardListFromOtherView): Tools: Add a new API test that does some process-swapping navigations (including a back navigation) and verifies the state of the engine afterwards. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: (-[PSONMessageHandler userContentController:didReceiveScriptMessage:]): (-[PSONScheme initWithBytes:]): (-[PSONScheme webView:startURLSchemeTask:]): (log): (function): (TEST): Deleted. Canonical link: https://commits.webkit.org/199558@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229926 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-03-23 22:15:23 +00:00
/*
* Copyright (C) 2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
2018-10-15 14:30:57 +00:00
#include <wtf/Forward.h>
Go to back/forward list items after a process-swapped navigation. <rdar://problem/38690544> and https://bugs.webkit.org/show_bug.cgi?id=183920 Reviewed by Andy Estes. Source/WebCore: Covered by new API test. Most of the changes to WebCore are teaching HistoryItem navigations to know when they should do a policy check or not. * WebCore.xcodeproj/project.pbxproj: * history/BackForwardController.cpp: (WebCore::BackForwardController::goBackOrForward): (WebCore::BackForwardController::goBack): (WebCore::BackForwardController::goForward): * history/HistoryItem.cpp: (WebCore::HistoryItem::setStateObject): Actually push state object changes to the UIProcess. This was a long standing bug that made it difficult to effectively test this change. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURLIntoChildFrame): (WebCore::FrameLoader::loadDifferentDocumentItem): (WebCore::FrameLoader::loadItem): (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad): * loader/FrameLoader.h: * loader/FrameLoaderTypes.h: * loader/HistoryController.cpp: (WebCore::HistoryController::goToItem): (WebCore::HistoryController::setDefersLoading): (WebCore::HistoryController::recursiveGoToItem): * loader/HistoryController.h: * loader/NavigationPolicyCheck.h: * page/Page.cpp: (WebCore::Page::goToItem): * page/Page.h: Source/WebKit: This takes the initial work of "process swap a normal navigation" and extends it to process swapping for back/forward item navigations. * Scripts/webkit/messages.py: Make sure state objects are serialized to the UI Process back/forward list items, as otherwise they will be lost in process-swap scenarios: * Shared/SessionState.cpp: (WebKit::PageState::encode const): (WebKit::PageState::decode): * Shared/SessionState.h: Make a new variant of APINavigation specifically for back/forward list items. * UIProcess/API/APINavigation.cpp: (API::Navigation::Navigation): (API::Navigation::loggingURL const): * UIProcess/API/APINavigation.h: (API::Navigation::create): (API::Navigation::backForwardListItem): (API::Navigation::backForwardFrameLoadType const): * UIProcess/API/C/WKPage.cpp: (WKPageGoToBackForwardListItem): * UIProcess/API/Cocoa/WKBrowsingContextController.mm: (-[WKBrowsingContextController goToBackForwardListItem:]): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView goToBackForwardListItem:]): * UIProcess/WebNavigationState.cpp: (WebKit::WebNavigationState::createLoadRequestNavigation): (WebKit::WebNavigationState::createBackForwardNavigation): * UIProcess/WebNavigationState.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::reattachToWebProcessForReload): (WebKit::WebPageProxy::reattachToWebProcessWithItem): (WebKit::WebPageProxy::goForward): (WebKit::WebPageProxy::goBack): (WebKit::WebPageProxy::goToBackForwardItem): (WebKit::WebPageProxy::receivedPolicyDecision): (WebKit::WebPageProxy::continueNavigationInNewProcess): Handle back/forward navigations differently than others. (WebKit::WebPageProxy::restoreFromSessionState): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::addOrUpdateBackForwardItem): Renamed from "addBackForwardItem" for clarity (WebKit::WebProcessProxy::addBackForwardItem): Deleted. * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::endSwipeGesture): * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::endSwipeGesture): * WebProcess/WebCoreSupport/SessionStateConversion.cpp: (WebKit::toPageState): (WebKit::toHistoryItem): * WebProcess/WebPage/WebBackForwardListProxy.cpp: (WebKit::updateBackForwardItem): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::goToBackForwardItem): Combined "goBack" and "goForward" with this method, passing the appropriate FrameLoadType around as needed to remember the specific type. (WebKit::WebPage::goForward): Deleted. (WebKit::WebPage::goBack): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Source/WebKitLegacy/mac: * WebView/WebView.mm: (-[WebView _loadBackForwardListFromOtherView:]): (-[WebView goToBackForwardItem:]): Source/WebKitLegacy/win: * WebView.cpp: (WebView::goToBackForwardItem): (WebView::loadBackForwardListFromOtherView): Tools: Add a new API test that does some process-swapping navigations (including a back navigation) and verifies the state of the engine afterwards. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: (-[PSONMessageHandler userContentController:didReceiveScriptMessage:]): (-[PSONScheme initWithBytes:]): (-[PSONScheme webView:startURLSchemeTask:]): (log): (function): (TEST): Deleted. Canonical link: https://commits.webkit.org/199558@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229926 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-03-23 22:15:23 +00:00
namespace WebCore {
Shrink more enum classes https://bugs.webkit.org/show_bug.cgi?id=190540 Reviewed by Chris Dumez. Source/JavaScriptCore: * runtime/ConsoleTypes.h: Source/WebCore: * Modules/notifications/NotificationDirection.h: * dom/Document.h: * loader/FrameLoader.h: * loader/FrameLoaderClient.h: * loader/HistoryController.h: * loader/ShouldSkipSafeBrowsingCheck.h: * loader/ShouldTreatAsContinuingLoad.h: * page/AutoplayEvent.h: * page/ChromeClient.h: * page/DiagnosticLoggingClient.h: * page/Page.h: * platform/CookiesStrategy.h: * platform/audio/AudioSession.h: * platform/network/NetworkStorageSession.h: * platform/network/StoredCredentialsPolicy.h: * workers/service/SWClientConnection.h: * workers/service/ServiceWorkerContainer.h: * workers/service/ServiceWorkerRegistrationData.h: * workers/service/ServiceWorkerRegistrationOptions.h: * workers/service/ServiceWorkerTypes.h: * workers/service/ServiceWorkerUpdateViaCache.h: * workers/service/server/SWServer.h: * workers/service/server/SWServerRegistration.h: Source/WebKit: * 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: Canonical link: https://commits.webkit.org/205484@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237110 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-15 15:23:59 +00:00
enum class ShouldTreatAsContinuingLoad : bool { No, Yes };
Go to back/forward list items after a process-swapped navigation. <rdar://problem/38690544> and https://bugs.webkit.org/show_bug.cgi?id=183920 Reviewed by Andy Estes. Source/WebCore: Covered by new API test. Most of the changes to WebCore are teaching HistoryItem navigations to know when they should do a policy check or not. * WebCore.xcodeproj/project.pbxproj: * history/BackForwardController.cpp: (WebCore::BackForwardController::goBackOrForward): (WebCore::BackForwardController::goBack): (WebCore::BackForwardController::goForward): * history/HistoryItem.cpp: (WebCore::HistoryItem::setStateObject): Actually push state object changes to the UIProcess. This was a long standing bug that made it difficult to effectively test this change. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURLIntoChildFrame): (WebCore::FrameLoader::loadDifferentDocumentItem): (WebCore::FrameLoader::loadItem): (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad): * loader/FrameLoader.h: * loader/FrameLoaderTypes.h: * loader/HistoryController.cpp: (WebCore::HistoryController::goToItem): (WebCore::HistoryController::setDefersLoading): (WebCore::HistoryController::recursiveGoToItem): * loader/HistoryController.h: * loader/NavigationPolicyCheck.h: * page/Page.cpp: (WebCore::Page::goToItem): * page/Page.h: Source/WebKit: This takes the initial work of "process swap a normal navigation" and extends it to process swapping for back/forward item navigations. * Scripts/webkit/messages.py: Make sure state objects are serialized to the UI Process back/forward list items, as otherwise they will be lost in process-swap scenarios: * Shared/SessionState.cpp: (WebKit::PageState::encode const): (WebKit::PageState::decode): * Shared/SessionState.h: Make a new variant of APINavigation specifically for back/forward list items. * UIProcess/API/APINavigation.cpp: (API::Navigation::Navigation): (API::Navigation::loggingURL const): * UIProcess/API/APINavigation.h: (API::Navigation::create): (API::Navigation::backForwardListItem): (API::Navigation::backForwardFrameLoadType const): * UIProcess/API/C/WKPage.cpp: (WKPageGoToBackForwardListItem): * UIProcess/API/Cocoa/WKBrowsingContextController.mm: (-[WKBrowsingContextController goToBackForwardListItem:]): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView goToBackForwardListItem:]): * UIProcess/WebNavigationState.cpp: (WebKit::WebNavigationState::createLoadRequestNavigation): (WebKit::WebNavigationState::createBackForwardNavigation): * UIProcess/WebNavigationState.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::reattachToWebProcessForReload): (WebKit::WebPageProxy::reattachToWebProcessWithItem): (WebKit::WebPageProxy::goForward): (WebKit::WebPageProxy::goBack): (WebKit::WebPageProxy::goToBackForwardItem): (WebKit::WebPageProxy::receivedPolicyDecision): (WebKit::WebPageProxy::continueNavigationInNewProcess): Handle back/forward navigations differently than others. (WebKit::WebPageProxy::restoreFromSessionState): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::addOrUpdateBackForwardItem): Renamed from "addBackForwardItem" for clarity (WebKit::WebProcessProxy::addBackForwardItem): Deleted. * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::endSwipeGesture): * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::endSwipeGesture): * WebProcess/WebCoreSupport/SessionStateConversion.cpp: (WebKit::toPageState): (WebKit::toHistoryItem): * WebProcess/WebPage/WebBackForwardListProxy.cpp: (WebKit::updateBackForwardItem): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::goToBackForwardItem): Combined "goBack" and "goForward" with this method, passing the appropriate FrameLoadType around as needed to remember the specific type. (WebKit::WebPage::goForward): Deleted. (WebKit::WebPage::goBack): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Source/WebKitLegacy/mac: * WebView/WebView.mm: (-[WebView _loadBackForwardListFromOtherView:]): (-[WebView goToBackForwardItem:]): Source/WebKitLegacy/win: * WebView.cpp: (WebView::goToBackForwardItem): (WebView::loadBackForwardListFromOtherView): Tools: Add a new API test that does some process-swapping navigations (including a back navigation) and verifies the state of the engine afterwards. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: (-[PSONMessageHandler userContentController:didReceiveScriptMessage:]): (-[PSONScheme initWithBytes:]): (-[PSONScheme webView:startURLSchemeTask:]): (log): (function): (TEST): Deleted. Canonical link: https://commits.webkit.org/199558@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229926 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-03-23 22:15:23 +00:00
} // namespace WebCore
namespace WTF {
http/tests/security/cors-post-redirect-307.html fails with PSON enabled https://bugs.webkit.org/show_bug.cgi?id=186441 Reviewed by Brady Eidson. Source/WebCore: When we are continuing a load in a new process, we currently bypass the navigation policy check. We now also bypass the adding of headers such as the Origin one since the request was already processed in the previous process. This is important because in the case of a cross-origin redirect, the previous process has removed the Origin header from the request and we do not want the new process to add it again. Test: http/tests/security/cors-post-redirect-307-pson.html * WebCore.xcodeproj/project.pbxproj: * history/BackForwardController.cpp: (WebCore::BackForwardController::goBackOrForward): (WebCore::BackForwardController::goBack): (WebCore::BackForwardController::goForward): * loader/FrameLoadRequest.h: (WebCore::FrameLoadRequest::setShouldTreatAsContinuingLoad): (WebCore::FrameLoadRequest::shouldTreatAsContinuingLoad const): (WebCore::FrameLoadRequest::setShouldCheckNavigationPolicy): Deleted. (WebCore::FrameLoadRequest::shouldCheckNavigationPolicy const): Deleted. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURLIntoChildFrame): (WebCore::FrameLoader::load): (WebCore::FrameLoader::loadWithNavigationAction): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::reloadWithOverrideEncoding): (WebCore::FrameLoader::reload): (WebCore::FrameLoader::addExtraFieldsToRequest): (WebCore::FrameLoader::addHTTPOriginIfNeeded): (WebCore::FrameLoader::loadDifferentDocumentItem): (WebCore::FrameLoader::loadItem): (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad): * loader/FrameLoader.h: * loader/HistoryController.cpp: (WebCore::HistoryController::goToItem): (WebCore::HistoryController::setDefersLoading): (WebCore::HistoryController::recursiveGoToItem): * loader/HistoryController.h: * loader/ShouldTreatAsContinuingLoad.h: Renamed from Source/WebCore/loader/NavigationPolicyCheck.h. * page/Page.cpp: (WebCore::Page::goToItem): * page/Page.h: Source/WebKit: Rename existing flag to something a bit more generic, now that it is used for more things than bypassing the navigation policy check. * Shared/LoadParameters.cpp: (WebKit::LoadParameters::encode const): (WebKit::LoadParameters::decode): * Shared/LoadParameters.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::reattachToWebProcessForReload): (WebKit::WebPageProxy::reattachToWebProcessWithItem): (WebKit::WebPageProxy::loadRequest): (WebKit::WebPageProxy::loadRequestWithNavigation): (WebKit::WebPageProxy::goToBackForwardItem): (WebKit::WebPageProxy::continueNavigationInNewProcess): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadRequest): (WebKit::WebPage::goToBackForwardItem): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Source/WebKitLegacy/mac: Rename existing flag to something a bit more generic, now that it is used for more things than bypassing the navigation policy check. * WebView/WebView.mm: (-[WebView _loadBackForwardListFromOtherView:]): (-[WebView goToBackForwardItem:]): Source/WebKitLegacy/win: Rename existing flag to something a bit more generic, now that it is used for more things than bypassing the navigation policy check. * WebView.cpp: (WebView::goToBackForwardItem): (WebView::loadBackForwardListFromOtherView): LayoutTests: Add layout test coverage. * http/tests/security/cors-post-redirect-307-pson-expected.txt: Added. * http/tests/security/cors-post-redirect-307-pson.html: Added. Canonical link: https://commits.webkit.org/201862@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-11 20:52:31 +00:00
template<> struct EnumTraits<WebCore::ShouldTreatAsContinuingLoad> {
Go to back/forward list items after a process-swapped navigation. <rdar://problem/38690544> and https://bugs.webkit.org/show_bug.cgi?id=183920 Reviewed by Andy Estes. Source/WebCore: Covered by new API test. Most of the changes to WebCore are teaching HistoryItem navigations to know when they should do a policy check or not. * WebCore.xcodeproj/project.pbxproj: * history/BackForwardController.cpp: (WebCore::BackForwardController::goBackOrForward): (WebCore::BackForwardController::goBack): (WebCore::BackForwardController::goForward): * history/HistoryItem.cpp: (WebCore::HistoryItem::setStateObject): Actually push state object changes to the UIProcess. This was a long standing bug that made it difficult to effectively test this change. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURLIntoChildFrame): (WebCore::FrameLoader::loadDifferentDocumentItem): (WebCore::FrameLoader::loadItem): (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad): * loader/FrameLoader.h: * loader/FrameLoaderTypes.h: * loader/HistoryController.cpp: (WebCore::HistoryController::goToItem): (WebCore::HistoryController::setDefersLoading): (WebCore::HistoryController::recursiveGoToItem): * loader/HistoryController.h: * loader/NavigationPolicyCheck.h: * page/Page.cpp: (WebCore::Page::goToItem): * page/Page.h: Source/WebKit: This takes the initial work of "process swap a normal navigation" and extends it to process swapping for back/forward item navigations. * Scripts/webkit/messages.py: Make sure state objects are serialized to the UI Process back/forward list items, as otherwise they will be lost in process-swap scenarios: * Shared/SessionState.cpp: (WebKit::PageState::encode const): (WebKit::PageState::decode): * Shared/SessionState.h: Make a new variant of APINavigation specifically for back/forward list items. * UIProcess/API/APINavigation.cpp: (API::Navigation::Navigation): (API::Navigation::loggingURL const): * UIProcess/API/APINavigation.h: (API::Navigation::create): (API::Navigation::backForwardListItem): (API::Navigation::backForwardFrameLoadType const): * UIProcess/API/C/WKPage.cpp: (WKPageGoToBackForwardListItem): * UIProcess/API/Cocoa/WKBrowsingContextController.mm: (-[WKBrowsingContextController goToBackForwardListItem:]): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView goToBackForwardListItem:]): * UIProcess/WebNavigationState.cpp: (WebKit::WebNavigationState::createLoadRequestNavigation): (WebKit::WebNavigationState::createBackForwardNavigation): * UIProcess/WebNavigationState.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::reattachToWebProcessForReload): (WebKit::WebPageProxy::reattachToWebProcessWithItem): (WebKit::WebPageProxy::goForward): (WebKit::WebPageProxy::goBack): (WebKit::WebPageProxy::goToBackForwardItem): (WebKit::WebPageProxy::receivedPolicyDecision): (WebKit::WebPageProxy::continueNavigationInNewProcess): Handle back/forward navigations differently than others. (WebKit::WebPageProxy::restoreFromSessionState): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::addOrUpdateBackForwardItem): Renamed from "addBackForwardItem" for clarity (WebKit::WebProcessProxy::addBackForwardItem): Deleted. * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::endSwipeGesture): * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::endSwipeGesture): * WebProcess/WebCoreSupport/SessionStateConversion.cpp: (WebKit::toPageState): (WebKit::toHistoryItem): * WebProcess/WebPage/WebBackForwardListProxy.cpp: (WebKit::updateBackForwardItem): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::goToBackForwardItem): Combined "goBack" and "goForward" with this method, passing the appropriate FrameLoadType around as needed to remember the specific type. (WebKit::WebPage::goForward): Deleted. (WebKit::WebPage::goBack): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Source/WebKitLegacy/mac: * WebView/WebView.mm: (-[WebView _loadBackForwardListFromOtherView:]): (-[WebView goToBackForwardItem:]): Source/WebKitLegacy/win: * WebView.cpp: (WebView::goToBackForwardItem): (WebView::loadBackForwardListFromOtherView): Tools: Add a new API test that does some process-swapping navigations (including a back navigation) and verifies the state of the engine afterwards. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: (-[PSONMessageHandler userContentController:didReceiveScriptMessage:]): (-[PSONScheme initWithBytes:]): (-[PSONScheme webView:startURLSchemeTask:]): (log): (function): (TEST): Deleted. Canonical link: https://commits.webkit.org/199558@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229926 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-03-23 22:15:23 +00:00
using values = EnumValues<
http/tests/security/cors-post-redirect-307.html fails with PSON enabled https://bugs.webkit.org/show_bug.cgi?id=186441 Reviewed by Brady Eidson. Source/WebCore: When we are continuing a load in a new process, we currently bypass the navigation policy check. We now also bypass the adding of headers such as the Origin one since the request was already processed in the previous process. This is important because in the case of a cross-origin redirect, the previous process has removed the Origin header from the request and we do not want the new process to add it again. Test: http/tests/security/cors-post-redirect-307-pson.html * WebCore.xcodeproj/project.pbxproj: * history/BackForwardController.cpp: (WebCore::BackForwardController::goBackOrForward): (WebCore::BackForwardController::goBack): (WebCore::BackForwardController::goForward): * loader/FrameLoadRequest.h: (WebCore::FrameLoadRequest::setShouldTreatAsContinuingLoad): (WebCore::FrameLoadRequest::shouldTreatAsContinuingLoad const): (WebCore::FrameLoadRequest::setShouldCheckNavigationPolicy): Deleted. (WebCore::FrameLoadRequest::shouldCheckNavigationPolicy const): Deleted. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURLIntoChildFrame): (WebCore::FrameLoader::load): (WebCore::FrameLoader::loadWithNavigationAction): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::reloadWithOverrideEncoding): (WebCore::FrameLoader::reload): (WebCore::FrameLoader::addExtraFieldsToRequest): (WebCore::FrameLoader::addHTTPOriginIfNeeded): (WebCore::FrameLoader::loadDifferentDocumentItem): (WebCore::FrameLoader::loadItem): (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad): * loader/FrameLoader.h: * loader/HistoryController.cpp: (WebCore::HistoryController::goToItem): (WebCore::HistoryController::setDefersLoading): (WebCore::HistoryController::recursiveGoToItem): * loader/HistoryController.h: * loader/ShouldTreatAsContinuingLoad.h: Renamed from Source/WebCore/loader/NavigationPolicyCheck.h. * page/Page.cpp: (WebCore::Page::goToItem): * page/Page.h: Source/WebKit: Rename existing flag to something a bit more generic, now that it is used for more things than bypassing the navigation policy check. * Shared/LoadParameters.cpp: (WebKit::LoadParameters::encode const): (WebKit::LoadParameters::decode): * Shared/LoadParameters.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::reattachToWebProcessForReload): (WebKit::WebPageProxy::reattachToWebProcessWithItem): (WebKit::WebPageProxy::loadRequest): (WebKit::WebPageProxy::loadRequestWithNavigation): (WebKit::WebPageProxy::goToBackForwardItem): (WebKit::WebPageProxy::continueNavigationInNewProcess): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadRequest): (WebKit::WebPage::goToBackForwardItem): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Source/WebKitLegacy/mac: Rename existing flag to something a bit more generic, now that it is used for more things than bypassing the navigation policy check. * WebView/WebView.mm: (-[WebView _loadBackForwardListFromOtherView:]): (-[WebView goToBackForwardItem:]): Source/WebKitLegacy/win: Rename existing flag to something a bit more generic, now that it is used for more things than bypassing the navigation policy check. * WebView.cpp: (WebView::goToBackForwardItem): (WebView::loadBackForwardListFromOtherView): LayoutTests: Add layout test coverage. * http/tests/security/cors-post-redirect-307-pson-expected.txt: Added. * http/tests/security/cors-post-redirect-307-pson.html: Added. Canonical link: https://commits.webkit.org/201862@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-11 20:52:31 +00:00
WebCore::ShouldTreatAsContinuingLoad,
WebCore::ShouldTreatAsContinuingLoad::No,
WebCore::ShouldTreatAsContinuingLoad::Yes
Go to back/forward list items after a process-swapped navigation. <rdar://problem/38690544> and https://bugs.webkit.org/show_bug.cgi?id=183920 Reviewed by Andy Estes. Source/WebCore: Covered by new API test. Most of the changes to WebCore are teaching HistoryItem navigations to know when they should do a policy check or not. * WebCore.xcodeproj/project.pbxproj: * history/BackForwardController.cpp: (WebCore::BackForwardController::goBackOrForward): (WebCore::BackForwardController::goBack): (WebCore::BackForwardController::goForward): * history/HistoryItem.cpp: (WebCore::HistoryItem::setStateObject): Actually push state object changes to the UIProcess. This was a long standing bug that made it difficult to effectively test this change. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURLIntoChildFrame): (WebCore::FrameLoader::loadDifferentDocumentItem): (WebCore::FrameLoader::loadItem): (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad): * loader/FrameLoader.h: * loader/FrameLoaderTypes.h: * loader/HistoryController.cpp: (WebCore::HistoryController::goToItem): (WebCore::HistoryController::setDefersLoading): (WebCore::HistoryController::recursiveGoToItem): * loader/HistoryController.h: * loader/NavigationPolicyCheck.h: * page/Page.cpp: (WebCore::Page::goToItem): * page/Page.h: Source/WebKit: This takes the initial work of "process swap a normal navigation" and extends it to process swapping for back/forward item navigations. * Scripts/webkit/messages.py: Make sure state objects are serialized to the UI Process back/forward list items, as otherwise they will be lost in process-swap scenarios: * Shared/SessionState.cpp: (WebKit::PageState::encode const): (WebKit::PageState::decode): * Shared/SessionState.h: Make a new variant of APINavigation specifically for back/forward list items. * UIProcess/API/APINavigation.cpp: (API::Navigation::Navigation): (API::Navigation::loggingURL const): * UIProcess/API/APINavigation.h: (API::Navigation::create): (API::Navigation::backForwardListItem): (API::Navigation::backForwardFrameLoadType const): * UIProcess/API/C/WKPage.cpp: (WKPageGoToBackForwardListItem): * UIProcess/API/Cocoa/WKBrowsingContextController.mm: (-[WKBrowsingContextController goToBackForwardListItem:]): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView goToBackForwardListItem:]): * UIProcess/WebNavigationState.cpp: (WebKit::WebNavigationState::createLoadRequestNavigation): (WebKit::WebNavigationState::createBackForwardNavigation): * UIProcess/WebNavigationState.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::reattachToWebProcessForReload): (WebKit::WebPageProxy::reattachToWebProcessWithItem): (WebKit::WebPageProxy::goForward): (WebKit::WebPageProxy::goBack): (WebKit::WebPageProxy::goToBackForwardItem): (WebKit::WebPageProxy::receivedPolicyDecision): (WebKit::WebPageProxy::continueNavigationInNewProcess): Handle back/forward navigations differently than others. (WebKit::WebPageProxy::restoreFromSessionState): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::addOrUpdateBackForwardItem): Renamed from "addBackForwardItem" for clarity (WebKit::WebProcessProxy::addBackForwardItem): Deleted. * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::endSwipeGesture): * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::endSwipeGesture): * WebProcess/WebCoreSupport/SessionStateConversion.cpp: (WebKit::toPageState): (WebKit::toHistoryItem): * WebProcess/WebPage/WebBackForwardListProxy.cpp: (WebKit::updateBackForwardItem): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::goToBackForwardItem): Combined "goBack" and "goForward" with this method, passing the appropriate FrameLoadType around as needed to remember the specific type. (WebKit::WebPage::goForward): Deleted. (WebKit::WebPage::goBack): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Source/WebKitLegacy/mac: * WebView/WebView.mm: (-[WebView _loadBackForwardListFromOtherView:]): (-[WebView goToBackForwardItem:]): Source/WebKitLegacy/win: * WebView.cpp: (WebView::goToBackForwardItem): (WebView::loadBackForwardListFromOtherView): Tools: Add a new API test that does some process-swapping navigations (including a back navigation) and verifies the state of the engine afterwards. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: (-[PSONMessageHandler userContentController:didReceiveScriptMessage:]): (-[PSONScheme initWithBytes:]): (-[PSONScheme webView:startURLSchemeTask:]): (log): (function): (TEST): Deleted. Canonical link: https://commits.webkit.org/199558@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229926 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-03-23 22:15:23 +00:00
>;
};
} // namespace WTF