mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-01 07:35:02 +03:00
WebContent: Add "load-reference-page" debug request
This attempts to load the URL of the first `<link rel="match" href=""/>` it finds. If that tag is missing, we load an error page to make sure the ref-test fails. (And to provide some feedback if someone looks at the screenshot somehow.) Wrong URLs will instead end up loading the default 404 error page.
This commit is contained in:
parent
7ba686dcb3
commit
f3add3dd72
Notes:
sideshowbarker
2024-07-16 22:24:48 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/f3add3dd72 Pull-request: https://github.com/SerenityOS/serenity/pull/21049 Reviewed-by: https://github.com/kalenikaliaksandr ✅
@ -459,6 +459,21 @@ void ConnectionFromClient::debug_request(DeprecatedString const& request, Deprec
|
||||
document->window().local_storage().release_value_but_fixme_should_propagate_errors()->dump();
|
||||
return;
|
||||
}
|
||||
|
||||
if (request == "load-reference-page") {
|
||||
if (auto* document = page().top_level_browsing_context().active_document()) {
|
||||
auto maybe_link = document->query_selector("link[rel=match]"sv);
|
||||
if (maybe_link.is_error() || !maybe_link.value()) {
|
||||
// To make sure that we fail the ref-test if the link is missing, load the error page.
|
||||
load_html("<h1>Failed to find <link rel="match" /> in ref test page!</h1> Make sure you added it.", "about:blank"sv);
|
||||
} else {
|
||||
auto link = maybe_link.release_value();
|
||||
auto url = document->parse_url(link->get_attribute(Web::HTML::AttributeNames::href));
|
||||
load_url(url);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionFromClient::get_source()
|
||||
|
Loading…
Reference in New Issue
Block a user