Title: [129479] trunk
Revision
129479
Author
[email protected]
Date
2012-09-25 02:19:57 -0700 (Tue, 25 Sep 2012)

Log Message

[WK2][WTR] WTR bundle client loads binary data as text
https://bugs.webkit.org/show_bug.cgi?id=97532

Patch by Mikhail Pozdnyakov <[email protected]> on 2012-09-25
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

Added WKBundlePageCanShowMIMEType() function to WKBundlePage private API.
This function is put to WKBundlePage to keep consistency with WebKit::WebPageProxy::canShowMIMEType().
Actually it does not need anything from page.

* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageCanShowMIMEType):
* WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:

Tools:

WTR::InjectedBundlePage::decidePolicyForResponse now checks response MIME type
and returns WKBundlePagePolicyActionPassThrough if it cannot be shown.

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::decidePolicyForResponse):

LayoutTests:

Unskipped http/tests/loading/text-content-type-with-binary-extension.html for WK2.

* platform/efl-wk1/TestExpectations:
* platform/efl/TestExpectations:
* platform/wk2/Skipped:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (129478 => 129479)


--- trunk/LayoutTests/ChangeLog	2012-09-25 09:09:58 UTC (rev 129478)
+++ trunk/LayoutTests/ChangeLog	2012-09-25 09:19:57 UTC (rev 129479)
@@ -1,3 +1,16 @@
+2012-09-25  Mikhail Pozdnyakov  <[email protected]>
+
+        [WK2][WTR] WTR bundle client loads binary data as text
+        https://bugs.webkit.org/show_bug.cgi?id=97532
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Unskipped http/tests/loading/text-content-type-with-binary-extension.html for WK2.
+
+        * platform/efl-wk1/TestExpectations:
+        * platform/efl/TestExpectations:
+        * platform/wk2/Skipped:
+
 2012-09-20  Alexander Pavlov  <[email protected]>
 
         Web Inspector: Relative URL Link Tooltips do not respect <base>

Modified: trunk/LayoutTests/platform/efl/TestExpectations (129478 => 129479)


--- trunk/LayoutTests/platform/efl/TestExpectations	2012-09-25 09:09:58 UTC (rev 129478)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2012-09-25 09:19:57 UTC (rev 129479)
@@ -1157,9 +1157,5 @@
 # Fails after r129175.
 webkit.org/b/97296 fast/text/international/hebrew-selection.html [ ImageOnlyFailure ]
 
-# Fail after r128393.
-webkit.org/b/96620 http/tests/loading/pdf-commit-load-callbacks.html [ Failure ]
-webkit.org/b/96620 http/tests/loading/text-content-type-with-binary-extension.html [ Failure ]
-
 # Frame does not get focus as expected
 webkit.org/b/97077 inspector/extensions/extensions-panel.html [ Failure ]

Modified: trunk/LayoutTests/platform/efl-wk1/TestExpectations (129478 => 129479)


--- trunk/LayoutTests/platform/efl-wk1/TestExpectations	2012-09-25 09:09:58 UTC (rev 129478)
+++ trunk/LayoutTests/platform/efl-wk1/TestExpectations	2012-09-25 09:19:57 UTC (rev 129479)
@@ -105,3 +105,6 @@
 # scrolling with fixed position does not work correctly when using ewk_view_tiled. 
 webkit.org/b/84933 compositing/geometry/fixed-position.html [ ImageOnlyFailure Pass ]
 
+# Fail after r128393.
+webkit.org/b/96620 http/tests/loading/pdf-commit-load-callbacks.html [ Failure ]
+webkit.org/b/96620 http/tests/loading/text-content-type-with-binary-extension.html [ Failure ]

Modified: trunk/LayoutTests/platform/wk2/Skipped (129478 => 129479)


--- trunk/LayoutTests/platform/wk2/Skipped	2012-09-25 09:09:58 UTC (rev 129478)
+++ trunk/LayoutTests/platform/wk2/Skipped	2012-09-25 09:19:57 UTC (rev 129479)
@@ -809,7 +809,6 @@
 # Should pass now on ports other than EFL and GTK.
 # But it needs to be checked first.
 http/tests/loading/bad-scheme-subframe.html
-http/tests/loading/text-content-type-with-binary-extension.html
 
 # Some elements are skipped when focus is moved.
 fast/spatial-navigation/snav-container-white-space.html

Modified: trunk/Source/WebKit2/ChangeLog (129478 => 129479)


