Closed Bug 620184 Opened 14 years ago Closed 14 years ago

remove null checks from GetDOMSlots() and rename it to DOMSlots() because it is infallible in m-c

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b9

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug)

Details

(Keywords: coverity)

Attachments

(1 file, 1 obsolete file)

248 nsStyledElement::GetStyle(nsresult* retval)
259   nsGenericElement::nsDOMSlots *slots = GetDOMSlots();

261   if (!slots->mStyle) {

this is the only place which doesn't null check GetDOMSlots(), coverity thinks this is suspicious.
It looks to me like slots creation uses infallible malloc (nsINode::CreateSlots), and therefore the things that null-check it all shouldn't be null-checking it anymore.

That said, before we had infallible malloc this does look like a valid OOM crash bug.
Component: Style System (CSS) → DOM
QA Contact: style-system → general
afaict 1.9.2 and 1.9.1 have null checks there
Severity: critical → enhancement
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: crash
Summary: potential crash [@ nsStyledElement::GetStyle] if GetDOMSlots() can return null here → remove null checks from GetDOMSlots() because it is infallible in m-c
Attached patch remove checks (obsolete) — Splinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #498581 - Flags: review?(dbaron)
Attachment #498581 - Flags: approval2.0?
Attachment #498581 - Flags: review?(dbaron) → review?(jonas)
Comment on attachment 498581 [details] [diff] [review]
remove checks

Please also rename the function to DOMSlots(). We usually drop the "Get" for functions that never return null.
Attachment #498581 - Flags: review?(jonas)
Attachment #498581 - Flags: review+
Attachment #498581 - Flags: approval2.0?
Attachment #498581 - Flags: approval2.0+
Summary: remove null checks from GetDOMSlots() because it is infallible in m-c → remove null checks from GetDOMSlots() and rename it to DOMSlots() because it is infallible in m-c
Attached patch DOMSlots()Splinter Review
Attachment #498581 - Attachment is obsolete: true
Attachment #499198 - Flags: review+
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/e27527551d57
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Flags: in-testsuite-
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b9
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: