Truly independent web browser
Meta: Support [Exposed=Window] attributes in the Rust bindings
Shannon Booth5fa8610492ed
diff --git a/Meta/Generators/libweb_bindings/rust_bindings.py b/Meta/Generators/libweb_bindings/rust_bindings.pyindex 7457bc6b8c2..6e3a9d4482f 100644--- a/Meta/Generators/libweb_bindings/rust_bindings.py+++ b/Meta/Generators/libweb_bindings/rust_bindings.py@@ -1384,13 +1384,21 @@ def write_rust_interface(is_secure_context_only = "SecureContext" in attribute.attribute.extended_attributesif attribute.is_cached:definition = f'define_cached_attribute(vm, realm, prototype, "{name}", {getter});'- out.write(member_exposure_definition(definition, secure_context_only=is_secure_context_only))+ out.write(+ member_exposure_definition(+ definition, secure_context_only=is_secure_context_only, window_only=attribute.is_window_only+ )+ )defined_property_names.append(name)continuehas_setter = not attribute.attribute.readonly or attribute.put_forwards is not Nonesetter = f"raw_native!({attribute.setter_function})" if has_setter else "None"definition = f'define_attribute(vm, realm, prototype, "{name}", {getter}, {setter});'- out.write(member_exposure_definition(definition, secure_context_only=is_secure_context_only))+ out.write(+ member_exposure_definition(+ definition, secure_context_only=is_secure_context_only, window_only=attribute.is_window_only+ )+ )defined_property_names.append(name)if interface.name == "CSSStyleProperties":out.write(diff --git a/Meta/Generators/libweb_bindings/rust_members.py b/Meta/Generators/libweb_bindings/rust_members.pyindex ba35e332f92..8048786fba7 100644--- a/Meta/Generators/libweb_bindings/rust_members.py+++ b/Meta/Generators/libweb_bindings/rust_members.py@@ -39,6 +39,7 @@ SUPPORTED_ATTRIBUTE_EXTENDED_ATTRIBUTES = {"AttributeCallbackName","CachedAccessor","CEReactions",+ "Exposed","FIXME","ImplementedAs","LegacyNullToEmptyString",@@ -103,6 +104,11 @@ class RustAttribute:def returns_js_value(self) -> bool:return "ReturnsJSValue" in self.attribute.extended_attributes+ @property+ def is_window_only(self) -> bool:+ """Whether only a Window has the attribute: [Exposed=Window] on an interface exposed elsewhere as well."""+ return self.attribute.extended_attributes.get("Exposed") == SUPPORTED_MEMBER_EXPOSURE+@propertydef function_stem(self) -> str:"""What the generated native functions are named after. [AttributeCallbackName] tells apart the attributes that@@ -539,6 +545,7 @@ def rust_members(interface: Interface) -> RustMembers:check_extended_attributes(attribute.name, attribute.extended_attributes, SUPPORTED_ATTRIBUTE_EXTENDED_ATTRIBUTES)+ check_exposure(attribute.name, attribute.extended_attributes)if "FIXME" in attribute.extended_attributes:members.attributes_in_order.append(attribute.name)continue