Closed Bug 777074 Opened 12 years ago Closed 12 years ago

dictionary_helper_gen.py doesn't handle 'unsigned long' types

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mikeh, Assigned: smaug)

References

Details

Attachments

(2 files, 4 obsolete files)

Steps to reproduce:
1. edit an IDL to include a dictionary with 'unsigned long' types, e.g.:
dictionary Foo {
  unsigned long bar;
};
2. modify dictionary_helper_gen.conf to include your IDL;
3. make

Expected behaviour: should handle unsigned long types.

Observed behaviour:
Traceback (most recent call last):
  File "/home/mikeh/dev/mozilla/btg011/gecko/config/pythonpath.py", line 56, in <module>
    main(sys.argv[1:])
  File "/home/mikeh/dev/mozilla/btg011/gecko/config/pythonpath.py", line 48, in main
    execfile(script, frozenglobals)
  File "/home/mikeh/dev/mozilla/btg011/gecko/js/xpconnect/src/dictionary_helper_gen.py", line 464, in <module>
    print_cpp_file(outfd, conf)
  File "/home/mikeh/dev/mozilla/btg011/gecko/js/xpconnect/src/dictionary_helper_gen.py", line 247, in print_cpp_file
    print_cpp(idl, fd, conf, d[0], dicts)
  File "/home/mikeh/dev/mozilla/btg011/gecko/js/xpconnect/src/dictionary_helper_gen.py", line 188, in print_cpp
    write_cpp(p, fd)
  File "/home/mikeh/dev/mozilla/btg011/gecko/js/xpconnect/src/dictionary_helper_gen.py", line 401, in write_cpp
    write_getter(a, iface, fd)
  File "/home/mikeh/dev/mozilla/btg011/gecko/js/xpconnect/src/dictionary_helper_gen.py", line 341, in write_getter
    raise BaseException("Unsupported type %s found in dictionary %s" % (realtype, iface.name))
BaseException: Unsupported type PRUint32  found in dictionary Dimensions
make[7]: *** [DictionaryHelpers.cpp] Error 1
make[7]: *** Deleting file `DictionaryHelpers.cpp'
make[6]: *** [libs] Error 2
make[5]: *** [libs_tier_platform] Error 2
make[4]: *** [tier_platform] Error 2
make[3]: *** [default] Error 2
make[2]: *** [realbuild] Error 2
make[1]: *** [build] Error 2

Note: signed 'long' works fine.
Attached patch patch (obsolete) — Splinter Review
Attached patch patch (obsolete) — Splinter Review
Attachment #645502 - Attachment is obsolete: true
Btw, this stuff used to work when dictionaries used XPCOM stuff.
Attached patch with commit message (obsolete) — Splinter Review
At least it compiles :)
Assignee: nobody → bugs
Attachment #645513 - Flags: review?(khuey)
Compiles and runs as expected.
> +    elif realtype.count("PRUint32"):
> +        fd.write("    uint32_t u;\n")
> +        fd.write("    NS_ENSURE_STATE(JS_ValueToECMAUint32(aCx, v, &u));\n")
> +        fd.write("    aDict.%s = u;\n" % a.name)
You can pass |aDict.%s| directly to JS_ValueToECMAUint32 instead of using a temporary variable.
https://mxr.mozilla.org/mozilla-central/source/js/xpconnect/src/XPCConvert.cpp?rev=0581a34dde2a#412
emk, want to upload such patch? I could review it immediately ;)
Sorry, I'm about to go out. Plaese create a patch yourself.
Attached patch patch (obsolete) — Splinter Review
Attachment #645508 - Attachment is obsolete: true
Attachment #645513 - Attachment is obsolete: true
Attachment #645513 - Flags: review?(khuey)
Attachment #645561 - Flags: review?(khuey)
Comment on attachment 645561 [details] [diff] [review]
patch

too hard to get this 2 line patch right :/
Attachment #645561 - Attachment is obsolete: true
Attachment #645561 - Flags: review?(khuey)
Attached patch patchSplinter Review
Attachment #645562 - Flags: review?(khuey)
https://hg.mozilla.org/mozilla-central/rev/9792ee3e5244
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Attachment #645936 - Flags: feedback?(khuey)
Attachment #645936 - Flags: feedback?(bzbarsky)
Comment on attachment 645936 [details] [diff] [review]
idl file using dictionaries

Wrong bug?
Comment on attachment 645936 [details] [diff] [review]
idl file using dictionaries

interns :)
Attachment #645936 - Flags: feedback?(khuey)
Attachment #645936 - Flags: feedback?(bzbarsky)
wrong bug, sorry about that
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: