Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.1

0.6.1 / src / web / content_security_policy / directives / names.lucb

#==============================================================================================
#
#   names - Names: the names of the CSP directives
#
#   DESCRIPTION:
#       Port of Libraries/LibWeb/ContentSecurityPolicy/Directives/Names.cpp (lines 1-16) with
#       Names.h's ENUMERATE_DIRECTIVE_NAMES. C++ initializes the FlyStrings statically; here
#       content_security_policy_directives_names_initialize_strings interns them at run time and
#       web_initialize_strings runs it at startup (DESIGN.md ยง2.6).
#
#       Copyright (c) 2025, Luke Wilde <luke@ladybird.org>
#       SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================

## Whether content_security_policy_directives_names_initialize_strings has run.
var content_security_policy_directives_names_strings_initialized: bool

## Ported from Libraries/LibWeb/ContentSecurityPolicy/Directives/Names.cpp:11 the definitions of
## Web::ContentSecurityPolicy::Directives::Names's FlyStrings (`FlyString name = value##_fly_string;` for each ENUMERATE_DIRECTIVE_NAMES entry).
pub func content_security_policy_directives_names_initialize_strings():
    if content_security_policy_directives_names_strings_initialized:
        return
    content_security_policy_directives_names_base_uri = ak.fly_string_from_str("base-uri")
    content_security_policy_directives_names_child_src = ak.fly_string_from_str("child-src")
    content_security_policy_directives_names_connect_src = ak.fly_string_from_str("connect-src")
    content_security_policy_directives_names_default_src = ak.fly_string_from_str("default-src")
    content_security_policy_directives_names_font_src = ak.fly_string_from_str("font-src")
    content_security_policy_directives_names_form_action = ak.fly_string_from_str("form-action")
    content_security_policy_directives_names_frame_ancestors = ak.fly_string_from_str("frame-ancestors")
    content_security_policy_directives_names_frame_src = ak.fly_string_from_str("frame-src")
    content_security_policy_directives_names_img_src = ak.fly_string_from_str("img-src")
    content_security_policy_directives_names_manifest_src = ak.fly_string_from_str("manifest-src")
    content_security_policy_directives_names_media_src = ak.fly_string_from_str("media-src")
    content_security_policy_directives_names_object_src = ak.fly_string_from_str("object-src")
    content_security_policy_directives_names_report_to = ak.fly_string_from_str("report-to")
    content_security_policy_directives_names_report_uri = ak.fly_string_from_str("report-uri")
    content_security_policy_directives_names_require_trusted_types_for = ak.fly_string_from_str("require-trusted-types-for")
    content_security_policy_directives_names_sandbox = ak.fly_string_from_str("sandbox")
    content_security_policy_directives_names_script_src = ak.fly_string_from_str("script-src")
    content_security_policy_directives_names_script_src_elem = ak.fly_string_from_str("script-src-elem")
    content_security_policy_directives_names_script_src_attr = ak.fly_string_from_str("script-src-attr")
    content_security_policy_directives_names_style_src = ak.fly_string_from_str("style-src")
    content_security_policy_directives_names_style_src_elem = ak.fly_string_from_str("style-src-elem")
    content_security_policy_directives_names_style_src_attr = ak.fly_string_from_str("style-src-attr")
    content_security_policy_directives_names_trusted_types = ak.fly_string_from_str("trusted-types")
    content_security_policy_directives_names_web_rtc = ak.fly_string_from_str("webrtc")
    content_security_policy_directives_names_worker_src = ak.fly_string_from_str("worker-src")
    content_security_policy_directives_names_strings_initialized = true