Commit 8f11b919 authored by mitz@apple.com's avatar mitz@apple.com

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:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159387 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a90902e8
2013-11-16 Dan Bernstein <mitz@apple.com>
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 <ryuan.choi@samsung.com>
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.
......
......@@ -346,10 +346,10 @@ void callMemberFunction(std::tuple<P1, P2, P3, P4, P5, P6, P7>&& args, MessageDe
// 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>
......
......@@ -150,22 +150,24 @@ enum { kWKPageLoaderClientCurrentVersion = 3 };
// 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;
......
......@@ -82,6 +82,7 @@ NSString * const WKActionURLRequestKey = @"WKActionURLRequestKey";
NSString * const WKActionURLResponseKey = @"WKActionURLResponseKey";
NSString * const WKActionFrameNameKey = @"WKActionFrameNameKey";
NSString * const WKActionOriginatingFrameURLKey = @"WKActionOriginatingFrameURLKey";
NSString * const WKActionCanShowMIMETypeKey = @"WKActionCanShowMIMETypeKey";
@interface WKBrowsingContextControllerData : NSObject {
@public
......@@ -663,14 +664,15 @@ static void setUpPagePolicyClient(WKBrowsingContextController *browsingContext,
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)];
......
......@@ -36,6 +36,7 @@ WK_EXPORT extern NSString * const WKActionURLRequestKey; // NSURLReques
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,
......
......@@ -443,9 +443,10 @@ void WebInspectorProxy::createInspectorPage(uint64_t& inspectorPageID, WebPageCr
this, /* clientInfo */
0, /* decidePolicyForNavigationAction_deprecatedForUseWithV0 */
0, /* decidePolicyForNewWindowAction */
0, /* decidePolicyForResponse */
0, /* decidePolicyForResponse_deprecatedForUseWithV0 */
0, /* unableToImplementPolicy */
decidePolicyForNavigationAction
decidePolicyForNavigationAction,
0, /* decidePolicyForResponse */
};
inspectorPage->initializePolicyClient(&policyClient);
......
......@@ -2462,7 +2462,7 @@ void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, uint32_t opa
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 @@ void WebPageProxy::decidePolicyForResponse(uint64_t frameID, const ResourceRespo
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 @@ void WebPageProxy::decidePolicyForResponseSync(uint64_t frameID, const ResourceR
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;
......
......@@ -791,8 +791,8 @@ private:
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&);
......
......@@ -96,7 +96,7 @@ messages -> WebPageProxy {
#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
......
......@@ -60,15 +60,19 @@ bool WebPolicyClient::decidePolicyForNewWindowAction(WebPageProxy* page, WebFram
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;
}
......
......@@ -52,7 +52,7 @@ class WebPolicyClient : public APIClient<WKPagePolicyClient, kWKPagePolicyClient
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);
};
......
......@@ -61,7 +61,7 @@ void PagePolicyClientEfl::decidePolicyForNewWindowAction(WKPageRef, WKFrameRef,
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) {
......
......@@ -41,7 +41,7 @@ public:
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;
};
......
......@@ -638,13 +638,15 @@ void WebFrameLoaderClient::dispatchDecidePolicyForResponse(const ResourceRespons
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.
......
2013-11-16 Dan Bernstein <mitz@apple.com>
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 <timothy_horton@apple.com>
Checkmarks are shifted down on iPhone at build.webkit.org/dashboard
......
......@@ -426,7 +426,7 @@ static void decidePolicyForNewWindowAction(WKPageRef page, WKFrameRef frame, WKF
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 @@ - (void)awakeFromNib
self, /* clientInfo */
0, /* decidePolicyForNavigationAction_deprecatedForUseWithV0 */
decidePolicyForNewWindowAction,
decidePolicyForResponse,
0, /* decidePolicyForResponse_deprecatedForUseWithV */
0, /* unableToImplementPolicy */
decidePolicyForNavigationAction,
decidePolicyForResponse,
};
WKPageSetPagePolicyClient(_webView.pageRef, &policyClient);
......
......@@ -103,7 +103,7 @@ static void decidePolicyForNewWindowAction(WKPageRef page, WKFrameRef frame, WKF
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);
}
......
......@@ -490,9 +490,10 @@ void TestController::createWebViewWithOptions(WKDictionaryRef options)
this,
0, // decidePolicyForNavigationAction_deprecatedForUseWithV0
0, // decidePolicyForNewWindowAction
decidePolicyForResponse,
0, // decidePolicyForResponse_deprecatedForUseWithV0
0, // unableToImplementPolicy
decidePolicyForNavigationAction,
decidePolicyForResponse,
};
WKPageSetPagePolicyClient(m_mainWebView->page(), &pagePolicyClient);
......@@ -1232,7 +1233,7 @@ void TestController::decidePolicyForNavigationAction(WKFramePolicyListenerRef li
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);
}
......
......@@ -155,7 +155,7 @@ private:
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*);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment