Closed Bug 398889 Opened 17 years ago Closed 15 years ago

XPCOMUtils.generateQI throws confusing error when interface doesn't exist

Categories

(Core :: XPConnect, defect)

x86
Linux
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 477735

People

(Reporter: jason.barnabe, Assigned: mnyromyr)

References

Details

Attachments

(1 obsolete file)

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a9pre) Gecko/2007092900 Minefield/3.0a9pre

The code

XPCOMUtils.generateQI([Components.interfaces.thisDoesntExist, Components.interfaces.nsISupports])

throws

JS Component Loader: ERROR file:///home/jason/firefox/dist/bin/modules/XPCOMUtils.jsm:114
                     TypeError: i has no properties

which is fairly confusing. It should throw an error that says the interface doesn't exist.
Blocks: 456209
Attached patch safeguard object member access (obsolete) — Splinter Review
If the interface doesn't exist or if you just pass null, i.name will throw on its own accord. Safeguarding this, we'll pass null down to the QI and correctly get NS_ERROR_NO_INTERFACE.
Assignee: nobody → mnyromyr
Attachment #374497 - Flags: review?(sayrer)
Already fixed in bug 477735. Were you looking at the 1.9.1 branch?
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
Attachment #374497 - Attachment is obsolete: true
Attachment #374497 - Flags: review?(sayrer)
Basically I think my patch is more elegant than Vlad's... ;-)
But it's good to see it's fixed.
The one he actually landed is functionally equivalent:
http://hg.mozilla.org/mozilla-central/rev/0ce096d6b9df
V.Duplicate
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: