From bb2cc3b8c311f0995c16f6eea2d80a996fc4e17e Mon Sep 17 00:00:00 2001 From: ldm0 Date: Sat, 3 Oct 2026 20:36:37 +0800 Subject: [PATCH] test(fetch): cover MIME parameters in no-cors header fills --- moli-renderer-v8/src/script_vm/tests/no_cors_header_fill.rs | 6 +++--- moli-renderer-v8/tests/fixtures/no-cors-header-fill.js | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/moli-renderer-v8/src/script_vm/tests/no_cors_header_fill.rs b/moli-renderer-v8/src/script_vm/tests/no_cors_header_fill.rs index 29ce0a7b74..b7f88fd034 100644 --- a/moli-renderer-v8/src/script_vm/tests/no_cors_header_fill.rs +++ b/moli-renderer-v8/src/script_vm/tests/no_cors_header_fill.rs @@ -4,7 +4,7 @@ use super::*; async fn no_cors_header_fill_uses_append_guards_in_window_and_worker() { let fixture = include_str!("../../../tests/fixtures/no-cors-header-fill.js"); for worker in [false, true] { - let server = StaticHttpServer::spawn_echo(64).await; + let server = StaticHttpServer::spawn_echo(72).await; let base = server.base_url(); let origin = serde_json::to_string(base.as_str().trim_end_matches('/')).unwrap(); let loader = static_http_loader([]); @@ -52,7 +52,7 @@ async fn no_cors_header_fill_uses_append_guards_in_window_and_worker() { .filter(|check| check["pass"] != true) .collect(); assert_eq!(result["state"], "pass", "worker={worker}: {failures:?}"); - assert_eq!(checks.len(), 320, "worker={worker}"); - assert_eq!(server.finish().await.len(), 64, "worker={worker}"); + assert_eq!(checks.len(), 360, "worker={worker}"); + assert_eq!(server.finish().await.len(), 72, "worker={worker}"); } } diff --git a/moli-renderer-v8/tests/fixtures/no-cors-header-fill.js b/moli-renderer-v8/tests/fixtures/no-cors-header-fill.js index 2d5a7d7922..98243e163c 100644 --- a/moli-renderer-v8/tests/fixtures/no-cors-header-fill.js +++ b/moli-renderer-v8/tests/fixtures/no-cors-header-fill.js @@ -13,6 +13,8 @@ async function noCorsFillProbe(base) { const longType = 'text/plain;x=' + 'a'.repeat(114); cases.push( ['type/duplicate', 'Content-Type', ['text/plain', 'text/plain'], 'text/plain', false], + ['type/parameter', 'Content-Type', ['text/plain;charset=utf8', 'extra'], 'text/plain;charset=utf8, extra', true], + ['type/parameter-second-type', 'Content-Type', ['text/plain;charset=utf8', 'application/json'], 'text/plain;charset=utf8, application/json', true], ['type/unsafe', 'Content-Type', ['text/plain;charset=utf8', '"'], 'text/plain;charset=utf8', false], ['type/invalid-first', 'Content-Type', ['application/json', 'text/plain'], 'text/plain', false], ['type/overflow', 'Content-Type', [longType, 'ok'], longType, false],