Implement enum as dictionary member for WebIDL

RESOLVED FIXED

Status

()

Core
DOM
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: wchen, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
Code generation fails if we have an enum type as a dictionary member.

Example (from http://dvcs.w3.org/hg/notifications/raw-file/tip/Overview.html#api):

dictionary NotificationOptions {
  NotificationDirection titleDir;
  DOMString body;
  NotificationDirection bodyDir;
  DOMString tag;
  DOMString iconUrl;
};

enum NotificationDirection {
  "auto",
  "ltr",
  "rtl"
};
The actual error William is seeing:

  File "/Users/wchen/mozilla/dom/bindings/Codegen.py", line 1704, in
  getJSToNativeConversionTemplate
    if type.isAny():
  File "/Users/wchen/mozilla/dom/bindings/parser/WebIDL.py", line 778, in isAny
    return self.tag() == IDLType.Tags.any
  File "/Users/wchen/mozilla/dom/bindings/parser/WebIDL.py", line 791, in tag
    assert False # Override me!

This is due to dictionaries not calling complete() on their member types, which causes the type here to be an IDLUnresolvedType instead of an IDLWrapperType for a dictionary.

The patch in bug 763911 fixes that, and in my tree with that patch this works.
Depends on: 763911
er, I meant IDLWrapperType for an enum.
Is this fixed? If so, should this be a dupe of bug 763911?
Yeah, this is fixed.  We have a test for this in TestCodeGen.webidl.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.