mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 14:19:48 +00:00
LibWeb: Make DOMException take error message as a String
There was no need to use FlyString for error messages, and it just caused a bunch of churn since these strings typically only existed during the lifetime of the error.
This commit is contained in:
parent
5f9a36feac
commit
175f3febb8
Notes:
github-actions[bot]
2024-10-12 19:15:13 +00:00
Author: https://github.com/awesomekling
Commit: 175f3febb8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1743
Reviewed-by: https://github.com/ADKaster
89 changed files with 464 additions and 462 deletions
|
@ -20,9 +20,9 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<CanvasGradient>> CanvasGradient::create_rad
|
|||
{
|
||||
// If either of r0 or r1 are negative, then an "IndexSizeError" DOMException must be thrown.
|
||||
if (r0 < 0)
|
||||
return WebIDL::IndexSizeError::create(realm, "The r0 passed is less than 0"_fly_string);
|
||||
return WebIDL::IndexSizeError::create(realm, "The r0 passed is less than 0"_string);
|
||||
if (r1 < 0)
|
||||
return WebIDL::IndexSizeError::create(realm, "The r1 passed is less than 0"_fly_string);
|
||||
return WebIDL::IndexSizeError::create(realm, "The r1 passed is less than 0"_string);
|
||||
|
||||
auto radial_gradient = TRY_OR_THROW_OOM(realm.vm(), Gfx::CanvasRadialGradientPaintStyle::create(Gfx::FloatPoint { x0, y0 }, r0, Gfx::FloatPoint { x1, y1 }, r1));
|
||||
return realm.heap().allocate<CanvasGradient>(realm, realm, *radial_gradient);
|
||||
|
@ -61,14 +61,14 @@ WebIDL::ExceptionOr<void> CanvasGradient::add_color_stop(double offset, StringVi
|
|||
{
|
||||
// 1. If the offset is less than 0 or greater than 1, then throw an "IndexSizeError" DOMException.
|
||||
if (offset < 0 || offset > 1)
|
||||
return WebIDL::IndexSizeError::create(realm(), "CanvasGradient color stop offset out of bounds"_fly_string);
|
||||
return WebIDL::IndexSizeError::create(realm(), "CanvasGradient color stop offset out of bounds"_string);
|
||||
|
||||
// 2. Let parsed color be the result of parsing color.
|
||||
auto parsed_color = Color::from_string(color);
|
||||
|
||||
// 3. If parsed color is failure, throw a "SyntaxError" DOMException.
|
||||
if (!parsed_color.has_value())
|
||||
return WebIDL::SyntaxError::create(realm(), "Could not parse color for CanvasGradient"_fly_string);
|
||||
return WebIDL::SyntaxError::create(realm(), "Could not parse color for CanvasGradient"_string);
|
||||
|
||||
// 4. Place a new stop on the gradient, at offset offset relative to the whole gradient, and with the color parsed color.
|
||||
TRY_OR_THROW_OOM(realm().vm(), m_gradient->add_color_stop(offset, parsed_color.value()));
|
||||
|
|
|
@ -124,7 +124,7 @@ WebIDL::ExceptionOr<JS::GCPtr<CanvasPattern>> CanvasPattern::create(JS::Realm& r
|
|||
// then throw a "SyntaxError" DOMException.
|
||||
auto repetition_value = parse_repetition(repetition);
|
||||
if (!repetition_value.has_value())
|
||||
return WebIDL::SyntaxError::create(realm, "Repetition value is not valid"_fly_string);
|
||||
return WebIDL::SyntaxError::create(realm, "Repetition value is not valid"_string);
|
||||
|
||||
// Note: Bitmap won't be null here, as if it were it would have "bad" usability.
|
||||
auto const& bitmap = *image.visit([](auto const& source) -> Gfx::Bitmap const* { return source->bitmap(); });
|
||||
|
|
|
@ -48,7 +48,7 @@ CanvasRenderingContext2D::~CanvasRenderingContext2D() = default;
|
|||
void CanvasRenderingContext2D::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CanvasRenderingContext2DPrototype>(realm, "CanvasRenderingContext2D"_fly_string));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CanvasRenderingContext2DPrototype>(realm, "CanvasRenderingContext2D"_string));
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::visit_edges(Cell::Visitor& visitor)
|
||||
|
@ -331,11 +331,11 @@ WebIDL::ExceptionOr<JS::GCPtr<ImageData>> CanvasRenderingContext2D::get_image_da
|
|||
{
|
||||
// 1. If either the sw or sh arguments are zero, then throw an "IndexSizeError" DOMException.
|
||||
if (width == 0 || height == 0)
|
||||
return WebIDL::IndexSizeError::create(realm(), "Width and height must not be zero"_fly_string);
|
||||
return WebIDL::IndexSizeError::create(realm(), "Width and height must not be zero"_string);
|
||||
|
||||
// 2. If the CanvasRenderingContext2D's origin-clean flag is set to false, then throw a "SecurityError" DOMException.
|
||||
if (!m_origin_clean)
|
||||
return WebIDL::SecurityError::create(realm(), "CanvasRenderingContext2D is not origin-clean"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "CanvasRenderingContext2D is not origin-clean"_string);
|
||||
|
||||
// 3. Let imageData be a new ImageData object.
|
||||
// 4. Initialize imageData given sw, sh, settings set to settings, and defaultColorSpace set to this's color space.
|
||||
|
@ -600,7 +600,7 @@ WebIDL::ExceptionOr<CanvasImageSourceUsability> check_usability_of_image(CanvasI
|
|||
[](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 WebIDL::InvalidStateError::create(canvas_element->realm(), "Canvas width or height is zero"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(canvas_element->realm(), "Canvas width or height is zero"_string);
|
||||
return Optional<CanvasImageSourceUsability> {};
|
||||
},
|
||||
|
||||
|
@ -608,7 +608,7 @@ WebIDL::ExceptionOr<CanvasImageSourceUsability> check_usability_of_image(CanvasI
|
|||
// FIXME: VideoFrame
|
||||
[](JS::Handle<ImageBitmap> const& image_bitmap) -> WebIDL::ExceptionOr<Optional<CanvasImageSourceUsability>> {
|
||||
if (image_bitmap->is_detached())
|
||||
return WebIDL::InvalidStateError::create(image_bitmap->realm(), "Image bitmap is detached"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(image_bitmap->realm(), "Image bitmap is detached"_string);
|
||||
return Optional<CanvasImageSourceUsability> {};
|
||||
}));
|
||||
if (usability.has_value())
|
||||
|
|
|
@ -45,7 +45,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<CloseWatcher>> CloseWatcher::construct_impl
|
|||
// FIXME: Not in spec explicitly, but this should account for detached iframes too. See /close-watcher/frame-removal.html WPT.
|
||||
auto& window = verify_cast<HTML::Window>(realm.global_object());
|
||||
if (!window.associated_document().is_fully_active())
|
||||
return WebIDL::InvalidStateError::create(realm, "The document is not fully active."_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm, "The document is not fully active."_string);
|
||||
|
||||
// 2. Let close_watcher be the result of establishing a close watcher
|
||||
auto close_watcher = establish(window);
|
||||
|
|
|
@ -139,7 +139,7 @@ JS::ThrowCompletionOr<void> CustomElementRegistry::define(String const& name, We
|
|||
});
|
||||
|
||||
if (existing_definition_with_constructor_iterator != m_custom_element_definitions.end())
|
||||
return JS::throw_completion(WebIDL::NotSupportedError::create(realm, "The given constructor is already in use by another custom element"_fly_string));
|
||||
return JS::throw_completion(WebIDL::NotSupportedError::create(realm, "The given constructor is already in use by another custom element"_string));
|
||||
|
||||
// 5. Let localName be name.
|
||||
String local_name = name;
|
||||
|
@ -163,7 +163,7 @@ JS::ThrowCompletionOr<void> CustomElementRegistry::define(String const& name, We
|
|||
|
||||
// 8. If this CustomElementRegistry's element definition is running flag is set, then throw a "NotSupportedError" DOMException.
|
||||
if (m_element_definition_is_running)
|
||||
return JS::throw_completion(WebIDL::NotSupportedError::create(realm, "Cannot recursively define custom elements"_fly_string));
|
||||
return JS::throw_completion(WebIDL::NotSupportedError::create(realm, "Cannot recursively define custom elements"_string));
|
||||
|
||||
// 9. Set this CustomElementRegistry's element definition is running flag.
|
||||
m_element_definition_is_running = true;
|
||||
|
|
|
@ -147,7 +147,7 @@ WebIDL::ExceptionOr<void> DOMStringMap::set_value_of_new_named_property(String c
|
|||
if (current_character == '-' && character_index + 1 < name_view.length()) {
|
||||
auto next_character = name_view[character_index + 1];
|
||||
if (is_ascii_lower_alpha(next_character))
|
||||
return WebIDL::SyntaxError::create(realm(), "Name cannot contain a '-' followed by a lowercase character."_fly_string);
|
||||
return WebIDL::SyntaxError::create(realm(), "Name cannot contain a '-' followed by a lowercase character."_string);
|
||||
}
|
||||
|
||||
// 2. For each ASCII upper alpha in name, insert a U+002D HYPHEN-MINUS character (-) before the character and replace the character with the same character converted to ASCII lowercase.
|
||||
|
|
|
@ -281,7 +281,7 @@ WebIDL::ExceptionOr<void> FormAssociatedTextControlElement::set_selection_start(
|
|||
if (is<HTMLInputElement>(html_element)) {
|
||||
auto& input_element = static_cast<HTMLInputElement&>(html_element);
|
||||
if (!input_element.selection_or_range_applies())
|
||||
return WebIDL::InvalidStateError::create(html_element.realm(), "setSelectionStart does not apply to this input type"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(html_element.realm(), "setSelectionStart does not apply to this input type"_string);
|
||||
}
|
||||
|
||||
// 2. Let end be the value of this element's selectionEnd attribute.
|
||||
|
@ -330,7 +330,7 @@ WebIDL::ExceptionOr<void> FormAssociatedTextControlElement::set_selection_end(Op
|
|||
if (is<HTMLInputElement>(html_element)) {
|
||||
auto& input_element = static_cast<HTMLInputElement&>(html_element);
|
||||
if (!input_element.selection_or_range_applies())
|
||||
return WebIDL::InvalidStateError::create(html_element.realm(), "setSelectionEnd does not apply to this input type"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(html_element.realm(), "setSelectionEnd does not apply to this input type"_string);
|
||||
}
|
||||
|
||||
// 2. Set the selection range with the value of this element's selectionStart attribute, the
|
||||
|
@ -383,7 +383,7 @@ WebIDL::ExceptionOr<void> FormAssociatedTextControlElement::set_selection_direct
|
|||
if (is<HTMLInputElement>(html_element)) {
|
||||
auto const& input_element = static_cast<HTMLInputElement const&>(html_element);
|
||||
if (!input_element.selection_direction_applies())
|
||||
return WebIDL::InvalidStateError::create(input_element.realm(), "selectionDirection does not apply to element"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(input_element.realm(), "selectionDirection does not apply to element"_string);
|
||||
}
|
||||
|
||||
set_the_selection_range(m_selection_start, m_selection_end, string_to_selection_direction(direction));
|
||||
|
@ -403,7 +403,7 @@ WebIDL::ExceptionOr<void> FormAssociatedTextControlElement::set_range_text(Strin
|
|||
// throw an "InvalidStateError" DOMException.
|
||||
auto& html_element = form_associated_element_to_html_element();
|
||||
if (is<HTMLInputElement>(html_element) && !static_cast<HTMLInputElement&>(html_element).selection_or_range_applies())
|
||||
return WebIDL::InvalidStateError::create(html_element.realm(), "setRangeText does not apply to this input type"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(html_element.realm(), "setRangeText does not apply to this input type"_string);
|
||||
|
||||
// 2. Set this element's dirty value flag to true.
|
||||
set_dirty_value_flag(true);
|
||||
|
@ -414,7 +414,7 @@ WebIDL::ExceptionOr<void> FormAssociatedTextControlElement::set_range_text(Strin
|
|||
|
||||
// 4. If start is greater than end, then throw an "IndexSizeError" DOMException.
|
||||
if (start > end)
|
||||
return WebIDL::IndexSizeError::create(html_element.realm(), "The start argument must be less than or equal to the end argument"_fly_string);
|
||||
return WebIDL::IndexSizeError::create(html_element.realm(), "The start argument must be less than or equal to the end argument"_string);
|
||||
|
||||
// 5. If start is greater than the length of the relevant value of the text control, then set it to the length of the relevant value of the text control.
|
||||
auto the_relevant_value = relevant_value();
|
||||
|
@ -523,7 +523,7 @@ WebIDL::ExceptionOr<void> FormAssociatedTextControlElement::set_selection_range(
|
|||
// element, throw an "InvalidStateError" DOMException.
|
||||
auto& html_element = form_associated_element_to_html_element();
|
||||
if (is<HTMLInputElement>(html_element) && !static_cast<HTMLInputElement&>(html_element).selection_or_range_applies())
|
||||
return WebIDL::InvalidStateError::create(html_element.realm(), "setSelectionRange does not apply to this input type"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(html_element.realm(), "setSelectionRange does not apply to this input type"_string);
|
||||
|
||||
// 2. Set the selection range with start, end, and direction.
|
||||
set_the_selection_range(start, end, string_to_selection_direction(direction));
|
||||
|
|
|
@ -87,11 +87,11 @@ WebIDL::ExceptionOr<void> HTMLDialogElement::show_modal()
|
|||
|
||||
// 2. If this has an open attribute, then throw an "InvalidStateError" DOMException.
|
||||
if (has_attribute(AttributeNames::open))
|
||||
return WebIDL::InvalidStateError::create(realm(), "Dialog already open"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm(), "Dialog already open"_string);
|
||||
|
||||
// 3. If this is not connected, then throw an "InvalidStateError" DOMException.
|
||||
if (!is_connected())
|
||||
return WebIDL::InvalidStateError::create(realm(), "Dialog not connected"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm(), "Dialog not connected"_string);
|
||||
|
||||
// FIXME: 4. If this is in the popover showing state, then throw an "InvalidStateError" DOMException.
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ WebIDL::ExceptionOr<void> HTMLElement::set_content_editable(StringView content_e
|
|||
MUST(set_attribute(HTML::AttributeNames::contenteditable, "false"_string));
|
||||
return {};
|
||||
}
|
||||
return WebIDL::SyntaxError::create(realm(), "Invalid contentEditable value, must be 'true', 'false', or 'inherit'"_fly_string);
|
||||
return WebIDL::SyntaxError::create(realm(), "Invalid contentEditable value, must be 'true', 'false', or 'inherit'"_string);
|
||||
}
|
||||
|
||||
void HTMLElement::set_inner_text(StringView text)
|
||||
|
@ -651,26 +651,26 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ElementInternals>> HTMLElement::attach_inte
|
|||
{
|
||||
// 1. If this's is value is not null, then throw a "NotSupportedError" DOMException.
|
||||
if (is_value().has_value())
|
||||
return WebIDL::NotSupportedError::create(realm(), "ElementInternals cannot be attached to a customized build-in element"_fly_string);
|
||||
return WebIDL::NotSupportedError::create(realm(), "ElementInternals cannot be attached to a customized build-in element"_string);
|
||||
|
||||
// 2. Let definition be the result of looking up a custom element definition given this's node document, its namespace, its local name, and null as the is value.
|
||||
auto definition = document().lookup_custom_element_definition(namespace_uri(), local_name(), is_value());
|
||||
|
||||
// 3. If definition is null, then throw an "NotSupportedError" DOMException.
|
||||
if (!definition)
|
||||
return WebIDL::NotSupportedError::create(realm(), "ElementInternals cannot be attached to an element that is not a custom element"_fly_string);
|
||||
return WebIDL::NotSupportedError::create(realm(), "ElementInternals cannot be attached to an element that is not a custom element"_string);
|
||||
|
||||
// 4. If definition's disable internals is true, then throw a "NotSupportedError" DOMException.
|
||||
if (definition->disable_internals())
|
||||
return WebIDL::NotSupportedError::create(realm(), "ElementInternals are disabled for this custom element"_fly_string);
|
||||
return WebIDL::NotSupportedError::create(realm(), "ElementInternals are disabled for this custom element"_string);
|
||||
|
||||
// 5. If this's attached internals is non-null, then throw an "NotSupportedError" DOMException.
|
||||
if (m_attached_internals)
|
||||
return WebIDL::NotSupportedError::create(realm(), "ElementInternals already attached"_fly_string);
|
||||
return WebIDL::NotSupportedError::create(realm(), "ElementInternals already attached"_string);
|
||||
|
||||
// 6. If this's custom element state is not "precustomized" or "custom", then throw a "NotSupportedError" DOMException.
|
||||
if (!first_is_one_of(custom_element_state(), DOM::CustomElementState::Precustomized, DOM::CustomElementState::Custom))
|
||||
return WebIDL::NotSupportedError::create(realm(), "Custom element is in an invalid state to attach ElementInternals"_fly_string);
|
||||
return WebIDL::NotSupportedError::create(realm(), "Custom element is in an invalid state to attach ElementInternals"_string);
|
||||
|
||||
// 7. Set this's attached internals to a new ElementInternals instance whose target element is this.
|
||||
auto internals = ElementInternals::create(realm(), *this);
|
||||
|
|
|
@ -342,7 +342,7 @@ WebIDL::ExceptionOr<void> HTMLFormElement::request_submit(JS::GCPtr<Element> sub
|
|||
|
||||
// 2. If submitter's form owner is not this form element, then throw a "NotFoundError" DOMException.
|
||||
if (form_associated_element->form() != this)
|
||||
return WebIDL::NotFoundError::create(realm(), "The submitter is not owned by this form element"_fly_string);
|
||||
return WebIDL::NotFoundError::create(realm(), "The submitter is not owned by this form element"_string);
|
||||
}
|
||||
// 2. Otherwise, set submitter to this form element.
|
||||
else {
|
||||
|
|
|
@ -295,7 +295,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> HTMLImageElement::decode() co
|
|||
if (this->document().is_fully_active())
|
||||
return false;
|
||||
|
||||
auto exception = WebIDL::EncodingError::create(realm, "Node document not fully active"_fly_string);
|
||||
auto exception = WebIDL::EncodingError::create(realm, "Node document not fully active"_string);
|
||||
HTML::TemporaryExecutionContext context(HTML::relevant_settings_object(*this));
|
||||
WebIDL::reject_promise(realm, promise, exception);
|
||||
return true;
|
||||
|
@ -305,7 +305,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> HTMLImageElement::decode() co
|
|||
if (this->current_request().state() != ImageRequest::State::Broken)
|
||||
return false;
|
||||
|
||||
auto exception = WebIDL::EncodingError::create(realm, "Current request state is broken"_fly_string);
|
||||
auto exception = WebIDL::EncodingError::create(realm, "Current request state is broken"_string);
|
||||
HTML::TemporaryExecutionContext context(HTML::relevant_settings_object(*this));
|
||||
WebIDL::reject_promise(realm, promise, exception);
|
||||
return true;
|
||||
|
|
|
@ -326,7 +326,7 @@ WebIDL::ExceptionOr<void> HTMLInputElement::show_picker()
|
|||
|
||||
// 1. If this is not mutable, then throw an "InvalidStateError" DOMException.
|
||||
if (!m_is_mutable)
|
||||
return WebIDL::InvalidStateError::create(realm(), "Element is not mutable"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm(), "Element is not mutable"_string);
|
||||
|
||||
// 2. If this's relevant settings object's origin is not same origin with this's relevant settings object's top-level origin,
|
||||
// and this's type attribute is not in the File Upload state or Color state, then throw a "SecurityError" DOMException.
|
||||
|
@ -334,14 +334,14 @@ WebIDL::ExceptionOr<void> HTMLInputElement::show_picker()
|
|||
// and has never been guarded by an origin check.
|
||||
if (!relevant_settings_object(*this).origin().is_same_origin(relevant_settings_object(*this).top_level_origin)
|
||||
&& m_type != TypeAttributeState::FileUpload && m_type != TypeAttributeState::Color) {
|
||||
return WebIDL::SecurityError::create(realm(), "Cross origin pickers are not allowed"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Cross origin pickers are not allowed"_string);
|
||||
}
|
||||
|
||||
// 3. If this's relevant global object does not have transient activation, then throw a "NotAllowedError" DOMException.
|
||||
// FIXME: The global object we get here should probably not need casted to Window to check for transient activation
|
||||
auto& global_object = relevant_global_object(*this);
|
||||
if (!is<HTML::Window>(global_object) || !static_cast<HTML::Window&>(global_object).has_transient_activation()) {
|
||||
return WebIDL::NotAllowedError::create(realm(), "Too long since user activation to show picker"_fly_string);
|
||||
return WebIDL::NotAllowedError::create(realm(), "Too long since user activation to show picker"_string);
|
||||
}
|
||||
|
||||
// 4. Show the picker, if applicable, for this.
|
||||
|
@ -607,7 +607,7 @@ WebIDL::ExceptionOr<void> HTMLInputElement::set_value(String const& value)
|
|||
case ValueAttributeMode::Filename:
|
||||
// On setting, if the new value is the empty string, empty the list of selected files; otherwise, throw an "InvalidStateError" DOMException.
|
||||
if (!value.is_empty())
|
||||
return WebIDL::InvalidStateError::create(realm, "Setting value of input type file to non-empty string"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm, "Setting value of input type file to non-empty string"_string);
|
||||
|
||||
m_selected_files = nullptr;
|
||||
break;
|
||||
|
@ -2093,7 +2093,7 @@ WebIDL::ExceptionOr<void> HTMLInputElement::set_value_as_date(Optional<JS::Handl
|
|||
{
|
||||
// On setting, if the valueAsDate attribute does not apply, as defined for the input element's type attribute's current state, then throw an "InvalidStateError" DOMException;
|
||||
if (!value_as_date_applies())
|
||||
return WebIDL::InvalidStateError::create(realm(), "valueAsDate: Invalid input type used"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm(), "valueAsDate: Invalid input type used"_string);
|
||||
|
||||
// otherwise, if the new value is not null and not a Date object throw a TypeError exception;
|
||||
if (value.has_value() && !is<JS::Date>(**value))
|
||||
|
@ -2136,7 +2136,7 @@ WebIDL::ExceptionOr<void> HTMLInputElement::set_value_as_number(double value)
|
|||
|
||||
// Otherwise, if the valueAsNumber attribute does not apply, as defined for the input element's type attribute's current state, then throw an "InvalidStateError" DOMException.
|
||||
if (!value_as_number_applies())
|
||||
return WebIDL::InvalidStateError::create(realm(), "valueAsNumber: Invalid input type used"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm(), "valueAsNumber: Invalid input type used"_string);
|
||||
|
||||
// Otherwise, if the new value is a Not-a-Number (NaN) value, then set the value of the element to the empty string.
|
||||
if (value == NAN) {
|
||||
|
@ -2171,7 +2171,7 @@ WebIDL::ExceptionOr<void> HTMLInputElement::step_up_or_down(bool is_down, WebIDL
|
|||
// 2. If the element has no allowed value step, then throw an "InvalidStateError" DOMException.
|
||||
auto maybe_allowed_value_step = allowed_value_step();
|
||||
if (!maybe_allowed_value_step.has_value())
|
||||
return WebIDL::InvalidStateError::create(realm(), "element has no allowed value step"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm(), "element has no allowed value step"_string);
|
||||
double allowed_value_step = *maybe_allowed_value_step;
|
||||
|
||||
// 3. If the element has a minimum and a maximum and the minimum is greater than the maximum, then return.
|
||||
|
|
|
@ -395,7 +395,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::set_volume(double volume)
|
|||
// set to the new value. If the new value is outside the range 0.0 to 1.0 inclusive, then, on setting, an
|
||||
// "IndexSizeError" DOMException must be thrown instead.
|
||||
if (volume < 0.0 || volume > 1.0)
|
||||
return WebIDL::IndexSizeError::create(realm(), "Volume must be in the range 0.0 to 1.0, inclusive"_fly_string);
|
||||
return WebIDL::IndexSizeError::create(realm(), "Volume must be in the range 0.0 to 1.0, inclusive"_string);
|
||||
|
||||
m_volume = volume;
|
||||
volume_or_muted_attribute_changed();
|
||||
|
@ -548,7 +548,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::load_element()
|
|||
|
||||
// 2. Take pending play promises and reject pending play promises with the result and an "AbortError" DOMException.
|
||||
auto promises = take_pending_play_promises();
|
||||
reject_pending_play_promises<WebIDL::AbortError>(promises, "Media playback was aborted"_fly_string);
|
||||
reject_pending_play_promises<WebIDL::AbortError>(promises, "Media playback was aborted"_string);
|
||||
}
|
||||
|
||||
// 7. If seeking is true, set it to false.
|
||||
|
@ -1290,7 +1290,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::handle_media_source_failure(Span<JS:
|
|||
dispatch_event(DOM::Event::create(realm, HTML::EventNames::error));
|
||||
|
||||
// 6. Reject pending play promises with promises and a "NotSupportedError" DOMException.
|
||||
reject_pending_play_promises<WebIDL::NotSupportedError>(promises, "Media is not supported"_fly_string);
|
||||
reject_pending_play_promises<WebIDL::NotSupportedError>(promises, "Media is not supported"_string);
|
||||
|
||||
// 7. Set the element's delaying-the-load-event flag to false. This stops delaying the load event.
|
||||
m_delaying_the_load_event.clear();
|
||||
|
@ -1516,7 +1516,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::pause_element()
|
|||
dispatch_event(DOM::Event::create(realm, HTML::EventNames::pause));
|
||||
|
||||
// 3. Reject pending play promises with promises and an "AbortError" DOMException.
|
||||
reject_pending_play_promises<WebIDL::AbortError>(promises, "Media playback was paused"_fly_string);
|
||||
reject_pending_play_promises<WebIDL::AbortError>(promises, "Media playback was paused"_string);
|
||||
});
|
||||
|
||||
// 4. Set the official playback position to the current playback position.
|
||||
|
@ -1768,7 +1768,7 @@ void HTMLMediaElement::reached_end_of_media_playback()
|
|||
|
||||
// 3. Take pending play promises and reject pending play promises with the result and an "AbortError" DOMException.
|
||||
auto promises = take_pending_play_promises();
|
||||
reject_pending_play_promises<WebIDL::AbortError>(promises, "Media playback has ended"_fly_string);
|
||||
reject_pending_play_promises<WebIDL::AbortError>(promises, "Media playback has ended"_string);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -200,11 +200,11 @@ private:
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#reject-pending-play-promises
|
||||
template<typename ErrorType>
|
||||
void reject_pending_play_promises(ReadonlySpan<JS::NonnullGCPtr<WebIDL::Promise>> promises, FlyString const& message)
|
||||
void reject_pending_play_promises(ReadonlySpan<JS::NonnullGCPtr<WebIDL::Promise>> promises, String message)
|
||||
{
|
||||
auto& realm = this->realm();
|
||||
|
||||
auto error = ErrorType::create(realm, message);
|
||||
auto error = ErrorType::create(realm, move(message));
|
||||
reject_pending_play_promises(promises, error);
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ WebIDL::ExceptionOr<void> HTMLOptionsCollection::set_value_of_indexed_property(u
|
|||
}
|
||||
|
||||
if (!unconverted_option.is_object() || !is<HTMLOptionElement>(unconverted_option.as_object())) {
|
||||
return WebIDL::TypeMismatchError::create(realm(), "The value provided is not an HTMLOptionElement"_fly_string);
|
||||
return WebIDL::TypeMismatchError::create(realm(), "The value provided is not an HTMLOptionElement"_string);
|
||||
}
|
||||
|
||||
auto& option = static_cast<HTMLOptionElement&>(unconverted_option.as_object());
|
||||
|
@ -133,11 +133,11 @@ WebIDL::ExceptionOr<void> HTMLOptionsCollection::add(HTMLOptionOrOptGroupElement
|
|||
|
||||
// 1. If element is an ancestor of the select element on which the HTMLOptionsCollection is rooted, then throw a "HierarchyRequestError" DOMException.
|
||||
if (resolved_element->is_ancestor_of(root()))
|
||||
return WebIDL::HierarchyRequestError::create(realm(), "The provided element is an ancestor of the root select element."_fly_string);
|
||||
return WebIDL::HierarchyRequestError::create(realm(), "The provided element is an ancestor of the root select element."_string);
|
||||
|
||||
// 2. If before is an element, but that element isn't a descendant of the select element on which the HTMLOptionsCollection is rooted, then throw a "NotFoundError" DOMException.
|
||||
if (before_element && !before_element->is_descendant_of(root()))
|
||||
return WebIDL::NotFoundError::create(realm(), "The 'before' element is not a descendant of the root select element."_fly_string);
|
||||
return WebIDL::NotFoundError::create(realm(), "The 'before' element is not a descendant of the root select element."_string);
|
||||
|
||||
// 3. If element and before are the same element, then return.
|
||||
if (before_element && (resolved_element.ptr() == before_element.ptr()))
|
||||
|
|
|
@ -420,19 +420,19 @@ WebIDL::ExceptionOr<void> HTMLSelectElement::show_picker()
|
|||
|
||||
// 1. If this is not mutable, then throw an "InvalidStateError" DOMException.
|
||||
if (!enabled())
|
||||
return WebIDL::InvalidStateError::create(realm(), "Element is not mutable"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm(), "Element is not mutable"_string);
|
||||
|
||||
// 2. If this's relevant settings object's origin is not same origin with this's relevant settings object's top-level origin,
|
||||
// and this is a select element, then throw a "SecurityError" DOMException.
|
||||
if (!relevant_settings_object(*this).origin().is_same_origin(relevant_settings_object(*this).top_level_origin)) {
|
||||
return WebIDL::SecurityError::create(realm(), "Cross origin pickers are not allowed"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Cross origin pickers are not allowed"_string);
|
||||
}
|
||||
|
||||
// 3. If this's relevant global object does not have transient activation, then throw a "NotAllowedError" DOMException.
|
||||
// FIXME: The global object we get here should probably not need casted to Window to check for transient activation
|
||||
auto& global_object = relevant_global_object(*this);
|
||||
if (!is<HTML::Window>(global_object) || !static_cast<HTML::Window&>(global_object).has_transient_activation()) {
|
||||
return WebIDL::NotAllowedError::create(realm(), "Too long since user activation to show picker"_fly_string);
|
||||
return WebIDL::NotAllowedError::create(realm(), "Too long since user activation to show picker"_string);
|
||||
}
|
||||
|
||||
// FIXME: 4. If this is a select element, and this is not being rendered, then throw a "NotSupportedError" DOMException.
|
||||
|
|
|
@ -185,7 +185,7 @@ WebIDL::ExceptionOr<void> HTMLTableElement::set_t_head(HTMLTableSectionElement*
|
|||
{
|
||||
// If the new value is neither null nor a thead element, then a "HierarchyRequestError" DOMException must be thrown instead.
|
||||
if (thead && thead->local_name() != TagNames::thead)
|
||||
return WebIDL::HierarchyRequestError::create(realm(), "Element is not thead"_fly_string);
|
||||
return WebIDL::HierarchyRequestError::create(realm(), "Element is not thead"_string);
|
||||
|
||||
// On setting, if the new value is null or a thead element, the first thead element child of the table element,
|
||||
// if any, must be removed,
|
||||
|
@ -283,7 +283,7 @@ WebIDL::ExceptionOr<void> HTMLTableElement::set_t_foot(HTMLTableSectionElement*
|
|||
{
|
||||
// If the new value is neither null nor a tfoot element, then a "HierarchyRequestError" DOMException must be thrown instead.
|
||||
if (tfoot && tfoot->local_name() != TagNames::tfoot)
|
||||
return WebIDL::HierarchyRequestError::create(realm(), "Element is not tfoot"_fly_string);
|
||||
return WebIDL::HierarchyRequestError::create(realm(), "Element is not tfoot"_string);
|
||||
|
||||
// On setting, if the new value is null or a tfoot element, the first tfoot element child of the table element,
|
||||
// if any, must be removed,
|
||||
|
@ -395,7 +395,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLTableRowElement>> HTMLTableElement::ins
|
|||
auto rows_length = rows->length();
|
||||
|
||||
if (index < -1 || index > (long)rows_length) {
|
||||
return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than the number of rows"_fly_string);
|
||||
return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than the number of rows"_string);
|
||||
}
|
||||
auto& tr = static_cast<HTMLTableRowElement&>(*TRY(DOM::create_element(document(), TagNames::tr, Namespace::HTML)));
|
||||
if (rows_length == 0 && !has_child_of_type<HTMLTableRowElement>()) {
|
||||
|
@ -422,7 +422,7 @@ WebIDL::ExceptionOr<void> HTMLTableElement::delete_row(WebIDL::Long index)
|
|||
|
||||
// 1. If index is less than −1 or greater than or equal to the number of elements in the rows collection, then throw an "IndexSizeError" DOMException.
|
||||
if (index < -1 || index >= (long)rows_length)
|
||||
return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than or equal to the number of rows"_fly_string);
|
||||
return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than or equal to the number of rows"_string);
|
||||
|
||||
// 2. If index is −1, then remove the last element in the rows collection from its parent, or do nothing if the rows collection is empty.
|
||||
if (index == -1) {
|
||||
|
|
|
@ -139,7 +139,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLTableCellElement>> HTMLTableRowElement:
|
|||
|
||||
// 1. If index is less than −1 or greater than the number of elements in the cells collection, then throw an "IndexSizeError" DOMException.
|
||||
if (index < -1 || index > cells_collection_size)
|
||||
return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than the number of cells"_fly_string);
|
||||
return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than the number of cells"_string);
|
||||
|
||||
// 2. Let table cell be the result of creating an element given this tr element's node document, td, and the HTML namespace.
|
||||
auto& table_cell = static_cast<HTMLTableCellElement&>(*TRY(DOM::create_element(document(), HTML::TagNames::td, Namespace::HTML)));
|
||||
|
@ -164,7 +164,7 @@ WebIDL::ExceptionOr<void> HTMLTableRowElement::delete_cell(i32 index)
|
|||
|
||||
// 1. If index is less than −1 or greater than or equal to the number of elements in the cells collection, then throw an "IndexSizeError" DOMException.
|
||||
if (index < -1 || index >= cells_collection_size)
|
||||
return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than or equal to the number of cells"_fly_string);
|
||||
return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than or equal to the number of cells"_string);
|
||||
|
||||
// 2. If index is −1, then remove the last element in the cells collection from its parent, or do nothing if the cells collection is empty.
|
||||
if (index == -1) {
|
||||
|
|
|
@ -62,7 +62,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLTableRowElement>> HTMLTableSectionEleme
|
|||
|
||||
// 1. If index is less than −1 or greater than the number of elements in the rows collection, throw an "IndexSizeError" DOMException.
|
||||
if (index < -1 || index > rows_collection_size)
|
||||
return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than the number of rows"_fly_string);
|
||||
return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than the number of rows"_string);
|
||||
|
||||
// 2. Let table row be the result of creating an element given this element's node document, tr, and the HTML namespace.
|
||||
auto& table_row = static_cast<HTMLTableRowElement&>(*TRY(DOM::create_element(document(), TagNames::tr, Namespace::HTML)));
|
||||
|
@ -86,7 +86,7 @@ WebIDL::ExceptionOr<void> HTMLTableSectionElement::delete_row(WebIDL::Long index
|
|||
|
||||
// 1. If index is less than −1 or greater than or equal to the number of elements in the rows collection, then throw an "IndexSizeError" DOMException.
|
||||
if (index < -1 || index >= rows_collection_size)
|
||||
return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than or equal to the number of rows"_fly_string);
|
||||
return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than or equal to the number of rows"_string);
|
||||
|
||||
// 2. If index is −1, then remove the last element in the rows collection from this element, or do nothing if the rows collection is empty.
|
||||
if (index == -1) {
|
||||
|
|
|
@ -62,7 +62,7 @@ WebIDL::ExceptionOr<u64> History::length() const
|
|||
{
|
||||
// 1. If this's relevant global object's associated Document is not fully active, then throw a "SecurityError" DOMException.
|
||||
if (!m_associated_document->is_fully_active())
|
||||
return WebIDL::SecurityError::create(realm(), "Cannot perform length on a document that isn't fully active."_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Cannot perform length on a document that isn't fully active."_string);
|
||||
|
||||
// 2. Return this's length.
|
||||
return m_length;
|
||||
|
@ -73,7 +73,7 @@ WebIDL::ExceptionOr<JS::Value> History::state() const
|
|||
{
|
||||
// 1. If this's relevant global object's associated Document is not fully active, then throw a "SecurityError" DOMException.
|
||||
if (!m_associated_document->is_fully_active())
|
||||
return WebIDL::SecurityError::create(realm(), "Cannot perform state on a document that isn't fully active."_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Cannot perform state on a document that isn't fully active."_string);
|
||||
|
||||
// 2. Return this's state.
|
||||
return m_state;
|
||||
|
@ -91,7 +91,7 @@ WebIDL::ExceptionOr<void> History::go(WebIDL::Long delta = 0)
|
|||
|
||||
// 2. If document is not fully active, then throw a "SecurityError" DOMException.
|
||||
if (!m_associated_document->is_fully_active())
|
||||
return WebIDL::SecurityError::create(realm(), "Cannot perform go on a document that isn't fully active."_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Cannot perform go on a document that isn't fully active."_string);
|
||||
|
||||
VERIFY(m_associated_document->navigable());
|
||||
|
||||
|
@ -178,7 +178,7 @@ WebIDL::ExceptionOr<void> History::shared_history_push_replace_state(JS::Value d
|
|||
|
||||
// 2. If document is not fully active, then throw a "SecurityError" DOMException.
|
||||
if (!document->is_fully_active())
|
||||
return WebIDL::SecurityError::create(realm(), "Cannot perform pushState or replaceState on a document that isn't fully active."_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Cannot perform pushState or replaceState on a document that isn't fully active."_string);
|
||||
|
||||
// 3. Optionally, return. (For example, the user agent might disallow calls to these methods that are invoked on a timer,
|
||||
// or from event listeners that are not triggered in response to a clear user action, or that are invoked in rapid succession.)
|
||||
|
@ -200,14 +200,14 @@ WebIDL::ExceptionOr<void> History::shared_history_push_replace_state(JS::Value d
|
|||
|
||||
// 2. If that fails, then throw a "SecurityError" DOMException.
|
||||
if (!parsed_url.is_valid())
|
||||
return WebIDL::SecurityError::create(realm(), "Cannot pushState or replaceState to incompatible URL"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Cannot pushState or replaceState to incompatible URL"_string);
|
||||
|
||||
// 3. Set newURL to the resulting URL record.
|
||||
new_url = parsed_url;
|
||||
|
||||
// 4. If document cannot have its URL rewritten to newURL, then throw a "SecurityError" DOMException.
|
||||
if (!can_have_its_url_rewritten(document, new_url))
|
||||
return WebIDL::SecurityError::create(realm(), "Cannot pushState or replaceState to incompatible URL"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Cannot pushState or replaceState to incompatible URL"_string);
|
||||
}
|
||||
|
||||
// 7. Let navigation be history's relevant global object's navigation API.
|
||||
|
@ -234,7 +234,7 @@ WebIDL::ExceptionOr<Bindings::ScrollRestoration> History::scroll_restoration() c
|
|||
{
|
||||
// 1. If this's relevant global object's associated Document is not fully active, then throw a "SecurityError" DOMException.
|
||||
if (!m_associated_document->is_fully_active())
|
||||
return WebIDL::SecurityError::create(realm(), "Cannot obtain scroll restoration mode for a document that isn't fully active."_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Cannot obtain scroll restoration mode for a document that isn't fully active."_string);
|
||||
|
||||
// 2. Return this's node navigable's active session history entry's scroll restoration mode.
|
||||
auto scroll_restoration_mode = m_associated_document->navigable()->active_session_history_entry()->scroll_restoration_mode();
|
||||
|
@ -252,7 +252,7 @@ WebIDL::ExceptionOr<void> History::set_scroll_restoration(Bindings::ScrollRestor
|
|||
{
|
||||
// 1. If this's relevant global object's associated Document is not fully active, then throw a "SecurityError" DOMException.
|
||||
if (!m_associated_document->is_fully_active())
|
||||
return WebIDL::SecurityError::create(realm(), "Cannot set scroll restoration mode for a document that isn't fully active."_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Cannot set scroll restoration mode for a document that isn't fully active."_string);
|
||||
|
||||
// 2. Set this's node navigable's active session history entry's scroll restoration mode to the given value.
|
||||
auto active_session_history_entry = m_associated_document->navigable()->active_session_history_entry();
|
||||
|
|
|
@ -25,7 +25,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ImageData>> ImageData::create(JS::Realm& re
|
|||
|
||||
// 1. If one or both of sw and sh are zero, then throw an "IndexSizeError" DOMException.
|
||||
if (sw == 0 || sh == 0)
|
||||
return WebIDL::IndexSizeError::create(realm, "The source width and height must be greater than zero."_fly_string);
|
||||
return WebIDL::IndexSizeError::create(realm, "The source width and height must be greater than zero."_string);
|
||||
|
||||
// 2. Initialize this given sw, sh, and settings set to settings.
|
||||
// 3. Initialize the image data of this to transparent black.
|
||||
|
@ -55,7 +55,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ImageData>> ImageData::create(JS::Realm& re
|
|||
|
||||
// 2. If length is not a nonzero integral multiple of four, then throw an "InvalidStateError" DOMException.
|
||||
if (length == 0 || length % 4 != 0)
|
||||
return WebIDL::InvalidStateError::create(realm, "Source data must have a non-sero length that is a multiple of four."_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm, "Source data must have a non-sero length that is a multiple of four."_string);
|
||||
|
||||
// 3. Let length be length divided by four.
|
||||
length = length / 4;
|
||||
|
@ -64,14 +64,14 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ImageData>> ImageData::create(JS::Realm& re
|
|||
// NOTE: At this step, the length is guaranteed to be greater than zero (otherwise the second step above would have aborted the steps),
|
||||
// so if sw is zero, this step will throw the exception and return.
|
||||
if (sw == 0 || length % sw != 0)
|
||||
return WebIDL::IndexSizeError::create(realm, "Source width must be a multiple of source data's length."_fly_string);
|
||||
return WebIDL::IndexSizeError::create(realm, "Source width must be a multiple of source data's length."_string);
|
||||
|
||||
// 5. Let height be length divided by sw.
|
||||
auto height = length / sw;
|
||||
|
||||
// 6. If sh was given and its value is not equal to height, then throw an "IndexSizeError" DOMException.
|
||||
if (sh.has_value() && sh.value() != height)
|
||||
return WebIDL::IndexSizeError::create(realm, "Source height must be equal to the calculated height of the data."_fly_string);
|
||||
return WebIDL::IndexSizeError::create(realm, "Source height must be equal to the calculated height of the data."_string);
|
||||
|
||||
// 7. Initialize this given sw, sh, settings set to settings, and source set to data.
|
||||
auto bitmap = TRY_OR_THROW_OOM(vm, Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::RGBA8888, Gfx::AlphaType::Unpremultiplied, Gfx::IntSize(sw, height), sw * sizeof(u32), uint8_clamped_array_data.data().data()));
|
||||
|
|
|
@ -100,7 +100,7 @@ WebIDL::ExceptionOr<String> Location::href() const
|
|||
// 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException.
|
||||
auto const relevant_document = this->relevant_document();
|
||||
if (relevant_document && !relevant_document->origin().is_same_origin_domain(entry_settings_object().origin()))
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_string);
|
||||
|
||||
// 2. Return this's url, serialized.
|
||||
return TRY_OR_THROW_OOM(vm, String::from_byte_string(url().serialize()));
|
||||
|
@ -138,7 +138,7 @@ WebIDL::ExceptionOr<String> Location::origin() const
|
|||
// 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException.
|
||||
auto const relevant_document = this->relevant_document();
|
||||
if (relevant_document && !relevant_document->origin().is_same_origin_domain(entry_settings_object().origin()))
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_string);
|
||||
|
||||
// 2. Return the serialization of this's url's origin.
|
||||
return TRY_OR_THROW_OOM(vm, String::from_byte_string(url().origin().serialize()));
|
||||
|
@ -152,7 +152,7 @@ WebIDL::ExceptionOr<String> Location::protocol() const
|
|||
// 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException.
|
||||
auto const relevant_document = this->relevant_document();
|
||||
if (relevant_document && !relevant_document->origin().is_same_origin_domain(entry_settings_object().origin()))
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_string);
|
||||
|
||||
// 2. Return this's url's scheme, followed by ":".
|
||||
return TRY_OR_THROW_OOM(vm, String::formatted("{}:", url().scheme()));
|
||||
|
@ -169,7 +169,7 @@ WebIDL::ExceptionOr<void> Location::set_protocol(String const& value)
|
|||
|
||||
// 2. If this's relevant Document's origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException.
|
||||
if (!relevant_document->origin().is_same_origin_domain(entry_settings_object().origin()))
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_string);
|
||||
|
||||
// 3. Let copyURL be a copy of this's url.
|
||||
auto copy_url = this->url();
|
||||
|
@ -199,7 +199,7 @@ WebIDL::ExceptionOr<String> Location::host() const
|
|||
// 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException.
|
||||
auto const relevant_document = this->relevant_document();
|
||||
if (relevant_document && !relevant_document->origin().is_same_origin_domain(entry_settings_object().origin()))
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_string);
|
||||
|
||||
// 2. Let url be this's url.
|
||||
auto url = this->url();
|
||||
|
@ -230,7 +230,7 @@ WebIDL::ExceptionOr<String> Location::hostname() const
|
|||
// 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException.
|
||||
auto const relevant_document = this->relevant_document();
|
||||
if (relevant_document && !relevant_document->origin().is_same_origin_domain(entry_settings_object().origin()))
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_string);
|
||||
|
||||
auto url = this->url();
|
||||
|
||||
|
@ -256,7 +256,7 @@ WebIDL::ExceptionOr<String> Location::port() const
|
|||
// 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException.
|
||||
auto const relevant_document = this->relevant_document();
|
||||
if (relevant_document && !relevant_document->origin().is_same_origin_domain(entry_settings_object().origin()))
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_string);
|
||||
|
||||
auto url = this->url();
|
||||
|
||||
|
@ -280,7 +280,7 @@ WebIDL::ExceptionOr<String> Location::pathname() const
|
|||
// 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException.
|
||||
auto const relevant_document = this->relevant_document();
|
||||
if (relevant_document && !relevant_document->origin().is_same_origin_domain(entry_settings_object().origin()))
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_string);
|
||||
|
||||
// 2. Return the result of URL path serializing this Location object's url.
|
||||
return url().serialize_path();
|
||||
|
@ -300,7 +300,7 @@ WebIDL::ExceptionOr<String> Location::search() const
|
|||
// 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException.
|
||||
auto const relevant_document = this->relevant_document();
|
||||
if (relevant_document && !relevant_document->origin().is_same_origin_domain(entry_settings_object().origin()))
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_string);
|
||||
|
||||
auto url = this->url();
|
||||
|
||||
|
@ -324,7 +324,7 @@ WebIDL::ExceptionOr<void> Location::set_search(String const& value)
|
|||
|
||||
// 2. If this's relevant Document's origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException.
|
||||
if (!relevant_document->origin().is_same_origin_domain(entry_settings_object().origin()))
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_string);
|
||||
|
||||
// 3. Let copyURL be a copy of this's url.
|
||||
auto copy_url = this->url();
|
||||
|
@ -360,7 +360,7 @@ WebIDL::ExceptionOr<String> Location::hash() const
|
|||
// 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException.
|
||||
auto const relevant_document = this->relevant_document();
|
||||
if (relevant_document && !relevant_document->origin().is_same_origin_domain(entry_settings_object().origin()))
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_string);
|
||||
|
||||
auto url = this->url();
|
||||
|
||||
|
@ -384,7 +384,7 @@ WebIDL::ExceptionOr<void> Location::set_hash(String const& value)
|
|||
|
||||
// 2. If this's relevant Document's origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException.
|
||||
if (!relevant_document->origin().is_same_origin_domain(entry_settings_object().origin()))
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_string);
|
||||
|
||||
// 3. Let copyURL be a copy of this's url.
|
||||
auto copy_url = this->url();
|
||||
|
@ -452,7 +452,7 @@ WebIDL::ExceptionOr<void> Location::assign(String const& url)
|
|||
|
||||
// 2. If this's relevant Document's origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException.
|
||||
if (!relevant_document->origin().is_same_origin_domain(entry_settings_object().origin()))
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_string);
|
||||
|
||||
// 3. Parse url relative to the entry settings object. If that failed, throw a "SyntaxError" DOMException.
|
||||
auto assign_url = entry_settings_object().parse_url(url);
|
||||
|
|
|
@ -207,7 +207,7 @@ WebIDL::ExceptionOr<void> MessagePort::message_port_post_message_steps(JS::GCPtr
|
|||
// 2. If transfer contains this MessagePort, then throw a "DataCloneError" DOMException.
|
||||
for (auto const& handle : transfer) {
|
||||
if (handle == this)
|
||||
return WebIDL::DataCloneError::create(realm, "Cannot transfer a MessagePort to itself"_fly_string);
|
||||
return WebIDL::DataCloneError::create(realm, "Cannot transfer a MessagePort to itself"_string);
|
||||
}
|
||||
|
||||
// 3. Let doomed be false.
|
||||
|
|
|
@ -1261,7 +1261,7 @@ WebIDL::ExceptionOr<void> Navigable::navigate(NavigateParams params)
|
|||
if (!source_document->navigable()->allowed_by_sandboxing_to_navigate(*this, source_snapshot_params)) {
|
||||
// 1. If exceptionsEnabled is true, then throw a "SecurityError" DOMException.
|
||||
if (exceptions_enabled) {
|
||||
return WebIDL::SecurityError::create(realm, "Source document's node navigable is not allowed to navigate"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm, "Source document's node navigable is not allowed to navigate"_string);
|
||||
}
|
||||
|
||||
// 2 Return.
|
||||
|
|
|
@ -76,11 +76,11 @@ WebIDL::ExceptionOr<void> NavigateEvent::intercept(NavigationInterceptOptions co
|
|||
|
||||
// 2. If this's canIntercept attribute was initialized to false, then throw a "SecurityError" DOMException.
|
||||
if (!m_can_intercept)
|
||||
return WebIDL::SecurityError::create(realm, "NavigateEvent cannot be intercepted"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm, "NavigateEvent cannot be intercepted"_string);
|
||||
|
||||
// 3. If this's dispatch flag is unset, then throw an "InvalidStateError" DOMException.
|
||||
if (!this->dispatched())
|
||||
return WebIDL::InvalidStateError::create(realm, "NavigationEvent is not dispatched yet"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm, "NavigationEvent is not dispatched yet"_string);
|
||||
|
||||
// 4. Assert: this's interception state is either "none" or "intercepted".
|
||||
VERIFY(m_interception_state == InterceptionState::None || m_interception_state == InterceptionState::Intercepted);
|
||||
|
@ -134,7 +134,7 @@ WebIDL::ExceptionOr<void> NavigateEvent::scroll()
|
|||
|
||||
// 2. If this's interception state is not "committed", then throw an "InvalidStateError" DOMException.
|
||||
if (m_interception_state != InterceptionState::Committed)
|
||||
return WebIDL::InvalidStateError::create(realm(), "Cannot scroll NavigationEvent that is not committed"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm(), "Cannot scroll NavigationEvent that is not committed"_string);
|
||||
|
||||
// 3. Process scroll behavior given this.
|
||||
process_scroll_behavior();
|
||||
|
@ -151,15 +151,15 @@ WebIDL::ExceptionOr<void> NavigateEvent::perform_shared_checks()
|
|||
// then throw an "InvalidStateError" DOMException.
|
||||
auto& associated_document = verify_cast<HTML::Window>(relevant_global_object(*this)).associated_document();
|
||||
if (!associated_document.is_fully_active())
|
||||
return WebIDL::InvalidStateError::create(realm(), "Document is not fully active"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm(), "Document is not fully active"_string);
|
||||
|
||||
// 2. If event's isTrusted attribute was initialized to false, then throw a "SecurityError" DOMException.
|
||||
if (!this->is_trusted())
|
||||
return WebIDL::SecurityError::create(realm(), "NavigateEvent is not trusted"_fly_string);
|
||||
return WebIDL::SecurityError::create(realm(), "NavigateEvent is not trusted"_string);
|
||||
|
||||
// 3. If event's canceled flag is set, then throw an "InvalidStateError" DOMException.
|
||||
if (this->cancelled())
|
||||
return WebIDL::InvalidStateError::create(realm(), "NavigateEvent already cancelled"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm(), "NavigateEvent already cancelled"_string);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ WebIDL::ExceptionOr<void> Navigation::update_current_entry(NavigationUpdateCurre
|
|||
|
||||
// 2. If current is null, then throw an "InvalidStateError" DOMException.
|
||||
if (current == nullptr)
|
||||
return WebIDL::InvalidStateError::create(realm(), "Cannot update current NavigationHistoryEntry when there is no current entry"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm(), "Cannot update current NavigationHistoryEntry when there is no current entry"_string);
|
||||
|
||||
// 3. Let serializedState be StructuredSerializeForStorage(options["state"]), rethrowing any exceptions.
|
||||
auto serialized_state = TRY(structured_serialize_for_storage(vm(), options.state));
|
||||
|
@ -230,7 +230,7 @@ WebIDL::ExceptionOr<NavigationResult> Navigation::navigate(String url, Navigatio
|
|||
// Otherwise, let urlRecord be the resulting URL record.
|
||||
auto url_record = relevant_settings_object(*this).parse_url(url);
|
||||
if (!url_record.is_valid())
|
||||
return early_error_result(WebIDL::SyntaxError::create(realm, "Cannot navigate to Invalid URL"_fly_string));
|
||||
return early_error_result(WebIDL::SyntaxError::create(realm, "Cannot navigate to Invalid URL"_string));
|
||||
|
||||
// 2. Let document be this's relevant global object's associated Document.
|
||||
auto& document = verify_cast<HTML::Window>(relevant_global_object(*this)).associated_document();
|
||||
|
@ -238,7 +238,7 @@ WebIDL::ExceptionOr<NavigationResult> Navigation::navigate(String url, Navigatio
|
|||
// 3. If options["history"] is "push", and the navigation must be a replace given urlRecord and document,
|
||||
// then return an early error result for a "NotSupportedError" DOMException.
|
||||
if (options.history == Bindings::NavigationHistoryBehavior::Push && navigation_must_be_a_replace(url_record, document))
|
||||
return early_error_result(WebIDL::NotSupportedError::create(realm, "Navigation must be a replace, but push was requested"_fly_string));
|
||||
return early_error_result(WebIDL::NotSupportedError::create(realm, "Navigation must be a replace, but push was requested"_string));
|
||||
|
||||
// 4. Let state be options["state"], if it exists; otherwise, undefined.
|
||||
auto state = options.state.value_or(JS::js_undefined());
|
||||
|
@ -257,11 +257,11 @@ WebIDL::ExceptionOr<NavigationResult> Navigation::navigate(String url, Navigatio
|
|||
|
||||
// 6. If document is not fully active, then return an early error result for an "InvalidStateError" DOMException.
|
||||
if (!document.is_fully_active())
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Document is not fully active"_fly_string));
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Document is not fully active"_string));
|
||||
|
||||
// 7. If document's unload counter is greater than 0, then return an early error result for an "InvalidStateError" DOMException.
|
||||
if (document.unload_counter() > 0)
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Document already unloaded"_fly_string));
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Document already unloaded"_string));
|
||||
|
||||
// 8. Let info be options["info"], if it exists; otherwise, undefined.
|
||||
auto info = options.info.value_or(JS::js_undefined());
|
||||
|
@ -287,7 +287,7 @@ WebIDL::ExceptionOr<NavigationResult> Navigation::navigate(String url, Navigatio
|
|||
// that upcoming API method tracker to ongoing.
|
||||
if (m_upcoming_non_traverse_api_method_tracker == api_method_tracker) {
|
||||
m_upcoming_non_traverse_api_method_tracker = nullptr;
|
||||
return early_error_result(WebIDL::AbortError::create(realm, "Navigation aborted"_fly_string));
|
||||
return early_error_result(WebIDL::AbortError::create(realm, "Navigation aborted"_string));
|
||||
}
|
||||
|
||||
// 12. Return a navigation API method tracker-derived result for apiMethodTracker.
|
||||
|
@ -330,11 +330,11 @@ WebIDL::ExceptionOr<NavigationResult> Navigation::reload(NavigationReloadOptions
|
|||
|
||||
// 5. If document is not fully active, then return an early error result for an "InvalidStateError" DOMException.
|
||||
if (!document.is_fully_active())
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Document is not fully active"_fly_string));
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Document is not fully active"_string));
|
||||
|
||||
// 6. If document's unload counter is greater than 0, then return an early error result for an "InvalidStateError" DOMException.
|
||||
if (document.unload_counter() > 0)
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Document already unloaded"_fly_string));
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Document already unloaded"_string));
|
||||
|
||||
// 7. Let info be options["info"], if it exists; otherwise, undefined.
|
||||
auto info = options.info.value_or(JS::js_undefined());
|
||||
|
@ -357,7 +357,7 @@ WebIDL::ExceptionOr<NavigationResult> Navigation::traverse_to(String key, Naviga
|
|||
|
||||
// 1. If this's current entry index is −1, then return an early error result for an "InvalidStateError" DOMException.
|
||||
if (m_current_entry_index == -1)
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Cannot traverseTo: no current session history entry"_fly_string));
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Cannot traverseTo: no current session history entry"_string));
|
||||
|
||||
// 2. If this's entry list does not contain a NavigationHistoryEntry whose session history entry's navigation API key equals key,
|
||||
// then return an early error result for an "InvalidStateError" DOMException.
|
||||
|
@ -365,7 +365,7 @@ WebIDL::ExceptionOr<NavigationResult> Navigation::traverse_to(String key, Naviga
|
|||
return entry->session_history_entry().navigation_api_key() == key;
|
||||
});
|
||||
if (it == m_entry_list.end())
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Cannot traverseTo: key not found in session history list"_fly_string));
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Cannot traverseTo: key not found in session history list"_string));
|
||||
|
||||
// 3. Return the result of performing a navigation API traversal given this, key, and options.
|
||||
return perform_a_navigation_api_traversal(key, options);
|
||||
|
@ -379,7 +379,7 @@ WebIDL::ExceptionOr<NavigationResult> Navigation::back(NavigationOptions const&
|
|||
|
||||
// 1. If this's current entry index is −1 or 0, then return an early error result for an "InvalidStateError" DOMException.
|
||||
if (m_current_entry_index == -1 || m_current_entry_index == 0)
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Cannot navigate back: no previous session history entry"_fly_string));
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Cannot navigate back: no previous session history entry"_string));
|
||||
|
||||
// 2. Let key be this's entry list[this's current entry index − 1]'s session history entry's navigation API key.
|
||||
auto key = m_entry_list[m_current_entry_index - 1]->session_history_entry().navigation_api_key();
|
||||
|
@ -397,7 +397,7 @@ WebIDL::ExceptionOr<NavigationResult> Navigation::forward(NavigationOptions cons
|
|||
// 1. If this's current entry index is −1 or is equal to this's entry list's size − 1,
|
||||
// then return an early error result for an "InvalidStateError" DOMException.
|
||||
if (m_current_entry_index == -1 || m_current_entry_index == static_cast<i64>(m_entry_list.size() - 1))
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Cannot navigate forward: no next session history entry"_fly_string));
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Cannot navigate forward: no next session history entry"_string));
|
||||
|
||||
// 2. Let key be this's entry list[this's current entry index + 1]'s session history entry's navigation API key.
|
||||
auto key = m_entry_list[m_current_entry_index + 1]->session_history_entry().navigation_api_key();
|
||||
|
@ -626,11 +626,11 @@ WebIDL::ExceptionOr<NavigationResult> Navigation::perform_a_navigation_api_trave
|
|||
|
||||
// 2. If document is not fully active, then return an early error result for an "InvalidStateError" DOMException.
|
||||
if (!document.is_fully_active())
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Document is not fully active"_fly_string));
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Document is not fully active"_string));
|
||||
|
||||
// 3. If document's unload counter is greater than 0, then return an early error result for an "InvalidStateError" DOMException.
|
||||
if (document.unload_counter() > 0)
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Document already unloaded"_fly_string));
|
||||
return early_error_result(WebIDL::InvalidStateError::create(realm, "Document already unloaded"_string));
|
||||
|
||||
// 4. Let current be the current entry of navigation.
|
||||
auto current = current_entry();
|
||||
|
@ -683,7 +683,7 @@ WebIDL::ExceptionOr<NavigationResult> Navigation::perform_a_navigation_api_trave
|
|||
auto& reject_realm = relevant_realm(*this);
|
||||
TemporaryExecutionContext execution_context { relevant_settings_object(*this) };
|
||||
WebIDL::reject_promise(reject_realm, api_method_tracker->finished_promise,
|
||||
WebIDL::InvalidStateError::create(reject_realm, "Cannot traverse with stale session history entry"_fly_string));
|
||||
WebIDL::InvalidStateError::create(reject_realm, "Cannot traverse with stale session history entry"_string));
|
||||
}));
|
||||
|
||||
// 2. Abort these steps.
|
||||
|
@ -714,7 +714,7 @@ WebIDL::ExceptionOr<NavigationResult> Navigation::perform_a_navigation_api_trave
|
|||
if (result == TraversableNavigable::HistoryStepResult::CanceledByBeforeUnload) {
|
||||
queue_global_task(Task::Source::NavigationAndTraversal, global, JS::create_heap_function(heap(), [this, api_method_tracker, &realm] {
|
||||
TemporaryExecutionContext execution_context { relevant_settings_object(*this) };
|
||||
reject_the_finished_promise(api_method_tracker, WebIDL::AbortError::create(realm, "Navigation cancelled by beforeunload"_fly_string));
|
||||
reject_the_finished_promise(api_method_tracker, WebIDL::AbortError::create(realm, "Navigation cancelled by beforeunload"_string));
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -724,7 +724,7 @@ WebIDL::ExceptionOr<NavigationResult> Navigation::perform_a_navigation_api_trave
|
|||
if (result == TraversableNavigable::HistoryStepResult::InitiatorDisallowed) {
|
||||
queue_global_task(Task::Source::NavigationAndTraversal, global, JS::create_heap_function(heap(), [this, api_method_tracker, &realm] {
|
||||
TemporaryExecutionContext execution_context { relevant_settings_object(*this) };
|
||||
reject_the_finished_promise(api_method_tracker, WebIDL::SecurityError::create(realm, "Navigation disallowed from this origin"_fly_string));
|
||||
reject_the_finished_promise(api_method_tracker, WebIDL::SecurityError::create(realm, "Navigation disallowed from this origin"_string));
|
||||
}));
|
||||
}
|
||||
}));
|
||||
|
@ -754,7 +754,7 @@ void Navigation::abort_the_ongoing_navigation(JS::GCPtr<WebIDL::DOMException> er
|
|||
|
||||
// 5. If error was not given, then let error be a new "AbortError" DOMException created in navigation's relevant realm.
|
||||
if (!error)
|
||||
error = WebIDL::AbortError::create(realm, "Navigation aborted"_fly_string);
|
||||
error = WebIDL::AbortError::create(realm, "Navigation aborted"_string);
|
||||
|
||||
VERIFY(error);
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ bool is_valid_floating_point_number(StringView string)
|
|||
WebIDL::ExceptionOr<String> convert_non_negative_integer_to_string(JS::Realm& realm, WebIDL::Long value)
|
||||
{
|
||||
if (value < 0)
|
||||
return WebIDL::IndexSizeError::create(realm, "The attribute is limited to only non-negative numbers"_fly_string);
|
||||
return WebIDL::IndexSizeError::create(realm, "The attribute is limited to only non-negative numbers"_string);
|
||||
return MUST(String::number(value));
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ JS::Completion ClassicScript::run(RethrowErrors rethrow_errors, JS::GCPtr<JS::En
|
|||
settings.clean_up_after_running_script();
|
||||
|
||||
// 2. Throw a "NetworkError" DOMException.
|
||||
return throw_completion(WebIDL::NetworkError::create(settings.realm(), "Script error."_fly_string));
|
||||
return throw_completion(WebIDL::NetworkError::create(settings.realm(), "Script error."_string));
|
||||
}
|
||||
|
||||
// 3. Otherwise, rethrow errors is false. Perform the following steps:
|
||||
|
|
|
@ -520,7 +520,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ClassicScript>> fetch_a_classic_worker_impo
|
|||
if (body_bytes.template has<Empty>() || body_bytes.template has<Fetch::Infrastructure::FetchAlgorithms::ConsumeBodyFailureTag>()
|
||||
|| !Fetch::Infrastructure::is_ok_status(response->status())
|
||||
|| !response->header_list()->extract_mime_type().has_value() || !response->header_list()->extract_mime_type()->is_javascript()) {
|
||||
return WebIDL::NetworkError::create(realm, "Network error"_fly_string);
|
||||
return WebIDL::NetworkError::create(realm, "Network error"_string);
|
||||
}
|
||||
|
||||
// 8. Let sourceText be the result of UTF-8 decoding bodyBytes.
|
||||
|
|
|
@ -75,7 +75,7 @@ WebIDL::ExceptionOr<JS::GCPtr<JavaScriptModuleScript>> JavaScriptModuleScript::c
|
|||
for (auto const& attribute : requested.attributes) {
|
||||
if (attribute.key != "type"sv) {
|
||||
// 1. Let error be a new SyntaxError exception.
|
||||
auto error = JS::SyntaxError::create(settings_object.realm(), "Module request attributes must only contain a type attribute"_fly_string);
|
||||
auto error = JS::SyntaxError::create(settings_object.realm(), "Module request attributes must only contain a type attribute"_string);
|
||||
|
||||
// 2. Set script's parse error to error.
|
||||
script->set_parse_error(error);
|
||||
|
@ -161,7 +161,7 @@ JS::Promise* JavaScriptModuleScript::run(PreventErrorReporting)
|
|||
// then set evaluationPromise to a promise rejected with a new "QuotaExceededError" DOMException.
|
||||
if (elevation_promise_or_error.is_error()) {
|
||||
auto promise = JS::Promise::create(settings_object().realm());
|
||||
promise->reject(WebIDL::QuotaExceededError::create(settings_object().realm(), "Failed to evaluate module script"_fly_string).ptr());
|
||||
promise->reject(WebIDL::QuotaExceededError::create(settings_object().realm(), "Failed to evaluate module script"_string).ptr());
|
||||
|
||||
evaluation_promise = promise;
|
||||
} else {
|
||||
|
|
|
@ -195,7 +195,7 @@ public:
|
|||
|
||||
// 5. If Type(value) is Symbol, then throw a "DataCloneError" DOMException.
|
||||
if (value.is_symbol())
|
||||
return WebIDL::DataCloneError::create(*m_vm.current_realm(), "Cannot serialize Symbol"_fly_string);
|
||||
return WebIDL::DataCloneError::create(*m_vm.current_realm(), "Cannot serialize Symbol"_string);
|
||||
|
||||
// 6. Let serialized be an uninitialized value.
|
||||
|
||||
|
@ -326,12 +326,12 @@ public:
|
|||
|
||||
// 20. Otherwise, if value is a platform object, then throw a "DataCloneError" DOMException.
|
||||
else if (value.is_object() && is<Bindings::PlatformObject>(value.as_object())) {
|
||||
return throw_completion(WebIDL::DataCloneError::create(*m_vm.current_realm(), "Cannot serialize platform objects"_fly_string));
|
||||
return throw_completion(WebIDL::DataCloneError::create(*m_vm.current_realm(), "Cannot serialize platform objects"_string));
|
||||
}
|
||||
|
||||
// 21. Otherwise, if IsCallable(value) is true, then throw a "DataCloneError" DOMException.
|
||||
else if (value.is_function()) {
|
||||
return throw_completion(WebIDL::DataCloneError::create(*m_vm.current_realm(), "Cannot serialize functions"_fly_string));
|
||||
return throw_completion(WebIDL::DataCloneError::create(*m_vm.current_realm(), "Cannot serialize functions"_string));
|
||||
}
|
||||
|
||||
// FIXME: 22. Otherwise, if value has any internal slot other than [[Prototype]] or [[Extensible]], then throw a "DataCloneError" DOMException.
|
||||
|
@ -569,11 +569,11 @@ WebIDL::ExceptionOr<void> serialize_array_buffer(JS::VM& vm, Vector<u32>& vector
|
|||
// NOTE: This check is only needed when serializing (and not when deserializing) as the cross-origin isolated capability cannot change
|
||||
// over time and a SharedArrayBuffer cannot leave an agent cluster.
|
||||
if (current_settings_object().cross_origin_isolated_capability() == CanUseCrossOriginIsolatedAPIs::No)
|
||||
return WebIDL::DataCloneError::create(*vm.current_realm(), "Cannot serialize SharedArrayBuffer when cross-origin isolated"_fly_string);
|
||||
return WebIDL::DataCloneError::create(*vm.current_realm(), "Cannot serialize SharedArrayBuffer when cross-origin isolated"_string);
|
||||
|
||||
// 2. If forStorage is true, then throw a "DataCloneError" DOMException.
|
||||
if (for_storage)
|
||||
return WebIDL::DataCloneError::create(*vm.current_realm(), "Cannot serialize SharedArrayBuffer for storage"_fly_string);
|
||||
return WebIDL::DataCloneError::create(*vm.current_realm(), "Cannot serialize SharedArrayBuffer for storage"_string);
|
||||
|
||||
// FIXME: 3. If value has an [[ArrayBufferMaxByteLength]] internal slot, then set serialized to { [[Type]]: "GrowableSharedArrayBuffer",
|
||||
// [[ArrayBufferData]]: value.[[ArrayBufferData]], [[ArrayBufferByteLengthData]]: value.[[ArrayBufferByteLengthData]],
|
||||
|
@ -585,7 +585,7 @@ WebIDL::ExceptionOr<void> serialize_array_buffer(JS::VM& vm, Vector<u32>& vector
|
|||
else {
|
||||
// 1. If IsDetachedBuffer(value) is true, then throw a "DataCloneError" DOMException.
|
||||
if (array_buffer.is_detached())
|
||||
return WebIDL::DataCloneError::create(*vm.current_realm(), "Cannot serialize detached ArrayBuffer"_fly_string);
|
||||
return WebIDL::DataCloneError::create(*vm.current_realm(), "Cannot serialize detached ArrayBuffer"_string);
|
||||
|
||||
// 2. Let size be value.[[ArrayBufferByteLength]].
|
||||
auto size = array_buffer.byte_length();
|
||||
|
@ -778,7 +778,7 @@ public:
|
|||
// If this throws an exception, catch it, and then throw a "DataCloneError" DOMException.
|
||||
auto bytes_or_error = deserialize_bytes(m_vm, m_serialized, m_position);
|
||||
if (bytes_or_error.is_error())
|
||||
return WebIDL::DataCloneError::create(*m_vm.current_realm(), "out of memory"_fly_string);
|
||||
return WebIDL::DataCloneError::create(*m_vm.current_realm(), "out of memory"_string);
|
||||
value = JS::ArrayBuffer::create(*realm, bytes_or_error.release_value());
|
||||
break;
|
||||
}
|
||||
|
@ -892,7 +892,7 @@ public:
|
|||
auto interface_name = TRY(deserialize_string(m_vm, m_serialized, m_position));
|
||||
// 2. If the interface identified by interfaceName is not exposed in targetRealm, then throw a "DataCloneError" DOMException.
|
||||
if (!is_interface_exposed_on_target_realm(interface_name, realm))
|
||||
return WebIDL::DataCloneError::create(realm, "Unsupported type"_fly_string);
|
||||
return WebIDL::DataCloneError::create(realm, "Unsupported type"_string);
|
||||
|
||||
// 3. Set value to a new instance of the interface identified by interfaceName, created in targetRealm.
|
||||
value = TRY(create_serialized_type(interface_name, realm));
|
||||
|
@ -1114,7 +1114,7 @@ WebIDL::ExceptionOr<SerializedTransferRecord> structured_serialize_with_transfer
|
|||
// 1. If transferable has neither an [[ArrayBufferData]] internal slot nor a [[Detached]] internal slot, then throw a "DataCloneError" DOMException.
|
||||
// FIXME: Handle transferring ArrayBufferData objects
|
||||
if (!is<Bindings::Transferable>(*transferable)) {
|
||||
return WebIDL::DataCloneError::create(*vm.current_realm(), "Cannot transfer type"_fly_string);
|
||||
return WebIDL::DataCloneError::create(*vm.current_realm(), "Cannot transfer type"_string);
|
||||
}
|
||||
|
||||
// FIXME: 2. If transferable has an [[ArrayBufferData]] internal slot and IsSharedArrayBuffer(transferable) is true, then throw a "DataCloneError" DOMException.
|
||||
|
@ -1122,7 +1122,7 @@ WebIDL::ExceptionOr<SerializedTransferRecord> structured_serialize_with_transfer
|
|||
// 3. If memory[transferable] exists, then throw a "DataCloneError" DOMException.
|
||||
auto transferable_value = JS::Value(transferable);
|
||||
if (memory.contains(transferable_value)) {
|
||||
return WebIDL::DataCloneError::create(*vm.current_realm(), "Cannot transfer value twice"_fly_string);
|
||||
return WebIDL::DataCloneError::create(*vm.current_realm(), "Cannot transfer value twice"_string);
|
||||
}
|
||||
|
||||
// 4. Set memory[transferable] to { [[Type]]: an uninitialized value }.
|
||||
|
@ -1144,7 +1144,7 @@ WebIDL::ExceptionOr<SerializedTransferRecord> structured_serialize_with_transfer
|
|||
if (is<Bindings::Transferable>(*transferable)) {
|
||||
auto& transferable_object = dynamic_cast<Bindings::Transferable&>(*transferable);
|
||||
if (transferable_object.is_detached()) {
|
||||
return WebIDL::DataCloneError::create(*vm.current_realm(), "Value already transferred"_fly_string);
|
||||
return WebIDL::DataCloneError::create(*vm.current_realm(), "Value already transferred"_string);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1250,7 +1250,7 @@ WebIDL::ExceptionOr<DeserializedTransferRecord> structured_deserialize_with_tran
|
|||
|
||||
// 2. If the interface identified by interfaceName is not exposed in targetRealm, then throw a "DataCloneError" DOMException.
|
||||
if (!is_interface_exposed_on_target_realm(interface_name, target_realm))
|
||||
return WebIDL::DataCloneError::create(target_realm, "Unknown type transferred"_fly_string);
|
||||
return WebIDL::DataCloneError::create(target_realm, "Unknown type transferred"_string);
|
||||
|
||||
// 3. Set value to a new instance of the interface identified by interfaceName, created in targetRealm.
|
||||
// 4. Perform the appropriate transfer-receiving steps for the interface identified by interfaceName given transferDataHolder and value.
|
||||
|
|
|
@ -115,7 +115,7 @@ WebIDL::ExceptionOr<String> WindowOrWorkerGlobalScopeMixin::btoa(String const& d
|
|||
byte_string.ensure_capacity(data.bytes().size());
|
||||
for (u32 code_point : Utf8View(data)) {
|
||||
if (code_point > 0xff)
|
||||
return WebIDL::InvalidCharacterError::create(realm, "Data contains characters outside the range U+0000 and U+00FF"_fly_string);
|
||||
return WebIDL::InvalidCharacterError::create(realm, "Data contains characters outside the range U+0000 and U+00FF"_string);
|
||||
byte_string.append(code_point);
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ WebIDL::ExceptionOr<String> WindowOrWorkerGlobalScopeMixin::atob(String const& d
|
|||
|
||||
// 2. If decodedData is failure, then throw an "InvalidCharacterError" DOMException.
|
||||
if (decoded_data.is_error())
|
||||
return WebIDL::InvalidCharacterError::create(realm, "Input string is not valid base64 data"_fly_string);
|
||||
return WebIDL::InvalidCharacterError::create(realm, "Input string is not valid base64 data"_string);
|
||||
|
||||
// 3. Return decodedData.
|
||||
// decode_base64() returns a byte buffer. LibJS uses UTF-8 for strings. Use Latin1Decoder to convert bytes 128-255 to UTF-8.
|
||||
|
|
|
@ -66,7 +66,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Worker>> Worker::create(String const& scrip
|
|||
// 4. If this fails, throw a "SyntaxError" DOMException.
|
||||
if (!url.is_valid()) {
|
||||
dbgln_if(WEB_WORKER_DEBUG, "WebWorker: Invalid URL loaded '{}'.", script_url);
|
||||
return WebIDL::SyntaxError::create(document.realm(), "url is not valid"_fly_string);
|
||||
return WebIDL::SyntaxError::create(document.realm(), "url is not valid"_string);
|
||||
}
|
||||
|
||||
// 5. Let worker URL be the resulting URL record.
|
||||
|
|
|
@ -104,7 +104,7 @@ WebIDL::ExceptionOr<void> WorkerGlobalScope::import_scripts(Vector<String> const
|
|||
|
||||
// 2. If urlRecord is failure, then throw a "SyntaxError" DOMException.
|
||||
if (!url_record.is_valid())
|
||||
return WebIDL::SyntaxError::create(realm(), "Invalid URL"_fly_string);
|
||||
return WebIDL::SyntaxError::create(realm(), "Invalid URL"_string);
|
||||
|
||||
// 3. Append urlRecord to urlRecords.
|
||||
url_records.unchecked_append(url_record);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue