Bug 1176800 part 2. Add a ToJSValue overload for owning unions. r=peterv

This commit is contained in:
Boris Zbarsky 2015-07-01 00:15:30 -04:00
parent cf4b97758b
commit f87bcd3914

View File

@ -281,6 +281,18 @@ ToJSValue(JSContext* aCx,
ErrorResult& aArgument,
JS::MutableHandle<JS::Value> aValue);
// Accept owning WebIDL unions.
template <typename T>
MOZ_WARN_UNUSED_RESULT
typename EnableIf<IsBaseOf<AllOwningUnionBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
const T& aArgument,
JS::MutableHandle<JS::Value> aValue)
{
JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(aCx));
return aArgument.ToJSVal(aCx, global, aValue);
}
// Accept pointers to other things we accept
template <typename T>
MOZ_WARN_UNUSED_RESULT