Skip to content

Truly independent web browser

1.2 KB
Raw Blame
/*
 * Copyright (c) 2022, Andreas Kling <[email protected]>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/Utf16String.h>
#include <LibHTTP/Forward.h>
#include <LibWebCommon/Export.h>

namespace Web::HTML {

// https://html.spec.whatwg.org/multipage/origin.html#cross-origin-opener-policy-value
enum class OpenerPolicyValue {
    UnsafeNone,
    SameOriginAllowPopups,
    SameOrigin,
    SameOriginPlusCOEP,
    NoopenerAllowPopups,
};

// https://html.spec.whatwg.org/multipage/origin.html#cross-origin-opener-policy
struct OpenerPolicy {
    // A value, which is an opener policy value, initially "unsafe-none".
    OpenerPolicyValue value { OpenerPolicyValue::UnsafeNone };

    // A reporting endpoint, which is string or null, initially null.
    Optional<Utf16String> reporting_endpoint;

    // A report-only value, which is an opener policy value, initially "unsafe-none".
    OpenerPolicyValue report_only_value { OpenerPolicyValue::UnsafeNone };

    // A report-only reporting endpoint, which is a string or null, initially null.
    Optional<Utf16String> report_only_reporting_endpoint;
};

WEBCOMMON_API OpenerPolicy obtain_an_opener_policy(HTTP::HeaderList const&, bool reserved_environment_is_a_non_secure_context);

}