diff --git a/Cargo.lock b/Cargo.lock index be17dd12aff..a8d3f512d61 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,9 +20,9 @@ checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" [[package]] name = "accountable-refcell" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6e2bba6f21fcf0ae382750eb6d9387c42807761fa7329d3a05fcd1334e8c3f2" +checksum = "6afea9052e0b2d90e38572691d87194b2e5d8d6899b9b850b22aaab17e486252" dependencies = [ "backtrace", ] @@ -6060,12 +6060,6 @@ dependencies = [ "thiserror 2.0.9", ] -[[package]] -name = "ref_filter_map" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b5ceb840e4009da4841ed22a15eb49f64fdd00a2138945c5beacf506b2fb5ed" - [[package]] name = "regex" version = "1.11.1" @@ -6337,7 +6331,6 @@ dependencies = [ "pixels", "profile_traits", "range", - "ref_filter_map", "regex", "script_bindings", "script_layout_interface", diff --git a/Cargo.toml b/Cargo.toml index 4045a0ffcb9..1373440d67e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ publish = false rust-version = "1.85.0" [workspace.dependencies] -accountable-refcell = "0.2.0" +accountable-refcell = "0.2.2" aes = "0.8.4" aes-gcm = "0.10.3" aes-kw = { version = "0.2.1", features = ["alloc"] } diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index f41ef733c5f..6d588a3984e 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -100,7 +100,6 @@ phf = "0.11" pixels = { path = "../pixels" } profile_traits = { workspace = true } range = { path = "../range" } -ref_filter_map = "1.0.1" regex = { workspace = true } script_bindings = { path = "../script_bindings" } script_layout_interface = { workspace = true } diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs index 7e7e752bc0c..805ab28224f 100644 --- a/components/script/dom/bindings/cell.rs +++ b/components/script/dom/bindings/cell.rs @@ -9,10 +9,8 @@ use std::cell::{BorrowError, BorrowMutError}; pub(crate) use std::cell::{Ref, RefCell, RefMut}; #[cfg(feature = "refcell_backtrace")] -pub(crate) use accountable_refcell::{Ref, RefCell, RefMut, ref_filter_map}; +pub(crate) use accountable_refcell::{Ref, RefCell, RefMut}; use malloc_size_of::{MallocConditionalSizeOf, MallocSizeOfOps}; -#[cfg(not(feature = "refcell_backtrace"))] -pub(crate) use ref_filter_map::ref_filter_map; use crate::dom::bindings::root::{assert_in_layout, assert_in_script}; diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index ed58548a3e5..dbf0f14ab68 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -66,7 +66,7 @@ use xml5ever::serialize::TraversalScope::{ use crate::conversions::Convert; use crate::dom::activation::Activatable; use crate::dom::attr::{Attr, AttrHelpersForLayout, is_relevant_attribute}; -use crate::dom::bindings::cell::{DomRefCell, Ref, RefMut, ref_filter_map}; +use crate::dom::bindings::cell::{DomRefCell, Ref, RefMut}; use crate::dom::bindings::codegen::Bindings::AttrBinding::AttrMethods; use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use crate::dom::bindings::codegen::Bindings::ElementBinding::{ @@ -1480,7 +1480,7 @@ impl Element { // is "xmlns", and local name is prefix, or if prefix is null and it has an attribute // whose namespace is the XMLNS namespace, namespace prefix is null, and local name is // "xmlns", then return its value if it is not the empty string, and null otherwise." - let attr = ref_filter_map(self.attrs(), |attrs| { + let attr = Ref::filter_map(self.attrs(), |attrs| { attrs.iter().find(|attr| { if attr.namespace() != &ns!(xmlns) { return false; @@ -1493,7 +1493,8 @@ impl Element { _ => false, } }) - }); + }) + .ok(); if let Some(attr) = attr { return (**attr.value()).into(); diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index c2bfc9c2d7f..27da9f2b537 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -31,7 +31,7 @@ pub(crate) use crate::canvas_context::*; use crate::conversions::Convert; use crate::dom::attr::Attr; use crate::dom::bindings::callback::ExceptionHandling; -use crate::dom::bindings::cell::{DomRefCell, Ref, ref_filter_map}; +use crate::dom::bindings::cell::{DomRefCell, Ref}; use crate::dom::bindings::codegen::Bindings::HTMLCanvasElementBinding::{ BlobCallback, HTMLCanvasElementMethods, RenderingContext as RootedRenderingContext, }; @@ -225,7 +225,7 @@ impl LayoutHTMLCanvasElementHelpers for LayoutDom<'_, HTMLCanvasElement> { impl HTMLCanvasElement { pub(crate) fn context(&self) -> Option> { - ref_filter_map(self.context_mode.borrow(), |ctx| ctx.as_ref()) + Ref::filter_map(self.context_mode.borrow(), |ctx| ctx.as_ref()).ok() } fn get_or_init_2d_context(&self, can_gc: CanGc) -> Option> { diff --git a/components/script/dom/offscreencanvas.rs b/components/script/dom/offscreencanvas.rs index bceed49ac7d..b4323ef6b54 100644 --- a/components/script/dom/offscreencanvas.rs +++ b/components/script/dom/offscreencanvas.rs @@ -10,7 +10,7 @@ use js::rust::{HandleObject, HandleValue}; use snapshot::Snapshot; use crate::canvas_context::{CanvasContext, OffscreenRenderingContext}; -use crate::dom::bindings::cell::{DomRefCell, Ref, ref_filter_map}; +use crate::dom::bindings::cell::{DomRefCell, Ref}; use crate::dom::bindings::codegen::Bindings::OffscreenCanvasBinding::{ OffscreenCanvasMethods, OffscreenRenderingContext as RootedOffscreenRenderingContext, }; @@ -84,7 +84,7 @@ impl OffscreenCanvas { } pub(crate) fn context(&self) -> Option> { - ref_filter_map(self.context.borrow(), |ctx| ctx.as_ref()) + Ref::filter_map(self.context.borrow(), |ctx| ctx.as_ref()).ok() } pub(crate) fn get_image_data(&self) -> Option { diff --git a/components/script/dom/vertexarrayobject.rs b/components/script/dom/vertexarrayobject.rs index 7da5cf7195b..27f65bde7ee 100644 --- a/components/script/dom/vertexarrayobject.rs +++ b/components/script/dom/vertexarrayobject.rs @@ -8,7 +8,7 @@ use canvas_traits::webgl::{ ActiveAttribInfo, WebGLCommand, WebGLError, WebGLResult, WebGLVersion, WebGLVertexArrayId, }; -use crate::dom::bindings::cell::{DomRefCell, Ref, ref_filter_map}; +use crate::dom::bindings::cell::{DomRefCell, Ref}; use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants2; use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use crate::dom::bindings::root::{Dom, MutNullableDom}; @@ -83,9 +83,10 @@ impl VertexArrayObject { } pub(crate) fn get_vertex_attrib(&self, index: u32) -> Option> { - ref_filter_map(self.vertex_attribs.borrow(), |attribs| { + Ref::filter_map(self.vertex_attribs.borrow(), |attribs| { attribs.get(index as usize) }) + .ok() } pub(crate) fn set_vertex_attrib_type(&self, index: u32, type_: u32) {