Closed
Bug 946897
Opened 11 years ago
Closed 11 years ago
WebIDL emits unhelpful error message on interface name collisions
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla31
People
(Reporter: mikeh, Assigned: anilreddykatta)
References
Details
(Whiteboard: [mentor=jdm][lang=py][good first bug])
Attachments
(1 file, 2 obsolete files)
1.76 KB,
patch
|
khuey
:
review+
|
Details | Diff | Splinter Review |
Found doing this:
--- X.webidl ---
callback Foo = void (DOMString foo);
interface Bar {
[Throws]
getFoo(optional Foo callback);
};
--- Y.webidl ---
interface Foo;
// ...
Emitted traceback and error:
Traceback (most recent call last):
File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/config/pythonpath.py", line 56, in <module>
main(sys.argv[1:])
File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/config/pythonpath.py", line 48, in main
execfile(script, frozenglobals)
File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/GlobalGen.py", line 81, in <module>
main()
File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/GlobalGen.py", line 55, in main
parser.parse(''.join(lines), fullPath)
File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/WebIDL.py", line 4811, in parse
self._productions.extend(self.parser.parse(lexer=self.lexer,tracking=True))
File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/other-licenses/ply/ply/yacc.py", line 263, in parse
return self.parseopt(input,lexer,debug,tracking,tokenfunc)
File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/other-licenses/ply/ply/yacc.py", line 710, in parseopt
p.callable(pslice)
File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/WebIDL.py", line 3809, in p_CallbackRest
identifier, p[3], p[5])
File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/WebIDL.py", line 2882, in __init__
IDLObjectWithScope.__init__(self, location, parentScope, identifier)
File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/WebIDL.py", line 410, in __init__
IDLObjectWithIdentifier.__init__(self, location, parentScope, identifier)
File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/WebIDL.py", line 362, in __init__
self.resolve(parentScope)
File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/WebIDL.py", line 369, in resolve
self.identifier.resolve(parentScope, self)
File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/WebIDL.py", line 343, in resolve
scope.ensureUnique(self, object)
File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/WebIDL.py", line 250, in ensureUnique
object)
File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/WebIDL.py", line 268, in resolveIdentifierConflict
if originalObject.tag == IDLInterfaceMember.Tags.Method and \
AttributeError: 'IDLExternalInterface' object has no attribute 'tag'
Comment 1•11 years ago
|
||
I suspect a good way to improve this situation is to check for IDLExternalInterface in resolveIdentifierConflict and print out a better message.
Whiteboard: [mentor=jdm][lang=py][good first bug]
Updated•11 years ago
|
Assignee: nobody → anilreddykatta
Printing extra information like identifier caused collision and respective location of files where it resides
Attachment #8346878 -
Flags: review?(khuey)
![]() |
||
Comment 6•11 years ago
|
||
What happens if it's the newObject that's the IDLExternalInterface?
Forgot to check whether newObjet or originalObject is instance of IDLExternalInterface
Attachment #8346878 -
Attachment is obsolete: true
Attachment #8346878 -
Flags: review?(khuey)
Attachment #8347041 -
Flags: review?(khuey)
@Boris: I forgot to do that. Fixed that in latest patch..May be you can have a look
![]() |
||
Comment 9•11 years ago
|
||
Yes, that looks much more plausible. Are the two if bodies in fact identical?
Assignee | ||
Comment 10•11 years ago
|
||
yeah...I was about to correct that..place body of if loop inside one if where conditions for newObject and originalObject are 'OR'
Assignee | ||
Comment 11•11 years ago
|
||
Merged two if's into one
Attachment #8347041 -
Attachment is obsolete: true
Attachment #8347041 -
Flags: review?(khuey)
Attachment #8347050 -
Flags: review?(khuey)
Comment on attachment 8347050 [details] [diff] [review]
bug946897_webidl_interface_name_collisions_updated.diff
Review of attachment 8347050 [details] [diff] [review]:
-----------------------------------------------------------------
I'm sorry it took me so long to get to this. Thank you very much for the patch. Please make these minor changes and then we can check it in.
::: dom/bindings/parser/WebIDL.py
@@ +259,5 @@
> if isinstance(originalObject, IDLExternalInterface) and \
> isinstance(newObject, IDLExternalInterface) and \
> originalObject.identifier.name == newObject.identifier.name:
> return originalObject
> +
Please remove the extra whitespace on this line.
@@ +264,5 @@
> + if isinstance(originalObject, IDLExternalInterface) or isinstance(newObject, IDLExternalInterface):
> + raise WebIDLError(
> + "Name collision between "
> + "interface declarations for identifier '%s' at '%s' and '%s'"
> + % (identifier.name,
And what's at the end of this line.
Attachment #8347050 -
Flags: review?(khuey) → review+
![]() |
||
Comment 13•11 years ago
|
||
anra_ka, will you have a chance to make those changes?
Flags: needinfo?(anilreddykatta)
Assignee | ||
Comment 14•11 years ago
|
||
Boris: I am currently out of station. Is it possible for you to make those changes?
Flags: needinfo?(anilreddykatta)
![]() |
||
Updated•11 years ago
|
Flags: needinfo?(bzbarsky)
![]() |
||
Comment 15•11 years ago
|
||
Flags: needinfo?(bzbarsky)
Comment 16•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•