summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Fetch/Fetching
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-01-13 15:48:09 -0500
committerTim Flynn <trflynn89@pm.me>2023-01-13 18:50:47 -0500
commitafc0e461e123489808930e5433f0d8b3f95d9256 (patch)
tree0ac45b4bbc1c55890555cddf394b2d056502e9ea /Userland/Libraries/LibWeb/Fetch/Fetching
parent3de75f6436a1e729691a40c35e8e8a5be5aa2f41 (diff)
downloadserenity-afc0e461e123489808930e5433f0d8b3f95d9256.zip
AK+Everywhere: Disallow returning a reference from a fallible expression
This will silently make a copy. Rather than masking this behavior, let's explicitly disallow it.
Diffstat (limited to 'Userland/Libraries/LibWeb/Fetch/Fetching')
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp
index d0117b3c2c..b3a8c92401 100644
--- a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp
@@ -42,12 +42,14 @@
namespace Web::Fetch::Fetching {
-#define TRY_OR_IGNORE(expression) \
- ({ \
- auto _temporary_result = (expression); \
- if (_temporary_result.is_error()) \
- return; \
- _temporary_result.release_value(); \
+#define TRY_OR_IGNORE(expression) \
+ ({ \
+ auto _temporary_result = (expression); \
+ if (_temporary_result.is_error()) \
+ return; \
+ static_assert(!IsLvalueReference<decltype(_temporary_result.release_value())>, \
+ "Do not return a reference from a fallible expression"); \
+ _temporary_result.release_value(); \
})
// https://fetch.spec.whatwg.org/#concept-fetch