From 7967faeefe972bedfcd8dfaf3f19c2278f1099d5 Mon Sep 17 00:00:00 2001 From: ldm0 Date: Mon, 5 Oct 2026 04:16:36 +0800 Subject: [PATCH] fix(navigation): adapt history updates to shared entry wrappers --- moli-renderer-v8/src/context_bootstrap/history_mutation.rs | 6 +++--- .../src/context_bootstrap/navigation_entry/wrappers.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/moli-renderer-v8/src/context_bootstrap/history_mutation.rs b/moli-renderer-v8/src/context_bootstrap/history_mutation.rs index 3169f33d7ed..fce43c7e04a 100644 --- a/moli-renderer-v8/src/context_bootstrap/history_mutation.rs +++ b/moli-renderer-v8/src/context_bootstrap/history_mutation.rs @@ -28,6 +28,7 @@ use super::navigation_window::{ window_navigation_for_holder, }; use super::*; +use crate::context_bootstrap::navigation_entry::wrappers as entry_wrappers; use crate::structured_clone::{deserialize_history_state, serialize_history_state}; use crate::webidl; @@ -52,13 +53,12 @@ pub(crate) fn update_history_for_document_open<'s>( let Some(previous_record) = history_record.borrow().current_entry().cloned() else { return; }; - let previous = - super::history_runtime::native::entry_wrapper(scope, window, previous_record.clone()); + let previous = entry_wrappers::for_window(scope, window, previous_record.clone()); let mut record = previous_record.borrow().clone(); record.url = url.as_str().to_owned(); record.id = super::navigation_entry::navigation_entry_public_token(new_navigation_entry_id().as_str()); - let entry = super::history_runtime::native::entry_wrapper(scope, window, record.into_ref()); + let entry = entry_wrappers::for_window(scope, window, record.into_ref()); let state = super::history_runtime::state::history_state_value(scope, history); replace_history_entry(scope, history, entry); cache_current_history_state(scope, history, state); diff --git a/moli-renderer-v8/src/context_bootstrap/navigation_entry/wrappers.rs b/moli-renderer-v8/src/context_bootstrap/navigation_entry/wrappers.rs index 5fa9d8c87be..c8c42d903ee 100644 --- a/moli-renderer-v8/src/context_bootstrap/navigation_entry/wrappers.rs +++ b/moli-renderer-v8/src/context_bootstrap/navigation_entry/wrappers.rs @@ -50,7 +50,7 @@ pub(in crate::context_bootstrap) fn in_realm<'s>( source: v8::Local<'s, v8::Object>, context: v8::Local<'s, v8::Context>, ) -> v8::Local<'s, v8::Object> { - if source.get_creation_context(scope) == Some(context) { + if crate::context_bootstrap::world_wrappers::belongs_to_world(scope, source, context) { return source; } let Some(record) = native::entry(scope, source) else {