--- trunk/Source/WebKit2/ChangeLog	2012-09-25 09:09:58 UTC (rev 129478)
+++ trunk/Source/WebKit2/ChangeLog	2012-09-25 09:19:57 UTC (rev 129479)
@@ -1,3 +1,18 @@
+2012-09-25  Mikhail Pozdnyakov  <[email protected]>
+
+        [WK2][WTR] WTR bundle client loads binary data as text
+        https://bugs.webkit.org/show_bug.cgi?id=97532
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Added WKBundlePageCanShowMIMEType() function to WKBundlePage private API.
+        This function is put to WKBundlePage to keep consistency with WebKit::WebPageProxy::canShowMIMEType().
+        Actually it does not need anything from page.
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKBundlePageCanShowMIMEType):
+        * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
+
 2012-09-25  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Don't use the C API internally in WebKitWebView

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (129478 => 129479)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2012-09-25 09:09:58 UTC (rev 129478)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2012-09-25 09:19:57 UTC (rev 129479)
@@ -44,6 +44,7 @@
 #include <WebCore/AccessibilityObject.h>
 #include <WebCore/Frame.h>
 #include <WebCore/KURL.h>
+#include <WebCore/MIMETypeRegistry.h>
 #include <WebCore/Page.h>
 
 #if ENABLE(WEB_INTENTS)
@@ -413,3 +414,21 @@
 {
     toImpl(pageRef)->confirmCompositionForTesting(toImpl(text)->string());
 }
+
+bool WKBundlePageCanShowMIMEType(WKBundlePageRef, WKStringRef mimeTypeRef)
+{
+    using WebCore::MIMETypeRegistry;
+
+    const WTF::String mimeType = toImpl(mimeTypeRef)->string();
+
+    if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType))
+        return true;
+
+    if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
+        return true;
+
+    if (mimeType.startsWith("text/", false))
+        return !MIMETypeRegistry::isUnsupportedTextMIMEType(mimeType);
+
+    return false;
+}

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h (129478 => 129479)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h	2012-09-25 09:09:58 UTC (rev 129478)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h	2012-09-25 09:19:57 UTC (rev 129479)
@@ -71,8 +71,10 @@
 WK_EXPORT void WKBundlePageConfirmComposition(WKBundlePageRef page);
 WK_EXPORT void WKBundlePageConfirmCompositionWithText(WKBundlePageRef page, WKStringRef text);
 
+WK_EXPORT bool WKBundlePageCanShowMIMEType(WKBundlePageRef, WKStringRef mimeType);
+
 WK_EXPORT void* WKAccessibilityRootObject(WKBundlePageRef);
-WK_EXPORT void* WKAccessibilityFocusedObject(WKBundlePageRef);    
+WK_EXPORT void* WKAccessibilityFocusedObject(WKBundlePageRef);
 
 #ifdef __cplusplus
 }

Modified: trunk/Tools/ChangeLog (129478 => 129479)


--- trunk/Tools/ChangeLog	2012-09-25 09:09:58 UTC (rev 129478)
+++ trunk/Tools/ChangeLog	2012-09-25 09:19:57 UTC (rev 129479)
@@ -1,3 +1,16 @@
+2012-09-25  Mikhail Pozdnyakov  <[email protected]>
+
+        [WK2][WTR] WTR bundle client loads binary data as text
+        https://bugs.webkit.org/show_bug.cgi?id=97532
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        WTR::InjectedBundlePage::decidePolicyForResponse now checks response MIME type
+        and returns WKBundlePagePolicyActionPassThrough if it cannot be shown.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::decidePolicyForResponse):
+
 2012-09-25  Zan Dobersek  <[email protected]>
 
         Unreviewed, another test case adjustment after r129459. Python 2.7 doesn't

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (129478 => 129479)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-09-25 09:09:58 UTC (rev 129478)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-09-25 09:19:57 UTC (rev 129479)
@@ -1319,9 +1319,10 @@
     return WKBundlePagePolicyActionUse;
 }
 
-WKBundlePagePolicyAction InjectedBundlePage::decidePolicyForResponse(WKBundlePageRef, WKBundleFrameRef, WKURLResponseRef, WKURLRequestRef, WKTypeRef*)
+WKBundlePagePolicyAction InjectedBundlePage::decidePolicyForResponse(WKBundlePageRef page, WKBundleFrameRef, WKURLResponseRef response, WKURLRequestRef, WKTypeRef*)
 {
-    return WKBundlePagePolicyActionUse;
+    WKRetainPtr<WKStringRef> mimeType = adoptWK(WKURLResponseCopyMIMEType(response));
+    return WKBundlePageCanShowMIMEType(page, mimeType.get()) ? WKBundlePagePolicyActionUse : WKBundlePagePolicyActionPassThrough;
 }
 
 void InjectedBundlePage::unableToImplementPolicy(WKBundlePageRef, WKBundleFrameRef, WKErrorRef, WKTypeRef*)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to