Title: [159387] trunk
Revision
159387
Author
[email protected]
Date
2013-11-17 12:30:43 -0800 (Sun, 17 Nov 2013)

Log Message

No way for policy client to determine if a the response’s MIME type can be shown
https://bugs.webkit.org/show_bug.cgi?id=124445

Reviewed by Sam Weinig.

Source/WebKit2: 

* Platform/CoreIPC/HandleMessage.h:
(CoreIPC::callMemberFunction): Added a fifth message parameter to this template.

* UIProcess/API/C/WKPage.h: Added a canShowMIMEType parameter to
WKPageDecidePolicyForResponseCallback and deprecated the old version.

* UIProcess/API/mac/WKBrowsingContextController.mm:
(setUpPagePolicyClient): Include whether the response MIME type can be shown under a new key
in the action information dictionary.
* UIProcess/API/mac/WKBrowsingContextPolicyDelegate.h: Declared
WKActionCanShowMIMETypeKey.

* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::createInspectorPage): Updated for changes in the policy client.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::decidePolicyForResponse): Added canShowMIMEType parameter, which is
passed to the policy client.
(WebKit::WebPageProxy::decidePolicyForResponseSync): Added canShowMIMEType parameter, which
is passed to the above function.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in: Added canShowMIMEType paramter to
DecidePolicyForResponseSync.

* UIProcess/WebPolicyClient.cpp:
(WebKit::WebPolicyClient::decidePolicyForResponse): Added canShowMIMEType parameter, which
is passed to the client callback.
* UIProcess/WebPolicyClient.h:

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): Determine if the response
MIME type can be shown and pass this information along in the message to the UI process.

Tools: 

* MiniBrowser/mac/WK2BrowserWindowController.m:
(decidePolicyForResponse): Added canShowMIMEType parameter.
(-[WK2BrowserWindowController awakeFromNib]): Updated for changes in the policy client.

* TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp:
(TestWebKitAPI::decidePolicyForResponse): Added canShowMIMEType parameter.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createWebViewWithOptions): Updated for changes in the policy client.
(WTR::TestController::decidePolicyForResponse): Added canShowMIMEType parameter.
* WebKitTestRunner/TestController.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (159386 => 159387)


--- trunk/Source/WebKit2/ChangeLog	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Source/WebKit2/ChangeLog	2013-11-17 20:30:43 UTC (rev 159387)
@@ -1,3 +1,43 @@
+2013-11-16  Dan Bernstein  <[email protected]>
+
+        No way for policy client to determine if a the response’s MIME type can be shown
+        https://bugs.webkit.org/show_bug.cgi?id=124445
+
+        Reviewed by Sam Weinig.
+
+        * Platform/CoreIPC/HandleMessage.h:
+        (CoreIPC::callMemberFunction): Added a fifth message parameter to this template.
+
+        * UIProcess/API/C/WKPage.h: Added a canShowMIMEType parameter to
+        WKPageDecidePolicyForResponseCallback and deprecated the old version.
+
+        * UIProcess/API/mac/WKBrowsingContextController.mm:
+        (setUpPagePolicyClient): Include whether the response MIME type can be shown under a new key
+        in the action information dictionary.
+        * UIProcess/API/mac/WKBrowsingContextPolicyDelegate.h: Declared
+        WKActionCanShowMIMETypeKey.
+
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::createInspectorPage): Updated for changes in the policy client.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::decidePolicyForResponse): Added canShowMIMEType parameter, which is
+        passed to the policy client.
+        (WebKit::WebPageProxy::decidePolicyForResponseSync): Added canShowMIMEType parameter, which
+        is passed to the above function.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in: Added canShowMIMEType paramter to
+        DecidePolicyForResponseSync.
+
+        * UIProcess/WebPolicyClient.cpp:
+        (WebKit::WebPolicyClient::decidePolicyForResponse): Added canShowMIMEType parameter, which
+        is passed to the client callback.
+        * UIProcess/WebPolicyClient.h:
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): Determine if the response
+        MIME type can be shown and pass this information along in the message to the UI process.
+
 2013-11-15  Ryuan Choi  <[email protected]>
 
         Unreviewed EFL build fix after r159358.
@@ -46,7 +86,7 @@
         policy client version to 1.
 
         * UIProcess/API/mac/WKBrowsingContextController.mm:
-        (setUpPagePolicyClient): Include the originating frame’s URL under the a new key in the
+        (setUpPagePolicyClient): Include the originating frame’s URL under a new key in the
         action information dictionary.
         * UIProcess/API/mac/WKBrowsingContextPolicyDelegate.h: Declared
         WKActionOriginatingFrameURLKey.

Modified: trunk/Source/WebKit2/Platform/CoreIPC/HandleMessage.h (159386 => 159387)


--- trunk/Source/WebKit2/Platform/CoreIPC/HandleMessage.h	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Source/WebKit2/Platform/CoreIPC/HandleMessage.h	2013-11-17 20:30:43 UTC (rev 159387)
@@ -346,10 +346,10 @@
 
 // Variadic dispatch functions with non-variadic reply arguments.
 
-template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename R1, typename R2, typename R3>
-void callMemberFunction(std::tuple<P1, P2, P3, P4>&& args, MessageDecoder& decoder, std::tuple<R1, R2, R3>& replyArgs, C* object, MF function)
+template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename R1, typename R2, typename R3>
+void callMemberFunction(std::tuple<P1, P2, P3, P4, P5>&& args, MessageDecoder& decoder, std::tuple<R1, R2, R3>& replyArgs, C* object, MF function)
 {
-    (object->*function)(std::get<0>(args), std::get<1>(args), std::get<2>(args), std::get<3>(args), decoder, std::get<0>(replyArgs), std::get<1>(replyArgs), std::get<2>(replyArgs));
+    (object->*function)(std::get<0>(args), std::get<1>(args), std::get<2>(args), std::get<3>(args), std::get<4>(args), decoder, std::get<0>(replyArgs), std::get<1>(replyArgs), std::get<2>(replyArgs));
 }
 
 template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename R1, typename R2>

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.h (159386 => 159387)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2013-11-17 20:30:43 UTC (rev 159387)
@@ -150,22 +150,24 @@
 // Policy Client.
 typedef void (*WKPageDecidePolicyForNavigationActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKFrameRef originatingFrame, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
 typedef void (*WKPageDecidePolicyForNewWindowActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
-typedef void (*WKPageDecidePolicyForResponseCallback)(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
+typedef void (*WKPageDecidePolicyForResponseCallback_deprecatedForUseWithV0)(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
 typedef void (*WKPageUnableToImplementPolicyCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void* clientInfo);
 
 // Deprecated
 typedef void (*WKPageDecidePolicyForNavigationActionCallback_deprecatedForUseWithV0)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
+typedef void (*WKPageDecidePolicyForResponseCallback)(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, bool canShowMIMEType, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
 
 struct WKPagePolicyClient {
     int                                                                  version;
     const void *                                                         clientInfo;
     WKPageDecidePolicyForNavigationActionCallback_deprecatedForUseWithV0 decidePolicyForNavigationAction_deprecatedForUseWithV0;
     WKPageDecidePolicyForNewWindowActionCallback                         decidePolicyForNewWindowAction;
-    WKPageDecidePolicyForResponseCallback                                decidePolicyForResponse;
+    WKPageDecidePolicyForResponseCallback_deprecatedForUseWithV0         decidePolicyForResponse_deprecatedForUseWithV0;
     WKPageUnableToImplementPolicyCallback                                unableToImplementPolicy;
 
     // Version 1
     WKPageDecidePolicyForNavigationActionCallback                        decidePolicyForNavigationAction;
+    WKPageDecidePolicyForResponseCallback                                decidePolicyForResponse;
 };
 typedef struct WKPagePolicyClient WKPagePolicyClient;
 

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm (159386 => 159387)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm	2013-11-17 20:30:43 UTC (rev 159387)
@@ -82,6 +82,7 @@
 NSString * const WKActionURLResponseKey = @"WKActionURLResponseKey";
 NSString * const WKActionFrameNameKey = @"WKActionFrameNameKey";
 NSString * const WKActionOriginatingFrameURLKey = @"WKActionOriginatingFrameURLKey";
+NSString * const WKActionCanShowMIMETypeKey = @"WKActionCanShowMIMETypeKey";
 
 @interface WKBrowsingContextControllerData : NSObject {
 @public
@@ -663,14 +664,15 @@
             WKFramePolicyListenerUse(listener);
     };
 
-    policyClient.decidePolicyForResponse = [](WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
+    policyClient.decidePolicyForResponse = [](WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, bool canShowMIMEType, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
     {
         WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo;
         if ([browsingContext.policyDelegate respondsToSelector:@selector(browsingContextController:decidePolicyForResponseAction:decisionHandler:)]) {
             NSDictionary *actionDictionary = @{
                 WKActionIsMainFrameKey: @(WKFrameIsMainFrame(frame)),
                 WKActionURLRequestKey: adoptNS(WKURLRequestCopyNSURLRequest(request)).get(),
-                WKActionURLResponseKey: adoptNS(WKURLResponseCopyNSURLResponse(response)).get()
+                WKActionURLResponseKey: adoptNS(WKURLResponseCopyNSURLResponse(response)).get(),
+                WKActionCanShowMIMETypeKey: @(canShowMIMEType),
             };
 
             [browsingContext.policyDelegate browsingContextController:browsingContext decidePolicyForResponseAction:actionDictionary decisionHandler:makePolicyDecisionBlock(listener)];

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextPolicyDelegate.h (159386 => 159387)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextPolicyDelegate.h	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextPolicyDelegate.h	2013-11-17 20:30:43 UTC (rev 159387)
@@ -36,6 +36,7 @@
 WK_EXPORT extern NSString * const WKActionURLResponseKey;         // NSURLResponse
 WK_EXPORT extern NSString * const WKActionFrameNameKey;           // NSString
 WK_EXPORT extern NSString * const WKActionOriginatingFrameURLKey; // NSURL
+WK_EXPORT extern NSString * const WKActionCanShowMIMETypeKey;     // NSNumber (BOOL)
 
 typedef NS_ENUM(NSUInteger, WKNavigationType) {
     WKNavigationTypeLinkClicked,

Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (159386 => 159387)


--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp	2013-11-17 20:30:43 UTC (rev 159387)
@@ -443,9 +443,10 @@
         this, /* clientInfo */
         0, /* decidePolicyForNavigationAction_deprecatedForUseWithV0 */
         0, /* decidePolicyForNewWindowAction */
+        0, /* decidePolicyForResponse_deprecatedForUseWithV0 */
+        0, /* unableToImplementPolicy */
+        decidePolicyForNavigationAction,
         0, /* decidePolicyForResponse */
-        0, /* unableToImplementPolicy */
-        decidePolicyForNavigationAction
     };
 
     inspectorPage->initializePolicyClient(&policyClient);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (159386 => 159387)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-11-17 20:30:43 UTC (rev 159387)
@@ -2462,7 +2462,7 @@
         listener->use();
 }
 
-void WebPageProxy::decidePolicyForResponse(uint64_t frameID, const ResourceResponse& response, const ResourceRequest& request, uint64_t listenerID, CoreIPC::MessageDecoder& decoder)
+void WebPageProxy::decidePolicyForResponse(uint64_t frameID, const ResourceResponse& response, const ResourceRequest& request, bool canShowMIMEType, uint64_t listenerID, CoreIPC::MessageDecoder& decoder)
 {
     RefPtr<API::Object> userData;
     WebContextUserMessageDecoder messageDecoder(userData, m_process.get());
@@ -2476,11 +2476,11 @@
 
     RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
 
-    if (!m_policyClient.decidePolicyForResponse(this, frame, response, request, listener.get(), userData.get()))
+    if (!m_policyClient.decidePolicyForResponse(this, frame, response, request, canShowMIMEType, listener.get(), userData.get()))
         listener->use();
 }
 
-void WebPageProxy::decidePolicyForResponseSync(uint64_t frameID, const ResourceResponse& response, const ResourceRequest& request, uint64_t listenerID, CoreIPC::MessageDecoder& decoder, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID)
+void WebPageProxy::decidePolicyForResponseSync(uint64_t frameID, const ResourceResponse& response, const ResourceRequest& request, bool canShowMIMEType, uint64_t listenerID, CoreIPC::MessageDecoder& decoder, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID)
 {
     ASSERT(!m_inDecidePolicyForResponseSync);
 
@@ -2488,7 +2488,7 @@
     m_decidePolicyForResponseRequest = &request;
     m_syncMimeTypePolicyActionIsValid = false;
 
-    decidePolicyForResponse(frameID, response, request, listenerID, decoder);
+    decidePolicyForResponse(frameID, response, request, canShowMIMEType, listenerID, decoder);
 
     m_inDecidePolicyForResponseSync = false;
     m_decidePolicyForResponseRequest = 0;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (159386 => 159387)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-11-17 20:30:43 UTC (rev 159387)
@@ -791,8 +791,8 @@
 
     void decidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, uint64_t originatingFrameID, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::MessageDecoder&, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
     void decidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, const String& frameName, uint64_t listenerID, CoreIPC::MessageDecoder&);
-    void decidePolicyForResponse(uint64_t frameID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::MessageDecoder&);
-    void decidePolicyForResponseSync(uint64_t frameID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::MessageDecoder&, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
+    void decidePolicyForResponse(uint64_t frameID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool canShowMIMEType, uint64_t listenerID, CoreIPC::MessageDecoder&);
+    void decidePolicyForResponseSync(uint64_t frameID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool canShowMIMEType, uint64_t listenerID, CoreIPC::MessageDecoder&, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
     void unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::MessageDecoder&);
 
     void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const Vector<std::pair<String, String>>& textFieldValues, uint64_t listenerID, CoreIPC::MessageDecoder&);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (159386 => 159387)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2013-11-17 20:30:43 UTC (rev 159387)
@@ -96,7 +96,7 @@
 #endif
 
     # Policy messages
-    DecidePolicyForResponseSync(uint64_t frameID, WebCore::ResourceResponse response, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID) Variadic
+    DecidePolicyForResponseSync(uint64_t frameID, WebCore::ResourceResponse response, WebCore::ResourceRequest request, bool canShowMIMEType, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID) Variadic
     DecidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, uint64_t originatingFrameID, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID) Variadic
     DecidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WebCore::ResourceRequest request, WTF::String frameName, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) Variadic
     UnableToImplementPolicy(uint64_t frameID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData)  Variadic

Modified: trunk/Source/WebKit2/UIProcess/WebPolicyClient.cpp (159386 => 159387)


--- trunk/Source/WebKit2/UIProcess/WebPolicyClient.cpp	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Source/WebKit2/UIProcess/WebPolicyClient.cpp	2013-11-17 20:30:43 UTC (rev 159387)
@@ -60,15 +60,19 @@
     return true;
 }
 
-bool WebPolicyClient::decidePolicyForResponse(WebPageProxy* page, WebFrameProxy* frame, const ResourceResponse& resourceResponse, const ResourceRequest& resourceRequest, WebFramePolicyListenerProxy* listener, API::Object* userData)
+bool WebPolicyClient::decidePolicyForResponse(WebPageProxy* page, WebFrameProxy* frame, const ResourceResponse& resourceResponse, const ResourceRequest& resourceRequest, bool canShowMIMEType, WebFramePolicyListenerProxy* listener, API::Object* userData)
 {
-    if (!m_client.decidePolicyForResponse)
+    if (!m_client.decidePolicyForResponse_deprecatedForUseWithV0 && !m_client.decidePolicyForResponse)
         return false;
 
     RefPtr<WebURLResponse> response = WebURLResponse::create(resourceResponse);
     RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest);
 
-    m_client.decidePolicyForResponse(toAPI(page), toAPI(frame), toAPI(response.get()), toAPI(request.get()), toAPI(listener), toAPI(userData), m_client.clientInfo);
+    if (m_client.decidePolicyForResponse_deprecatedForUseWithV0)
+        m_client.decidePolicyForResponse_deprecatedForUseWithV0(toAPI(page), toAPI(frame), toAPI(response.get()), toAPI(request.get()), toAPI(listener), toAPI(userData), m_client.clientInfo);
+    else
+        m_client.decidePolicyForResponse(toAPI(page), toAPI(frame), toAPI(response.get()), toAPI(request.get()), canShowMIMEType, toAPI(listener), toAPI(userData), m_client.clientInfo);
+
     return true;
 }
 

Modified: trunk/Source/WebKit2/UIProcess/WebPolicyClient.h (159386 => 159387)


--- trunk/Source/WebKit2/UIProcess/WebPolicyClient.h	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Source/WebKit2/UIProcess/WebPolicyClient.h	2013-11-17 20:30:43 UTC (rev 159387)
@@ -52,7 +52,7 @@
 public:
     bool decidePolicyForNavigationAction(WebPageProxy*, WebFrameProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, WebFrameProxy* originatingFrame, const WebCore::ResourceRequest&, WebFramePolicyListenerProxy*, API::Object* userData);
     bool decidePolicyForNewWindowAction(WebPageProxy*, WebFrameProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, const WebCore::ResourceRequest&, const String& frameName, WebFramePolicyListenerProxy*, API::Object* userData);
-    bool decidePolicyForResponse(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, WebFramePolicyListenerProxy*, API::Object* userData);
+    bool decidePolicyForResponse(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool canShowMIMEType, WebFramePolicyListenerProxy*, API::Object* userData);
     void unableToImplementPolicy(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceError&, API::Object* userData);
 };
 

Modified: trunk/Source/WebKit2/UIProcess/efl/PagePolicyClientEfl.cpp (159386 => 159387)


--- trunk/Source/WebKit2/UIProcess/efl/PagePolicyClientEfl.cpp	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Source/WebKit2/UIProcess/efl/PagePolicyClientEfl.cpp	2013-11-17 20:30:43 UTC (rev 159387)
@@ -61,7 +61,7 @@
     policyClient->m_view->smartCallback<NewWindowPolicyDecision>().call(decision.get());
 }
 
-void PagePolicyClientEfl::decidePolicyForResponseCallback(WKPageRef, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef, WKFramePolicyListenerRef listener, WKTypeRef /*userData*/, const void* /*clientInfo*/)
+void PagePolicyClientEfl::decidePolicyForResponseCallback(WKPageRef, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef, bool canShowMIMEType, WKFramePolicyListenerRef listener, WKTypeRef /*userData*/, const void* /*clientInfo*/)
 {
     // Ignore responses with an HTTP status code of 204 (No Content)
     if (WKURLResponseHTTPStatusCode(response) == WebCore::HTTPNoContent) {

Modified: trunk/Source/WebKit2/UIProcess/efl/PagePolicyClientEfl.h (159386 => 159387)


--- trunk/Source/WebKit2/UIProcess/efl/PagePolicyClientEfl.h	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Source/WebKit2/UIProcess/efl/PagePolicyClientEfl.h	2013-11-17 20:30:43 UTC (rev 159387)
@@ -41,7 +41,7 @@
 private:
     static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKFrameRef, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef, const void*);
     static void decidePolicyForNewWindowAction(WKPageRef, WKFrameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKURLRequestRef, WKStringRef, WKFramePolicyListenerRef, WKTypeRef, const void*);
-    static void decidePolicyForResponseCallback(WKPageRef, WKFrameRef, WKURLResponseRef, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef, const void*);
+    static void decidePolicyForResponseCallback(WKPageRef, WKFrameRef, WKURLResponseRef, WKURLRequestRef, bool canShowMIMEType, WKFramePolicyListenerRef, WKTypeRef, const void*);
 
     EwkView* m_view;
 };

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (159386 => 159387)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2013-11-17 20:30:43 UTC (rev 159387)
@@ -638,13 +638,15 @@
         return;
     }
 
+    bool canShowMIMEType = webPage->canShowMIMEType(response.mimeType());
+
     uint64_t listenerID = m_frame->setUpPolicyListener(std::move(function));
     bool receivedPolicyAction;
     uint64_t policyAction;
     uint64_t downloadID;
 
     // Notify the UIProcess.
-    if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForResponseSync(m_frame->frameID(), response, request, listenerID, InjectedBundleUserMessageEncoder(userData.get())), Messages::WebPageProxy::DecidePolicyForResponseSync::Reply(receivedPolicyAction, policyAction, downloadID)))
+    if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForResponseSync(m_frame->frameID(), response, request, canShowMIMEType, listenerID, InjectedBundleUserMessageEncoder(userData.get())), Messages::WebPageProxy::DecidePolicyForResponseSync::Reply(receivedPolicyAction, policyAction, downloadID)))
         return;
 
     // We call this synchronously because CFNetwork can only convert a loading connection to a download from its didReceiveResponse callback.

