diff options
author | davidot <david.tuin@gmail.com> | 2021-07-24 12:23:37 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-07-26 15:56:15 +0100 |
commit | a67f0cbfa2bc1682c8675f3f7b20bba61001e302 (patch) | |
tree | 95819c4341e2efaea90d26d43a98e9add31fcb16 /Userland/Libraries/LibWeb/Bindings | |
parent | e42eaa5d956fb27df131202f9684cfb3fdf7a055 (diff) | |
download | serenity-a67f0cbfa2bc1682c8675f3f7b20bba61001e302.zip |
LibWeb: Make the custom CSSDeclaration methods only work on strings
Otherwise it will try to convert it to a string later anyway. And as far
as I'm aware there are no style properties with just a number or
JavaScript symbol as name.
Diffstat (limited to 'Userland/Libraries/LibWeb/Bindings')
-rw-r--r-- | Userland/Libraries/LibWeb/Bindings/CSSStyleDeclarationWrapperCustom.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/CSSStyleDeclarationWrapperCustom.cpp b/Userland/Libraries/LibWeb/Bindings/CSSStyleDeclarationWrapperCustom.cpp index 15b9d29759..606dbf299e 100644 --- a/Userland/Libraries/LibWeb/Bindings/CSSStyleDeclarationWrapperCustom.cpp +++ b/Userland/Libraries/LibWeb/Bindings/CSSStyleDeclarationWrapperCustom.cpp @@ -13,13 +13,17 @@ namespace Web::Bindings { bool CSSStyleDeclarationWrapper::internal_has_property(JS::PropertyName const& name) const { + if (!name.is_string()) + return Base::internal_has_property(name); // FIXME: These should actually use camelCase versions of the property names! auto property_id = CSS::property_id_from_string(name.to_string()); return property_id != CSS::PropertyID::Invalid; } -JS::Value CSSStyleDeclarationWrapper::internal_get(const JS::PropertyName& name, JS::Value receiver) const +JS::Value CSSStyleDeclarationWrapper::internal_get(JS::PropertyName const& name, JS::Value receiver) const { + if (!name.is_string()) + return Base::internal_get(name, receiver); // FIXME: These should actually use camelCase versions of the property names! auto property_id = CSS::property_id_from_string(name.to_string()); if (property_id == CSS::PropertyID::Invalid) @@ -31,8 +35,10 @@ JS::Value CSSStyleDeclarationWrapper::internal_get(const JS::PropertyName& name, return js_string(vm(), String::empty()); } -bool CSSStyleDeclarationWrapper::internal_set(const JS::PropertyName& name, JS::Value value, JS::Value receiver) +bool CSSStyleDeclarationWrapper::internal_set(JS::PropertyName const& name, JS::Value value, JS::Value receiver) { + if (!name.is_string()) + return Base::internal_set(name, value, receiver); // FIXME: These should actually use camelCase versions of the property names! auto property_id = CSS::property_id_from_string(name.to_string()); if (property_id == CSS::PropertyID::Invalid) |