mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 06:04:57 +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:
parent
f9e5b43b7a
commit
9ce8189f21
156 changed files with 471 additions and 471 deletions
|
@ -35,7 +35,7 @@ WebViewImplementationNative::WebViewImplementationNative(jobject thiz)
|
|||
env.get()->CallVoidMethod(m_java_instance, invalidate_layout_method);
|
||||
};
|
||||
|
||||
on_load_start = [this](AK::URL const& url, bool is_redirect) {
|
||||
on_load_start = [this](URL const& url, bool is_redirect) {
|
||||
JavaEnvironment env(global_vm);
|
||||
auto url_string = env.jstring_from_ak_string(MUST(url.to_string()));
|
||||
env.get()->CallVoidMethod(m_java_instance, on_load_start_method, url_string, is_redirect);
|
||||
|
|
|
@ -82,7 +82,7 @@ Java_org_serenityos_ladybird_WebViewImplementation_nativeLoadURL(JNIEnv* env, jo
|
|||
{
|
||||
auto* impl = reinterpret_cast<WebViewImplementationNative*>(instance);
|
||||
char const* raw_url = env->GetStringUTFChars(url, nullptr);
|
||||
auto ak_url = AK::URL::create_with_url_or_path(StringView { raw_url, strlen(raw_url) });
|
||||
auto ak_url = URL::create_with_url_or_path(StringView { raw_url, strlen(raw_url) });
|
||||
env->ReleaseStringUTFChars(url, raw_url);
|
||||
impl->load(ak_url);
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ ErrorOr<void> AutoComplete::got_network_response(QNetworkReply* reply)
|
|||
String AutoComplete::auto_complete_url_from_query(StringView query)
|
||||
{
|
||||
auto autocomplete_engine = ak_string_from_qstring(Settings::the()->autocomplete_engine().url);
|
||||
return MUST(autocomplete_engine.replace("{}"sv, AK::URL::percent_encode(query), ReplaceMode::FirstOnly));
|
||||
return MUST(autocomplete_engine.replace("{}"sv, URL::percent_encode(query), ReplaceMode::FirstOnly));
|
||||
}
|
||||
|
||||
void AutoComplete::clear_suggestions()
|
||||
|
|
|
@ -471,7 +471,7 @@ void BrowserWindow::debug_request(ByteString const& request, ByteString const& a
|
|||
m_current_tab->debug_request(request, argument);
|
||||
}
|
||||
|
||||
Tab& BrowserWindow::new_tab_from_url(AK::URL const& url, Web::HTML::ActivateTab activate_tab)
|
||||
Tab& BrowserWindow::new_tab_from_url(URL const& url, Web::HTML::ActivateTab activate_tab)
|
||||
{
|
||||
auto& tab = create_new_tab(activate_tab);
|
||||
tab.navigate(url);
|
||||
|
|
|
@ -73,7 +73,7 @@ public slots:
|
|||
void device_pixel_ratio_changed(qreal dpi);
|
||||
void tab_title_changed(int index, QString const&);
|
||||
void tab_favicon_changed(int index, QIcon const& icon);
|
||||
Tab& new_tab_from_url(AK::URL const&, Web::HTML::ActivateTab);
|
||||
Tab& new_tab_from_url(URL const&, Web::HTML::ActivateTab);
|
||||
Tab& new_tab_from_content(StringView html, Web::HTML::ActivateTab);
|
||||
Tab& new_child_tab(Web::HTML::ActivateTab, Tab& parent, Web::HTML::WebViewHints, Optional<u64> page_index);
|
||||
void activate_tab(int index);
|
||||
|
|
|
@ -24,7 +24,7 @@ void RequestManagerQt::reply_finished(QNetworkReply* reply)
|
|||
request->did_finish();
|
||||
}
|
||||
|
||||
RefPtr<Web::ResourceLoaderConnectorRequest> RequestManagerQt::start_request(ByteString const& method, AK::URL const& url, HashMap<ByteString, ByteString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const& proxy)
|
||||
RefPtr<Web::ResourceLoaderConnectorRequest> RequestManagerQt::start_request(ByteString const& method, URL const& url, HashMap<ByteString, ByteString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const& proxy)
|
||||
{
|
||||
if (!url.scheme().bytes_as_string_view().is_one_of_ignoring_ascii_case("http"sv, "https"sv)) {
|
||||
return nullptr;
|
||||
|
@ -38,7 +38,7 @@ RefPtr<Web::ResourceLoaderConnectorRequest> RequestManagerQt::start_request(Byte
|
|||
return request;
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<RequestManagerQt::Request>> RequestManagerQt::Request::create(QNetworkAccessManager& qnam, ByteString const& method, AK::URL const& url, HashMap<ByteString, ByteString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&)
|
||||
ErrorOr<NonnullRefPtr<RequestManagerQt::Request>> RequestManagerQt::Request::create(QNetworkAccessManager& qnam, ByteString const& method, URL const& url, HashMap<ByteString, ByteString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&)
|
||||
{
|
||||
QNetworkRequest request { QString(url.to_byte_string().characters()) };
|
||||
request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy);
|
||||
|
|
|
@ -24,10 +24,10 @@ public:
|
|||
|
||||
virtual ~RequestManagerQt() override { }
|
||||
|
||||
virtual void prefetch_dns(AK::URL const&) override { }
|
||||
virtual void preconnect(AK::URL const&) override { }
|
||||
virtual void prefetch_dns(URL const&) override { }
|
||||
virtual void preconnect(URL const&) override { }
|
||||
|
||||
virtual RefPtr<Web::ResourceLoaderConnectorRequest> start_request(ByteString const& method, AK::URL const&, HashMap<ByteString, ByteString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&) override;
|
||||
virtual RefPtr<Web::ResourceLoaderConnectorRequest> start_request(ByteString const& method, URL const&, HashMap<ByteString, ByteString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&) override;
|
||||
|
||||
private slots:
|
||||
void reply_finished(QNetworkReply*);
|
||||
|
@ -38,7 +38,7 @@ private:
|
|||
class Request
|
||||
: public Web::ResourceLoaderConnectorRequest {
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<Request>> create(QNetworkAccessManager& qnam, ByteString const& method, AK::URL const& url, HashMap<ByteString, ByteString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&);
|
||||
static ErrorOr<NonnullRefPtr<Request>> create(QNetworkAccessManager& qnam, ByteString const& method, URL const& url, HashMap<ByteString, ByteString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&);
|
||||
|
||||
virtual ~Request() override;
|
||||
|
||||
|
|
|
@ -23,13 +23,13 @@ QString qstring_from_ak_string(StringView ak_string)
|
|||
return QString::fromUtf8(ak_string.characters_without_null_termination(), static_cast<qsizetype>(ak_string.length()));
|
||||
}
|
||||
|
||||
AK::URL ak_url_from_qstring(QString const& qstring)
|
||||
URL ak_url_from_qstring(QString const& qstring)
|
||||
{
|
||||
auto utf8_data = qstring.toUtf8();
|
||||
return AK::URL(StringView(utf8_data.data(), utf8_data.size()));
|
||||
return URL(StringView(utf8_data.data(), utf8_data.size()));
|
||||
}
|
||||
|
||||
AK::URL ak_url_from_qurl(QUrl const& qurl)
|
||||
URL ak_url_from_qurl(QUrl const& qurl)
|
||||
{
|
||||
return ak_url_from_qstring(qurl.toString());
|
||||
}
|
||||
|
|
|
@ -17,5 +17,5 @@
|
|||
AK::ByteString ak_byte_string_from_qstring(QString const&);
|
||||
String ak_string_from_qstring(QString const&);
|
||||
QString qstring_from_ak_string(StringView);
|
||||
AK::URL ak_url_from_qstring(QString const&);
|
||||
AK::URL ak_url_from_qurl(QUrl const&);
|
||||
URL ak_url_from_qstring(QString const&);
|
||||
URL ak_url_from_qurl(QUrl const&);
|
||||
|
|
|
@ -309,7 +309,7 @@ Tab::Tab(BrowserWindow* window, WebContentOptions const& web_content_options, St
|
|||
search_selected_text_action->setIcon(load_icon_from_uri("resource://icons/16x16/find.png"sv));
|
||||
QObject::connect(search_selected_text_action, &QAction::triggered, this, [this]() {
|
||||
auto url = MUST(String::formatted(Settings::the()->search_engine().query_url, URL::percent_encode(*m_page_context_menu_search_text)));
|
||||
m_window->new_tab_from_url(AK::URL(url), Web::HTML::ActivateTab::Yes);
|
||||
m_window->new_tab_from_url(URL(url), Web::HTML::ActivateTab::Yes);
|
||||
});
|
||||
|
||||
auto take_screenshot = [this](auto type) {
|
||||
|
@ -658,7 +658,7 @@ void Tab::focus_location_editor()
|
|||
m_location_edit->selectAll();
|
||||
}
|
||||
|
||||
void Tab::navigate(AK::URL const& url)
|
||||
void Tab::navigate(URL const& url)
|
||||
{
|
||||
view().load(url);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
WebContentView& view() { return *m_view; }
|
||||
|
||||
void navigate(AK::URL const&);
|
||||
void navigate(URL const&);
|
||||
void load_html(StringView);
|
||||
|
||||
void back();
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
WebContentView(QWidget* window, WebContentOptions const&, StringView webdriver_content_ipc_path, RefPtr<WebView::WebContentClient> parent_client = nullptr, size_t page_index = 0);
|
||||
virtual ~WebContentView() override;
|
||||
|
||||
Function<String(const AK::URL&, Web::HTML::ActivateTab)> on_tab_open_request;
|
||||
Function<String(const URL&, Web::HTML::ActivateTab)> on_tab_open_request;
|
||||
|
||||
virtual void paintEvent(QPaintEvent*) override;
|
||||
virtual void resizeEvent(QResizeEvent*) override;
|
||||
|
|
|
@ -19,7 +19,7 @@ NonnullRefPtr<WebSocketClientManagerQt> WebSocketClientManagerQt::create()
|
|||
WebSocketClientManagerQt::WebSocketClientManagerQt() = default;
|
||||
WebSocketClientManagerQt::~WebSocketClientManagerQt() = default;
|
||||
|
||||
RefPtr<Web::WebSockets::WebSocketClientSocket> WebSocketClientManagerQt::connect(AK::URL const& url, ByteString const& origin, Vector<ByteString> const& protocols)
|
||||
RefPtr<Web::WebSockets::WebSocketClientSocket> WebSocketClientManagerQt::connect(URL const& url, ByteString const& origin, Vector<ByteString> const& protocols)
|
||||
{
|
||||
WebSocket::ConnectionInfo connection_info(url);
|
||||
connection_info.set_origin(origin);
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
static NonnullRefPtr<WebSocketClientManagerQt> create();
|
||||
|
||||
virtual ~WebSocketClientManagerQt() override;
|
||||
virtual RefPtr<Web::WebSockets::WebSocketClientSocket> connect(AK::URL const&, ByteString const& origin, Vector<ByteString> const& protocols) override;
|
||||
virtual RefPtr<Web::WebSockets::WebSocketClientSocket> connect(URL const&, ByteString const& origin, Vector<ByteString> const& protocols) override;
|
||||
|
||||
private:
|
||||
WebSocketClientManagerQt();
|
||||
|
|
|
@ -55,7 +55,7 @@ void SearchPanel::search(StringView query)
|
|||
HashMap<ByteString, ByteString> headers;
|
||||
headers.set("User-Agent", "SerenityOS Maps");
|
||||
headers.set("Accept", "application/json");
|
||||
URL url(MUST(String::formatted("https://nominatim.openstreetmap.org/search?q={}&format=json", AK::URL::percent_encode(query, AK::URL::PercentEncodeSet::Query))));
|
||||
URL url(MUST(String::formatted("https://nominatim.openstreetmap.org/search?q={}&format=json", URL::percent_encode(query, URL::PercentEncodeSet::Query))));
|
||||
auto request = m_request_client->start_request("GET", url, headers, {});
|
||||
VERIFY(!request.is_null());
|
||||
m_request = request;
|
||||
|
|
|
@ -64,8 +64,8 @@ String CSSFontFaceRule::serialized() const
|
|||
|
||||
// 2. The result of invoking serialize a comma-separated list on performing serialize a URL or serialize a LOCAL for each source on the source list.
|
||||
serialize_a_comma_separated_list(builder, m_font_face.sources(), [&](StringBuilder& builder, FontFace::Source source) -> void {
|
||||
if (source.local_or_url.has<AK::URL>()) {
|
||||
serialize_a_url(builder, MUST(source.local_or_url.get<AK::URL>().to_string()));
|
||||
if (source.local_or_url.has<URL>()) {
|
||||
serialize_a_url(builder, MUST(source.local_or_url.get<URL>().to_string()));
|
||||
} else {
|
||||
builder.appendff("local({})", source.local_or_url.get<String>());
|
||||
}
|
||||
|
|
|
@ -21,13 +21,13 @@ namespace Web::CSS {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(CSSImportRule);
|
||||
|
||||
JS::NonnullGCPtr<CSSImportRule> CSSImportRule::create(AK::URL url, DOM::Document& document)
|
||||
JS::NonnullGCPtr<CSSImportRule> CSSImportRule::create(URL url, DOM::Document& document)
|
||||
{
|
||||
auto& realm = document.realm();
|
||||
return realm.heap().allocate<CSSImportRule>(realm, move(url), document);
|
||||
}
|
||||
|
||||
CSSImportRule::CSSImportRule(AK::URL url, DOM::Document& document)
|
||||
CSSImportRule::CSSImportRule(URL url, DOM::Document& document)
|
||||
: CSSRule(document.realm())
|
||||
, m_url(move(url))
|
||||
, m_document(document)
|
||||
|
|
|
@ -23,11 +23,11 @@ class CSSImportRule final
|
|||
JS_DECLARE_ALLOCATOR(CSSImportRule);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static JS::NonnullGCPtr<CSSImportRule> create(AK::URL, DOM::Document&);
|
||||
[[nodiscard]] static JS::NonnullGCPtr<CSSImportRule> create(URL, DOM::Document&);
|
||||
|
||||
virtual ~CSSImportRule() = default;
|
||||
|
||||
AK::URL const& url() const { return m_url; }
|
||||
URL const& url() const { return m_url; }
|
||||
// FIXME: This should return only the specified part of the url. eg, "stuff/foo.css", not "https://example.com/stuff/foo.css".
|
||||
String href() const { return MUST(m_url.to_string()); }
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
|||
virtual Type type() const override { return Type::Import; }
|
||||
|
||||
private:
|
||||
CSSImportRule(AK::URL, DOM::Document&);
|
||||
CSSImportRule(URL, DOM::Document&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
@ -50,7 +50,7 @@ private:
|
|||
virtual void resource_did_fail() override;
|
||||
virtual void resource_did_load() override;
|
||||
|
||||
AK::URL m_url;
|
||||
URL m_url;
|
||||
JS::GCPtr<DOM::Document> m_document;
|
||||
JS::GCPtr<CSSStyleSheet> m_style_sheet;
|
||||
Optional<DOM::DocumentLoadEventDelayer> m_document_load_event_delayer;
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Web::CSS {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(CSSStyleSheet);
|
||||
|
||||
JS::NonnullGCPtr<CSSStyleSheet> CSSStyleSheet::create(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional<AK::URL> location)
|
||||
JS::NonnullGCPtr<CSSStyleSheet> CSSStyleSheet::create(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional<URL> location)
|
||||
{
|
||||
return realm.heap().allocate<CSSStyleSheet>(realm, realm, rules, media, move(location));
|
||||
}
|
||||
|
@ -37,12 +37,12 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSStyleSheet>> CSSStyleSheet::construct_im
|
|||
|
||||
// 3. Set sheet’s stylesheet base URL to the baseURL attribute value from options.
|
||||
if (options.has_value() && options->base_url.has_value()) {
|
||||
Optional<AK::URL> sheet_location_url;
|
||||
Optional<URL> sheet_location_url;
|
||||
if (sheet->location().has_value())
|
||||
sheet_location_url = sheet->location().release_value();
|
||||
|
||||
// AD-HOC: This isn't explicitly mentioned in the specification, but multiple modern browsers do this.
|
||||
AK::URL url = sheet->location().has_value() ? sheet_location_url->complete_url(options->base_url.value()) : options->base_url.value();
|
||||
URL url = sheet->location().has_value() ? sheet_location_url->complete_url(options->base_url.value()) : options->base_url.value();
|
||||
if (!url.is_valid())
|
||||
return WebIDL::NotAllowedError::create(realm, "Constructed style sheets must have a valid base URL"_fly_string);
|
||||
|
||||
|
@ -91,7 +91,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSStyleSheet>> CSSStyleSheet::construct_im
|
|||
return sheet;
|
||||
}
|
||||
|
||||
CSSStyleSheet::CSSStyleSheet(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional<AK::URL> location)
|
||||
CSSStyleSheet::CSSStyleSheet(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional<URL> location)
|
||||
: StyleSheet(realm, media)
|
||||
, m_rules(&rules)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ class CSSStyleSheet final
|
|||
JS_DECLARE_ALLOCATOR(CSSStyleSheet);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static JS::NonnullGCPtr<CSSStyleSheet> create(JS::Realm&, CSSRuleList&, MediaList&, Optional<AK::URL> location);
|
||||
[[nodiscard]] static JS::NonnullGCPtr<CSSStyleSheet> create(JS::Realm&, CSSRuleList&, MediaList&, Optional<URL> location);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSStyleSheet>> construct_impl(JS::Realm&, Optional<CSSStyleSheetInit> const& options = {});
|
||||
|
||||
virtual ~CSSStyleSheet() override = default;
|
||||
|
@ -67,8 +67,8 @@ public:
|
|||
Optional<FlyString> default_namespace() const;
|
||||
Optional<FlyString> namespace_uri(StringView namespace_prefix) const;
|
||||
|
||||
Optional<AK::URL> base_url() const { return m_base_url; }
|
||||
void set_base_url(Optional<AK::URL> base_url) { m_base_url = move(base_url); }
|
||||
Optional<URL> base_url() const { return m_base_url; }
|
||||
void set_base_url(Optional<URL> base_url) { m_base_url = move(base_url); }
|
||||
|
||||
bool constructed() const { return m_constructed; }
|
||||
|
||||
|
@ -78,7 +78,7 @@ public:
|
|||
bool disallow_modification() const { return m_disallow_modification; }
|
||||
|
||||
private:
|
||||
CSSStyleSheet(JS::Realm&, CSSRuleList&, MediaList&, Optional<AK::URL> location);
|
||||
CSSStyleSheet(JS::Realm&, CSSRuleList&, MediaList&, Optional<URL> location);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
@ -95,7 +95,7 @@ private:
|
|||
JS::GCPtr<StyleSheetList> m_style_sheet_list;
|
||||
JS::GCPtr<CSSRule> m_owner_css_rule;
|
||||
|
||||
Optional<AK::URL> m_base_url;
|
||||
Optional<URL> m_base_url;
|
||||
JS::GCPtr<DOM::Document const> m_constructor_document;
|
||||
bool m_constructed { false };
|
||||
bool m_disallow_modification { false };
|
||||
|
|
|
@ -183,33 +183,33 @@ public:
|
|||
: m_value(color)
|
||||
{
|
||||
}
|
||||
SVGPaint(AK::URL const& url)
|
||||
SVGPaint(URL const& url)
|
||||
: m_value(url)
|
||||
{
|
||||
}
|
||||
|
||||
bool is_color() const { return m_value.has<Color>(); }
|
||||
bool is_url() const { return m_value.has<AK::URL>(); }
|
||||
bool is_url() const { return m_value.has<URL>(); }
|
||||
Color as_color() const { return m_value.get<Color>(); }
|
||||
AK::URL const& as_url() const { return m_value.get<AK::URL>(); }
|
||||
URL const& as_url() const { return m_value.get<URL>(); }
|
||||
|
||||
private:
|
||||
Variant<AK::URL, Color> m_value;
|
||||
Variant<URL, Color> m_value;
|
||||
};
|
||||
|
||||
// https://drafts.fxtf.org/css-masking-1/#typedef-mask-reference
|
||||
class MaskReference {
|
||||
public:
|
||||
// TODO: Support other mask types.
|
||||
MaskReference(AK::URL const& url)
|
||||
MaskReference(URL const& url)
|
||||
: m_url(url)
|
||||
{
|
||||
}
|
||||
|
||||
AK::URL const& url() const { return m_url; }
|
||||
URL const& url() const { return m_url; }
|
||||
|
||||
private:
|
||||
AK::URL m_url;
|
||||
URL m_url;
|
||||
};
|
||||
|
||||
struct BackgroundLayerData {
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Web::CSS {
|
|||
class FontFace {
|
||||
public:
|
||||
struct Source {
|
||||
Variant<String, AK::URL> local_or_url;
|
||||
Variant<String, URL> local_or_url;
|
||||
// FIXME: Do we need to keep this around, or is it only needed to discard unwanted formats during parsing?
|
||||
Optional<FlyString> format;
|
||||
};
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
CSS::CSSStyleSheet* parse_css_stylesheet(CSS::Parser::ParsingContext const& context, StringView css, Optional<AK::URL> location)
|
||||
CSS::CSSStyleSheet* parse_css_stylesheet(CSS::Parser::ParsingContext const& context, StringView css, Optional<URL> location)
|
||||
{
|
||||
if (css.is_empty()) {
|
||||
auto rule_list = CSS::CSSRuleList::create_empty(context.realm());
|
||||
|
|
|
@ -124,7 +124,7 @@ Parser::Parser(Parser&& other)
|
|||
// 5.3.3. Parse a stylesheet
|
||||
// https://www.w3.org/TR/css-syntax-3/#parse-stylesheet
|
||||
template<typename T>
|
||||
Parser::ParsedStyleSheet Parser::parse_a_stylesheet(TokenStream<T>& tokens, Optional<AK::URL> location)
|
||||
Parser::ParsedStyleSheet Parser::parse_a_stylesheet(TokenStream<T>& tokens, Optional<URL> location)
|
||||
{
|
||||
// To parse a stylesheet from an input given an optional url location:
|
||||
|
||||
|
@ -144,7 +144,7 @@ Parser::ParsedStyleSheet Parser::parse_a_stylesheet(TokenStream<T>& tokens, Opti
|
|||
}
|
||||
|
||||
// https://www.w3.org/TR/css-syntax-3/#parse-a-css-stylesheet
|
||||
CSSStyleSheet* Parser::parse_as_css_stylesheet(Optional<AK::URL> location)
|
||||
CSSStyleSheet* Parser::parse_as_css_stylesheet(Optional<URL> location)
|
||||
{
|
||||
// To parse a CSS stylesheet, first parse a stylesheet.
|
||||
auto style_sheet = parse_a_stylesheet(m_token_stream, {});
|
||||
|
@ -1160,11 +1160,11 @@ ElementInlineCSSStyleDeclaration* Parser::parse_as_style_attribute(DOM::Element&
|
|||
return ElementInlineCSSStyleDeclaration::create(element, move(properties), move(custom_properties));
|
||||
}
|
||||
|
||||
Optional<AK::URL> Parser::parse_url_function(ComponentValue const& component_value)
|
||||
Optional<URL> Parser::parse_url_function(ComponentValue const& component_value)
|
||||
{
|
||||
// FIXME: Handle list of media queries. https://www.w3.org/TR/css-cascade-3/#conditional-import
|
||||
|
||||
auto convert_string_to_url = [&](StringView url_string) -> Optional<AK::URL> {
|
||||
auto convert_string_to_url = [&](StringView url_string) -> Optional<URL> {
|
||||
auto url = m_context.complete_url(url_string);
|
||||
if (url.is_valid())
|
||||
return url;
|
||||
|
@ -1215,7 +1215,7 @@ CSSRule* Parser::convert_to_rule(NonnullRefPtr<Rule> rule)
|
|||
return parse_font_face_rule(tokens);
|
||||
}
|
||||
if (rule->at_rule_name().equals_ignoring_ascii_case("import"sv) && !rule->prelude().is_empty()) {
|
||||
Optional<AK::URL> url;
|
||||
Optional<URL> url;
|
||||
for (auto const& token : rule->prelude()) {
|
||||
if (token.is(Token::Type::Whitespace))
|
||||
continue;
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
Parser(Parser&&);
|
||||
|
||||
CSSStyleSheet* parse_as_css_stylesheet(Optional<AK::URL> location);
|
||||
CSSStyleSheet* parse_as_css_stylesheet(Optional<URL> location);
|
||||
ElementInlineCSSStyleDeclaration* parse_as_style_attribute(DOM::Element&);
|
||||
CSSRule* parse_as_css_rule();
|
||||
Optional<StyleProperty> parse_as_supports_condition();
|
||||
|
@ -86,11 +86,11 @@ private:
|
|||
|
||||
// "Parse a stylesheet" is intended to be the normal parser entry point, for parsing stylesheets.
|
||||
struct ParsedStyleSheet {
|
||||
Optional<AK::URL> location;
|
||||
Optional<URL> location;
|
||||
Vector<NonnullRefPtr<Rule>> rules;
|
||||
};
|
||||
template<typename T>
|
||||
ParsedStyleSheet parse_a_stylesheet(TokenStream<T>&, Optional<AK::URL> location);
|
||||
ParsedStyleSheet parse_a_stylesheet(TokenStream<T>&, Optional<URL> location);
|
||||
|
||||
// "Parse a list of rules" is intended for the content of at-rules such as @media. It differs from "Parse a stylesheet" in the handling of <CDO-token> and <CDC-token>.
|
||||
template<typename T>
|
||||
|
@ -195,7 +195,7 @@ private:
|
|||
Optional<GridRepeat> parse_repeat(Vector<ComponentValue> const&);
|
||||
Optional<ExplicitGridTrack> parse_track_sizing_function(ComponentValue const&);
|
||||
|
||||
Optional<AK::URL> parse_url_function(ComponentValue const&);
|
||||
Optional<URL> parse_url_function(ComponentValue const&);
|
||||
RefPtr<StyleValue> parse_url_value(ComponentValue const&);
|
||||
|
||||
Optional<Vector<LinearColorStopListElement>> parse_linear_color_stop_list(TokenStream<ComponentValue>&);
|
||||
|
@ -330,7 +330,7 @@ private:
|
|||
|
||||
namespace Web {
|
||||
|
||||
CSS::CSSStyleSheet* parse_css_stylesheet(CSS::Parser::ParsingContext const&, StringView, Optional<AK::URL> location = {});
|
||||
CSS::CSSStyleSheet* parse_css_stylesheet(CSS::Parser::ParsingContext const&, StringView, Optional<URL> location = {});
|
||||
CSS::ElementInlineCSSStyleDeclaration* parse_css_style_attribute(CSS::Parser::ParsingContext const&, StringView, DOM::Element&);
|
||||
RefPtr<CSS::StyleValue> parse_css_value(CSS::Parser::ParsingContext const&, StringView, CSS::PropertyID property_id = CSS::PropertyID::Invalid);
|
||||
Optional<CSS::SelectorList> parse_selector(CSS::Parser::ParsingContext const&, StringView);
|
||||
|
|
|
@ -19,7 +19,7 @@ ParsingContext::ParsingContext(JS::Realm& realm, Mode mode)
|
|||
{
|
||||
}
|
||||
|
||||
ParsingContext::ParsingContext(DOM::Document const& document, AK::URL url, Mode mode)
|
||||
ParsingContext::ParsingContext(DOM::Document const& document, URL url, Mode mode)
|
||||
: m_realm(const_cast<JS::Realm&>(document.realm()))
|
||||
, m_document(&document)
|
||||
, m_url(move(url))
|
||||
|
@ -49,7 +49,7 @@ bool ParsingContext::in_quirks_mode() const
|
|||
}
|
||||
|
||||
// https://www.w3.org/TR/css-values-4/#relative-urls
|
||||
AK::URL ParsingContext::complete_url(StringView relative_url) const
|
||||
URL ParsingContext::complete_url(StringView relative_url) const
|
||||
{
|
||||
return m_url.complete_url(relative_url);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
|
||||
explicit ParsingContext(JS::Realm&, Mode = Mode::Normal);
|
||||
explicit ParsingContext(DOM::Document const&, Mode = Mode::Normal);
|
||||
explicit ParsingContext(DOM::Document const&, AK::URL, Mode = Mode::Normal);
|
||||
explicit ParsingContext(DOM::Document const&, URL, Mode = Mode::Normal);
|
||||
explicit ParsingContext(DOM::ParentNode&, Mode = Mode::Normal);
|
||||
|
||||
Mode mode() const { return m_mode; }
|
||||
|
@ -30,7 +30,7 @@ public:
|
|||
bool in_quirks_mode() const;
|
||||
DOM::Document const* document() const { return m_document; }
|
||||
HTML::Window const* window() const;
|
||||
AK::URL complete_url(StringView) const;
|
||||
URL complete_url(StringView) const;
|
||||
|
||||
PropertyID current_property_id() const { return m_current_property_id; }
|
||||
void set_current_property_id(PropertyID property_id) { m_current_property_id = property_id; }
|
||||
|
@ -41,7 +41,7 @@ private:
|
|||
JS::NonnullGCPtr<JS::Realm> m_realm;
|
||||
JS::GCPtr<DOM::Document const> m_document;
|
||||
PropertyID m_current_property_id { PropertyID::Invalid };
|
||||
AK::URL m_url;
|
||||
URL m_url;
|
||||
Mode m_mode { Mode::Normal };
|
||||
};
|
||||
|
||||
|
|
|
@ -276,10 +276,10 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla
|
|||
if (!matches_link_pseudo_class(element))
|
||||
return false;
|
||||
auto document_url = element.document().url();
|
||||
AK::URL target_url = element.document().parse_url(element.attribute(HTML::AttributeNames::href).value_or({}));
|
||||
URL target_url = element.document().parse_url(element.attribute(HTML::AttributeNames::href).value_or({}));
|
||||
if (target_url.fragment().has_value())
|
||||
return document_url.equals(target_url, AK::URL::ExcludeFragment::No);
|
||||
return document_url.equals(target_url, AK::URL::ExcludeFragment::Yes);
|
||||
return document_url.equals(target_url, URL::ExcludeFragment::No);
|
||||
return document_url.equals(target_url, URL::ExcludeFragment::Yes);
|
||||
}
|
||||
case CSS::PseudoClass::Visited:
|
||||
// FIXME: Maybe match this selector sometimes?
|
||||
|
|
|
@ -100,7 +100,7 @@ StyleComputer::~StyleComputer() = default;
|
|||
|
||||
class StyleComputer::FontLoader : public ResourceClient {
|
||||
public:
|
||||
explicit FontLoader(StyleComputer& style_computer, FlyString family_name, Vector<Gfx::UnicodeRange> unicode_ranges, Vector<AK::URL> urls)
|
||||
explicit FontLoader(StyleComputer& style_computer, FlyString family_name, Vector<Gfx::UnicodeRange> unicode_ranges, Vector<URL> urls)
|
||||
: m_style_computer(style_computer)
|
||||
, m_family_name(move(family_name))
|
||||
, m_unicode_ranges(move(unicode_ranges))
|
||||
|
@ -185,7 +185,7 @@ private:
|
|||
FlyString m_family_name;
|
||||
Vector<Gfx::UnicodeRange> m_unicode_ranges;
|
||||
RefPtr<Gfx::VectorFont> m_vector_font;
|
||||
Vector<AK::URL> m_urls;
|
||||
Vector<URL> m_urls;
|
||||
};
|
||||
|
||||
struct StyleComputer::MatchingFontCandidate {
|
||||
|
@ -1999,11 +1999,11 @@ void StyleComputer::load_fonts_from_sheet(CSSStyleSheet const& sheet)
|
|||
.slope = font_face.slope().value_or(0),
|
||||
};
|
||||
|
||||
Vector<AK::URL> urls;
|
||||
Vector<URL> urls;
|
||||
for (auto& source : font_face.sources()) {
|
||||
// FIXME: These should be loaded relative to the stylesheet URL instead of the document URL.
|
||||
if (source.local_or_url.has<AK::URL>())
|
||||
urls.append(m_document->parse_url(MUST(source.local_or_url.get<AK::URL>().to_string())));
|
||||
if (source.local_or_url.has<URL>())
|
||||
urls.append(m_document->parse_url(MUST(source.local_or_url.get<URL>().to_string())));
|
||||
// FIXME: Handle local()
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
ImageStyleValue::ImageStyleValue(AK::URL const& url)
|
||||
ImageStyleValue::ImageStyleValue(URL const& url)
|
||||
: AbstractImageStyleValue(Type::Image)
|
||||
, m_url(url)
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ class ImageStyleValue final
|
|||
: public AbstractImageStyleValue
|
||||
, public Weakable<ImageStyleValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<ImageStyleValue> create(AK::URL const& url)
|
||||
static ValueComparingNonnullRefPtr<ImageStyleValue> create(URL const& url)
|
||||
{
|
||||
return adopt_ref(*new (nothrow) ImageStyleValue(url));
|
||||
}
|
||||
|
@ -54,14 +54,14 @@ public:
|
|||
JS::GCPtr<HTML::DecodedImageData> image_data() const;
|
||||
|
||||
private:
|
||||
ImageStyleValue(AK::URL const&);
|
||||
ImageStyleValue(URL const&);
|
||||
|
||||
JS::GCPtr<HTML::SharedImageRequest> m_image_request;
|
||||
|
||||
void animate();
|
||||
Gfx::ImmutableBitmap const* bitmap(size_t frame_index, Gfx::IntSize = {}) const;
|
||||
|
||||
AK::URL m_url;
|
||||
URL m_url;
|
||||
WeakPtr<DOM::Document> m_document;
|
||||
|
||||
size_t m_current_frame_index { 0 };
|
||||
|
|
|
@ -14,14 +14,14 @@ namespace Web::CSS {
|
|||
|
||||
class URLStyleValue final : public StyleValueWithDefaultOperators<URLStyleValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<URLStyleValue> create(AK::URL const& url)
|
||||
static ValueComparingNonnullRefPtr<URLStyleValue> create(URL const& url)
|
||||
{
|
||||
return adopt_ref(*new (nothrow) URLStyleValue(url));
|
||||
}
|
||||
|
||||
virtual ~URLStyleValue() override = default;
|
||||
|
||||
AK::URL const& url() const { return m_url; }
|
||||
URL const& url() const { return m_url; }
|
||||
|
||||
bool properties_equal(URLStyleValue const& other) const { return m_url == other.m_url; }
|
||||
|
||||
|
@ -31,13 +31,13 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
URLStyleValue(AK::URL const& url)
|
||||
URLStyleValue(URL const& url)
|
||||
: StyleValueWithDefaultOperators(Type::URL)
|
||||
, m_url(url)
|
||||
{
|
||||
}
|
||||
|
||||
AK::URL m_url;
|
||||
URL m_url;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -312,8 +312,8 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> Document::create_and_initialize(
|
|||
auto const& referrer = navigation_params.request->referrer();
|
||||
|
||||
// 3. If referrer is a URL record, then set document's referrer to the serialization of referrer.
|
||||
if (referrer.has<AK::URL>()) {
|
||||
document->m_referrer = MUST(String::from_byte_string(referrer.get<AK::URL>().serialize()));
|
||||
if (referrer.has<URL>()) {
|
||||
document->m_referrer = MUST(String::from_byte_string(referrer.get<URL>().serialize()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -337,12 +337,12 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> Document::construct_impl(JS::Rea
|
|||
return Document::create(realm);
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<Document> Document::create(JS::Realm& realm, AK::URL const& url)
|
||||
JS::NonnullGCPtr<Document> Document::create(JS::Realm& realm, URL const& url)
|
||||
{
|
||||
return realm.heap().allocate<Document>(realm, realm, url);
|
||||
}
|
||||
|
||||
Document::Document(JS::Realm& realm, const AK::URL& url)
|
||||
Document::Document(JS::Realm& realm, const URL& url)
|
||||
: ParentNode(realm, *this, NodeType::DOCUMENT_NODE)
|
||||
, m_page(Bindings::host_defined_page(realm))
|
||||
, m_style_computer(make<CSS::StyleComputer>(*this))
|
||||
|
@ -938,7 +938,7 @@ JS::GCPtr<HTML::HTMLBaseElement const> Document::first_base_element_with_href_in
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#fallback-base-url
|
||||
AK::URL Document::fallback_base_url() const
|
||||
URL Document::fallback_base_url() const
|
||||
{
|
||||
// 1. If document is an iframe srcdoc document, then:
|
||||
if (HTML::url_matches_about_srcdoc(m_url)) {
|
||||
|
@ -958,7 +958,7 @@ AK::URL Document::fallback_base_url() const
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#document-base-url
|
||||
AK::URL Document::base_url() const
|
||||
URL Document::base_url() const
|
||||
{
|
||||
// 1. If there is no base element that has an href attribute in the Document, then return the Document's fallback base URL.
|
||||
auto base_element = first_base_element_with_href_in_tree_order();
|
||||
|
@ -970,7 +970,7 @@ AK::URL Document::base_url() const
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#parse-a-url
|
||||
AK::URL Document::parse_url(StringView url) const
|
||||
URL Document::parse_url(StringView url) const
|
||||
{
|
||||
// FIXME: Pass in document's character encoding.
|
||||
return base_url().complete_url(url);
|
||||
|
@ -1855,7 +1855,7 @@ Document::IndicatedPart Document::determine_the_indicated_part() const
|
|||
|
||||
// 5. Let fragmentBytes be the result of percent-decoding fragment.
|
||||
// 6. Let decodedFragment be the result of running UTF-8 decode without BOM on fragmentBytes.
|
||||
auto decoded_fragment = AK::URL::percent_decode(*fragment);
|
||||
auto decoded_fragment = URL::percent_decode(*fragment);
|
||||
|
||||
// 7. Set potentialIndicatedElement to the result of finding a potential indicated element given document and decodedFragment.
|
||||
potential_indicated_element = find_a_potential_indicated_element(MUST(FlyString::from_deprecated_fly_string(decoded_fragment)));
|
||||
|
@ -3768,7 +3768,7 @@ void Document::update_for_history_step_application(JS::NonnullGCPtr<HTML::Sessio
|
|||
// The doNotReactivate argument distinguishes between these two cases.
|
||||
if (documents_entry_changed) {
|
||||
// 1. Let oldURL be document's latest entry's URL.
|
||||
auto old_url = m_latest_entry ? m_latest_entry->url : AK::URL {};
|
||||
auto old_url = m_latest_entry ? m_latest_entry->url : URL {};
|
||||
|
||||
// 2. Set document's latest entry to entry.
|
||||
m_latest_entry = entry;
|
||||
|
@ -3831,7 +3831,7 @@ void Document::update_for_history_step_application(JS::NonnullGCPtr<HTML::Sessio
|
|||
}
|
||||
}
|
||||
|
||||
HashMap<AK::URL, JS::GCPtr<HTML::SharedImageRequest>>& Document::shared_image_requests()
|
||||
HashMap<URL, JS::GCPtr<HTML::SharedImageRequest>>& Document::shared_image_requests()
|
||||
{
|
||||
return m_shared_image_requests;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> create_and_initialize(Type, String content_type, HTML::NavigationParams&);
|
||||
|
||||
[[nodiscard]] static JS::NonnullGCPtr<Document> create(JS::Realm&, AK::URL const& url = "about:blank"sv);
|
||||
[[nodiscard]] static JS::NonnullGCPtr<Document> create(JS::Realm&, URL const& url = "about:blank"sv);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> construct_impl(JS::Realm&);
|
||||
virtual ~Document() override;
|
||||
|
||||
|
@ -106,10 +106,10 @@ public:
|
|||
String referrer() const;
|
||||
void set_referrer(String);
|
||||
|
||||
void set_url(const AK::URL& url) { m_url = url; }
|
||||
AK::URL url() const { return m_url; }
|
||||
AK::URL fallback_base_url() const;
|
||||
AK::URL base_url() const;
|
||||
void set_url(const URL& url) { m_url = url; }
|
||||
URL url() const { return m_url; }
|
||||
URL fallback_base_url() const;
|
||||
URL base_url() const;
|
||||
|
||||
void update_base_element(Badge<HTML::HTMLBaseElement>);
|
||||
JS::GCPtr<HTML::HTMLBaseElement const> first_base_element_with_href_in_tree_order() const;
|
||||
|
@ -123,7 +123,7 @@ public:
|
|||
HTML::CrossOriginOpenerPolicy const& cross_origin_opener_policy() const { return m_cross_origin_opener_policy; }
|
||||
void set_cross_origin_opener_policy(HTML::CrossOriginOpenerPolicy policy) { m_cross_origin_opener_policy = move(policy); }
|
||||
|
||||
AK::URL parse_url(StringView) const;
|
||||
URL parse_url(StringView) const;
|
||||
|
||||
CSS::StyleComputer& style_computer() { return *m_style_computer; }
|
||||
const CSS::StyleComputer& style_computer() const { return *m_style_computer; }
|
||||
|
@ -451,8 +451,8 @@ public:
|
|||
void set_is_initial_about_blank(bool b) { m_is_initial_about_blank = b; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#concept-document-about-base-url
|
||||
Optional<AK::URL> about_base_url() const { return m_about_base_url; }
|
||||
void set_about_base_url(Optional<AK::URL> url) { m_about_base_url = url; }
|
||||
Optional<URL> about_base_url() const { return m_about_base_url; }
|
||||
void set_about_base_url(Optional<URL> url) { m_about_base_url = url; }
|
||||
|
||||
String domain() const;
|
||||
void set_domain(String const&);
|
||||
|
@ -544,7 +544,7 @@ public:
|
|||
|
||||
void update_for_history_step_application(JS::NonnullGCPtr<HTML::SessionHistoryEntry>, bool do_not_reactivate, size_t script_history_length, size_t script_history_index, Optional<Vector<JS::NonnullGCPtr<HTML::SessionHistoryEntry>>> entries_for_navigation_api = {}, bool update_navigation_api = true);
|
||||
|
||||
HashMap<AK::URL, JS::GCPtr<HTML::SharedImageRequest>>& shared_image_requests();
|
||||
HashMap<URL, JS::GCPtr<HTML::SharedImageRequest>>& shared_image_requests();
|
||||
|
||||
void restore_the_history_object_state(JS::NonnullGCPtr<HTML::SessionHistoryEntry> entry);
|
||||
|
||||
|
@ -602,7 +602,7 @@ protected:
|
|||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
Document(JS::Realm&, AK::URL const&);
|
||||
Document(JS::Realm&, URL const&);
|
||||
|
||||
private:
|
||||
// ^HTML::GlobalEventHandlers
|
||||
|
@ -631,7 +631,7 @@ private:
|
|||
Optional<CSS::Selector::PseudoElement::Type> m_inspected_pseudo_element;
|
||||
JS::GCPtr<Node> m_active_favicon;
|
||||
WeakPtr<HTML::BrowsingContext> m_browsing_context;
|
||||
AK::URL m_url;
|
||||
URL m_url;
|
||||
|
||||
JS::GCPtr<HTML::Window> m_window;
|
||||
|
||||
|
@ -732,7 +732,7 @@ private:
|
|||
bool m_is_initial_about_blank { false };
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#concept-document-about-base-url
|
||||
Optional<AK::URL> m_about_base_url;
|
||||
Optional<URL> m_about_base_url;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#concept-document-coop
|
||||
HTML::CrossOriginOpenerPolicy m_cross_origin_opener_policy;
|
||||
|
@ -808,7 +808,7 @@ private:
|
|||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#latest-entry
|
||||
JS::GCPtr<HTML::SessionHistoryEntry> m_latest_entry;
|
||||
|
||||
HashMap<AK::URL, JS::GCPtr<HTML::SharedImageRequest>> m_shared_image_requests;
|
||||
HashMap<URL, JS::GCPtr<HTML::SharedImageRequest>> m_shared_image_requests;
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#timeline-associated-with-a-document
|
||||
HashTable<JS::NonnullGCPtr<Animations::AnimationTimeline>> m_associated_animation_timelines;
|
||||
|
|
|
@ -31,7 +31,7 @@ JS::NonnullGCPtr<DOM::Document> create_document_for_inline_content(JS::GCPtr<HTM
|
|||
// origin: origin
|
||||
// cross-origin opener policy: coop
|
||||
HTML::CrossOriginOpenerPolicyEnforcementResult coop_enforcement_result {
|
||||
.url = AK::URL("about:error"), // AD-HOC
|
||||
.url = URL("about:error"), // AD-HOC
|
||||
.origin = origin,
|
||||
.cross_origin_opener_policy = coop
|
||||
};
|
||||
|
@ -52,7 +52,7 @@ JS::NonnullGCPtr<DOM::Document> create_document_for_inline_content(JS::GCPtr<HTM
|
|||
// FIXME: navigation timing type: navTimingType
|
||||
// about base URL: null
|
||||
auto response = Fetch::Infrastructure::Response::create(vm);
|
||||
response->url_list().append(AK::URL("about:error")); // AD-HOC: https://github.com/whatwg/html/issues/9122
|
||||
response->url_list().append(URL("about:error")); // AD-HOC: https://github.com/whatwg/html/issues/9122
|
||||
HTML::NavigationParams navigation_params {
|
||||
.id = navigation_id,
|
||||
.navigable = navigable,
|
||||
|
|
|
@ -11,12 +11,12 @@ namespace Web::DOM {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(XMLDocument);
|
||||
|
||||
JS::NonnullGCPtr<XMLDocument> XMLDocument::create(JS::Realm& realm, AK::URL const& url)
|
||||
JS::NonnullGCPtr<XMLDocument> XMLDocument::create(JS::Realm& realm, URL const& url)
|
||||
{
|
||||
return realm.heap().allocate<XMLDocument>(realm, realm, url);
|
||||
}
|
||||
|
||||
XMLDocument::XMLDocument(JS::Realm& realm, AK::URL const& url)
|
||||
XMLDocument::XMLDocument(JS::Realm& realm, URL const& url)
|
||||
: Document(realm, url)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -15,11 +15,11 @@ class XMLDocument final : public Document {
|
|||
JS_DECLARE_ALLOCATOR(XMLDocument);
|
||||
|
||||
public:
|
||||
static JS::NonnullGCPtr<XMLDocument> create(JS::Realm&, AK::URL const& url = "about:blank"sv);
|
||||
static JS::NonnullGCPtr<XMLDocument> create(JS::Realm&, URL const& url = "about:blank"sv);
|
||||
virtual ~XMLDocument() override = default;
|
||||
|
||||
private:
|
||||
XMLDocument(JS::Realm& realm, AK::URL const& url);
|
||||
XMLDocument(JS::Realm& realm, URL const& url);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
};
|
||||
|
|
|
@ -18,19 +18,19 @@ namespace Web::DOMURL {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(DOMURL);
|
||||
|
||||
JS::NonnullGCPtr<DOMURL> DOMURL::create(JS::Realm& realm, AK::URL url, JS::NonnullGCPtr<URLSearchParams> query)
|
||||
JS::NonnullGCPtr<DOMURL> DOMURL::create(JS::Realm& realm, URL url, JS::NonnullGCPtr<URLSearchParams> query)
|
||||
{
|
||||
return realm.heap().allocate<DOMURL>(realm, realm, move(url), move(query));
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#api-url-parser
|
||||
static Optional<AK::URL> parse_api_url(String const& url, Optional<String> const& base)
|
||||
static Optional<URL> parse_api_url(String const& url, Optional<String> const& base)
|
||||
{
|
||||
// FIXME: We somewhat awkwardly have two failure states encapsulated in the return type (and convert between them in the steps),
|
||||
// ideally we'd get rid of URL's valid flag
|
||||
|
||||
// 1. Let parsedBase be null.
|
||||
Optional<AK::URL> parsed_base;
|
||||
Optional<URL> parsed_base;
|
||||
|
||||
// 2. If base is non-null:
|
||||
if (base.has_value()) {
|
||||
|
@ -46,7 +46,7 @@ static Optional<AK::URL> parse_api_url(String const& url, Optional<String> const
|
|||
|
||||
// 3. Return the result of running the basic URL parser on url with parsedBase.
|
||||
auto parsed = URLParser::basic_parse(url, parsed_base);
|
||||
return parsed.is_valid() ? parsed : Optional<AK::URL> {};
|
||||
return parsed.is_valid() ? parsed : Optional<URL> {};
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-url
|
||||
|
@ -75,7 +75,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMURL>> DOMURL::construct_impl(JS::Realm&
|
|||
return result_url;
|
||||
}
|
||||
|
||||
DOMURL::DOMURL(JS::Realm& realm, AK::URL url, JS::NonnullGCPtr<URLSearchParams> query)
|
||||
DOMURL::DOMURL(JS::Realm& realm, URL url, JS::NonnullGCPtr<URLSearchParams> query)
|
||||
: PlatformObject(realm)
|
||||
, m_url(move(url))
|
||||
, m_query(move(query))
|
||||
|
@ -166,7 +166,7 @@ WebIDL::ExceptionOr<void> DOMURL::set_href(String const& href)
|
|||
auto& vm = realm().vm();
|
||||
|
||||
// 1. Let parsedURL be the result of running the basic URL parser on the given value.
|
||||
AK::URL parsed_url = href;
|
||||
URL parsed_url = href;
|
||||
|
||||
// 2. If parsedURL is failure, then throw a TypeError.
|
||||
if (!parsed_url.is_valid())
|
||||
|
@ -355,7 +355,7 @@ WebIDL::ExceptionOr<String> DOMURL::pathname() const
|
|||
auto& vm = realm().vm();
|
||||
|
||||
// The pathname getter steps are to return the result of URL path serializing this’s URL.
|
||||
return TRY_OR_THROW_OOM(vm, String::from_byte_string(m_url.serialize_path(AK::URL::ApplyPercentDecoding::No)));
|
||||
return TRY_OR_THROW_OOM(vm, String::from_byte_string(m_url.serialize_path(URL::ApplyPercentDecoding::No)));
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#ref-for-dom-url-pathname%E2%91%A0
|
||||
|
@ -482,7 +482,7 @@ void DOMURL::set_hash(String const& hash)
|
|||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#concept-url-origin
|
||||
HTML::Origin url_origin(AK::URL const& url)
|
||||
HTML::Origin url_origin(URL const& url)
|
||||
{
|
||||
// FIXME: We should probably have an extended version of AK::URL for LibWeb instead of standalone functions like this.
|
||||
|
||||
|
@ -533,7 +533,7 @@ HTML::Origin url_origin(AK::URL const& url)
|
|||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#concept-domain
|
||||
bool host_is_domain(AK::URL::Host const& host)
|
||||
bool host_is_domain(URL::Host const& host)
|
||||
{
|
||||
// A domain is a non-empty ASCII string that identifies a realm within a network.
|
||||
return host.has<String>() && host.get<String>() != String {};
|
||||
|
@ -563,7 +563,7 @@ void strip_trailing_spaces_from_an_opaque_path(DOMURL& url)
|
|||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#concept-url-parser
|
||||
AK::URL parse(StringView input, Optional<AK::URL> const& base_url)
|
||||
URL parse(StringView input, Optional<URL> const& base_url)
|
||||
{
|
||||
// FIXME: We should probably have an extended version of AK::URL for LibWeb instead of standalone functions like this.
|
||||
|
||||
|
|
|
@ -79,22 +79,22 @@ public:
|
|||
void set_query(Badge<URLSearchParams>, Optional<String> query) { m_url.set_query(move(query)); }
|
||||
|
||||
private:
|
||||
DOMURL(JS::Realm&, AK::URL, JS::NonnullGCPtr<URLSearchParams> query);
|
||||
DOMURL(JS::Realm&, URL, JS::NonnullGCPtr<URLSearchParams> query);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
AK::URL m_url;
|
||||
URL m_url;
|
||||
JS::NonnullGCPtr<URLSearchParams> m_query;
|
||||
};
|
||||
|
||||
HTML::Origin url_origin(AK::URL const&);
|
||||
bool host_is_domain(AK::URL::Host const&);
|
||||
HTML::Origin url_origin(URL const&);
|
||||
bool host_is_domain(URL::Host const&);
|
||||
|
||||
// https://url.spec.whatwg.org/#potentially-strip-trailing-spaces-from-an-opaque-path
|
||||
void strip_trailing_spaces_from_an_opaque_path(DOMURL& url);
|
||||
|
||||
// https://url.spec.whatwg.org/#concept-url-parser
|
||||
AK::URL parse(StringView input, Optional<AK::URL> const& base_url = {});
|
||||
URL parse(StringView input, Optional<URL> const& base_url = {});
|
||||
|
||||
}
|
||||
|
|
|
@ -55,11 +55,11 @@ ErrorOr<String> url_encode(Vector<QueryParam> const& tuples, StringView encoding
|
|||
|
||||
// 2. Let name be the result of running percent-encode after encoding with encoding, tuple’s name, the application/x-www-form-urlencoded percent-encode set, and true.
|
||||
// FIXME: URLParser does not currently implement encoding.
|
||||
auto name = TRY(URLParser::percent_encode_after_encoding(tuple.name, AK::URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded, true));
|
||||
auto name = TRY(URLParser::percent_encode_after_encoding(tuple.name, URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded, true));
|
||||
|
||||
// 3. Let value be the result of running percent-encode after encoding with encoding, tuple’s value, the application/x-www-form-urlencoded percent-encode set, and true.
|
||||
// FIXME: URLParser does not currently implement encoding.
|
||||
auto value = TRY(URLParser::percent_encode_after_encoding(tuple.value, AK::URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded, true));
|
||||
auto value = TRY(URLParser::percent_encode_after_encoding(tuple.value, URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded, true));
|
||||
|
||||
// 4. If output is not the empty string, then append U+0026 (&) to output.
|
||||
if (!output.is_empty())
|
||||
|
@ -109,8 +109,8 @@ ErrorOr<Vector<QueryParam>> url_decode(StringView input)
|
|||
auto space_decoded_name = name.replace("+"sv, " "sv, ReplaceMode::All);
|
||||
|
||||
// 5. Let nameString and valueString be the result of running UTF-8 decode without BOM on the percent-decoding of name and value, respectively.
|
||||
auto name_string = TRY(String::from_byte_string(AK::URL::percent_decode(space_decoded_name)));
|
||||
auto value_string = TRY(String::from_byte_string(AK::URL::percent_decode(value)));
|
||||
auto name_string = TRY(String::from_byte_string(URL::percent_decode(space_decoded_name)));
|
||||
auto value_string = TRY(String::from_byte_string(URL::percent_decode(value)));
|
||||
|
||||
TRY(output.try_empend(move(name_string), move(value_string)));
|
||||
}
|
||||
|
|
|
@ -647,8 +647,8 @@ void dump_font_face_rule(StringBuilder& builder, CSS::CSSFontFaceRule const& rul
|
|||
builder.append("sources:\n"sv);
|
||||
for (auto const& source : font_face.sources()) {
|
||||
indent(builder, indent_levels + 2);
|
||||
if (source.local_or_url.has<AK::URL>())
|
||||
builder.appendff("url={}, format={}\n", source.local_or_url.get<AK::URL>(), source.format.value_or("???"_string));
|
||||
if (source.local_or_url.has<URL>())
|
||||
builder.appendff("url={}, format={}\n", source.local_or_url.get<URL>(), source.format.value_or("???"_string));
|
||||
else
|
||||
builder.appendff("local={}\n", source.local_or_url.get<AK::String>());
|
||||
}
|
||||
|
|
|
@ -1335,9 +1335,9 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_network_or_cache_fet
|
|||
}
|
||||
|
||||
// 11. If httpRequest’s referrer is a URL, then:
|
||||
if (http_request->referrer().has<AK::URL>()) {
|
||||
if (http_request->referrer().has<URL>()) {
|
||||
// 1. Let referrerValue be httpRequest’s referrer, serialized and isomorphic encoded.
|
||||
auto referrer_value = TRY_OR_THROW_OOM(vm, ByteBuffer::copy(http_request->referrer().get<AK::URL>().serialize().bytes()));
|
||||
auto referrer_value = TRY_OR_THROW_OOM(vm, ByteBuffer::copy(http_request->referrer().get<URL>().serialize().bytes()));
|
||||
|
||||
// 2. Append (`Referer`, referrerValue) to httpRequest’s header list.
|
||||
auto header = Infrastructure::Header {
|
||||
|
|
|
@ -44,7 +44,7 @@ JS::NonnullGCPtr<Request> Request::create(JS::VM& vm)
|
|||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-url
|
||||
AK::URL& Request::url()
|
||||
URL& Request::url()
|
||||
{
|
||||
// A request has an associated URL (a URL).
|
||||
// NOTE: Implementations are encouraged to make this a pointer to the first URL in request’s URL list. It is provided as a distinct field solely for the convenience of other standards hooking into Fetch.
|
||||
|
@ -53,13 +53,13 @@ AK::URL& Request::url()
|
|||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-url
|
||||
AK::URL const& Request::url() const
|
||||
URL const& Request::url() const
|
||||
{
|
||||
return const_cast<Request&>(*this).url();
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-current-url
|
||||
AK::URL& Request::current_url()
|
||||
URL& Request::current_url()
|
||||
{
|
||||
// A request has an associated current URL. It is a pointer to the last URL in request’s URL list.
|
||||
VERIFY(!m_url_list.is_empty());
|
||||
|
@ -67,12 +67,12 @@ AK::URL& Request::current_url()
|
|||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-current-url
|
||||
AK::URL const& Request::current_url() const
|
||||
URL const& Request::current_url() const
|
||||
{
|
||||
return const_cast<Request&>(*this).current_url();
|
||||
}
|
||||
|
||||
void Request::set_url(AK::URL url)
|
||||
void Request::set_url(URL url)
|
||||
{
|
||||
// Sometimes setting the URL and URL list are done as two distinct steps in the spec,
|
||||
// but since we know the URL is always the URL list's first item and doesn't change later
|
||||
|
@ -163,7 +163,7 @@ bool Request::has_redirect_tainted_origin() const
|
|||
// A request request has a redirect-tainted origin if these steps return true:
|
||||
|
||||
// 1. Let lastURL be null.
|
||||
Optional<AK::URL const&> last_url;
|
||||
Optional<URL const&> last_url;
|
||||
|
||||
// 2. For each url of request’s URL list:
|
||||
for (auto const& url : m_url_list) {
|
||||
|
|
|
@ -164,7 +164,7 @@ public:
|
|||
using BodyType = Variant<Empty, ByteBuffer, JS::NonnullGCPtr<Body>>;
|
||||
using OriginType = Variant<Origin, HTML::Origin>;
|
||||
using PolicyContainerType = Variant<PolicyContainer, HTML::PolicyContainer>;
|
||||
using ReferrerType = Variant<Referrer, AK::URL>;
|
||||
using ReferrerType = Variant<Referrer, URL>;
|
||||
using ReservedClientType = Variant<Empty, HTML::Environment*, JS::GCPtr<HTML::EnvironmentSettingsObject>>;
|
||||
using WindowType = Variant<Window, JS::GCPtr<HTML::EnvironmentSettingsObject>>;
|
||||
|
||||
|
@ -263,9 +263,9 @@ public:
|
|||
[[nodiscard]] bool render_blocking() const { return m_render_blocking; }
|
||||
void set_render_blocking(bool render_blocking) { m_render_blocking = render_blocking; }
|
||||
|
||||
[[nodiscard]] Vector<AK::URL> const& url_list() const { return m_url_list; }
|
||||
[[nodiscard]] Vector<AK::URL>& url_list() { return m_url_list; }
|
||||
void set_url_list(Vector<AK::URL> url_list) { m_url_list = move(url_list); }
|
||||
[[nodiscard]] Vector<URL> const& url_list() const { return m_url_list; }
|
||||
[[nodiscard]] Vector<URL>& url_list() { return m_url_list; }
|
||||
void set_url_list(Vector<URL> url_list) { m_url_list = move(url_list); }
|
||||
|
||||
[[nodiscard]] u8 redirect_count() const { return m_redirect_count; }
|
||||
void set_redirect_count(u8 redirect_count) { m_redirect_count = redirect_count; }
|
||||
|
@ -288,11 +288,11 @@ public:
|
|||
[[nodiscard]] bool timing_allow_failed() const { return m_timing_allow_failed; }
|
||||
void set_timing_allow_failed(bool timing_allow_failed) { m_timing_allow_failed = timing_allow_failed; }
|
||||
|
||||
[[nodiscard]] AK::URL& url();
|
||||
[[nodiscard]] AK::URL const& url() const;
|
||||
[[nodiscard]] AK::URL& current_url();
|
||||
[[nodiscard]] AK::URL const& current_url() const;
|
||||
void set_url(AK::URL url);
|
||||
[[nodiscard]] URL& url();
|
||||
[[nodiscard]] URL const& url() const;
|
||||
[[nodiscard]] URL& current_url();
|
||||
[[nodiscard]] URL const& current_url() const;
|
||||
void set_url(URL url);
|
||||
|
||||
[[nodiscard]] bool destination_is_script_like() const;
|
||||
|
||||
|
@ -487,7 +487,7 @@ private:
|
|||
// https://fetch.spec.whatwg.org/#concept-request-url-list
|
||||
// A request has an associated URL list (a list of one or more URLs). Unless stated otherwise, it is a list
|
||||
// containing a copy of request’s URL.
|
||||
Vector<AK::URL> m_url_list;
|
||||
Vector<URL> m_url_list;
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-redirect-count
|
||||
// A request has an associated redirect count. Unless stated otherwise, it is zero.
|
||||
|
|
|
@ -104,7 +104,7 @@ bool Response::is_network_error() const
|
|||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-response-url
|
||||
Optional<AK::URL const&> Response::url() const
|
||||
Optional<URL const&> Response::url() const
|
||||
{
|
||||
// A response has an associated URL. It is a pointer to the last URL in response’s URL list and null if response’s URL list is empty.
|
||||
// NOTE: We have to use the virtual getter here to not bypass filtered responses.
|
||||
|
@ -114,23 +114,23 @@ Optional<AK::URL const&> Response::url() const
|
|||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-response-location-url
|
||||
ErrorOr<Optional<AK::URL>> Response::location_url(Optional<String> const& request_fragment) const
|
||||
ErrorOr<Optional<URL>> Response::location_url(Optional<String> const& request_fragment) const
|
||||
{
|
||||
// The location URL of a response response, given null or an ASCII string requestFragment, is the value returned by the following steps. They return null, failure, or a URL.
|
||||
|
||||
// 1. If response’s status is not a redirect status, then return null.
|
||||
// NOTE: We have to use the virtual getter here to not bypass filtered responses.
|
||||
if (!is_redirect_status(status()))
|
||||
return Optional<AK::URL> {};
|
||||
return Optional<URL> {};
|
||||
|
||||
// 2. Let location be the result of extracting header list values given `Location` and response’s header list.
|
||||
auto location_values_or_failure = TRY(extract_header_list_values("Location"sv.bytes(), m_header_list));
|
||||
if (location_values_or_failure.has<Infrastructure::ExtractHeaderParseFailure>() || location_values_or_failure.has<Empty>())
|
||||
return Optional<AK::URL> {};
|
||||
return Optional<URL> {};
|
||||
|
||||
auto const& location_values = location_values_or_failure.get<Vector<ByteBuffer>>();
|
||||
if (location_values.size() != 1)
|
||||
return Optional<AK::URL> {};
|
||||
return Optional<URL> {};
|
||||
|
||||
// 3. If location is a header value, then set location to the result of parsing location with response’s URL.
|
||||
auto location = DOMURL::parse(location_values.first(), url());
|
||||
|
|
|
@ -65,9 +65,9 @@ public:
|
|||
[[nodiscard]] virtual bool aborted() const { return m_aborted; }
|
||||
void set_aborted(bool aborted) { m_aborted = aborted; }
|
||||
|
||||
[[nodiscard]] virtual Vector<AK::URL> const& url_list() const { return m_url_list; }
|
||||
[[nodiscard]] virtual Vector<AK::URL>& url_list() { return m_url_list; }
|
||||
void set_url_list(Vector<AK::URL> url_list) { m_url_list = move(url_list); }
|
||||
[[nodiscard]] virtual Vector<URL> const& url_list() const { return m_url_list; }
|
||||
[[nodiscard]] virtual Vector<URL>& url_list() { return m_url_list; }
|
||||
void set_url_list(Vector<URL> url_list) { m_url_list = move(url_list); }
|
||||
|
||||
[[nodiscard]] virtual Status status() const { return m_status; }
|
||||
void set_status(Status status) { m_status = status; }
|
||||
|
@ -106,8 +106,8 @@ public:
|
|||
[[nodiscard]] bool is_aborted_network_error() const;
|
||||
[[nodiscard]] bool is_network_error() const;
|
||||
|
||||
[[nodiscard]] Optional<AK::URL const&> url() const;
|
||||
[[nodiscard]] ErrorOr<Optional<AK::URL>> location_url(Optional<String> const& request_fragment) const;
|
||||
[[nodiscard]] Optional<URL const&> url() const;
|
||||
[[nodiscard]] ErrorOr<Optional<URL>> location_url(Optional<String> const& request_fragment) const;
|
||||
|
||||
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<Response>> clone(JS::Realm&) const;
|
||||
|
||||
|
@ -134,7 +134,7 @@ private:
|
|||
|
||||
// https://fetch.spec.whatwg.org/#concept-response-url-list
|
||||
// A response has an associated URL list (a list of zero or more URLs). Unless stated otherwise, it is the empty list.
|
||||
Vector<AK::URL> m_url_list;
|
||||
Vector<URL> m_url_list;
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-response-status
|
||||
// A response has an associated status, which is a status. Unless stated otherwise it is 200.
|
||||
|
@ -197,8 +197,8 @@ public:
|
|||
|
||||
[[nodiscard]] virtual Type type() const override { return m_internal_response->type(); }
|
||||
[[nodiscard]] virtual bool aborted() const override { return m_internal_response->aborted(); }
|
||||
[[nodiscard]] virtual Vector<AK::URL> const& url_list() const override { return m_internal_response->url_list(); }
|
||||
[[nodiscard]] virtual Vector<AK::URL>& url_list() override { return m_internal_response->url_list(); }
|
||||
[[nodiscard]] virtual Vector<URL> const& url_list() const override { return m_internal_response->url_list(); }
|
||||
[[nodiscard]] virtual Vector<URL>& url_list() override { return m_internal_response->url_list(); }
|
||||
[[nodiscard]] virtual Status status() const override { return m_internal_response->status(); }
|
||||
[[nodiscard]] virtual ReadonlyBytes status_message() const override { return m_internal_response->status_message(); }
|
||||
[[nodiscard]] virtual JS::NonnullGCPtr<HeaderList> header_list() const override { return m_internal_response->header_list(); }
|
||||
|
@ -268,8 +268,8 @@ public:
|
|||
[[nodiscard]] static JS::NonnullGCPtr<OpaqueFilteredResponse> create(JS::VM&, JS::NonnullGCPtr<Response>);
|
||||
|
||||
[[nodiscard]] virtual Type type() const override { return Type::Opaque; }
|
||||
[[nodiscard]] virtual Vector<AK::URL> const& url_list() const override { return m_url_list; }
|
||||
[[nodiscard]] virtual Vector<AK::URL>& url_list() override { return m_url_list; }
|
||||
[[nodiscard]] virtual Vector<URL> const& url_list() const override { return m_url_list; }
|
||||
[[nodiscard]] virtual Vector<URL>& url_list() override { return m_url_list; }
|
||||
[[nodiscard]] virtual Status status() const override { return 0; }
|
||||
[[nodiscard]] virtual ReadonlyBytes status_message() const override { return {}; }
|
||||
[[nodiscard]] virtual JS::NonnullGCPtr<HeaderList> header_list() const override { return m_header_list; }
|
||||
|
@ -281,7 +281,7 @@ private:
|
|||
|
||||
virtual void visit_edges(JS::Cell::Visitor&) override;
|
||||
|
||||
Vector<AK::URL> m_url_list;
|
||||
Vector<URL> m_url_list;
|
||||
JS::NonnullGCPtr<HeaderList> m_header_list;
|
||||
JS::GCPtr<Body> m_body;
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
namespace Web::Fetch::Infrastructure {
|
||||
|
||||
// https://fetch.spec.whatwg.org/#is-local
|
||||
bool is_local_url(AK::URL const& url)
|
||||
bool is_local_url(URL const& url)
|
||||
{
|
||||
// A URL is local if its scheme is a local scheme.
|
||||
return any_of(LOCAL_SCHEMES, [&](auto scheme) { return url.scheme() == scheme; });
|
||||
|
|
|
@ -33,7 +33,7 @@ inline constexpr Array FETCH_SCHEMES = {
|
|||
"resource"sv
|
||||
};
|
||||
|
||||
[[nodiscard]] bool is_local_url(AK::URL const&);
|
||||
[[nodiscard]] bool is_local_url(URL const&);
|
||||
[[nodiscard]] bool is_fetch_scheme(StringView);
|
||||
[[nodiscard]] bool is_http_or_https_scheme(StringView);
|
||||
|
||||
|
|
|
@ -548,7 +548,7 @@ WebIDL::ExceptionOr<String> Request::referrer() const
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
},
|
||||
[&](AK::URL const& url) -> WebIDL::ExceptionOr<String> {
|
||||
[&](URL const& url) -> WebIDL::ExceptionOr<String> {
|
||||
// 3. Return this’s request’s referrer, serialized.
|
||||
return TRY_OR_THROW_OOM(vm, String::from_byte_string(url.serialize()));
|
||||
});
|
||||
|
|
|
@ -239,7 +239,7 @@ WebIDL::ExceptionOr<String> Response::url() const
|
|||
// The url getter steps are to return the empty string if this’s response’s URL is null; otherwise this’s response’s URL, serialized with exclude fragment set to true.
|
||||
return !m_response->url().has_value()
|
||||
? String {}
|
||||
: TRY_OR_THROW_OOM(vm, String::from_byte_string(m_response->url()->serialize(AK::URL::ExcludeFragment::Yes)));
|
||||
: TRY_OR_THROW_OOM(vm, String::from_byte_string(m_response->url()->serialize(URL::ExcludeFragment::Yes)));
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#dom-response-redirected
|
||||
|
|
|
@ -82,7 +82,7 @@ ErrorOr<void> remove_entry_from_blob_url_store(StringView url)
|
|||
auto& store = blob_url_store();
|
||||
|
||||
// 2. Let url string be the result of serializing url.
|
||||
auto url_string = TRY(AK::URL { url }.to_string());
|
||||
auto url_string = TRY(URL { url }.to_string());
|
||||
|
||||
// 3. Remove store[url string].
|
||||
store.remove(url_string);
|
||||
|
|
|
@ -70,7 +70,7 @@ WebIDL::ExceptionOr<FileReader::Result> FileReader::blob_package_data(JS::Realm&
|
|||
// Return bytes as a DataURL [RFC2397] subject to the considerations below:
|
||||
// Use mimeType as part of the Data URL if it is available in keeping with the Data URL specification [RFC2397].
|
||||
// If mimeType is not available return a Data URL without a media-type. [RFC2397].
|
||||
return MUST(AK::URL::create_with_data(mime_type.value_or(String {}), MUST(encode_base64(bytes)), true).to_string());
|
||||
return MUST(URL::create_with_data(mime_type.value_or(String {}), MUST(encode_base64(bytes)), true).to_string());
|
||||
case Type::Text: {
|
||||
// 1. Let encoding be failure.
|
||||
Optional<StringView> encoding;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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&);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>())
|
||||
|
|
|
@ -69,7 +69,7 @@ private:
|
|||
void update_href();
|
||||
bool cannot_navigate() const;
|
||||
|
||||
Optional<AK::URL> m_url;
|
||||
Optional<URL> m_url;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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]() {
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -22,7 +22,7 @@ class ListOfAvailableImages : public JS::Cell {
|
|||
|
||||
public:
|
||||
struct Key {
|
||||
AK::URL url;
|
||||
URL url;
|
||||
HTML::CORSSettingAttribute mode;
|
||||
Optional<HTML::Origin> origin;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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&);
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 = {};
|
||||
|
|
|
@ -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 };
|
||||
};
|
||||
|
||||
|
|
|
@ -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())));
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue