Miscellaneous script splitting preparation changes (#36216)

* script: Move num module to script_bindings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Make JS reflector creation generic over DOM trait.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Move bindings-specific lock to script_bindings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Move DOM proto array code to script_bindings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Move finalizer implementations to script_bindings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Move some error routines to script_bindings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Move some DOM interface conversion routines to script_bindings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Make is_array_like generic over DOM trait.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Use generic interfaces for conditional exposure functions.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Move a bunch of routines used by codegen to script_bindings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix clippy warnings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-03-29 04:11:27 -04:00 committed by GitHub
parent 2c94110952
commit c30ad5a30e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 836 additions and 691 deletions

View file

@ -51,6 +51,7 @@ use num_traits::ToPrimitive;
use percent_encoding::percent_decode;
use profile_traits::ipc as profile_ipc;
use profile_traits::time::TimerMetadataFrameType;
use script_bindings::interfaces::DocumentHelpers;
use script_layout_interface::{PendingRestyle, TrustedNodeAddress};
use script_traits::{
AnimationState, ConstellationInputEvent, DocumentActivity, ProgressiveWebMetricType, ScriptMsg,
@ -78,7 +79,6 @@ use super::bindings::codegen::Bindings::XPathEvaluatorBinding::XPathEvaluatorMet
use super::canvasrenderingcontext2d::CanvasRenderingContext2D;
use super::clipboardevent::ClipboardEventType;
use super::performancepainttiming::PerformancePaintTiming;
use crate::DomTypes;
use crate::animation_timeline::AnimationTimeline;
use crate::animations::Animations;
use crate::canvas_context::CanvasContext as _;
@ -6398,11 +6398,7 @@ fn is_named_element_with_id_attribute(elem: &Element) -> bool {
elem.is::<HTMLImageElement>() && elem.get_name().is_some_and(|name| !name.is_empty())
}
pub(crate) trait DocumentHelpers<D: DomTypes> {
fn ensure_safe_to_run_script_or_layout(&self);
}
impl DocumentHelpers<crate::DomTypeHolder> for Document {
impl DocumentHelpers for Document {
fn ensure_safe_to_run_script_or_layout(&self) {
Document::ensure_safe_to_run_script_or_layout(self)
}