1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-03 11:13:38 +00:00

LibWeb: Avoid null dereference when performing mixed content checks

Previously, navigating to or from `about:newtab` caused a crash due to
inadvertent null dereferences when checking whether a request or
response to a request should be blocked as mixed content.

(cherry picked from commit 572ebe00eacd5aaeecc17207c75c6bf2327a3897)
This commit is contained in:
Tim Ledbetter 2024-06-14 00:53:04 +01:00 committed by Nico Weber
parent 3d467182bc
commit 166130e12d

View File

@ -80,7 +80,7 @@ Fetch::Infrastructure::RequestOrResponseBlocking should_fetching_request_be_bloc
|| false
// 4. requests destination is "document", and requests target browsing context has no parent browsing context.
|| (request.destination() == Fetch::Infrastructure::Request::Destination::Document && !request.client()->target_browsing_context->parent())) {
|| (request.destination() == Fetch::Infrastructure::Request::Destination::Document && !(request.client()->target_browsing_context && request.client()->target_browsing_context->parent()))) {
return Fetch::Infrastructure::RequestOrResponseBlocking::Allowed;
}
@ -104,7 +104,7 @@ Web::Fetch::Infrastructure::RequestOrResponseBlocking should_response_to_request
|| false
// 4. requests destination is "document", and requests target browsing context has no parent browsing context.
|| (request.destination() == Fetch::Infrastructure::Request::Destination::Document && !request.client()->target_browsing_context->parent())) {
|| (request.destination() == Fetch::Infrastructure::Request::Destination::Document && !(request.client()->target_browsing_context && request.client()->target_browsing_context->parent()))) {
return Fetch::Infrastructure::RequestOrResponseBlocking::Allowed;
}