Process swapping on navigation needs to handle server redirects.
[WebKit-https.git] / Source / WebKit / UIProcess / API / APINavigation.cpp
index bea333e..b95753c 100644 (file)
@@ -41,13 +41,16 @@ Navigation::Navigation(WebNavigationState& state)
 
 Navigation::Navigation(WebNavigationState& state, WebCore::ResourceRequest&& request)
     : m_navigationID(state.generateNavigationID())
-    , m_request(WTFMove(request))
+    , m_originalRequest(WTFMove(request))
+    , m_currentRequest(m_originalRequest)
 {
-    m_redirectChain.append(m_request.url());
+    m_redirectChain.append(m_originalRequest.url());
 }
 
 Navigation::Navigation(WebNavigationState& state, WebBackForwardListItem& item, FrameLoadType backForwardFrameLoadType)
     : m_navigationID(state.generateNavigationID())
+    , m_originalRequest(item.url())
+    , m_currentRequest(m_originalRequest)
     , m_backForwardListItem(&item)
     , m_backForwardFrameLoadType(backForwardFrameLoadType)
 {
@@ -57,16 +60,22 @@ Navigation::~Navigation()
 {
 }
 
-void Navigation::appendRedirectionURL(const WebCore::URL& url)
+void Navigation::setCurrentRequest(ResourceRequest&& request, ProcessIdentifier processIdentifier)
+{
+    m_currentRequest = WTFMove(request);
+    m_currentRequestProcessIdentifier = processIdentifier;
+}
+
+void Navigation::appendRedirectionURL(const URL& url)
 {
     if (m_redirectChain.isEmpty() || m_redirectChain.last() != url)
         m_redirectChain.append(url);
 }
 
 #if !LOG_DISABLED
-WTF::String Navigation::loggingURL() const
+WTF::String Navigation::loggingString() const
 {
-    return m_backForwardListItem ? m_backForwardListItem->url() : m_request.url().string();
+    return makeString("Most recent URL: ", m_currentRequest.url().string(), " Back/forward list item URL: '", m_backForwardListItem ? m_backForwardListItem->url() : String { }, String::format("' (%p)", m_backForwardListItem.get()));
 }
 #endif