Modified: trunk/Tools/ChangeLog (159386 => 159387)


--- trunk/Tools/ChangeLog	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Tools/ChangeLog	2013-11-17 20:30:43 UTC (rev 159387)
@@ -1,3 +1,22 @@
+2013-11-16  Dan Bernstein  <[email protected]>
+
+        No way for policy client to determine if a the response’s MIME type can be shown
+        https://bugs.webkit.org/show_bug.cgi?id=124445
+
+        Reviewed by Sam Weinig.
+
+        * MiniBrowser/mac/WK2BrowserWindowController.m:
+        (decidePolicyForResponse): Added canShowMIMEType parameter.
+        (-[WK2BrowserWindowController awakeFromNib]): Updated for changes in the policy client.
+
+        * TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp:
+        (TestWebKitAPI::decidePolicyForResponse): Added canShowMIMEType parameter.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::createWebViewWithOptions): Updated for changes in the policy client.
+        (WTR::TestController::decidePolicyForResponse): Added canShowMIMEType parameter.
+        * WebKitTestRunner/TestController.h:
+
 2013-11-16  Tim Horton  <[email protected]>
 
         Checkmarks are shifted down on iPhone at build.webkit.org/dashboard

Modified: trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m (159386 => 159387)


--- trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m	2013-11-17 20:30:43 UTC (rev 159387)
@@ -426,7 +426,7 @@
     WKFramePolicyListenerUse(listener);
 }
 
