mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-04 16:11:54 +00:00
LibURL+LibWeb: Port URL::complete_url to Optional
Removing one more source of the URL::is_valid API.
This commit is contained in:
parent
356728b1e0
commit
53826995f6
Notes:
github-actions[bot]
2025-02-15 17:07:12 +00:00
Author: https://github.com/shannonbooth
Commit: 53826995f6
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3586
Reviewed-by: https://github.com/tcl3 ✅
14 changed files with 57 additions and 52 deletions
|
@ -74,12 +74,12 @@ void HTMLBaseElement::set_the_frozen_base_url()
|
|||
|
||||
// 3. Set element's frozen base URL to document's fallback base URL, if urlRecord is failure or running Is base allowed for Document? on the resulting URL record and document returns "Blocked", and to urlRecord otherwise.
|
||||
// FIXME: Apply "Is base allowed for Document?" CSP
|
||||
if (!url_record.is_valid()) {
|
||||
if (!url_record.has_value()) {
|
||||
m_frozen_base_url = document.fallback_base_url();
|
||||
return;
|
||||
}
|
||||
|
||||
m_frozen_base_url = move(url_record);
|
||||
m_frozen_base_url = url_record.release_value();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#dom-base-href
|
||||
|
@ -96,11 +96,11 @@ String HTMLBaseElement::href() const
|
|||
auto url_record = document.fallback_base_url().complete_url(url);
|
||||
|
||||
// 4. If urlRecord is failure, return url.
|
||||
if (!url_record.is_valid())
|
||||
if (!url_record.has_value())
|
||||
return url;
|
||||
|
||||
// 5. Return the serialization of urlRecord.
|
||||
return url_record.to_string();
|
||||
return url_record->to_string();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#dom-base-href
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue