mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 18:47:41 +00:00
LibWeb: Port History interface from DeprecatedString to String
This commit is contained in:
parent
7b79324548
commit
72f54eca26
4 changed files with 10 additions and 10 deletions
|
@ -2,7 +2,7 @@
|
||||||
#import <DOM/AbstractRange.idl>
|
#import <DOM/AbstractRange.idl>
|
||||||
#import <Geometry/DOMRect.idl>
|
#import <Geometry/DOMRect.idl>
|
||||||
|
|
||||||
[Exposed=Window]
|
[Exposed=Window, UseNewAKString]
|
||||||
interface Range : AbstractRange {
|
interface Range : AbstractRange {
|
||||||
|
|
||||||
constructor();
|
constructor();
|
||||||
|
|
|
@ -37,14 +37,14 @@ void History::visit_edges(Cell::Visitor& visitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/history.html#dom-history-pushstate
|
// https://html.spec.whatwg.org/multipage/history.html#dom-history-pushstate
|
||||||
WebIDL::ExceptionOr<void> History::push_state(JS::Value data, DeprecatedString const&, DeprecatedString const& url)
|
WebIDL::ExceptionOr<void> History::push_state(JS::Value data, String const&, Optional<String> const& url)
|
||||||
{
|
{
|
||||||
// NOTE: The second parameter of this function is intentionally unused.
|
// NOTE: The second parameter of this function is intentionally unused.
|
||||||
return shared_history_push_replace_state(data, url, IsPush::Yes);
|
return shared_history_push_replace_state(data, url, IsPush::Yes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/history.html#dom-history-replacestate
|
// https://html.spec.whatwg.org/multipage/history.html#dom-history-replacestate
|
||||||
WebIDL::ExceptionOr<void> History::replace_state(JS::Value data, DeprecatedString const&, DeprecatedString const& url)
|
WebIDL::ExceptionOr<void> History::replace_state(JS::Value data, String const&, Optional<String> const& url)
|
||||||
{
|
{
|
||||||
// NOTE: The second parameter of this function is intentionally unused.
|
// NOTE: The second parameter of this function is intentionally unused.
|
||||||
return shared_history_push_replace_state(data, url, IsPush::No);
|
return shared_history_push_replace_state(data, url, IsPush::No);
|
||||||
|
@ -150,7 +150,7 @@ static bool can_have_its_url_rewritten(DOM::Document const& document, AK::URL co
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/history.html#shared-history-push/replace-state-steps
|
// https://html.spec.whatwg.org/multipage/history.html#shared-history-push/replace-state-steps
|
||||||
WebIDL::ExceptionOr<void> History::shared_history_push_replace_state(JS::Value value, DeprecatedString const& url, IsPush)
|
WebIDL::ExceptionOr<void> History::shared_history_push_replace_state(JS::Value value, Optional<String> const& url, IsPush)
|
||||||
{
|
{
|
||||||
// 1. Let document be history's associated Document.
|
// 1. Let document be history's associated Document.
|
||||||
auto& document = m_associated_document;
|
auto& document = m_associated_document;
|
||||||
|
@ -171,10 +171,10 @@ WebIDL::ExceptionOr<void> History::shared_history_push_replace_state(JS::Value v
|
||||||
auto new_url = document->url();
|
auto new_url = document->url();
|
||||||
|
|
||||||
// 6. If url is not null or the empty string, then:
|
// 6. If url is not null or the empty string, then:
|
||||||
if (!url.is_empty() && !url.is_null()) {
|
if (url.has_value() && !url->is_empty()) {
|
||||||
|
|
||||||
// 1. Parse url, relative to the relevant settings object of history.
|
// 1. Parse url, relative to the relevant settings object of history.
|
||||||
auto parsed_url = relevant_settings_object(*this).parse_url(url);
|
auto parsed_url = relevant_settings_object(*this).parse_url(url->to_deprecated_string());
|
||||||
|
|
||||||
// 2. If that fails, then throw a "SecurityError" DOMException.
|
// 2. If that fails, then throw a "SecurityError" DOMException.
|
||||||
if (!parsed_url.is_valid())
|
if (!parsed_url.is_valid())
|
||||||
|
|
|
@ -20,8 +20,8 @@ public:
|
||||||
|
|
||||||
virtual ~History() override;
|
virtual ~History() override;
|
||||||
|
|
||||||
WebIDL::ExceptionOr<void> push_state(JS::Value data, DeprecatedString const& unused, DeprecatedString const& url);
|
WebIDL::ExceptionOr<void> push_state(JS::Value data, String const& unused, Optional<String> const& url = {});
|
||||||
WebIDL::ExceptionOr<void> replace_state(JS::Value data, DeprecatedString const& unused, DeprecatedString const& url);
|
WebIDL::ExceptionOr<void> replace_state(JS::Value data, String const& unused, Optional<String> const& url = {});
|
||||||
WebIDL::ExceptionOr<void> go(long delta);
|
WebIDL::ExceptionOr<void> go(long delta);
|
||||||
WebIDL::ExceptionOr<void> back();
|
WebIDL::ExceptionOr<void> back();
|
||||||
WebIDL::ExceptionOr<void> forward();
|
WebIDL::ExceptionOr<void> forward();
|
||||||
|
@ -37,7 +37,7 @@ private:
|
||||||
No,
|
No,
|
||||||
Yes,
|
Yes,
|
||||||
};
|
};
|
||||||
WebIDL::ExceptionOr<void> shared_history_push_replace_state(JS::Value data, DeprecatedString const& url, IsPush is_push);
|
WebIDL::ExceptionOr<void> shared_history_push_replace_state(JS::Value data, Optional<String> const& url, IsPush is_push);
|
||||||
|
|
||||||
JS::NonnullGCPtr<DOM::Document> m_associated_document;
|
JS::NonnullGCPtr<DOM::Document> m_associated_document;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// https://html.spec.whatwg.org/multipage/history.html#the-history-interface
|
// https://html.spec.whatwg.org/multipage/history.html#the-history-interface
|
||||||
[Exposed=Window]
|
[Exposed=Window, UseNewAKString]
|
||||||
interface History {
|
interface History {
|
||||||
readonly attribute unsigned long length;
|
readonly attribute unsigned long length;
|
||||||
// FIXME: attribute ScrollRestoration scrollRestoration;
|
// FIXME: attribute ScrollRestoration scrollRestoration;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue