Closed
Bug 870219
Opened 12 years ago
Closed 12 years ago
Add a way for JS-implemented WebIDL objects to sanely do event handlers
Categories
(Core :: DOM: Events, defect)
Tracking
()
RESOLVED
FIXED
mozilla23
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
(Keywords: dev-doc-needed)
Attachments
(2 files)
6.11 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
1.50 KB,
patch
|
bent.mozilla
:
review+
|
Details | Diff | Splinter Review |
Without having to reinvent the wheel, that is.
Assignee | ||
Comment 1•12 years ago
|
||
With the upcoming patch, implementing something like this:
attribute EventHandler onaddstream;
would look like this:
get onaddstream() {
return this.__DOM_IMPL__.getEventHandler("addstream");
},
set onaddstream(handler) {
return this.__DOM_IMPL__.setEventHandler("addstream", handler);
},
which is not as cool as if we autogenerated it in the binding code, but better than nothing...
Of course the other option is we could just special-case event handlers in the binding codegen: for things inheriting from EventTarget, attributes of type EventHandler, named on*, just generate calls into the superclass... Not sure whether it's worth the bother.
Assignee | ||
Comment 2•12 years ago
|
||
Attachment #747293 -
Flags: review?(bugs)
Assignee | ||
Updated•12 years ago
|
Updated•12 years ago
|
Attachment #747293 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 3•12 years ago
|
||
Flags: in-testsuite-
Whiteboard: [need review]
Target Milestone: --- → mozilla23
Comment 4•12 years ago
|
||
Any reason you called it setEventHandler rather than setEventListener?
Assignee | ||
Comment 5•12 years ago
|
||
Yes they're different things. An event listener is something that gets invoked when an event fires. An event handler is a callback that a very special kinds of event listener can call...
Comment 6•12 years ago
|
||
addEventListener handles event listeners, onfoo properties are event handlers.
Assignee | ||
Comment 7•12 years ago
|
||
And backed out: https://hg.mozilla.org/integration/mozilla-inbound/rev/10cb7bc4cc58
The problem is that worker code is crashing at startup with:
###!!! ASSERTION: Wrong thread!: '!NS_IsMainThread()', file ../../../dom/workers/WorkerPrivate.cpp, line 4257
with the stack showing JS running under the component loader and doing:
mozilla::dom::EventTargetBinding_workers::CreateInterfaceObjects(JSContext*, JS::Handle<JSObject*>, JSObject**)+0x00000063 [/builds/slave/m-in-osx64-d-00000000000000000/build/obj-firefox/dist/FirefoxNightlyDebug.app/Contents/MacOS/XUL +0x01882423]
mozilla::dom::workers::ResolveWorkerClasses(JSContext*, JS::Handle<JSObject*>, JS::Handle<jsid>, unsigned int, JS::MutableHandle<JSObject*>)+0x000001BF [/builds/slave/m-in-osx64-d-00000000000000000/build/obj-firefox/dist/FirefoxNightlyDebug.app/Contents/MacOS/XUL +0x00D1679F]
BackstagePass::NewResolve(nsIXPConnectWrappedNative*, JSContext*, JSObject*, jsid, unsigned int, JSObject**, bool*)+0x00000086 [/builds/slave/m-in-osx64-d-00000000000000000/build/obj-firefox/dist/FirefoxNightlyDebug.app/Contents/MacOS/XUL +0x010FAC86]
Assignee | ||
Comment 8•12 years ago
|
||
Attachment #747539 -
Flags: review?(bent.mozilla)
Comment on attachment 747539 [details] [diff] [review]
part 1. Fix the chrome-scope checking for workers to work even if we incorrectly set up worker interface objects on the main thread.
Are we guaranteed that nsThreadUtils.h is included somewhere?
Attachment #747539 -
Flags: review?(bent.mozilla) → review+
Assignee | ||
Comment 10•12 years ago
|
||
> Are we guaranteed that nsThreadUtils.h is included somewhere?
I'll add it to the list of binding includes, just in case.
Assignee | ||
Comment 11•12 years ago
|
||
Comment 12•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/096e054032bf
https://hg.mozilla.org/mozilla-central/rev/3e42977d6d77
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Updated•12 years ago
|
Keywords: dev-doc-needed
You need to log in
before you can comment on or make changes to this bug.
Description
•