Bug 747815. Use const strings for arguments in DOM bindings. r=peterv

This commit is contained in:
Boris Zbarsky 2012-04-26 00:42:03 -04:00
Родитель 7a7980b4b4
Коммит 719660aa43
2 изменённых файлов: 16 добавлений и 4 удалений

Просмотреть файл

@ -1247,9 +1247,9 @@ def getArgumentConversionTemplate(type, descriptor):
undefinedBehavior = "eStringify"
return (
" xpc_qsDOMString ${name}(cx, ${argVal}, ${argPtr},\n"
" xpc_qsDOMString::%s,\n"
" xpc_qsDOMString::%s);\n"
" const xpc_qsDOMString ${name}(cx, ${argVal}, ${argPtr},\n"
" xpc_qsDOMString::%s,\n"
" xpc_qsDOMString::%s);\n"
" if (!${name}.IsValid()) {\n"
" return false;\n"
" }\n" % (nullBehavior, undefinedBehavior))

Просмотреть файл

@ -262,7 +262,7 @@ public:
Ptr()->~implementation_type();
}
JSBool IsValid() { return mValid; }
JSBool IsValid() const { return mValid; }
implementation_type *Ptr()
{
@ -270,12 +270,24 @@ public:
return reinterpret_cast<implementation_type *>(mBuf);
}
const implementation_type *Ptr() const
{
MOZ_ASSERT(mValid);
return reinterpret_cast<const implementation_type *>(mBuf);
}
operator interface_type &()
{
MOZ_ASSERT(mValid);
return *Ptr();
}
operator const interface_type &() const
{
MOZ_ASSERT(mValid);
return *Ptr();
}
/* Enum that defines how JS |null| and |undefined| should be treated. See
* the WebIDL specification. eStringify means convert to the string "null"
* or "undefined" respectively, via the standard JS ToString() operation;