1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 23:24:57 +00:00

LibWeb: Add 'is scripting enabled' concept to EnvironmentSettingsObject

This is now the source of truth for 'user enabled/disabled scripting',
but it has to ask the window's page, which actually stores the setting.

Also use this new functionality in two places where it was previously
marked as a FIXME.
This commit is contained in:
Linus Groh 2022-03-30 22:42:09 +01:00 committed by Andreas Kling
parent f60a2a1d80
commit 7bdbac7fd9
6 changed files with 42 additions and 4 deletions

View file

@ -24,7 +24,9 @@ NonnullRefPtr<ClassicScript> ClassicScript::create(String filename, StringView s
if (muted_errors == MutedErrors::Yes)
base_url = "about:blank";
// FIXME: 3. If scripting is disabled for settings, then set source to the empty string.
// 3. If scripting is disabled for settings, then set source to the empty string.
if (environment_settings_object.is_scripting_disabled())
source = "";
// 4. Let script be a new classic script that this algorithm will subsequently initialize.
auto script = adopt_ref(*new ClassicScript(move(base_url), move(filename), environment_settings_object));