1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-29 17:25:10 +00:00

LibWeb: Add facilities to serialize EnvironmentSettingsObjects

This will be used to transfer information about the parent context to
DedicatedWorkers and future out-of-process Worker/Worklet
implementations for fetching purposes. In order to properly check
same-origin and other policies, we need to know more about the outside
settings than we were previously passing to the WebWorker process.
This commit is contained in:
Andrew Kaster 2024-03-05 09:29:14 -07:00 committed by Andreas Kling
parent c79bac70f4
commit 4d22358e05
11 changed files with 198 additions and 5 deletions

View file

@ -489,4 +489,22 @@ bool is_non_secure_context(Environment const& environment)
return !is_secure_context(environment);
}
SerializedEnvironmentSettingsObject EnvironmentSettingsObject::serialize()
{
SerializedEnvironmentSettingsObject object;
object.id = this->id;
object.creation_url = this->creation_url;
object.top_level_creation_url = this->top_level_creation_url;
object.top_level_origin = this->top_level_origin;
object.api_url_character_encoding = api_url_character_encoding();
object.api_base_url = api_base_url();
object.origin = origin();
object.policy_container = policy_container();
object.cross_origin_isolated_capability = cross_origin_isolated_capability();
return object;
}
}