WebKit:
authorbeidson <beidson@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Sep 2006 18:20:08 +0000 (18:20 +0000)
committerbeidson <beidson@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Sep 2006 18:20:08 +0000 (18:20 +0000)
        Reviewed by Maciej, landed by Brady

        Update URL request associated with provisional data source on redirect.
        Notify IWebFrameLoadDelegate of redirects for the provisional load.
        Notify IWebFrameLoadDelegate of a provisional load being commited.

        * COM/WebDataSource.cpp:
        (WebDataSource::replaceRequest):
        * COM/WebDataSource.h:
        * COM/WebFrame.cpp:
        (WebFrame::receivedRedirect):
        (WebFrame::receivedResponse):
        (WebFrame::receivedData):

WebKitTools:

        Reviewed by Maciej, landed by Brady

        Fix URL bar updating.

        * Spinneret/Spinneret/Spinneret.h:
        (SpinneretWebHost::didStartProvisionalLoadForFrame):
        (SpinneretWebHost::didCommitLoadForFrame):
        (SpinneretWebHost::didFinishLoadForFrame):

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

WebKit/COM/WebDataSource.cpp
WebKit/COM/WebDataSource.h
WebKit/COM/WebFrame.cpp
WebKit/ChangeLog
WebKitTools/ChangeLog
WebKitTools/Spinneret/Spinneret/Spinneret.h

index 94cd18d9a6966d90a37d05bb82fd7dfe08e62a36..ac40074d072fb51c4c1fe97e0d16fe1507a4a8f4 100644 (file)
@@ -65,6 +65,13 @@ WebDataSource* WebDataSource::createInstance(WebFrame* frame)
     return instance;
 }
 
+void WebDataSource::replaceRequest(IWebMutableURLRequest* request) {
+    if (m_request)
+        m_request->Release();
+    m_request = request;
+    m_request->AddRef();
+}
+
 // IUnknown -------------------------------------------------------------------
 
 HRESULT STDMETHODCALLTYPE WebDataSource::QueryInterface(REFIID riid, void** ppvObject)
index 554c4396632418cfdafc405f9bf30922d1d77f14..13429daec430bb70645c4d9fb50be33de7503bea 100644 (file)
@@ -35,6 +35,10 @@ class WebDataSource : public IWebDataSource
 {
 public:
     static WebDataSource* createInstance(WebFrame* frame);
+
+    // Replace the request associated with this data source
+    void replaceRequest(IWebMutableURLRequest* request);
+
 protected:
     WebDataSource();
     ~WebDataSource();
index c4e4534fc1bee7bcee6e7897f033d1e7a9eded87..6fb7c7e4e903462b1c3b165bb055d019faa627ca 100644 (file)
@@ -464,9 +464,27 @@ int WebFrame::getObjectCacheSize()
 
 // ResourceLoaderClient
 
-void WebFrame::receivedRedirect(ResourceLoader*, const KURL&)
+void WebFrame::receivedRedirect(ResourceLoader*, const KURL& url)
 {
-    //FIXME
+    DeprecatedString urlStr(url.url());
+    urlStr.append('\0');
+
+    // FIXME: is this the correct way to handle a redirect?
+
+    IWebMutableURLRequest* request = WebMutableURLRequest::createInstance();
+    BSTR urlBStr = SysAllocString((LPCTSTR)urlStr.unicode());
+    if (SUCCEEDED(request->initWithURL(urlBStr, WebURLRequestUseProtocolCachePolicy, 0))) {
+        _ASSERT(m_provisionalDataSource);
+        static_cast<WebDataSource*>(m_provisionalDataSource)->replaceRequest(request);
+    }
+    SysFreeString(urlBStr);
+    request->Release();
+
+    IWebFrameLoadDelegate* frameLoadDelegate;
+    if (SUCCEEDED(d->webView->frameLoadDelegate(&frameLoadDelegate))) {
+        frameLoadDelegate->didReceiveServerRedirectForProvisionalLoadForFrame(d->webView, this);
+        frameLoadDelegate->Release();
+    }
 }
 
 void WebFrame::receivedResponse(ResourceLoader*, PlatformResponse)
@@ -475,10 +493,22 @@ void WebFrame::receivedResponse(ResourceLoader*, PlatformResponse)
         m_dataSource = m_provisionalDataSource;
         m_provisionalDataSource = 0;
     }
