Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
fix(layout): terminate fractional grid track growth
ldm064a649862797
diff --git a/Cargo.lock b/Cargo.lockindex be384b394..c21543ab4 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -5550,7 +5550,7 @@ dependencies = [[[package]]name = "taffy"version = "0.13.0"-source = "git+https://github.com/ldm0/taffy?rev=2b54aa97792a13a6a962202422a80c7385012935#2b54aa97792a13a6a962202422a80c7385012935"+source = "git+https://github.com/ldm0/taffy?rev=5453d6cdda8d2dd12b87e5237686e0adaf7cc0bc#5453d6cdda8d2dd12b87e5237686e0adaf7cc0bc"dependencies = ["arrayvec","serde",diff --git a/Cargo.toml b/Cargo.tomlindex d44af5433..51143ee7e 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -117,7 +117,7 @@ stylo_dom = { git = "https://github.com/lexmount/stylo", rev = "0c7e8baf63b6714estylo_static_prefs = { git = "https://github.com/lexmount/stylo", rev = "0c7e8baf63b6714e7614834fadbc09710f3c3d27" }stylo_traits = { git = "https://github.com/lexmount/stylo", rev = "0c7e8baf63b6714e7614834fadbc09710f3c3d27" }svgtypes = { git = "https://github.com/lexmount/svgtypes", branch = "moli" }-taffy = { git = "https://github.com/ldm0/taffy", rev = "2b54aa97792a13a6a962202422a80c7385012935" }+taffy = { git = "https://github.com/ldm0/taffy", rev = "5453d6cdda8d2dd12b87e5237686e0adaf7cc0bc" }[workspace.lints.clippy]disallowed_methods = "deny"diff --git a/moli/tests/fetch_cli.rs b/moli/tests/fetch_cli.rsindex d2a13119d..a14f027e1 100644--- a/moli/tests/fetch_cli.rs+++ b/moli/tests/fetch_cli.rs@@ -51,6 +51,8 @@ mod disable_js;mod eval;#[path = "fetch_cli/http_fail.rs"]mod http_fail;+#[path = "fetch_cli/layout_regressions.rs"]+mod layout_regressions;#[path = "fetch_cli/markdown.rs"]mod markdown;#[path = "fetch_cli/readiness.rs"]diff --git a/moli/tests/fetch_cli/layout_regressions.rs b/moli/tests/fetch_cli/layout_regressions.rsnew file mode 100644index 000000000..c61a942b9--- /dev/null+++ b/moli/tests/fetch_cli/layout_regressions.rs@@ -0,0 +1,68 @@+use super::clean_output;+use anyhow::{Context, Result, bail};+use base64::{Engine as _, engine::general_purpose::STANDARD};+use serde_json::Value;+use std::{+ process::{Command, Stdio},+ thread,+ time::{Duration, Instant},+};++fn run_layout(html: &str, expression: &str, fonts: bool) -> Result<Value> {+ let url = format!("data:text/html;base64,{}", STANDARD.encode(html));+ let mut command = Command::new(env!("CARGO_BIN_EXE_moli"));+ command.args([+ "fetch",+ "--log-level",+ "error",+ "--http-no-proxy",+ "*",+ "--layout",+ "--timeout",+ "2000",+ "--eval",+ expression,+ ]);+ if fonts {+ command.arg("--font");+ }+ let mut child = command+ .arg(url)+ .stdout(Stdio::piped())+ .stderr(Stdio::piped())+ .spawn()?;+ let started = Instant::now();+ loop {+ if child.try_wait()?.is_some() {+ break;+ }+ if started.elapsed() >= Duration::from_secs(10) {+ child.kill()?;+ let output = child.wait_with_output()?;+ bail!("layout did not terminate: {}", clean_output(&output.stderr));+ }+ thread::sleep(Duration::from_millis(10));+ }+ let output = child.wait_with_output()?;+ assert!(output.status.success(), "{}", clean_output(&output.stderr));+ serde_json::from_slice(&output.stdout).context("layout probe must return JSON")+}++#[test]+fn fractional_grid_track_limits_terminate_with_a_finite_item_width() -> Result<()> {+ // This formerly loops in track growth even after the CLI's own timeout.+ // The subprocess deadline also bounds this regression if the loop returns.+ let html = r#"<!doctype html><style>+ body { margin: 0 }+ .grid { display: grid; width: 1000px; height: 100px;+ grid-template-columns: minmax(6.879453%, 20.244017%) }+ </style><div class="grid"><div id="item">test</div></div>"#;+ let value = run_layout(+ html,+ "document.querySelector('#item').getBoundingClientRect().width",+ false,+ )?;+ let width = value.as_f64().context("item width must be a number")?;+ assert!((width - 202.44017).abs() < 0.05, "{width}");+ Ok(())+}