From 5442302f8be251bb00ee102cca0ff82db81d7388 Mon Sep 17 00:00:00 2001 From: Gae24 <96017547+Gae24@users.noreply.github.com> Date: Tue, 30 Sep 2025 12:17:09 +0200 Subject: [PATCH] script: move testbinding DOM interfaces to script/dom/test (#39585) Move testbinding interfaces to it's own module, to avoid cluttering dom folder. Testing: A successful build is enough Part of #38901 --------- Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> --- components/script/dom/mod.rs | 24 ++----------------- components/script/dom/testing/mod.rs | 16 +++++++++++++ .../script/dom/{ => testing}/testbinding.rs | 0 .../dom/{ => testing}/testbindingiterable.rs | 0 .../testbindingmaplikewithinterface.rs | 3 +-- .../testbindingmaplikewithprimitive.rs | 3 +-- .../{ => testing}/testbindingpairiterable.rs | 0 .../dom/{ => testing}/testbindingproxy.rs | 0 .../testbindingsetlikewithinterface.rs | 2 +- .../testbindingsetlikewithprimitive.rs | 2 +- components/script/dom/{ => testing}/testns.rs | 0 .../script/dom/{ => testing}/testutils.rs | 2 +- .../script/dom/{ => testing}/testworklet.rs | 0 .../{ => testing}/testworkletglobalscope.rs | 0 14 files changed, 23 insertions(+), 29 deletions(-) create mode 100644 components/script/dom/testing/mod.rs rename components/script/dom/{ => testing}/testbinding.rs (100%) rename components/script/dom/{ => testing}/testbindingiterable.rs (100%) rename components/script/dom/{ => testing}/testbindingmaplikewithinterface.rs (97%) rename components/script/dom/{ => testing}/testbindingmaplikewithprimitive.rs (97%) rename components/script/dom/{ => testing}/testbindingpairiterable.rs (100%) rename components/script/dom/{ => testing}/testbindingproxy.rs (100%) rename components/script/dom/{ => testing}/testbindingsetlikewithinterface.rs (98%) rename components/script/dom/{ => testing}/testbindingsetlikewithprimitive.rs (97%) rename components/script/dom/{ => testing}/testns.rs (100%) rename components/script/dom/{ => testing}/testutils.rs (97%) rename components/script/dom/{ => testing}/testworklet.rs (100%) rename components/script/dom/{ => testing}/testworkletglobalscope.rs (100%) diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index c4bd5394e9a..b7d0a228e20 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -455,29 +455,9 @@ pub(crate) mod svggraphicselement; pub(crate) mod svgimageelement; pub(crate) mod svgsvgelement; #[cfg(feature = "testbinding")] -pub(crate) mod testbinding; +mod testing; #[cfg(feature = "testbinding")] -pub(crate) mod testbindingiterable; -#[cfg(feature = "testbinding")] -pub(crate) mod testbindingmaplikewithinterface; -#[cfg(feature = "testbinding")] -pub(crate) mod testbindingmaplikewithprimitive; -#[cfg(feature = "testbinding")] -pub(crate) mod testbindingpairiterable; -#[cfg(feature = "testbinding")] -pub(crate) mod testbindingproxy; -#[cfg(feature = "testbinding")] -pub(crate) mod testbindingsetlikewithinterface; -#[cfg(feature = "testbinding")] -pub(crate) mod testbindingsetlikewithprimitive; -#[cfg(feature = "testbinding")] -pub(crate) mod testns; -#[cfg(feature = "testbinding")] -pub(crate) mod testutils; -#[cfg(feature = "testbinding")] -pub(crate) mod testworklet; -#[cfg(feature = "testbinding")] -pub(crate) mod testworkletglobalscope; +pub(crate) use self::testing::*; pub(crate) mod text; pub(crate) mod textcontrol; pub(crate) mod textdecoder; diff --git a/components/script/dom/testing/mod.rs b/components/script/dom/testing/mod.rs new file mode 100644 index 00000000000..eaadb2df482 --- /dev/null +++ b/components/script/dom/testing/mod.rs @@ -0,0 +1,16 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +pub(crate) mod testbinding; +pub(crate) mod testbindingiterable; +pub(crate) mod testbindingmaplikewithinterface; +pub(crate) mod testbindingmaplikewithprimitive; +pub(crate) mod testbindingpairiterable; +pub(crate) mod testbindingproxy; +pub(crate) mod testbindingsetlikewithinterface; +pub(crate) mod testbindingsetlikewithprimitive; +pub(crate) mod testns; +pub(crate) mod testutils; +pub(crate) mod testworklet; +pub(crate) mod testworkletglobalscope; diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testing/testbinding.rs similarity index 100% rename from components/script/dom/testbinding.rs rename to components/script/dom/testing/testbinding.rs diff --git a/components/script/dom/testbindingiterable.rs b/components/script/dom/testing/testbindingiterable.rs similarity index 100% rename from components/script/dom/testbindingiterable.rs rename to components/script/dom/testing/testbindingiterable.rs diff --git a/components/script/dom/testbindingmaplikewithinterface.rs b/components/script/dom/testing/testbindingmaplikewithinterface.rs similarity index 97% rename from components/script/dom/testbindingmaplikewithinterface.rs rename to components/script/dom/testing/testbindingmaplikewithinterface.rs index e60d251aeaf..e5a42fe83f1 100644 --- a/components/script/dom/testbindingmaplikewithinterface.rs +++ b/components/script/dom/testing/testbindingmaplikewithinterface.rs @@ -8,10 +8,9 @@ use dom_struct::dom_struct; use indexmap::IndexMap; use js::rust::HandleObject; -use super::bindings::error::Error; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::TestBindingMaplikeWithInterfaceBinding::TestBindingMaplikeWithInterfaceMethods; -use crate::dom::bindings::error::Fallible; +use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::like::Maplike; use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; diff --git a/components/script/dom/testbindingmaplikewithprimitive.rs b/components/script/dom/testing/testbindingmaplikewithprimitive.rs similarity index 97% rename from components/script/dom/testbindingmaplikewithprimitive.rs rename to components/script/dom/testing/testbindingmaplikewithprimitive.rs index 1a89bebb00b..e5550383591 100644 --- a/components/script/dom/testbindingmaplikewithprimitive.rs +++ b/components/script/dom/testing/testbindingmaplikewithprimitive.rs @@ -8,10 +8,9 @@ use dom_struct::dom_struct; use indexmap::IndexMap; use js::rust::HandleObject; -use super::bindings::error::Error; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::TestBindingMaplikeWithPrimitiveBinding::TestBindingMaplikeWithPrimitiveMethods; -use crate::dom::bindings::error::Fallible; +use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::like::Maplike; use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; diff --git a/components/script/dom/testbindingpairiterable.rs b/components/script/dom/testing/testbindingpairiterable.rs similarity index 100% rename from components/script/dom/testbindingpairiterable.rs rename to components/script/dom/testing/testbindingpairiterable.rs diff --git a/components/script/dom/testbindingproxy.rs b/components/script/dom/testing/testbindingproxy.rs similarity index 100% rename from components/script/dom/testbindingproxy.rs rename to components/script/dom/testing/testbindingproxy.rs diff --git a/components/script/dom/testbindingsetlikewithinterface.rs b/components/script/dom/testing/testbindingsetlikewithinterface.rs similarity index 98% rename from components/script/dom/testbindingsetlikewithinterface.rs rename to components/script/dom/testing/testbindingsetlikewithinterface.rs index b41888e4dd6..df4dc223229 100644 --- a/components/script/dom/testbindingsetlikewithinterface.rs +++ b/components/script/dom/testing/testbindingsetlikewithinterface.rs @@ -8,10 +8,10 @@ use dom_struct::dom_struct; use indexmap::IndexSet; use js::rust::HandleObject; -use super::bindings::like::Setlike; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::TestBindingSetlikeWithInterfaceBinding::TestBindingSetlikeWithInterfaceMethods; use crate::dom::bindings::error::Fallible; +use crate::dom::bindings::like::Setlike; use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/dom/testbindingsetlikewithprimitive.rs b/components/script/dom/testing/testbindingsetlikewithprimitive.rs similarity index 97% rename from components/script/dom/testbindingsetlikewithprimitive.rs rename to components/script/dom/testing/testbindingsetlikewithprimitive.rs index 031c55e50f4..367bc331564 100644 --- a/components/script/dom/testbindingsetlikewithprimitive.rs +++ b/components/script/dom/testing/testbindingsetlikewithprimitive.rs @@ -8,10 +8,10 @@ use dom_struct::dom_struct; use indexmap::IndexSet; use js::rust::HandleObject; -use super::bindings::like::Setlike; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::TestBindingSetlikeWithPrimitiveBinding::TestBindingSetlikeWithPrimitiveMethods; use crate::dom::bindings::error::Fallible; +use crate::dom::bindings::like::Setlike; use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; diff --git a/components/script/dom/testns.rs b/components/script/dom/testing/testns.rs similarity index 100% rename from components/script/dom/testns.rs rename to components/script/dom/testing/testns.rs diff --git a/components/script/dom/testutils.rs b/components/script/dom/testing/testutils.rs similarity index 97% rename from components/script/dom/testutils.rs rename to components/script/dom/testing/testutils.rs index 4aadac05da3..02ea79e375d 100644 --- a/components/script/dom/testutils.rs +++ b/components/script/dom/testing/testutils.rs @@ -9,8 +9,8 @@ use js::jsapi::{GCReason, JS_GC}; use script_bindings::reflector::Reflector; use script_bindings::script_runtime::CanGc; -use super::globalscope::GlobalScope; use crate::dom::bindings::codegen::Bindings::TestUtilsBinding::TestUtilsMethods; +use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; use crate::test::TrustedPromise; diff --git a/components/script/dom/testworklet.rs b/components/script/dom/testing/testworklet.rs similarity index 100% rename from components/script/dom/testworklet.rs rename to components/script/dom/testing/testworklet.rs diff --git a/components/script/dom/testworkletglobalscope.rs b/components/script/dom/testing/testworkletglobalscope.rs similarity index 100% rename from components/script/dom/testworkletglobalscope.rs rename to components/script/dom/testing/testworkletglobalscope.rs