Skip to content

Commit cb15132

Browse files
committed
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.
1 parent e97cc67 commit cb15132

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ bool EnvironmentSettingsObject::is_scripting_enabled() const
244244
// The user agent supports scripting.
245245
// NOTE: This is always true in LibWeb :^)
246246

247+
// FIXME: Do the right thing for workers.
248+
if (!is<HTML::Window>(m_realm_execution_context->realm->global_object()))
249+
return true;
250+
247251
// 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.)
248252
auto document = const_cast<EnvironmentSettingsObject&>(*this).responsible_document();
249253
VERIFY(document);

0 commit comments

Comments
 (0)