mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-30 05:35:31 +00:00
Bug 726960 - Introduce xpc::NonVoidStringToJsval; r=bholley
This commit is contained in:
parent
f0746b81d8
commit
f425afc45a
@ -1048,14 +1048,20 @@ xpc_qsJsvalToWcharStr(JSContext *cx, jsval v, jsval *pval, const PRUnichar **pst
|
||||
namespace xpc {
|
||||
|
||||
bool
|
||||
StringToJsval(JSContext *cx, nsString &str, JS::Value *rval)
|
||||
StringToJsval(JSContext *cx, nsAString &str, JS::Value *rval)
|
||||
{
|
||||
// From the T_DOMSTRING case in XPCConvert::NativeData2JS.
|
||||
if (str.IsVoid()) {
|
||||
*rval = JSVAL_NULL;
|
||||
return true;
|
||||
}
|
||||
return NonVoidStringToJsval(cx, str, rval);
|
||||
}
|
||||
|
||||
bool
|
||||
NonVoidStringToJsval(JSContext *cx, nsAString &str, JS::Value *rval)
|
||||
{
|
||||
MOZ_ASSERT(!str.IsVoid());
|
||||
nsStringBuffer* sharedBuffer;
|
||||
jsval jsstr = XPCStringConvert::ReadableToJSVal(cx, str, &sharedBuffer);
|
||||
if (JSVAL_IS_NULL(jsstr))
|
||||
|
@ -219,7 +219,8 @@ bool Base64Decode(JSContext *cx, JS::Value val, JS::Value *out);
|
||||
* Note, the ownership of the string buffer may be moved from str to rval.
|
||||
* If that happens, str will point to an empty string after this call.
|
||||
*/
|
||||
bool StringToJsval(JSContext *cx, nsString &str, JS::Value *rval);
|
||||
bool StringToJsval(JSContext *cx, nsAString &str, JS::Value *rval);
|
||||
bool NonVoidStringToJsval(JSContext *cx, nsAString &str, JS::Value *rval);
|
||||
|
||||
void *GetCompartmentName(JSContext *cx, JSCompartment *c);
|
||||
void DestroyCompartmentName(void *string);
|
||||
|
Loading…
Reference in New Issue
Block a user