Bug 57262

Summary: ResourceError::certificate() should return a PCCERT_CONTEXT
Product: WebKit Reporter: Jeff Miller <jeffm>
Component: WebKit2Assignee: Jeff Miller <jeffm>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows 7   
Attachments:
Description Flags
Patch aroben: review+

Description Jeff Miller 2011-03-28 12:47:48 PDT
Follow-up to <https://bugs.webkit.org/show_bug.cgi?id=57195>. This allows us to clean up encodeResourceError() in WebCoreArgumentCoders.win.cpp.
Comment 1 Jeff Miller 2011-03-28 12:54:26 PDT
Created attachment 87183 [details]
Patch
Comment 2 WebKit Review Bot 2011-03-28 12:57:12 PDT
Attachment 87183 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebKit2/ChangeLog:13:  ChangeLog entry has no bug number  [changelog/bugnumber] [5]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Adam Roben (:aroben) 2011-03-28 12:58:32 PDT
Comment on attachment 87183 [details]
Patch

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

> Source/WebCore/platform/network/cf/ResourceErrorCF.cpp:62
> +PCCERT_CONTEXT ResourceError::certificate() const
> +{
> +    if (!m_certificate)
> +        return 0;
> +    
> +    return reinterpret_cast<PCCERT_CONTEXT>(CFDataGetBytePtr(m_certificate.get()));
> +}

Now I'm starting to wonder whether making m_certificate itself a PCCERT_CONTEXT would be good. I guess one benefit of using CFDataRef is that we get to use RetainPtr. We don't have a comparable smart pointer for PCCERT_CONTEXT.
Comment 4 Jeff Miller 2011-03-28 13:05:19 PDT
(In reply to comment #3)
> (From update of attachment 87183 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=87183&action=review
> 
> > Source/WebCore/platform/network/cf/ResourceErrorCF.cpp:62
> > +PCCERT_CONTEXT ResourceError::certificate() const
> > +{
> > +    if (!m_certificate)
> > +        return 0;
> > +    
> > +    return reinterpret_cast<PCCERT_CONTEXT>(CFDataGetBytePtr(m_certificate.get()));
> > +}
> 
> Now I'm starting to wonder whether making m_certificate itself a PCCERT_CONTEXT would be good. I guess one benefit of using CFDataRef is that we get to use RetainPtr. We don't have a comparable smart pointer for PCCERT_CONTEXT.

Yes, I originally went down the path of using PCCERT_CONTEXT, but without a comparable smart pointer I would have had to add a destructor, so it seemed cleaner to use a CFDataRef.  Plus, we need it in a CFDataRef when we stick it in the user info dictionary in the CFErrorRef.
Comment 5 Jeff Miller 2011-03-28 13:07:39 PDT
(In reply to comment #2)
> Attachment 87183 [details] did not pass style-queue:
> 
> Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1
> 
> Source/WebKit2/ChangeLog:13:  ChangeLog entry has no bug number  [changelog/bugnumber] [5]
> Total errors found: 1 in 5 files
> 
> 
> If any of these errors are false positives, please file a bug against check-webkit-style.

Another false positive, which I assume is a similar issue to the bug I already filed: https://bugs.webkit.org/show_bug.cgi?id=57250
Comment 6 Jeff Miller 2011-03-28 13:09:34 PDT
Committed r82146: <http://trac.webkit.org/changeset/82146>