Closed
Bug 1023698
Opened 10 years ago
Closed 10 years ago
Missing JSContext* parameter in Generated Event Constructor
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla33
People
(Reporter: schien, Assigned: smaug)
Details
Attachments
(3 files, 1 obsolete file)
2.14 KB,
patch
|
Details | Diff | Splinter Review | |
2.94 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
2.93 KB,
patch
|
Details | Diff | Splinter Review |
===Example WebIDL=== [Constructor(DOMString type, optional TestBaseEventInit eventInitDict)] interface TestBaseEvent: Event { readonly attribute any data; }; dictionary TestBaseEventInit : EventInit { any data; }; [Constructor(DOMString type, optional TestEventInit eventInitDict)] interface TestEvent: TestBaseEvent { readonly attribute DOMString someString; }; dictionary TestEventInit : TestBaseEventInit { DOMString someString = ""; }; ===Compile Error=== 3:45.54 ./TestEventBinding.cpp:303:12: error: no matching function for call to 'Constructor' 3:45.54 result = mozilla::dom::TestEvent::Constructor(global, cx, NonNullHelper(Constify(arg0)), Constify(arg1), rv); 3:45.55 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3:45.55 ./TestEvent.cpp:61:12: note: candidate function not viable: requires 3 arguments, but 5 were provided 3:45.55 TestEvent::Constructor(mozilla::dom::EventTarget* aOwner, const nsAString& aType, const TestEventInit& aEventInitDict) 3:45.55 ^ 3:45.55 ./TestEvent.cpp:74:12: note: candidate function not viable: requires 4 arguments, but 5 were provided 3:45.55 TestEvent::Constructor(const GlobalObject& aGlobal, const nsAString& aType, const TestEventInit& aEventInitDict, ErrorResult& aRv) 3:45.55 ^
Reporter | ||
Comment 1•10 years ago
|
||
CGEventMethod should also check inherited interfaces for appending JSContext* in argument list. http://dxr.mozilla.org/mozilla-central/source/dom/bindings/Codegen.py?from=codegen.py&case=true#13567
Comment 2•10 years ago
|
||
Or maybe just examine the types in the signature of self.member instead? That's what really matters here; the fact that those happen to match the interface member types in the case of events is somewhat accidental.
Assignee | ||
Comment 3•10 years ago
|
||
+ "\n" removal is to fix .h coding style. No extra newlines. Event codegen very much relies on interface attributes and dictionary properties etc. to match.
Attachment #8438639 -
Flags: review?(bzbarsky)
Comment 4•10 years ago
|
||
Comment on attachment 8438639 [details] [diff] [review] patch >+ while iface.identifier.name != "Event": Why not just: while iface: ? But also, is this really simpler/better than: return needCx(None, self.member.signatures()[0][1], [], True) ?
Assignee | ||
Comment 5•10 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #4) > Why not just: > > while iface: > > ? Just because rest of the codegen tends to iterate up to Event > > But also, is this really simpler/better than: > > return needCx(None, self.member.signatures()[0][1], [], True) I have no idea what that does. Hard to read at least.
Comment 6•10 years ago
|
||
> I have no idea what that does.
It passes the list of our actual IDL arguments to needCx, which is how needCx is _meant_ to be used. The fact that it even worked with an interface member list is just because both arguments and attributes happen to have the type in .type (which I've been planning to change for attributes, btw!) and because we only support attributes in codegenned events.
So how about this:
1) Add an arguments() method to IDLMethod, which asserts that there is only one signature and returns that signatures arguments.
2) Use self.member.arguments() here.
Assignee | ||
Comment 7•10 years ago
|
||
Need to still change .member name to be something which might hint what it is about, or hide .member here and add arguments to CGNativeMember or something.
Assignee | ||
Comment 8•10 years ago
|
||
Attachment #8438639 -
Attachment is obsolete: true
Attachment #8438639 -
Flags: review?(bzbarsky)
Attachment #8438668 -
Flags: review?(bzbarsky)
Comment 9•10 years ago
|
||
Comment on attachment 8438668 [details] [diff] [review] hide the magic behind def arguments() >+ def arguments(self): >+ return self.member.signatures()[0][1]; Oh, I meant adding arguments() to IDLMethod over in the parser. But this is ok, I guess. r=me
Attachment #8438668 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 10•10 years ago
|
||
Yeah, I realized you wanted arguments() to IDLMethod, but one would still need to use .member which is too magical ;)
Assignee | ||
Comment 11•10 years ago
|
||
Assignee | ||
Comment 12•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/19ba96e89095
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → bugs
https://hg.mozilla.org/mozilla-central/rev/19ba96e89095
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
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
•