Closed
Bug 571635
Opened 14 years ago
Closed 11 years ago
Make nsCSSStyleSheet::GetStyleRuleAt return a css::Rule*
Categories
(Core :: CSS Parsing and Computation, defect)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla25
People
(Reporter: ehsan.akhgari, Assigned: poiru)
Details
(Whiteboard: [good first bug][mentor=ehsan])
Attachments
(1 file, 2 obsolete files)
5.62 KB,
patch
|
poiru
:
review+
|
Details | Diff | Splinter Review |
This really hurt my eyes, and my brains. nsCSSStyleSheet::GetStyleRuleAt takes an nsICSSRule*&, which leads to code such as: nsCOMPtr<nsICSSRule> bar; stylesheet->GetStyleRuleAt(foo, *getter_AddRefs(bar)); I think pretty much every body would write this instead, assuming that this method is returning the pointer without addrefing, nsICSSRule *bar; stylesheet->GetStyleRuleAt(foo, bar); ... and tracking the leak is not the most pleasant thing to do.
Reporter | ||
Updated•14 years ago
|
Whiteboard: [good first bug]
Comment 1•14 years ago
|
||
Seems to me like the right signature is: nsICSSRule* GetStyleRuleAt(PRInt32 aIndex); without any of the random refcounting.
Reporter | ||
Comment 2•14 years ago
|
||
Yes, that's probably even better!
Comment 3•14 years ago
|
||
Assignee: nobody → wesongathedeveloper
Status: NEW → ASSIGNED
Attachment #451139 -
Flags: review?(bzbarsky)
Reporter | ||
Comment 4•14 years ago
|
||
Comment on attachment 451139 [details] [diff] [review] Patch I landed a patch a few hours ago which bitrots this one (sorry about that!).
Attachment #451139 -
Attachment is obsolete: true
Attachment #451139 -
Flags: review?(bzbarsky)
Comment 5•14 years ago
|
||
noprob, although why doesn't the change show up in my updated mc working copy? i still have the old code.
Reporter | ||
Comment 6•14 years ago
|
||
This is the code in question: <http://hg.mozilla.org/mozilla-central/rev/208d7f999037#l3.256>
Comment 7•14 years ago
|
||
(In reply to comment #4) > I landed a patch a few hours ago which bitrots this one (sorry about that!). Does this mean that the bug should be resolved as invalid/wontfix or that a new patch is needed?
Reporter | ||
Comment 8•14 years ago
|
||
(In reply to comment #7) > (In reply to comment #4) > > I landed a patch a few hours ago which bitrots this one (sorry about that!). > > Does this mean that the bug should be resolved as invalid/wontfix or that a new > patch is needed? A new patch is needed. Once you have a new patch, please attach it to the bug and request the review flag from :bz again. Thanks!
Comment 9•11 years ago
|
||
Saint Wesonga, are you still working on this bug? I'm looking at old "good first bugs" not touched for a while. Ehsan, do you think this bug could become a mentored bug? Would you like to apply as mentor?
Flags: needinfo?(wesongathedeveloper)
Reporter | ||
Comment 10•11 years ago
|
||
Sure!
Whiteboard: [good first bug] → [good first bug][mentor=ehsan]
Updated•11 years ago
|
Assignee: wesongathedeveloper → nobody
Flags: needinfo?(wesongathedeveloper)
Updated•11 years ago
|
Status: ASSIGNED → NEW
Assignee | ||
Comment 11•11 years ago
|
||
Hi. I've attached a patch for this.
Attachment #769391 -
Flags: review?(ehsan)
Reporter | ||
Comment 12•11 years ago
|
||
Comment on attachment 769391 [details] [diff] [review] Patch v1 Review of attachment 769391 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me, but I think David should take a look at this too.
Attachment #769391 -
Flags: review?(ehsan) → review?(dbaron)
Comment on attachment 769391 [details] [diff] [review] Patch v1 >diff --git a/content/base/src/nsTreeSanitizer.cpp b/content/base/src/nsTreeSanitizer.cpp >--- a/content/base/src/nsTreeSanitizer.cpp >+++ b/content/base/src/nsTreeSanitizer.cpp >@@ -1106,19 +1106,18 @@ nsTreeSanitizer::SanitizeStyleSheet(cons > NS_ENSURE_SUCCESS(rv, true); > // Mark the sheet as complete. > NS_ABORT_IF_FALSE(!sheet->IsModified(), > "should not get marked modified during parsing"); > sheet->SetComplete(); > // Loop through all the rules found in the CSS text > int32_t ruleCount = sheet->StyleRuleCount(); > for (int32_t i = 0; i < ruleCount; ++i) { >- nsRefPtr<mozilla::css::Rule> rule; >- rv = sheet->GetStyleRuleAt(i, *getter_AddRefs(rule)); >- if (NS_FAILED(rv)) >+ nsRefPtr<mozilla::css::Rule> rule = sheet->GetStyleRuleAt(i); >+ if (!rule) > continue; NS_ASSERTION(rule, "We should have a rule by now"); This should just be mozilla::css::Rule* rather than using nsRefPtr. And while you're there, could you also fix that NS_ASSERTION being on the same line? r=dbaron with that fixed
Attachment #769391 -
Flags: review?(dbaron) → review+
Removing the assertion is fine too.
Assignee | ||
Comment 15•11 years ago
|
||
(In reply to David Baron [:dbaron])
> This should just be mozilla::css::Rule* rather than using nsRefPtr.
> Removing the assertion is fine too.
Done.
Assignee: nobody → birunthan
Attachment #769391 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #771528 -
Flags: review+
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 16•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/1f030ce15fdb
Keywords: checkin-needed
Comment 17•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/1f030ce15fdb
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
And thanks for fixing this!
Updated•11 years ago
|
Flags: in-testsuite-
OS: Mac OS X → All
Hardware: x86 → All
Summary: Make nsCSSStyleSheet::GetStyleRuleAt take an nsICSSRule** parameter → Make nsCSSStyleSheet::GetStyleRuleAt return a css::Rule*
You need to log in
before you can comment on or make changes to this bug.
Description
•