LibWeb: Handle blob URLs in Document::parse_url

Implement this function to the spec, and use the full blown URL parser
that handles blob URLs, instead of the basic-url-parser.

Also clean up a FIXME that does not seem relevant any more.
This commit is contained in:
Shannon Booth 2024-05-05 19:54:42 +12:00 committed by Andrew Kaster
parent 95c6fdf401
commit c071720430
Notes: sideshowbarker 2024-07-16 22:11:09 +09:00

View file

@ -53,6 +53,7 @@
#include <LibWeb/DOM/ShadowRoot.h>
#include <LibWeb/DOM/Text.h>
#include <LibWeb/DOM/TreeWalker.h>
#include <LibWeb/DOMURL/DOMURL.h>
#include <LibWeb/Dump.h>
#include <LibWeb/Fetch/Infrastructure/HTTP/Responses.h>
#include <LibWeb/FileAPI/BlobURLStore.h>
@ -982,8 +983,11 @@ URL::URL Document::base_url() const
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#parse-a-url
URL::URL Document::parse_url(StringView url) const
{
// FIXME: Pass in document's character encoding.
return base_url().complete_url(url);
// 1. Let baseURL be environment's base URL, if environment is a Document object; otherwise environment's API base URL.
auto base_url = this->base_url();
// 2. Return the result of applying the URL parser to url, with baseURL.
return DOMURL::parse(url, base_url);
}
void Document::set_needs_layout()