Closed Bug 295927 Opened 19 years ago Closed 2 months ago

Null pointer checks in RDF container code

Categories

(Core Graveyard :: RDF, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: enndeakin, Unassigned)

Details

Attachments

(1 file)

datasource.GetTarget is supposed to return NS_RDF_NO_VALUE when a value isn't
present. Some implementations of nsIRDFDataSource (like JS components such as
the extension manager) just assume that returning null is ok, causing crashes in
certain situations.
Attachment #184830 - Flags: review?(axel)
Comment on attachment 184830 [details] [diff] [review]
Add some null guards

Grrr, returning null and success is verboten.
Please file bugs on the implementations?

Whatever, CompositeDataSourceImpl::GetSource has the same problem.

Could you use the wallpaper of
http://lxr.mozilla.org/seamonkey/source/rdf/base/src/nsCompositeDataSource.cpp#
245,
with a NS_WARNING? Just accepting it is bad, IMHO.
Attachment #184830 - Flags: review?(axel) → review-
Actually, you probably want to assert when people violate the api...  And yes,
file bugs on the api implementors.
Unfortunately, success return codes in JS are so inconsistently broken that
fixing the implementors tends to make things worse. I'd file a bug, unless there
is one, but coming up with a reliable testcase is hard.
I'd change the JS to return the right code, and then whenever we make XPConnect suck less it should work...
I wouldn't. I'd change the API such that returning null works. There are hundreds of consumers and extensions that assume that returning null indicates no value, and about 3, all in Mozilla code, that assume the success code is returned.

Returning a success code is a non-sensical thing anyway.
Assignee: enndeakin → nobody
Product: Core → Core Graveyard
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: