diff --git a/dom/bindings/ToJSValue.h b/dom/bindings/ToJSValue.h index 55d8a335e708..0b82bb2fc745 100644 --- a/dom/bindings/ToJSValue.h +++ b/dom/bindings/ToJSValue.h @@ -23,13 +23,13 @@ namespace dom { // JSContext. // Accept strings. -bool +MOZ_WARN_UNUSED_RESULT bool ToJSValue(JSContext* aCx, const nsAString& aArgument, JS::MutableHandle aValue); // Accept booleans. -inline bool +MOZ_WARN_UNUSED_RESULT inline bool ToJSValue(JSContext* aCx, bool aArgument, JS::MutableHandle 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 aValue) @@ -141,6 +141,7 @@ ToJSValue(JSContext* aCx, // Accept objects that inherit from nsWrapperCache (e.g. most // DOM objects). template +MOZ_WARN_UNUSED_RESULT typename EnableIf::value, bool>::Type ToJSValue(JSContext* aCx, T& aArgument, @@ -156,6 +157,7 @@ ToJSValue(JSContext* aCx, // Accept typed arrays built from appropriate nsTArray values template +MOZ_WARN_UNUSED_RESULT typename EnableIf::value, bool>::Type ToJSValue(JSContext* aCx, const TypedArrayCreator& aArgument, @@ -184,6 +186,7 @@ ISupportsToJSValue(JSContext* aCx, // Accept objects that inherit from nsISupports but not nsWrapperCache (e.g. // nsIDOMFile). template +MOZ_WARN_UNUSED_RESULT typename EnableIf::value && !IsBaseOf::value && IsBaseOf::value, bool>::Type @@ -199,7 +202,7 @@ ToJSValue(JSContext* aCx, // Accept nsRefPtr/nsCOMPtr template -bool +MOZ_WARN_UNUSED_RESULT bool ToJSValue(JSContext* aCx, const nsCOMPtr& aArgument, JS::MutableHandle aValue) @@ -208,7 +211,7 @@ ToJSValue(JSContext* aCx, } template -bool +MOZ_WARN_UNUSED_RESULT bool ToJSValue(JSContext* aCx, const nsRefPtr& aArgument, JS::MutableHandle aValue) @@ -218,6 +221,7 @@ ToJSValue(JSContext* aCx, // Accept WebIDL dictionaries template +MOZ_WARN_UNUSED_RESULT typename EnableIf::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 aArgument, JS::MutableHandle aValue) { @@ -236,7 +240,7 @@ ToJSValue(JSContext* aCx, JS::Handle 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& aArgument, JS::MutableHandle aValue) { @@ -245,7 +249,7 @@ ToJSValue(JSContext* aCx, const JS::Heap& 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& aArgument, JS::MutableHandle aValue) { @@ -255,7 +259,7 @@ ToJSValue(JSContext* aCx, const JS::Rooted& 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 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 aValue); // Accept pointers to other things we accept template +MOZ_WARN_UNUSED_RESULT typename EnableIf::value, bool>::Type ToJSValue(JSContext* aCx, T aArgument, @@ -280,7 +285,7 @@ ToJSValue(JSContext* aCx, // Accept arrays of other things we accept template -bool +MOZ_WARN_UNUSED_RESULT bool ToJSValue(JSContext* aCx, T* aArguments, size_t aLength, @@ -307,7 +312,7 @@ ToJSValue(JSContext* aCx, } template -bool +MOZ_WARN_UNUSED_RESULT bool ToJSValue(JSContext* aCx, const nsTArray& aArgument, JS::MutableHandle aValue) @@ -317,7 +322,7 @@ ToJSValue(JSContext* aCx, } template -bool +MOZ_WARN_UNUSED_RESULT bool ToJSValue(JSContext* aCx, const FallibleTArray& aArgument, JS::MutableHandle aValue) @@ -327,7 +332,7 @@ ToJSValue(JSContext* aCx, } template -bool +MOZ_WARN_UNUSED_RESULT bool ToJSValue(JSContext* aCx, const T(&aArgument)[N], JS::MutableHandle aValue)