mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Allow CORS requests from opaque origins to resource:// URLs
JavaScript module requests (in a non-worker context) always have CORS enabled. However, CORS requests are only allowed for same-origin or HTTP/S requests. This patch extends this to allow resource:// requests from opaque origins (e.g. about: URLs). We must also set the Access-Control-Allow-Origin header to "null" to ensure that the response is accepted by the CORS checks. This does not affect requesting resource:// URLs from resource:// URLs as those are same-origin and skip CORS checks. This ultimately enables requesting resource:// JS modules from the about:settings page.
This commit is contained in:
parent
5f9b1d3cd4
commit
6539c72e7e
Notes:
github-actions[bot]
2025-04-24 00:00:07 +00:00
Author: https://github.com/trflynn89
Commit: 6539c72e7e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4445
2 changed files with 6 additions and 2 deletions
|
@ -142,6 +142,7 @@ static HTTP::HeaderMap response_headers_for_file(StringView path, Optional<time_
|
|||
auto mime_type = Core::guess_mime_type_based_on_filename(path);
|
||||
|
||||
HTTP::HeaderMap response_headers;
|
||||
response_headers.set("Access-Control-Allow-Origin"sv, "null"sv);
|
||||
response_headers.set("Content-Type"sv, mime_type);
|
||||
|
||||
if (modified_time.has_value()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue