1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:47:34 +00:00

LibWeb: Port DOMException interface from DeprecatedString to String

This commit is contained in:
Shannon Booth 2023-09-06 16:03:01 +12:00 committed by Tim Flynn
parent bcb6851c07
commit 41928c2902
65 changed files with 296 additions and 296 deletions

View file

@ -118,7 +118,7 @@ WebIDL::ExceptionOr<JS::GCPtr<DOM::Range>> Selection::get_range_at(unsigned inde
{
// The method must throw an IndexSizeError exception if index is not 0, or if this is empty.
if (index != 0 || is_empty())
return WebIDL::IndexSizeError::create(realm(), "Selection.getRangeAt() on empty Selection or with invalid argument"sv);
return WebIDL::IndexSizeError::create(realm(), "Selection.getRangeAt() on empty Selection or with invalid argument"_fly_string);
// Otherwise, it must return a reference to (not a copy of) this's range.
return m_range;
@ -149,7 +149,7 @@ WebIDL::ExceptionOr<void> Selection::remove_range(JS::NonnullGCPtr<DOM::Range> r
}
// Otherwise, it must throw a NotFoundError.
return WebIDL::NotFoundError::create(realm(), "Selection.removeRange() with invalid argument"sv);
return WebIDL::NotFoundError::create(realm(), "Selection.removeRange() with invalid argument"_fly_string);
}
// https://w3c.github.io/selection-api/#dom-selection-removeallranges
@ -177,7 +177,7 @@ WebIDL::ExceptionOr<void> Selection::collapse(JS::GCPtr<DOM::Node> node, unsigne
// 2. The method must throw an IndexSizeError exception if offset is longer than node's length and abort these steps.
if (offset > node->length()) {
return WebIDL::IndexSizeError::create(realm(), "Selection.collapse() with offset longer than node's length"sv);
return WebIDL::IndexSizeError::create(realm(), "Selection.collapse() with offset longer than node's length"_fly_string);
}
// 3. If node's root is not the document associated with this, abort these steps.
@ -208,7 +208,7 @@ WebIDL::ExceptionOr<void> Selection::collapse_to_start()
{
// 1. The method must throw InvalidStateError exception if the this is empty.
if (!m_range) {
return WebIDL::InvalidStateError::create(realm(), "Selection.collapse_to_start() on empty range"sv);
return WebIDL::InvalidStateError::create(realm(), "Selection.collapse_to_start() on empty range"_fly_string);
}
// 2. Otherwise, it must create a new range
@ -228,7 +228,7 @@ WebIDL::ExceptionOr<void> Selection::collapse_to_end()
{
// 1. The method must throw InvalidStateError exception if the this is empty.
if (!m_range) {
return WebIDL::InvalidStateError::create(realm(), "Selection.collapse_to_end() on empty range"sv);
return WebIDL::InvalidStateError::create(realm(), "Selection.collapse_to_end() on empty range"_fly_string);
}
// 2. Otherwise, it must create a new range
@ -253,7 +253,7 @@ WebIDL::ExceptionOr<void> Selection::extend(JS::NonnullGCPtr<DOM::Node> node, un
// 2. If this is empty, throw an InvalidStateError exception and abort these steps.
if (!m_range) {
return WebIDL::InvalidStateError::create(realm(), "Selection.extend() on empty range"sv);
return WebIDL::InvalidStateError::create(realm(), "Selection.extend() on empty range"_fly_string);
}
// 3. Let oldAnchor and oldFocus be the this's anchor and focus, and let newFocus be the boundary point (node, offset).
@ -298,10 +298,10 @@ WebIDL::ExceptionOr<void> Selection::set_base_and_extent(JS::NonnullGCPtr<DOM::N
{
// 1. If anchorOffset is longer than anchorNode's length or if focusOffset is longer than focusNode's length, throw an IndexSizeError exception and abort these steps.
if (anchor_offset > anchor_node->length())
return WebIDL::IndexSizeError::create(realm(), "Anchor offset points outside of the anchor node");
return WebIDL::IndexSizeError::create(realm(), "Anchor offset points outside of the anchor node"_fly_string);
if (focus_offset > focus_node->length())
return WebIDL::IndexSizeError::create(realm(), "Focus offset points outside of the focus node");
return WebIDL::IndexSizeError::create(realm(), "Focus offset points outside of the focus node"_fly_string);
// 2. If the roots of anchorNode or focusNode are not the document associated with this, abort these steps.
if (&anchor_node->root() != m_document.ptr())