LibWeb: Support implicit downcast to DOMException in ExceptionOr

This commit is contained in:
Shannon Booth
2025-12-26 22:03:19 +01:00
committed by Shannon Booth
parent cbd07b2153
commit c12f21498c
2 changed files with 8 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
#include <LibWeb/Bindings/DOMPointReadOnlyPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Geometry/DOMMatrix.h>
#include <LibWeb/Geometry/DOMPoint.h>
#include <LibWeb/Geometry/DOMPointReadOnly.h>
#include <LibWeb/HTML/StructuredSerialize.h>
#include <LibWeb/WebIDL/ExceptionOr.h>

View File

@@ -91,6 +91,13 @@ public:
ExceptionOr(ExceptionOr const& other) = default;
~ExceptionOr() = default;
template<typename E>
requires(IsBaseOf<DOMException, E>)
ExceptionOr(GC::Ref<E> exception)
: ExceptionOr(GC::Ref<DOMException> { exception })
{
}
ValueType& value()
requires(!IsSame<ValueType, Empty>)
{