script: Check same-origin-domain when evaluating javscript: URLs. (#41969)

These changes introduce a new OriginSnapshot type, which is an immutable
version of MutableOrigin (ie. an origin that includes an optional domain
modifier). This is now propagated as part of LoadData's origin, allowing
us to perform the same-origin-domain check for javascript: URLs as
needed.

Testing: Newly-passing tests.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews
2026-01-17 21:32:51 -05:00
committed by GitHub
parent bc1ec4bfaf
commit a97a345d6e
13 changed files with 93 additions and 38 deletions

View File

@@ -872,7 +872,7 @@ impl HTMLFormElement {
// Step 21
let target_window = target_document.window();
let mut load_data = LoadData::new(
LoadOrigin::Script(doc.origin().immutable().clone()),
LoadOrigin::Script(doc.origin().snapshot()),
action_components,
None,
target_window.as_global_scope().get_referrer(),