mirror of
https://github.com/lexmount/moli.git
synced 2026-09-23 08:01:28 +00:00
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.
This commit is contained in:
@@ -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}"#,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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 = '<p id="childOnly">child</p>';
|
||||
(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<v8::Context>;
|
||||
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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user