mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +00:00
Ladybird+LibWeb: Add about scheme support for internal pages
This commit is contained in:
parent
c0acb2918b
commit
05c0640474
4 changed files with 26 additions and 0 deletions
14
Base/res/ladybird/about.html
Normal file
14
Base/res/ladybird/about.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>About URLs</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>List of About URLs</h1>
|
||||||
|
<ul>
|
||||||
|
<li><a href="about:about">about:about</a></li>
|
||||||
|
<li><a href="about:newtab">about:newtab</a></li>
|
||||||
|
</ul>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -294,6 +294,7 @@ if (current_os == "mac") {
|
||||||
|
|
||||||
bundle_data("ladybird_web_resources") {
|
bundle_data("ladybird_web_resources") {
|
||||||
sources = [
|
sources = [
|
||||||
|
"//Base/res/ladybird/about.html",
|
||||||
"//Base/res/ladybird/inspector.css",
|
"//Base/res/ladybird/inspector.css",
|
||||||
"//Base/res/ladybird/inspector.js",
|
"//Base/res/ladybird/inspector.js",
|
||||||
"//Base/res/ladybird/newtab.html",
|
"//Base/res/ladybird/newtab.html",
|
||||||
|
|
|
@ -718,6 +718,9 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> scheme_fetch(JS::Realm& r
|
||||||
response->set_body(MUST(Infrastructure::byte_sequence_as_body(realm, ""sv.bytes())));
|
response->set_body(MUST(Infrastructure::byte_sequence_as_body(realm, ""sv.bytes())));
|
||||||
return PendingResponse::create(vm, request, response);
|
return PendingResponse::create(vm, request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: This is actually wrong, see note above.
|
||||||
|
return TRY(nonstandard_resource_loader_file_or_http_network_fetch(realm, fetch_params));
|
||||||
}
|
}
|
||||||
// -> "blob"
|
// -> "blob"
|
||||||
else if (request->current_url().scheme() == "blob"sv) {
|
else if (request->current_url().scheme() == "blob"sv) {
|
||||||
|
|
|
@ -230,6 +230,14 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
|
||||||
HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> response_headers;
|
HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> response_headers;
|
||||||
response_headers.set("Content-Type", "text/html; charset=UTF-8");
|
response_headers.set("Content-Type", "text/html; charset=UTF-8");
|
||||||
|
|
||||||
|
// Other about static HTML pages
|
||||||
|
auto resource = Core::Resource::load_from_uri(MUST(String::formatted("resource://ladybird/{}.html", url.path_segment_at_index(0))));
|
||||||
|
if (!resource.is_error()) {
|
||||||
|
auto data = resource.value()->data();
|
||||||
|
success_callback(data, response_headers, {});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Platform::EventLoopPlugin::the().deferred_invoke([success_callback = move(success_callback), response_headers = move(response_headers)] {
|
Platform::EventLoopPlugin::the().deferred_invoke([success_callback = move(success_callback), response_headers = move(response_headers)] {
|
||||||
success_callback(ByteString::empty().to_byte_buffer(), response_headers, {});
|
success_callback(ByteString::empty().to_byte_buffer(), response_headers, {});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue