Bug 57368 - WebKit2: Support setting the client certificate on Windows
Summary: WebKit2: Support setting the client certificate on Windows
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows 7
: P2 Normal
Assignee: Jeff Miller
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-29 11:38 PDT by Jeff Miller
Modified: 2011-03-29 13:26 PDT (History)
0 users

See Also:


Attachments
Patch (8.42 KB, patch)
2011-03-29 11:44 PDT, Jeff Miller
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Miller 2011-03-29 11:38:23 PDT
WebKit2: Support setting the client certificate on Windows
Comment 1 Jeff Miller 2011-03-29 11:44:19 PDT
Created attachment 87378 [details]
Patch
Comment 2 Darin Adler 2011-03-29 11:52:52 PDT
Comment on attachment 87378 [details]
Patch

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

I’m not sure that this is following best practices for platform-specific functions. All those empty ones that say ASSERT_NOT_REACHED seem wrong to me. Can you find another example to check the idiom? Or ask Sam or Anders?

> Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp:37
> +    RefPtr<WebCertificateInfo> certificateInfo = WebCertificateInfo::create(PlatformCertificateInfo(certificate));
> +    return toAPI(certificateInfo.release().releaseRef());

Should use leakRef rather than releaseRef. The name releaseRef is deprecated, I just haven’t had a chance to remove it yet. I also think writing this as a 1-liner would be better.

> Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp:34
> +#if USE(CFNETWORK)
> +#include <WebCore/CertificateCFWin.h>
> +#endif

Conditional includes should go in a separate paragraph after the rest of the includes.

> Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp:114
> +    RetainPtr<CFDataRef> certificate = WebCore::copyCertificateToData(certificateChain.first());
> +    ResourceHandle::setClientCertificate(host, certificate.get());

I think this would read better as a one-liner.
Comment 3 Jeff Miller 2011-03-29 13:18:30 PDT
(In reply to comment #2)
> (From update of attachment 87378 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=87378&action=review
> 
> I’m not sure that this is following best practices for platform-specific functions. All those empty ones that say ASSERT_NOT_REACHED seem wrong to me. Can you find another example to check the idiom? Or ask Sam or Anders?

Anders says: "if we know that they're only used on windows, we should PLATFORM(WIN) them, and add WKBundleSetClientCertificate to WKBundlePrivateWin.h"

This also applies to InjectedBundle::setHostAllowsANyHTTPSCertificate(), which is a Windows-only API which I added in another recent patch.

I'm going to land this patch as-is (after addressing your other comments) and move both these functions to be Windows-only in another patch.
Comment 4 Jeff Miller 2011-03-29 13:26:00 PDT
Committed r82309: <http://trac.webkit.org/changeset/82309>