Integration: execMenuItem requests go through the request cap (#3580)

A script looping on app.execMenuItem could queue unlimited requests; they now follow the same count and byte limits as other requests.
This commit is contained in:
aiongg
2026-10-24 08:15:46 +00:00
parent b04257d5eb
commit 06959df890
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -704,7 +704,7 @@ pub(crate) fn menu_item(name: &str) -> Option<Request> {
fn exec_menu_item(_: &JsValue, args: &[JsValue], ctx: &mut Context) -> JsResult<JsValue> {
let item = text(&arg(args, 0), ctx)?;
if let Some(r) = menu_item(&item) {
host(ctx)?.borrow_mut().requests.push(r);
host(ctx)?.borrow_mut().request(r);
}
Ok(JsValue::undefined())
}
+7
View File
@@ -254,6 +254,13 @@ fn kept_bytes(o: &Outcome) -> usize {
o.console.iter().chain(&o.alerts).map(String::len).sum::<usize>() + o.requests.iter().map(req).sum::<usize>()
}
#[test]
fn exec_menu_item_requests_are_capped_like_other_requests() {
let o = go("for (var i = 0; i < 12000; i++) app.execMenuItem('Print');", &Event::field("Mouse Up", "agree", ""));
assert_eq!(o.error, None);
assert_eq!(o.requests.len(), crate::xfa::MAX_EFFECTS);
}
#[test]
fn console_alerts_and_requests_are_capped_in_count_and_bytes() {
let o = go(