+
+    // FIXME: pass mime type of response to frame.  perhaps the Frame::begin() 
+    // should be made from here.
+
+    IWebFrameLoadDelegate* frameLoadDelegate;
+    if (SUCCEEDED(d->webView->frameLoadDelegate(&frameLoadDelegate))) {
+        frameLoadDelegate->didCommitLoadForFrame(d->webView, this);
+        frameLoadDelegate->Release();
+    }
 }
 
 void WebFrame::receivedData(ResourceLoader*, const char* data, int length)
 {
+    // Ensure that WebFrame::receivedResponse was called.
+    _ASSERT(m_dataSource && !m_provisionalDataSource);
+
     d->frame->write(data, length);
 }
 
index 4976720e41810adbd729da8900e465ad478248b4..98fa35a6798a4594ea0f8052db435daef888de88 100644 (file)
@@ -1,3 +1,19 @@
+2006-09-27  MorganL  <morganl.webkit@yahoo.com>
+
+        Reviewed by Maciej, landed by Brady
+
+        Update URL request associated with provisional data source on redirect.
+        Notify IWebFrameLoadDelegate of redirects for the provisional load.
+        Notify IWebFrameLoadDelegate of a provisional load being commited.
+
+        * COM/WebDataSource.cpp:
+        (WebDataSource::replaceRequest):
+        * COM/WebDataSource.h:
+        * COM/WebFrame.cpp:
+        (WebFrame::receivedRedirect):
+        (WebFrame::receivedResponse):
+        (WebFrame::receivedData):
+
 2006-09-26  John Sullivan  <sullivan@apple.com>
 
         Reviewed by Darin
index 44abdca3a327fda414692a9b58a20fd71c90dd10..38eb27816f2ee7492f8218e4c8911d15d7b65b06 100644 (file)
@@ -1,3 +1,14 @@
+2006-09-27  MorganL  <morganl.webkit@yahoo.com>
+
+        Reviewed by Maciej, landed by Brady
+
+        Fix URL bar updating.
+
+        * Spinneret/Spinneret/Spinneret.h:
+        (SpinneretWebHost::didStartProvisionalLoadForFrame):
+        (SpinneretWebHost::didCommitLoadForFrame):
+        (SpinneretWebHost::didFinishLoadForFrame):
+
 2006-09-23  Sam Weinig  <sam.weinig@gmail.com>
 
         Reviewed by Eric.
index f47a7a7c9df7c3c7277bd1bb6c2fc814a6a61357..fc51ab2dbc2ea49e37310407ff11a05ecb557b25 100644 (file)
@@ -40,7 +40,7 @@ public:
     // IWebFrameLoadDelegate
     virtual HRESULT STDMETHODCALLTYPE didStartProvisionalLoadForFrame( 
         /* [in] */ IWebView* webView,
-        /* [in] */ IWebFrame* /*frame*/) { return updateAddressBar(webView); }
+        /* [in] */ IWebFrame* /*frame*/) { return S_OK; }
     
     virtual HRESULT STDMETHODCALLTYPE didReceiveServerRedirectForProvisionalLoadForFrame( 
         /* [in] */ IWebView *webView,
@@ -53,7 +53,7 @@ public:
     
     virtual HRESULT STDMETHODCALLTYPE didCommitLoadForFrame( 
         /* [in] */ IWebView *webView,
-        /* [in] */ IWebFrame *frame) { return S_OK; }
+        /* [in] */ IWebFrame *frame) { return updateAddressBar(webView); }
     
     virtual HRESULT STDMETHODCALLTYPE didReceiveTitle( 
         /* [in] */ IWebView *webView,
@@ -67,7 +67,7 @@ public:
     
     virtual HRESULT STDMETHODCALLTYPE didFinishLoadForFrame( 
         /* [in] */ IWebView* webView,
-        /* [in] */ IWebFrame* /*frame*/) { return updateAddressBar(webView); }
+        /* [in] */ IWebFrame* /*frame*/) { return S_OK; }
     
     virtual HRESULT STDMETHODCALLTYPE didFailLoadWithError( 
         /* [in] */ IWebView *webView,
@@ -104,4 +104,4 @@ protected:
 
 protected:
     ULONG                   m_refCount;
-};
\ No newline at end of file
+};