1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

LibWeb: Move ExceptionOr from DOM/ to WebIDL/

This is a concept fully defined in the Web IDL spec and doesn't belong
in the DOM directory/namespace - not even DOMException, despite the name
:^)
This commit is contained in:
Linus Groh 2022-09-25 17:03:42 +01:00
parent c0eda77928
commit ad04d7ac9b
107 changed files with 441 additions and 440 deletions

View file

@ -859,7 +859,7 @@ void BrowsingContext::remove()
}
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate
DOM::ExceptionOr<void> BrowsingContext::navigate(
WebIDL::ExceptionOr<void> BrowsingContext::navigate(
Fetch::Infrastructure::Request resource,
BrowsingContext& source_browsing_context,
bool exceptions_enabled,
@ -983,7 +983,7 @@ DOM::ExceptionOr<void> BrowsingContext::navigate(
}
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate-fragid
DOM::ExceptionOr<void> BrowsingContext::navigate_to_a_fragment(AK::URL const& url, HistoryHandlingBehavior history_handling, String navigation_id)
WebIDL::ExceptionOr<void> BrowsingContext::navigate_to_a_fragment(AK::URL const& url, HistoryHandlingBehavior history_handling, String navigation_id)
{
// 1. If historyHandling is not "replace",
if (history_handling != HistoryHandlingBehavior::Replace) {
@ -1025,7 +1025,7 @@ DOM::ExceptionOr<void> BrowsingContext::navigate_to_a_fragment(AK::URL const& ur
}
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#traverse-the-history
DOM::ExceptionOr<void> BrowsingContext::traverse_the_history(size_t entry_index, HistoryHandlingBehavior history_handling, bool explicit_history_navigation)
WebIDL::ExceptionOr<void> BrowsingContext::traverse_the_history(size_t entry_index, HistoryHandlingBehavior history_handling, bool explicit_history_navigation)
{
auto* entry = &m_session_history[entry_index];

View file

@ -140,7 +140,7 @@ public:
bool is_allowed_to_navigate(BrowsingContext const&) const;
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate
DOM::ExceptionOr<void> navigate(
WebIDL::ExceptionOr<void> navigate(
Fetch::Infrastructure::Request resource,
BrowsingContext& source_browsing_context,
bool exceptions_enabled = false,
@ -151,13 +151,13 @@ public:
Function<void(NonnullOwnPtr<Fetch::Infrastructure::Response>)> process_response_end_of_body = {});
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate-fragid
DOM::ExceptionOr<void> navigate_to_a_fragment(AK::URL const&, HistoryHandlingBehavior, String navigation_id);
WebIDL::ExceptionOr<void> navigate_to_a_fragment(AK::URL const&, HistoryHandlingBehavior, String navigation_id);
// https://html.spec.whatwg.org/multipage/origin.html#one-permitted-sandboxed-navigator
BrowsingContext const* the_one_permitted_sandboxed_navigator() const;
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#traverse-the-history
DOM::ExceptionOr<void> traverse_the_history(size_t entry_index, HistoryHandlingBehavior = HistoryHandlingBehavior::Default, bool explicit_history_navigation = false);
WebIDL::ExceptionOr<void> traverse_the_history(size_t entry_index, HistoryHandlingBehavior = HistoryHandlingBehavior::Default, bool explicit_history_navigation = false);
Vector<JS::Handle<DOM::Document>> document_family() const;
bool document_family_contains(DOM::Document const&) const;

View file

@ -21,7 +21,7 @@ static void default_source_size(CanvasImageSource const& image, float& source_wi
});
}
DOM::ExceptionOr<void> CanvasDrawImage::draw_image(Web::HTML::CanvasImageSource const& image, float destination_x, float destination_y)
WebIDL::ExceptionOr<void> CanvasDrawImage::draw_image(Web::HTML::CanvasImageSource const& image, float destination_x, float destination_y)
{
// If not specified, the dw and dh arguments must default to the values of sw and sh, interpreted such that one CSS pixel in the image is treated as one unit in the output bitmap's coordinate space.
// If the sx, sy, sw, and sh arguments are omitted, then they must default to 0, 0, the image's intrinsic width in image pixels, and the image's intrinsic height in image pixels, respectively.
@ -33,7 +33,7 @@ DOM::ExceptionOr<void> CanvasDrawImage::draw_image(Web::HTML::CanvasImageSource
return draw_image_internal(image, 0, 0, source_width, source_height, destination_x, destination_y, source_width, source_height);
}
DOM::ExceptionOr<void> CanvasDrawImage::draw_image(Web::HTML::CanvasImageSource const& image, float destination_x, float destination_y, float destination_width, float destination_height)
WebIDL::ExceptionOr<void> CanvasDrawImage::draw_image(Web::HTML::CanvasImageSource const& image, float destination_x, float destination_y, float destination_width, float destination_height)
{
// If the sx, sy, sw, and sh arguments are omitted, then they must default to 0, 0, the image's intrinsic width in image pixels, and the image's intrinsic height in image pixels, respectively.
// If the image has no intrinsic dimensions, then the concrete object size must be used instead, as determined using the CSS "Concrete Object Size Resolution" algorithm, with the specified size having
@ -44,7 +44,7 @@ DOM::ExceptionOr<void> CanvasDrawImage::draw_image(Web::HTML::CanvasImageSource
return draw_image_internal(image, 0, 0, source_width, source_height, destination_x, destination_y, destination_width, destination_height);
}
DOM::ExceptionOr<void> CanvasDrawImage::draw_image(Web::HTML::CanvasImageSource const& image, float source_x, float source_y, float source_width, float source_height, float destination_x, float destination_y, float destination_width, float destination_height)
WebIDL::ExceptionOr<void> CanvasDrawImage::draw_image(Web::HTML::CanvasImageSource const& image, float source_x, float source_y, float source_width, float source_height, float destination_x, float destination_y, float destination_width, float destination_height)
{
return draw_image_internal(image, source_x, source_y, source_width, source_height, destination_x, destination_y, destination_width, destination_height);
}

View file

@ -7,9 +7,9 @@
#pragma once
#include <AK/String.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/HTML/HTMLCanvasElement.h>
#include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::HTML {
@ -22,11 +22,11 @@ class CanvasDrawImage {
public:
virtual ~CanvasDrawImage() = default;
DOM::ExceptionOr<void> draw_image(CanvasImageSource const&, float destination_x, float destination_y);
DOM::ExceptionOr<void> draw_image(CanvasImageSource const&, float destination_x, float destination_y, float destination_width, float destination_height);
DOM::ExceptionOr<void> draw_image(CanvasImageSource const&, float source_x, float source_y, float source_width, float source_height, float destination_x, float destination_y, float destination_width, float destination_height);
WebIDL::ExceptionOr<void> draw_image(CanvasImageSource const&, float destination_x, float destination_y);
WebIDL::ExceptionOr<void> draw_image(CanvasImageSource const&, float destination_x, float destination_y, float destination_width, float destination_height);
WebIDL::ExceptionOr<void> draw_image(CanvasImageSource const&, float source_x, float source_y, float source_width, float source_height, float destination_x, float destination_y, float destination_width, float destination_height);
virtual DOM::ExceptionOr<void> draw_image_internal(CanvasImageSource const&, float source_x, float source_y, float source_width, float source_height, float destination_x, float destination_y, float destination_width, float destination_height) = 0;
virtual WebIDL::ExceptionOr<void> draw_image_internal(CanvasImageSource const&, float source_x, float source_y, float source_width, float source_height, float destination_x, float destination_y, float destination_width, float destination_height) = 0;
protected:
CanvasDrawImage() = default;

View file

@ -16,7 +16,7 @@ public:
virtual ~CanvasImageData() = default;
virtual JS::GCPtr<ImageData> create_image_data(int width, int height) const = 0;
virtual DOM::ExceptionOr<JS::GCPtr<ImageData>> get_image_data(int x, int y, int width, int height) const = 0;
virtual WebIDL::ExceptionOr<JS::GCPtr<ImageData>> get_image_data(int x, int y, int width, int height) const = 0;
virtual void put_image_data(ImageData const&, float x, float y) = 0;
protected:

View file

@ -36,14 +36,14 @@ void CanvasPath::bezier_curve_to(double cp1x, double cp1y, double cp2x, double c
m_path.cubic_bezier_curve_to(Gfx::FloatPoint(cp1x, cp1y), Gfx::FloatPoint(cp2x, cp2y), Gfx::FloatPoint(x, y));
}
DOM::ExceptionOr<void> CanvasPath::arc(float x, float y, float radius, float start_angle, float end_angle, bool counter_clockwise)
WebIDL::ExceptionOr<void> CanvasPath::arc(float x, float y, float radius, float start_angle, float end_angle, bool counter_clockwise)
{
if (radius < 0)
return DOM::IndexSizeError::create(m_self.global_object(), String::formatted("The radius provided ({}) is negative.", radius));
return ellipse(x, y, radius, radius, 0, start_angle, end_angle, counter_clockwise);
}
DOM::ExceptionOr<void> CanvasPath::ellipse(float x, float y, float radius_x, float radius_y, float rotation, float start_angle, float end_angle, bool counter_clockwise)
WebIDL::ExceptionOr<void> CanvasPath::ellipse(float x, float y, float radius_x, float radius_y, float rotation, float start_angle, float end_angle, bool counter_clockwise)
{
if (radius_x < 0)
return DOM::IndexSizeError::create(m_self.global_object(), String::formatted("The major-axis radius provided ({}) is negative.", radius_x));

View file

@ -7,7 +7,7 @@
#pragma once
#include <LibGfx/Path.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::HTML {
@ -23,8 +23,8 @@ public:
void quadratic_curve_to(float cx, float cy, float x, float y);
void bezier_curve_to(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
void rect(float x, float y, float width, float height);
DOM::ExceptionOr<void> arc(float x, float y, float radius, float start_angle, float end_angle, bool counter_clockwise);
DOM::ExceptionOr<void> ellipse(float x, float y, float radius_x, float radius_y, float rotation, float start_angle, float end_angle, bool counter_clockwise);
WebIDL::ExceptionOr<void> arc(float x, float y, float radius, float start_angle, float end_angle, bool counter_clockwise);
WebIDL::ExceptionOr<void> ellipse(float x, float y, float radius_x, float radius_y, float rotation, float start_angle, float end_angle, bool counter_clockwise);
Gfx::Path& path() { return m_path; }
Gfx::Path const& path() const { return m_path; }

View file

@ -5,9 +5,9 @@
*/
#include <AK/QuickSort.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/HTML/CanvasGradient.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::HTML {
@ -49,7 +49,7 @@ CanvasGradient::CanvasGradient(HTML::Window& window, Type type)
CanvasGradient::~CanvasGradient() = default;
// https://html.spec.whatwg.org/multipage/canvas.html#dom-canvasgradient-addcolorstop
DOM::ExceptionOr<void> CanvasGradient::add_color_stop(double offset, String const& color)
WebIDL::ExceptionOr<void> CanvasGradient::add_color_stop(double offset, String const& color)
{
// 1. If the offset is less than 0 or greater than 1, then throw an "IndexSizeError" DOMException.
if (offset < 0 || offset > 1)

View file

@ -25,7 +25,7 @@ public:
static JS::NonnullGCPtr<CanvasGradient> create_linear(HTML::Window&, double x0, double y0, double x1, double y1);
static JS::NonnullGCPtr<CanvasGradient> create_conic(HTML::Window&, double start_angle, double x, double y);
DOM::ExceptionOr<void> add_color_stop(double offset, String const& color);
WebIDL::ExceptionOr<void> add_color_stop(double offset, String const& color);
~CanvasGradient();

View file

@ -10,7 +10,6 @@
#include <LibGfx/Painter.h>
#include <LibGfx/Quad.h>
#include <LibGfx/Rect.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/HTML/CanvasRenderingContext2D.h>
#include <LibWeb/HTML/HTMLCanvasElement.h>
#include <LibWeb/HTML/HTMLImageElement.h>
@ -20,6 +19,7 @@
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Layout/TextNode.h>
#include <LibWeb/Platform/FontPlugin.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::HTML {
@ -107,7 +107,7 @@ void CanvasRenderingContext2D::stroke_rect(float x, float y, float width, float
}
// 4.12.5.1.14 Drawing images, https://html.spec.whatwg.org/multipage/canvas.html#drawing-images
DOM::ExceptionOr<void> CanvasRenderingContext2D::draw_image_internal(CanvasImageSource const& image, float source_x, float source_y, float source_width, float source_height, float destination_x, float destination_y, float destination_width, float destination_height)
WebIDL::ExceptionOr<void> CanvasRenderingContext2D::draw_image_internal(CanvasImageSource const& image, float source_x, float source_y, float source_width, float source_height, float destination_x, float destination_y, float destination_width, float destination_height)
{
// 1. If any of the arguments are infinite or NaN, then return.
if (!isfinite(source_x) || !isfinite(source_y) || !isfinite(source_width) || !isfinite(source_height) || !isfinite(destination_x) || !isfinite(destination_y) || !isfinite(destination_width) || !isfinite(destination_height))
@ -271,7 +271,7 @@ JS::GCPtr<ImageData> CanvasRenderingContext2D::create_image_data(int width, int
}
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-getimagedata
DOM::ExceptionOr<JS::GCPtr<ImageData>> CanvasRenderingContext2D::get_image_data(int x, int y, int width, int height) const
WebIDL::ExceptionOr<JS::GCPtr<ImageData>> CanvasRenderingContext2D::get_image_data(int x, int y, int width, int height) const
{
// 1. If either the sw or sh arguments are zero, then throw an "IndexSizeError" DOMException.
if (width == 0 || height == 0)
@ -471,12 +471,12 @@ void CanvasRenderingContext2D::clip()
}
// https://html.spec.whatwg.org/multipage/canvas.html#check-the-usability-of-the-image-argument
DOM::ExceptionOr<CanvasImageSourceUsability> check_usability_of_image(CanvasImageSource const& image)
WebIDL::ExceptionOr<CanvasImageSourceUsability> check_usability_of_image(CanvasImageSource const& image)
{
// 1. Switch on image:
auto usability = TRY(image.visit(
// HTMLOrSVGImageElement
[](JS::Handle<HTMLImageElement> const& image_element) -> DOM::ExceptionOr<Optional<CanvasImageSourceUsability>> {
[](JS::Handle<HTMLImageElement> const& image_element) -> WebIDL::ExceptionOr<Optional<CanvasImageSourceUsability>> {
// FIXME: If image's current request's state is broken, then throw an "InvalidStateError" DOMException.
// If image is not fully decodable, then return bad.
@ -494,7 +494,7 @@ DOM::ExceptionOr<CanvasImageSourceUsability> check_usability_of_image(CanvasImag
// HTMLCanvasElement
// FIXME: OffscreenCanvas
[](JS::Handle<HTMLCanvasElement> const& canvas_element) -> DOM::ExceptionOr<Optional<CanvasImageSourceUsability>> {
[](JS::Handle<HTMLCanvasElement> const& canvas_element) -> WebIDL::ExceptionOr<Optional<CanvasImageSourceUsability>> {
// If image has either a horizontal dimension or a vertical dimension equal to zero, then throw an "InvalidStateError" DOMException.
if (canvas_element->width() == 0 || canvas_element->height() == 0)
return DOM::InvalidStateError::create(canvas_element->global_object(), "Canvas width or height is zero");

View file

@ -14,7 +14,6 @@
#include <LibGfx/Painter.h>
#include <LibGfx/Path.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/HTML/Canvas/CanvasDrawImage.h>
#include <LibWeb/HTML/Canvas/CanvasDrawPath.h>
#include <LibWeb/HTML/Canvas/CanvasFillStrokeStyles.h>
@ -28,6 +27,7 @@
#include <LibWeb/HTML/CanvasGradient.h>
#include <LibWeb/Layout/InlineNode.h>
#include <LibWeb/Layout/LineBox.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::HTML {
@ -58,7 +58,7 @@ public:
virtual void stroke_rect(float x, float y, float width, float height) override;
virtual void clear_rect(float x, float y, float width, float height) override;
virtual DOM::ExceptionOr<void> draw_image_internal(CanvasImageSource const&, float source_x, float source_y, float source_width, float source_height, float destination_x, float destination_y, float destination_width, float destination_height) override;
virtual WebIDL::ExceptionOr<void> draw_image_internal(CanvasImageSource const&, float source_x, float source_y, float source_width, float source_height, float destination_x, float destination_y, float destination_width, float destination_height) override;
virtual void begin_path() override;
virtual void stroke() override;
@ -71,7 +71,7 @@ public:
virtual void fill(Path2D& path, String const& fill_rule) override;
virtual JS::GCPtr<ImageData> create_image_data(int width, int height) const override;
virtual DOM::ExceptionOr<JS::GCPtr<ImageData>> get_image_data(int x, int y, int width, int height) const override;
virtual WebIDL::ExceptionOr<JS::GCPtr<ImageData>> get_image_data(int x, int y, int width, int height) const override;
virtual void put_image_data(ImageData const&, float x, float y) override;
virtual void reset_to_default_state() override;
@ -120,7 +120,7 @@ enum class CanvasImageSourceUsability {
Good,
};
DOM::ExceptionOr<CanvasImageSourceUsability> check_usability_of_image(CanvasImageSource const&);
WebIDL::ExceptionOr<CanvasImageSourceUsability> check_usability_of_image(CanvasImageSource const&);
bool image_is_not_origin_clean(CanvasImageSource const&);
}

View file

@ -13,7 +13,7 @@
namespace Web::HTML {
DOM::ExceptionOr<JS::NonnullGCPtr<DOMParser>> DOMParser::create_with_global_object(HTML::Window& window)
WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMParser>> DOMParser::create_with_global_object(HTML::Window& window)
{
return JS::NonnullGCPtr(*window.heap().allocate<DOMParser>(window.realm(), window));
}

View file

@ -8,8 +8,8 @@
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/Forward.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::HTML {
@ -18,7 +18,7 @@ class DOMParser final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(DOMParser, Bindings::PlatformObject);
public:
static DOM::ExceptionOr<JS::NonnullGCPtr<DOMParser>> create_with_global_object(HTML::Window&);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMParser>> create_with_global_object(HTML::Window&);
virtual ~DOMParser() override;

View file

@ -111,7 +111,7 @@ String DOMStringMap::determine_value_of_named_property(String const& name) const
}
// https://html.spec.whatwg.org/multipage/dom.html#dom-domstringmap-setitem
DOM::ExceptionOr<void> DOMStringMap::set_value_of_new_named_property(String const& name, String const& value)
WebIDL::ExceptionOr<void> DOMStringMap::set_value_of_new_named_property(String const& name, String const& value)
{
AK::StringBuilder builder;
@ -150,7 +150,7 @@ DOM::ExceptionOr<void> DOMStringMap::set_value_of_new_named_property(String cons
}
// https://html.spec.whatwg.org/multipage/dom.html#dom-domstringmap-setitem
DOM::ExceptionOr<void> DOMStringMap::set_value_of_existing_named_property(String const& name, String const& value)
WebIDL::ExceptionOr<void> DOMStringMap::set_value_of_existing_named_property(String const& name, String const& value)
{
return set_value_of_new_named_property(name, value);
}

View file

@ -25,8 +25,8 @@ public:
String determine_value_of_named_property(String const&) const;
DOM::ExceptionOr<void> set_value_of_new_named_property(String const&, String const&);
DOM::ExceptionOr<void> set_value_of_existing_named_property(String const&, String const&);
WebIDL::ExceptionOr<void> set_value_of_new_named_property(String const&, String const&);
WebIDL::ExceptionOr<void> set_value_of_existing_named_property(String const&, String const&);
bool delete_existing_named_property(String const&);

View file

@ -9,7 +9,6 @@
#include <LibJS/Parser.h>
#include <LibWeb/DOM/DOMException.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/DOM/IDLEventListener.h>
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/BrowsingContextContainer.h>
@ -25,6 +24,7 @@
#include <LibWeb/UIEvents/EventNames.h>
#include <LibWeb/UIEvents/FocusEvent.h>
#include <LibWeb/UIEvents/MouseEvent.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::HTML {
@ -90,7 +90,7 @@ String HTMLElement::content_editable() const
}
// https://html.spec.whatwg.org/multipage/interaction.html#contenteditable
DOM::ExceptionOr<void> HTMLElement::set_content_editable(String const& content_editable)
WebIDL::ExceptionOr<void> HTMLElement::set_content_editable(String const& content_editable)
{
if (content_editable.equals_ignoring_case("inherit"sv)) {
remove_attribute(HTML::AttributeNames::contenteditable);

View file

@ -25,7 +25,7 @@ public:
virtual bool is_editable() const final;
String content_editable() const;
DOM::ExceptionOr<void> set_content_editable(String const&);
WebIDL::ExceptionOr<void> set_content_editable(String const&);
String inner_text();
void set_inner_text(StringView);

View file

@ -27,7 +27,7 @@ HTMLOptionsCollection::HTMLOptionsCollection(DOM::ParentNode& root, Function<boo
HTMLOptionsCollection::~HTMLOptionsCollection() = default;
// https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#dom-htmloptionscollection-add
DOM::ExceptionOr<void> HTMLOptionsCollection::add(HTMLOptionOrOptGroupElement element, Optional<HTMLElementOrElementIndex> before)
WebIDL::ExceptionOr<void> HTMLOptionsCollection::add(HTMLOptionOrOptGroupElement element, Optional<HTMLElementOrElementIndex> before)
{
auto resolved_element = element.visit(
[](auto& e) -> JS::Handle<HTMLElement> {

View file

@ -7,8 +7,8 @@
#pragma once
#include <AK/Variant.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/DOM/HTMLCollection.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::HTML {
@ -22,7 +22,7 @@ public:
static JS::NonnullGCPtr<HTMLOptionsCollection> create(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter);
virtual ~HTMLOptionsCollection() override;
DOM::ExceptionOr<void> add(HTMLOptionOrOptGroupElement element, Optional<HTMLElementOrElementIndex> before = {});
WebIDL::ExceptionOr<void> add(HTMLOptionOrOptGroupElement element, Optional<HTMLElementOrElementIndex> before = {});
private:
HTMLOptionsCollection(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter);

View file

@ -43,7 +43,7 @@ JS::GCPtr<HTMLOptionsCollection> const& HTMLSelectElement::options()
}
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-add
DOM::ExceptionOr<void> HTMLSelectElement::add(HTMLOptionOrOptGroupElement element, Optional<HTMLElementOrElementIndex> before)
WebIDL::ExceptionOr<void> HTMLSelectElement::add(HTMLOptionOrOptGroupElement element, Optional<HTMLElementOrElementIndex> before)
{
// Similarly, the add(element, before) method must act like its namesake method on that same options collection.
return const_cast<HTMLOptionsCollection&>(*options()).add(move(element), move(before));

View file

@ -25,7 +25,7 @@ public:
JS::GCPtr<HTMLOptionsCollection> const& options();
DOM::ExceptionOr<void> add(HTMLOptionOrOptGroupElement element, Optional<HTMLElementOrElementIndex> before = {});
WebIDL::ExceptionOr<void> add(HTMLOptionOrOptGroupElement element, Optional<HTMLElementOrElementIndex> before = {});
int selected_index() const;
void set_selected_index(int);

View file

@ -97,7 +97,7 @@ JS::GCPtr<HTMLTableSectionElement> HTMLTableElement::t_head()
return nullptr;
}
DOM::ExceptionOr<void> HTMLTableElement::set_t_head(HTMLTableSectionElement* thead)
WebIDL::ExceptionOr<void> HTMLTableElement::set_t_head(HTMLTableSectionElement* thead)
{
// FIXME: This is not always the case, but this function is currently written in a way that assumes non-null.
VERIFY(thead);
@ -184,7 +184,7 @@ JS::GCPtr<HTMLTableSectionElement> HTMLTableElement::t_foot()
return nullptr;
}
DOM::ExceptionOr<void> HTMLTableElement::set_t_foot(HTMLTableSectionElement* tfoot)
WebIDL::ExceptionOr<void> HTMLTableElement::set_t_foot(HTMLTableSectionElement* tfoot)
{
// FIXME: This is not always the case, but this function is currently written in a way that assumes non-null.
VERIFY(tfoot);
@ -280,7 +280,7 @@ JS::NonnullGCPtr<DOM::HTMLCollection> HTMLTableElement::rows()
});
}
DOM::ExceptionOr<JS::NonnullGCPtr<HTMLTableRowElement>> HTMLTableElement::insert_row(long index)
WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLTableRowElement>> HTMLTableElement::insert_row(long index)
{
auto rows = this->rows();
auto rows_length = rows->length();
@ -306,7 +306,7 @@ DOM::ExceptionOr<JS::NonnullGCPtr<HTMLTableRowElement>> HTMLTableElement::insert
}
// https://html.spec.whatwg.org/multipage/tables.html#dom-table-deleterow
DOM::ExceptionOr<void> HTMLTableElement::delete_row(long index)
WebIDL::ExceptionOr<void> HTMLTableElement::delete_row(long index)
{
auto rows = this->rows();
auto rows_length = rows->length();

View file

@ -6,11 +6,11 @@
#pragma once
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/HTML/HTMLElement.h>
#include <LibWeb/HTML/HTMLTableCaptionElement.h>
#include <LibWeb/HTML/HTMLTableRowElement.h>
#include <LibWeb/HTML/HTMLTableSectionElement.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::HTML {
@ -26,12 +26,12 @@ public:
void delete_caption();
JS::GCPtr<HTMLTableSectionElement> t_head();
DOM::ExceptionOr<void> set_t_head(HTMLTableSectionElement* thead);
WebIDL::ExceptionOr<void> set_t_head(HTMLTableSectionElement* thead);
JS::NonnullGCPtr<HTMLTableSectionElement> create_t_head();
void delete_t_head();
JS::GCPtr<HTMLTableSectionElement> t_foot();
DOM::ExceptionOr<void> set_t_foot(HTMLTableSectionElement* tfoot);
WebIDL::ExceptionOr<void> set_t_foot(HTMLTableSectionElement* tfoot);
JS::NonnullGCPtr<HTMLTableSectionElement> create_t_foot();
void delete_t_foot();
@ -39,8 +39,8 @@ public:
JS::NonnullGCPtr<HTMLTableSectionElement> create_t_body();
JS::NonnullGCPtr<DOM::HTMLCollection> rows();
DOM::ExceptionOr<JS::NonnullGCPtr<HTMLTableRowElement>> insert_row(long index);
DOM::ExceptionOr<void> delete_row(long index);
WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLTableRowElement>> insert_row(long index);
WebIDL::ExceptionOr<void> delete_row(long index);
private:
HTMLTableElement(DOM::Document&, DOM::QualifiedName);

View file

@ -36,7 +36,7 @@ JS::NonnullGCPtr<DOM::HTMLCollection> HTMLTableSectionElement::rows() const
}
// https://html.spec.whatwg.org/multipage/tables.html#dom-tbody-insertrow
DOM::ExceptionOr<JS::NonnullGCPtr<HTMLTableRowElement>> HTMLTableSectionElement::insert_row(long index)
WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLTableRowElement>> HTMLTableSectionElement::insert_row(long index)
{
auto rows_collection = rows();
auto rows_collection_size = static_cast<long>(rows_collection->length());
@ -60,7 +60,7 @@ DOM::ExceptionOr<JS::NonnullGCPtr<HTMLTableRowElement>> HTMLTableSectionElement:
}
// https://html.spec.whatwg.org/multipage/tables.html#dom-tbody-deleterow
DOM::ExceptionOr<void> HTMLTableSectionElement::delete_row(long index)
WebIDL::ExceptionOr<void> HTMLTableSectionElement::delete_row(long index)
{
auto rows_collection = rows();
auto rows_collection_size = static_cast<long>(rows_collection->length());

View file

@ -18,8 +18,8 @@ public:
virtual ~HTMLTableSectionElement() override;
JS::NonnullGCPtr<DOM::HTMLCollection> rows() const;
DOM::ExceptionOr<JS::NonnullGCPtr<HTMLTableRowElement>> insert_row(long index);
DOM::ExceptionOr<void> delete_row(long index);
WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLTableRowElement>> insert_row(long index);
WebIDL::ExceptionOr<void> delete_row(long index);
private:
HTMLTableSectionElement(DOM::Document&, DOM::QualifiedName);

View file

@ -30,21 +30,21 @@ void History::visit_edges(Cell::Visitor& visitor)
}
// https://html.spec.whatwg.org/multipage/history.html#dom-history-pushstate
DOM::ExceptionOr<void> History::push_state(JS::Value data, String const&, String const& url)
WebIDL::ExceptionOr<void> History::push_state(JS::Value data, String const&, String const& url)
{
// NOTE: The second parameter of this function is intentionally unused.
return shared_history_push_replace_state(data, url, IsPush::Yes);
}
// https://html.spec.whatwg.org/multipage/history.html#dom-history-replacestate
DOM::ExceptionOr<void> History::replace_state(JS::Value data, String const&, String const& url)
WebIDL::ExceptionOr<void> History::replace_state(JS::Value data, String const&, String const& url)
{
// NOTE: The second parameter of this function is intentionally unused.
return shared_history_push_replace_state(data, url, IsPush::No);
}
// https://html.spec.whatwg.org/multipage/history.html#shared-history-push/replace-state-steps
DOM::ExceptionOr<void> History::shared_history_push_replace_state(JS::Value, String const&, IsPush)
WebIDL::ExceptionOr<void> History::shared_history_push_replace_state(JS::Value, String const&, IsPush)
{
// 1. Let document be history's associated Document. (NOTE: Not necessary)

View file

@ -9,7 +9,7 @@
#include <LibJS/Heap/Handle.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::HTML {
@ -21,8 +21,8 @@ public:
virtual ~History() override;
DOM::ExceptionOr<void> push_state(JS::Value data, String const& unused, String const& url);
DOM::ExceptionOr<void> replace_state(JS::Value data, String const& unused, String const& url);
WebIDL::ExceptionOr<void> push_state(JS::Value data, String const& unused, String const& url);
WebIDL::ExceptionOr<void> replace_state(JS::Value data, String const& unused, String const& url);
private:
explicit History(HTML::Window&, DOM::Document&);
@ -33,7 +33,7 @@ private:
No,
Yes,
};
DOM::ExceptionOr<void> shared_history_push_replace_state(JS::Value data, String const& url, IsPush is_push);
WebIDL::ExceptionOr<void> shared_history_push_replace_state(JS::Value data, String const& url, IsPush is_push);
JS::NonnullGCPtr<DOM::Document> m_associated_document;
};

View file

@ -57,7 +57,7 @@ String Storage::get_item(String const& key) const
}
// https://html.spec.whatwg.org/multipage/webstorage.html#dom-storage-setitem
DOM::ExceptionOr<void> Storage::set_item(String const& key, String const& value)
WebIDL::ExceptionOr<void> Storage::set_item(String const& key, String const& value)
{
// 1. Let oldValue be null.
String old_value;

View file

@ -8,7 +8,7 @@
#include <AK/HashMap.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::HTML {
@ -22,7 +22,7 @@ public:
size_t length() const;
String key(size_t index);
String get_item(String const& key) const;
DOM::ExceptionOr<void> set_item(String const& key, String const& value);
WebIDL::ExceptionOr<void> set_item(String const& key, String const& value);
void remove_item(String const& key);
void clear();

View file

@ -596,7 +596,7 @@ Window* Window::parent()
}
// https://html.spec.whatwg.org/multipage/web-messaging.html#window-post-message-steps
DOM::ExceptionOr<void> Window::post_message_impl(JS::Value message, String const&)
WebIDL::ExceptionOr<void> Window::post_message_impl(JS::Value message, String const&)
{
// FIXME: This is an ad-hoc hack implementation instead, since we don't currently
// have serialization and deserialization of messages.

View file

@ -108,7 +108,7 @@ public:
Window* parent();
DOM::ExceptionOr<void> post_message_impl(JS::Value, String const& target_origin);
WebIDL::ExceptionOr<void> post_message_impl(JS::Value, String const& target_origin);
String name() const;
void set_name(String const&);

View file

@ -8,10 +8,10 @@
#include <LibJS/Runtime/ConsoleObject.h>
#include <LibJS/Runtime/Realm.h>
#include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Worker.h>
#include <LibWeb/HTML/WorkerDebugConsoleClient.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::HTML {
@ -39,7 +39,7 @@ void Worker::visit_edges(Cell::Visitor& visitor)
}
// https://html.spec.whatwg.org/multipage/workers.html#dom-worker
DOM::ExceptionOr<JS::NonnullGCPtr<Worker>> Worker::create(FlyString const& script_url, WorkerOptions const options, DOM::Document& document)
WebIDL::ExceptionOr<JS::NonnullGCPtr<Worker>> Worker::create(FlyString const& script_url, WorkerOptions const options, DOM::Document& document)
{
dbgln_if(WEB_WORKER_DEBUG, "WebWorker: Creating worker with script_url = {}", script_url);
@ -312,7 +312,7 @@ void Worker::run_a_worker(AK::URL& url, EnvironmentSettingsObject& outside_setti
}
// https://html.spec.whatwg.org/multipage/workers.html#dom-worker-terminate
DOM::ExceptionOr<void> Worker::terminate()
WebIDL::ExceptionOr<void> Worker::terminate()
{
dbgln_if(WEB_WORKER_DEBUG, "WebWorker: Terminate");

View file

@ -36,13 +36,13 @@ class Worker : public DOM::EventTarget {
WEB_PLATFORM_OBJECT(Worker, DOM::EventTarget);
public:
static DOM::ExceptionOr<JS::NonnullGCPtr<Worker>> create(FlyString const& script_url, WorkerOptions const options, DOM::Document& document);
static DOM::ExceptionOr<JS::NonnullGCPtr<Worker>> create_with_global_object(HTML::Window& window, FlyString const& script_url, WorkerOptions const options)
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Worker>> create(FlyString const& script_url, WorkerOptions const options, DOM::Document& document);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Worker>> create_with_global_object(HTML::Window& window, FlyString const& script_url, WorkerOptions const options)
{
return Worker::create(script_url, options, window.associated_document());
}
DOM::ExceptionOr<void> terminate();
WebIDL::ExceptionOr<void> terminate();
void post_message(JS::Value message, JS::Value transfer);

View file

@ -43,7 +43,7 @@ void WorkerGlobalScope::visit_edges(Cell::Visitor& visitor)
}
// https://html.spec.whatwg.org/multipage/workers.html#importing-scripts-and-libraries
DOM::ExceptionOr<void> WorkerGlobalScope::import_scripts(Vector<String> urls)
WebIDL::ExceptionOr<void> WorkerGlobalScope::import_scripts(Vector<String> urls)
{
// The algorithm may optionally be customized by supplying custom perform the fetch hooks,
// which if provided will be used when invoking fetch a classic worker-imported script.
@ -121,7 +121,7 @@ bool WorkerGlobalScope::cross_origin_isolated() const
}
// https://html.spec.whatwg.org/multipage/webappapis.html#dom-btoa
DOM::ExceptionOr<String> WorkerGlobalScope::btoa(String const& data) const
WebIDL::ExceptionOr<String> WorkerGlobalScope::btoa(String const& data) const
{
// FIXME: This is the same as the implementation in Bindings/WindowObject.cpp
// Find a way to share this implementation, since they come from the same mixin.
@ -141,7 +141,7 @@ DOM::ExceptionOr<String> WorkerGlobalScope::btoa(String const& data) const
}
// https://html.spec.whatwg.org/multipage/webappapis.html#dom-atob
DOM::ExceptionOr<String> WorkerGlobalScope::atob(String const& data) const
WebIDL::ExceptionOr<String> WorkerGlobalScope::atob(String const& data) const
{
// FIXME: This is the same as the implementation in Bindings/WindowObject.cpp
// Find a way to share this implementation, since they come from the same mixin.

View file

@ -10,10 +10,10 @@
#include <AK/RefCounted.h>
#include <AK/URL.h>
#include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/WorkerLocation.h>
#include <LibWeb/HTML/WorkerNavigator.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
#define ENUMERATE_WORKER_GLOBAL_SCOPE_EVENT_HANDLERS(E) \
E(onerror, HTML::EventNames::error) \
@ -42,7 +42,7 @@ public:
JS::NonnullGCPtr<WorkerLocation> location() const;
JS::NonnullGCPtr<WorkerNavigator> navigator() const;
DOM::ExceptionOr<void> import_scripts(Vector<String> urls);
WebIDL::ExceptionOr<void> import_scripts(Vector<String> urls);
#undef __ENUMERATE
#define __ENUMERATE(attribute_name, event_name) \
@ -57,8 +57,8 @@ public:
String origin() const;
bool is_secure_context() const;
bool cross_origin_isolated() const;
DOM::ExceptionOr<String> btoa(String const& data) const;
DOM::ExceptionOr<String> atob(String const& data) const;
WebIDL::ExceptionOr<String> btoa(String const& data) const;
WebIDL::ExceptionOr<String> atob(String const& data) const;
// Non-IDL public methods