Title: [97375] trunk/Source/WebKit2
- Revision
- 97375
- Author
- [email protected]
- Date
- 2011-10-13 11:44:02 -0700 (Thu, 13 Oct 2011)
Log Message
[Qt][WK2] Implement decidePolicyForResponse in our PolicyClient
https://bugs.webkit.org/show_bug.cgi?id=69832
Patch by Jesus Sanchez-Palencia <[email protected]> on 2011-10-13
Reviewed by Kenneth Rohde Christiansen.
We implement decidePolicyForResponse in our PolicyClient in order to
decide whether a given ResourceResponse should be downloaded or loaded.
* UIProcess/qt/ClientImpl.cpp:
(qt_wk_decidePolicyForResponse):
* UIProcess/qt/ClientImpl.h:
* UIProcess/qt/QtWebPageProxy.cpp:
(QtWebPageProxy::init):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (97374 => 97375)
--- trunk/Source/WebKit2/ChangeLog 2011-10-13 18:31:26 UTC (rev 97374)
+++ trunk/Source/WebKit2/ChangeLog 2011-10-13 18:44:02 UTC (rev 97375)
@@ -1,3 +1,19 @@
+2011-10-13 Jesus Sanchez-Palencia <[email protected]>
+
+ [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.
+
+ * UIProcess/qt/ClientImpl.cpp:
+ (qt_wk_decidePolicyForResponse):
+ * UIProcess/qt/ClientImpl.h:
+ * UIProcess/qt/QtWebPageProxy.cpp:
+ (QtWebPageProxy::init):
+
2011-10-13 Carlos Garcia Campos <[email protected]>
[GTK] Add WebKitTestServer class to WebKit2 GTK+ unit tests library
Modified: trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp (97374 => 97375)
--- trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp 2011-10-13 18:31:26 UTC (rev 97374)
+++ trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp 2011-10-13 18:44:02 UTC (rev 97375)
@@ -247,3 +247,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 (97374 => 97375)
--- trunk/Source/WebKit2/UIProcess/qt/ClientImpl.h 2011-10-13 18:31:26 UTC (rev 97374)
+++ trunk/Source/WebKit2/UIProcess/qt/ClientImpl.h 2011-10-13 18:44:02 UTC (rev 97375)
@@ -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 (97374 => 97375)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp 2011-10-13 18:31:26 UTC (rev 97374)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp 2011-10-13 18:44:02 UTC (rev 97375)
@@ -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);
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes