mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Attach blob to URL on DOMURL::parse
On a non-basic URL parse, we are meant to perform a lookup on the blob URL registry and attach any blob to that URL if present. Now - we do that :^)
This commit is contained in:
parent
4f30d50dc9
commit
2457fdc7a4
Notes:
sideshowbarker
2024-07-16 20:39:14 +09:00
Author: https://github.com/shannonbooth
Commit: 2457fdc7a4
Pull-request: https://github.com/SerenityOS/serenity/pull/24220
Reviewed-by: https://github.com/kennethmyhra
1 changed files with 10 additions and 4 deletions
|
@ -575,14 +575,20 @@ URL::URL parse(StringView input, Optional<URL::URL> const& base_url)
|
|||
if (!url.is_valid())
|
||||
return {};
|
||||
|
||||
// 3. If url’s scheme is not "blob",
|
||||
// 3. If url’s scheme is not "blob", return url.
|
||||
if (url.scheme() != "blob")
|
||||
return url;
|
||||
|
||||
// FIXME: 4. Set url’s blob URL entry to the result of resolving the blob URL url,
|
||||
// FIXME: 5. if that did not return failure, and null otherwise.
|
||||
// 4. Set url’s blob URL entry to the result of resolving the blob URL url, if that did not return failure, and null otherwise.
|
||||
auto blob_url_entry = FileAPI::resolve_a_blob_url(url);
|
||||
if (blob_url_entry.has_value()) {
|
||||
url.set_blob_url_entry(URL::BlobURLEntry {
|
||||
.type = blob_url_entry->object->type(),
|
||||
.byte_buffer = MUST(ByteBuffer::copy(blob_url_entry->object->bytes())),
|
||||
});
|
||||
}
|
||||
|
||||
// 6. Return url
|
||||
// 5. Return url
|
||||
return url;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue