Remove pre-Network Session code path for allowing any HTTPS certificate on Mac and iOS
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Apr 2018 23:05:03 +0000 (23:05 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Apr 2018 23:05:03 +0000 (23:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184242

Reviewed by Alexey Proskuryakov.

Following r227364 we use the Network Session (NSURLSession) code path by default in
modern WebKit on Mac and iOS. That is, we no longer use {CF, NS}URLConnection in modern
WebKit on these platforms. So, we can remove code that used NSURLRequest SPI to allow
any HTTPS certificate from localhost and 127.0.0.1 when using {CF, NS}URLConnection.
The equivalent functionality is implemented in TestController::canAuthenticateAgainstProtectionSpace().

* WebKitTestRunner/InjectedBundle/ios/InjectedBundleIOS.mm:
(WTR::InjectedBundle::platformInitialize):
* WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm:
(WTR::InjectedBundle::platformInitialize):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@230190 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/ios/InjectedBundleIOS.mm
Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm

index cc09ee4..47a3911 100644 (file)
@@ -1,3 +1,21 @@
+2018-04-02  Daniel Bates  <dabates@apple.com>
+
+        Remove pre-Network Session code path for allowing any HTTPS certificate on Mac and iOS
+        https://bugs.webkit.org/show_bug.cgi?id=184242
+
+        Reviewed by Alexey Proskuryakov.
+
+        Following r227364 we use the Network Session (NSURLSession) code path by default in
+        modern WebKit on Mac and iOS. That is, we no longer use {CF, NS}URLConnection in modern
+        WebKit on these platforms. So, we can remove code that used NSURLRequest SPI to allow
+        any HTTPS certificate from localhost and 127.0.0.1 when using {CF, NS}URLConnection.
+        The equivalent functionality is implemented in TestController::canAuthenticateAgainstProtectionSpace().
+
+        * WebKitTestRunner/InjectedBundle/ios/InjectedBundleIOS.mm:
+        (WTR::InjectedBundle::platformInitialize):
+        * WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm:
+        (WTR::InjectedBundle::platformInitialize):
+
 2018-04-02  Brady Eidson  <beidson@apple.com>
 
         Process swapping on navigation needs to handle server redirects.
 2018-04-02  Brady Eidson  <beidson@apple.com>
 
         Process swapping on navigation needs to handle server redirects.
index 269318b..3f2d76c 100644 (file)
 
 #import <Foundation/Foundation.h>
 
 
 #import <Foundation/Foundation.h>
 
-@interface NSURLRequest (PrivateThingsWeShouldntReallyUse)
-+(void)setAllowsAnyHTTPSCertificate:(BOOL)allow forHost:(NSString *)host;
-@end
-
 namespace WTR {
 
 void InjectedBundle::platformInitialize(WKTypeRef)
 namespace WTR {
 
 void InjectedBundle::platformInitialize(WKTypeRef)
@@ -46,9 +42,6 @@ void InjectedBundle::platformInitialize(WKTypeRef)
         [dict setObject:languages forKey:@"AppleLanguages"];
 
     [[NSUserDefaults standardUserDefaults] setVolatileDomain:dict.get() forName:NSArgumentDomain];
         [dict setObject:languages forKey:@"AppleLanguages"];
 
     [[NSUserDefaults standardUserDefaults] setVolatileDomain:dict.get() forName:NSArgumentDomain];
-
-    [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:@"localhost"];
-    [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:@"127.0.0.1"];
 }
 
 } // namespace WTR
 }
 
 } // namespace WTR
index d388e5f..360f0d1 100644 (file)
 
 #import <Foundation/Foundation.h>
 
 
 #import <Foundation/Foundation.h>
 
-@interface NSURLRequest (PrivateThingsWeShouldntReallyUse)
-+(void)setAllowsAnyHTTPSCertificate:(BOOL)allow forHost:(NSString *)host;
-@end
-
 @interface NSSound ()
 + (void)_setAlertType:(NSUInteger)alertType;
 @end
 @interface NSSound ()
 + (void)_setAlertType:(NSUInteger)alertType;
 @end
@@ -87,9 +83,6 @@ void InjectedBundle::platformInitialize(WKTypeRef initializationUserData)
     // A distributed notification is delivered to all applications, but it should be harmless, and it's the only way to update all underlying frameworks anyway.
     [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"AppleAquaAntiAliasingChanged" object:nil userInfo:nil deliverImmediately:YES];
 
     // A distributed notification is delivered to all applications, but it should be harmless, and it's the only way to update all underlying frameworks anyway.
     [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"AppleAquaAntiAliasingChanged" object:nil userInfo:nil deliverImmediately:YES];
 
-    [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:@"localhost"];
-    [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:@"127.0.0.1"];
-
     [NSSound _setAlertType:0];
 }
 
     [NSSound _setAlertType:0];
 }