Skip to content
Permalink
Browse files
WebDriver: [Cocoa] support acceptInsecureCerts capability
https://bugs.webkit.org/show_bug.cgi?id=231789

Reviewed by BJ Burg.

Add necessary plumbing to support the `acceptInsecureCerts` WebDriver capability.

Source/JavaScriptCore:

* inspector/remote/RemoteInspectorConstants.h:
* inspector/remote/cocoa/RemoteInspectorCocoa.mm:
(Inspector::RemoteInspector::receivedAutomationSessionRequestMessage):

Source/WebKit:

* UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h:
* UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.mm:
(-[_WKAutomationSessionConfiguration init]):
(-[_WKAutomationSessionConfiguration copyWithZone:]):
* UIProcess/Cocoa/AutomationClient.mm:
(WebKit::AutomationClient::requestAutomationSession):



Canonical link: https://commits.webkit.org/243800@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285164 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
patrickangle committed Nov 2, 2021
1 parent 3e152dd commit e4274b35d638bcd7a3dbe92ce8b14561ebc3bc7e
Showing 7 changed files with 40 additions and 0 deletions.
@@ -1,3 +1,16 @@
2021-11-02 Patrick Angle <pangle@apple.com>

WebDriver: [Cocoa] support `acceptInsecureCerts` capability
https://bugs.webkit.org/show_bug.cgi?id=231789

Reviewed by BJ Burg.

Add necessary plumbing to support the `acceptInsecureCerts` WebDriver capability.

* inspector/remote/RemoteInspectorConstants.h:
* inspector/remote/cocoa/RemoteInspectorCocoa.mm:
(Inspector::RemoteInspector::receivedAutomationSessionRequestMessage):

2021-11-01 Mark Lam <mark.lam@apple.com>

Remove some unused Heap fields.
@@ -103,6 +103,7 @@

// The value for WIRSessionCapabilitiesKey is a dictionary that holds these capability key-value pairs.

#define WIRAcceptInsecureCertificatesKey @"org.webkit.webdriver.accept-insecure-certificates"
#define WIRAllowInsecureMediaCaptureCapabilityKey @"org.webkit.webdriver.webrtc.allow-insecure-media-capture"
#define WIRSuppressICECandidateFilteringCapabilityKey @"org.webkit.webdriver.webrtc.suppress-ice-candidate-filtering"

@@ -729,6 +729,11 @@ static bool globalAutomaticInspectionState()
BAIL_IF_UNEXPECTED_TYPE_ALLOWING_NIL(forwardedCapabilities, [NSDictionary class]);

Client::SessionCapabilities sessionCapabilities;
if (NSNumber *value = forwardedCapabilities[WIRAcceptInsecureCertificatesKey]) {
if ([value isKindOfClass:[NSNumber class]])
sessionCapabilities.acceptInsecureCertificates = value.boolValue;
}

if (NSNumber *value = forwardedCapabilities[WIRAllowInsecureMediaCaptureCapabilityKey]) {
if ([value isKindOfClass:[NSNumber class]])
sessionCapabilities.allowInsecureMediaCapture = value.boolValue;
@@ -1,3 +1,19 @@
2021-11-02 Patrick Angle <pangle@apple.com>

WebDriver: [Cocoa] support `acceptInsecureCerts` capability
https://bugs.webkit.org/show_bug.cgi?id=231789

Reviewed by BJ Burg.

Add necessary plumbing to support the `acceptInsecureCerts` WebDriver capability.

* UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h:
* UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.mm:
(-[_WKAutomationSessionConfiguration init]):
(-[_WKAutomationSessionConfiguration copyWithZone:]):
* UIProcess/Cocoa/AutomationClient.mm:
(WebKit::AutomationClient::requestAutomationSession):

2021-11-02 Kate Cheney <katherine_cheney@apple.com>

https://bugs.webkit.org/show_bug.cgi?id=232593
@@ -32,6 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
WK_CLASS_AVAILABLE(macos(10.13.4), ios(12.2))
@interface _WKAutomationSessionConfiguration : NSObject <NSCopying>

@property (nonatomic) BOOL acceptInsecureCertificates;
@property (nonatomic) BOOL allowsInsecureMediaCapture;
@property (nonatomic) BOOL suppressesICECandidateFiltering;

@@ -33,6 +33,7 @@ - (instancetype)init
if (!(self = [super init]))
return nil;

_acceptInsecureCertificates = NO;
_allowsInsecureMediaCapture = YES;
_suppressesICECandidateFiltering = NO;

@@ -43,6 +44,7 @@ - (id)copyWithZone:(NSZone *)zone
{
_WKAutomationSessionConfiguration *configuration = [(_WKAutomationSessionConfiguration *)[[self class] allocWithZone:zone] init];

configuration.acceptInsecureCertificates = self.acceptInsecureCertificates;
configuration.allowsInsecureMediaCapture = self.allowsInsecureMediaCapture;
configuration.suppressesICECandidateFiltering = self.suppressesICECandidateFiltering;

@@ -78,6 +78,8 @@
void AutomationClient::requestAutomationSession(const String& sessionIdentifier, const RemoteInspector::Client::SessionCapabilities& sessionCapabilities)
{
auto configuration = adoptNS([[_WKAutomationSessionConfiguration alloc] init]);
[configuration setAcceptInsecureCertificates:sessionCapabilities.acceptInsecureCertificates];

if (sessionCapabilities.allowInsecureMediaCapture)
[configuration setAllowsInsecureMediaCapture:sessionCapabilities.allowInsecureMediaCapture.value()];
if (sessionCapabilities.suppressICECandidateFiltering)

0 comments on commit e4274b3

Please sign in to comment.