From 5240998e9316e7d4b81ea77c0a4da355d43da8f3 Mon Sep 17 00:00:00 2001 From: ldm0 Date: Mon, 14 Sep 2026 15:23:19 +0800 Subject: [PATCH] fix(webapi): reconcile replayed FileList binding and regressions Use the shared FileList interface identity in the replayed input setter. Remove the duplicate XHR URL and credentials regression while retaining one complete copy, and format the newly replayed WebRTC import. Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (17971 passed, 13 skipped). --- .../src/context_bootstrap/webrtc/events.rs | 2 +- .../element/forms/input/files.rs | 2 +- .../src/script_vm/tests/dom_xhr/xhr.rs | 54 ------------------- 3 files changed, 2 insertions(+), 56 deletions(-) diff --git a/moli-renderer-v8/src/context_bootstrap/webrtc/events.rs b/moli-renderer-v8/src/context_bootstrap/webrtc/events.rs index c239d7fcb4..23b2d54df6 100644 --- a/moli-renderer-v8/src/context_bootstrap/webrtc/events.rs +++ b/moli-renderer-v8/src/context_bootstrap/webrtc/events.rs @@ -1,5 +1,5 @@ -use crate::web_api_interfaces; use super::{ice_candidate::ice_candidate_receiver_branded, rtc_data_channel_receiver_branded}; +use crate::web_api_interfaces; use crate::{ context_bootstrap::events::{initialize_event_object_with_type, parse_event_init}, util::{ diff --git a/moli-renderer-v8/src/native_bridge/element/forms/input/files.rs b/moli-renderer-v8/src/native_bridge/element/forms/input/files.rs index 9c2f9f19b3..990a91d7c1 100644 --- a/moli-renderer-v8/src/native_bridge/element/forms/input/files.rs +++ b/moli-renderer-v8/src/native_bridge/element/forms/input/files.rs @@ -129,7 +129,7 @@ fn input_files_setter_on_object<'s>( }; // Web IDL checks the interface identity, independent of the object's realm // or mutable prototype. This conversion also precedes input-type checks. - if !crate::context_bootstrap::is_file_list_object(scope, object) { + if !crate::web_api_interfaces::FileList::is_instance(scope, object) { throw_type_error( scope, "Failed to set the 'files' property on 'HTMLInputElement': The provided value is not of type 'FileList'.", diff --git a/moli-renderer-v8/src/script_vm/tests/dom_xhr/xhr.rs b/moli-renderer-v8/src/script_vm/tests/dom_xhr/xhr.rs index 482efca7fd..33b9689d0b 100644 --- a/moli-renderer-v8/src/script_vm/tests/dom_xhr/xhr.rs +++ b/moli-renderer-v8/src/script_vm/tests/dom_xhr/xhr.rs @@ -3435,60 +3435,6 @@ async fn streaming_xhr_materialization_failure_errors_body_source_before_close() ); } -#[tokio::test(flavor = "current_thread")] -async fn window_xhr_open_freezes_base_url_and_applies_url_credentials() { - let server = StaticHttpServer::spawn(1).await; - let base_url = server.base_url(); - let loader = static_http_loader(std::iter::empty::()); - let mut vm = new_page_task_executor_test_vm_with_loader( - base_url - .join("page.html") - .expect("page fixture URL") - .as_str(), - &loader, - ); - let first_base = base_url.join("first/").expect("first base URL"); - let second_base = base_url.join("second/").expect("second base URL"); - - vm.eval(&format!( - r#" -(() => {{ - globalThis.__xhrOpenUrlProbe = "pending"; - const base = document.createElement("base"); - base.href = {}; - document.head.append(base); - const xhr = new XMLHttpRequest(); - xhr.open("GET", "resource", true, "alice", "secret"); - base.href = {}; - xhr.onload = () => {{ globalThis.__xhrOpenUrlProbe = "done"; }}; - xhr.onerror = () => {{ globalThis.__xhrOpenUrlProbe = "error"; }}; - xhr.send(); - return "started"; -}})() -"#, - serde_json::to_string(first_base.as_str()).expect("serialize first base URL"), - serde_json::to_string(second_base.as_str()).expect("serialize second base URL"), - )) - .expect("XHR open URL probe should evaluate"); - - advance_page_task_executor_until_eval_equals( - &mut vm, - &loader, - "String(globalThis.__xhrOpenUrlProbe)", - "done", - "XHR open URL probe", - ) - .await; - - let requests = server.finish().await; - assert_eq!(requests.len(), 1); - assert_eq!(requests[0].target, "/first/resource"); - assert_eq!( - requests[0].header_value("authorization"), - Some("Basic YWxpY2U6c2VjcmV0") - ); -} - #[test] fn xhr_response_documents_keep_distinct_source_modification_times() { let environment = moli_v8_platform::ProcessEnvironmentOwner::default();