Closed
Bug 455839
Opened 16 years ago
Closed 12 years ago
Small cleanup in error handling in nsCSSParser/nsCSSScanner
Categories
(Core :: CSS Parsing and Computation, defect)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla19
People
(Reporter: alfredkayser, Assigned: zwol)
References
Details
(Keywords: memory-footprint)
Attachments
(1 file, 7 obsolete files)
19.73 KB,
patch
|
zwol
:
review+
|
Details | Diff | Splinter Review |
The ReportUnexpectedParams and ReportUnexpectedTokensParams accept both a list of parameters, but actually they always used with one parameter.
By changing them to accept just one parameter, the calling of these from nsCSSParser can be simplified resulting in less and cleaner code.
Attachment #339210 -
Flags: review?(zweinberg)
Reporter | ||
Comment 1•16 years ago
|
||
Simple reportparam cleanup/simplification.
Attachment #339210 -
Attachment is obsolete: true
Attachment #369091 -
Flags: review?(dbaron)
Attachment #339210 -
Flags: review?(zweinberg)
Reporter | ||
Updated•16 years ago
|
Assignee: nobody → alfredkayser
Status: NEW → ASSIGNED
Comment on attachment 369091 [details] [diff] [review]
V2: Updated to current trunk
>-// @see REPORT_UNEXPECTED_EOF in nsCSSParser.cpp
You dropped this comment on the floor; please put it back next to the moved code.
Please also describe how you tested the patch. With that description, I'd have granted review now (given that it was appropriate), but without it I'm going to wait for it until granting review.
Comment on attachment 369091 [details] [diff] [review]
V2: Updated to current trunk
Please re-request review after describing how you tested the patch.
Attachment #369091 -
Flags: review?(dbaron) → review-
Assignee | ||
Comment 4•15 years ago
|
||
As long as I was messing with error reporting (see bug 516091) I thought I'd pick this one up and polish it a little.
Tested (like 516091) by running layout/style mochitests with the error console open and watching the diagnostics go by. I also spot-checked REPORT_UNEXPECTED_TOKEN_P with <style>foo { color: hsl(1,2%,3% blah) }</style> since I didn't see that one go by.
Assignee: alfredkayser → zweinberg
Attachment #400209 -
Flags: review?(dbaron)
Reporter | ||
Comment 5•15 years ago
|
||
Even better than my attempts!
I liked Alfred's original patch, but I think I prefer leaving "Report" in the method names and leaving the aMessage being a const char* rather than const PRUnichar* (the string conversion performance should be trivial compared to the rest of the cost of that method, so we may as well bloat the binary less and store narrow strings). Are there other changes thrown in?
Reporter | ||
Comment 7•15 years ago
|
||
Retaking. The original patch was best (IMHO).
I have included the idea from Zack to use overloading for the parameter variants.
I have also removed the EOF(char) variant, as it was used in one location only.
No other changes than that.
Tested with Mochitest (with error console), with my themes and gmail pages (especially the last generate a lot of CSS errors...)
Assignee: zweinberg → alfredkayser
Attachment #369091 -
Attachment is obsolete: true
Attachment #400209 -
Attachment is obsolete: true
Attachment #412172 -
Flags: review?(dbaron)
Attachment #400209 -
Flags: review?(dbaron)
Reporter | ||
Comment 8•15 years ago
|
||
Note, the latest patch doesn't depend on bug 516091.
Assignee | ||
Comment 9•15 years ago
|
||
Re-claiming this bug again.
(In reply to comment #6)
> I liked Alfred's original patch, but I think I prefer leaving "Report" in
> the method names and leaving the aMessage being a const char* rather than
> const PRUnichar* (the string conversion performance should be trivial
> compared to the rest of the cost of that method, so we may as well bloat
> the binary less and store narrow strings).
Ok, I've put "Report" back in the method names and changed the stringbundle tag arguments back to const char*. I have, however, kept the use of function overloads rather than a bunch of ReportUnexpectedThing variants (EOF being the only surviving one of those).
> Are there other changes thrown in?
A small number of nsSubstring -> nsAString conversions (the former is a typedef for the latter, and is obsolete according to nsStringFwd.h); AddToError is no longer an exposed method; (nsCSS)Token::IsSymbol() and ::AppendToString() are now const methods. That last allows me to declare that all the ReportUnexpected* methods that take a token argument do not modify it.
(In reply to comment #7)
> Retaking. The original patch was best (IMHO).
I must insist that
+ REPORT_UNEXPECTED_P(PEValueParsingError, propertyName);
is aesthetically superior to
+ REPORT_UNEXPECTED_P(PEValueParsingError, propertyName.get());
> I have also removed the EOF(char) variant, as it was used in one location only.
I kept it; I really don't like having this kind of gunk in the parser
+ const PRUnichar lookingForStr[] = {
+ PRUnichar('\''), aSymbol, PRUnichar('\''), PRUnichar(0)
+ };
Also, this way all uses of PEUnexpEOF2 are in nsCSSErrorReporter.cpp.
Assignee: alfredkayser → zweinberg
Attachment #412172 -
Attachment is obsolete: true
Attachment #423475 -
Flags: review?(dbaron)
Attachment #412172 -
Flags: review?(dbaron)
Assignee | ||
Comment 10•15 years ago
|
||
Back to depending on bug 516091. (This is #8 in a stack that I'm sort of hoping I get to land all at once, now. :-)
Depends on: 516091
Assignee | ||
Comment 11•15 years ago
|
||
Random question for dbaron or whoever: Is it necessary to use nsXPIDLString rather than nsString (or possibly even nsAString) for the return from nsIStringBundle::(Get|Format)StringFromName? How about nsIURI::GetSpec?
Comment 12•15 years ago
|
||
Used to be. Now you can use nsString. Maybe even nsSubstring; not sure about nsAString; I get lost in the defines.
Reporter | ||
Comment 13•15 years ago
|
||
V4 is OK by me.
Assignee | ||
Comment 14•15 years ago
|
||
Comment on attachment 423475 [details] [diff] [review]
V4: My patch, addressing dbaron's comments
I'm not sure anymore at what point this change ought to happen, so clearing review for now.
Attachment #423475 -
Flags: review?(dbaron)
Assignee | ||
Updated•13 years ago
|
Assignee | ||
Comment 15•13 years ago
|
||
New updated version of this patch, can hopefully go in along with 543151 et seq.
Attachment #423475 -
Attachment is obsolete: true
Attachment #535995 -
Flags: review?(dbaron)
Assignee | ||
Comment 16•12 years ago
|
||
Dusting this off now we're finally in a position to land bug 663291 and therefore to test CSS error reporting in detail.
No substantive changes from the previous version. Textual dependency on bug 516091.
Attachment #535995 -
Attachment is obsolete: true
Attachment #535995 -
Flags: review?(dbaron)
Attachment #661642 -
Flags: review?(dbaron)
Comment on attachment 661642 [details] [diff] [review]
v6
r=dbaron
Attachment #661642 -
Flags: review?(dbaron) → review+
Assignee | ||
Comment 18•12 years ago
|
||
This required defuzzing for the @page changes (bug 115199).
Attachment #661642 -
Attachment is obsolete: true
Attachment #682025 -
Flags: review+
Assignee | ||
Comment 19•12 years ago
|
||
Comment 20•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in
before you can comment on or make changes to this bug.
Description
•