1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:27:43 +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

@ -847,8 +847,7 @@ void Node::serialize_tree_as_json(JsonObjectSerializer<StringBuilder>& object) c
bool Node::is_scripting_enabled() const
{
// Scripting is enabled for a node node if node's node document's browsing context is non-null, and scripting is enabled for node's relevant settings object.
// FIXME: Check if scripting is enabled for the ESO.
return document().browsing_context();
return document().browsing_context() && const_cast<Document&>(document()).relevant_settings_object().is_scripting_enabled();
}
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-n-noscript