Last Comment Bug 777074 - dictionary_helper_gen.py doesn't handle 'unsigned long' types
: dictionary_helper_gen.py doesn't handle 'unsigned long' types
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: XPConnect (show other bugs)
: unspecified
: All All
: -- normal (vote)
: ---
Assigned To: Olli Pettay [:smaug]
:
Mentors:
Depends on:
Blocks: 740997
  Show dependency treegraph
 
Reported: 2012-07-24 14:30 PDT by Mike Habicher [:mikeh] (high bugzilla latency)
Modified: 2012-07-25 16:43 PDT (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (1.22 KB, patch)
2012-07-24 14:32 PDT, Olli Pettay [:smaug]
no flags Details | Diff | Splinter Review
patch (1.25 KB, patch)
2012-07-24 14:35 PDT, Olli Pettay [:smaug]
no flags Details | Diff | Splinter Review
with commit message (1.53 KB, patch)
2012-07-24 14:42 PDT, Olli Pettay [:smaug]
no flags Details | Diff | Splinter Review
patch (2.02 KB, patch)
2012-07-24 16:00 PDT, Olli Pettay [:smaug]
no flags Details | Diff | Splinter Review
patch (1.46 KB, patch)
2012-07-24 16:02 PDT, Olli Pettay [:smaug]
khuey: review+
Details | Diff | Splinter Review
idl file using dictionaries (4.71 KB, patch)
2012-07-25 16:35 PDT, Christoph Kerschbaumer [:ckerschb]
no flags Details | Diff | Splinter Review

Description Mike Habicher [:mikeh] (high bugzilla latency) 2012-07-24 14:30:00 PDT
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.
Comment 1 Olli Pettay [:smaug] 2012-07-24 14:32:42 PDT
Created attachment 645502 [details] [diff] [review]
patch
Comment 2 Olli Pettay [:smaug] 2012-07-24 14:35:45 PDT
Created attachment 645508 [details] [diff] [review]
patch
Comment 3 Olli Pettay [:smaug] 2012-07-24 14:38:21 PDT
Btw, this stuff used to work when dictionaries used XPCOM stuff.
Comment 4 Olli Pettay [:smaug] 2012-07-24 14:42:37 PDT
Created attachment 645513 [details] [diff] [review]
with commit message

At least it compiles :)
Comment 5 Mike Habicher [:mikeh] (high bugzilla latency) 2012-07-24 15:09:18 PDT
Compiles and runs as expected.
Comment 6 Masatoshi Kimura [:emk] 2012-07-24 15:48:21 PDT
> +    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
Comment 7 Olli Pettay [:smaug] 2012-07-24 15:50:31 PDT
emk, want to upload such patch? I could review it immediately ;)
Comment 8 Masatoshi Kimura [:emk] 2012-07-24 15:56:16 PDT
Sorry, I'm about to go out. Plaese create a patch yourself.
Comment 9 Olli Pettay [:smaug] 2012-07-24 16:00:21 PDT
Created attachment 645561 [details] [diff] [review]
patch
Comment 10 Olli Pettay [:smaug] 2012-07-24 16:01:04 PDT
Comment on attachment 645561 [details] [diff] [review]
patch

too hard to get this 2 line patch right :/
Comment 11 Olli Pettay [:smaug] 2012-07-24 16:02:55 PDT
Created attachment 645562 [details] [diff] [review]
patch
Comment 12 Olli Pettay [:smaug] 2012-07-25 09:08:27 PDT
https://hg.mozilla.org/mozilla-central/rev/9792ee3e5244
Comment 13 Christoph Kerschbaumer [:ckerschb] 2012-07-25 16:35:48 PDT
Created attachment 645936 [details] [diff] [review]
idl file using dictionaries
Comment 14 Olli Pettay [:smaug] 2012-07-25 16:37:01 PDT
Comment on attachment 645936 [details] [diff] [review]
idl file using dictionaries

Wrong bug?
Comment 15 Gregor Wagner [:gwagner] 2012-07-25 16:38:54 PDT
Comment on attachment 645936 [details] [diff] [review]
idl file using dictionaries

interns :)
Comment 16 Christoph Kerschbaumer [:ckerschb] 2012-07-25 16:43:16 PDT
wrong bug, sorry about that

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