Title: [238685] trunk/Source
Revision
238685
Author
[email protected]
Date
2018-11-29 12:52:46 -0800 (Thu, 29 Nov 2018)

Log Message

Modernize the check for kCFURLRequestContentDecoderSkipURLCheck existence
https://bugs.webkit.org/show_bug.cgi?id=192041

Reviewed by Tim Horton.

Source/WebCore:

* loader/ResourceLoaderOptions.h: Added a FIXME for poor naming of loader options.
There is a lot of code that needs to be cleaned up here.

* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::applySniffingPoliciesIfNeeded):

Source/WebCore/PAL:

* pal/spi/cf/CFNetworkSPI.h:

Source/WebKit:

* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):

Source/WTF:

* wtf/Platform.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (238684 => 238685)


--- trunk/Source/WTF/ChangeLog	2018-11-29 20:42:58 UTC (rev 238684)
+++ trunk/Source/WTF/ChangeLog	2018-11-29 20:52:46 UTC (rev 238685)
@@ -1,3 +1,12 @@
+2018-11-29  Alexey Proskuryakov  <[email protected]>
+
+        Modernize the check for kCFURLRequestContentDecoderSkipURLCheck existence
+        https://bugs.webkit.org/show_bug.cgi?id=192041
+
+        Reviewed by Tim Horton.
+
+        * wtf/Platform.h:
+
 2018-11-28  Mark Lam  <[email protected]>
 
         ENABLE_SEPARATED_WX_HEAP needs to be defined in Platform.h.

Modified: trunk/Source/WTF/wtf/Platform.h (238684 => 238685)


--- trunk/Source/WTF/wtf/Platform.h	2018-11-29 20:42:58 UTC (rev 238684)
+++ trunk/Source/WTF/wtf/Platform.h	2018-11-29 20:52:46 UTC (rev 238685)
@@ -1397,3 +1397,12 @@
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED < 101400
 #define HAVE_NSHTTPCOOKIESTORAGE__INITWITHIDENTIFIER_WITH_INACCURATE_NULLABILITY 1
 #endif
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101302 && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || PLATFORM(IOS_FAMILY)
+#define HAVE_CFNETWORK_WITH_CONTENT_ENCODING_SNIFFING_OVERRIDE 1
+/* The override isn't needed on iOS family, as the default behavior is to not sniff. */
+/* FIXME: This should probably be enabled on 10.13.2 and newer, not just 10.14 and newer. */
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+#define USE_CFNETWORK_CONTENT_ENCODING_SNIFFING_OVERRIDE 1
+#endif
+#endif

Modified: trunk/Source/WebCore/ChangeLog (238684 => 238685)


--- trunk/Source/WebCore/ChangeLog	2018-11-29 20:42:58 UTC (rev 238684)
+++ trunk/Source/WebCore/ChangeLog	2018-11-29 20:52:46 UTC (rev 238685)
@@ -1,3 +1,16 @@
+2018-11-29  Alexey Proskuryakov  <[email protected]>
+
+        Modernize the check for kCFURLRequestContentDecoderSkipURLCheck existence
+        https://bugs.webkit.org/show_bug.cgi?id=192041
+
+        Reviewed by Tim Horton.
+
+        * loader/ResourceLoaderOptions.h: Added a FIXME for poor naming of loader options.
+        There is a lot of code that needs to be cleaned up here.
+
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::applySniffingPoliciesIfNeeded):
+
 2018-11-29  Youenn Fablet  <[email protected]>
 
         Updating a service worker during a navigation load sometimes makes the load fail

Modified: trunk/Source/WebCore/PAL/ChangeLog (238684 => 238685)


--- trunk/Source/WebCore/PAL/ChangeLog	2018-11-29 20:42:58 UTC (rev 238684)
+++ trunk/Source/WebCore/PAL/ChangeLog	2018-11-29 20:52:46 UTC (rev 238685)
@@ -1,3 +1,12 @@
+2018-11-29  Alexey Proskuryakov  <[email protected]>
+
+        Modernize the check for kCFURLRequestContentDecoderSkipURLCheck existence
+        https://bugs.webkit.org/show_bug.cgi?id=192041
+
+        Reviewed by Tim Horton.
+
+        * pal/spi/cf/CFNetworkSPI.h:
+
 2018-11-29  Ryan Haddad  <[email protected]>
 
         Unreviewed, rolling out r238678.

Modified: trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h (238684 => 238685)


--- trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h	2018-11-29 20:42:58 UTC (rev 238684)
+++ trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h	2018-11-29 20:52:46 UTC (rev 238685)
@@ -265,7 +265,7 @@
 extern const CFStringRef _kCFURLConnectionPropertyShouldSniff;
 extern const CFStringRef _kCFURLStorageSessionIsPrivate;
 
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+#if HAVE(CFNETWORK_WITH_CONTENT_ENCODING_SNIFFING_OVERRIDE)
 extern const CFStringRef kCFURLRequestContentDecoderSkipURLCheck;
 #endif
 

Modified: trunk/Source/WebCore/loader/ResourceLoaderOptions.h (238684 => 238685)


--- trunk/Source/WebCore/loader/ResourceLoaderOptions.h	2018-11-29 20:42:58 UTC (rev 238684)
+++ trunk/Source/WebCore/loader/ResourceLoaderOptions.h	2018-11-29 20:52:46 UTC (rev 238685)
@@ -46,6 +46,8 @@
     DoNotSendCallbacks
 };
 
+// FIXME: These options are named poorly. We only implement force disabling content sniffing, not enabling it,
+// and even that only on some platforms.
 enum class ContentSniffingPolicy : uint8_t {
     SniffContent,
     DoNotSniffContent
@@ -107,6 +109,8 @@
     Bypass
 };
 
+// FIXME: These options are named poorly. We only implement force disabling content encoding sniffing, not enabling it,
+// and even that only on some platforms.
 enum class ContentEncodingSniffingPolicy : uint8_t {
     Sniff,
     DoNotSniff,

Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (238684 => 238685)


--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2018-11-29 20:42:58 UTC (rev 238684)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2018-11-29 20:52:46 UTC (rev 238685)
@@ -109,17 +109,20 @@
 
 NSURLRequest *ResourceHandle::applySniffingPoliciesIfNeeded(NSURLRequest *request, bool shouldContentSniff, bool shouldContentEncodingSniff)
 {
-#if !PLATFORM(MAC)
+#if !USE(CFNETWORK_CONTENT_ENCODING_SNIFFING_OVERRIDE)
     UNUSED_PARAM(shouldContentEncodingSniff);
-#elif __MAC_OS_X_VERSION_MIN_REQUIRED < 101302
-    shouldContentEncodingSniff = true;
 #endif
-    if (shouldContentSniff && shouldContentEncodingSniff)
+
+    if (shouldContentSniff
+#if USE(CFNETWORK_CONTENT_ENCODING_SNIFFING_OVERRIDE)
+        && shouldContentEncodingSniff
+#endif
+        )
         return request;
 
     auto mutableRequest = adoptNS([request mutableCopy]);
 
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101302
+#if USE(CFNETWORK_CONTENT_ENCODING_SNIFFING_OVERRIDE)
     if (!shouldContentEncodingSniff)
         [mutableRequest _setProperty:@(YES) forKey:(__bridge NSString *)kCFURLRequestContentDecoderSkipURLCheck];
 #endif

Modified: trunk/Source/WebKit/ChangeLog (238684 => 238685)


--- trunk/Source/WebKit/ChangeLog	2018-11-29 20:42:58 UTC (rev 238684)
+++ trunk/Source/WebKit/ChangeLog	2018-11-29 20:52:46 UTC (rev 238685)
@@ -1,3 +1,13 @@
+2018-11-29  Alexey Proskuryakov  <[email protected]>
+
+        Modernize the check for kCFURLRequestContentDecoderSkipURLCheck existence
+        https://bugs.webkit.org/show_bug.cgi?id=192041
+
+        Reviewed by Tim Horton.
+
+        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+        (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
+
 2018-11-29  Ryan Haddad  <[email protected]>
 
         Unreviewed, rolling out r238678.

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (238684 => 238685)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2018-11-29 20:42:58 UTC (rev 238684)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2018-11-29 20:52:46 UTC (rev 238685)
@@ -81,14 +81,15 @@
 
 void NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded(__strong NSURLRequest *& nsRequest, bool shouldContentSniff, bool shouldContentEncodingSniff)
 {
-#if !PLATFORM(MAC)
+#if !USE(CFNETWORK_CONTENT_ENCODING_SNIFFING_OVERRIDE)
     UNUSED_PARAM(shouldContentEncodingSniff);
-#elif __MAC_OS_X_VERSION_MIN_REQUIRED < 101400
-    shouldContentEncodingSniff = true;
 #endif
+
     auto& cocoaSession = static_cast<NetworkSessionCocoa&>(m_session.get());
     if (shouldContentSniff
+#if USE(CFNETWORK_CONTENT_ENCODING_SNIFFING_OVERRIDE)
         && shouldContentEncodingSniff
+#endif
         && cocoaSession.m_boundInterfaceIdentifier.isNull()
         && !cocoaSession.m_proxyConfiguration)
         return;
@@ -95,7 +96,7 @@
 
     auto mutableRequest = adoptNS([nsRequest mutableCopy]);
 
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+#if USE(CFNETWORK_CONTENT_ENCODING_SNIFFING_OVERRIDE)
     if (!shouldContentEncodingSniff)
         [mutableRequest _setProperty:@(YES) forKey:(NSString *)kCFURLRequestContentDecoderSkipURLCheck];
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to