mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 00:08:11 +00:00
LibWeb: Port CrossOriginPropertyDescriptorMap from ByteString
This commit is contained in:
parent
10e5458e27
commit
3a7fb6cf9e
2 changed files with 18 additions and 18 deletions
|
@ -31,26 +31,26 @@ Vector<CrossOriginProperty> cross_origin_properties(Variant<HTML::Location const
|
||||||
// 2. If O is a Location object, then return « { [[Property]]: "href", [[NeedsGet]]: false, [[NeedsSet]]: true }, { [[Property]]: "replace" } ».
|
// 2. If O is a Location object, then return « { [[Property]]: "href", [[NeedsGet]]: false, [[NeedsSet]]: true }, { [[Property]]: "replace" } ».
|
||||||
[](HTML::Location const*) -> Vector<CrossOriginProperty> {
|
[](HTML::Location const*) -> Vector<CrossOriginProperty> {
|
||||||
return {
|
return {
|
||||||
{ .property = "href"sv, .needs_get = false, .needs_set = true },
|
{ .property = "href"_string, .needs_get = false, .needs_set = true },
|
||||||
{ .property = "replace"sv },
|
{ .property = "replace"_string },
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
// 3. Return « { [[Property]]: "window", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "self", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "location", [[NeedsGet]]: true, [[NeedsSet]]: true }, { [[Property]]: "close" }, { [[Property]]: "closed", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "focus" }, { [[Property]]: "blur" }, { [[Property]]: "frames", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "length", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "top", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "opener", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "parent", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "postMessage" } ».
|
// 3. Return « { [[Property]]: "window", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "self", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "location", [[NeedsGet]]: true, [[NeedsSet]]: true }, { [[Property]]: "close" }, { [[Property]]: "closed", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "focus" }, { [[Property]]: "blur" }, { [[Property]]: "frames", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "length", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "top", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "opener", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "parent", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "postMessage" } ».
|
||||||
[](HTML::Window const*) -> Vector<CrossOriginProperty> {
|
[](HTML::Window const*) -> Vector<CrossOriginProperty> {
|
||||||
return {
|
return {
|
||||||
{ .property = "window"sv, .needs_get = true, .needs_set = false },
|
{ .property = "window"_string, .needs_get = true, .needs_set = false },
|
||||||
{ .property = "self"sv, .needs_get = true, .needs_set = false },
|
{ .property = "self"_string, .needs_get = true, .needs_set = false },
|
||||||
{ .property = "location"sv, .needs_get = true, .needs_set = true },
|
{ .property = "location"_string, .needs_get = true, .needs_set = true },
|
||||||
{ .property = "close"sv },
|
{ .property = "close"_string },
|
||||||
{ .property = "closed"sv, .needs_get = true, .needs_set = false },
|
{ .property = "closed"_string, .needs_get = true, .needs_set = false },
|
||||||
{ .property = "focus"sv },
|
{ .property = "focus"_string },
|
||||||
{ .property = "blur"sv },
|
{ .property = "blur"_string },
|
||||||
{ .property = "frames"sv, .needs_get = true, .needs_set = false },
|
{ .property = "frames"_string, .needs_get = true, .needs_set = false },
|
||||||
{ .property = "length"sv, .needs_get = true, .needs_set = false },
|
{ .property = "length"_string, .needs_get = true, .needs_set = false },
|
||||||
{ .property = "top"sv, .needs_get = true, .needs_set = false },
|
{ .property = "top"_string, .needs_get = true, .needs_set = false },
|
||||||
{ .property = "opener"sv, .needs_get = true, .needs_set = false },
|
{ .property = "opener"_string, .needs_get = true, .needs_set = false },
|
||||||
{ .property = "parent"sv, .needs_get = true, .needs_set = false },
|
{ .property = "parent"_string, .needs_get = true, .needs_set = false },
|
||||||
{ .property = "postMessage"sv },
|
{ .property = "postMessage"_string },
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ Optional<JS::PropertyDescriptor> cross_origin_get_own_property_helper(Variant<HT
|
||||||
if (!property_key.is_string()) {
|
if (!property_key.is_string()) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
auto const& property_key_string = property_key.as_string();
|
auto const& property_key_string = MUST(FlyString::from_deprecated_fly_string(property_key.as_string()));
|
||||||
|
|
||||||
// 2. For each e of CrossOriginProperties(O):
|
// 2. For each e of CrossOriginProperties(O):
|
||||||
for (auto const& entry : cross_origin_properties(object_const_variant)) {
|
for (auto const& entry : cross_origin_properties(object_const_variant)) {
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/ByteString.h>
|
|
||||||
#include <AK/Forward.h>
|
#include <AK/Forward.h>
|
||||||
#include <AK/Optional.h>
|
#include <AK/Optional.h>
|
||||||
|
#include <AK/String.h>
|
||||||
#include <AK/Traits.h>
|
#include <AK/Traits.h>
|
||||||
#include <LibJS/Forward.h>
|
#include <LibJS/Forward.h>
|
||||||
#include <LibJS/Runtime/PropertyKey.h>
|
#include <LibJS/Runtime/PropertyKey.h>
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
struct CrossOriginProperty {
|
struct CrossOriginProperty {
|
||||||
ByteString property;
|
String property;
|
||||||
Optional<bool> needs_get {};
|
Optional<bool> needs_get {};
|
||||||
Optional<bool> needs_set {};
|
Optional<bool> needs_set {};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue