mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +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
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue