mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:07:35 +00:00
LibJS+LibWeb: Move the macro to convert ENOMEM to an exception to LibJS
Move the macro to LibJS and change it to return a throw completion instead of a WebIDL exception. This will let us use this macro within LibJS to handle OOM conditions.
This commit is contained in:
parent
ba97f6a0d3
commit
d8044c5358
15 changed files with 118 additions and 93 deletions
|
@ -14,18 +14,6 @@
|
|||
|
||||
namespace Web::WebIDL {
|
||||
|
||||
#define TRY_OR_RETURN_OOM(realm, expression) \
|
||||
({ \
|
||||
/* Ignore -Wshadow to allow nesting the macro. */ \
|
||||
AK_IGNORE_DIAGNOSTIC("-Wshadow", \
|
||||
auto _temporary_result = (expression)); \
|
||||
if (_temporary_result.is_error()) { \
|
||||
VERIFY(_temporary_result.error().code() == ENOMEM); \
|
||||
return WebIDL::UnknownError::create(realm, "Out of memory."sv); \
|
||||
} \
|
||||
_temporary_result.release_value(); \
|
||||
})
|
||||
|
||||
// The following have a legacy code value but *don't* produce it as
|
||||
// DOMException.code value when used as name (and are therefore omitted here):
|
||||
// - DOMStringSizeError (DOMSTRING_SIZE_ERR = 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue