diff options
author | Andreas Kling <kling@serenityos.org> | 2022-09-05 12:21:48 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-09-06 00:27:09 +0200 |
commit | cb151321463b133fbdfff57c0ab25da067e66410 (patch) | |
tree | 4d7e608146dffb62cfe56ae1455c17d4b8d3fd3d /Userland/Libraries/LibWeb | |
parent | e97cc671eaff2830fc1481f932378727c4136f55 (diff) | |
download | serenity-cb151321463b133fbdfff57c0ab25da067e66410.zip |
LibWeb: Always allow scripting in workers for now
Workers don't have a document, so we can't ask them if scripting is
enabled or not. This is not the right long-term fix, but it fixes an
assertion when trying to query the missing responsible document of a
web worker.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp index eea9c37b95..3d34ee10df 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp @@ -244,6 +244,10 @@ bool EnvironmentSettingsObject::is_scripting_enabled() const // The user agent supports scripting. // NOTE: This is always true in LibWeb :^) + // FIXME: Do the right thing for workers. + if (!is<HTML::Window>(m_realm_execution_context->realm->global_object())) + return true; + // 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); |