mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb+LibURL: Move HTML::Origin to URL::Origin
While Origin is defined in the HTML spec - this leaves us with quite an awkward relationship as the URL spec makes use of AO's from what is defined in the HTML spec. To simplify this factoring, relocate Origin into LibURL.
This commit is contained in:
parent
e9dd05b2b5
commit
dc401f49ea
Notes:
github-actions[bot]
2024-10-05 08:47:56 +00:00
Author: https://github.com/shannonbooth
Commit: dc401f49ea
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1636
55 changed files with 143 additions and 157 deletions
|
@ -152,7 +152,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Infrastructure::FetchController>> fetch(JS:
|
|||
// - request’s unsafe-request flag is not set or request’s header list is empty
|
||||
&& (!request.unsafe_request() || request.header_list()->is_empty())) {
|
||||
// 1. Assert: request’s origin is same origin with request’s client’s origin.
|
||||
VERIFY(request.origin().has<HTML::Origin>() && request.origin().get<HTML::Origin>().is_same_origin(request.client()->origin()));
|
||||
VERIFY(request.origin().has<URL::Origin>() && request.origin().get<URL::Origin>().is_same_origin(request.client()->origin()));
|
||||
|
||||
// 2. Let onPreloadedResponseAvailable be an algorithm that runs the following step given a response
|
||||
// response: set fetchParams’s preloaded response candidate to response.
|
||||
|
@ -353,7 +353,7 @@ WebIDL::ExceptionOr<JS::GCPtr<PendingResponse>> main_fetch(JS::Realm& realm, Inf
|
|||
// -> request’s current URL’s scheme is "data"
|
||||
// -> request’s mode is "navigate" or "websocket"
|
||||
else if (
|
||||
(request->origin().has<HTML::Origin>() && DOMURL::url_origin(request->current_url()).is_same_origin(request->origin().get<HTML::Origin>()) && request->response_tainting() == Infrastructure::Request::ResponseTainting::Basic)
|
||||
(request->origin().has<URL::Origin>() && DOMURL::url_origin(request->current_url()).is_same_origin(request->origin().get<URL::Origin>()) && request->response_tainting() == Infrastructure::Request::ResponseTainting::Basic)
|
||||
|| request->current_url().scheme() == "data"sv
|
||||
|| (request->mode() == Infrastructure::Request::Mode::Navigate || request->mode() == Infrastructure::Request::Mode::WebSocket)) {
|
||||
// 1. Set request’s response tainting to "basic".
|
||||
|
@ -919,7 +919,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> scheme_fetch(JS::Realm& r
|
|||
else if (request->current_url().scheme() == "file"sv || request->current_url().scheme() == "resource"sv) {
|
||||
// For now, unfortunate as it is, file: URLs are left as an exercise for the reader.
|
||||
// When in doubt, return a network error.
|
||||
if (request->origin().has<HTML::Origin>() && (request->origin().get<HTML::Origin>().is_opaque() || request->origin().get<HTML::Origin>().scheme() == "file"sv || request->origin().get<HTML::Origin>().scheme() == "resource"sv))
|
||||
if (request->origin().has<URL::Origin>() && (request->origin().get<URL::Origin>().is_opaque() || request->origin().get<URL::Origin>().scheme() == "file"sv || request->origin().get<URL::Origin>().scheme() == "resource"sv))
|
||||
return TRY(nonstandard_resource_loader_file_or_http_network_fetch(realm, fetch_params));
|
||||
else
|
||||
return PendingResponse::create(vm, request, Infrastructure::Response::network_error(vm, "Request with 'file:' or 'resource:' URL blocked"sv));
|
||||
|
@ -1200,8 +1200,8 @@ WebIDL::ExceptionOr<JS::GCPtr<PendingResponse>> http_redirect_fetch(JS::Realm& r
|
|||
// locationURL’s origin, then return a network error.
|
||||
if (request->mode() == Infrastructure::Request::Mode::CORS
|
||||
&& location_url.includes_credentials()
|
||||
&& request->origin().has<HTML::Origin>()
|
||||
&& !request->origin().get<HTML::Origin>().is_same_origin(DOMURL::url_origin(location_url))) {
|
||||
&& request->origin().has<URL::Origin>()
|
||||
&& !request->origin().get<URL::Origin>().is_same_origin(DOMURL::url_origin(location_url))) {
|
||||
return PendingResponse::create(vm, request, Infrastructure::Response::network_error(vm, "Request with 'cors' mode and different URL and request origin must not include credentials in redirect URL"sv));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue