Summary: | XSSAuditor doesn't need a copy of the original document's body. | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Mike West <mkwst> | ||||||
Component: | New Bugs | Assignee: | Mike West <mkwst> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | abarth, dbates, esprehn+autocc, ojan.autocc, tsepez, webkit.review.bot | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Bug Depends on: | |||||||||
Bug Blocks: | 110733 | ||||||||
Attachments: |
|
Description
Mike West
2013-03-10 14:54:14 PDT
Created attachment 192387 [details]
Patch
Comment on attachment 192387 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=192387&action=review > Source/WebCore/html/parser/XSSAuditor.cpp:336 > + if (!m_reportURL.isEmpty()) > m_reportURL = KURL(); This is now a strange sequence. It says “make all URLs null except for the empty URL”; having logic that goes out of its way to preserve the empty URL rather than replacing it with null is strange. I suggest an unconditional assignment without an if statement. > Source/WebCore/html/parser/XSSAuditorDelegate.cpp:83 > + FormData* formData = frameLoader->documentLoader()->originalRequest().httpBody(); > + if (formData) > + httpBody = formData->flattenToString(); It’s sometimes considered good style to write code like this with the assignment in the if statement itself. I like it that way. Thanks for taking a look! (In reply to comment #2) > (From update of attachment 192387 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=192387&action=review > > > Source/WebCore/html/parser/XSSAuditor.cpp:336 > > + if (!m_reportURL.isEmpty()) > > m_reportURL = KURL(); > > This is now a strange sequence. It says “make all URLs null except for the empty URL”; having logic that goes out of its way to preserve the empty URL rather than replacing it with null is strange. I suggest an unconditional assignment without an if statement. The goal here is to only send one report per page. I think we should actually refactor this into a counter stored on XSSAuditorDelegate now that I look at it: bug 111964. For this patch, I'm happy to just drop the `if`. > > Source/WebCore/html/parser/XSSAuditorDelegate.cpp:83 > > + FormData* formData = frameLoader->documentLoader()->originalRequest().httpBody(); > > + if (formData) > > + httpBody = formData->flattenToString(); > > It’s sometimes considered good style to write code like this with the assignment in the if statement itself. I like it that way. I personally prefer one effect per line when possible, but it's a pretty common pattern in WebCore, so I'm happy to try to start using it. :) Created attachment 192427 [details]
Patch for landing
Comment on attachment 192427 [details] Patch for landing Clearing flags on attachment: 192427 Committed r145348: <http://trac.webkit.org/changeset/145348> All reviewed patches have been landed. Closing bug. |