def init_value(attribute):
    realtype = attribute.realtype.nativeType('in')
    realtype = realtype.strip(' ')
    if attribute.defvalue is None:
        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
        if realtype.count("nsACString"):
            return "NS_LITERAL_CSTRING(\"%s\")" % attribute.defvalue
        raise xpidl.IDLError(
            "Default value of %s is not supported for type %s" %
            (attribute.defvalue, realtype), attribute.location)
def init_value(attribute):
    realtype = attribute.realtype.nativeType('in')
    realtype = realtype.strip(' ')
    if attribute.defvalue is None:
        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("nsAString"):
            return "NS_LITERAL_STRING(\"%s\")" % attribute.defvalue
        if realtype.count("nsACString"):
            return "NS_LITERAL_CSTRING(\"%s\")" % attribute.defvalue
        raise xpidl.IDLError("Default value is not supported for type %s" %
                             realtype)