M6: app.runtimeHighlight asks once, for the setting a script ends with, under the request cap

This commit is contained in:
Eric Kaden committed 2026-10-24 09:21:03 -04:00
1 parent 22e20b04fb
commit a90f764a8e
2 files changed
+8 -1

No files matched your search

+4 -1
View File
@@ -690,7 +690,10 @@ fn set_runtime_highlight(_: &JsValue, args: &[JsValue], ctx: &mut Context) -> Js
let mut h = host(ctx)?.borrow_mut();
if h.doc.highlight != on {
h.doc.highlight = on;
h.requests.push(Request::Highlight(on));
// Only the setting the script ends with matters: one request, the latest, under the
// host's request cap like any other.
h.requests.retain(|r| !matches!(r, Request::Highlight(_)));
h.request(Request::Highlight(on));
}
Ok(JsValue::undefined())
}
+4
View File
@@ -1560,6 +1560,10 @@ mod runtime_highlight {
assert_eq!(o.error, None);
assert_eq!(o.value, "false,true", "the script reads back what it set");
assert_eq!(o.requests, vec![Request::Highlight(true)]);
// A script that toggles it over and over asks once, for where it ended.
let o = go("for (var i = 0; i < 5001; i++) { app.runtimeHighlight = !app.runtimeHighlight; }", &ev);
assert_eq!(o.error, None);
assert_eq!(o.requests, vec![Request::Highlight(true)], "one request, the last setting");
}
/// The same in XFA scripts, where the change is an effect; nothing is asked for when the