/* * Copyright (c) 2022, Linus Groh * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Web::Bindings { struct CrossOriginProperty { String property; Optional needs_get {}; Optional needs_set {}; }; struct CrossOriginKey { FlatPtr current_settings_object; FlatPtr relevant_settings_object; JS::PropertyKey property_key; }; using CrossOriginPropertyDescriptorMap = HashMap; Vector cross_origin_properties(Variant const&); bool is_cross_origin_accessible_window_property_name(JS::PropertyKey const&); JS::ThrowCompletionOr cross_origin_property_fallback(JS::GlobalObject&, JS::PropertyKey const&); bool is_platform_object_same_origin(JS::Object const&); Optional cross_origin_get_own_property_helper(Variant const&, JS::PropertyKey const&); JS::ThrowCompletionOr cross_origin_get(JS::GlobalObject&, JS::Object const&, JS::PropertyKey const&, JS::Value receiver); JS::ThrowCompletionOr cross_origin_set(JS::GlobalObject&, JS::Object&, JS::PropertyKey const&, JS::Value, JS::Value receiver); JS::MarkedVector cross_origin_own_property_keys(Variant const&); } namespace AK { template<> struct Traits : public GenericTraits { static unsigned hash(Web::Bindings::CrossOriginKey const& key) { return pair_int_hash( Traits::hash(key.property_key), pair_int_hash(ptr_hash(key.current_settings_object), ptr_hash(key.relevant_settings_object))); } static bool equals(Web::Bindings::CrossOriginKey const& a, Web::Bindings::CrossOriginKey const& b) { return a.current_settings_object == b.current_settings_object && a.relevant_settings_object == b.relevant_settings_object && Traits::equals(a.property_key, b.property_key); } }; }