test: cover source rendering caches with suspended owner cycles
This commit is contained in:
@@ -6175,6 +6175,72 @@ returned = button.dispatch(dispatched)"#,
|
||||
assert!(!session.is_faulted());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn source_render_caches_do_not_root_a_page_block_waiting_frame_cycle() {
|
||||
let (mut session, _) = ReplSession::load(
|
||||
include_str!("../examples/gc-lifecycle.endor"),
|
||||
"app.main",
|
||||
902,
|
||||
1,
|
||||
)
|
||||
.unwrap();
|
||||
let baseline = session
|
||||
.execute("ui.stats().objects", "app.main")
|
||||
.unwrap()
|
||||
.value;
|
||||
session.execute("mountCycle()", "app.main").unwrap();
|
||||
session.poll_tasks().unwrap();
|
||||
assert_eq!(
|
||||
session.execute("phase.value", "app.main").unwrap().value,
|
||||
"1"
|
||||
);
|
||||
assert_eq!(
|
||||
session
|
||||
.execute("pending.value.status()", "app.main")
|
||||
.unwrap()
|
||||
.value,
|
||||
"\"running\""
|
||||
);
|
||||
let globals = session.candidate.globals.unwrap();
|
||||
let Value::Object(holder) = session
|
||||
.candidate
|
||||
.vm
|
||||
.dict_get(globals, &Value::Text("holder".into()))
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
else {
|
||||
panic!("holder")
|
||||
};
|
||||
let Value::Object(page) = session.candidate.vm.get_attr(holder, "value").unwrap() else {
|
||||
panic!("page")
|
||||
};
|
||||
let rect = crate::block::resolve(session.candidate.vm.object_store(), page)
|
||||
.unwrap()
|
||||
.1
|
||||
.children[0]
|
||||
.block;
|
||||
let page_weak = session.candidate.vm.object_store().downgrade(page).unwrap();
|
||||
let rect_weak = session.candidate.vm.object_store().downgrade(rect).unwrap();
|
||||
session.execute("holder.value.close()", "app.main").unwrap();
|
||||
assert_eq!(
|
||||
session
|
||||
.execute("pending.value.status()", "app.main")
|
||||
.unwrap()
|
||||
.value,
|
||||
"\"running\""
|
||||
);
|
||||
session.execute("releaseCycle()", "app.main").unwrap();
|
||||
assert_eq!(
|
||||
session
|
||||
.execute("ui.stats().objects", "app.main")
|
||||
.unwrap()
|
||||
.value,
|
||||
baseline
|
||||
);
|
||||
assert!(session.candidate.vm.upgrade(page_weak).unwrap().is_none());
|
||||
assert!(session.candidate.vm.upgrade(rect_weak).unwrap().is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn binding_tokens_do_not_retain_hidden_targets_and_compute_is_read_only() {
|
||||
let mut session = ReplSession::new(221).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user