Closed
Bug 523817
Opened 15 years ago
Closed 15 years ago
Make optional out params actually work and allow [optional] before [retval]
Categories
(Core :: XPConnect, defect, P2)
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
status1.9.2 | --- | beta2-fixed |
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
Attachments
(1 file)
5.78 KB,
patch
|
shaver
:
review+
|
Details | Diff | Splinter Review |
Two proposed changes:
1) [optional] out params almost work. The XPCWrappedNative::CallMethod machinery deals with the part after the call fine (converts the out result to a jsval and if the arg wasn't passed just drops the jsval on the floor so it'll get gced later. But the checks before the call require an object for out params, even optional ones. Loosening up the checks is pretty straightforward.
2) xpidl enforces that only [optional] arguments come after an [optional] argument. I'd like to relax that to allow a [retval] as well.
The net result is that I can then write:
void getEventTargetChainFor(in nsIDOMEventTarget aEventTarget,
[optional] out unsigned long aCount,
[retval, array, size_is(aCount)] out
nsIDOMEventTarget aOutArray);
and from JS call:
getEventTargetChainFor(foo);
and have it work.
Assignee | ||
Comment 1•15 years ago
|
||
Mike, would you do the honors?
Assignee | ||
Comment 2•15 years ago
|
||
Oh, and if someone has bright ideas for how to test short of changing some of our existing tests to exercise this code, that'd be nice.
Comment 3•15 years ago
|
||
(In reply to comment #2)
> Oh, and if someone has bright ideas for how to test short of changing some of
> our existing tests to exercise this code, that'd be nice.
We'd have to change some interface to make it work - I presume you'll have a test in 507488 which should be good enough, right?
Assignee | ||
Comment 4•15 years ago
|
||
Yeah, absolutely.
Updated•15 years ago
|
Attachment #407748 -
Flags: review?(shaver) → review+
Comment 5•15 years ago
|
||
Comment on attachment 407748 [details] [diff] [review]
Like so
r=shaver, given the referenced tests.
Assignee | ||
Comment 6•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Assignee | ||
Updated•15 years ago
|
Attachment #407748 -
Flags: approval1.9.2?
Assignee | ||
Comment 7•15 years ago
|
||
Comment on attachment 407748 [details] [diff] [review]
Like so
We should take this on 1.9.2. It's completely compatible with both js and c++ callers and callees.
Updated•15 years ago
|
Keywords: dev-doc-needed
Comment 9•15 years ago
|
||
Yay!
If the interface's implementation is in JS, does it still need to set the now-optional size_is argument? Or does xpconnect magically pull .length from the JS array?
Also, since you didn't bump the IID in the idl, I assume it's safe to go ahead and add the [optional] on existing interfaces?
Comment 10•15 years ago
|
||
(In reply to comment #9)
> Also, since you didn't bump the IID in the idl, I assume it's safe to go ahead
> and add the [optional] on existing interfaces?
Yeah, it's a completely compatible interface change. Yay!
Assignee | ||
Comment 11•15 years ago
|
||
Justin, this doesn't affect callees, just like [optional] in general. So the JS impl still needs to set the size_is argument.
And yes, this is a completely compatible change, so you can sprinkle the [optional] around.
Comment 13•15 years ago
|
||
Thus, blocking. Please land away on 1.9.2.
Flags: blocking1.9.2? → blocking1.9.2+
Priority: -- → P2
Assignee | ||
Comment 14•15 years ago
|
||
status1.9.2:
--- → final-fixed
Assignee | ||
Updated•15 years ago
|
Attachment #407748 -
Flags: approval1.9.2?
Comment 15•14 years ago
|
||
Bug 399537 covers the need to update and migrate the XPIDL docs, removing the doc needed keyword here.
Keywords: dev-doc-needed
You need to log in
before you can comment on or make changes to this bug.
Description
•