Closed Bug 879917 Opened 11 years ago Closed 10 years ago

the WebIDL parser should more gracefully handle dictionaries being defined twice.

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: tbsaunde, Assigned: TYLin)

References

Details

(Whiteboard: [mentor=bzbarsky@mit.edu][lang=python][good first bug])

Attachments

(2 files, 3 obsolete files)

This can happen if you say accidentally add the webidl file to the list of files twice.
So the issue is that IDLScope.resolveIdentifierConflict does this:

268         if originalObject.tag == IDLInterfaceMember.Tags.Method and \
269            newObject.tag == IDLInterfaceMember.Tags.Method:
270             return originalObject.addOverload(newObject)

But if originalObject is an IDLDictionary, say, it has no .tag.

Kyle, can/should we just use isinstance here instead?
Flags: needinfo?(khuey)
That seems reasonable to me.
Flags: needinfo?(khuey)
Need to land the fix for bug 946897 and then see what's left to do here...
Depends on: 946897
Whiteboard: [mentor=bzbarsky@mit.edu][lang=python][good first bug]
Is there anything left to do after bug 946897 was landed? If yes, I would like to take this as my first bug. Please tell me how to reproduce this issue. Thanks.
Flags: needinfo?(bzbarsky)
Assignee: nobody → tlin
Sorry for the lag; it was the weekend...

Yes, there's something to do here.  You can reproduce by adding these two lines to any WebIDL file:

  dictionary Foo {};
  dictionary Foo {};

and then seeing the totally incomprehensible exception that gets thrown when you build in dom/bindings.

If you want to work on this, that sounds great!  I'm happy to answer any questions you have; response times should be smaller during the week.  ;)
Flags: needinfo?(bzbarsky)
Summary: the WebIDL parser should more gracefully handle interfaces or dictionaries being defined twice. → the WebIDL parser should more gracefully handle dictionaries being defined twice.
Attachment #8417250 - Flags: review?(bzbarsky)
Attachment #8417251 - Flags: review?(bzbarsky)
Comment on attachment 8417250 [details] [diff] [review]
part 1: Strip trailing whitespaces in WebIDL.py

r=me
Attachment #8417250 - Flags: review?(bzbarsky) → review+
Comment on attachment 8417251 [details] [diff] [review]
part 2: Emit useful message on dictionary name collisions

Shouldn't that be "or" instead of "and"?

r=me with that change or an explanation of why it's "and".
Attachment #8417251 - Flags: review?(bzbarsky) → review+
Comment on attachment 8417799 [details] [diff] [review]
part 1: Strip trailing whitespaces in WebIDL.py.

Review of attachment 8417799 [details] [diff] [review]:
-----------------------------------------------------------------

Carry over r+.
Attachment #8417799 - Flags: review+
Attachment #8417799 - Flags: review+
Attachment #8417251 - Attachment is obsolete: true
Attachment #8417803 - Flags: review+
Comment on attachment 8417799 [details] [diff] [review]
part 1: Strip trailing whitespaces in WebIDL.py.

Review of attachment 8417799 [details] [diff] [review]:
-----------------------------------------------------------------

Carry over r+.
Attachment #8417799 - Flags: review+
(In reply to Ting-Yu Lin [:TYLin] from comment #13)
> Created attachment 8417803 [details] [diff] [review]
> part 2: Emit useful message on dictionary name collisions.

It should be "or". Using "and" generates exception on the following test case:

callback Foo = void (int foo);
dictionary Foo {};

bz, thanks for your review!
Keywords: checkin-needed
Hi, could you provide a Try link. Suggestions for what to run if you haven't yet can be found here:
https://wiki.mozilla.org/Sheriffing/How:To:Recommended_Try_Practices
Keywords: checkin-needed
Since I modified only the WebIDL parser, it should be sufficient to test the build status.

Try result:
https://tbpl.mozilla.org/?tree=Try&rev=fd05455cd50a
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/c9e5847428d5
https://hg.mozilla.org/mozilla-central/rev/aceefcfd3708
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: