diff --git a/moli-renderer-v8/src/native_bridge/context_host/child_dynamic_scripts.rs b/moli-renderer-v8/src/native_bridge/context_host/child_dynamic_scripts.rs index f0a825ddc4d..3eb7c80971e 100644 --- a/moli-renderer-v8/src/native_bridge/context_host/child_dynamic_scripts.rs +++ b/moli-renderer-v8/src/native_bridge/context_host/child_dynamic_scripts.rs @@ -172,13 +172,9 @@ impl PageScriptHost { else { return Ok(()); }; - job.script_nonce = self - .dom_host() - .node(script_handle) - .and_then(crate::dom::native::Node::as_element) - .and_then(|element| element.cryptographic_nonce()) - .map(str::to_owned) - .or_else(|| self.dom_host().get_attribute(script_handle, "nonce")); + job.script_nonce = + crate::host::script_element_nonce_for_csp(self.dom_host(), script_handle) + .map(str::to_owned); job.script_integrity = self.dom_host().get_attribute(script_handle, "integrity"); // Commit before entering V8: the script can remove and reinsert itself, // mutate another pending script, or replace its preparation Document. diff --git a/moli-renderer-v8/src/native_bridge/context_host/child_runtime_script_order.rs b/moli-renderer-v8/src/native_bridge/context_host/child_runtime_script_order.rs index 41726dfaab8..5d307ef038e 100644 --- a/moli-renderer-v8/src/native_bridge/context_host/child_runtime_script_order.rs +++ b/moli-renderer-v8/src/native_bridge/context_host/child_runtime_script_order.rs @@ -132,7 +132,7 @@ mod tests { use super::*; use crate::frame_owner_model::{ DocumentId, FrameDocumentRealmBoundScriptWork, FrameSchedulerLaneId, LocalWindowId, - PendingChildDynamicDocumentScript, + PendingChildExternalClassicDocumentScript, }; fn owner(document: u64) -> FrameDocumentTaskOwner { @@ -144,14 +144,15 @@ mod tests { } fn work(owner: FrameDocumentTaskOwner, node: DomHandle) -> FrameDocumentScriptReadyTaskWork { - FrameDocumentRealmBoundScriptWork::DynamicClassic(PendingChildDynamicDocumentScript { + FrameDocumentRealmBoundScriptWork::ExternalClassic(PendingChildExternalClassicDocumentScript { child_handle: DomHandle::new(1), owner, realm_id: Some(FrameRealmId(2)), script_handle: node, - source: String::new(), - script_nonce: None, - script_integrity: None, + load_delay: crate::frame_owner_model::ChildDocumentAsyncClassicScriptLoadDelay::AlreadyUnblocked, + source_result: Ok(String::new()), + script_url: url::Url::parse("https://child-script-order.test/script.js").unwrap(), + script_base_url: url::Url::parse("https://child-script-order.test/").unwrap(), }) .into() } diff --git a/moli-renderer-v8/src/runtime/page_vm/tests/bitmap.rs b/moli-renderer-v8/src/runtime/page_vm/tests/bitmap.rs index f4765c17c45..07c24936cee 100644 --- a/moli-renderer-v8/src/runtime/page_vm/tests/bitmap.rs +++ b/moli-renderer-v8/src/runtime/page_vm/tests/bitmap.rs @@ -171,7 +171,7 @@ async fn bitmap_task_uses_child_intrinsics_and_retires_when_the_child_window_is_ 'scheduled' "#)?; run_expected_child_realm_materialization_for_wait(&mut page_vm, "child bitmap realm").await; - assert!(page_vm.run_exact_selected_page_task_for_test(PageSelectedTaskTestSelector::ChildDocumentScriptReady, &loader).await?); + assert!(!page_vm.run_exact_selected_page_task_for_test(PageSelectedTaskTestSelector::ChildDocumentScriptReady, &loader).await?, "inline execution must not leave a queued script task"); run_ready_bitmap_task(&mut page_vm).await?; assert_eq!(page_vm.vm_mut().eval("JSON.stringify(bitmapChildOutcome)")?, "[3,4,true]"); assert!(page_vm.vm().has_pending_bitmap_tasks());