summaryrefslogtreecommitdiff
path: root/dom/bindings/ToJSValue.h
diff options
context:
space:
mode:
Diffstat (limited to 'dom/bindings/ToJSValue.h')
-rw-r--r--dom/bindings/ToJSValue.h46
1 files changed, 23 insertions, 23 deletions
diff --git a/dom/bindings/ToJSValue.h b/dom/bindings/ToJSValue.h
index 25bd7639fe..0b643315ec 100644
--- a/dom/bindings/ToJSValue.h
+++ b/dom/bindings/ToJSValue.h
@@ -24,7 +24,7 @@ class Promise;
// JSContext.
// Accept strings.
-MOZ_MUST_USE bool
+[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const nsAString& aArgument,
JS::MutableHandle<JS::Value> aValue);
@@ -35,7 +35,7 @@ ToJSValue(JSContext* aCx,
// desirable. So make this a template that only gets used if the argument type
// is actually boolean
template<typename T>
-MOZ_MUST_USE
+[[nodiscard]]
typename EnableIf<IsSame<T, bool>::value, bool>::Type
ToJSValue(JSContext* aCx,
T aArgument,
@@ -123,7 +123,7 @@ ToJSValue(JSContext* aCx,
}
// Accept CallbackObjects
-MOZ_MUST_USE inline bool
+[[nodiscard]] inline bool
ToJSValue(JSContext* aCx,
CallbackObject& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -139,7 +139,7 @@ ToJSValue(JSContext* aCx,
// Accept objects that inherit from nsWrapperCache (e.g. most
// DOM objects).
template <class T>
-MOZ_MUST_USE
+[[nodiscard]]
typename EnableIf<IsBaseOf<nsWrapperCache, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
T& aArgument,
@@ -155,7 +155,7 @@ ToJSValue(JSContext* aCx,
// Accept typed arrays built from appropriate nsTArray values
template<typename T>
-MOZ_MUST_USE
+[[nodiscard]]
typename EnableIf<IsBaseOf<AllTypedArraysBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
const TypedArrayCreator<T>& aArgument,
@@ -175,7 +175,7 @@ ToJSValue(JSContext* aCx,
// Accept objects that inherit from nsISupports but not nsWrapperCache (e.g.
// DOM File).
template <class T>
-MOZ_MUST_USE
+[[nodiscard]]
typename EnableIf<!IsBaseOf<nsWrapperCache, T>::value &&
!IsBaseOf<CallbackObject, T>::value &&
IsBaseOf<nsISupports, T>::value, bool>::Type
@@ -193,7 +193,7 @@ ToJSValue(JSContext* aCx,
// Accept nsRefPtr/nsCOMPtr
template <typename T>
-MOZ_MUST_USE bool
+[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const nsCOMPtr<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -202,7 +202,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T>
-MOZ_MUST_USE bool
+[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const RefPtr<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -211,7 +211,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T>
-MOZ_MUST_USE bool
+[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const NonNull<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -221,7 +221,7 @@ ToJSValue(JSContext* aCx,
// Accept WebIDL dictionaries
template <class T>
-MOZ_MUST_USE
+[[nodiscard]]
typename EnableIf<IsBaseOf<DictionaryBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
const T& aArgument,
@@ -231,7 +231,7 @@ ToJSValue(JSContext* aCx,
}
// Accept existing JS values (which may not be same-compartment with us
-MOZ_MUST_USE inline bool
+[[nodiscard]] inline bool
ToJSValue(JSContext* aCx, JS::Handle<JS::Value> aArgument,
JS::MutableHandle<JS::Value> aValue)
{
@@ -240,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
-MOZ_MUST_USE inline bool
+[[nodiscard]] inline bool
ToJSValue(JSContext* aCx, const JS::Heap<JS::Value>& aArgument,
JS::MutableHandle<JS::Value> aValue)
{
@@ -249,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
-MOZ_MUST_USE inline bool
+[[nodiscard]] inline bool
ToJSValue(JSContext* aCx, const JS::Rooted<JS::Value>& aArgument,
JS::MutableHandle<JS::Value> aValue)
{
@@ -259,7 +259,7 @@ ToJSValue(JSContext* aCx, const JS::Rooted<JS::Value>& aArgument,
// Accept existing rooted JS objects (which may not be same-compartment with
// us).
-MOZ_MUST_USE inline bool
+[[nodiscard]] inline bool
ToJSValue(JSContext* aCx, const JS::Rooted<JSObject*>& aArgument,
JS::MutableHandle<JS::Value> aValue)
{
@@ -269,7 +269,7 @@ ToJSValue(JSContext* aCx, const JS::Rooted<JSObject*>& aArgument,
// Accept nsresult, for use in rejections, and create an XPCOM
// exception object representing that nsresult.
-MOZ_MUST_USE bool
+[[nodiscard]] bool
ToJSValue(JSContext* aCx,
nsresult aArgument,
JS::MutableHandle<JS::Value> aValue);
@@ -277,14 +277,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.
-MOZ_MUST_USE bool
+[[nodiscard]] bool
ToJSValue(JSContext* aCx,
ErrorResult& aArgument,
JS::MutableHandle<JS::Value> aValue);
// Accept owning WebIDL unions.
template <typename T>
-MOZ_MUST_USE
+[[nodiscard]]
typename EnableIf<IsBaseOf<AllOwningUnionBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
const T& aArgument,
@@ -296,7 +296,7 @@ ToJSValue(JSContext* aCx,
// Accept pointers to other things we accept
template <typename T>
-MOZ_MUST_USE
+[[nodiscard]]
typename EnableIf<IsPointer<T>::value, bool>::Type
ToJSValue(JSContext* aCx,
T aArgument,
@@ -306,14 +306,14 @@ ToJSValue(JSContext* aCx,
}
// Accept Promise objects, which need special handling.
-MOZ_MUST_USE bool
+[[nodiscard]] bool
ToJSValue(JSContext* aCx,
Promise& aArgument,
JS::MutableHandle<JS::Value> aValue);
// Accept arrays of other things we accept
template <typename T>
-MOZ_MUST_USE bool
+[[nodiscard]] bool
ToJSValue(JSContext* aCx,
T* aArguments,
size_t aLength,
@@ -340,7 +340,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T>
-MOZ_MUST_USE bool
+[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const nsTArray<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -350,7 +350,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T>
-MOZ_MUST_USE bool
+[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const FallibleTArray<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -360,7 +360,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T, int N>
-MOZ_MUST_USE bool
+[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const T(&aArgument)[N],
JS::MutableHandle<JS::Value> aValue)