Closed Bug 483971 Opened 15 years ago Closed 15 years ago

nsCSSScanner: cleanup of EatWhiteSpace and removal of EatNewline

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
trivial

Tracking

()

VERIFIED FIXED
mozilla1.9.2a1

People

(Reporter: alfredkayser, Assigned: alfredkayser)

Details

(Keywords: memory-footprint)

Attachments

(1 file, 2 obsolete files)

1. Fix EatWhitespace to eat all whitespace (using IsWhitespace) and remove return
value (is not used).
2. EatNewline is only used in one place, and can be inlined (and making Read logic simpler).
Attachment #368004 - Flags: review?(dbaron)
Assignee: nobody → alfredkayser
Status: NEW → ASSIGNED
Attachment #368004 - Attachment is obsolete: true
Attachment #368884 - Flags: review?(dbaron)
Attachment #368004 - Flags: review?(dbaron)
Comment on attachment 368884 [details] [diff] [review]
V2: hg diff -pU8 version from current build

>+    if ((ch != ' ') && (ch != '\n') && (ch != '\t')) {
>+      Pushback(ch);
>+      break;
>+    }

I think you've introduced tabs here.

>+  // "Any character except a hexidecimal digit can be escaped to
>+  // remove its special meaning by putting a backslash in front"
>+  // -- CSS1 spec section 7.1
>+  if ((ch > 0) && (ch != '\n')) {
>+    aOutput.Append(ch);
>   }

You've made it so we no longer consume the character in this case.  Please fix that and add a regression test that would catch the mistake.

I think it looks ok with those two issues fixed.


What regression tests did you run before requesting review?  (for both the original patch and the revised patch)
Attachment #368884 - Flags: review?(dbaron) → review-
Changes:
1. Remove the tabs.
2. Added 'ch = Read();' to consume the escaped character. Note, previous testing was not done correctly, causing to miss the introduced issue.

Tested using mochitest on /tests/layout:
Before: passed 30889, failed 0, todo 80
With faulty patch: passed 30858, failed 35!, todo 80.
With correct patch: passed 30889, failed 0, todo 80.

As the mochitests (when correctly run on correctly rebuild) clear show the impact of a faulty patch, I think that it is not needed to add specific tests for this. Even specifically: test_parse_rule.html does already include specific tests for escaping, including escaped newlines.
Attachment #368884 - Attachment is obsolete: true
Attachment #369990 - Flags: review?(dbaron)
Comment on attachment 369990 [details] [diff] [review]
V3: Do consume the escaped character!

r=dbaron, but in the future please run appropriate tests before requesting review.  (For example, if you're changing the CSS parser, you should obviously be running at least the mochitests in layout/style.)
Attachment #369990 - Flags: review?(dbaron) → review+
dbaron, is a separate sr needed, or can you do this also?

P.s. I promise that I will do the tests on the correct build before requesting review.
http://hg.mozilla.org/mozilla-central/rev/3c687f3d4ff4
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
Backed out; the push this was part of seems to be causing random leak orange on Mac.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Looks like the random leak orange is still happening, so this can reland as desired...
Actually, scratch that.  This orange is on Linux, whereas the orange from the push this landed as part of was on Mac.  I recommend landing this separately from the other 4 patches that landed with it.
The leak exists on 1.9.1, so this didn't cause it.
http://hg.mozilla.org/mozilla-central/rev/02f8e9df8612
Status: REOPENED → RESOLVED
Closed: 15 years ago15 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Thanks!
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: