From 21079f17af7df69a696bbee5cd71c898a0aeec7f Mon Sep 17 00:00:00 2001 From: ldm0 Date: Wed, 23 Sep 2026 00:29:00 +0800 Subject: [PATCH] test(webidl): deduplicate Window regressions after main rebase Keep the existing reportError receiver-realm and Window named-property regressions in their topic sections. Main appended identical copies at the ends of these modules, causing duplicate Rust function definitions after rebasing the WPT branch. --- .../browser_api/events_selection_storage.rs | 74 ------------------- .../tests/dom_elements/dom_surface.rs | 33 --------- 2 files changed, 107 deletions(-) diff --git a/moli-renderer-v8/src/script_vm/tests/browser_api/events_selection_storage.rs b/moli-renderer-v8/src/script_vm/tests/browser_api/events_selection_storage.rs index acb299220..4c2526240 100644 --- a/moli-renderer-v8/src/script_vm/tests/browser_api/events_selection_storage.rs +++ b/moli-renderer-v8/src/script_vm/tests/browser_api/events_selection_storage.rs @@ -9611,77 +9611,3 @@ fn modal_dialog_selection_inertness_is_scoped_to_its_document() { r#"{"parentWithParentModal":"parent dialog","childWithParentModal":"child outside","childCommandWithParentModal":true,"childCommandTextWithParentModal":"child outside","parentWithChildModal":"parent outside","childWithChildModal":"child dialog","parentCommandWithChildModal":true,"parentCommandTextWithChildModal":"parent outside"}"# ); } - -#[test] -fn report_error_uses_the_receiver_realm_without_observing_exception_getters() { - let mut vm = new_storage_test_vm("https://report-error-receiver-realm.test/"); - - vm.eval( - r#" - (() => { - const frame = document.createElement("iframe"); - (document.body || document.documentElement || document).appendChild(frame); - globalThis.__reportErrorRealmFrame = frame; - return "ready"; - })() - "#, - ) - .expect("reportError receiver Realm setup should evaluate"); - vm.drain_pending_child_frame_work_for_test(); - - let result = vm - .eval( - r#" - (() => { - const child = globalThis.__reportErrorRealmFrame.contentWindow; - const childEvents = []; - let topEvents = 0; - let getterCalls = 0; - window.addEventListener("error", () => topEvents++); - child.addEventListener("error", event => childEvents.push(event)); - - const error = new TypeError("receiver failure"); - window.reportError.call(child, error); - - const opaqueReason = {}; - for (const name of ["name", "message", "fileName", "lineNumber", "columnNumber"]) { - Object.defineProperty(opaqueReason, name, { - get() { - getterCalls++; - throw new Error(`unexpected ${name} getter`); - } - }); - } - window.reportError.call(child, opaqueReason); - - let missingArgumentError = null; - try { - window.reportError(); - } catch (exception) { - missingArgumentError = exception.name; - } - - globalThis.__reportErrorRealmFrame.remove(); - child.reportError("detached failure"); - const detachedCallCompleted = true; - - return JSON.stringify({ - topEvents, - eventCount: childEvents.length, - exactErrors: [childEvents[0].error === error, childEvents[1].error === opaqueReason], - receiverRealm: childEvents.every(event => event instanceof child.ErrorEvent), - messagesAreNonEmpty: childEvents.every(event => event.message.length > 0), - getterCalls, - missingArgumentError, - detachedCallCompleted - }); - })() - "#, - ) - .expect("cross-Realm reportError probe should evaluate"); - - assert_eq!( - result, - r#"{"topEvents":0,"eventCount":2,"exactErrors":[true,true],"receiverRealm":true,"messagesAreNonEmpty":true,"getterCalls":0,"missingArgumentError":"TypeError","detachedCallCompleted":true}"#, - ); -} diff --git a/moli-renderer-v8/src/script_vm/tests/dom_elements/dom_surface.rs b/moli-renderer-v8/src/script_vm/tests/dom_elements/dom_surface.rs index 99fa58d40..5793aab5b 100644 --- a/moli-renderer-v8/src/script_vm/tests/dom_elements/dom_surface.rs +++ b/moli-renderer-v8/src/script_vm/tests/dom_elements/dom_surface.rs @@ -17142,36 +17142,3 @@ fn child_browsing_context_lookup_tolerates_document_handle_cycle() { Some(handle) ); } - -#[test] -fn window_named_access_uses_its_realm_during_child_history_callbacks() { - let mut vm = new_storage_test_vm("https://joint-history.test/parent"); - vm.eval( - r#" - const frame = document.createElement('iframe'); - frame.id = 'topFrame'; - frame.srcdoc = '

child

'; - (document.body || document.documentElement || document).appendChild(frame); - "#, - ) - .unwrap(); - vm.drain_pending_child_frame_work_for_test(); - let child = vm - ._context_host - .borrow() - .child_browsing_context_handles_in_document_order()[0]; - let context = &vm.page_default_context as *const v8::Global; - vm.with_context_scope_by_ptr(context, |scope, _| { - crate::native_bridge::enter_active_child_window_scope(scope, Some(child)); - Ok(()) - }) - .unwrap(); - let result = - vm.eval("[topFrame.id, typeof childOnly, frame.contentWindow.childOnly.id].join('|')"); - vm.with_context_scope_by_ptr(context, |scope, _| { - crate::native_bridge::enter_active_child_window_scope(scope, None); - Ok(()) - }) - .unwrap(); - assert_eq!(result.unwrap(), "topFrame|undefined|childOnly"); -}