Closed
Bug 675884
Opened 13 years ago
Closed 13 years ago
Implement Event constructors
Categories
(Core :: DOM: Events, defect)
Core
DOM: Events
Tracking
()
RESOLVED
FIXED
People
(Reporter: annevk, Assigned: smaug)
References
Details
(Keywords: dev-doc-complete)
Attachments
(2 files, 1 obsolete file)
18.28 KB,
patch
|
jst
:
review+
|
Details | Diff | Splinter Review |
1.67 KB,
patch
|
jst
:
review+
|
Details | Diff | Splinter Review |
DOM Core introduces a constructor syntax for Events. http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-event Please implement it so init*Event() can die in a fire.
Updated•13 years ago
|
OS: Mac OS X → All
Hardware: x86 → All
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → bugs
Assignee | ||
Comment 1•13 years ago
|
||
Patch coming soon for Event and CustomEvent. I don't know specs defining other event ctors.
Assignee | ||
Comment 2•13 years ago
|
||
Ah, there are other specs for other event ctors. But I'll start from Event and CustomEvent.
Assignee | ||
Comment 3•13 years ago
|
||
This adds the basic stuff (Event and CustomEvent and ctors are defined in DOM4). After this adding support for new event ctors is easy: - Create FooEventInit interface - Add NS_DEFINE_EVENT_CTOR(Foo) and NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(Foo) to nsDOMClassInfo.cpp - virtual const nsIID& EventInitIID() { return NS_GET_IID(nsIFooEventInit); } to the nsDOMFooEvent.h - Implement virtual nsresult InitFromCtor(const nsAString& aType, nsISupports* aDict);
Attachment #580075 -
Flags: review?(jst)
Assignee | ||
Comment 4•13 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=109e5fb30913
Comment 5•13 years ago
|
||
Can you check the expected behaviour for { bubbles: get () { throw foo } } and add a test? Also, \o/
Assignee | ||
Comment 6•13 years ago
|
||
Handle exceptions per WebIDL
Attachment #580075 -
Attachment is obsolete: true
Attachment #580075 -
Flags: review?(jst)
Attachment #580086 -
Flags: review?(jst)
Comment 7•13 years ago
|
||
Comment on attachment 580086 [details] [diff] [review] patch >--- a/content/events/src/nsDOMEvent.cpp >+++ b/content/events/src/nsDOMEvent.cpp >+nsDOMEvent::Initialize(nsISupports* aOwner, JSContext* aCx, JSObject* aObj, >+ PRUint32 aArgc, jsval* aArgv) >+{ >+ JSAutoRequest ar(aCx); >+ JSString* jsstr = JS_ValueToString(aCx, aArgv[0]); >+ if (!jsstr) { >+ return NS_ERROR_DOM_SYNTAX_ERR; >+ } >+ >+ JS::Anchor<JSString*> deleteProtector(jsstr); >+ size_t length; >+ const jschar* chars = JS_GetStringCharsAndLength(aCx, jsstr, &length); >+ if (!chars) { >+ return NS_ERROR_OUT_OF_MEMORY; >+ } >+ >+ nsAutoString type; >+ type.Assign(chars, length); >+ deleteProtector.clear(); Can this use nsDependentJSString?
Assignee | ||
Comment 8•13 years ago
|
||
I don't know why nsDependentJSString is ever safe to use.
Assignee | ||
Comment 9•13 years ago
|
||
I'm trying to write a code generator for event ctors. But feel free to review the current patches.
Assignee | ||
Comment 10•13 years ago
|
||
I filed Bug 709569 to get a tool for generic dictionary handling.
Assignee | ||
Comment 11•13 years ago
|
||
I'll file a followup bug to get better nsDependentJSString <-> JS::Anchor handling. nsDependentJSString could just do the right thing with JSString, or at least enforce that JS::Anchor is used.
Attachment #580086 -
Attachment is obsolete: true
Attachment #580086 -
Flags: review?(jst)
Attachment #580731 -
Flags: review?(jst)
Assignee | ||
Comment 12•13 years ago
|
||
Comment on attachment 580086 [details] [diff] [review] patch er, the previous patch is on top of this.
Attachment #580086 -
Attachment is obsolete: false
Attachment #580086 -
Flags: review?(jst)
Updated•13 years ago
|
Attachment #580086 -
Flags: review?(jst) → review+
Updated•13 years ago
|
Attachment #580731 -
Flags: review?(jst) → review+
Assignee | ||
Comment 13•13 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/01a26239462a https://hg.mozilla.org/mozilla-central/rev/1ab5ed4f93bf
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Updated•13 years ago
|
Keywords: dev-doc-needed
Comment 14•11 years ago
|
||
We really need serious documentation for this...
Comment 15•10 years ago
|
||
Documentation updated: Constructor: https://developer.mozilla.org/en-US/docs/Web/API/Event.Event https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent Interface pages updated: https://developer.mozilla.org/en-US/docs/Web/API/Event https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent init*Event pages deprecated: https://developer.mozilla.org/en-US/docs/Web/API/Event.initEvent https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.initCustomEvent and https://developer.mozilla.org/en-US/Firefox/Releases/11#DOM updated
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•