Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

fix(geometry): expose fromPoint as an enumerable WebIDL operation

ldm0c4c6a7786508
diff --git a/moli-renderer-v8/src/context_bootstrap/geometry_runtime.rs b/moli-renderer-v8/src/context_bootstrap/geometry_runtime.rs
index 6fee76e76..756b54052 100644
--- a/moli-renderer-v8/src/context_bootstrap/geometry_runtime.rs
+++ b/moli-renderer-v8/src/context_bootstrap/geometry_runtime.rs
@@ -202,7 +202,7 @@ struct DomPointPrototypeMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(interface = web_api_interfaces::DOMPoint)]
+#[webapi(interface = web_api_interfaces::DOMPoint, enumerable)]
struct DomPointConstructorDeclaration {
#[webapi(static_method = "fromPoint", length = 0, callback = dom_point_from_point_callback)]
from_point: (),
diff --git a/moli-renderer-v8/src/script_vm/tests/browser_api/misc/extracted/webidl_surface.rs b/moli-renderer-v8/src/script_vm/tests/browser_api/misc/extracted/webidl_surface.rs
index c727df2d8..1d872068d 100644
--- a/moli-renderer-v8/src/script_vm/tests/browser_api/misc/extracted/webidl_surface.rs
+++ b/moli-renderer-v8/src/script_vm/tests/browser_api/misc/extracted/webidl_surface.rs
@@ -1888,3 +1888,20 @@ fn dom_matrix_window_operations_use_webidl_descriptors() {
"function,0,true,true,true|function,1,true,true,true|function,0,true,true,true|function,1,true,true,true|function,0,true,true,true|function,1,true,true,true"
);
}
+
+#[test]
+fn dom_point_from_point_has_a_webidl_operation_descriptor() {
+ let mut vm = new_storage_test_vm("https://geometry-descriptors.test/");
+ assert_eq!(
+ vm.eval(
+ r#"(() => {
+ const descriptor = Object.getOwnPropertyDescriptor(DOMPoint, 'fromPoint');
+ const point = descriptor.value({x: 12, y: 34});
+ return [typeof descriptor.value, descriptor.enumerable, descriptor.writable,
+ descriptor.configurable, descriptor.value.length, point.x, point.y].join('|');
+ })()"#
+ )
+ .unwrap(),
+ "function|true|true|true|0|12|34"
+ );
+}