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

Everywhere: Use unqualified AK::URL

Now possible in LibWeb now that there is no longer a Web::URL.
This commit is contained in:
Shannon Booth 2024-02-11 20:15:39 +13:00 committed by Andreas Kling
parent f9e5b43b7a
commit 9ce8189f21
156 changed files with 471 additions and 471 deletions

View file

@ -36,7 +36,7 @@ namespace Web::HTML {
JS_DEFINE_ALLOCATOR(BrowsingContext);
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#matches-about:blank
bool url_matches_about_blank(AK::URL const& url)
bool url_matches_about_blank(URL const& url)
{
// A URL matches about:blank if its scheme is "about", its path contains a single string "blank", its username and password are the empty string, and its host is null.
return url.scheme() == "about"sv
@ -47,7 +47,7 @@ bool url_matches_about_blank(AK::URL const& url)
}
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#matches-about:srcdoc
bool url_matches_about_srcdoc(AK::URL const& url)
bool url_matches_about_srcdoc(URL const& url)
{
// A URL matches about:srcdoc if its scheme is "about", its path contains a single string "srcdoc", its query is null, its username and password are the empty string, and its host is null.
return url.scheme() == "about"sv
@ -59,7 +59,7 @@ bool url_matches_about_srcdoc(AK::URL const& url)
}
// https://html.spec.whatwg.org/multipage/document-sequences.html#determining-the-origin
HTML::Origin determine_the_origin(AK::URL const& url, SandboxingFlagSet sandbox_flags, Optional<HTML::Origin> source_origin)
HTML::Origin determine_the_origin(URL const& url, SandboxingFlagSet sandbox_flags, Optional<HTML::Origin> source_origin)
{
// 1. If sandboxFlags has its sandboxed origin browsing context flag set, then return a new opaque origin.
if (has_flag(sandbox_flags, SandboxingFlagSet::SandboxedOrigin)) {
@ -132,7 +132,7 @@ WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext
Optional<Origin> creator_origin = {};
// FIXME: This algorithm needs re-aligned with the spec
Optional<AK::URL> creator_base_url = {};
Optional<URL> creator_base_url = {};
// 4. If creator is non-null, then:
if (creator) {
@ -151,7 +151,7 @@ WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext
SandboxingFlagSet sandbox_flags = {};
// 6. Let origin be the result of determining the origin given about:blank, sandboxFlags, and creatorOrigin.
auto origin = determine_the_origin(AK::URL("about:blank"sv), sandbox_flags, creator_origin);
auto origin = determine_the_origin(URL("about:blank"sv), sandbox_flags, creator_origin);
// FIXME: 7. Let permissionsPolicy be the result of creating a permissions policy given browsingContext and origin. [PERMISSIONSPOLICY]
@ -176,7 +176,7 @@ WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext
});
// 10. Let topLevelCreationURL be about:blank if embedder is null; otherwise embedder's relevant settings object's top-level creation URL.
auto top_level_creation_url = !embedder ? AK::URL("about:blank") : relevant_settings_object(*embedder).top_level_creation_url;
auto top_level_creation_url = !embedder ? URL("about:blank") : relevant_settings_object(*embedder).top_level_creation_url;
// 11. Let topLevelOrigin be origin if embedder is null; otherwise embedder's relevant settings object's top-level origin.
auto top_level_origin = !embedder ? origin : relevant_settings_object(*embedder).origin();
@ -184,7 +184,7 @@ WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext
// 12. Set up a window environment settings object with about:blank, realm execution context, null, topLevelCreationURL, and topLevelOrigin.
WindowEnvironmentSettingsObject::setup(
page,
AK::URL("about:blank"),
URL("about:blank"),
move(realm_execution_context),
{},
top_level_creation_url,

View file

@ -179,7 +179,7 @@ private:
bool m_is_auxiliary { false };
// https://html.spec.whatwg.org/multipage/document-sequences.html#browsing-context-initial-url
Optional<AK::URL> m_initial_url;
Optional<URL> m_initial_url;
// https://html.spec.whatwg.org/multipage/document-sequences.html#virtual-browsing-context-group-id
u64 m_virtual_browsing_context_group_id = { 0 };
@ -199,12 +199,12 @@ private:
JS::GCPtr<BrowsingContext> m_previous_sibling;
};
HTML::Origin determine_the_origin(AK::URL const& url, SandboxingFlagSet sandbox_flags, Optional<HTML::Origin> source_origin);
HTML::Origin determine_the_origin(URL const& url, SandboxingFlagSet sandbox_flags, Optional<HTML::Origin> source_origin);
SandboxingFlagSet determine_the_creation_sandboxing_flags(BrowsingContext const&, JS::GCPtr<DOM::Element> embedder);
// FIXME: Find a better home for these
bool url_matches_about_blank(AK::URL const& url);
bool url_matches_about_srcdoc(AK::URL const& url);
bool url_matches_about_blank(URL const& url);
bool url_matches_about_srcdoc(URL const& url);
}

View file

@ -21,7 +21,7 @@ struct CrossOriginOpenerPolicyEnforcementResult {
bool would_need_a_browsing_context_group_switch_due_to_report_only { false };
// A URL url.
AK::URL url;
URL url;
// An origin origin.
Origin origin;

View file

@ -53,8 +53,8 @@ public:
[[nodiscard]] Optional<HTML::Origin> origin() const { return m_origin; }
void set_origin(Optional<HTML::Origin> origin) { m_origin = move(origin); }
[[nodiscard]] Optional<AK::URL> const& about_base_url() const { return m_about_base_url; }
void set_about_base_url(Optional<AK::URL> url) { m_about_base_url = move(url); }
[[nodiscard]] Optional<URL> const& about_base_url() const { return m_about_base_url; }
void set_about_base_url(Optional<URL> url) { m_about_base_url = move(url); }
[[nodiscard]] Vector<NestedHistory> const& nested_histories() const { return m_nested_histories; }
[[nodiscard]] Vector<NestedHistory>& nested_histories() { return m_nested_histories; }
@ -95,7 +95,7 @@ private:
Optional<HTML::Origin> m_origin;
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#document-state-about-base-url
Optional<AK::URL> m_about_base_url = {};
Optional<URL> m_about_base_url = {};
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#document-state-nested-histories
Vector<NestedHistory> m_nested_histories;

View file

@ -20,7 +20,7 @@ public:
String href() const;
WebIDL::ExceptionOr<void> set_href(String const& href);
AK::URL const& frozen_base_url() const { return m_frozen_base_url; }
URL const& frozen_base_url() const { return m_frozen_base_url; }
virtual void inserted() override;
virtual void removed_from(Node*) override;
@ -34,7 +34,7 @@ private:
// https://html.spec.whatwg.org/multipage/semantics.html#frozen-base-url
// A base element that is the first base element with an href content attribute in a document tree has a frozen base URL.
AK::URL m_frozen_base_url;
URL m_frozen_base_url;
void set_the_frozen_base_url();
};

View file

@ -275,7 +275,7 @@ String HTMLCanvasElement::to_data_url(StringView type, Optional<double> quality)
if (base64_encoded_or_error.is_error()) {
return "data:,"_string;
}
return MUST(AK::URL::create_with_data(file.value().mime_type, base64_encoded_or_error.release_value(), true).to_string());
return MUST(URL::create_with_data(file.value().mime_type, base64_encoded_or_error.release_value(), true).to_string());
}
// https://html.spec.whatwg.org/multipage/canvas.html#dom-canvas-toblob

View file

@ -10,7 +10,7 @@ namespace Web::HTML {
JS_DEFINE_ALLOCATOR(HTMLDocument);
HTMLDocument::HTMLDocument(JS::Realm& realm, AK::URL const& url)
HTMLDocument::HTMLDocument(JS::Realm& realm, URL const& url)
: Document(realm, url)
{
}
@ -22,7 +22,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLDocument>> HTMLDocument::construct_impl
return HTMLDocument::create(realm);
}
JS::NonnullGCPtr<HTMLDocument> HTMLDocument::create(JS::Realm& realm, AK::URL const& url)
JS::NonnullGCPtr<HTMLDocument> HTMLDocument::create(JS::Realm& realm, URL const& url)
{
return realm.heap().allocate<HTMLDocument>(realm, realm, url);
}

View file

@ -21,11 +21,11 @@ class HTMLDocument final : public DOM::Document {
public:
virtual ~HTMLDocument() override;
[[nodiscard]] static JS::NonnullGCPtr<HTMLDocument> create(JS::Realm&, AK::URL const& url = "about:blank"sv);
[[nodiscard]] static JS::NonnullGCPtr<HTMLDocument> create(JS::Realm&, URL const& url = "about:blank"sv);
WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLDocument>> construct_impl(JS::Realm&);
private:
HTMLDocument(JS::Realm&, AK::URL const&);
HTMLDocument(JS::Realm&, URL const&);
};
}

View file

@ -708,7 +708,7 @@ static ErrorOr<String> plain_text_encode(Vector<DOMURL::QueryParam> const& pairs
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-mutate-action
ErrorOr<void> HTMLFormElement::mutate_action_url(AK::URL parsed_action, Vector<XHR::FormDataEntry> entry_list, String encoding, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement)
ErrorOr<void> HTMLFormElement::mutate_action_url(URL parsed_action, Vector<XHR::FormDataEntry> entry_list, String encoding, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement)
{
// 1. Let pairs be the result of converting to a list of name-value pairs with entry list.
auto pairs = TRY(convert_to_list_of_name_value_pairs(entry_list));
@ -725,7 +725,7 @@ ErrorOr<void> HTMLFormElement::mutate_action_url(AK::URL parsed_action, Vector<X
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-body
ErrorOr<void> HTMLFormElement::submit_as_entity_body(AK::URL parsed_action, Vector<XHR::FormDataEntry> entry_list, EncodingTypeAttributeState encoding_type, [[maybe_unused]] String encoding, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement)
ErrorOr<void> HTMLFormElement::submit_as_entity_body(URL parsed_action, Vector<XHR::FormDataEntry> entry_list, EncodingTypeAttributeState encoding_type, [[maybe_unused]] String encoding, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement)
{
// 1. Assert: method is POST.
@ -784,7 +784,7 @@ ErrorOr<void> HTMLFormElement::submit_as_entity_body(AK::URL parsed_action, Vect
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-get-action
void HTMLFormElement::get_action_url(AK::URL parsed_action, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement)
void HTMLFormElement::get_action_url(URL parsed_action, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement)
{
// 1. Plan to navigate to parsed action.
// Spec Note: entry list is discarded.
@ -792,7 +792,7 @@ void HTMLFormElement::get_action_url(AK::URL parsed_action, JS::NonnullGCPtr<Nav
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-mailto-headers
ErrorOr<void> HTMLFormElement::mail_with_headers(AK::URL parsed_action, Vector<XHR::FormDataEntry> entry_list, [[maybe_unused]] String encoding, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement)
ErrorOr<void> HTMLFormElement::mail_with_headers(URL parsed_action, Vector<XHR::FormDataEntry> entry_list, [[maybe_unused]] String encoding, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement)
{
// 1. Let pairs be the result of converting to a list of name-value pairs with entry list.
auto pairs = TRY(convert_to_list_of_name_value_pairs(entry_list));
@ -811,7 +811,7 @@ ErrorOr<void> HTMLFormElement::mail_with_headers(AK::URL parsed_action, Vector<X
return {};
}
ErrorOr<void> HTMLFormElement::mail_as_body(AK::URL parsed_action, Vector<XHR::FormDataEntry> entry_list, EncodingTypeAttributeState encoding_type, [[maybe_unused]] String encoding, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement)
ErrorOr<void> HTMLFormElement::mail_as_body(URL parsed_action, Vector<XHR::FormDataEntry> entry_list, EncodingTypeAttributeState encoding_type, [[maybe_unused]] String encoding, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement)
{
// 1. Let pairs be the result of converting to a list of name-value pairs with entry list.
auto pairs = TRY(convert_to_list_of_name_value_pairs(entry_list));
@ -828,7 +828,7 @@ ErrorOr<void> HTMLFormElement::mail_as_body(AK::URL parsed_action, Vector<XHR::F
// 2. Set body to the result of running UTF-8 percent-encode on body using the default encode set. [URL]
// NOTE: body is already UTF-8 encoded due to using AK::String, so we only have to do the percent encoding.
// NOTE: "default encode set" links to "path percent-encode-set": https://url.spec.whatwg.org/#default-encode-set
auto percent_encoded_body = AK::URL::percent_encode(body, AK::URL::PercentEncodeSet::Path);
auto percent_encoded_body = URL::percent_encode(body, URL::PercentEncodeSet::Path);
body = TRY(String::from_utf8(percent_encoded_body.view()));
break;
}
@ -865,7 +865,7 @@ ErrorOr<void> HTMLFormElement::mail_as_body(AK::URL parsed_action, Vector<XHR::F
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plan-to-navigate
void HTMLFormElement::plan_to_navigate_to(AK::URL url, Variant<Empty, String, POSTResource> post_resource, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement)
void HTMLFormElement::plan_to_navigate_to(URL url, Variant<Empty, String, POSTResource> post_resource, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement)
{
// 1. Let referrerPolicy be the empty string.
ReferrerPolicy::ReferrerPolicy referrer_policy = ReferrerPolicy::ReferrerPolicy::EmptyString;

View file

@ -111,12 +111,12 @@ private:
ErrorOr<String> pick_an_encoding() const;
ErrorOr<void> mutate_action_url(AK::URL parsed_action, Vector<XHR::FormDataEntry> entry_list, String encoding, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement);
ErrorOr<void> submit_as_entity_body(AK::URL parsed_action, Vector<XHR::FormDataEntry> entry_list, EncodingTypeAttributeState encoding_type, String encoding, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement);
void get_action_url(AK::URL parsed_action, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement);
ErrorOr<void> mail_with_headers(AK::URL parsed_action, Vector<XHR::FormDataEntry> entry_list, String encoding, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement);
ErrorOr<void> mail_as_body(AK::URL parsed_action, Vector<XHR::FormDataEntry> entry_list, EncodingTypeAttributeState encoding_type, String encoding, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement);
void plan_to_navigate_to(AK::URL url, Variant<Empty, String, POSTResource> post_resource, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement);
ErrorOr<void> mutate_action_url(URL parsed_action, Vector<XHR::FormDataEntry> entry_list, String encoding, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement);
ErrorOr<void> submit_as_entity_body(URL parsed_action, Vector<XHR::FormDataEntry> entry_list, EncodingTypeAttributeState encoding_type, String encoding, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement);
void get_action_url(URL parsed_action, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement);
ErrorOr<void> mail_with_headers(URL parsed_action, Vector<XHR::FormDataEntry> entry_list, String encoding, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement);
ErrorOr<void> mail_as_body(URL parsed_action, Vector<XHR::FormDataEntry> entry_list, EncodingTypeAttributeState encoding_type, String encoding, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement);
void plan_to_navigate_to(URL url, Variant<Empty, String, POSTResource> post_resource, JS::NonnullGCPtr<Navigable> target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement);
FormAssociatedElement* default_button();
size_t number_of_fields_blocking_implicit_submission() const;

View file

@ -205,7 +205,7 @@ String HTMLHyperlinkElementUtils::hostname() const
// 1. Reinitialize url.
//
// 2. Let url be this element's url.
AK::URL url(href());
URL url(href());
// 3. If url or url's host is null, return the empty string.
if (url.host().has<Empty>())

View file

@ -69,7 +69,7 @@ private:
void update_href();
bool cannot_navigate() const;
Optional<AK::URL> m_url;
Optional<URL> m_url;
};
}

View file

@ -85,7 +85,7 @@ void HTMLIFrameElement::process_the_iframe_attributes(bool initial_insertion)
// 1. Set element's lazy load resumption steps to the rest of this algorithm starting with the step labeled navigate to the srcdoc resource.
set_lazy_load_resumption_steps([this]() {
// 3. Navigate to the srcdoc resource: navigate an iframe or frame given element, about:srcdoc, the empty string, and the value of element's srcdoc attribute.
navigate_an_iframe_or_frame(AK::URL("about:srcdoc"sv), ReferrerPolicy::ReferrerPolicy::EmptyString, get_attribute(HTML::AttributeNames::srcdoc));
navigate_an_iframe_or_frame(URL("about:srcdoc"sv), ReferrerPolicy::ReferrerPolicy::EmptyString, get_attribute(HTML::AttributeNames::srcdoc));
// FIXME: The resulting Document must be considered an iframe srcdoc document.
});
@ -101,7 +101,7 @@ void HTMLIFrameElement::process_the_iframe_attributes(bool initial_insertion)
}
// 3. Navigate to the srcdoc resource: navigate an iframe or frame given element, about:srcdoc, the empty string, and the value of element's srcdoc attribute.
navigate_an_iframe_or_frame(AK::URL("about:srcdoc"sv), ReferrerPolicy::ReferrerPolicy::EmptyString, get_attribute(HTML::AttributeNames::srcdoc));
navigate_an_iframe_or_frame(URL("about:srcdoc"sv), ReferrerPolicy::ReferrerPolicy::EmptyString, get_attribute(HTML::AttributeNames::srcdoc));
// FIXME: The resulting Document must be considered an iframe srcdoc document.

View file

@ -582,7 +582,7 @@ after_step_7:
return {};
}
void HTMLImageElement::add_callbacks_to_image_request(JS::NonnullGCPtr<ImageRequest> image_request, bool maybe_omit_events, AK::URL const& url_string, AK::URL const& previous_url)
void HTMLImageElement::add_callbacks_to_image_request(JS::NonnullGCPtr<ImageRequest> image_request, bool maybe_omit_events, URL const& url_string, URL const& previous_url)
{
image_request->add_callbacks(
[this, image_request, maybe_omit_events, url_string, previous_url]() {

View file

@ -110,9 +110,9 @@ private:
virtual void did_set_viewport_rect(CSSPixelRect const&) override;
void handle_successful_fetch(AK::URL const&, StringView mime_type, ImageRequest&, ByteBuffer, bool maybe_omit_events, AK::URL const& previous_url);
void handle_successful_fetch(URL const&, StringView mime_type, ImageRequest&, ByteBuffer, bool maybe_omit_events, URL const& previous_url);
void handle_failed_fetch();
void add_callbacks_to_image_request(JS::NonnullGCPtr<ImageRequest>, bool maybe_omit_events, AK::URL const& url_string, AK::URL const& previous_url);
void add_callbacks_to_image_request(JS::NonnullGCPtr<ImageRequest>, bool maybe_omit_events, URL const& url_string, URL const& previous_url);
void animate();

View file

@ -361,7 +361,7 @@ void HTMLLinkElement::process_stylesheet_resource(bool success, Fetch::Infrastru
auto const& encoded_string = body_bytes.get<ByteBuffer>();
auto maybe_decoded_string = TextCodec::convert_input_to_utf8_using_given_decoder_unless_there_is_a_byte_order_mark(*decoder, encoded_string);
if (maybe_decoded_string.is_error()) {
dbgln("Style sheet {} claimed to be '{}' but decoding failed", response.url().value_or(AK::URL()), encoding);
dbgln("Style sheet {} claimed to be '{}' but decoding failed", response.url().value_or(URL()), encoding);
dispatch_event(*DOM::Event::create(realm(), HTML::EventNames::error));
} else {
auto const decoded_string = maybe_decoded_string.release_value();
@ -442,7 +442,7 @@ void HTMLLinkElement::resource_did_load_favicon()
document().check_favicon_after_loading_link_resource();
}
static bool decode_favicon(ReadonlyBytes favicon_data, AK::URL const& favicon_url, JS::GCPtr<Navigable> navigable)
static bool decode_favicon(ReadonlyBytes favicon_data, URL const& favicon_url, JS::GCPtr<Navigable> navigable)
{
auto decoded_image = Platform::ImageCodecPlugin::the().decode_image(favicon_data);
if (!decoded_image.has_value() || decoded_image->frames.is_empty()) {

View file

@ -75,7 +75,7 @@ private:
// Null or a source set
// base URL
// A URL
AK::URL base_url;
URL base_url;
// origin
// An origin
HTML::Origin origin;

View file

@ -894,7 +894,7 @@ enum class FetchMode {
};
// https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource
WebIDL::ExceptionOr<void> HTMLMediaElement::fetch_resource(AK::URL const& url_record, Function<void(String)> failure_callback)
WebIDL::ExceptionOr<void> HTMLMediaElement::fetch_resource(URL const& url_record, Function<void(String)> failure_callback)
{
auto& realm = this->realm();
auto& vm = realm.vm();

View file

@ -158,7 +158,7 @@ private:
Task::Source media_element_event_task_source() const { return m_media_element_event_task_source.source; }
WebIDL::ExceptionOr<void> load_element();
WebIDL::ExceptionOr<void> fetch_resource(AK::URL const&, Function<void(String)> failure_callback);
WebIDL::ExceptionOr<void> fetch_resource(URL const&, Function<void(String)> failure_callback);
static bool verify_response(JS::NonnullGCPtr<Fetch::Infrastructure::Response>, ByteRange const&);
WebIDL::ExceptionOr<void> process_media_data(Function<void(String)> failure_callback);
WebIDL::ExceptionOr<void> handle_media_source_failure(Span<JS::NonnullGCPtr<WebIDL::Promise>> promises, String error_message);

View file

@ -121,7 +121,7 @@ WebIDL::ExceptionOr<void> History::forward()
}
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#can-have-its-url-rewritten
bool can_have_its_url_rewritten(DOM::Document const& document, AK::URL const& target_url)
bool can_have_its_url_rewritten(DOM::Document const& document, ::URL const& target_url)
{
// 1. Let documentURL be document's URL.
auto document_url = document.url();

View file

@ -47,6 +47,6 @@ private:
JS::Value m_state { JS::js_null() };
};
bool can_have_its_url_rewritten(DOM::Document const& document, AK::URL const& target_url);
bool can_have_its_url_rewritten(DOM::Document const& document, URL const& target_url);
}

View file

@ -66,12 +66,12 @@ void ImageRequest::set_state(State state)
m_state = state;
}
AK::URL const& ImageRequest::current_url() const
URL const& ImageRequest::current_url() const
{
return m_current_url;
}
void ImageRequest::set_current_url(JS::Realm& realm, AK::URL url)
void ImageRequest::set_current_url(JS::Realm& realm, URL url)
{
m_current_url = move(url);
if (m_current_url.is_valid())

View file

@ -40,8 +40,8 @@ public:
State state() const;
void set_state(State);
AK::URL const& current_url() const;
void set_current_url(JS::Realm&, AK::URL);
URL const& current_url() const;
void set_current_url(JS::Realm&, URL);
[[nodiscard]] JS::GCPtr<DecodedImageData> image_data() const;
void set_image_data(JS::GCPtr<DecodedImageData>);
@ -73,7 +73,7 @@ private:
// https://html.spec.whatwg.org/multipage/images.html#img-req-url
// An image request's current URL is initially the empty string.
AK::URL m_current_url;
URL m_current_url;
// https://html.spec.whatwg.org/multipage/images.html#img-req-data
JS::GCPtr<DecodedImageData> m_image_data;

View file

@ -22,7 +22,7 @@ bool ListOfAvailableImages::Key::operator==(Key const& other) const
u32 ListOfAvailableImages::Key::hash() const
{
if (!cached_hash.has_value()) {
u32 url_hash = Traits<AK::URL>::hash(url);
u32 url_hash = Traits<URL>::hash(url);
u32 mode_hash = static_cast<u32>(mode);
u32 origin_hash = 0;
if (origin.has_value())

View file

@ -22,7 +22,7 @@ class ListOfAvailableImages : public JS::Cell {
public:
struct Key {
AK::URL url;
URL url;
HTML::CORSSettingAttribute mode;
Optional<HTML::Origin> origin;

View file

@ -74,7 +74,7 @@ static Bindings::NavigationHistoryBehavior to_navigation_history_behavior(Histor
}
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#location-object-navigate
WebIDL::ExceptionOr<void> Location::navigate(AK::URL url, HistoryHandlingBehavior history_handling)
WebIDL::ExceptionOr<void> Location::navigate(URL url, HistoryHandlingBehavior history_handling)
{
// 1. Let navigable be location's relevant global object's navigable.
auto navigable = verify_cast<HTML::Window>(HTML::relevant_global_object(*this)).navigable();
@ -97,7 +97,7 @@ WebIDL::ExceptionOr<void> Location::navigate(AK::URL url, HistoryHandlingBehavio
}
// https://html.spec.whatwg.org/multipage/history.html#concept-location-url
AK::URL Location::url() const
URL Location::url() const
{
// A Location object has an associated url, which is this Location object's relevant Document's URL,
// if this Location object's relevant Document is non-null, and about:blank otherwise.

View file

@ -75,8 +75,8 @@ private:
virtual void visit_edges(Cell::Visitor&) override;
JS::GCPtr<DOM::Document> relevant_document() const;
AK::URL url() const;
WebIDL::ExceptionOr<void> navigate(AK::URL, HistoryHandlingBehavior = HistoryHandlingBehavior::Default);
URL url() const;
WebIDL::ExceptionOr<void> navigate(URL, HistoryHandlingBehavior = HistoryHandlingBehavior::Default);
// [[CrossOriginPropertyDescriptorMap]], https://html.spec.whatwg.org/multipage/browsers.html#crossoriginpropertydescriptormap
HTML::CrossOriginPropertyDescriptorMap m_cross_origin_property_descriptor_map;

View file

@ -501,7 +501,7 @@ Vector<JS::NonnullGCPtr<SessionHistoryEntry>>& Navigable::get_session_history_en
}
// https://html.spec.whatwg.org/multipage/browsers.html#determining-navigation-params-policy-container
static PolicyContainer determine_navigation_params_policy_container(AK::URL const& response_url,
static PolicyContainer determine_navigation_params_policy_container(URL const& response_url,
Optional<PolicyContainer> history_policy_container,
Optional<PolicyContainer> initiator_policy_container,
Optional<PolicyContainer> parent_policy_container,
@ -594,7 +594,7 @@ static WebIDL::ExceptionOr<NavigationParams> create_navigation_params_from_a_src
// header list: (`Content-Type`, `text/html`)
// body: the UTF-8 encoding of documentResource, as a body
auto response = Fetch::Infrastructure::Response::create(vm);
response->url_list().append(AK::URL("about:srcdoc"));
response->url_list().append(URL("about:srcdoc"));
auto header = TRY_OR_THROW_OOM(vm, Fetch::Infrastructure::Header::from_string_pair("Content-Type"sv, "text/html"sv));
TRY_OR_THROW_OOM(vm, response->header_list()->append(move(header)));
response->set_body(TRY(Fetch::Infrastructure::byte_sequence_as_body(realm, document_resource.get<String>().bytes())));
@ -791,10 +791,10 @@ static WebIDL::ExceptionOr<Variant<Empty, NavigationParams, NonFetchSchemeNaviga
CrossOriginOpenerPolicy response_coop = {};
// 16. Let locationURL be null.
ErrorOr<Optional<AK::URL>> location_url { OptionalNone {} };
ErrorOr<Optional<URL>> location_url { OptionalNone {} };
// 17. Let currentURL be request's current URL.
AK::URL current_url = request->current_url();
URL current_url = request->current_url();
// 18. Let commitEarlyHints be null.
Function<void(DOM::Document&)> commit_early_hints = nullptr;
@ -1126,7 +1126,7 @@ WebIDL::ExceptionOr<void> Navigable::populate_session_history_entry_document(
auto error_html = load_error_page(entry->url).release_value_but_fixme_should_propagate_errors();
entry->document_state->set_document(create_document_for_inline_content(this, navigation_id, [error_html](auto& document) {
auto parser = HTML::HTMLParser::create(document, error_html, "utf-8");
document.set_url(AK::URL("about:error"));
document.set_url(URL("about:error"));
parser->run();
}));
@ -1255,7 +1255,7 @@ WebIDL::ExceptionOr<void> Navigable::navigate(NavigateParams params)
// 1. If url equals navigable's active document's URL,
// and initiatorOriginSnapshot is same origin with targetNavigable's active document's origin,
// then set historyHandling to "replace".
if (url.equals(active_document.url(), AK::URL::ExcludeFragment::Yes) && initiator_origin_snapshot.is_same_origin(active_document.origin()))
if (url.equals(active_document.url(), URL::ExcludeFragment::Yes) && initiator_origin_snapshot.is_same_origin(active_document.origin()))
history_handling = Bindings::NavigationHistoryBehavior::Replace;
// 2. Otherwise, set historyHandling to "push".
@ -1274,7 +1274,7 @@ WebIDL::ExceptionOr<void> Navigable::navigate(NavigateParams params)
// - url's fragment is non-null
if (document_resource.has<Empty>()
&& !response
&& url.equals(active_session_history_entry()->url, AK::URL::ExcludeFragment::Yes)
&& url.equals(active_session_history_entry()->url, URL::ExcludeFragment::Yes)
&& url.fragment().has_value()) {
// 1. Navigate to a fragment given navigable, url, historyHandling, userInvolvement, navigationAPIState, and navigationId.
TRY(navigate_to_a_fragment(url, to_history_handling_behavior(history_handling), user_involvement, navigation_api_state, navigation_id));
@ -1433,7 +1433,7 @@ WebIDL::ExceptionOr<void> Navigable::navigate(NavigateParams params)
}
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate-fragid
WebIDL::ExceptionOr<void> Navigable::navigate_to_a_fragment(AK::URL const& url, HistoryHandlingBehavior history_handling, UserNavigationInvolvement user_involvement, Optional<SerializationRecord> navigation_api_state, String navigation_id)
WebIDL::ExceptionOr<void> Navigable::navigate_to_a_fragment(URL const& url, HistoryHandlingBehavior history_handling, UserNavigationInvolvement user_involvement, Optional<SerializationRecord> navigation_api_state, String navigation_id)
{
(void)navigation_id;
@ -1520,7 +1520,7 @@ WebIDL::ExceptionOr<void> Navigable::navigate_to_a_fragment(AK::URL const& url,
}
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#evaluate-a-javascript:-url
WebIDL::ExceptionOr<JS::GCPtr<DOM::Document>> Navigable::evaluate_javascript_url(AK::URL const& url, Origin const& new_document_origin, String navigation_id)
WebIDL::ExceptionOr<JS::GCPtr<DOM::Document>> Navigable::evaluate_javascript_url(URL const& url, Origin const& new_document_origin, String navigation_id)
{
auto& vm = this->vm();
auto& realm = active_window()->realm();
@ -1532,7 +1532,7 @@ WebIDL::ExceptionOr<JS::GCPtr<DOM::Document>> Navigable::evaluate_javascript_url
auto encoded_script_source = url_string.substring_view(11, url_string.length() - 11);
// 3. Let scriptSource be the UTF-8 decoding of the percent-decoding of encodedScriptSource.
auto script_source = AK::URL::percent_decode(encoded_script_source);
auto script_source = URL::percent_decode(encoded_script_source);
// 4. Let settings be targetNavigable's active document's relevant settings object.
auto& settings = active_document()->relevant_settings_object();
@ -1622,7 +1622,7 @@ WebIDL::ExceptionOr<JS::GCPtr<DOM::Document>> Navigable::evaluate_javascript_url
}
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate-to-a-javascript:-url
WebIDL::ExceptionOr<void> Navigable::navigate_to_a_javascript_url(AK::URL const& url, HistoryHandlingBehavior history_handling, Origin const& initiator_origin, CSPNavigationType csp_navigation_type, String navigation_id)
WebIDL::ExceptionOr<void> Navigable::navigate_to_a_javascript_url(URL const& url, HistoryHandlingBehavior history_handling, Origin const& initiator_origin, CSPNavigationType csp_navigation_type, String navigation_id)
{
// 1. Assert: historyHandling is "replace".
VERIFY(history_handling == HistoryHandlingBehavior::Replace);
@ -1711,7 +1711,7 @@ void Navigable::reload()
}
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#the-navigation-must-be-a-replace
bool navigation_must_be_a_replace(AK::URL const& url, DOM::Document const& document)
bool navigation_must_be_a_replace(URL const& url, DOM::Document const& document)
{
return url.scheme() == "javascript"sv || document.is_initial_about_blank();
}
@ -1859,7 +1859,7 @@ void finalize_a_cross_document_navigation(JS::NonnullGCPtr<Navigable> navigable,
}
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#url-and-history-update-steps
void perform_url_and_history_update_steps(DOM::Document& document, AK::URL new_url, Optional<SerializationRecord> serialized_data, HistoryHandlingBehavior history_handling)
void perform_url_and_history_update_steps(DOM::Document& document, URL new_url, Optional<SerializationRecord> serialized_data, HistoryHandlingBehavior history_handling)
{
// 1. Let navigable be document's node navigable.
auto navigable = document.navigable();

View file

@ -125,7 +125,7 @@ public:
Function<void()> completion_steps = [] {});
struct NavigateParams {
AK::URL const& url;
URL const& url;
JS::NonnullGCPtr<DOM::Document> source_document;
Variant<Empty, String, POSTResource> document_resource = Empty {};
JS::GCPtr<Fetch::Infrastructure::Response> response = nullptr;
@ -139,10 +139,10 @@ public:
WebIDL::ExceptionOr<void> navigate(NavigateParams);
WebIDL::ExceptionOr<void> navigate_to_a_fragment(AK::URL const&, HistoryHandlingBehavior, UserNavigationInvolvement, Optional<SerializationRecord> navigation_api_state, String navigation_id);
WebIDL::ExceptionOr<void> navigate_to_a_fragment(URL const&, HistoryHandlingBehavior, UserNavigationInvolvement, Optional<SerializationRecord> navigation_api_state, String navigation_id);
WebIDL::ExceptionOr<JS::GCPtr<DOM::Document>> evaluate_javascript_url(AK::URL const&, Origin const& new_document_origin, String navigation_id);
WebIDL::ExceptionOr<void> navigate_to_a_javascript_url(AK::URL const&, HistoryHandlingBehavior, Origin const& initiator_origin, CSPNavigationType csp_navigation_type, String navigation_id);
WebIDL::ExceptionOr<JS::GCPtr<DOM::Document>> evaluate_javascript_url(URL const&, Origin const& new_document_origin, String navigation_id);
WebIDL::ExceptionOr<void> navigate_to_a_javascript_url(URL const&, HistoryHandlingBehavior, Origin const& initiator_origin, CSPNavigationType csp_navigation_type, String navigation_id);
bool allowed_by_sandboxing_to_navigate(Navigable const& target, SourceSnapshotParams const&);
@ -229,9 +229,9 @@ private:
HashTable<Navigable*>& all_navigables();
bool navigation_must_be_a_replace(AK::URL const& url, DOM::Document const& document);
bool navigation_must_be_a_replace(URL const& url, DOM::Document const& document);
void finalize_a_cross_document_navigation(JS::NonnullGCPtr<Navigable>, HistoryHandlingBehavior, JS::NonnullGCPtr<SessionHistoryEntry>);
void perform_url_and_history_update_steps(DOM::Document& document, AK::URL new_url, Optional<SerializationRecord> = {}, HistoryHandlingBehavior history_handling = HistoryHandlingBehavior::Reload);
void perform_url_and_history_update_steps(DOM::Document& document, URL new_url, Optional<SerializationRecord> = {}, HistoryHandlingBehavior history_handling = HistoryHandlingBehavior::Reload);
UserNavigationInvolvement user_navigation_involvement(DOM::Event const&);
}

View file

@ -188,10 +188,10 @@ HTML::WindowProxy* NavigableContainer::content_window()
}
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#shared-attribute-processing-steps-for-iframe-and-frame-elements
Optional<AK::URL> NavigableContainer::shared_attribute_processing_steps_for_iframe_and_frame(bool initial_insertion)
Optional<URL> NavigableContainer::shared_attribute_processing_steps_for_iframe_and_frame(bool initial_insertion)
{
// 1. Let url be the URL record about:blank.
auto url = AK::URL("about:blank");
auto url = URL("about:blank");
// 2. If element has a src attribute specified, and its value is not the empty string,
// then parse the value of that attribute relative to element's node document.
@ -208,7 +208,7 @@ Optional<AK::URL> NavigableContainer::shared_attribute_processing_steps_for_ifra
if (m_content_navigable) {
for (auto const& navigable : document().inclusive_ancestor_navigables()) {
VERIFY(navigable->active_document());
if (navigable->active_document()->url().equals(url, AK::URL::ExcludeFragment::Yes))
if (navigable->active_document()->url().equals(url, URL::ExcludeFragment::Yes))
return {};
}
}
@ -223,7 +223,7 @@ Optional<AK::URL> NavigableContainer::shared_attribute_processing_steps_for_ifra
}
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#navigate-an-iframe-or-frame
void NavigableContainer::navigate_an_iframe_or_frame(AK::URL url, ReferrerPolicy::ReferrerPolicy referrer_policy, Optional<String> srcdoc_string)
void NavigableContainer::navigate_an_iframe_or_frame(URL url, ReferrerPolicy::ReferrerPolicy referrer_policy, Optional<String> srcdoc_string)
{
// 1. Let historyHandling be "auto".
auto history_handling = Bindings::NavigationHistoryBehavior::Auto;

View file

@ -57,10 +57,10 @@ protected:
virtual void visit_edges(Cell::Visitor&) override;
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#shared-attribute-processing-steps-for-iframe-and-frame-elements
Optional<AK::URL> shared_attribute_processing_steps_for_iframe_and_frame(bool initial_insertion);
Optional<URL> shared_attribute_processing_steps_for_iframe_and_frame(bool initial_insertion);
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#navigate-an-iframe-or-frame
void navigate_an_iframe_or_frame(AK::URL url, ReferrerPolicy::ReferrerPolicy referrer_policy, Optional<String> srcdoc_string = {});
void navigate_an_iframe_or_frame(URL url, ReferrerPolicy::ReferrerPolicy referrer_policy, Optional<String> srcdoc_string = {});
WebIDL::ExceptionOr<void> create_new_child_navigable();

View file

@ -1012,7 +1012,7 @@ bool Navigation::inner_navigate_event_firing_algorithm(
// - destination's URL's fragment is not identical to currentURL's fragment,
// then initialize event's hashChange to true. Otherwise, initialize it to false.
event_init.hash_change = (destination->same_document()
&& destination->raw_url().equals(current_url, AK::URL::ExcludeFragment::Yes)
&& destination->raw_url().equals(current_url, URL::ExcludeFragment::Yes)
&& destination->raw_url().fragment() != current_url.fragment());
// 22. If userInvolvement is not "none", then initialize event's userInitiated to true. Otherwise, initialize it to false.
@ -1282,7 +1282,7 @@ bool Navigation::fire_a_traverse_navigate_event(JS::NonnullGCPtr<SessionHistoryE
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#fire-a-push/replace/reload-navigate-event
bool Navigation::fire_a_push_replace_reload_navigate_event(
Bindings::NavigationType navigation_type,
AK::URL destination_url,
URL destination_url,
bool is_same_document,
UserNavigationInvolvement user_involvement,
Optional<Vector<XHR::FormDataEntry>&> form_data_entry_list,
@ -1322,7 +1322,7 @@ bool Navigation::fire_a_push_replace_reload_navigate_event(
}
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#fire-a-download-request-navigate-event
bool Navigation::fire_a_download_request_navigate_event(AK::URL destination_url, UserNavigationInvolvement user_involvement, String filename)
bool Navigation::fire_a_download_request_navigate_event(URL destination_url, UserNavigationInvolvement user_involvement, String filename)
{
auto& realm = relevant_realm(*this);
auto& vm = this->vm();

View file

@ -113,13 +113,13 @@ public:
bool fire_a_traverse_navigate_event(JS::NonnullGCPtr<SessionHistoryEntry> destination_she, UserNavigationInvolvement = UserNavigationInvolvement::None);
bool fire_a_push_replace_reload_navigate_event(
Bindings::NavigationType,
AK::URL destination_url,
URL destination_url,
bool is_same_document,
UserNavigationInvolvement = UserNavigationInvolvement::None,
Optional<Vector<XHR::FormDataEntry>&> form_data_entry_list = {},
Optional<SerializationRecord> navigation_api_state = {},
Optional<SerializationRecord> classic_history_api_state = {});
bool fire_a_download_request_navigate_event(AK::URL destination_url, UserNavigationInvolvement user_involvement, String filename);
bool fire_a_download_request_navigate_event(URL destination_url, UserNavigationInvolvement user_involvement, String filename);
void initialize_the_navigation_api_entries_for_a_new_document(Vector<JS::NonnullGCPtr<SessionHistoryEntry>> const& new_shes, JS::NonnullGCPtr<SessionHistoryEntry> initial_she);
void update_the_navigation_api_entries_for_a_same_document_navigation(JS::NonnullGCPtr<SessionHistoryEntry> destination_she, Bindings::NavigationType);

View file

@ -31,14 +31,14 @@ public:
JS::GCPtr<NavigationHistoryEntry> navigation_history_entry() const { return m_entry; }
// Setters are not available to JS, but expected in many spec algorithms
void set_url(AK::URL const& url) { m_url = url; }
void set_url(URL const& url) { m_url = url; }
void set_entry(JS::GCPtr<NavigationHistoryEntry> entry) { m_entry = entry; }
void set_state(SerializationRecord state) { m_state = move(state); }
void set_is_same_document(bool b) { m_is_same_document = b; }
virtual ~NavigationDestination() override;
AK::URL const& raw_url() const { return m_url; }
URL const& raw_url() const { return m_url; }
private:
NavigationDestination(JS::Realm&);
@ -47,7 +47,7 @@ private:
virtual void visit_edges(JS::Cell::Visitor&) override;
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigationdestination-url
AK::URL m_url;
URL m_url;
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigationdestination-url
JS::GCPtr<NavigationHistoryEntry> m_entry;

View file

@ -59,7 +59,7 @@ struct NavigationParams {
// FIXME: a NavigationTimingType used for creating the navigation timing entry for the new Document
// a URL or null used to populate the new Document's about base URL
Optional<AK::URL> about_base_url;
Optional<URL> about_base_url;
};
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#non-fetch-scheme-navigation-params
@ -71,7 +71,7 @@ struct NonFetchSchemeNavigationParams {
JS::Handle<Navigable> navigable;
// a URL
AK::URL url;
URL url;
// the target snapshot params's sandboxing flags present during navigation
SandboxingFlagSet target_snapshot_sandboxing_flags = {};

View file

@ -16,7 +16,7 @@ namespace Web::HTML {
class Origin {
public:
Origin() = default;
Origin(Optional<ByteString> const& scheme, AK::URL::Host const& host, u16 port)
Origin(Optional<ByteString> const& scheme, URL::Host const& host, u16 port)
: m_scheme(scheme)
, m_host(host)
, m_port(port)
@ -30,7 +30,7 @@ public:
{
return m_scheme.map([](auto& str) { return str.view(); }).value_or(StringView {});
}
AK::URL::Host const& host() const { return m_host; }
URL::Host const& host() const { return m_host; }
u16 port() const { return m_port; }
// https://html.spec.whatwg.org/multipage/origin.html#same-origin
@ -98,7 +98,7 @@ public:
}
// https://html.spec.whatwg.org/multipage/origin.html#concept-origin-effective-domain
Optional<AK::URL::Host> effective_domain() const
Optional<URL::Host> effective_domain() const
{
// 1. If origin is an opaque origin, then return null.
if (is_opaque())
@ -114,7 +114,7 @@ public:
private:
Optional<ByteString> m_scheme;
AK::URL::Host m_host;
URL::Host m_host;
u16 m_port { 0 };
};

View file

@ -216,7 +216,7 @@ void HTMLParser::run(HTMLTokenizer::StopAtInsertionPoint stop_at_insertion_point
flush_character_insertions();
}
void HTMLParser::run(const AK::URL& url, HTMLTokenizer::StopAtInsertionPoint stop_at_insertion_point)
void HTMLParser::run(const URL& url, HTMLTokenizer::StopAtInsertionPoint stop_at_insertion_point)
{
m_document->set_url(url);
m_document->set_source(MUST(String::from_byte_string(m_tokenizer.source())));

View file

@ -54,7 +54,7 @@ public:
static JS::NonnullGCPtr<HTMLParser> create(DOM::Document&, StringView input, ByteString const& encoding);
void run(HTMLTokenizer::StopAtInsertionPoint = HTMLTokenizer::StopAtInsertionPoint::No);
void run(const AK::URL&, HTMLTokenizer::StopAtInsertionPoint = HTMLTokenizer::StopAtInsertionPoint::No);
void run(const URL&, HTMLTokenizer::StopAtInsertionPoint = HTMLTokenizer::StopAtInsertionPoint::No);
static void the_end(JS::NonnullGCPtr<DOM::Document>, JS::GCPtr<HTMLParser> = nullptr);

View file

@ -11,7 +11,7 @@ namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#create-a-potential-cors-request
JS::NonnullGCPtr<Fetch::Infrastructure::Request>
create_potential_CORS_request(JS::VM& vm, AK::URL const& url, Optional<Fetch::Infrastructure::Request::Destination> destination, CORSSettingAttribute cors_attribute_state, SameOriginFallbackFlag same_origin_fallback_flag)
create_potential_CORS_request(JS::VM& vm, URL const& url, Optional<Fetch::Infrastructure::Request::Destination> destination, CORSSettingAttribute cors_attribute_state, SameOriginFallbackFlag same_origin_fallback_flag)
{
// 1. Let mode be "no-cors" if corsAttributeState is No CORS, and "cors" otherwise.
auto mode = cors_attribute_state == CORSSettingAttribute::NoCORS

View file

@ -18,6 +18,6 @@ enum class SameOriginFallbackFlag {
Yes,
};
[[nodiscard]] JS::NonnullGCPtr<Fetch::Infrastructure::Request> create_potential_CORS_request(JS::VM&, const AK::URL&, Optional<Fetch::Infrastructure::Request::Destination>, CORSSettingAttribute, SameOriginFallbackFlag = SameOriginFallbackFlag::No);
[[nodiscard]] JS::NonnullGCPtr<Fetch::Infrastructure::Request> create_potential_CORS_request(JS::VM&, const URL&, Optional<Fetch::Infrastructure::Request::Destination>, CORSSettingAttribute, SameOriginFallbackFlag = SameOriginFallbackFlag::No);
}

View file

@ -18,7 +18,7 @@ namespace Web::HTML {
JS_DEFINE_ALLOCATOR(ClassicScript);
// https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-classic-script
JS::NonnullGCPtr<ClassicScript> ClassicScript::create(ByteString filename, StringView source, EnvironmentSettingsObject& environment_settings_object, AK::URL base_url, size_t source_line_number, MutedErrors muted_errors)
JS::NonnullGCPtr<ClassicScript> ClassicScript::create(ByteString filename, StringView source, EnvironmentSettingsObject& environment_settings_object, URL base_url, size_t source_line_number, MutedErrors muted_errors)
{
auto& vm = environment_settings_object.realm().vm();
@ -147,7 +147,7 @@ JS::Completion ClassicScript::run(RethrowErrors rethrow_errors, JS::GCPtr<JS::En
// Return Completion { [[Type]]: throw, [[Value]]: a new "QuotaExceededError" DOMException, [[Target]]: empty }.
}
ClassicScript::ClassicScript(AK::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object)
ClassicScript::ClassicScript(URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object)
: Script(move(base_url), move(filename), environment_settings_object)
{
}

View file

@ -24,7 +24,7 @@ public:
No,
Yes,
};
static JS::NonnullGCPtr<ClassicScript> create(ByteString filename, StringView source, EnvironmentSettingsObject&, AK::URL base_url, size_t source_line_number = 1, MutedErrors = MutedErrors::No);
static JS::NonnullGCPtr<ClassicScript> create(ByteString filename, StringView source, EnvironmentSettingsObject&, URL base_url, size_t source_line_number = 1, MutedErrors = MutedErrors::No);
JS::Script* script_record() { return m_script_record; }
JS::Script const* script_record() const { return m_script_record; }
@ -38,7 +38,7 @@ public:
MutedErrors muted_errors() const { return m_muted_errors; }
private:
ClassicScript(AK::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object);
ClassicScript(URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object);
virtual void visit_edges(Cell::Visitor&) override;

View file

@ -161,7 +161,7 @@ void EnvironmentSettingsObject::prepare_to_run_callback()
}
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#parse-a-url
AK::URL EnvironmentSettingsObject::parse_url(StringView url)
URL EnvironmentSettingsObject::parse_url(StringView url)
{
// 1. Let encoding be document's character encoding, if document was given, and environment settings object's API URL character encoding otherwise.
// FIXME: Pass in environment settings object's API URL character encoding.

View file

@ -23,10 +23,10 @@ struct Environment {
String id;
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-creation-url
AK::URL creation_url;
URL creation_url;
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-top-level-creation-url
AK::URL top_level_creation_url;
URL top_level_creation_url;
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-top-level-origin
Origin top_level_origin;
@ -72,7 +72,7 @@ struct EnvironmentSettingsObject
virtual String api_url_character_encoding() = 0;
// https://html.spec.whatwg.org/multipage/webappapis.html#api-base-url
virtual AK::URL api_base_url() = 0;
virtual URL api_base_url() = 0;
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin
virtual Origin origin() = 0;
@ -83,7 +83,7 @@ struct EnvironmentSettingsObject
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-cross-origin-isolated-capability
virtual CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() = 0;
AK::URL parse_url(StringView);
URL parse_url(StringView);
JS::Realm& realm();
JS::Object& global_object();

View file

@ -77,11 +77,11 @@ ByteString module_type_from_module_request(JS::ModuleRequest const& module_reque
}
// https://html.spec.whatwg.org/multipage/webappapis.html#resolve-a-module-specifier
WebIDL::ExceptionOr<AK::URL> resolve_module_specifier(Optional<Script&> referring_script, ByteString const& specifier)
WebIDL::ExceptionOr<URL> resolve_module_specifier(Optional<Script&> referring_script, ByteString const& specifier)
{
// 1. Let settingsObject and baseURL be null.
Optional<EnvironmentSettingsObject&> settings_object;
Optional<AK::URL const&> base_url;
Optional<URL const&> base_url;
// 2. If referringScript is not null, then:
if (referring_script.has_value()) {
@ -153,7 +153,7 @@ WebIDL::ExceptionOr<AK::URL> resolve_module_specifier(Optional<Script&> referrin
}
// https://html.spec.whatwg.org/multipage/webappapis.html#resolving-an-imports-match
WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(ByteString const& normalized_specifier, Optional<AK::URL> as_url, ModuleSpecifierMap const& specifier_map)
WebIDL::ExceptionOr<Optional<URL>> resolve_imports_match(ByteString const& normalized_specifier, Optional<URL> as_url, ModuleSpecifierMap const& specifier_map)
{
// 1. For each specifierKey → resolutionResult of specifierMap:
for (auto const& [specifier_key, resolution_result] : specifier_map) {
@ -216,11 +216,11 @@ WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(ByteString const& n
}
// 2. Return null.
return Optional<AK::URL> {};
return Optional<URL> {};
}
// https://html.spec.whatwg.org/multipage/webappapis.html#resolving-a-url-like-module-specifier
Optional<AK::URL> resolve_url_like_module_specifier(ByteString const& specifier, AK::URL const& base_url)
Optional<URL> resolve_url_like_module_specifier(ByteString const& specifier, URL const& base_url)
{
// 1. If specifier starts with "/", "./", or "../", then:
if (specifier.starts_with("/"sv) || specifier.starts_with("./"sv) || specifier.starts_with("../"sv)) {
@ -277,7 +277,7 @@ static void set_up_module_script_request(Fetch::Infrastructure::Request& request
}
// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-script
WebIDL::ExceptionOr<void> fetch_classic_script(JS::NonnullGCPtr<HTMLScriptElement> element, AK::URL const& url, EnvironmentSettingsObject& settings_object, ScriptFetchOptions options, CORSSettingAttribute cors_setting, String character_encoding, OnFetchScriptComplete on_complete)
WebIDL::ExceptionOr<void> fetch_classic_script(JS::NonnullGCPtr<HTMLScriptElement> element, URL const& url, EnvironmentSettingsObject& settings_object, ScriptFetchOptions options, CORSSettingAttribute cors_setting, String character_encoding, OnFetchScriptComplete on_complete)
{
auto& realm = element->realm();
auto& vm = realm.vm();
@ -342,7 +342,7 @@ WebIDL::ExceptionOr<void> fetch_classic_script(JS::NonnullGCPtr<HTMLScriptElemen
}
// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-worker-script
WebIDL::ExceptionOr<void> fetch_classic_worker_script(AK::URL const& url, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination destination, EnvironmentSettingsObject& settings_object, PerformTheFetchHook perform_fetch, OnFetchScriptComplete on_complete)
WebIDL::ExceptionOr<void> fetch_classic_worker_script(URL const& url, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination destination, EnvironmentSettingsObject& settings_object, PerformTheFetchHook perform_fetch, OnFetchScriptComplete on_complete)
{
auto& realm = settings_object.realm();
auto& vm = realm.vm();
@ -551,7 +551,7 @@ void fetch_descendants_of_a_module_script(JS::Realm& realm, JavaScriptModuleScri
// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script
void fetch_single_module_script(JS::Realm& realm,
AK::URL const& url,
URL const& url,
EnvironmentSettingsObject& fetch_client,
Fetch::Infrastructure::Request::Destination destination,
ScriptFetchOptions const& options,
@ -666,7 +666,7 @@ void fetch_single_module_script(JS::Realm& realm,
}
// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-script-tree
void fetch_external_module_script_graph(JS::Realm& realm, AK::URL const& url, EnvironmentSettingsObject& settings_object, ScriptFetchOptions const& options, OnFetchScriptComplete on_complete)
void fetch_external_module_script_graph(JS::Realm& realm, URL const& url, EnvironmentSettingsObject& settings_object, ScriptFetchOptions const& options, OnFetchScriptComplete on_complete)
{
// 1. Disallow further import maps given settingsObject.
settings_object.disallow_further_import_maps();
@ -688,7 +688,7 @@ void fetch_external_module_script_graph(JS::Realm& realm, AK::URL const& url, En
}
// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-an-inline-module-script-graph
void fetch_inline_module_script_graph(JS::Realm& realm, ByteString const& filename, ByteString const& source_text, AK::URL const& base_url, EnvironmentSettingsObject& settings_object, OnFetchScriptComplete on_complete)
void fetch_inline_module_script_graph(JS::Realm& realm, ByteString const& filename, ByteString const& source_text, URL const& base_url, EnvironmentSettingsObject& settings_object, OnFetchScriptComplete on_complete)
{
// 1. Disallow further import maps given settingsObject.
settings_object.disallow_further_import_maps();
@ -708,7 +708,7 @@ void fetch_inline_module_script_graph(JS::Realm& realm, ByteString const& filena
// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-imported-module-script
void fetch_single_imported_module_script(JS::Realm& realm,
AK::URL const& url,
URL const& url,
EnvironmentSettingsObject& fetch_client,
Fetch::Infrastructure::Request::Destination destination,
ScriptFetchOptions const& options,

View file

@ -82,16 +82,16 @@ private:
};
ByteString module_type_from_module_request(JS::ModuleRequest const&);
WebIDL::ExceptionOr<AK::URL> resolve_module_specifier(Optional<Script&> referring_script, ByteString const& specifier);
WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(ByteString const& normalized_specifier, Optional<AK::URL> as_url, ModuleSpecifierMap const&);
Optional<AK::URL> resolve_url_like_module_specifier(ByteString const& specifier, AK::URL const& base_url);
WebIDL::ExceptionOr<URL> resolve_module_specifier(Optional<Script&> referring_script, ByteString const& specifier);
WebIDL::ExceptionOr<Optional<URL>> resolve_imports_match(ByteString const& normalized_specifier, Optional<URL> as_url, ModuleSpecifierMap const&);
Optional<URL> resolve_url_like_module_specifier(ByteString const& specifier, URL const& base_url);
WebIDL::ExceptionOr<void> fetch_classic_script(JS::NonnullGCPtr<HTMLScriptElement>, AK::URL const&, EnvironmentSettingsObject& settings_object, ScriptFetchOptions options, CORSSettingAttribute cors_setting, String character_encoding, OnFetchScriptComplete on_complete);
WebIDL::ExceptionOr<void> fetch_classic_worker_script(AK::URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, EnvironmentSettingsObject& settings_object, PerformTheFetchHook, OnFetchScriptComplete);
WebIDL::ExceptionOr<void> fetch_classic_script(JS::NonnullGCPtr<HTMLScriptElement>, URL const&, EnvironmentSettingsObject& settings_object, ScriptFetchOptions options, CORSSettingAttribute cors_setting, String character_encoding, OnFetchScriptComplete on_complete);
WebIDL::ExceptionOr<void> fetch_classic_worker_script(URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, EnvironmentSettingsObject& settings_object, PerformTheFetchHook, OnFetchScriptComplete);
void fetch_internal_module_script_graph(JS::Realm&, JS::ModuleRequest const& module_request, EnvironmentSettingsObject& fetch_client_settings_object, Fetch::Infrastructure::Request::Destination, ScriptFetchOptions const&, Script& referring_script, HashTable<ModuleLocationTuple> const& visited_set, OnFetchScriptComplete on_complete);
void fetch_external_module_script_graph(JS::Realm&, AK::URL const&, EnvironmentSettingsObject& settings_object, ScriptFetchOptions const&, OnFetchScriptComplete on_complete);
void fetch_inline_module_script_graph(JS::Realm&, ByteString const& filename, ByteString const& source_text, AK::URL const& base_url, EnvironmentSettingsObject& settings_object, OnFetchScriptComplete on_complete);
void fetch_single_imported_module_script(JS::Realm&, AK::URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, ScriptFetchOptions const&, EnvironmentSettingsObject& settings_object, Fetch::Infrastructure::Request::Referrer, JS::ModuleRequest const&, OnFetchScriptComplete on_complete);
void fetch_external_module_script_graph(JS::Realm&, URL const&, EnvironmentSettingsObject& settings_object, ScriptFetchOptions const&, OnFetchScriptComplete on_complete);
void fetch_inline_module_script_graph(JS::Realm&, ByteString const& filename, ByteString const& source_text, URL const& base_url, EnvironmentSettingsObject& settings_object, OnFetchScriptComplete on_complete);
void fetch_single_imported_module_script(JS::Realm&, URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, ScriptFetchOptions const&, EnvironmentSettingsObject& settings_object, Fetch::Infrastructure::Request::Referrer, JS::ModuleRequest const&, OnFetchScriptComplete on_complete);
void fetch_descendants_of_a_module_script(JS::Realm&, JavaScriptModuleScript& module_script, EnvironmentSettingsObject& fetch_client_settings_object, Fetch::Infrastructure::Request::Destination, HashTable<ModuleLocationTuple> visited_set, OnFetchScriptComplete callback);
void fetch_descendants_of_and_link_a_module_script(JS::Realm&, JavaScriptModuleScript&, EnvironmentSettingsObject&, Fetch::Infrastructure::Request::Destination, OnFetchScriptComplete on_complete);
@ -101,6 +101,6 @@ enum class TopLevelModule {
No
};
void fetch_single_module_script(JS::Realm&, AK::URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, ScriptFetchOptions const&, EnvironmentSettingsObject& settings_object, Web::Fetch::Infrastructure::Request::ReferrerType const&, Optional<JS::ModuleRequest> const&, TopLevelModule, OnFetchScriptComplete callback);
void fetch_single_module_script(JS::Realm&, URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, ScriptFetchOptions const&, EnvironmentSettingsObject& settings_object, Web::Fetch::Infrastructure::Request::ReferrerType const&, Optional<JS::ModuleRequest> const&, TopLevelModule, OnFetchScriptComplete callback);
}

View file

@ -10,7 +10,7 @@
namespace Web::HTML {
using ModuleSpecifierMap = HashMap<ByteString, Optional<AK::URL>>;
using ModuleSpecifierMap = HashMap<ByteString, Optional<URL>>;
// https://html.spec.whatwg.org/multipage/webappapis.html#import-map
class ImportMap {
@ -20,12 +20,12 @@ public:
ModuleSpecifierMap const& imports() const { return m_imports; }
ModuleSpecifierMap& imports() { return m_imports; }
HashMap<AK::URL, ModuleSpecifierMap> const& scopes() const { return m_scopes; }
HashMap<AK::URL, ModuleSpecifierMap>& scopes() { return m_scopes; }
HashMap<URL, ModuleSpecifierMap> const& scopes() const { return m_scopes; }
HashMap<URL, ModuleSpecifierMap>& scopes() { return m_scopes; }
private:
ModuleSpecifierMap m_imports;
HashMap<AK::URL, ModuleSpecifierMap> m_scopes;
HashMap<URL, ModuleSpecifierMap> m_scopes;
};
}

View file

@ -21,17 +21,17 @@ void ModuleMap::visit_edges(Visitor& visitor)
visitor.visit(callback);
}
bool ModuleMap::is_fetching(AK::URL const& url, ByteString const& type) const
bool ModuleMap::is_fetching(URL const& url, ByteString const& type) const
{
return is(url, type, EntryType::Fetching);
}
bool ModuleMap::is_failed(AK::URL const& url, ByteString const& type) const
bool ModuleMap::is_failed(URL const& url, ByteString const& type) const
{
return is(url, type, EntryType::Failed);
}
bool ModuleMap::is(AK::URL const& url, ByteString const& type, EntryType entry_type) const
bool ModuleMap::is(URL const& url, ByteString const& type, EntryType entry_type) const
{
auto value = m_values.get({ url, type });
if (!value.has_value())
@ -40,12 +40,12 @@ bool ModuleMap::is(AK::URL const& url, ByteString const& type, EntryType entry_t
return value->type == entry_type;
}
Optional<ModuleMap::Entry> ModuleMap::get(AK::URL const& url, ByteString const& type) const
Optional<ModuleMap::Entry> ModuleMap::get(URL const& url, ByteString const& type) const
{
return m_values.get({ url, type });
}
AK::HashSetResult ModuleMap::set(AK::URL const& url, ByteString const& type, Entry entry)
AK::HashSetResult ModuleMap::set(URL const& url, ByteString const& type, Entry entry)
{
// NOTE: Re-entering this function while firing wait_for_change callbacks is not allowed.
VERIFY(!m_firing_callbacks);
@ -63,7 +63,7 @@ AK::HashSetResult ModuleMap::set(AK::URL const& url, ByteString const& type, Ent
return value;
}
void ModuleMap::wait_for_change(JS::Heap& heap, AK::URL const& url, ByteString const& type, Function<void(Entry)> callback)
void ModuleMap::wait_for_change(JS::Heap& heap, URL const& url, ByteString const& type, Function<void(Entry)> callback)
{
m_callbacks.ensure({ url, type }).append(JS::create_heap_function(heap, move(callback)));
}

View file

@ -15,13 +15,13 @@ namespace Web::HTML {
class ModuleLocationTuple {
public:
ModuleLocationTuple(AK::URL url, ByteString type)
ModuleLocationTuple(URL url, ByteString type)
: m_url(move(url))
, m_type(move(type))
{
}
AK::URL const& url() const { return m_url; }
URL const& url() const { return m_url; }
ByteString const& type() const { return m_type; }
bool operator==(ModuleLocationTuple const& other) const
@ -30,7 +30,7 @@ public:
}
private:
AK::URL m_url;
URL m_url;
ByteString m_type;
};
@ -56,16 +56,16 @@ public:
using CallbackFunction = JS::NonnullGCPtr<JS::HeapFunction<void(Entry)>>;
bool is_fetching(AK::URL const& url, ByteString const& type) const;
bool is_failed(AK::URL const& url, ByteString const& type) const;
bool is_fetching(URL const& url, ByteString const& type) const;
bool is_failed(URL const& url, ByteString const& type) const;
bool is(AK::URL const& url, ByteString const& type, EntryType) const;
bool is(URL const& url, ByteString const& type, EntryType) const;
Optional<Entry> get(AK::URL const& url, ByteString const& type) const;
Optional<Entry> get(URL const& url, ByteString const& type) const;
AK::HashSetResult set(AK::URL const& url, ByteString const& type, Entry);
AK::HashSetResult set(URL const& url, ByteString const& type, Entry);
void wait_for_change(JS::Heap&, AK::URL const& url, ByteString const& type, Function<void(Entry)> callback);
void wait_for_change(JS::Heap&, URL const& url, ByteString const& type, Function<void(Entry)> callback);
private:
virtual void visit_edges(JS::Cell::Visitor&) override;

View file

@ -17,20 +17,20 @@ JS_DEFINE_ALLOCATOR(JavaScriptModuleScript);
ModuleScript::~ModuleScript() = default;
ModuleScript::ModuleScript(AK::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object)
ModuleScript::ModuleScript(URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object)
: Script(move(base_url), move(filename), environment_settings_object)
{
}
JavaScriptModuleScript::~JavaScriptModuleScript() = default;
JavaScriptModuleScript::JavaScriptModuleScript(AK::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object)
JavaScriptModuleScript::JavaScriptModuleScript(URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object)
: ModuleScript(move(base_url), move(filename), environment_settings_object)
{
}
// https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-javascript-module-script
WebIDL::ExceptionOr<JS::GCPtr<JavaScriptModuleScript>> JavaScriptModuleScript::create(ByteString const& filename, StringView source, EnvironmentSettingsObject& settings_object, AK::URL base_url)
WebIDL::ExceptionOr<JS::GCPtr<JavaScriptModuleScript>> JavaScriptModuleScript::create(ByteString const& filename, StringView source, EnvironmentSettingsObject& settings_object, URL base_url)
{
// 1. If scripting is disabled for settings, then set source to the empty string.
if (settings_object.is_scripting_disabled())

View file

@ -19,7 +19,7 @@ public:
virtual ~ModuleScript() override;
protected:
ModuleScript(AK::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object);
ModuleScript(URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object);
};
class JavaScriptModuleScript final : public ModuleScript {
@ -29,7 +29,7 @@ class JavaScriptModuleScript final : public ModuleScript {
public:
virtual ~JavaScriptModuleScript() override;
static WebIDL::ExceptionOr<JS::GCPtr<JavaScriptModuleScript>> create(ByteString const& filename, StringView source, EnvironmentSettingsObject&, AK::URL base_url);
static WebIDL::ExceptionOr<JS::GCPtr<JavaScriptModuleScript>> create(ByteString const& filename, StringView source, EnvironmentSettingsObject&, URL base_url);
enum class PreventErrorReporting {
Yes,
@ -42,7 +42,7 @@ public:
JS::SourceTextModule* record() { return m_record.ptr(); }
protected:
JavaScriptModuleScript(AK::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object);
JavaScriptModuleScript(URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object);
private:
virtual void visit_edges(JS::Cell::Visitor&) override;

View file

@ -11,7 +11,7 @@ namespace Web::HTML {
JS_DEFINE_ALLOCATOR(Script);
Script::Script(AK::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object)
Script::Script(URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object)
: m_base_url(move(base_url))
, m_filename(move(filename))
, m_settings_object(environment_settings_object)

View file

@ -23,7 +23,7 @@ class Script
public:
virtual ~Script() override;
AK::URL const& base_url() const { return m_base_url; }
URL const& base_url() const { return m_base_url; }
ByteString const& filename() const { return m_filename; }
EnvironmentSettingsObject& settings_object() { return m_settings_object; }
@ -35,14 +35,14 @@ public:
void set_parse_error(JS::Value value) { m_parse_error = value; }
protected:
Script(AK::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object);
Script(URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object);
virtual void visit_edges(Visitor&) override;
private:
virtual void visit_host_defined_self(JS::Cell::Visitor&) override;
AK::URL m_base_url;
URL m_base_url;
ByteString m_filename;
JS::NonnullGCPtr<EnvironmentSettingsObject> m_settings_object;

View file

@ -29,7 +29,7 @@ void WindowEnvironmentSettingsObject::visit_edges(JS::Cell::Visitor& visitor)
}
// https://html.spec.whatwg.org/multipage/window-object.html#set-up-a-window-environment-settings-object
void WindowEnvironmentSettingsObject::setup(Page& page, AK::URL const& creation_url, NonnullOwnPtr<JS::ExecutionContext> execution_context, Optional<Environment> reserved_environment, AK::URL top_level_creation_url, Origin top_level_origin)
void WindowEnvironmentSettingsObject::setup(Page& page, URL const& creation_url, NonnullOwnPtr<JS::ExecutionContext> execution_context, Optional<Environment> reserved_environment, URL top_level_creation_url, Origin top_level_origin)
{
// 1. Let realm be the value of execution context's Realm component.
auto realm = execution_context->realm;
@ -97,7 +97,7 @@ String WindowEnvironmentSettingsObject::api_url_character_encoding()
}
// https://html.spec.whatwg.org/multipage/window-object.html#script-settings-for-window-objects:api-base-url
AK::URL WindowEnvironmentSettingsObject::api_base_url()
URL WindowEnvironmentSettingsObject::api_base_url()
{
// Return the current base URL of window's associated Document.
return m_window->associated_document().base_url();

View file

@ -16,13 +16,13 @@ class WindowEnvironmentSettingsObject final : public EnvironmentSettingsObject {
JS_DECLARE_ALLOCATOR(WindowEnvironmentSettingsObject);
public:
static void setup(Page&, AK::URL const& creation_url, NonnullOwnPtr<JS::ExecutionContext>, Optional<Environment>, AK::URL top_level_creation_url, Origin top_level_origin);
static void setup(Page&, URL const& creation_url, NonnullOwnPtr<JS::ExecutionContext>, Optional<Environment>, URL top_level_creation_url, Origin top_level_origin);
virtual ~WindowEnvironmentSettingsObject() override;
virtual JS::GCPtr<DOM::Document> responsible_document() override;
virtual String api_url_character_encoding() override;
virtual AK::URL api_base_url() override;
virtual URL api_base_url() override;
virtual Origin origin() override;
virtual PolicyContainer policy_container() override;
virtual CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override;

View file

@ -30,7 +30,7 @@ public:
JS::GCPtr<DOM::Document> responsible_document() override { return nullptr; }
String api_url_character_encoding() override { return m_api_url_character_encoding; }
AK::URL api_base_url() override { return m_url; }
URL api_base_url() override { return m_url; }
Origin origin() override { return m_origin; }
PolicyContainer policy_container() override { return m_policy_container; }
CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override { return CanUseCrossOriginIsolatedAPIs::No; }
@ -39,7 +39,7 @@ private:
virtual void visit_edges(JS::Cell::Visitor&) override;
String m_api_url_character_encoding;
AK::URL m_url;
URL m_url;
HTML::Origin m_origin;
HTML::PolicyContainer m_policy_container;

View file

@ -46,7 +46,7 @@ struct SessionHistoryEntry final : public JS::Cell {
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#she-url
// URL, a URL
AK::URL url;
URL url;
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#she-document-state
JS::GCPtr<HTML::DocumentState> document_state;

View file

@ -21,7 +21,7 @@ namespace Web::HTML {
JS_DEFINE_ALLOCATOR(SharedImageRequest);
JS::NonnullGCPtr<SharedImageRequest> SharedImageRequest::get_or_create(JS::Realm& realm, JS::NonnullGCPtr<Page> page, AK::URL const& url)
JS::NonnullGCPtr<SharedImageRequest> SharedImageRequest::get_or_create(JS::Realm& realm, JS::NonnullGCPtr<Page> page, URL const& url)
{
auto document = Bindings::host_defined_environment_settings_object(realm).responsible_document();
VERIFY(document);
@ -33,7 +33,7 @@ JS::NonnullGCPtr<SharedImageRequest> SharedImageRequest::get_or_create(JS::Realm
return request;
}
SharedImageRequest::SharedImageRequest(JS::NonnullGCPtr<Page> page, AK::URL url, JS::NonnullGCPtr<DOM::Document> document)
SharedImageRequest::SharedImageRequest(JS::NonnullGCPtr<Page> page, URL url, JS::NonnullGCPtr<DOM::Document> document)
: m_page(page)
, m_url(move(url))
, m_document(document)
@ -134,7 +134,7 @@ void SharedImageRequest::add_callbacks(Function<void()> on_finish, Function<void
m_callbacks.append(move(callbacks));
}
void SharedImageRequest::handle_successful_fetch(AK::URL const& url_string, StringView mime_type, ByteBuffer data)
void SharedImageRequest::handle_successful_fetch(URL const& url_string, StringView mime_type, ByteBuffer data)
{
// AD-HOC: At this point, things gets very ad-hoc.
// FIXME: Bring this closer to spec.

View file

@ -22,11 +22,11 @@ class SharedImageRequest final : public JS::Cell {
JS_DECLARE_ALLOCATOR(SharedImageRequest);
public:
[[nodiscard]] static JS::NonnullGCPtr<SharedImageRequest> get_or_create(JS::Realm&, JS::NonnullGCPtr<Page>, AK::URL const&);
[[nodiscard]] static JS::NonnullGCPtr<SharedImageRequest> get_or_create(JS::Realm&, JS::NonnullGCPtr<Page>, URL const&);
virtual ~SharedImageRequest() override;
AK::URL const& url() const { return m_url; }
URL const& url() const { return m_url; }
[[nodiscard]] JS::GCPtr<DecodedImageData> image_data() const;
@ -41,12 +41,12 @@ public:
bool needs_fetching() const;
private:
explicit SharedImageRequest(JS::NonnullGCPtr<Page>, AK::URL, JS::NonnullGCPtr<DOM::Document>);
explicit SharedImageRequest(JS::NonnullGCPtr<Page>, URL, JS::NonnullGCPtr<DOM::Document>);
virtual void finalize() override;
virtual void visit_edges(JS::Cell::Visitor&) override;
void handle_successful_fetch(AK::URL const&, StringView mime_type, ByteBuffer data);
void handle_successful_fetch(URL const&, StringView mime_type, ByteBuffer data);
void handle_failed_fetch();
enum class State {
@ -66,7 +66,7 @@ private:
};
Vector<Callbacks> m_callbacks;
AK::URL m_url;
URL m_url;
JS::GCPtr<DecodedImageData> m_image_data;
JS::GCPtr<Fetch::Infrastructure::FetchController> m_fetch_controller;

View file

@ -115,7 +115,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<TraversableNavigable>> TraversableNavigable
}
// https://html.spec.whatwg.org/multipage/document-sequences.html#create-a-fresh-top-level-traversable
WebIDL::ExceptionOr<JS::NonnullGCPtr<TraversableNavigable>> TraversableNavigable::create_a_fresh_top_level_traversable(JS::NonnullGCPtr<Page> page, AK::URL const& initial_navigation_url, Variant<Empty, String, POSTResource> initial_navigation_post_resource)
WebIDL::ExceptionOr<JS::NonnullGCPtr<TraversableNavigable>> TraversableNavigable::create_a_fresh_top_level_traversable(JS::NonnullGCPtr<Page> page, URL const& initial_navigation_url, Variant<Empty, String, POSTResource> initial_navigation_post_resource)
{
// 1. Let traversable be the result of creating a new top-level traversable given null and the empty string.
auto traversable = TRY(create_a_new_top_level_traversable(page, nullptr, {}));

View file

@ -20,7 +20,7 @@ class TraversableNavigable final : public Navigable {
public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<TraversableNavigable>> create_a_new_top_level_traversable(JS::NonnullGCPtr<Page>, JS::GCPtr<BrowsingContext> opener, String target_name);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<TraversableNavigable>> create_a_fresh_top_level_traversable(JS::NonnullGCPtr<Page>, AK::URL const& initial_navigation_url, Variant<Empty, String, POSTResource> = Empty {});
static WebIDL::ExceptionOr<JS::NonnullGCPtr<TraversableNavigable>> create_a_fresh_top_level_traversable(JS::NonnullGCPtr<Page>, URL const& initial_navigation_url, Variant<Empty, String, POSTResource> = Empty {});
virtual ~TraversableNavigable() override;

View file

@ -386,7 +386,7 @@ WebIDL::ExceptionOr<JS::GCPtr<WindowProxy>> Window::open_impl(StringView url, St
// NOTE: While this is not implemented yet, all of observable actions taken by this operation are optional (implementation-defined).
// 3. Let urlRecord be the URL record about:blank.
auto url_record = AK::URL("about:blank"sv);
auto url_record = URL("about:blank"sv);
// 4. If url is not the empty string, then set urlRecord to the result of encoding-parsing a URL given url, relative to the entry settings object.
if (!url.is_empty()) {

View file

@ -89,7 +89,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Worker>> Worker::create(String const& scrip
}
// https://html.spec.whatwg.org/multipage/workers.html#run-a-worker
void Worker::run_a_worker(AK::URL& url, EnvironmentSettingsObject& outside_settings, JS::GCPtr<MessagePort> port, WorkerOptions const& options)
void Worker::run_a_worker(URL& url, EnvironmentSettingsObject& outside_settings, JS::GCPtr<MessagePort> port, WorkerOptions const& options)
{
// 1. Let is shared be true if worker is a SharedWorker object, and false otherwise.
// FIXME: SharedWorker support

View file

@ -69,7 +69,7 @@ private:
JS::GCPtr<WorkerAgent> m_agent;
void run_a_worker(AK::URL& url, EnvironmentSettingsObject& outside_settings, JS::GCPtr<MessagePort> outside_port, WorkerOptions const& options);
void run_a_worker(URL& url, EnvironmentSettingsObject& outside_settings, JS::GCPtr<MessagePort> outside_port, WorkerOptions const& options);
};
}

View file

@ -13,7 +13,7 @@ namespace Web::HTML {
JS_DEFINE_ALLOCATOR(WorkerAgent);
WorkerAgent::WorkerAgent(AK::URL url, WorkerOptions const& options, JS::GCPtr<MessagePort> outside_port)
WorkerAgent::WorkerAgent(URL url, WorkerOptions const& options, JS::GCPtr<MessagePort> outside_port)
: m_worker_options(options)
, m_url(move(url))
, m_outside_port(outside_port)

View file

@ -22,14 +22,14 @@ class WorkerAgent : public JS::Cell {
JS_CELL(Agent, JS::Cell);
JS_DECLARE_ALLOCATOR(WorkerAgent);
WorkerAgent(AK::URL url, WorkerOptions const& options, JS::GCPtr<MessagePort> outside_port);
WorkerAgent(URL url, WorkerOptions const& options, JS::GCPtr<MessagePort> outside_port);
private:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
WorkerOptions m_worker_options;
AK::URL m_url;
URL m_url;
JS::GCPtr<MessagePort> m_message_port;
JS::GCPtr<MessagePort> m_outside_port;

View file

@ -77,8 +77,8 @@ public:
// Non-IDL public methods
AK::URL const& url() const { return m_url.value(); }
void set_url(AK::URL const& url) { m_url = url; }
URL const& url() const { return m_url.value(); }
void set_url(URL const& url) { m_url = url; }
// Spec note: While the WorkerLocation object is created after the WorkerGlobalScope object,
// this is not problematic as it cannot be observed from script.
@ -114,7 +114,7 @@ private:
// https://html.spec.whatwg.org/multipage/workers.html#concept-workerglobalscope-url
// A WorkerGlobalScope object has an associated url (null or a URL). It is initially null.
Optional<AK::URL> m_url;
Optional<URL> m_url;
// https://html.spec.whatwg.org/multipage/workers.html#concept-workerglobalscope-name
// A WorkerGlobalScope object has an associated name (a string). It is set during creation.