Closed Bug 946897 Opened 8 years ago Closed 8 years ago

WebIDL emits unhelpful error message on interface name collisions


(Core :: DOM: Core & HTML, defect)

Not set





(Reporter: mikeh, Assigned: anilreddykatta)



(Whiteboard: [mentor=jdm][lang=py][good first bug])


(1 file, 2 obsolete files)

Found doing this:

--- X.webidl ---
callback Foo = void (DOMString foo);
interface Bar {
  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/", line 56, in <module>
  File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/config/", line 48, in main
    execfile(script, frozenglobals)
  File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/", line 81, in <module>
  File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/", line 55, in main
    parser.parse(''.join(lines), fullPath)
  File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/", line 4811, in parse
  File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/other-licenses/ply/ply/", 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/", line 710, in parseopt
  File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/", line 3809, in p_CallbackRest
    identifier, p[3], p[5])
  File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/", line 2882, in __init__
    IDLObjectWithScope.__init__(self, location, parentScope, identifier)
  File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/", line 410, in __init__
    IDLObjectWithIdentifier.__init__(self, location, parentScope, identifier)
  File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/", line 362, in __init__
  File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/", line 369, in resolve
    self.identifier.resolve(parentScope, self)
  File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/", line 343, in resolve
    scope.ensureUnique(self, object)
  File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/", line 250, in ensureUnique
  File "/home/mikeh/dev/mozilla/m-c/b2g-inbound/dom/bindings/parser/", line 268, in resolveIdentifierConflict
    if originalObject.tag == IDLInterfaceMember.Tags.Method and \
AttributeError: 'IDLExternalInterface' object has no attribute 'tag'
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]
Assignee: nobody → anilreddykatta
can any tell me how to reproduce the issue?
can any tell me how to reproduce the issue?
anra_ka: see comment 0?
Printing extra information like identifier caused collision and respective location of files where it resides
Attachment #8346878 - Flags: review?(khuey)
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
Yes, that looks much more plausible.  Are the two if bodies in fact identical?
yeah...I was about to correct body of if loop inside one if where conditions for newObject and originalObject are 'OR'
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]

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/
@@ +259,5 @@
>          if isinstance(originalObject, IDLExternalInterface) and \
>             isinstance(newObject, IDLExternalInterface) and \
>    ==
>              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'"
> +                % (, 

And what's at the end of this line.
Attachment #8347050 - Flags: review?(khuey) → review+
anra_ka, will you have a chance to make those changes?
Flags: needinfo?(anilreddykatta)
Boris: I am currently out of station. Is it possible for you to make those changes?
Flags: needinfo?(anilreddykatta)
Blocks: 879917
Flags: needinfo?(bzbarsky)
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.