summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-09-24 14:02:47 +0100
committerLinus Groh <mail@linusgroh.de>2022-09-24 19:31:39 +0100
commitdc44effd443adb18162ab8ca86c12d651faf8d8e (patch)
treecbeaa4a9ff0dc7c354a21d7f7af22ca174c60c06 /Userland
parentc3841e1667083c4516ed37ccc72d10ee64fa4cf8 (diff)
downloadserenity-dc44effd443adb18162ab8ca86c12d651faf8d8e.zip
LibWeb: Move cross-origin AOs from Bindings/ to HTML/CrossOrigin/
These are from the HTML spec and therefore belong in the HTML/ directory in LibWeb. Bindings/ has become a bit of a dumping ground, so this is a first step towards cleaning that up.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/Bindings/CrossOriginAbstractOperations.h61
-rw-r--r--Userland/Libraries/LibWeb/Bindings/LocationObject.cpp26
-rw-r--r--Userland/Libraries/LibWeb/Bindings/LocationObject.h8
-rw-r--r--Userland/Libraries/LibWeb/Bindings/WindowProxy.cpp8
-rw-r--r--Userland/Libraries/LibWeb/CMakeLists.txt2
-rw-r--r--Userland/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.cpp (renamed from Userland/Libraries/LibWeb/Bindings/CrossOriginAbstractOperations.cpp)16
-rw-r--r--Userland/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.h25
-rw-r--r--Userland/Libraries/LibWeb/HTML/CrossOrigin/CrossOriginPropertyDescriptorMap.h50
-rw-r--r--Userland/Libraries/LibWeb/HTML/CrossOrigin/Reporting.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/Window.h8
10 files changed, 111 insertions, 97 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/CrossOriginAbstractOperations.h b/Userland/Libraries/LibWeb/Bindings/CrossOriginAbstractOperations.h
deleted file mode 100644
index a385b74d6c..0000000000
--- a/Userland/Libraries/LibWeb/Bindings/CrossOriginAbstractOperations.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <AK/Forward.h>
-#include <AK/Traits.h>
-#include <LibJS/Forward.h>
-#include <LibJS/Runtime/PropertyKey.h>
-#include <LibWeb/Forward.h>
-
-namespace Web::Bindings {
-
-struct CrossOriginProperty {
- String property;
- Optional<bool> needs_get {};
- Optional<bool> needs_set {};
-};
-
-struct CrossOriginKey {
- FlatPtr current_settings_object;
- FlatPtr relevant_settings_object;
- JS::PropertyKey property_key;
-};
-
-using CrossOriginPropertyDescriptorMap = HashMap<CrossOriginKey, JS::PropertyDescriptor>;
-
-Vector<CrossOriginProperty> cross_origin_properties(Variant<LocationObject const*, HTML::Window const*> const&);
-bool is_cross_origin_accessible_window_property_name(JS::PropertyKey const&);
-JS::ThrowCompletionOr<JS::PropertyDescriptor> cross_origin_property_fallback(JS::VM&, JS::PropertyKey const&);
-bool is_platform_object_same_origin(JS::Object const&);
-Optional<JS::PropertyDescriptor> cross_origin_get_own_property_helper(Variant<LocationObject*, HTML::Window*> const&, JS::PropertyKey const&);
-JS::ThrowCompletionOr<JS::Value> cross_origin_get(JS::VM&, JS::Object const&, JS::PropertyKey const&, JS::Value receiver);
-JS::ThrowCompletionOr<bool> cross_origin_set(JS::VM&, JS::Object&, JS::PropertyKey const&, JS::Value, JS::Value receiver);
-JS::MarkedVector<JS::Value> cross_origin_own_property_keys(Variant<LocationObject const*, HTML::Window const*> const&);
-
-}
-
-namespace AK {
-
-template<>
-struct Traits<Web::Bindings::CrossOriginKey> : public GenericTraits<Web::Bindings::CrossOriginKey> {
- static unsigned hash(Web::Bindings::CrossOriginKey const& key)
- {
- return pair_int_hash(
- Traits<JS::PropertyKey>::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<JS::PropertyKey>::equals(a.property_key, b.property_key);
- }
-};
-
-}
diff --git a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp
index 15851ee259..c163f375c3 100644
--- a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp
@@ -11,11 +11,11 @@
#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/PropertyDescriptor.h>
#include <LibJS/Runtime/PropertyKey.h>
-#include <LibWeb/Bindings/CrossOriginAbstractOperations.h>
#include <LibWeb/Bindings/LocationObject.h>
#include <LibWeb/Bindings/LocationPrototype.h>
#include <LibWeb/DOM/DOMException.h>
#include <LibWeb/DOM/Document.h>
+#include <LibWeb/HTML/CrossOrigin/AbstractOperations.h>
#include <LibWeb/HTML/Window.h>
namespace Web::Bindings {
@@ -244,7 +244,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::replace)
JS::ThrowCompletionOr<JS::Object*> LocationObject::internal_get_prototype_of() const
{
// 1. If IsPlatformObjectSameOrigin(this) is true, then return ! OrdinaryGetPrototypeOf(this).
- if (is_platform_object_same_origin(*this))
+ if (HTML::is_platform_object_same_origin(*this))
return MUST(JS::Object::internal_get_prototype_of());
// 2. Return null.
@@ -278,7 +278,7 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> LocationObject::internal
auto& vm = this->vm();
// 1. If IsPlatformObjectSameOrigin(this) is true, then:
- if (is_platform_object_same_origin(*this)) {
+ if (HTML::is_platform_object_same_origin(*this)) {
// 1. Let desc be OrdinaryGetOwnProperty(this, P).
auto descriptor = MUST(Object::internal_get_own_property(property_key));
@@ -294,21 +294,21 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> LocationObject::internal
}
// 2. Let property be CrossOriginGetOwnPropertyHelper(this, P).
- auto property = cross_origin_get_own_property_helper(const_cast<LocationObject*>(this), property_key);
+ auto property = HTML::cross_origin_get_own_property_helper(const_cast<LocationObject*>(this), property_key);
// 3. If property is not undefined, then return property.
if (property.has_value())
return property;
// 4. Return ? CrossOriginPropertyFallback(P).
- return TRY(cross_origin_property_fallback(vm, property_key));
+ return TRY(HTML::cross_origin_property_fallback(vm, property_key));
}
// 7.10.5.6 [[DefineOwnProperty]] ( P, Desc ), https://html.spec.whatwg.org/multipage/history.html#location-defineownproperty
JS::ThrowCompletionOr<bool> LocationObject::internal_define_own_property(JS::PropertyKey const& property_key, JS::PropertyDescriptor const& descriptor)
{
// 1. If IsPlatformObjectSameOrigin(this) is true, then:
- if (is_platform_object_same_origin(*this)) {
+ if (HTML::is_platform_object_same_origin(*this)) {
// 1. If the value of the [[DefaultProperties]] internal slot of this contains P, then return false.
// 2. Return ? OrdinaryDefineOwnProperty(this, P, Desc).
return JS::Object::internal_define_own_property(property_key, descriptor);
@@ -324,11 +324,11 @@ JS::ThrowCompletionOr<JS::Value> LocationObject::internal_get(JS::PropertyKey co
auto& vm = this->vm();
// 1. If IsPlatformObjectSameOrigin(this) is true, then return ? OrdinaryGet(this, P, Receiver).
- if (is_platform_object_same_origin(*this))
+ if (HTML::is_platform_object_same_origin(*this))
return JS::Object::internal_get(property_key, receiver);
// 2. Return ? CrossOriginGet(this, P, Receiver).
- return cross_origin_get(vm, static_cast<JS::Object const&>(*this), property_key, receiver);
+ return HTML::cross_origin_get(vm, static_cast<JS::Object const&>(*this), property_key, receiver);
}
// 7.10.5.8 [[Set]] ( P, V, Receiver ), https://html.spec.whatwg.org/multipage/history.html#location-set
@@ -337,18 +337,18 @@ JS::ThrowCompletionOr<bool> LocationObject::internal_set(JS::PropertyKey const&
auto& vm = this->vm();
// 1. If IsPlatformObjectSameOrigin(this) is true, then return ? OrdinarySet(this, P, V, Receiver).
- if (is_platform_object_same_origin(*this))
+ if (HTML::is_platform_object_same_origin(*this))
return JS::Object::internal_set(property_key, value, receiver);
// 2. Return ? CrossOriginSet(this, P, V, Receiver).
- return cross_origin_set(vm, static_cast<JS::Object&>(*this), property_key, value, receiver);
+ return HTML::cross_origin_set(vm, static_cast<JS::Object&>(*this), property_key, value, receiver);
}
// 7.10.5.9 [[Delete]] ( P ), https://html.spec.whatwg.org/multipage/history.html#location-delete
JS::ThrowCompletionOr<bool> LocationObject::internal_delete(JS::PropertyKey const& property_key)
{
// 1. If IsPlatformObjectSameOrigin(this) is true, then return ? OrdinaryDelete(this, P).
- if (is_platform_object_same_origin(*this))
+ if (HTML::is_platform_object_same_origin(*this))
return JS::Object::internal_delete(property_key);
// 2. Throw a "SecurityError" DOMException.
@@ -359,11 +359,11 @@ JS::ThrowCompletionOr<bool> LocationObject::internal_delete(JS::PropertyKey cons
JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> LocationObject::internal_own_property_keys() const
{
// 1. If IsPlatformObjectSameOrigin(this) is true, then return OrdinaryOwnPropertyKeys(this).
- if (is_platform_object_same_origin(*this))
+ if (HTML::is_platform_object_same_origin(*this))
return JS::Object::internal_own_property_keys();
// 2. Return CrossOriginOwnPropertyKeys(this).
- return cross_origin_own_property_keys(this);
+ return HTML::cross_origin_own_property_keys(this);
}
}
diff --git a/Userland/Libraries/LibWeb/Bindings/LocationObject.h b/Userland/Libraries/LibWeb/Bindings/LocationObject.h
index 6bb3716f25..7bbd11f28c 100644
--- a/Userland/Libraries/LibWeb/Bindings/LocationObject.h
+++ b/Userland/Libraries/LibWeb/Bindings/LocationObject.h
@@ -10,9 +10,9 @@
#include <AK/URL.h>
#include <LibJS/Forward.h>
#include <LibJS/Runtime/Completion.h>
-#include <LibWeb/Bindings/CrossOriginAbstractOperations.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/Forward.h>
+#include <LibWeb/HTML/CrossOrigin/CrossOriginPropertyDescriptorMap.h>
namespace Web {
namespace Bindings {
@@ -34,8 +34,8 @@ public:
virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const&) override;
virtual JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> internal_own_property_keys() const override;
- CrossOriginPropertyDescriptorMap const& cross_origin_property_descriptor_map() const { return m_cross_origin_property_descriptor_map; }
- CrossOriginPropertyDescriptorMap& cross_origin_property_descriptor_map() { return m_cross_origin_property_descriptor_map; }
+ HTML::CrossOriginPropertyDescriptorMap const& cross_origin_property_descriptor_map() const { return m_cross_origin_property_descriptor_map; }
+ HTML::CrossOriginPropertyDescriptorMap& cross_origin_property_descriptor_map() { return m_cross_origin_property_descriptor_map; }
private:
explicit LocationObject(JS::Realm&);
@@ -61,7 +61,7 @@ private:
JS_DECLARE_NATIVE_FUNCTION(port_getter);
// [[CrossOriginPropertyDescriptorMap]], https://html.spec.whatwg.org/multipage/browsers.html#crossoriginpropertydescriptormap
- CrossOriginPropertyDescriptorMap m_cross_origin_property_descriptor_map;
+ HTML::CrossOriginPropertyDescriptorMap m_cross_origin_property_descriptor_map;
// [[DefaultProperties]], https://html.spec.whatwg.org/multipage/history.html#defaultproperties
Vector<JS::Value> m_default_properties;
diff --git a/Userland/Libraries/LibWeb/Bindings/WindowProxy.cpp b/Userland/Libraries/LibWeb/Bindings/WindowProxy.cpp
index 98e42cf524..84fe0dddef 100644
--- a/Userland/Libraries/LibWeb/Bindings/WindowProxy.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/WindowProxy.cpp
@@ -10,9 +10,9 @@
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/PropertyDescriptor.h>
#include <LibJS/Runtime/PropertyKey.h>
-#include <LibWeb/Bindings/CrossOriginAbstractOperations.h>
#include <LibWeb/Bindings/WindowProxy.h>
#include <LibWeb/DOM/DOMException.h>
+#include <LibWeb/HTML/CrossOrigin/AbstractOperations.h>
#include <LibWeb/HTML/CrossOrigin/Reporting.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Window.h>
@@ -120,7 +120,7 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> WindowProxy::internal_ge
}
// 7. Return ? CrossOriginPropertyFallback(P).
- return TRY(cross_origin_property_fallback(vm, property_key));
+ return TRY(HTML::cross_origin_property_fallback(vm, property_key));
}
// 7.4.6 [[DefineOwnProperty]] ( P, Desc ), https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-defineownproperty
@@ -160,7 +160,7 @@ JS::ThrowCompletionOr<JS::Value> WindowProxy::internal_get(JS::PropertyKey const
// 4. Return ? CrossOriginGet(this, P, Receiver).
// NOTE: this is passed rather than W as OrdinaryGet and CrossOriginGet will invoke the [[GetOwnProperty]] internal method.
- return cross_origin_get(vm, *this, property_key, receiver);
+ return HTML::cross_origin_get(vm, *this, property_key, receiver);
}
// 7.4.8 [[Set]] ( P, V, Receiver ), https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-set
@@ -185,7 +185,7 @@ JS::ThrowCompletionOr<bool> WindowProxy::internal_set(JS::PropertyKey const& pro
// 4. Return ? CrossOriginSet(this, P, V, Receiver).
// NOTE: this is passed rather than W as CrossOriginSet will invoke the [[GetOwnProperty]] internal method.
- return cross_origin_set(vm, *this, property_key, value, receiver);
+ return HTML::cross_origin_set(vm, *this, property_key, value, receiver);
}
// 7.4.9 [[Delete]] ( P ), https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-delete
diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt
index 71c94e0fdc..4b8b280e74 100644
--- a/Userland/Libraries/LibWeb/CMakeLists.txt
+++ b/Userland/Libraries/LibWeb/CMakeLists.txt
@@ -4,7 +4,6 @@ set(SOURCES
Bindings/AudioConstructor.cpp
Bindings/CSSNamespace.cpp
Bindings/CallbackType.cpp
- Bindings/CrossOriginAbstractOperations.cpp
Bindings/IDLAbstractOperations.cpp
Bindings/IDLOverloadResolution.cpp
Bindings/ImageConstructor.cpp
@@ -152,6 +151,7 @@ set(SOURCES
HTML/CanvasGradient.cpp
HTML/CanvasRenderingContext2D.cpp
HTML/CloseEvent.cpp
+ HTML/CrossOrigin/AbstractOperations.cpp
HTML/CrossOrigin/Reporting.cpp
HTML/DOMParser.cpp
HTML/DOMStringMap.cpp
diff --git a/Userland/Libraries/LibWeb/Bindings/CrossOriginAbstractOperations.cpp b/Userland/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.cpp
index ab1b1512d8..6909effd5e 100644
--- a/Userland/Libraries/LibWeb/Bindings/CrossOriginAbstractOperations.cpp
+++ b/Userland/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.cpp
@@ -13,23 +13,23 @@
#include <LibJS/Runtime/Object.h>
#include <LibJS/Runtime/PropertyDescriptor.h>
#include <LibJS/Runtime/PropertyKey.h>
-#include <LibWeb/Bindings/CrossOriginAbstractOperations.h>
#include <LibWeb/Bindings/LocationObject.h>
#include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/DOM/DOMException.h>
+#include <LibWeb/HTML/CrossOrigin/AbstractOperations.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Window.h>
-namespace Web::Bindings {
+namespace Web::HTML {
// 7.2.3.1 CrossOriginProperties ( O ), https://html.spec.whatwg.org/multipage/browsers.html#crossoriginproperties-(-o-)
-Vector<CrossOriginProperty> cross_origin_properties(Variant<LocationObject const*, HTML::Window const*> const& object)
+Vector<CrossOriginProperty> cross_origin_properties(Variant<Bindings::LocationObject const*, HTML::Window const*> const& object)
{
// 1. Assert: O is a Location or Window object.
return object.visit(
// 2. If O is a Location object, then return ยซ { [[Property]]: "href", [[NeedsGet]]: false, [[NeedsSet]]: true }, { [[Property]]: "replace" } ยป.
- [](LocationObject const*) -> Vector<CrossOriginProperty> {
+ [](Bindings::LocationObject const*) -> Vector<CrossOriginProperty> {
return {
{ .property = "href"sv, .needs_get = false, .needs_set = true },
{ .property = "replace"sv },
@@ -89,11 +89,11 @@ bool is_platform_object_same_origin(JS::Object const& object)
}
// 7.2.3.4 CrossOriginGetOwnPropertyHelper ( O, P ), https://html.spec.whatwg.org/multipage/browsers.html#crossorigingetownpropertyhelper-(-o,-p-)
-Optional<JS::PropertyDescriptor> cross_origin_get_own_property_helper(Variant<LocationObject*, HTML::Window*> const& object, JS::PropertyKey const& property_key)
+Optional<JS::PropertyDescriptor> cross_origin_get_own_property_helper(Variant<Bindings::LocationObject*, HTML::Window*> const& object, JS::PropertyKey const& property_key)
{
- auto& realm = *main_thread_vm().current_realm();
+ auto& realm = *Bindings::main_thread_vm().current_realm();
auto const* object_ptr = object.visit([](auto* o) { return static_cast<JS::Object const*>(o); });
- auto const object_const_variant = object.visit([](auto* o) { return Variant<LocationObject const*, HTML::Window const*> { o }; });
+ auto const object_const_variant = object.visit([](auto* o) { return Variant<Bindings::LocationObject const*, HTML::Window const*> { o }; });
// 1. Let crossOriginKey be a tuple consisting of the current settings object, O's relevant settings object, and P.
auto cross_origin_key = CrossOriginKey {
@@ -226,7 +226,7 @@ JS::ThrowCompletionOr<bool> cross_origin_set(JS::VM& vm, JS::Object& object, JS:
}
// 7.2.3.7 CrossOriginOwnPropertyKeys ( O ), https://html.spec.whatwg.org/multipage/browsers.html#crossoriginownpropertykeys-(-o-)
-JS::MarkedVector<JS::Value> cross_origin_own_property_keys(Variant<LocationObject const*, HTML::Window const*> const& object)
+JS::MarkedVector<JS::Value> cross_origin_own_property_keys(Variant<Bindings::LocationObject const*, HTML::Window const*> const& object)
{
auto& event_loop = HTML::main_thread_event_loop();
auto& vm = event_loop.vm();
diff --git a/Userland/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.h b/Userland/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.h
new file mode 100644
index 0000000000..3e68e34761
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Forward.h>
+#include <LibJS/Forward.h>
+#include <LibWeb/Forward.h>
+#include <LibWeb/HTML/CrossOrigin/CrossOriginPropertyDescriptorMap.h>
+
+namespace Web::HTML {
+
+Vector<CrossOriginProperty> cross_origin_properties(Variant<Bindings::LocationObject const*, HTML::Window const*> const&);
+bool is_cross_origin_accessible_window_property_name(JS::PropertyKey const&);
+JS::ThrowCompletionOr<JS::PropertyDescriptor> cross_origin_property_fallback(JS::VM&, JS::PropertyKey const&);
+bool is_platform_object_same_origin(JS::Object const&);
+Optional<JS::PropertyDescriptor> cross_origin_get_own_property_helper(Variant<Bindings::LocationObject*, HTML::Window*> const&, JS::PropertyKey const&);
+JS::ThrowCompletionOr<JS::Value> cross_origin_get(JS::VM&, JS::Object const&, JS::PropertyKey const&, JS::Value receiver);
+JS::ThrowCompletionOr<bool> cross_origin_set(JS::VM&, JS::Object&, JS::PropertyKey const&, JS::Value, JS::Value receiver);
+JS::MarkedVector<JS::Value> cross_origin_own_property_keys(Variant<Bindings::LocationObject const*, HTML::Window const*> const&);
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/CrossOrigin/CrossOriginPropertyDescriptorMap.h b/Userland/Libraries/LibWeb/HTML/CrossOrigin/CrossOriginPropertyDescriptorMap.h
new file mode 100644
index 0000000000..1aebdc0385
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/CrossOrigin/CrossOriginPropertyDescriptorMap.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Forward.h>
+#include <AK/Traits.h>
+#include <LibJS/Forward.h>
+
+namespace Web::HTML {
+
+struct CrossOriginProperty {
+ String property;
+ Optional<bool> needs_get {};
+ Optional<bool> needs_set {};
+};
+
+struct CrossOriginKey {
+ FlatPtr current_settings_object;
+ FlatPtr relevant_settings_object;
+ JS::PropertyKey property_key;
+};
+
+using CrossOriginPropertyDescriptorMap = HashMap<CrossOriginKey, JS::PropertyDescriptor>;
+
+}
+
+namespace AK {
+
+template<>
+struct Traits<Web::HTML::CrossOriginKey> : public GenericTraits<Web::HTML::CrossOriginKey> {
+ static unsigned hash(Web::HTML::CrossOriginKey const& key)
+ {
+ return pair_int_hash(
+ Traits<JS::PropertyKey>::hash(key.property_key),
+ pair_int_hash(ptr_hash(key.current_settings_object), ptr_hash(key.relevant_settings_object)));
+ }
+
+ static bool equals(Web::HTML::CrossOriginKey const& a, Web::HTML::CrossOriginKey const& b)
+ {
+ return a.current_settings_object == b.current_settings_object
+ && a.relevant_settings_object == b.relevant_settings_object
+ && Traits<JS::PropertyKey>::equals(a.property_key, b.property_key);
+ }
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/CrossOrigin/Reporting.cpp b/Userland/Libraries/LibWeb/HTML/CrossOrigin/Reporting.cpp
index ab801138af..b3b940fbfe 100644
--- a/Userland/Libraries/LibWeb/HTML/CrossOrigin/Reporting.cpp
+++ b/Userland/Libraries/LibWeb/HTML/CrossOrigin/Reporting.cpp
@@ -5,8 +5,8 @@
*/
#include <LibJS/Runtime/PropertyKey.h>
-#include <LibWeb/Bindings/CrossOriginAbstractOperations.h>
#include <LibWeb/HTML/BrowsingContext.h>
+#include <LibWeb/HTML/CrossOrigin/AbstractOperations.h>
#include <LibWeb/HTML/CrossOrigin/Reporting.h>
namespace Web::HTML {
@@ -15,7 +15,7 @@ namespace Web::HTML {
void check_if_access_between_two_browsing_contexts_should_be_reported(BrowsingContext const& accessor, BrowsingContext const& accessed, JS::PropertyKey const& property_key, EnvironmentSettingsObject const& environment)
{
// 1. If P is not a cross-origin accessible window property name, then return.
- if (!Bindings::is_cross_origin_accessible_window_property_name(property_key))
+ if (!is_cross_origin_accessible_window_property_name(property_key))
return;
// FIXME: 2. If accessor's active document's origin or any of its ancestors' active document's origins are not same origin with accessor's top-level browsing context's active document's origin, or if accessed's active document's origin or any of its ancestors' active document's origins are not same origin with accessed's top-level browsing context's active document's origin, then return.
diff --git a/Userland/Libraries/LibWeb/HTML/Window.h b/Userland/Libraries/LibWeb/HTML/Window.h
index f44f048be1..85a50d2213 100644
--- a/Userland/Libraries/LibWeb/HTML/Window.h
+++ b/Userland/Libraries/LibWeb/HTML/Window.h
@@ -13,10 +13,10 @@
#include <AK/TypeCasts.h>
#include <AK/URL.h>
#include <LibJS/Heap/Heap.h>
-#include <LibWeb/Bindings/CrossOriginAbstractOperations.h>
#include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/AnimationFrameCallbackDriver.h>
+#include <LibWeb/HTML/CrossOrigin/CrossOriginPropertyDescriptorMap.h>
#include <LibWeb/HTML/GlobalEventHandlers.h>
#include <LibWeb/HTML/WindowEventHandlers.h>
@@ -202,8 +202,8 @@ public:
virtual JS::ThrowCompletionOr<bool> internal_set_prototype_of(JS::Object* prototype) override;
- Bindings::CrossOriginPropertyDescriptorMap const& cross_origin_property_descriptor_map() const { return m_cross_origin_property_descriptor_map; }
- Bindings::CrossOriginPropertyDescriptorMap& cross_origin_property_descriptor_map() { return m_cross_origin_property_descriptor_map; }
+ CrossOriginPropertyDescriptorMap const& cross_origin_property_descriptor_map() const { return m_cross_origin_property_descriptor_map; }
+ CrossOriginPropertyDescriptorMap& cross_origin_property_descriptor_map() { return m_cross_origin_property_descriptor_map; }
private:
JS_DECLARE_NATIVE_FUNCTION(length_getter);
@@ -287,7 +287,7 @@ private:
HashMap<String, JS::NativeFunction*> m_constructors;
// [[CrossOriginPropertyDescriptorMap]], https://html.spec.whatwg.org/multipage/browsers.html#crossoriginpropertydescriptormap
- Bindings::CrossOriginPropertyDescriptorMap m_cross_origin_property_descriptor_map;
+ CrossOriginPropertyDescriptorMap m_cross_origin_property_descriptor_map;
};
void run_animation_frame_callbacks(DOM::Document&, double now);