mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1095728 - Mark ToJSValue with MOZ_WARN_UNUSED_RESULT. r=bz
This commit is contained in:
parent
6e834f4a06
commit
7e74625848
@ -23,13 +23,13 @@ namespace dom {
|
||||
// JSContext.
|
||||
|
||||
// Accept strings.
|
||||
bool
|
||||
MOZ_WARN_UNUSED_RESULT bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
const nsAString& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue);
|
||||
|
||||
// Accept booleans.
|
||||
inline bool
|
||||
MOZ_WARN_UNUSED_RESULT inline bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
bool aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
@ -125,7 +125,7 @@ ToJSValue(JSContext* aCx,
|
||||
}
|
||||
|
||||
// Accept CallbackObjects
|
||||
inline bool
|
||||
MOZ_WARN_UNUSED_RESULT inline bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
CallbackObject& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
@ -141,6 +141,7 @@ ToJSValue(JSContext* aCx,
|
||||
// Accept objects that inherit from nsWrapperCache (e.g. most
|
||||
// DOM objects).
|
||||
template <class T>
|
||||
MOZ_WARN_UNUSED_RESULT
|
||||
typename EnableIf<IsBaseOf<nsWrapperCache, T>::value, bool>::Type
|
||||
ToJSValue(JSContext* aCx,
|
||||
T& aArgument,
|
||||
@ -156,6 +157,7 @@ ToJSValue(JSContext* aCx,
|
||||
|
||||
// Accept typed arrays built from appropriate nsTArray values
|
||||
template<typename T>
|
||||
MOZ_WARN_UNUSED_RESULT
|
||||
typename EnableIf<IsBaseOf<AllTypedArraysBase, T>::value, bool>::Type
|
||||
ToJSValue(JSContext* aCx,
|
||||
const TypedArrayCreator<T>& aArgument,
|
||||
@ -184,6 +186,7 @@ ISupportsToJSValue(JSContext* aCx,
|
||||
// Accept objects that inherit from nsISupports but not nsWrapperCache (e.g.
|
||||
// nsIDOMFile).
|
||||
template <class T>
|
||||
MOZ_WARN_UNUSED_RESULT
|
||||
typename EnableIf<!IsBaseOf<nsWrapperCache, T>::value &&
|
||||
!IsBaseOf<CallbackObject, T>::value &&
|
||||
IsBaseOf<nsISupports, T>::value, bool>::Type
|
||||
@ -199,7 +202,7 @@ ToJSValue(JSContext* aCx,
|
||||
|
||||
// Accept nsRefPtr/nsCOMPtr
|
||||
template <typename T>
|
||||
bool
|
||||
MOZ_WARN_UNUSED_RESULT bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
const nsCOMPtr<T>& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
@ -208,7 +211,7 @@ ToJSValue(JSContext* aCx,
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool
|
||||
MOZ_WARN_UNUSED_RESULT bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
const nsRefPtr<T>& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
@ -218,6 +221,7 @@ ToJSValue(JSContext* aCx,
|
||||
|
||||
// Accept WebIDL dictionaries
|
||||
template <class T>
|
||||
MOZ_WARN_UNUSED_RESULT
|
||||
typename EnableIf<IsBaseOf<DictionaryBase, T>::value, bool>::Type
|
||||
ToJSValue(JSContext* aCx,
|
||||
const T& aArgument,
|
||||
@ -227,7 +231,7 @@ ToJSValue(JSContext* aCx,
|
||||
}
|
||||
|
||||
// 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,
|
||||
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
|
||||
inline bool
|
||||
MOZ_WARN_UNUSED_RESULT inline bool
|
||||
ToJSValue(JSContext* aCx, const JS::Heap<JS::Value>& aArgument,
|
||||
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
|
||||
inline bool
|
||||
MOZ_WARN_UNUSED_RESULT inline bool
|
||||
ToJSValue(JSContext* aCx, const JS::Rooted<JS::Value>& aArgument,
|
||||
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
|
||||
// exception object representing that nsresult.
|
||||
bool
|
||||
MOZ_WARN_UNUSED_RESULT bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
nsresult aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue);
|
||||
@ -263,13 +267,14 @@ ToJSValue(JSContext* aCx,
|
||||
// Accept ErrorResult, for use in rejections, and create an exception
|
||||
// representing the failure. Note, the ErrorResult must indicate a failure
|
||||
// with aArgument.Failure() returning true.
|
||||
bool
|
||||
MOZ_WARN_UNUSED_RESULT bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
ErrorResult& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue);
|
||||
|
||||
// Accept pointers to other things we accept
|
||||
template <typename T>
|
||||
MOZ_WARN_UNUSED_RESULT
|
||||
typename EnableIf<IsPointer<T>::value, bool>::Type
|
||||
ToJSValue(JSContext* aCx,
|
||||
T aArgument,
|
||||
@ -280,7 +285,7 @@ ToJSValue(JSContext* aCx,
|
||||
|
||||
// Accept arrays of other things we accept
|
||||
template <typename T>
|
||||
bool
|
||||
MOZ_WARN_UNUSED_RESULT bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
T* aArguments,
|
||||
size_t aLength,
|
||||
@ -307,7 +312,7 @@ ToJSValue(JSContext* aCx,
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool
|
||||
MOZ_WARN_UNUSED_RESULT bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
const nsTArray<T>& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
@ -317,7 +322,7 @@ ToJSValue(JSContext* aCx,
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool
|
||||
MOZ_WARN_UNUSED_RESULT bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
const FallibleTArray<T>& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
@ -327,7 +332,7 @@ ToJSValue(JSContext* aCx,
|
||||
}
|
||||
|
||||
template <typename T, int N>
|
||||
bool
|
||||
MOZ_WARN_UNUSED_RESULT bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
const T(&aArgument)[N],
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
|
Loading…
Reference in New Issue
Block a user