The original request should be accessible from WebNavigationData.
authoradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Jul 2011 16:57:57 +0000 (16:57 +0000)
committeradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Jul 2011 16:57:57 +0000 (16:57 +0000)
        https://bugs.webkit.org/show_bug.cgi?id=64227

        Reviewed by Anders Carlsson.

        * Shared/WebNavigationDataStore.h:
        (WebKit::WebNavigationDataStore::encode): Handle the encoding of the original request.
        (WebKit::WebNavigationDataStore::decode): Handle the decoding of the original request.
        * UIProcess/API/C/WKNavigationData.cpp:
        (WKNavigationDataCopyOriginalRequest):
        * UIProcess/API/C/WKNavigationData.h:
        * UIProcess/WebNavigationData.h:
        (WebKit::WebNavigationData::originalRequest):
        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
        (WebKit::WebFrameLoaderClient::updateGlobalHistory): Store the original request in the WebNavigationDataStore.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@90760 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebNavigationDataStore.h
Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp
Source/WebKit2/UIProcess/API/C/WKNavigationData.h
Source/WebKit2/UIProcess/WebNavigationData.h
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

index bfc6bf7..bae6420 100644 (file)
@@ -1,3 +1,21 @@
+2011-07-11  Ada Chan  <adachan@apple.com>
+
+        The original request should be accessible from WebNavigationData.
+        https://bugs.webkit.org/show_bug.cgi?id=64227
+
+        Reviewed by Anders Carlsson.
+
+        * Shared/WebNavigationDataStore.h:
+        (WebKit::WebNavigationDataStore::encode): Handle the encoding of the original request.
+        (WebKit::WebNavigationDataStore::decode): Handle the decoding of the original request.
+        * UIProcess/API/C/WKNavigationData.cpp:
+        (WKNavigationDataCopyOriginalRequest): 
+        * UIProcess/API/C/WKNavigationData.h:
+        * UIProcess/WebNavigationData.h:
+        (WebKit::WebNavigationData::originalRequest):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::updateGlobalHistory): Store the original request in the WebNavigationDataStore.
+
 2011-07-11  Benjamin Poulain  <benjamin@webkit.org>
 
         [Qt][WK2] Forward the viewport visible area from the view instead of inferring it from the TiledDrawingAreaProxy
index 01fd429..947d090 100644 (file)
@@ -29,6 +29,7 @@
 #include "ArgumentDecoder.h"
 #include "ArgumentEncoder.h"
 #include "WebCoreArgumentCoders.h"
+#include <WebCore/ResourceRequest.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebKit {
@@ -38,6 +39,7 @@ struct WebNavigationDataStore {
     {
         encoder->encode(url);
         encoder->encode(title);
+        encoder->encode(originalRequest);
     }
 
     static bool decode(CoreIPC::ArgumentDecoder* decoder, WebNavigationDataStore& store)
@@ -46,12 +48,15 @@ struct WebNavigationDataStore {
             return false;
         if (!decoder->decode(store.title))
             return false;
+        if (!decoder->decode(store.originalRequest))
+            return false;
         return true;
     }
 
     // FIXME: Add the remaining items we want to track for history.
     String url;
     String title;
+    WebCore::ResourceRequest originalRequest;
 };
 
 } // namespace WebKit
index fd0ddab..ba09d4d 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "WKAPICast.h"
 #include "WebNavigationData.h"
+#include "WebURLRequest.h"
 
 using namespace WebKit;
 
@@ -45,3 +46,8 @@ WKURLRef WKNavigationDataCopyURL(WKNavigationDataRef navigationDataRef)
 {
     return toCopiedURLAPI(toImpl(navigationDataRef)->url());
 }
+
+WKURLRequestRef WKNavigationDataCopyOriginalRequest(WKNavigationDataRef navigationData)
+{
+    return toAPI(WebURLRequest::create(toImpl(navigationData)->originalRequest()).leakRef());
+}
index c855b54..cf5d1e5 100644 (file)
@@ -36,6 +36,7 @@ WK_EXPORT WKTypeID WKNavigationDataGetTypeID();
 
 WK_EXPORT WKStringRef WKNavigationDataCopyTitle(WKNavigationDataRef navigationData);
 WK_EXPORT WKURLRef WKNavigationDataCopyURL(WKNavigationDataRef navigationData);
+WK_EXPORT WKURLRequestRef WKNavigationDataCopyOriginalRequest(WKNavigationDataRef navigationData);
 
 #ifdef __cplusplus
 }
index e6b6c31..a2788d6 100644 (file)
@@ -45,6 +45,7 @@ public:
 
     String title() const { return m_store.title; }
     String url() const { return m_store.url; }
+    const WebCore::ResourceRequest& originalRequest() const { return m_store.originalRequest; }
 
 private:
     WebNavigationData(const WebNavigationDataStore&);
index 165ab71..ae70068 100644 (file)
@@ -870,6 +870,7 @@ void WebFrameLoaderClient::updateGlobalHistory()
     data.url = loader->urlForHistory().string();
     // FIXME: use direction of title.
     data.title = loader->title().string();
+    data.originalRequest = loader->originalRequestCopy();
 
     WebProcess::shared().connection()->send(Messages::WebContext::DidNavigateWithNavigationData(webPage->pageID(), data, m_frame->frameID()), 0);
 }