Open
Bug 763860
Opened 12 years ago
Updated 2 years ago
xpidl needs to reject overloaded methods in scriptable interfaces even if the first letter is different case
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
NEW
People
(Reporter: ayg, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(3 files)
9.68 KB,
patch
|
Details | Diff | Splinter Review | |
3.25 KB,
patch
|
Details | Diff | Splinter Review | |
20.55 KB,
text/plain
|
Details |
See bug 762841. Attachment 631846 [details] [diff] there did nsISelection getSelection(in short type); + [noscript,notxpcom,nostdcall] Selection GetSelection(in short type); When I wrote "getSelection" for the second method, it complained that there was a naming conflict, but when I capitalized it, it worked happily. But then it broke horribly on Windows, because the generated C++ methods had the same name and that breaks on Windows for scriptable interfaces for some reason. The parser should refuse to do this.
Comment 1•12 years ago
|
||
It breaks on windows for any interface if you call it through XPConnect, because MSVC will reorder the members in some cases and then the vtable info XPConnect no longer matches the actual vtable.
Comment 2•12 years ago
|
||
Boris, does that apply to overloaded methods only? or can that error occur for any [noscript,notxpcom,nostdcall] method in a scriptable interface?
Comment 3•12 years ago
|
||
That applies to overloaded methods.
Comment 4•12 years ago
|
||
Note that if all of the overloaded methods are noscript/notxpcom (whichever makes them impossible to get called through xpconnect) this should be fine... Although I personally wouldn't go through the trouble of special casing that!
Comment 5•12 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #1) > It breaks on windows for any interface if you call it through XPConnect, > because MSVC will reorder the members in some cases and then the vtable info > XPConnect no longer matches the actual vtable. Is that the case also if we use two separate classes? If we generate the scriptable class with a different name: class NS_NO_VTABLE NS_SCRIPTABLE nsISelectionControllerScriptable : public nsISelectionDisplay { ... IDL stuff ... }; and then declare the internal type like so: class NS_NO_VTABLE nsISelectionController : public nsISelectionControllerScriptable { public: using nsISelectionControllerS::GetSelection; virtual already_AddRefed<mozilla::Selection> GetSelection(PRInt16 type) = 0; }; I tested this briefly on Linux and Win7 and it seemed to work...
Comment 6•12 years ago
|
||
> Is that the case also if we use two separate classes?
No, that can't be reordered, because the superclass vtable needs to not include the subclass methods.
Comment 7•12 years ago
|
||
This patch implements a 'separate_scriptable_name' interface attribute that generates a separate class with the name given name and only includes scriptable methods/attributes and constants in that class. The non-scriptable stuff goes into a sub-class. I've also added a 'overloaded' method attribute to indicate an scriptable/non-scriptable overloaded method (to generate the "using ..." bit), but this is probably redundant since it can be deduced from the internal method table I think.
Comment 8•12 years ago
|
||
Comment 9•12 years ago
|
||
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•