Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

refactor(dom): share associated Window lookup for documents

ldm0368eabd081cd
diff --git a/moli-renderer-v8/src/native_bridge/document.rs b/moli-renderer-v8/src/native_bridge/document.rs
index b3fc9286c..e0f6b871c 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::<v8::Object>::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>(