2011-02-03 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Feb 2011 07:27:37 +0000 (07:27 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Feb 2011 07:27:37 +0000 (07:27 +0000)
        Reviewed by Dan Bernstein.

        WebKit2: Need WebKit2 equivalent of WebResourceLoadDelegate::willSendRequest in the Bundle
        https://bugs.webkit.org/show_bug.cgi?id=52897
        <rdar://problem/8898294>

        * WebCore.exp.in: Add export now needed by WebKit2
2011-02-03  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Dan Bernstein.

        WebKit2: Need WebKit2 equivalent of WebResourceLoadDelegate::willSendRequest in the Bundle
        https://bugs.webkit.org/show_bug.cgi?id=52897
        <rdar://problem/8898294>

        * Shared/API/c/WKSharedAPICast.h:
        (WebKit::toAPI):
        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
        (WebKit::InjectedBundlePageLoaderClient::willSendRequestForFrame):
        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
        (WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
2011-02-03  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Dan Bernstein.

        WebKit2: Need WebKit2 equivalent of WebResourceLoadDelegate::willSendRequest in the Bundle
        https://bugs.webkit.org/show_bug.cgi?id=52897
        <rdar://problem/8898294>

        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
        (WTR::InjectedBundlePage::InjectedBundlePage):
        (WTR::InjectedBundlePage::willSendRequestForFrame):
        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:

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

Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/c/WKSharedAPICast.h
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h

index 49eea23..bef1534 100644 (file)
@@ -1,3 +1,13 @@
+2011-02-03  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        WebKit2: Need WebKit2 equivalent of WebResourceLoadDelegate::willSendRequest in the Bundle
+        https://bugs.webkit.org/show_bug.cgi?id=52897
+        <rdar://problem/8898294>
+
+        * WebCore.exp.in: Add export now needed by WebKit2
+
 2011-02-03  Victoria Kirst  <vrk@google.com>
 
         Reviewed by James Robinson.
index 2f3787f..5a6b056 100644 (file)
@@ -1089,6 +1089,7 @@ __ZNK7WebCore19AnimationController24numberOfActiveAnimationsEv
 __ZNK7WebCore19ResourceRequestBase10httpMethodEv
 __ZNK7WebCore19ResourceRequestBase15httpHeaderFieldEPKc
 __ZNK7WebCore19ResourceRequestBase3urlEv
+__ZNK7WebCore19ResourceRequestBase6isNullEv
 __ZNK7WebCore19ResourceRequestBase7isEmptyEv
 __ZNK7WebCore19SelectionController11currentFormEv
 __ZNK7WebCore19SelectionController15copyTypingStyleEv
index 5826a38..6fcacfb 100644 (file)
@@ -1,3 +1,20 @@
+2011-02-03  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        WebKit2: Need WebKit2 equivalent of WebResourceLoadDelegate::willSendRequest in the Bundle
+        https://bugs.webkit.org/show_bug.cgi?id=52897
+        <rdar://problem/8898294>
+
+        * Shared/API/c/WKSharedAPICast.h:
+        (WebKit::toAPI):
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
+        (WebKit::InjectedBundlePageLoaderClient::willSendRequestForFrame):
+        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
+
 2011-02-03  Ivan Krstić  <ike@apple.com>
 
         Reviewed by Maciej Stachowiak.
index ed97bbd..ac3b420 100644 (file)
@@ -41,6 +41,8 @@
 #include "WebNumber.h"
 #include "WebString.h"
 #include "WebURL.h"
+#include "WebURLRequest.h"
+#include "WebURLResponse.h"
 #include <WebCore/ContextMenuItem.h>
 #include <WebCore/FloatRect.h>
 #include <WebCore/FrameLoaderTypes.h>
@@ -174,6 +176,16 @@ inline ProxyingRefPtr<WebError> toAPI(const WebCore::ResourceError& error)
     return ProxyingRefPtr<WebError>(WebError::create(error));
 }
 
+inline ProxyingRefPtr<WebURLRequest> toAPI(const WebCore::ResourceRequest& request)
+{
+    return ProxyingRefPtr<WebURLRequest>(WebURLRequest::create(request));
+}
+
+inline ProxyingRefPtr<WebURLResponse> toAPI(const WebCore::ResourceResponse& response)
+{
+    return ProxyingRefPtr<WebURLResponse>(WebURLResponse::create(response));
+}
+
 /* Geometry conversions */
 
 inline WebCore::FloatRect toFloatRect(const WKRect& wkRect)
index 7c3e1e6..229a66e 100644 (file)
@@ -87,7 +87,8 @@ typedef void (*WKBundlePageDidClearWindowObjectForFrameCallback)(WKBundlePageRef
 typedef void (*WKBundlePageDidCancelClientRedirectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo);
 typedef void (*WKBundlePageWillPerformClientRedirectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKURLRef url, double delay, double date, const void *clientInfo);
 typedef void (*WKBundlePageDidHandleOnloadEventsForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo);
-typedef bool (*WKBundlePageShouldLoadResourceForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKStringRef url, const void *clientInfo);
+typedef WKURLRequestRef (*WKBundlePageWillSendRequestForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, uint64_t resourceIdentifier, WKURLRequestRef request, WKURLResponseRef redirectResponse, const void *clientInfo);
+
 
 
 struct WKBundlePageLoaderClient {
@@ -113,7 +114,7 @@ struct WKBundlePageLoaderClient {
     WKBundlePageDidCancelClientRedirectForFrameCallback                 didCancelClientRedirectForFrame;
     WKBundlePageWillPerformClientRedirectForFrameCallback               willPerformClientRedirectForFrame;
     WKBundlePageDidHandleOnloadEventsForFrameCallback                   didHandleOnloadEventsForFrame;
-    WKBundlePageShouldLoadResourceForFrameCallback                      shouldLoadResourceForFrame;
+    WKBundlePageWillSendRequestForFrameCallback                         willSendRequestForFrame;
 };
 typedef struct WKBundlePageLoaderClient WKBundlePageLoaderClient;
 
index 27176e7..a322baa 100644 (file)
@@ -176,12 +176,12 @@ void InjectedBundlePageLoaderClient::didRunInsecureContentForFrame(WebPage* page
     userData = adoptRef(toImpl(userDataToPass));
 }
 
-bool InjectedBundlePageLoaderClient::shouldLoadResourceForFrame(WebPage* page, WebFrame* frame, const String& resourceURL)
+void InjectedBundlePageLoaderClient::willSendRequestForFrame(WebPage* page, WebFrame* frame, uint64_t identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
 {
-    if (!m_client.shouldLoadResourceForFrame)
-        return true;
+    if (!m_client.willSendRequestForFrame)
+        return;
 
-    return m_client.shouldLoadResourceForFrame(toAPI(page), toAPI(frame), toAPI(resourceURL.impl()), m_client.clientInfo);
+    request = toImpl(m_client.willSendRequestForFrame(toAPI(page), toAPI(frame), identifier, toAPI(request), toAPI(redirectResponse), m_client.clientInfo))->resourceRequest();
 }
 
 void InjectedBundlePageLoaderClient::didClearWindowObjectForFrame(WebPage* page, WebFrame* frame, DOMWrapperWorld* world)
index e983b48..07979db 100644 (file)
@@ -35,6 +35,8 @@
 namespace WebCore {
 class DOMWrapperWorld;
 class ResourceError;
+class ResourceRequest;
+class ResourceResponse;
 }
 
 namespace WebKit {
@@ -60,7 +62,7 @@ public:
     void didDisplayInsecureContentForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
     void didRunInsecureContentForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
 
-    bool shouldLoadResourceForFrame(WebPage*, WebFrame*, const String&);
+    void willSendRequestForFrame(WebPage*, WebFrame*, uint64_t identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
 
     void didClearWindowObjectForFrame(WebPage*, WebFrame*, WebCore::DOMWrapperWorld*);
     void didCancelClientRedirectForFrame(WebPage*, WebFrame*);
index 743c213..e733325 100644 (file)
@@ -158,8 +158,9 @@ void WebFrameLoaderClient::dispatchWillSendRequest(DocumentLoader*, unsigned lon
     if (!webPage)
         return;
 
-    if (!webPage->injectedBundleLoaderClient().shouldLoadResourceForFrame(webPage, m_frame, request.url().string())) {
-        request = ResourceRequest();
+    webPage->injectedBundleLoaderClient().willSendRequestForFrame(webPage, m_frame, identifier, request, redirectResponse);
+
+    if (request.isNull()) {
         // FIXME: We should probably send a message saying we cancelled the request for the resource.
         return;
     }
index c663d63..6b0d354 100644 (file)
@@ -1,3 +1,16 @@
+2011-02-03  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        WebKit2: Need WebKit2 equivalent of WebResourceLoadDelegate::willSendRequest in the Bundle
+        https://bugs.webkit.org/show_bug.cgi?id=52897
+        <rdar://problem/8898294>
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::InjectedBundlePage):
+        (WTR::InjectedBundlePage::willSendRequestForFrame):
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
+
 2011-02-03  Ivan Krstić  <ike@apple.com>
 
         Unreviewed.
index 0875ca4..82437a7 100644 (file)
@@ -190,7 +190,7 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
         didCancelClientRedirectForFrame,
         willPerformClientRedirectForFrame,
         didHandleOnloadEventsForFrame,
-        shouldLoadResourceForFrame
+        willSendRequestForFrame
     };
     WKBundlePageSetLoaderClient(m_page, &loaderClient);
 
@@ -322,12 +322,11 @@ void InjectedBundlePage::didRunInsecureContentForFrame(WKBundlePageRef page, WKB
     static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didRunInsecureContentForFrame(frame);
 }
 
-bool InjectedBundlePage::shouldLoadResourceForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKStringRef, const void* clientInfo)
+WKURLRequestRef InjectedBundlePage::willSendRequestForFrame(WKBundlePageRef page, WKBundleFrameRef frame, uint64_t identifier, WKURLRequestRef request, WKURLResponseRef redirectResponse, const void* clientInfo)
 {
-    return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldLoadResourceForFrame(frame);
+    return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willSendRequestForFrame(page, frame, identifier, request, redirectResponse);
 }
 
-
 void InjectedBundlePage::didStartProvisionalLoadForFrame(WKBundleFrameRef frame)
 {
     if (!InjectedBundle::shared().isTestRunning())
@@ -575,9 +574,9 @@ void InjectedBundlePage::didRunInsecureContentForFrame(WKBundleFrameRef frame)
 {
 }
 
-bool InjectedBundlePage::shouldLoadResourceForFrame(WKBundleFrameRef frame)
+WKURLRequestRef InjectedBundlePage::willSendRequestForFrame(WKBundlePageRef, WKBundleFrameRef, uint64_t, WKURLRequestRef request, WKURLResponseRef)
 {
-    return true;
+    return request;
 }
 
 // UI Client Callbacks
index 3b99109..d763531 100644 (file)
@@ -63,7 +63,7 @@ private:
     static void didHandleOnloadEventsForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
     static void didDisplayInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*);
     static void didRunInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*);
-    static bool shouldLoadResourceForFrame(WKBundlePageRef, WKBundleFrameRef, WKStringRef, const void*);
+    static WKURLRequestRef willSendRequestForFrame(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKURLRequestRef, WKURLResponseRef, const void*);
     void didStartProvisionalLoadForFrame(WKBundleFrameRef);
     void didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef);
     void didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef, WKErrorRef);
@@ -79,7 +79,7 @@ private:
     void didHandleOnloadEventsForFrame(WKBundleFrameRef);
     void didDisplayInsecureContentForFrame(WKBundleFrameRef);
     void didRunInsecureContentForFrame(WKBundleFrameRef);
-    bool shouldLoadResourceForFrame(WKBundleFrameRef);
+    WKURLRequestRef willSendRequestForFrame(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKURLRequestRef, WKURLResponseRef);
 
     // UI Client
     static void willAddMessageToConsole(WKBundlePageRef, WKStringRef message, uint32_t lineNumber, const void* clientInfo);