Bug 1095728 - Mark ToJSValue with MOZ_WARN_UNUSED_RESULT. r=bz

This commit is contained in:
Tom Tromey 2014-12-09 14:45:00 -05:00
parent 1532825a2a
commit ecaf16e959

View File

@ -23,13 +23,13 @@ namespace dom {
// JSContext. // JSContext.
// Accept strings. // Accept strings.
bool MOZ_WARN_UNUSED_RESULT bool
ToJSValue(JSContext* aCx, ToJSValue(JSContext* aCx,
const nsAString& aArgument, const nsAString& aArgument,
JS::MutableHandle<JS::Value> aValue); JS::MutableHandle<JS::Value> aValue);
// Accept booleans. // Accept booleans.
inline bool MOZ_WARN_UNUSED_RESULT inline bool
ToJSValue(JSContext* aCx, ToJSValue(JSContext* aCx,
bool aArgument, bool aArgument,
JS::MutableHandle<JS::Value> aValue) JS::MutableHandle<JS::Value> aValue)
@ -125,7 +125,7 @@ ToJSValue(JSContext* aCx,
} }
// Accept CallbackObjects // Accept CallbackObjects
inline bool MOZ_WARN_UNUSED_RESULT inline bool
ToJSValue(JSContext* aCx, ToJSValue(JSContext* aCx,
CallbackObject& aArgument, CallbackObject& aArgument,
JS::MutableHandle<JS::Value> aValue) JS::MutableHandle<JS::Value> aValue)
@ -141,6 +141,7 @@ ToJSValue(JSContext* aCx,
// Accept objects that inherit from nsWrapperCache (e.g. most // Accept objects that inherit from nsWrapperCache (e.g. most
// DOM objects). // DOM objects).
template <class T> template <class T>
MOZ_WARN_UNUSED_RESULT
typename EnableIf<IsBaseOf<nsWrapperCache, T>::value, bool>::Type typename EnableIf<IsBaseOf<nsWrapperCache, T>::value, bool>::Type
ToJSValue(JSContext* aCx, ToJSValue(JSContext* aCx,
T& aArgument, T& aArgument,
@ -156,6 +157,7 @@ ToJSValue(JSContext* aCx,
// Accept typed arrays built from appropriate nsTArray values // Accept typed arrays built from appropriate nsTArray values
template<typename T> template<typename T>
MOZ_WARN_UNUSED_RESULT
typename EnableIf<IsBaseOf<AllTypedArraysBase, T>::value, bool>::Type typename EnableIf<IsBaseOf<AllTypedArraysBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx, ToJSValue(JSContext* aCx,
const TypedArrayCreator<T>& aArgument, const TypedArrayCreator<T>& aArgument,
@ -184,6 +186,7 @@ ISupportsToJSValue(JSContext* aCx,
// Accept objects that inherit from nsISupports but not nsWrapperCache (e.g. // Accept objects that inherit from nsISupports but not nsWrapperCache (e.g.
// nsIDOMFile). // nsIDOMFile).
template <class T> template <class T>
MOZ_WARN_UNUSED_RESULT
typename EnableIf<!IsBaseOf<nsWrapperCache, T>::value && typename EnableIf<!IsBaseOf<nsWrapperCache, T>::value &&
!IsBaseOf<CallbackObject, T>::value && !IsBaseOf<CallbackObject, T>::value &&
IsBaseOf<nsISupports, T>::value, bool>::Type IsBaseOf<nsISupports, T>::value, bool>::Type
@ -199,7 +202,7 @@ ToJSValue(JSContext* aCx,
// Accept nsRefPtr/nsCOMPtr // Accept nsRefPtr/nsCOMPtr
template <typename T> template <typename T>
bool MOZ_WARN_UNUSED_RESULT bool
ToJSValue(JSContext* aCx, ToJSValue(JSContext* aCx,
const nsCOMPtr<T>& aArgument, const nsCOMPtr<T>& aArgument,
JS::MutableHandle<JS::Value> aValue) JS::MutableHandle<JS::Value> aValue)
@ -208,7 +211,7 @@ ToJSValue(JSContext* aCx,
} }
template <typename T> template <typename T>
bool MOZ_WARN_UNUSED_RESULT bool
ToJSValue(JSContext* aCx, ToJSValue(JSContext* aCx,
const nsRefPtr<T>& aArgument, const nsRefPtr<T>& aArgument,
JS::MutableHandle<JS::Value> aValue) JS::MutableHandle<JS::Value> aValue)
@ -218,6 +221,7 @@ ToJSValue(JSContext* aCx,
// Accept WebIDL dictionaries // Accept WebIDL dictionaries
template <class T> template <class T>
MOZ_WARN_UNUSED_RESULT
typename EnableIf<IsBaseOf<DictionaryBase, T>::value, bool>::Type typename EnableIf<IsBaseOf<DictionaryBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx, ToJSValue(JSContext* aCx,
const T& aArgument, const T& aArgument,
@ -227,7 +231,7 @@ ToJSValue(JSContext* aCx,
} }
// Accept existing JS values (which may not be same-compartment with us // Accept existing JS values (which may not be same-compartment with us
inline bool MOZ_WARN_UNUSED_RESULT inline bool
ToJSValue(JSContext* aCx, JS::Handle<JS::Value> aArgument, ToJSValue(JSContext* aCx, JS::Handle<JS::Value> aArgument,
JS::MutableHandle<JS::Value> aValue) JS::MutableHandle<JS::Value> aValue)
{ {
@ -236,7 +240,7 @@ ToJSValue(JSContext* aCx, JS::Handle<JS::Value> aArgument,
} }
// Accept existing JS values on the Heap (which may not be same-compartment with us // Accept existing JS values on the Heap (which may not be same-compartment with us
inline bool MOZ_WARN_UNUSED_RESULT inline bool
ToJSValue(JSContext* aCx, const JS::Heap<JS::Value>& aArgument, ToJSValue(JSContext* aCx, const JS::Heap<JS::Value>& aArgument,
JS::MutableHandle<JS::Value> aValue) JS::MutableHandle<JS::Value> aValue)
{ {
@ -245,7 +249,7 @@ ToJSValue(JSContext* aCx, const JS::Heap<JS::Value>& aArgument,
} }
// Accept existing rooted JS values (which may not be same-compartment with us // Accept existing rooted JS values (which may not be same-compartment with us
inline bool MOZ_WARN_UNUSED_RESULT inline bool
ToJSValue(JSContext* aCx, const JS::Rooted<JS::Value>& aArgument, ToJSValue(JSContext* aCx, const JS::Rooted<JS::Value>& aArgument,
JS::MutableHandle<JS::Value> aValue) JS::MutableHandle<JS::Value> aValue)
{ {
@ -255,7 +259,7 @@ ToJSValue(JSContext* aCx, const JS::Rooted<JS::Value>& aArgument,
// Accept nsresult, for use in rejections, and create an XPCOM // Accept nsresult, for use in rejections, and create an XPCOM
// exception object representing that nsresult. // exception object representing that nsresult.
bool MOZ_WARN_UNUSED_RESULT bool
ToJSValue(JSContext* aCx, ToJSValue(JSContext* aCx,
nsresult aArgument, nsresult aArgument,
JS::MutableHandle<JS::Value> aValue); JS::MutableHandle<JS::Value> aValue);
@ -263,13 +267,14 @@ ToJSValue(JSContext* aCx,
// Accept ErrorResult, for use in rejections, and create an exception // Accept ErrorResult, for use in rejections, and create an exception
// representing the failure. Note, the ErrorResult must indicate a failure // representing the failure. Note, the ErrorResult must indicate a failure
// with aArgument.Failure() returning true. // with aArgument.Failure() returning true.
bool MOZ_WARN_UNUSED_RESULT bool
ToJSValue(JSContext* aCx, ToJSValue(JSContext* aCx,
ErrorResult& aArgument, ErrorResult& aArgument,
JS::MutableHandle<JS::Value> aValue); JS::MutableHandle<JS::Value> aValue);
// Accept pointers to other things we accept // Accept pointers to other things we accept
template <typename T> template <typename T>
MOZ_WARN_UNUSED_RESULT
typename EnableIf<IsPointer<T>::value, bool>::Type typename EnableIf<IsPointer<T>::value, bool>::Type
ToJSValue(JSContext* aCx, ToJSValue(JSContext* aCx,
T aArgument, T aArgument,
@ -280,7 +285,7 @@ ToJSValue(JSContext* aCx,
// Accept arrays of other things we accept // Accept arrays of other things we accept
template <typename T> template <typename T>
bool MOZ_WARN_UNUSED_RESULT bool
ToJSValue(JSContext* aCx, ToJSValue(JSContext* aCx,
T* aArguments, T* aArguments,
size_t aLength, size_t aLength,
@ -307,7 +312,7 @@ ToJSValue(JSContext* aCx,
} }
template <typename T> template <typename T>
bool MOZ_WARN_UNUSED_RESULT bool
ToJSValue(JSContext* aCx, ToJSValue(JSContext* aCx,
const nsTArray<T>& aArgument, const nsTArray<T>& aArgument,
JS::MutableHandle<JS::Value> aValue) JS::MutableHandle<JS::Value> aValue)
@ -317,7 +322,7 @@ ToJSValue(JSContext* aCx,
} }
template <typename T> template <typename T>
bool MOZ_WARN_UNUSED_RESULT bool
ToJSValue(JSContext* aCx, ToJSValue(JSContext* aCx,
const FallibleTArray<T>& aArgument, const FallibleTArray<T>& aArgument,
JS::MutableHandle<JS::Value> aValue) JS::MutableHandle<JS::Value> aValue)
@ -327,7 +332,7 @@ ToJSValue(JSContext* aCx,
} }
template <typename T, int N> template <typename T, int N>
bool MOZ_WARN_UNUSED_RESULT bool
ToJSValue(JSContext* aCx, ToJSValue(JSContext* aCx,
const T(&aArgument)[N], const T(&aArgument)[N],
JS::MutableHandle<JS::Value> aValue) JS::MutableHandle<JS::Value> aValue)