Diff
Modified: trunk/Source/WebKit2/ChangeLog (97607 => 97608)
--- trunk/Source/WebKit2/ChangeLog 2011-10-17 12:35:05 UTC (rev 97607)
+++ trunk/Source/WebKit2/ChangeLog 2011-10-17 12:41:23 UTC (rev 97608)
@@ -1,3 +1,24 @@
+2011-10-14 Jesus Sanchez-Palencia <jesus.palen...@openbossa.org>
+
+ [Qt][WK2] Implement decidePolicyForResponse in our PolicyClient
+ https://bugs.webkit.org/show_bug.cgi?id=69832
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ We implement decidePolicyForResponse in our PolicyClient in order to
+ decide whether a given ResourceResponse should be downloaded or loaded.
+
+ * Shared/qt/WebCoreArgumentCodersQt.cpp:
+ (CoreIPC::::encode):
+ (CoreIPC::::decode):
+ Implement serialization of ResourceResponse.
+
+ * UIProcess/qt/ClientImpl.cpp:
+ (qt_wk_decidePolicyForResponse):
+ * UIProcess/qt/ClientImpl.h:
+ * UIProcess/qt/QtWebPageProxy.cpp:
+ (QtWebPageProxy::init):
+
2011-10-17 Nayan Kumar K <naya...@motorola.com>
[WebKit2][gtk] Rename WEBKIT_POLICY_ERROR_CANNOT_SHOW_URL to WEBKIT_POLICY_ERROR_CANNOT_SHOW_URI
Modified: trunk/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp (97607 => 97608)
--- trunk/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp 2011-10-17 12:35:05 UTC (rev 97607)
+++ trunk/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp 2011-10-17 12:41:23 UTC (rev 97608)
@@ -26,7 +26,6 @@
#include "config.h"
#include "WebCoreArgumentCoders.h"
-#include <WebCore/NotImplemented.h>
#include <WebCore/ResourceError.h>
#include <WebCore/ResourceRequest.h>
#include <WebCore/ResourceResponse.h>
@@ -58,15 +57,37 @@
void ArgumentCoder<ResourceResponse>::encode(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse)
{
- notImplemented();
+ encoder->encode(resourceResponse.url().string());
+ encoder->encode(resourceResponse.mimeType());
+ encoder->encode(static_cast<int64_t>(resourceResponse.expectedContentLength()));
+ encoder->encode(resourceResponse.textEncodingName());
}
bool ArgumentCoder<ResourceResponse>::decode(ArgumentDecoder* decoder, ResourceResponse& resourceResponse)
{
- notImplemented();
+ ResourceResponse response;
- // FIXME: Ditto.
- resourceResponse = ResourceResponse();
+ String url;
+ if (!decoder->decode(url))
+ return false;
+ response.setURL(KURL(WebCore::ParsedURLString, url));
+
+ String mimeType;
+ if (!decoder->decode(mimeType))
+ return false;
+ response.setMimeType(mimeType);
+
+ int64_t contentLength;
+ if (!decoder->decode(contentLength))
+ return false;
+ response.setExpectedContentLength(contentLength);
+
+ String textEncodingName;
+ if (!decoder->decode(textEncodingName))
+ return false;
+ response.setTextEncodingName(textEncodingName);
+
+ resourceResponse = response;
return true;
}
Modified: trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp (97607 => 97608)
--- trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp 2011-10-17 12:35:05 UTC (rev 97607)
+++ trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp 2011-10-17 12:41:23 UTC (rev 97608)
@@ -252,3 +252,30 @@
break;
}
}
+
+void qt_wk_decidePolicyForResponse(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
+{
+ String type = toImpl(response)->resourceResponse().mimeType();
+ type.makeLower();
+ bool canShowMIMEType = toImpl(frame)->canShowMIMEType(type);
+
+ if (WKPageGetMainFrame(page) == frame) {
+ if (canShowMIMEType) {
+ WKFramePolicyListenerUse(listener);
+ return;
+ }
+
+ // If we can't use (show) it then we should download it.
+ WKFramePolicyListenerDownload(listener);
+ return;
+ }
+
+ // We should ignore downloadable top-level content for subframes, with an exception for text/xml and application/xml so we can still support Acid3 test.
+ // It makes the browser intentionally behave differently when it comes to text(application)/xml content in subframes vs. mainframe.
+ if (!canShowMIMEType && !(type == "text/xml" || type == "application/xml")) {
+ WKFramePolicyListenerIgnore(listener);
+ return;
+ }
+
+ WKFramePolicyListenerUse(listener);
+}
Modified: trunk/Source/WebKit2/UIProcess/qt/ClientImpl.h (97607 => 97608)
--- trunk/Source/WebKit2/UIProcess/qt/ClientImpl.h 2011-10-17 12:35:05 UTC (rev 97607)
+++ trunk/Source/WebKit2/UIProcess/qt/ClientImpl.h 2011-10-17 12:41:23 UTC (rev 97608)
@@ -48,6 +48,7 @@
// Policy client.
void qt_wk_decidePolicyForNavigationAction(WKPageRef, WKFrameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef userData, const void* clientInfo);
+void qt_wk_decidePolicyForResponse(WKPageRef, WKFrameRef, WKURLResponseRef, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef userData, const void* clientInfo);
#ifdef __cplusplus
}
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp (97607 => 97608)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp 2011-10-17 12:35:05 UTC (rev 97607)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp 2011-10-17 12:41:23 UTC (rev 97608)
@@ -156,6 +156,7 @@
policyClient.version = kWKPagePolicyClientCurrentVersion;
policyClient.clientInfo = m_policyInterface;
policyClient.decidePolicyForNavigationAction = qt_wk_decidePolicyForNavigationAction;
+ policyClient.decidePolicyForResponse = qt_wk_decidePolicyForResponse;
WKPageSetPagePolicyClient(toAPI(m_webPageProxy.get()), &policyClient);
}
}