mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-18 15:32:22 +00:00
LibWeb+LibURL: Use URL paths directly for comparison
This matches the text of the spec a little more closely in many cases and is also more efficient than serializing the URL path.
This commit is contained in:
parent
ea68bdef26
commit
ffe070d7f9
Notes:
github-actions[bot]
2024-08-05 07:59:07 +00:00
Author: https://github.com/shannonbooth
Commit: ffe070d7f9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/966
5 changed files with 9 additions and 11 deletions
|
@ -799,7 +799,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> scheme_fetch(JS::Realm& r
|
|||
// a body.
|
||||
// NOTE: URLs such as "about:config" are handled during navigation and result in a network error in the context
|
||||
// of fetching.
|
||||
if (request->current_url().serialize_path() == "blank"sv) {
|
||||
if (request->current_url().paths().size() == 1 && request->current_url().paths()[0] == "blank"sv) {
|
||||
auto response = Infrastructure::Response::create(vm);
|
||||
response->set_status_message(MUST(ByteBuffer::copy("OK"sv.bytes())));
|
||||
|
||||
|
|
|
@ -310,7 +310,8 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Request>> Request::construct_impl(JS::Realm
|
|||
// - parsedReferrer’s origin is not same origin with origin
|
||||
// then set request’s referrer to "client".
|
||||
auto parsed_referrer_origin = DOMURL::url_origin(parsed_referrer);
|
||||
if ((parsed_referrer.scheme() == "about"sv && parsed_referrer.serialize_path() == "client"sv) || !parsed_referrer_origin.is_same_origin(origin)) {
|
||||
if ((parsed_referrer.scheme() == "about"sv && parsed_referrer.paths().size() == 1 && parsed_referrer.paths()[0] == "client"sv)
|
||||
|| !parsed_referrer_origin.is_same_origin(origin)) {
|
||||
request->set_referrer(Infrastructure::Request::Referrer::Client);
|
||||
}
|
||||
// 4. Otherwise, set request’s referrer to parsedReferrer.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue