Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
refactor: use stable atomic updates and fixed-size slice chunks
ldm0c31404d801d0
diff --git a/moli-canvas/src/lib.rs b/moli-canvas/src/lib.rsindex 82f584c86..c93966bb3 100644--- a/moli-canvas/src/lib.rs+++ b/moli-canvas/src/lib.rs@@ -345,7 +345,9 @@ mod tests {paint_rect(&mut pixels, 4, 4, (2, 1, 6, 3), [255, 0, 0, 255]);let hot = pixels- .chunks_exact(4)+ .as_chunks::<4>()+ .0+ .iter().filter(|px| px[0] == 255 && px[3] == 255).count();assert_eq!(hot, 4);diff --git a/moli-charset-parser/src/tests.rs b/moli-charset-parser/src/tests.rsindex d3a28ee38..685daae36 100644--- a/moli-charset-parser/src/tests.rs+++ b/moli-charset-parser/src/tests.rs@@ -16,7 +16,7 @@ fn finds_meta_charset() {#[test]fn encoding_labels_allow_only_ascii_whitespace() {- for whitespace in [b'\t', b'\n', b'\x0C', b'\r', b' '] {+ for whitespace in *b"\t\n\x0C\r " {let input = [br#"<meta charset=""#.as_slice(),&[whitespace],diff --git a/moli-cookie-import/src/chrome.rs b/moli-cookie-import/src/chrome.rsindex 98c88d2dd..4fbe826bc 100644--- a/moli-cookie-import/src/chrome.rs+++ b/moli-cookie-import/src/chrome.rs@@ -282,7 +282,9 @@ fn decode_chrome_string(value: &[u8]) -> Option<Vec<u16>> {}Some(bytes- .chunks_exact(2)+ .as_chunks::<2>()+ .0+ .iter().map(|pair| u16::from_le_bytes([pair[0], pair[1]])).collect(),)diff --git a/moli-cookie-import/src/firefox.rs b/moli-cookie-import/src/firefox.rsindex acbe2481f..f3c40ffe4 100644--- a/moli-cookie-import/src/firefox.rs+++ b/moli-cookie-import/src/firefox.rs@@ -168,7 +168,9 @@ fn decode_local_storage_value(value: Vec<u8>, conversion: i64, compression: i64)bail!("UTF-16 value has an odd byte length");}let units = value- .chunks_exact(2)+ .as_chunks::<2>()+ .0+ .iter().map(|pair| u16::from_ne_bytes([pair[0], pair[1]])).collect::<Vec<_>>();String::from_utf16(&units).context("invalid UTF-16 value")diff --git a/moli-core/tests/web_apis/body_utf8.rs b/moli-core/tests/web_apis/body_utf8.rsindex 6b39ced69..efc42d0b7 100644--- a/moli-core/tests/web_apis/body_utf8.rs+++ b/moli-core/tests/web_apis/body_utf8.rs@@ -25,7 +25,7 @@ async fn assert_body_utf8_decoding(scenario: &str) -> Result<()> {let url = url::Url::parse(&format!("http://fixture{path}")).unwrap();let hex = url.query_pairs().find(|(name, _)| name == "hex").map(|(_, value)| value.into_owned()).unwrap_or_default();- let body: Vec<u8> = hex.as_bytes().chunks_exact(2).map(|pair| {+ let body: Vec<u8> = hex.as_bytes().as_chunks::<2>().0.iter().map(|pair| {u8::from_str_radix(std::str::from_utf8(pair).unwrap(), 16).unwrap()}).collect();let mime = url.query_pairs().find(|(name, _)| name == "type")diff --git a/moli-crypto/src/legacy.rs b/moli-crypto/src/legacy.rsindex 4d5e971b4..edfd57846 100644--- a/moli-crypto/src/legacy.rs+++ b/moli-crypto/src/legacy.rs@@ -67,7 +67,9 @@ mod tests {fn hex(input: &str) -> Vec<u8> {input.as_bytes()- .chunks_exact(2)+ .as_chunks::<2>()+ .0+ .iter().map(|pair| u8::from_str_radix(std::str::from_utf8(pair).unwrap(), 16).unwrap()).collect()}diff --git a/moli-curl/src/runtime/identity.rs b/moli-curl/src/runtime/identity.rsindex 96c4c31c1..64bc094d7 100644--- a/moli-curl/src/runtime/identity.rs+++ b/moli-curl/src/runtime/identity.rs@@ -44,7 +44,7 @@ pub(crate) fn next_transfer_id() -> Result<CurlTransferId> {fn next_nonzero_usize(counter: &AtomicUsize) -> Result<NonZeroUsize> {let sequence = counter- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |current| {current.checked_add(1)}).map_err(|_| anyhow!("identity space exhausted"))?;diff --git a/moli-image/src/jpeg.rs b/moli-image/src/jpeg.rsindex cf9b6be67..a8825e2a1 100644--- a/moli-image/src/jpeg.rs+++ b/moli-image/src/jpeg.rs@@ -85,7 +85,9 @@ pub fn decode_jpeg(bytes: &[u8]) -> Result<RgbaImage, JpegDecodeError> {.flat_map(|value| [value, value, value, 255]).collect(),jpeg_decoder::PixelFormat::RGB24 => decoded- .chunks_exact(3)+ .as_chunks::<3>()+ .0+ .iter().flat_map(|pixel| [pixel[0], pixel[1], pixel[2], 255]).collect(),jpeg_decoder::PixelFormat::L16 => {diff --git a/moli-image/src/png.rs b/moli-image/src/png.rsindex c0158fcd8..bedeaba60 100644--- a/moli-image/src/png.rs+++ b/moli-image/src/png.rs@@ -129,7 +129,9 @@ pub fn decode_png(bytes: &[u8]) -> Result<RgbaImage, PngDecodeError> {let rgba = match output.color_type {png::ColorType::Rgba => decoded,png::ColorType::Rgb => decoded- .chunks_exact(3)+ .as_chunks::<3>()+ .0+ .iter().flat_map(|pixel| [pixel[0], pixel[1], pixel[2], 255]).collect(),png::ColorType::Grayscale => decoded@@ -137,7 +139,9 @@ pub fn decode_png(bytes: &[u8]) -> Result<RgbaImage, PngDecodeError> {.flat_map(|value| [value, value, value, 255]).collect(),png::ColorType::GrayscaleAlpha => decoded- .chunks_exact(2)+ .as_chunks::<2>()+ .0+ .iter().flat_map(|pixel| [pixel[0], pixel[0], pixel[0], pixel[1]]).collect(),png::ColorType::Indexed => {diff --git a/moli-indexeddb/src/persistence.rs b/moli-indexeddb/src/persistence.rsindex b2ec61dd7..f63c19ffe 100644--- a/moli-indexeddb/src/persistence.rs+++ b/moli-indexeddb/src/persistence.rs@@ -298,8 +298,7 @@ fn unsanitize_origin(encoded: &str) -> Option<String> {return None;}let mut bytes = Vec::with_capacity(encoded.len() / 2);- let mut chars = encoded.as_bytes().chunks_exact(2);- for pair in &mut chars {+ for pair in encoded.as_bytes().as_chunks::<2>().0 {let pair = std::str::from_utf8(pair).ok()?;bytes.push(u8::from_str_radix(pair, 16).ok()?);}diff --git a/moli-opfs/src/store.rs b/moli-opfs/src/store.rsindex 1c8ff8495..ce1e714fb 100644--- a/moli-opfs/src/store.rs+++ b/moli-opfs/src/store.rs@@ -1102,7 +1102,7 @@ impl Opfs {fn take_owner_id(&self) -> OpfsResult<u64> {self.inner.next_owner_id- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |value| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |value| {value.checked_add(1)}).map_err(|_| OpfsError::InvalidState)diff --git a/moli-page-types/src/inspector_identity.rs b/moli-page-types/src/inspector_identity.rsindex 445f36625..af7222d59 100644--- a/moli-page-types/src/inspector_identity.rs+++ b/moli-page-types/src/inspector_identity.rs@@ -169,7 +169,7 @@ impl std::error::Error for RendererCallIdOutOfRange {}fn allocate_nonzero_u64(counter: &AtomicU64, name: &str) -> NonZeroU64 {let raw = counter- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |current| {current.checked_add(1)}).unwrap_or_else(|_| panic!("{name} exhausted"));diff --git a/moli-page-types/src/navigation_history.rs b/moli-page-types/src/navigation_history.rsindex 19a68224e..2362eb997 100644--- a/moli-page-types/src/navigation_history.rs+++ b/moli-page-types/src/navigation_history.rs@@ -37,7 +37,7 @@ impl std::ops::Deref for NavigationHistoryEntryId {fn allocate_navigation_history_entry_id(counter: &AtomicU64) -> NavigationHistoryEntryId {let raw = counter- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |current| {current.checked_add(1)}).expect("Navigation History entry id allocator exhausted");diff --git a/moli-paint/src/raster/filters.rs b/moli-paint/src/raster/filters.rsindex 5354ee90b..73d5a84d4 100644--- a/moli-paint/src/raster/filters.rs+++ b/moli-paint/src/raster/filters.rs@@ -59,7 +59,7 @@ pub(super) fn apply_software_color_filter(rgba: &mut [u8], filter: &PaintFilter)}fn apply_color_matrix(rgba: &mut [u8], matrix: &[f32; 20]) {- for pixel in rgba.chunks_exact_mut(4) {+ for pixel in rgba.as_chunks_mut::<4>().0 {let input = [f32::from(pixel[0]) / 255.0,f32::from(pixel[1]) / 255.0,diff --git a/moli-paint/src/raster/mod.rs b/moli-paint/src/raster/mod.rsindex d86e91f20..ccf017cbd 100644--- a/moli-paint/src/raster/mod.rs+++ b/moli-paint/src/raster/mod.rs@@ -250,7 +250,7 @@ pub fn raster_snapshot(snapshot: &PaintSnapshot) -> Result<RasterImage, PaintErr// Vello's Pixmap stores premultiplied channels; RasterImage and our software// color filters consume straight-alpha RGBA. Convert at each backend readback.fn unpremultiply_rgba(rgba: &mut [u8]) {- for pixel in rgba.chunks_exact_mut(4) {+ for pixel in rgba.as_chunks_mut::<4>().0 {let alpha = u16::from(pixel[3]);if alpha == 0 {pixel[..3].fill(0);diff --git a/moli-protocol-server/src/cdp_writer/pending_bytes.rs b/moli-protocol-server/src/cdp_writer/pending_bytes.rsindex f20738d82..0af577af5 100644--- a/moli-protocol-server/src/cdp_writer/pending_bytes.rs+++ b/moli-protocol-server/src/cdp_writer/pending_bytes.rs@@ -28,7 +28,7 @@ impl PendingByteBudget {pub(super) fn try_reserve(&self, bytes: usize) -> Option<PendingByteReservation> {self.current- .fetch_update(Ordering::AcqRel, Ordering::Acquire, |current| {+ .try_update(Ordering::AcqRel, Ordering::Acquire, |current| {current.checked_add(bytes).filter(|pending| *pending <= self.limit)diff --git a/moli-protocol-server/src/protocol_server/tests/screenshot.rs b/moli-protocol-server/src/protocol_server/tests/screenshot.rsindex b8af0295c..65b93b493 100644--- a/moli-protocol-server/src/protocol_server/tests/screenshot.rs+++ b/moli-protocol-server/src/protocol_server/tests/screenshot.rs@@ -273,7 +273,9 @@ async fn websocket_cdp_capture_screenshot_tracks_paint_and_layout_mutations() {);assert!(initial_pixels- .chunks_exact(4)+ .as_chunks::<4>()+ .0+ .iter().map(|rgba| [rgba[0], rgba[1], rgba[2], rgba[3]]).collect::<HashSet<_>>().len()diff --git a/moli-protocol-webdriver-classic/src/tests.rs b/moli-protocol-webdriver-classic/src/tests.rsindex 0906057f1..314c0e980 100644--- a/moli-protocol-webdriver-classic/src/tests.rs+++ b/moli-protocol-webdriver-classic/src/tests.rs@@ -1746,7 +1746,9 @@ fn maps_element_send_keys_to_shared_input_key_commands() {("F2", "F2", "", false),];assert_eq!(commands.len(), expected.len() * 2);- for (pair, (key, code, text, should_insert_text)) in commands.chunks_exact(2).zip(expected) {+ for (pair, (key, code, text, should_insert_text)) in+ commands.as_chunks::<2>().0.iter().zip(expected)+ {let AutomationCommand::DispatchKeyEvent(key_down) = &pair[0] else {panic!("expected keyDown dispatch");};diff --git a/moli-protocol/src/conn.rs b/moli-protocol/src/conn.rsindex 87d26a460..9690d096b 100644--- a/moli-protocol/src/conn.rs+++ b/moli-protocol/src/conn.rs@@ -3913,7 +3913,7 @@ impl CdpConnection {loop {let id = if let Some(allocator) = self.shared_target_id_allocator.as_ref() {allocator- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |current| {current.checked_add(1)}).expect("shared target id space exhausted")@@ -3941,7 +3941,7 @@ impl CdpConnection {loop {let id = if let Some(allocator) = self.shared_tab_target_id_allocator.as_ref() {allocator- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |current| {current.checked_add(1)}).expect("shared tab target id space exhausted")diff --git a/moli-protocol/src/conn/state/attachment_identity.rs b/moli-protocol/src/conn/state/attachment_identity.rsindex 163b7770f..0e163b0e3 100644--- a/moli-protocol/src/conn/state/attachment_identity.rs+++ b/moli-protocol/src/conn/state/attachment_identity.rs@@ -46,7 +46,7 @@ impl NavigationRequestId {fn allocate_nonzero_u64(counter: &AtomicU64, name: &str) -> NonZeroU64 {let raw = counter- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |current| {current.checked_add(1)}).unwrap_or_else(|_| panic!("{name} exhausted"));diff --git a/moli-protocol/src/domains/page/tests/capture/emulation.rs b/moli-protocol/src/domains/page/tests/capture/emulation.rsindex cf972845a..1c0c9d707 100644--- a/moli-protocol/src/domains/page/tests/capture/emulation.rs+++ b/moli-protocol/src/domains/page/tests/capture/emulation.rs@@ -129,8 +129,10 @@ fn assert_blue_boundary(bytes: &[u8], dimensions: (u32, u32), boundary: Option<ulet image = moli_image::decode_png(bytes).unwrap();let row = 10 * image.width as usize * 4;let first_blue = image.rgba[row..row + image.width as usize * 4]- .chunks_exact(4)- .position(|pixel| pixel == [0, 0, 255, 255])+ .as_chunks::<4>()+ .0+ .iter()+ .position(|pixel| *pixel == [0, 0, 255, 255]).map(|x| x as u32);assert_eq!(first_blue, boundary);}diff --git a/moli-renderer-v8/src/context_bootstrap/canvas/context2d.rs b/moli-renderer-v8/src/context_bootstrap/canvas/context2d.rsindex a520c2416..c47b013ef 100644--- a/moli-renderer-v8/src/context_bootstrap/canvas/context2d.rs+++ b/moli-renderer-v8/src/context_bootstrap/canvas/context2d.rs@@ -1567,7 +1567,12 @@ fn rasterize_canvas_fragment<'s>(/// Composites straight-alpha RGBA8 source and destination using source-over.fn composite_rgba8_over(destination: &mut [u8], source: &[u8]) {- for (dst, src) in destination.chunks_exact_mut(4).zip(source.chunks_exact(4)) {+ for (dst, src) in destination+ .as_chunks_mut::<4>()+ .0+ .iter_mut()+ .zip(source.as_chunks::<4>().0.iter())+ {let src_alpha = u32::from(src[3]);if src_alpha == 0 {continue;diff --git a/moli-renderer-v8/src/context_bootstrap/web_mcp/execution.rs b/moli-renderer-v8/src/context_bootstrap/web_mcp/execution.rsindex dfc89900e..13ed86459 100644--- a/moli-renderer-v8/src/context_bootstrap/web_mcp/execution.rs+++ b/moli-renderer-v8/src/context_bootstrap/web_mcp/execution.rs@@ -22,7 +22,7 @@ use crate::{fn next_invocation_id() -> u64 {static NEXT_INVOCATION: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1);NEXT_INVOCATION- .fetch_update(+ .try_update(std::sync::atomic::Ordering::Relaxed,std::sync::atomic::Ordering::Relaxed,|id| id.checked_add(1),diff --git a/moli-renderer-v8/src/context_bootstrap/webrtc/ice_candidate_parser.rs b/moli-renderer-v8/src/context_bootstrap/webrtc/ice_candidate_parser.rsindex fe68ce9f3..b21b36e4e 100644--- a/moli-renderer-v8/src/context_bootstrap/webrtc/ice_candidate_parser.rs+++ b/moli-renderer-v8/src/context_bootstrap/webrtc/ice_candidate_parser.rs@@ -65,8 +65,8 @@ pub(super) fn parse_ice_candidate(input: &str) -> Option<ParsedIceCandidate<'_>>related_address: None,related_port: None,};- let extensions = fields[8..].chunks_exact(2);- if !extensions.remainder().is_empty() {+ let (extensions, remainder) = fields[8..].as_chunks::<2>();+ if !remainder.is_empty() {return None;}for pair in extensions {diff --git a/moli-renderer-v8/src/native_bridge/history_traversal.rs b/moli-renderer-v8/src/native_bridge/history_traversal.rsindex 08232982f..df06cbb5e 100644--- a/moli-renderer-v8/src/native_bridge/history_traversal.rs+++ b/moli-renderer-v8/src/native_bridge/history_traversal.rs@@ -15,7 +15,7 @@ impl HistoryTraversalId {static NEXT_ID: AtomicU64 = AtomicU64::new(1);Self(NEXT_ID- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |id| id.checked_add(1))+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |id| id.checked_add(1)).expect("history traversal ID overflow"),)}diff --git a/moli-renderer-v8/src/runtime/captured_document_environment.rs b/moli-renderer-v8/src/runtime/captured_document_environment.rsindex a098679c5..6313de24d 100644--- a/moli-renderer-v8/src/runtime/captured_document_environment.rs+++ b/moli-renderer-v8/src/runtime/captured_document_environment.rs@@ -38,7 +38,7 @@ impl RendererCapturedDocumentEnvironment {) -> Self {static NEXT_ID: AtomicU64 = AtomicU64::new(1);let id = NEXT_ID- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |next| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |next| {next.checked_add(1)}).expect("captured document environment IDs exhausted");diff --git a/moli-renderer-v8/src/runtime/document_replacement.rs b/moli-renderer-v8/src/runtime/document_replacement.rsindex 9a7315876..f0229a284 100644--- a/moli-renderer-v8/src/runtime/document_replacement.rs+++ b/moli-renderer-v8/src/runtime/document_replacement.rs@@ -198,7 +198,7 @@ impl RendererPageReplacementTarget {) -> anyhow::Result<super::RendererPageReservationToken> {static NEXT_REQUEST: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1);let reservation_nonce = NEXT_REQUEST- .fetch_update(+ .try_update(std::sync::atomic::Ordering::Relaxed,std::sync::atomic::Ordering::Relaxed,|next| next.checked_add(1),diff --git a/moli-renderer-v8/src/runtime/page_screenshot.rs b/moli-renderer-v8/src/runtime/page_screenshot.rsindex 580776f4b..4d9c603f5 100644--- a/moli-renderer-v8/src/runtime/page_screenshot.rs+++ b/moli-renderer-v8/src/runtime/page_screenshot.rs@@ -377,7 +377,7 @@ impl PageVm {RendererScreenshotFormat::Jpeg => {// Chrome captures JPEG against black. The encoder discards alpha,// so composite our straight-alpha raster before handing it over.- for pixel in raster.rgba.chunks_exact_mut(4) {+ for pixel in raster.rgba.as_chunks_mut::<4>().0 {let alpha = u16::from(pixel[3]);if alpha != 255 {for channel in &mut pixel[..3] {diff --git a/moli-renderer-v8/src/runtime/page_vm/tests/rendering_update/painting_tables.rs b/moli-renderer-v8/src/runtime/page_vm/tests/rendering_update/painting_tables.rsindex 3bf124d5e..ee96ddc49 100644--- a/moli-renderer-v8/src/runtime/page_vm/tests/rendering_update/painting_tables.rs+++ b/moli-renderer-v8/src/runtime/page_vm/tests/rendering_update/painting_tables.rs@@ -1734,9 +1734,9 @@ getComputedStyle(document.getElementById('inline-gradient')).getPropertyValue('-);let colored_ink = image.rgba- .chunks_exact(4)+ .as_chunks::<4>().0.iter().filter(|pixel| {- let [red, green, blue, alpha] = <[u8; 4]>::try_from(*pixel).unwrap();+ let [red, green, blue, alpha] = **pixel;alpha == 255&& (red.abs_diff(blue) > 20|| red.max(blue).saturating_sub(green) > 20)@@ -1748,10 +1748,10 @@ getComputedStyle(document.getElementById('inline-gradient')).getPropertyValue('-);let colored_inline_ink = image.rgba- .chunks_exact(4)+ .as_chunks::<4>().0.iter().enumerate().filter(|(index, pixel)| {- let [red, green, blue, alpha] = <[u8; 4]>::try_from(*pixel).unwrap();+ let [red, green, blue, alpha] = **pixel;let y = *index as u32 / image.width;y >= 64&& alpha == 255diff --git a/moli-renderer-v8/src/runtime/page_vm/tests/rendering_update/text_styles.rs b/moli-renderer-v8/src/runtime/page_vm/tests/rendering_update/text_styles.rsindex 03d943803..777735d0c 100644--- a/moli-renderer-v8/src/runtime/page_vm/tests/rendering_update/text_styles.rs+++ b/moli-renderer-v8/src/runtime/page_vm/tests/rendering_update/text_styles.rs@@ -1040,9 +1040,9 @@ html,body{{margin:0;padding:0;background:white}}let image = moli_paint::raster_snapshot(&snapshot)?;let saturated_pixels = image.rgba- .chunks_exact(4)+ .as_chunks::<4>().0.iter().filter(|pixel| {- let [red, green, blue, alpha] = <[u8; 4]>::try_from(*pixel).unwrap();+ let [red, green, blue, alpha] = **pixel;let max = red.max(green).max(blue);let min = red.min(green).min(blue);alpha > 0 && max > 100 && max.saturating_sub(min) > 40diff --git a/moli-renderer-v8/src/runtime/protocol_output/identity.rs b/moli-renderer-v8/src/runtime/protocol_output/identity.rsindex ba9e302db..9b85b0589 100644--- a/moli-renderer-v8/src/runtime/protocol_output/identity.rs+++ b/moli-renderer-v8/src/runtime/protocol_output/identity.rs@@ -22,7 +22,7 @@ pub struct RendererOutputStreamEpoch(NonZeroU64);impl RendererOutputStreamEpoch {pub(crate) fn allocate() -> Self {let raw = NEXT_RENDERER_OUTPUT_STREAM_EPOCH- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |current| {current.checked_add(1)}).expect("renderer output stream epoch exhausted");@@ -153,7 +153,7 @@ pub struct RendererOutputFenceLeaseId(NonZeroU64);impl RendererOutputFenceLeaseId {pub(crate) fn allocate() -> Self {let raw = NEXT_RENDERER_OUTPUT_FENCE_LEASE_ID- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |current| {current.checked_add(1)}).expect("renderer output fence lease ID exhausted");diff --git a/moli-renderer-v8/src/script_vm/inspector/context_registry.rs b/moli-renderer-v8/src/script_vm/inspector/context_registry.rsindex acddb73c0..dab9f7c30 100644--- a/moli-renderer-v8/src/script_vm/inspector/context_registry.rs+++ b/moli-renderer-v8/src/script_vm/inspector/context_registry.rs@@ -15,7 +15,7 @@ impl DocumentInspectorContextGroupId {static NEXT_CONTEXT_GROUP_ID: AtomicI32 = AtomicI32::new(1);let id = NEXT_CONTEXT_GROUP_ID- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |id| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |id| {id.checked_add(1).filter(|next| *next > 0)}).expect("document inspector context group id exhausted");@@ -47,7 +47,7 @@ impl DocumentInspectorContextRegistrationId {static NEXT_CONTEXT_REGISTRATION_ID: AtomicU64 = AtomicU64::new(1);let id = NEXT_CONTEXT_REGISTRATION_ID- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |id| id.checked_add(1))+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |id| id.checked_add(1)).expect("document inspector context registration id exhausted");Self(NonZeroU64::new(id)diff --git a/moli-renderer-v8/src/script_vm/inspector/v8_backend.rs b/moli-renderer-v8/src/script_vm/inspector/v8_backend.rsindex f37e10e98..0b615c207 100644--- a/moli-renderer-v8/src/script_vm/inspector/v8_backend.rs+++ b/moli-renderer-v8/src/script_vm/inspector/v8_backend.rs@@ -535,7 +535,7 @@ impl RendererInspectorClientUniqueIdState {static NEXT_UNIQUE_ID: AtomicI64 = AtomicI64::new(1);let id = NEXT_UNIQUE_ID- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |id| id.checked_add(1))+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |id| id.checked_add(1)).expect("V8 inspector unique id exhausted");assert!(id > 0, "V8 inspector unique id exhausted");if self.capture_depth.get() > 0 {diff --git a/moli-renderer-v8/src/script_vm/inspector/v8_backend/interrupt.rs b/moli-renderer-v8/src/script_vm/inspector/v8_backend/interrupt.rsindex 8c165a098..629b97e4e 100644--- a/moli-renderer-v8/src/script_vm/inspector/v8_backend/interrupt.rs+++ b/moli-renderer-v8/src/script_vm/inspector/v8_backend/interrupt.rs@@ -44,7 +44,7 @@ impl Drop for EnteredOwnerWakeIsolateGuard {pub(super) fn allocate_session_executor_route_id() -> usize {NEXT_SESSION_EXECUTOR_ROUTE_ID- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |current| {current.checked_add(1)}).expect("renderer Inspector session-executor route ID exhausted")diff --git a/moli-renderer-v8/src/service_worker_runtime/clients.rs b/moli-renderer-v8/src/service_worker_runtime/clients.rsindex 23a9cb4f4..f47b102fd 100644--- a/moli-renderer-v8/src/service_worker_runtime/clients.rs+++ b/moli-renderer-v8/src/service_worker_runtime/clients.rs@@ -80,7 +80,7 @@ pub(crate) fn allocate_service_worker_exposed_client_id() -> String {fn allocate_service_worker_exposed_client_id_from(counter: &AtomicU64) -> String {let raw = counter- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |current| {current.checked_add(1)}).expect("ServiceWorker exposed client id allocator exhausted");diff --git a/moli-renderer-v8/src/worker/inspector_task_runner.rs b/moli-renderer-v8/src/worker/inspector_task_runner.rsindex bc2d444a0..69520ca54 100644--- a/moli-renderer-v8/src/worker/inspector_task_runner.rs+++ b/moli-renderer-v8/src/worker/inspector_task_runner.rs@@ -155,7 +155,7 @@ impl WorkerInspectorTaskRunner {isolate_handle: Arc<Mutex<Option<v8::IsolateHandle>>>,) -> Self {let route_id = NEXT_WORKER_INSPECTOR_ROUTE_ID- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |current| {current.checked_add(1)}).expect("worker Inspector route ID exhausted");diff --git a/moli-session-history/src/identity.rs b/moli-session-history/src/identity.rsindex 8c7d76ebe..46f2b15b9 100644--- a/moli-session-history/src/identity.rs+++ b/moli-session-history/src/identity.rs@@ -30,7 +30,7 @@ impl NavigationHistoryDocumentId {fn allocate_navigation_history_document_id(counter: &AtomicU64) -> NavigationHistoryDocumentId {let raw = counter- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |current| {current.checked_add(1)}).expect("Navigation History Document id allocator exhausted");@@ -69,7 +69,7 @@ impl std::ops::Deref for NavigationHistoryEntryKey {fn allocate_navigation_history_entry_key(counter: &AtomicU64) -> NavigationHistoryEntryKey {let raw = counter- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |current| {current.checked_add(1)}).expect("Navigation History entry key allocator exhausted");@@ -82,7 +82,7 @@ static NEXT_REVISION: AtomicU64 = AtomicU64::new(1);fn allocate(counter: &AtomicU64) -> u64 {counter- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |value| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |value| {value.checked_add(1)}).expect("session history identity allocator exhausted")diff --git a/moli-svg/src/geometry.rs b/moli-svg/src/geometry.rsindex afa082eab..8aa1c949e 100644--- a/moli-svg/src/geometry.rs+++ b/moli-svg/src/geometry.rs@@ -330,7 +330,7 @@ fn poly_points_geometry_path(raw: &str, close: bool) -> Option<BezPath> {if coordinates.len() < 2 || !coordinates.len().is_multiple_of(2) {return None;}- let mut coordinates = coordinates.chunks_exact(2);+ let mut coordinates = coordinates.as_chunks::<2>().0.iter();let first = coordinates.next()?;let mut path = BezPath::new();path.move_to((first[0], first[1]));diff --git a/moli-v8-platform/src/environment.rs b/moli-v8-platform/src/environment.rsindex b749a0599..766c00aec 100644--- a/moli-v8-platform/src/environment.rs+++ b/moli-v8-platform/src/environment.rs@@ -82,7 +82,7 @@ impl Default for ProcessEnvironmentOwner {fn default() -> Self {static NEXT_OWNER: AtomicU64 = AtomicU64::new(1);let id = NEXT_OWNER- .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| {+ .try_update(Ordering::Relaxed, Ordering::Relaxed, |current| {current.checked_add(1)}).expect("process environment owner ID exhausted");diff --git a/moli-v8-platform/src/environment/notifications.rs b/moli-v8-platform/src/environment/notifications.rsindex 56401ed04..dad492afe 100644--- a/moli-v8-platform/src/environment/notifications.rs+++ b/moli-v8-platform/src/environment/notifications.rs@@ -55,7 +55,7 @@ impl ProcessEnvironmentNotifications {ProcessEnvironmentInvalidation::DateTime => DATE_TIME,};self.pending- .fetch_update(Ordering::AcqRel, Ordering::Acquire, |pending| {+ .try_update(Ordering::AcqRel, Ordering::Acquire, |pending| {(pending & CLOSED == 0).then_some(pending | bits)})== Ok(0)diff --git a/moli-web-mime/src/response_policy.rs b/moli-web-mime/src/response_policy.rsindex 6dcdcb926..2d176b5d3 100644--- a/moli-web-mime/src/response_policy.rs+++ b/moli-web-mime/src/response_policy.rs@@ -232,7 +232,7 @@ fn decode_orb_script_candidate(content_type: &str, body: &[u8]) -> String {}fn decode_utf16_body(body: &[u8], little_endian: bool) -> String {- let units = body.chunks_exact(2).map(|chunk| {+ let units = body.as_chunks::<2>().0.iter().map(|chunk| {if little_endian {u16::from_le_bytes([chunk[0], chunk[1]])} else {diff --git a/vendor/v8-152.2.0/src/isolate.rs b/vendor/v8-152.2.0/src/isolate.rsindex a976320c5..92c556ec4 100644--- a/vendor/v8-152.2.0/src/isolate.rs+++ b/vendor/v8-152.2.0/src/isolate.rs@@ -2389,7 +2389,7 @@ fn current_thread_id() -> usize {// from another TLS destructor, where panicking would abort the process.// A relaxed global counter is sufficient because IDs are only compared.let id = NEXT_THREAD_ID- .fetch_update(+ .try_update(std::sync::atomic::Ordering::Relaxed,std::sync::atomic::Ordering::Relaxed,|next| next.checked_add(1),