Closed Bug 72908 Opened 24 years ago Closed 24 years ago

document support for [function] interfaces

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla0.9.1

People

(Reporter: jband_mozilla, Assigned: jband_mozilla)

Details

Attachments

(2 files)

I intend to add support to xpidl to mark [function] interfaces. The idea is that such interfaces are used to implement backward compatible event sinks where the old JS DOM would expect the event sink to be a function object (rather than an object with named methods). Marking an interface like... [scriptable, function, uuid(...)] ...will indicate to xpconnect (and possibly other language mappings) that when calling into the JS code implementing the interface it should try to use the wrapped JSObject as a function rather than looking up the named function on the JSObject. This will allow DOM code to dispatch these calls to JS (or other) event sinks as regular XPCOM calls. Other language mappings may choose to ignore this flag and implement such sinks in the normal manner. This really exists for backward compatibility. I opted to have [function] pertain to the entire interface rather than just selected methods. This is a somewhat arbitrary decision. I think it is better because it designates the intended use of the entire interface. I'll attach a patch that I intend to land soon on jband_xpconnect_flattening_BRANCH. If anyone has a serious problem with this then speak up. A JS test that works against the patch (in xpcshell) looks like: var Echo = new Components.Constructor( "@mozilla.org/js/xpc/test/Echo;1", "nsIEcho"); var echo = new Echo(); function foo(s) {print("function called with s = '"+s+"'");} echo.callFunction(foo, "some string");
Attached patch proposed changeSplinter Review
Attached patch proposed changeSplinter Review
NOTE: Second diff is identical to the first. Submitted twice.
I just checked the changes into jband_xpconnect_flattening_BRANCH. We can still hash this out before it hits the trunk.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.1
Summary: add support for [function] interfaces → document support for [function] interfaces
typelib spec updated.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Component: xpidl → XPCOM
QA Contact: jband_mozilla → xpcom
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: