Title: [230467] trunk/Source
Revision
230467
Author
wilan...@apple.com
Date
2018-04-09 20:43:46 -0700 (Mon, 09 Apr 2018)

Log Message

Refactor Ignore HSTS code
https://bugs.webkit.org/show_bug.cgi?id=184433
<rdar://problem/39298238>

Reviewed by Darin Adler.

This patch refactors our ignore HSTS code. The convenience functions are moved
out of CFNetwork SPI in PAL, and into where they are used. It also switches
from performSelector: calls to straight function calls, after checking that
there is a responder.

Source/WebCore:

* platform/network/mac/WebCoreURLResponse.mm:
(WebCore::schemeWasUpgradedDueToDynamicHSTS):
    Add convenience function here since it was moved out of
    CFNetworkSPI.h.

Source/WebCore/PAL:

* pal/spi/cf/CFNetworkSPI.h:
(schemeWasUpgradedDueToDynamicHSTS): Deleted.
(setIgnoreHSTS): Deleted.
(ignoreHSTS): Deleted.

Source/WebKit:

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(schemeWasUpgradedDueToDynamicHSTS):
(setIgnoreHSTS):
(ignoreHSTS):
    Add convenience functions here since they were moved out of
    CFNetworkSPI.h.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (230466 => 230467)


--- trunk/Source/WebCore/ChangeLog	2018-04-10 03:03:28 UTC (rev 230466)
+++ trunk/Source/WebCore/ChangeLog	2018-04-10 03:43:46 UTC (rev 230467)
@@ -1,3 +1,21 @@
+2018-04-09  John Wilander  <wilan...@apple.com>
+
+        Refactor Ignore HSTS code
+        https://bugs.webkit.org/show_bug.cgi?id=184433
+        <rdar://problem/39298238>
+
+        Reviewed by Darin Adler.
+
+        This patch refactors our ignore HSTS code. The convenience functions are moved
+        out of CFNetwork SPI in PAL, and into where they are used. It also switches
+        from performSelector: calls to straight function calls, after checking that
+        there is a responder.
+
+        * platform/network/mac/WebCoreURLResponse.mm:
+        (WebCore::schemeWasUpgradedDueToDynamicHSTS):
+            Add convenience function here since it was moved out of
+            CFNetworkSPI.h.
+
 2018-04-09  Brady Eidson  <beid...@apple.com>
 
         Expand WebCore policy concept of "shouldContinue" to allow for more than true/false

Modified: trunk/Source/WebCore/PAL/ChangeLog (230466 => 230467)


--- trunk/Source/WebCore/PAL/ChangeLog	2018-04-10 03:03:28 UTC (rev 230466)
+++ trunk/Source/WebCore/PAL/ChangeLog	2018-04-10 03:43:46 UTC (rev 230467)
@@ -1,3 +1,21 @@
+2018-04-09  John Wilander  <wilan...@apple.com>
+
+        Refactor Ignore HSTS code
+        https://bugs.webkit.org/show_bug.cgi?id=184433
+        <rdar://problem/39298238>
+
+        Reviewed by Darin Adler.
+
+        This patch refactors our ignore HSTS code. The convenience functions are moved
+        out of CFNetwork SPI in PAL, and into where they are used. It also switches
+        from performSelector: calls to straight function calls, after checking that
+        there is a responder.
+
+        * pal/spi/cf/CFNetworkSPI.h:
+        (schemeWasUpgradedDueToDynamicHSTS): Deleted.
+        (setIgnoreHSTS): Deleted.
+        (ignoreHSTS): Deleted.
+
 2018-04-07  Timothy Hatcher  <timo...@apple.com>
 
         Use the system's link color when system appearance is desired for a WebView.

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


--- trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h	2018-04-10 03:03:28 UTC (rev 230466)
+++ trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h	2018-04-10 03:43:46 UTC (rev 230467)
@@ -337,24 +337,4 @@
 - (void)_setMIMEType:(NSString *)type;
 @end
 
-static bool schemeWasUpgradedDueToDynamicHSTS(NSURLRequest *request)
-{
-    if ([request respondsToSelector:@selector(_schemeWasUpgradedDueToDynamicHSTS)])
-        return [request performSelector:@selector(_schemeWasUpgradedDueToDynamicHSTS)];
-    return false;
-}
-
-static void setIgnoreHSTS(NSMutableURLRequest *request, bool ignoreHSTS)
-{
-    if ([request respondsToSelector:@selector(_setIgnoreHSTS:)])
-        [request performSelector:@selector(_setIgnoreHSTS:) withObject:[NSNumber numberWithBool:ignoreHSTS]];
-}
-
-static bool ignoreHSTS(NSURLRequest *request)
-{
-    if ([request respondsToSelector:@selector(_ignoreHSTS)])
-        return [request performSelector:@selector(_ignoreHSTS)];
-    return false;
-}
-
 #endif // defined(__OBJC__)

Modified: trunk/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm (230466 => 230467)


--- trunk/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm	2018-04-10 03:03:28 UTC (rev 230466)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm	2018-04-10 03:43:46 UTC (rev 230467)
@@ -327,6 +327,17 @@
 }
 #endif
 
+static bool schemeWasUpgradedDueToDynamicHSTS(NSURLRequest *request)
+{
+#if !USE(CFNETWORK_IGNORE_HSTS)
+    UNUSED_PARAM(request);
+    return false;
+#else
+    return [request respondsToSelector:@selector(_schemeWasUpgradedDueToDynamicHSTS)]
+        && [request _schemeWasUpgradedDueToDynamicHSTS];
+#endif
+}
+
 NSURLResponse *synthesizeRedirectResponseIfNecessary(NSURLRequest *currentRequest, NSURLRequest *newRequest, NSURLResponse *redirectResponse)
 {
     if (redirectResponse)

Modified: trunk/Source/WebKit/ChangeLog (230466 => 230467)


--- trunk/Source/WebKit/ChangeLog	2018-04-10 03:03:28 UTC (rev 230466)
+++ trunk/Source/WebKit/ChangeLog	2018-04-10 03:43:46 UTC (rev 230467)
@@ -1,3 +1,23 @@
+2018-04-09  John Wilander  <wilan...@apple.com>
+
+        Refactor Ignore HSTS code
+        https://bugs.webkit.org/show_bug.cgi?id=184433
+        <rdar://problem/39298238>
+
+        Reviewed by Darin Adler.
+
+        This patch refactors our ignore HSTS code. The convenience functions are moved
+        out of CFNetwork SPI in PAL, and into where they are used. It also switches
+        from performSelector: calls to straight function calls, after checking that
+        there is a responder.
+
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (schemeWasUpgradedDueToDynamicHSTS):
+        (setIgnoreHSTS):
+        (ignoreHSTS):
+            Add convenience functions here since they were moved out of
+            CFNetworkSPI.h.
+
 2018-04-09  Michael Catanzaro  <mcatanz...@igalia.com>
 
         Rename UNUSED to BUNUSED

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (230466 => 230467)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2018-04-10 03:03:28 UTC (rev 230466)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2018-04-10 03:43:46 UTC (rev 230467)
@@ -182,6 +182,24 @@
     ASSERT_NOT_REACHED();
     return request;
 }
+
+static bool schemeWasUpgradedDueToDynamicHSTS(NSURLRequest *request)
+{
+    return [request respondsToSelector:@selector(_schemeWasUpgradedDueToDynamicHSTS)]
+        && [request _schemeWasUpgradedDueToDynamicHSTS];
+}
+
+static void setIgnoreHSTS(NSMutableURLRequest *request, bool ignoreHSTS)
+{
+    if ([request respondsToSelector:@selector(_setIgnoreHSTS:)])
+        [request _setIgnoreHSTS:ignoreHSTS];
+}
+
+static bool ignoreHSTS(NSURLRequest *request)
+{
+    return [request respondsToSelector:@selector(_ignoreHSTS)]
+        && [request _ignoreHSTS];
+}
 #endif
 
 static NSURLRequest* updateIgnoreStrictTransportSecuritySettingIfNecessary(NSURLRequest *request, bool shouldIgnoreHSTS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to