From fbc1ffc2776ba9fdabeb975bb706f78f5cff829b Mon Sep 17 00:00:00 2001 From: ldm0 Date: Wed, 30 Sep 2026 00:29:56 +0800 Subject: [PATCH] refactor(dom): share associated Window lookup for documents --- moli-renderer-v8/src/native_bridge/document.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/moli-renderer-v8/src/native_bridge/document.rs b/moli-renderer-v8/src/native_bridge/document.rs index b3fc9286cb..e0f6b871cd 100644 --- a/moli-renderer-v8/src/native_bridge/document.rs +++ b/moli-renderer-v8/src/native_bridge/document.rs @@ -1277,17 +1277,7 @@ pub(crate) fn document_associated_window_for_handle<'s>( let document = unsafe { &mut *runtime_ptr } .native_bridge_mut() .wrap_handle(scope, runtime_ptr, handle)?; - if let Some(window) = get_private_value(scope, document, DOCUMENT_ASSOCIATED_WINDOW_SLOT) - .and_then(|value| v8::Local::::try_from(value).ok()) - { - return Some(window); - } - if unsafe { &*runtime_ptr }.dom_host().document_handle() != handle { - return None; - } - document - .get_creation_context(scope) - .map(|context| context.global(scope)) + document_associated_window_for_object(scope, runtime_ptr, handle, document) } pub(in crate::native_bridge) fn set_document_associated_window<'s>(