<html>
<head>
<base href="https://bugs.webkit.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - WebKit::AuthenticatorPresenterCoordinator() constructor falls through ASSERT_NOT_REACHED()"
href="https://bugs.webkit.org/show_bug.cgi?id=234991">234991</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>WebKit::AuthenticatorPresenterCoordinator() constructor falls through ASSERT_NOT_REACHED()
</td>
</tr>
<tr>
<th>Product</th>
<td>WebKit
</td>
</tr>
<tr>
<th>Version</th>
<td>Other
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>OS</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>Normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P2
</td>
</tr>
<tr>
<th>Component</th>
<td>WebKit2
</td>
</tr>
<tr>
<th>Assignee</th>
<td>webkit-unassigned@lists.webkit.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ddkilzer@webkit.org
</td>
</tr>
<tr>
<th>CC</th>
<td>kkinnunen@apple.com, webkit-bug-importer@group.apple.com
</td>
</tr>
<tr>
<th>Depends on</th>
<td>234932
</td>
</tr></table>
<p>
<div>
<pre>WebKit::AuthenticatorPresenterCoordinator() constructor falls through ASSERT_NOT_REACHED().
If the wrong `type` is passed in, the constructor would make an invalid object.
I'd recommend using a "create()" pattern that can return `nullptr` (or empty std::unique_ptr<>) which checks the `type` parameter before calling the constructor.
AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator(const AuthenticatorManager& manager, const String& rpId, const TransportSet& transports, ClientDataType type, const String& username)
: m_manager(manager)
{
#if HAVE(ASC_AUTH_UI)
m_context = adoptNS([allocASCAuthorizationPresentationContextInstance() initWithRequestContext:nullptr appIdentifier:nullptr]);
if ([getASCAuthorizationPresentationContextClass() instancesRespondToSelector:@selector(setServiceName:)])
[m_context setServiceName:rpId];
switch (type) {
case ClientDataType::Create: {
auto options = adoptNS([allocASCPublicKeyCredentialCreationOptionsInstance() init]);
[options setUserName:username];
if (transports.contains(AuthenticatorTransport::Internal))
[m_context addLoginChoice:adoptNS([allocASCPlatformPublicKeyCredentialLoginChoiceInstance() initRegistrationChoiceWithOptions:options.get()]).get()];
if (transports.contains(AuthenticatorTransport::Usb) || transports.contains(AuthenticatorTransport::Nfc))
[m_context addLoginChoice:adoptNS([allocASCSecurityKeyPublicKeyCredentialLoginChoiceInstance() initRegistrationChoiceWithOptions:options.get()]).get()];
break;
}
case ClientDataType::Get:
if ((transports.contains(AuthenticatorTransport::Usb) || transports.contains(AuthenticatorTransport::Nfc)) && !transports.contains(AuthenticatorTransport::Internal))
[m_context addLoginChoice:adoptNS([allocASCSecurityKeyPublicKeyCredentialLoginChoiceInstance() initAssertionPlaceholderChoice]).get()];
break;
default:
ASSERT_NOT_REACHED();
}
[...]
#endif // HAVE(ASC_AUTH_UI)
}
See Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm.</pre>
</div>
</p>
<div id="referenced">
<hr style="border: 1px dashed #969696">
<b>Referenced Bugs:</b>
<ul>
<li>
[<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - check-webkit-style: add checker for unexpected fall through after ASSERT_NOT_REACHED() statements"
href="https://bugs.webkit.org/show_bug.cgi?id=234932">Bug 234932</a>] check-webkit-style: add checker for unexpected fall through after ASSERT_NOT_REACHED() statements
</li>
</ul>
</div>
<br>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>