[webkit-reviews] review granted: [Bug 60594] Protect self in [WebCoreResourceHandleAsDelegate connection:didReceiveDataArray:] : [Attachment 93038] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue May 10 16:31:52 PDT 2011
Alexey Proskuryakov <ap at webkit.org> has granted Pratik Solanki
<psolanki at apple.com>'s request for review:
Bug 60594: Protect self in [WebCoreResourceHandleAsDelegate
connection:didReceiveDataArray:]
https://bugs.webkit.org/show_bug.cgi?id=60594
Attachment 93038: Patch
https://bugs.webkit.org/attachment.cgi?id=93038&action=review
------- Additional Comments from Alexey Proskuryakov <ap at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=93038&action=review
> Source/WebCore/ChangeLog:4
> + https://bugs.webkit.org/show_bug.cgi?id=60594
Please add a Radar link here, too.
Also, there needs to be an explanation why there are no tests (e.g. "no bot
tests CFNETWORK_DATA_ARRAY_CALLBACK").
> Source/WebCore/platform/network/mac/ResourceHandleMac.mm:831
> + // The call to didReceiveData below could cancel a load, which would
result in the delegate
> + // (self) being released. Retain self so we can at least check the
value of m_handle without
> + // crashing and return safely in case the load got cancelled.
Please remove the second sentence - it just states what the code below does.
> Source/WebCore/platform/network/mac/ResourceHandleMac.mm:832
> + RetainPtr<WebCoreResourceHandleAsDelegate> protectDelegate(self);
protect(self) reads more like an English sentence than protectDelegate(self).
> Source/WebCore/platform/network/mac/ResourceHandleMac.mm:835
> + if (m_handle && m_handle->client())
> + m_handle->client()->didReceiveData(m_handle,
static_cast<const char*>([data bytes]), [data length], static_cast<int>([data
length]));
Is the check for m_handle->client() necessary? Let's not add it unless it's
necessary, since it would be confusing readers otherwise.
I'd have used an early return:
if (!m_handle)
break;
More information about the webkit-reviews
mailing list