[webkit-reviews] review granted: [Bug 224196] Reduce crash inside getAuditToken : [Attachment 425190] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 5 13:08:08 PDT 2021


David Kilzer (:ddkilzer) <ddkilzer at webkit.org> has granted Alex Christensen
<achristensen at apple.com>'s request for review:
Bug 224196: Reduce crash inside getAuditToken
https://bugs.webkit.org/show_bug.cgi?id=224196

Attachment 425190: Patch

https://bugs.webkit.org/attachment.cgi?id=425190&action=review




--- Comment #6 from David Kilzer (:ddkilzer) <ddkilzer at webkit.org> ---
Comment on attachment 425190
  --> https://bugs.webkit.org/attachment.cgi?id=425190
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=425190&action=review

r=me with additional logging added as requested.  Other changes are optional
(but recommended).

> Source/WebKit/Shared/Cocoa/DefaultWebBrowserChecks.mm:175
> +	   auto auditToken =
auxiliaryProcess.parentProcessConnection()->getAuditToken();
> +	   if (!auditToken) {
> +	       ASSERT_NOT_REACHED();

We should log here if this happens, as it's never supposed to happen according
to deleted code above:

    RELEASE_ASSERT(parentAuditToken); // This should be impossible.

> Source/WebKit/Shared/Cocoa/DefaultWebBrowserChecks.mm:235
> +	   RefPtr<IPC::Connection> connection =
auxiliaryProcess.parentProcessConnection();
> +	   if (!connection) {
> +	       ASSERT_NOT_REACHED();

We should log here if this happens.

> Source/WebKit/Shared/Cocoa/DefaultWebBrowserChecks.mm:241
> +	   auto auditToken = connection->getAuditToken();
> +	   if (!auditToken) {
> +	       ASSERT_NOT_REACHED();

We should log here if this happens, as it's never supposed to happen according
to deleted code above:

    RELEASE_ASSERT(parentAuditToken); // This should be impossible.

> Source/WebKit/WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:56
>  static bool isWebBrowser()
>  {
> -    if (auto* connection =
WebProcess::singleton().parentProcessConnection())
> -	   return isParentProcessAFullWebBrowser(connection->getAuditToken());
> -    return false;
> +    return isParentProcessAFullWebBrowser(WebProcess::singleton());
>  }

We should inline this within the source file.

> Source/WebKit/WebProcess/WebPage/WebPage.cpp:3832
>  bool WebPage::isParentProcessAWebBrowser() const
>  {
>  #if HAVE(AUDIT_TOKEN)
> -    if (auto* connection =
WebProcess::singleton().parentProcessConnection())
> -	   return isParentProcessAFullWebBrowser(connection->getAuditToken());
> +    return isParentProcessAFullWebBrowser(WebProcess::singleton());
>  #endif
>      return false;
>  }

We should move this implementation to the header.


More information about the webkit-reviews mailing list