Skip to content

armgit / moli

Public Imported from GitHub
0

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

fix(dom): enumerate collection query methods

ldm0644b82c710cf
diff --git a/moli-renderer-v8/src/native_bridge/collections/builders.rs b/moli-renderer-v8/src/native_bridge/collections/builders.rs
index 38d8167d2..24df2c8e7 100644
--- a/moli-renderer-v8/src/native_bridge/collections/builders.rs
+++ b/moli-renderer-v8/src/native_bridge/collections/builders.rs
@@ -97,7 +97,7 @@ struct NodeListPrototypeMembersDeclaration {
#[webapi(accessor_property, enumerable, getter = node_list_length_getter)]
length: (),
- #[webapi(method, length = 1, callback = node_list_item_callback)]
+ #[webapi(method, length = 1, enumerable, callback = node_list_item_callback)]
item: (),
#[webapi(
diff --git a/moli-renderer-v8/src/native_bridge/document.rs b/moli-renderer-v8/src/native_bridge/document.rs
index 6dc341c02..7167d31b6 100644
--- a/moli-renderer-v8/src/native_bridge/document.rs
+++ b/moli-renderer-v8/src/native_bridge/document.rs
@@ -448,7 +448,7 @@ struct DocumentCollectionAccessorsPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(interface = web_api_interfaces::Document, receiver)]
+#[webapi(interface = web_api_interfaces::Document, enumerable, receiver)]
struct DocumentCollectionQueryPrototypeDeclaration {
#[webapi(
method,
@@ -1372,7 +1372,7 @@ pub(crate) fn install_document_template_bindings<'s>(
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(interface = web_api_interfaces::Document, receiver)]
+#[webapi(interface = web_api_interfaces::Document, enumerable, receiver)]
struct DocumentGetElementByIdTemplateDeclaration {
#[webapi(method = "getElementById", length = 1, callback = node_get_element_by_id_callback)]
get_element_by_id: (),
diff --git a/moli-renderer-v8/src/script_vm/tests/dom_elements/detached/document_state_and_form_controls.rs b/moli-renderer-v8/src/script_vm/tests/dom_elements/detached/document_state_and_form_controls.rs
index 6f16ea309..0b7922127 100644
--- a/moli-renderer-v8/src/script_vm/tests/dom_elements/detached/document_state_and_form_controls.rs
+++ b/moli-renderer-v8/src/script_vm/tests/dom_elements/detached/document_state_and_form_controls.rs
@@ -982,7 +982,7 @@ fn document_template_methods_keep_declared_reflection_shape() {
r#"
(() => {
const methods = [
- ["getElementById", 1, false],
+ ["getElementById", 1],
["createElement", 1],
["createAttribute", 1],
["createAttributeNS", 2],
diff --git a/moli-renderer-v8/src/script_vm/tests/dom_elements/live_document/geometry_and_svg.rs b/moli-renderer-v8/src/script_vm/tests/dom_elements/live_document/geometry_and_svg.rs
index cc159dcaf..41ab1777a 100644
--- a/moli-renderer-v8/src/script_vm/tests/dom_elements/live_document/geometry_and_svg.rs
+++ b/moli-renderer-v8/src/script_vm/tests/dom_elements/live_document/geometry_and_svg.rs
@@ -602,7 +602,7 @@ fn element_methods_and_dataset_live_on_owner_prototypes() {
fragmentChild.setAttribute("name", "fragment-name");
fragmentChild.id = "fragment-id";
fragment.appendChild(fragmentChild);
- method(Document.prototype, "getElementById", 1, false);
+ method(Document.prototype, "getElementById", 1, true);
method(DocumentFragment.prototype, "getElementById", 1, false);
assert(!own(document, "getElementById"), "getElementById should not be own on document");
assert(!own(fragment, "getElementById"), "getElementById should not be own on fragment");
diff --git a/moli-renderer-v8/src/script_vm/tests/dom_xhr/dom/detached_documents.rs b/moli-renderer-v8/src/script_vm/tests/dom_xhr/dom/detached_documents.rs
index 579856279..43574c556 100644
--- a/moli-renderer-v8/src/script_vm/tests/dom_xhr/dom/detached_documents.rs
+++ b/moli-renderer-v8/src/script_vm/tests/dom_xhr/dom/detached_documents.rs
@@ -327,7 +327,7 @@ fn dom_parser_native_query_selector_all_declares_node_list_shell() {
assert_eq!(
result,
- "[object NodeList]|NodeList|true|2|a|b|true|a|b|true|a,b|false|false|false|true:false:true:true:function:item:1|true:false:true:true:function|true|false|true|a|a,b"
+ "[object NodeList]|NodeList|true|2|a|b|true|a|b|true|a,b|false|false|false|true:true:true:true:function:item:1|true:false:true:true:function|true|false|true|a|a,b"
);
}
diff --git a/moli-renderer-v8/src/script_vm/tests/dom_xhr/forms.rs b/moli-renderer-v8/src/script_vm/tests/dom_xhr/forms.rs
index 7ef1ba92b..34b26fbd3 100644
--- a/moli-renderer-v8/src/script_vm/tests/dom_xhr/forms.rs
+++ b/moli-renderer-v8/src/script_vm/tests/dom_xhr/forms.rs
@@ -5886,7 +5886,7 @@ fn collection_webidl_members_live_on_interface_prototypes() {
assert_eq!(
result,
- r#"{"own":{"htmlLength":false,"nodeLength":false,"optionsLength":false,"optionsSelectedIndex":false,"optionsAdd":false,"radioValue":false},"chains":[true,true],"accessors":{"htmlLength":"get length:0:::true:true","nodeLength":"get length:0:::true:true","optionsLength":"get length:0:set length:1:true:true","selectedIndex":"get selectedIndex:0:set selectedIndex:1:true:true","radioValue":"get value:0:set value:1:true:true"},"methods":{"htmlItem":"item:1:true:true:true","namedItem":"namedItem:1:true:true:true","nodeItem":"item:1:false:true:true","add":"add:1:true:true:true","remove":"remove:1:true:true:true"},"borrowed":[2,1,"second",false,true],"forged":["TypeError","TypeError","TypeError"],"crossBrand":["TypeError","TypeError","TypeError","TypeError","TypeError","TypeError","TypeError","TypeError"],"tags":["[object HTMLOptionsCollection]","[object RadioNodeList]"]}"#
+ r#"{"own":{"htmlLength":false,"nodeLength":false,"optionsLength":false,"optionsSelectedIndex":false,"optionsAdd":false,"radioValue":false},"chains":[true,true],"accessors":{"htmlLength":"get length:0:::true:true","nodeLength":"get length:0:::true:true","optionsLength":"get length:0:set length:1:true:true","selectedIndex":"get selectedIndex:0:set selectedIndex:1:true:true","radioValue":"get value:0:set value:1:true:true"},"methods":{"htmlItem":"item:1:true:true:true","namedItem":"namedItem:1:true:true:true","nodeItem":"item:1:true:true:true","add":"add:1:true:true:true","remove":"remove:1:true:true:true"},"borrowed":[2,1,"second",false,true],"forged":["TypeError","TypeError","TypeError"],"crossBrand":["TypeError","TypeError","TypeError","TypeError","TypeError","TypeError","TypeError","TypeError"],"tags":["[object HTMLOptionsCollection]","[object RadioNodeList]"]}"#
);
}