Skip to content

Commit

Permalink
LibWeb: Add null check to Navigable::navigate()
Browse files Browse the repository at this point in the history
This change ensures that the document's node navigable is not null when
determining if navigation is allowed by sandboxing.
  • Loading branch information
tcl3 committed Jun 19, 2024
1 parent eb4b318 commit 2e09d32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Userland/Libraries/LibWeb/HTML/Navigable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ WebIDL::ExceptionOr<void> Navigable::navigate(NavigateParams params)
auto initiator_base_url_snapshot = source_document->base_url();

// 5. If sourceDocument's node navigable is not allowed by sandboxing to navigate navigable given and sourceSnapshotParams, then:
if (!source_document->navigable()->allowed_by_sandboxing_to_navigate(*this, source_snapshot_params)) {
if (source_document->navigable() && !source_document->navigable()->allowed_by_sandboxing_to_navigate(*this, source_snapshot_params)) {
// 1. If exceptionsEnabled is true, then throw a "SecurityError" DOMException.
if (exceptions_enabled) {
return WebIDL::SecurityError::create(realm, "Source document's node navigable is not allowed to navigate"_fly_string);
Expand Down

0 comments on commit 2e09d32

Please sign in to comment.