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): align DOMMatrix operation descriptors with WebIDL

ldm0d43eb5721dba
diff --git a/moli-renderer-v8/src/context_bootstrap/geometry_runtime.rs b/moli-renderer-v8/src/context_bootstrap/geometry_runtime.rs
index b20eca932..6fee76e76 100644
--- a/moli-renderer-v8/src/context_bootstrap/geometry_runtime.rs
+++ b/moli-renderer-v8/src/context_bootstrap/geometry_runtime.rs
@@ -262,7 +262,7 @@ struct DomMatrixReadOnlyPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(interface = web_api_interfaces::DOMMatrixReadOnly)]
+#[webapi(interface = web_api_interfaces::DOMMatrixReadOnly, enumerable)]
struct DomMatrixReadOnlyPrototypeMethodsDeclaration {
#[webapi(method = "toJSON", enumerable, callback = dom_matrix_to_json_callback)]
to_json: (),
@@ -320,7 +320,7 @@ struct DomMatrixReadOnlyPrototypeMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(interface = web_api_interfaces::DOMMatrixReadOnly)]
+#[webapi(interface = web_api_interfaces::DOMMatrixReadOnly, enumerable)]
struct DomMatrixReadOnlyConstructorDeclaration {
#[webapi(
static_method = "fromMatrix",
@@ -394,7 +394,7 @@ struct DomMatrixPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(interface = web_api_interfaces::DOMMatrix)]
+#[webapi(interface = web_api_interfaces::DOMMatrix, enumerable)]
struct DomMatrixPrototypeMethodsDeclaration {
#[webapi(method = "translateSelf", callback = dom_matrix_translate_self_callback)]
translate_self: (),
@@ -435,12 +435,12 @@ struct DomMatrixPrototypeMethodsDeclaration {
#[webapi(method = "invertSelf", callback = dom_matrix_invert_self_callback)]
invert_self: (),
- #[webapi(method = "setMatrixValue", callback = dom_matrix_set_matrix_value_callback)]
+ #[webapi(method = "setMatrixValue", length = 1, callback = dom_matrix_set_matrix_value_callback)]
set_matrix_value: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(interface = web_api_interfaces::DOMMatrix)]
+#[webapi(interface = web_api_interfaces::DOMMatrix, enumerable)]
struct DomMatrixConstructorDeclaration {
#[webapi(
static_method = "fromMatrix",
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 6fd6a65c3..c727df2d8 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
@@ -1851,3 +1851,40 @@ fn notification_declared_surface_uses_private_slots_and_methods() {
"none|title:function:get title:0:undefined:true:true,data:function:get data:0:undefined:true:true,actions:function:get actions:0:undefined:true:true|real|42|0|throw:TypeError,throw:TypeError,throw:TypeError,throw:TypeError,throw:TypeError,throw:TypeError,throw:TypeError,throw:TypeError,throw:TypeError,throw:TypeError|throw:TypeError,throw:TypeError,throw:TypeError|true|true:true:true:true:function:0:requestPermission|true|true:true:true:true:function:0:addEventListener|true:true:true:true:function:0:removeEventListener|true:true:true:true:function:0:dispatchEvent|true|listener"
);
}
+
+#[test]
+fn dom_matrix_window_operations_use_webidl_descriptors() {
+ let mut vm = new_storage_test_vm("https://dommatrix-operation-descriptors.test/");
+
+ let result = vm
+ .eval(
+ r#"
+(() => {
+ const descriptorShape = (owner, name) => {
+ const descriptor = Object.getOwnPropertyDescriptor(owner, name);
+ return [
+ typeof descriptor.value,
+ descriptor.value.length,
+ descriptor.enumerable,
+ descriptor.writable,
+ descriptor.configurable
+ ].join(",");
+ };
+ return [
+ descriptorShape(DOMMatrixReadOnly.prototype, "toString"),
+ descriptorShape(DOMMatrix.prototype, "setMatrixValue"),
+ descriptorShape(DOMMatrixReadOnly, "fromMatrix"),
+ descriptorShape(DOMMatrixReadOnly, "fromFloat32Array"),
+ descriptorShape(DOMMatrix, "fromMatrix"),
+ descriptorShape(DOMMatrix, "fromFloat64Array")
+ ].join("|");
+})()
+"#,
+ )
+ .expect("DOMMatrix Window operation descriptors should evaluate");
+
+ assert_eq!(
+ result,
+ "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"
+ );
+}