summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Wanner <skyrising@pvpctutorials.de>2022-04-03 21:42:50 +0200
committerAndreas Kling <kling@serenityos.org>2022-04-03 23:12:13 +0200
commitfe0f0b0acfad80bc89f66028b5767df124d9d7e5 (patch)
tree3a81ea7141435665994d4cbab7069ebb00658938
parent9765f9f67ed5bbb6a77b10d0ec23381c12c0dbd2 (diff)
downloadserenity-fe0f0b0acfad80bc89f66028b5767df124d9d7e5.zip
LibWeb: Add a null-check for page() in ESO::is_scripting_enabled()
This could lead to a crash when spamming reload on a page with a <script> element.
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp
index 658f635bf3..23abf2c1f8 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp
@@ -247,7 +247,7 @@ bool EnvironmentSettingsObject::is_scripting_enabled() const
// The user has not disabled scripting for settings at this time. (User agents may provide users with the option to disable scripting globally, or in a finer-grained manner, e.g., on a per-origin basis, down to the level of individual environment settings objects.)
auto document = const_cast<EnvironmentSettingsObject&>(*this).responsible_document();
VERIFY(document);
- if (!document->window().page()->is_scripting_enabled())
+ if (!document->page() || !document->page()->is_scripting_enabled())
return false;
// FIXME: Either settings's global object is not a Window object, or settings's global object's associated Document's active sandboxing flag set does not have its sandboxed scripts browsing context flag set.