Last Comment Bug 764398 - Implement enum as dictionary member for WebIDL
: Implement enum as dictionary member for WebIDL
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM (show other bugs)
: unspecified
: x86 Mac OS X
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on: 763911
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-13 08:01 PDT by William Chen [:wchen]
Modified: 2012-06-25 06:23 PDT (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description William Chen [:wchen] 2012-06-13 08:01:33 PDT
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"
};
Comment 1 Boris Zbarsky [:bz] 2012-06-13 08:59:50 PDT
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.
Comment 2 Boris Zbarsky [:bz] 2012-06-13 09:01:01 PDT
er, I meant IDLWrapperType for an enum.
Comment 3 Peter Van der Beken [:peterv] - away till Aug 1st 2012-06-25 03:55:35 PDT
Is this fixed? If so, should this be a dupe of bug 763911?
Comment 4 Boris Zbarsky [:bz] 2012-06-25 06:23:49 PDT
Yeah, this is fixed.  We have a test for this in TestCodeGen.webidl.

Note You need to log in before you can comment on or make changes to this bug.