Closed Bug 855700 Opened 12 years ago Closed 12 years ago

Returning an nsIVariant from WebIDL doesn't work

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla23

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(1 file)

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.
Assignee: nobody → bzbarsky
Attachment #730682 - Flags: feedback?(ted)
Whiteboard: [need review]
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+
Flags: in-testsuite?
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: 12 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: