script: Use OnceCell instead of RefCell for some module fields. (#42119)

This better reflects the intention of the code, which is that these
fields are set at most one time.

Testing: No behaviour change expected, so existing tests suffice.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews
2026-01-24 01:53:33 -05:00
committed by GitHub
parent 34955ec1e3
commit 7925a26a99
3 changed files with 43 additions and 52 deletions

View File

@@ -1049,18 +1049,14 @@ impl HTMLScriptElement {
// Step 6.
{
let module_error = module_tree.get_rethrow_error().borrow();
let network_error = module_tree.get_network_error().borrow();
let network_error = module_tree.get_network_error();
if module_error.is_some() && network_error.is_none() {
module_tree.report_error(global, can_gc);
return;
}
}
let record = module_tree
.get_record()
.borrow()
.as_ref()
.map(|record| record.handle());
let record = module_tree.get_record().map(|record| record.handle());
if let Some(record) = record {
rooted!(in(*GlobalScope::get_cx()) let mut rval = UndefinedValue());