-static void decidePolicyForResponse(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
+static void decidePolicyForResponse(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, bool canShowMIMEType, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
 {
     WKFramePolicyListenerUse(listener);
 }
@@ -672,9 +672,10 @@
         self,       /* clientInfo */
         0,          /* decidePolicyForNavigationAction_deprecatedForUseWithV0 */
         decidePolicyForNewWindowAction,
-        decidePolicyForResponse,
+        0,          /* decidePolicyForResponse_deprecatedForUseWithV */
         0,          /* unableToImplementPolicy */
         decidePolicyForNavigationAction,
+        decidePolicyForResponse,
     };
     WKPageSetPagePolicyClient(_webView.pageRef, &policyClient);
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp (159386 => 159387)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp	2013-11-17 20:30:43 UTC (rev 159387)
@@ -103,7 +103,7 @@
     WKFramePolicyListenerUse(listener);
 }
 
-static void decidePolicyForResponse(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
+static void decidePolicyForResponse(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, bool canShowMIMEType, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
 {
     WKFramePolicyListenerUse(listener);
 }

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (159386 => 159387)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2013-11-17 20:30:43 UTC (rev 159387)
@@ -490,9 +490,10 @@
         this,
         0, // decidePolicyForNavigationAction_deprecatedForUseWithV0
         0, // decidePolicyForNewWindowAction
-        decidePolicyForResponse,
+        0, // decidePolicyForResponse_deprecatedForUseWithV0
         0, // unableToImplementPolicy
         decidePolicyForNavigationAction,
+        decidePolicyForResponse,
     };
     WKPageSetPagePolicyClient(m_mainWebView->page(), &pagePolicyClient);
 
@@ -1232,7 +1233,7 @@
     WKFramePolicyListenerUse(listener);
 }
 
