Closed
Bug 793000
Opened 13 years ago
Closed 13 years ago
Make it easier to handle JS callbacks in webidl interface implementations
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 779048
People
(Reporter: smaug, Unassigned)
Details
If I read the generated code correctly, callbacks end up being JSObjects.
That is somewhat painful to use. One needs to wrap the params and use JS API to
do the actual function call, or less painful, add some
xpidl interface and wrap the callback to be that.
Would be really nice to have some refcounted C++ object which had for example
CallbackMethod method which takes C++ objects as params.
The object should be also cycle collectable.
| Reporter | ||
Comment 1•13 years ago
|
||
I'm hoping
callback MutationCallback = void (sequence<MutationRecord> mutations, MutationObserver observer);
would translate to something like (assuming MutationRecord -> nsDOMMutationRecord and MutationObserver -> nsDOMMutationObserver)
.h
namespace mozilla {
namespace dom {
class MutationCallback
{
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(MutationCallback)
void Call(nsTArray<already_AddRefed<nsDOMMutationRecord> > aMutations, already_AddRefed<nsDOMMutationObserver> aObserver);
private:
JSObject* mJSObject;
};
}
}
No longer blocks: 790978
Comment 2•13 years ago
|
||
See bug 779048? I'm happy to dup that here, but the question remains: What machinery will the Call() method have to do to call JS safely? Once we have that sorted out, making this work is not too bad, I hope.
| Reporter | ||
Updated•13 years ago
|
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
| Assignee | ||
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•