Bug 939302 - JS::Value in dictionary_helper_gen.py is obsolete. r=bz, a=1.3+
authorTom Schuster <evilpies@gmail.com>
Fri, 13 Dec 2013 11:37:53 +0100
changeset 175518 2bc49f51742a33d1370327063b47b01a4c6aa373
parent 175517 17f677b7df0c8b30803e7b0f248455b11a26a368
child 175519 baa815736efeff45448a3a520fb4bbf3cd7a0373
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, 1
bugs939302
milestone28.0a2
Bug 939302 - JS::Value in dictionary_helper_gen.py is obsolete. r=bz, a=1.3+
js/xpconnect/src/dictionary_helper_gen.py
--- a/js/xpconnect/src/dictionary_helper_gen.py
+++ b/js/xpconnect/src/dictionary_helper_gen.py
@@ -231,18 +231,16 @@ def init_value(attribute):
         if realtype.endswith('*'):
             return "nullptr"
         if realtype == "bool":
             return "false"
         if realtype.count("nsAString"):
             return ""
         if realtype.count("nsACString"):
             return ""
-        if realtype.count("JS::Value"):
-            return "JSVAL_VOID"
         return "0"
     else:
         if realtype.count("double") and attribute.defvalue == "Infinity":
             return "mozilla::PositiveInfinity()"
         if realtype.count("double") and attribute.defvalue == "-Infinity":
             return "mozilla::NegativeInfinity()"
         if realtype.count("nsAString"):
             return "NS_LITERAL_STRING(\"%s\")" % attribute.defvalue
@@ -274,19 +272,17 @@ def write_header(iface, fd):
         fd.write("  %s;\n" % attributeVariableTypeAndName(member))
 
     fd.write("};\n\n")
 
 def write_getter(a, iface, fd):
     realtype = a.realtype.nativeType('in')
     fd.write("    NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, %s, &v));\n"
              % get_jsid(a.name))
-    if realtype.count("JS::Value"):
-        fd.write("    aDict.%s = v;\n" % a.name)
-    elif realtype.count("bool"):
+    if realtype.count("bool"):
         fd.write("    aDict.%s = JS::ToBoolean(v);\n" % a.name)
     elif realtype.count("uint16_t"):
         fd.write("    uint32_t u;\n")
         fd.write("    NS_ENSURE_STATE(JS::ToUint32(aCx, v, &u));\n")
         fd.write("    aDict.%s = u;\n" % a.name)
     elif realtype.count("int16_t"):
         fd.write("    int32_t i;\n")
         fd.write("    NS_ENSURE_STATE(JS::ToInt32(aCx, v, &i));\n")
@@ -317,30 +313,30 @@ def write_getter(a, iface, fd):
         fd.write("    NS_ENSURE_STATE(d);\n")
         fd.write("    aDict.%s = d;\n" % a.name)
     elif realtype.endswith('*'):
         fd.write("    %s d;\n" % realtype)
         fd.write("    xpc_qsSelfRef ref;\n")
         fd.write("    nsresult rv = xpc_qsUnwrapArg<%s>(aCx, v, &d, &ref.ptr, &v);\n" % realtype.strip('* '))
         fd.write("    NS_ENSURE_SUCCESS(rv, rv);\n")
         fd.write("    aDict.%s = d;\n" % a.name)
-    elif not realtype.count("JS::Value"):
+    else:
         raise BaseException("Unsupported type %s found in dictionary %s" % (realtype, iface.name))
 
 def write_cpp(iface, fd):
     attributes = []
     for member in iface.members:
         if isinstance(member, xpidl.Attribute):
             attributes.append(member)
 
     fd.write("%s::%s()" % (iface.name, iface.name))
 
     if iface.base is not None or len(attributes) > 0:
         fd.write(" :\n")
-    
+
     if iface.base is not None:
         fd.write("  %s()" % iface.base)
         if len(attributes) > 0:
             fd.write(",\n")
 
     for i in range(len(attributes)):
         fd.write("  %s(%s)" % (attributes[i].name, init_value(attributes[i])))
         if i < (len(attributes) - 1):