-void TestController::decidePolicyForResponse(WKPageRef, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef, WKFramePolicyListenerRef listener, WKTypeRef, const void* clientInfo)
+void TestController::decidePolicyForResponse(WKPageRef, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef, bool canShowMIMEType, WKFramePolicyListenerRef listener, WKTypeRef, const void* clientInfo)
 {
     static_cast<TestController*>(const_cast<void*>(clientInfo))->decidePolicyForResponse(frame, response, listener);
 }

Modified: trunk/Tools/WebKitTestRunner/TestController.h (159386 => 159387)


--- trunk/Tools/WebKitTestRunner/TestController.h	2013-11-17 18:25:34 UTC (rev 159386)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2013-11-17 20:30:43 UTC (rev 159387)
@@ -155,7 +155,7 @@
     static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKFrameRef, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef, const void*);
     void decidePolicyForNavigationAction(WKFramePolicyListenerRef);
 
-    static void decidePolicyForResponse(WKPageRef, WKFrameRef, WKURLResponseRef, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef, const void*);
+    static void decidePolicyForResponse(WKPageRef, WKFrameRef, WKURLResponseRef, WKURLRequestRef, bool canShowMIMEType, WKFramePolicyListenerRef, WKTypeRef, const void*);
     void decidePolicyForResponse(WKFrameRef, WKURLResponseRef, WKFramePolicyListenerRef);
 
     static WKPageRef createOtherPage(WKPageRef oldPage, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to