Closed
Bug 396119
Opened 17 years ago
Closed 17 years ago
Trivial errors in XPCOMUtils.jsm
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
People
(Reporter: mozbugs, Unassigned)
Details
Attachments
(1 file, 2 obsolete files)
2.12 KB,
patch
|
Gavin
:
review+
sayrer
:
review+
|
Details | Diff | Splinter Review |
I've noticed two problems in XPCOMUtils.jsm: * The error result logic in getClassObject is reversed * The call to catMan.deleteCategoryEntry is missing its 3rd argument, so that'll fail. Patch attached fixes both.
Comment 1•17 years ago
|
||
Can you fix http://lxr.mozilla.org/seamonkey/source/js/src/xpconnect/loader/XPCOMUtils.jsm#241 too while you're at it (CR not being defined)? :)
Reporter | ||
Comment 2•17 years ago
|
||
Attachment #280834 -
Attachment is obsolete: true
Reporter | ||
Updated•17 years ago
|
Attachment #280910 -
Flags: review?(gavin.sharp)
I don't get why the the throws are reversed... If you ask for an interface that isn't implemented (like in QI, for example), you get NO_INTERFACE. If you then ask for a class that isn't in the list you throw NOT_IMPLEMENTED. How is that incorrect?
Updated•17 years ago
|
Flags: in-testsuite?
Comment 4•17 years ago
|
||
Comment on attachment 280910 [details] [diff] [review] New patch, fixes the 3rd issue brought up too The nsGenericFactory code only validates aIID by calling QI on the factory object it creates, which means a failure would result in NS_ERROR_NO_INTERFACE if it failed (http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/xpcom/glue/nsGenericFactory.cpp&rev=1.66&mark=376#346 ). However, I think the sample code is throwing NS_ERROR_NOT_IMPLEMENTED in that case because it's trying to indicate that it doesn't support returning nsIClassInfos (only nsIFactories), which seems reasonable. A comment to explain would help, though. Throwing NS_ERROR_FACTORY_NOT_REGISTERED, or sticking with the current NS_ERROR_NOT_IMPLEMENTED seems like the way to go for a cid mismatch. That needs to be changed in the patch (also in the sample). The rest of the patch looks good.
Attachment #280910 -
Flags: review?(gavin.sharp) → review-
Reporter | ||
Comment 5•17 years ago
|
||
Per discussion with Gavin on IRC, throwing NS_ERROR_NOT_IMPLEMENTED if we don't get an iid of nsIFactory makes sense, since getClassInfo can give you an nsIFactory or an nsIClassInfo, but this code doesn't handle the later case, so we throw NOT_IMPLEMENTED. Per discussion with Shaver, he says to mirror the C++ version: http://mxr.mozilla.org/seamonkey/source/xpcom/glue/nsGenericFactory.cpp#380 So I'm throwing NS_ERROR_FACTORY_NOT_REGISTERED in case none of the cids match. Once there's a satisfactory review, I'll make a bug to make the xpcom JS samples match whatever finally goes in here.
Attachment #280910 -
Attachment is obsolete: true
Attachment #281371 -
Flags: review?(gavin.sharp)
Reporter | ||
Comment 6•17 years ago
|
||
Heh, Gavin commented just as I was attaching the new patch.
Comment 7•17 years ago
|
||
Comment on attachment 281371 [details] [diff] [review] New patch, hopefully addresses confusion Exactly! :) Thanks!
Attachment #281371 -
Flags: review?(gavin.sharp) → review+
Updated•17 years ago
|
Attachment #281371 -
Flags: review+
Comment 8•17 years ago
|
||
Patch landed on trunk -> FIXED
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•