PolicyContainers.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibIPC/Forward.h>
  8. #include <LibWeb/HTML/EmbedderPolicy.h>
  9. #include <LibWeb/ReferrerPolicy/ReferrerPolicy.h>
  10. namespace Web::HTML {
  11. // https://html.spec.whatwg.org/multipage/origin.html#policy-container
  12. // A policy container is a struct containing policies that apply to a Document, a WorkerGlobalScope, or a WorkletGlobalScope. It has the following items:
  13. struct PolicyContainer {
  14. // https://html.spec.whatwg.org/multipage/origin.html#policy-container-csp-list
  15. // FIXME: A CSP list, which is a CSP list. It is initially empty.
  16. // https://html.spec.whatwg.org/multipage/origin.html#policy-container-embedder-policy
  17. // An embedder policy, which is an embedder policy. It is initially a new embedder policy.
  18. EmbedderPolicy embedder_policy {};
  19. // https://html.spec.whatwg.org/multipage/origin.html#policy-container-referrer-policy
  20. // A referrer policy, which is a referrer policy. It is initially the default referrer policy.
  21. ReferrerPolicy::ReferrerPolicy referrer_policy { ReferrerPolicy::DEFAULT_REFERRER_POLICY };
  22. };
  23. }
  24. namespace IPC {
  25. template<>
  26. ErrorOr<void> encode(IPC::Encoder&, Web::HTML::PolicyContainer const&);
  27. template<>
  28. ErrorOr<Web::HTML::PolicyContainer> decode(IPC::Decoder&);
  29. }