Closed Bug 315442 Opened 20 years ago Closed 19 years ago

Need a scriptable way to post an event to an event target

Categories

(Core :: XPCOM, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: benjamin, Assigned: darin.moz)

References

()

Details

From bug 315087: We need a scriptable way to post an event to an event target. Since I don't really understand PLEvent all that well, here's my understand of our options: 1) add a method postScriptableEvent(in nsIRunnable); on the current nsIEventTarget 2) add a helper service something like this: interface nsIScriptableEventHelper : nsISupports { void postScriptableEvent(in nsIEventTarget, in nsIRunnable); }; Either way would end up wrapping the nsIRunnable with a PLEvent and calling it on the other end.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.9alpha
I believe that we also want an interface that would be a good candidate for being frozen for use not only by JS but also by C++. My current thinking is to go with something more like suggestion 2 -- to build a service that provides functions for operating on a nsIEventTarget. [scriptable, uuid(...)] interface nsIEventTargetManager : nsISupports { void post(in nsIEventTarget target, in nsIRunnable runnable, in boolean synchronous); nsIEventTarget getEventTarget(in ACString name); nsIEventTarget setEventTarget(in ACString name, in nsIEventTarget target); }; This interface gives consumers a way to not only post an event (in the form of a nsIRunnable), but it also gives them a way to access "special" nsIEventTargets such as the following: "main" "current" "socket" "io-thread-pool" The last two are examples of nsIEventTarget instances that are added dynamically by Necko. We might want to treat the empty string as equivalent to "current". Anyways, this is still a thought in progress, but I wanted to jot it down.
My proposed interface is wiki'd here: http://wiki.mozilla.org/XPCOM:nsIEventTargetManager Please read that instead of comment #1.
Blocks: 320988
FYI, I'm planning something quite different from what is proposed here and on the wiki page. More in a while...
Depends on: nsIThreadManager
Severity: normal → enhancement
Priority: -- → P2
This bug is fixed by the threadmanager patch in bug 326273.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.