LibWeb: Don't crash on named property access on detached window

In WindowProxy.[[Get]] it's not guaranteed that the current principal
global object has an associated document at the moment. This may happen
if a script is continuing to execute while a navigation has been
initiated.

Because of that, we can't blindly dereference the active document
pointer, so this patch adds a null check.
This commit is contained in:
Andreas Kling 2025-05-30 00:34:50 +02:00 committed by Andreas Kling
parent 456608cf03
commit 2eea8894a1
Notes: github-actions[bot] 2025-05-30 08:14:45 +00:00
3 changed files with 13 additions and 13 deletions

View file

@ -18,6 +18,6 @@ enum class AccessorAccessedRelationship {
None,
};
void check_if_access_between_two_browsing_contexts_should_be_reported(BrowsingContext const& accessor, BrowsingContext const* accessed, JS::PropertyKey const&, EnvironmentSettingsObject const&);
void check_if_access_between_two_browsing_contexts_should_be_reported(GC::Ptr<BrowsingContext const> accessor, GC::Ptr<BrowsingContext const> accessed, JS::PropertyKey const&, GC::Ref<EnvironmentSettingsObject const>);
}