[webkit-reviews] review granted: [Bug 58646] CSP policy violations should log to the console : [Attachment 90318] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 20 12:09:16 PDT 2011


Eric Seidel <eric at webkit.org> has granted Adam Barth <abarth at webkit.org>'s
request for review:
Bug 58646: CSP policy violations should log to the console
https://bugs.webkit.org/show_bug.cgi?id=58646

Attachment 90318: Patch
https://bugs.webkit.org/attachment.cgi?id=90318&action=review

------- Additional Comments from Eric Seidel <eric at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=90318&action=review

Looks fine.  The only nit which really matters is the repeating of all that
logging code.

> Source/WebCore/page/ContentSecurityPolicy.cpp:492
> +    if (!allowed) {

I might have reversed these ifs to flatten these blocks:
if (allowed)
    return allowed; (or simply true;)

But this is also OK.

> Source/WebCore/page/ContentSecurityPolicy.cpp:495
> +	   if (Frame* frame = m_document->frame())
> +	       frame->domWindow()->console()->addMessage(JSMessageSource,
LogMessageType, ErrorMessageLevel, consoleMessage, 1, String());

Seems like these two lines want to be a helper.  We repeat them 7 times. :)

> Source/WebCore/page/ContentSecurityPolicy.cpp:702
> +	   m_scriptSrc = adoptPtr(new CSPDirective(value,
m_document->securityOrigin()));

I would have added an origin() or securityOrigin() private method.  BUt this is
OK.


More information about the webkit-reviews mailing list