Closed Bug 855700 Opened 10 years ago Closed 10 years ago
Returning an ns
IVariant from Web IDL doesn't work
This is needed for bug 851542 for now until we have IDL arrays. But it might come up for something else too. The basic problem is that we treat nsIVariant as an external interface, call dom::WrapObject<nsIVariant>, which calls dom::XPCOMObjectToJsval, which calls dom::NativeInterface2JSObjectAndThrowIfFailed, which calls XPCConvert::NativeInterface2JSObject. And that fails, in a web page, because variants have no classinfo. The point, of course, is we don't want to create a wrapper for a variant at all. Note that XPCConvert::NativeData2JS special-cases nsIVariant in the nsXPTType::T_INTERFACE case by calling XPCVariant::VariantDataToJS. We need to do something similar.
Attachment #730682 - Flags: feedback?(ted)
Attachment #730682 - Flags: feedback?(ted) → review?(peterv)
This makes the patch in bug 851542 work for me.
Comment on attachment 730682 [details] [diff] [review] Make returning an nsIVariant from a WebIDL interface work. Exception handling is a bit ugly, but should at least be safe. I don't think we handle exceptions too consistently with VariantDataToJS.
Attachment #730682 - Flags: review?(peterv) → review+
Whiteboard: [need review]
Target Milestone: --- → mozilla23
Hmm, looks like I'm getting crash because iid is null.
debug only assertion crash.
MOZ_ASSERT(!iid || iid->Equals(NS_GET_IID(nsIVariant))); for now.
Does putting back the notflattened=True help?
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.