Closed
Bug 452275
Opened 17 years ago
Closed 17 years ago
Eliminate aErrorCode argument to most nsCSSScanner/CSSParserImpl functions
Categories
(Core :: CSS Parsing and Computation, enhancement)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla1.9.1
People
(Reporter: zwol, Assigned: zwol)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
237.92 KB,
patch
|
Details | Diff | Splinter Review |
It occurred to me this morning that the 'aErrorCode' argument that's threaded through most of the CSS parser and scanner, set rarely, and inspected only by top level parser entry points could be sensibly replaced with a nsCSSScanner member variable. The attached patch does this.
Since this touched just about every function definition in the two files, I took the opportunity to standardize them on the "return value on preceding line" style convention (both were inconsistent). I also did a trailing-whitespace sweep in nsCSSParser.cpp only.
I have one concern - it's a preexisting condition but it might as well be fixed with this patch, if it needs fixing: CSSParserImpl::Parse(), CSSParserImpl::ParseStyleAttribute(), and CSSParserImpl::ParseRule() all ignore this error code, always returning NS_OK even if it's been set to something else. Should that be corrected?
Attachment #335558 -
Flags: superreview?(dbaron)
Attachment #335558 -
Flags: review?(dbaron)
![]() |
||
Comment 1•17 years ago
|
||
See bug 399223?
Assignee | ||
Comment 2•17 years ago
|
||
This patch is, functionally, a subset of that patch - I am not convinced it makes sense to turn aToken into a member variable too. It should be easier to review this since it only changes aErrorCode.
Attachment #335558 -
Flags: superreview?(dbaron)
Attachment #335558 -
Flags: superreview+
Attachment #335558 -
Flags: review?(dbaron)
Attachment #335558 -
Flags: review+
Comment on attachment 335558 [details] [diff] [review]
(rev 1) initial patch
In the future, please do whitespace reformatting as a separate patch.
In ParseMediaList, I wonder whether we want to continue propagating the
error code whether or not GatherMedia fails, or do what you chose and
only propagate it if GatherMedia fails. It might be better to keep the
behavior as-is.
In ParseBorderImage, the 4 ParsePositiveVariant calls that parse the
border widths after the / look like they can be on one line now, rather
than split over 2 lines.
Likewise for the arguments in the definition of CSSParserImpl::ParseRect.
nsCSSScanner.cpp:
nsCSSScanner::SetLowLevelError should probably also assert that the
error is currently NS_OK, since we shouldn't be continuing to do things
that could cause an error after causing one.
In nsCSSScanner::EnsureData, rename |err| to |rv| so we don't have yet
another convention, and declare it on the same line it's first used,
i.e.,
nsresult rv = mInputStream->Read(...);
r+sr=dbaron
And if you posted an updated and merged-to-tip patch (or hg bundle), I should be able to land it for you (although send email, since I may not read bugmail as quickly).
Assignee | ||
Comment 5•17 years ago
|
||
Here's the revised patch. I made all the changes you requested. I'll be mailing you a bundle with this + 452278 + 452518 shortly.
Attachment #335558 -
Attachment is obsolete: true
Assignee | ||
Comment 6•17 years ago
|
||
landing seems to have stuck.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•