Closed Bug 913053 Opened 10 years ago Closed 8 years ago

typedef of one dictionary as another doesn't work (when typedef is used in a sequence<> of another dictionary)

Categories

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

x86
macOS
defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: jib, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Here are the significant parts of the attached MediaStreamTrack.webidl file:

> // Didn't work. file bug (this bug)
> //
> // // MediaTrackConstraint is one key-value pair from MediaTrackConstraintSet.
> // // Implemented as full set. Test Object.keys(pair).length==1 !
> //
> // typedef MediaTrackConstraintSet MediaTrackConstraint;

> dictionary MediaTrackConstraints {
>     // mandatory is really a MediaTrackConstraintSet, but we must use object
>     // to avoid filtering out unknown constraints (keys)
>     object mandatory;
>     // _optional is really a sequence<MediaTrackConstraint>, but it didn't work
>     sequence<MediaTrackConstraintSet> _optional;
> };

When I uncomment the typedef and use it in the sequence<>, I get:

Traceback (most recent call last):
  File "/Users/Jan/moz/mozilla-central/config/pythonpath.py", line 56, in <module>
    main(sys.argv[1:])
  File "/Users/Jan/moz/mozilla-central/config/pythonpath.py", line 48, in main
    execfile(script, frozenglobals)
  File "/Users/Jan/moz/mozilla-central/dom/bindings/GlobalGen.py", line 81, in <module>
    main()
  File "/Users/Jan/moz/mozilla-central/dom/bindings/GlobalGen.py", line 67, in main
    generate_file(config, 'GeneratedAtomList', 'declare')
  File "/Users/Jan/moz/mozilla-central/dom/bindings/GlobalGen.py", line 16, in generate_file
    root = getattr(GlobalGenRoots, name)(config)
  File "/Users/Jan/moz/mozilla-central/dom/bindings/Codegen.py", line 10343, in GeneratedAtomList
    dictMembers = dict.members
AttributeError: 'IDLTypedefType' object has no attribute 'members'


The workaround is simple, so this is likely low priority.
Attachment #800194 - Attachment mime type: text/x-csrc → text/plain
The issue is that IDLTypedefType is an object-with-identifier... but its isDictionary() is the IDLType isDictionary().  As in, we have two different hierarchies (types and objects-with-identifier) which both have isDictionary() with different semantics, but IDLTypedefType is in both hierarchies.  Fail.  :(

We can add a check for this explicitly in Configuration when setting up self.dictionaries, but this is not the first time this has bitten us.  The only thing that saves us is people don't typedef named things much.

Kyle, how feasible is it to split out IDLTypedefType and IDLTypedef or something?
Flags: needinfo?(khuey)
Clearly I lost track of this :)

If we still want to do this, I don't think it would be difficult to split them.  I'm going off of (somewhat fuzzy) memory here though.

I'm assuming this isn't actually a priority for anything, since I ignored this ni? for close to 18 months and you never poked me about it ;)
Flags: needinfo?(khuey)
Well, it wasn't a priority for me... Can't speak for Jan-Ivar.  ;)
No it's fine. I would have made a noise. Age can be a good triage function.

Happy you go through your needinfo queue. :-)
Severity: normal → minor
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/641161844751
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.