Bug 1071177 - Add support for symbols as a value type. r=billm
This commit is contained in:
@@ -267,6 +267,17 @@ JavaScriptShared::toVariant(JSContext *cx, JS::HandleValue from, JSVariant *to)
|
||||
return true;
|
||||
}
|
||||
|
||||
case JSTYPE_SYMBOL:
|
||||
{
|
||||
RootedSymbol sym(cx, from.toSymbol());
|
||||
|
||||
SymbolVariant symVar;
|
||||
if (!toSymbolVariant(cx, sym, &symVar))
|
||||
return false;
|
||||
*to = symVar;
|
||||
return true;
|
||||
}
|
||||
|
||||
case JSTYPE_STRING:
|
||||
{
|
||||
nsAutoJSString autoStr;
|
||||
@@ -314,6 +325,15 @@ JavaScriptShared::fromVariant(JSContext *cx, const JSVariant &from, MutableHandl
|
||||
return true;
|
||||
}
|
||||
|
||||
case JSVariant::TSymbolVariant:
|
||||
{
|
||||
Symbol *sym = fromSymbolVariant(cx, from.get_SymbolVariant());
|
||||
if (!sym)
|
||||
return false;
|
||||
to.setSymbol(sym);
|
||||
return true;
|
||||
}
|
||||
|
||||
case JSVariant::Tdouble:
|
||||
to.set(JS_NumberValue(from.get_double()));
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user