Closed
Bug 916879
Opened 11 years ago
Closed 11 years ago
|attribute EventHandler onfoo;| should be infallible
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla27
People
(Reporter: emk, Assigned: smaug)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
88.70 KB,
patch
|
emk
:
review+
|
Details | Diff | Splinter Review |
89.70 KB,
patch
|
Details | Diff | Splinter Review |
It's ridiculous we will have to write [SetterThrows] every time we define an event handler attribute.
Comment 1•11 years ago
|
||
How about we fix our event code to not throw instead? There's no good reason an event handler setter should ever throw; certainly per spec it doesn't.
Assignee | ||
Comment 2•11 years ago
|
||
Indeed. It is pretty much impossible to throw from ELM::SetEventHandler.
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → bugs
Assignee | ||
Comment 3•11 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=8a62e5443ac1 No changes to workers, since that code will hopefully die soon.
Attachment #805608 -
Flags: review?(VYV03354)
Reporter | ||
Comment 4•11 years ago
|
||
Comment on attachment 805608 [details] [diff] [review] patch \o/ ::: content/events/src/EventTarget.cpp @@ -27,31 +27,33 @@ EventTarget::GetEventHandler(nsIAtom* aT > void > EventTarget::SetEventHandler(const nsAString& aType, > EventHandlerNonNull* aHandler, >- ErrorResult& rv) >+ ErrorResult& aRv) > { >+ if (!StringBeginsWith(aType, NS_LITERAL_STRING("on"))) { >+ aRv.Throw(NS_ERROR_INVALID_ARG); >+ return; >+ } Can anyone call this function without a string starting with "on"?
Attachment #805608 -
Flags: review?(VYV03354) → review+
Reporter | ||
Updated•11 years ago
|
Summary: |attribute EventHandler onfoo;| should imply [SetterThrows] → |attribute EventHandler onfoo;| should be infallible
Assignee | ||
Comment 5•11 years ago
|
||
It is for JS implemented EventTargets and they can pass anything.
Reporter | ||
Comment 6•11 years ago
|
||
nsIDOMEventTarget is a builtinclass. Is WebIDL EventTarget implementable with JS?
Comment 7•11 years ago
|
||
You can have JS-implemented WebIDL interfaces that inherit from EventTarget. The EventTarget impl will be in C++, but the JS code will be able to call ChromeOnly methods on it, of course.
Reporter | ||
Comment 8•11 years ago
|
||
Got it. Thanks for the explanation. https://mxr.mozilla.org/mozilla-central/search?string=.setEventHandler&find=&findi=&filter=^[^\0]*%24&hitlimit=&tree=mozilla-central
Assignee | ||
Comment 9•11 years ago
|
||
And apparently I had missed FMRadio
Assignee | ||
Comment 10•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/8fa498beb805
Comment 11•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/8fa498beb805
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
Comment 12•11 years ago
|
||
<3
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•