Closed Bug 477735 Opened 17 years ago Closed 17 years ago

XPCOMUtils.generateQI should handle nulls in argument array

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: vlad, Assigned: vlad)

References

Details

(Keywords: fixed1.9.1, Whiteboard: [fixed1.9.1b99])

Attachments

(1 file)

This is kind of an edge case, but if an interface doesn't exist when accessed via Components.interfaces.nsIFoo, we'll get undef in the array; generateQI will then blow up when it tries to do "i.name". This happened when building the extension manager but with --disable-xpinstall; the EM .js file has generateQI([Ci.nsIXPIBlah]) where nsIXPIBlah was an xpinstall interface, and caused a blow up. This patch just walks through the array and only adds non-null/undef names to the array for the call to makeQI.
Attachment #361435 - Flags: review?(sayrer)
Comment on attachment 361435 [details] [diff] [review] make generateQI handle null/undef members in array [Checkin: Comment 3 & 7] should still be a one-liner, though. js> var interfaces = [{"name":"foo"}, null, {"name":"bar"}, undefined, {"name":"baz"}] js> var x = [i.name for each (i in interfaces) if (i)] js> x.length 3 js> x foo,bar,baz js>
Attachment #361435 - Flags: review?(sayrer) → review+
Man, that's starting to look like perlesque line noise ;) Sounds good though, will update.
Checked in with the one-liner, 0ce096d6b9df
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Assignee: nobody → vladimir
Target Milestone: --- → mozilla1.9.2a1
Version: unspecified → Trunk
Attachment #361435 - Flags: approval1.9.1?
Comment on attachment 361435 [details] [diff] [review] make generateQI handle null/undef members in array [Checkin: Comment 3 & 7] Can't hurt, and would help bug 484579 comment 33 for example.
Comment on attachment 361435 [details] [diff] [review] make generateQI handle null/undef members in array [Checkin: Comment 3 & 7] a191=beltzner
Attachment #361435 - Flags: approval1.9.1? → approval1.9.1+
Comment on attachment 361435 [details] [diff] [review] make generateQI handle null/undef members in array [Checkin: Comment 3 & 7] http://hg.mozilla.org/releases/mozilla-1.9.1/rev/aeffb6e8a4cc
Attachment #361435 - Attachment description: make generateQI handle null/undef members in array → make generateQI handle null/undef members in array [Checkin: Comment 3 & 7]
Keywords: fixed1.9.1
OS: Windows XP → All
Hardware: x86 → All
Whiteboard: [fixed1.9.1b5]
Whiteboard: [fixed1.9.1b5] → [fixed1.9.1b99]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: