Skip to content

Commit 1716d9d

Browse files
committed
vaev-loader: Added spec comment and link to about:blank handling.
1 parent 11df882 commit 1716d9d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/vaev-engine/loader/loader.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,17 @@ Async::_Task<Rc<Font::Database>> _loadFontfacesAsync(Http::Client& client, Style
175175
static auto dumpDom = Debug::Flag::debug("web-dom", "Dump the loaded DOM tree");
176176
static auto dumpStylesheets = Debug::Flag::debug("web-stylesheets", "Dump the loaded stylesheets");
177177

178-
static Str ABOUT_BLANK = R"html(<!DOCTYPE html><html><head></head><body></body></html>)html";
179-
178+
// https://fetch.spec.whatwg.org/#scheme-fetch
180179
export Async::Task<Gc::Ref<Dom::Document>> fetchDocumentAsync(Gc::Heap& heap, Http::Client& client, Ref::Url const& url) {
181180
Ref::Url resolvedUrl = url;
182-
if (url.scheme == "about" and url.path.str() == "blank")
183-
resolvedUrl = Ref::Url::data("text/html"_mime, bytes(ABOUT_BLANK));
181+
182+
// If request’s current URL’s path is the string "blank",
183+
if (url.scheme == "about" and url.path.str() == "blank") {
184+
// then return a new response whose status message is `OK`,
185+
// header list is « (`Content-Type`, `text/html;charset=utf-8`) »
186+
// and body is the empty byte sequence as a body.
187+
resolvedUrl = Ref::Url::data("text/html"_mime, {});
188+
}
184189

185190
auto resp = co_trya$(client.getAsync(resolvedUrl));
186191
auto dom = co_trya$(_loadDocumentAsync(heap, url, resp));

0 commit comments

Comments
 (0)