aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/utils.rs
diff options
context:
space:
mode:
authorErik Hennig <online@erik-hennig.me>2024-08-01 23:16:49 +0200
committerGitHub <noreply@github.com>2024-08-01 21:16:49 +0000
commit5963695664a6c0112bded05c9af9bbfa2224d411 (patch)
treed7cd468c01b5aa61146c2a675f359d1ebfb3f7f3 /components/script/dom/bindings/utils.rs
parent501950c2e33d421ad1a38fa095fa7aae610fd3aa (diff)
downloadservo-5963695664a6c0112bded05c9af9bbfa2224d411.tar.gz
servo-5963695664a6c0112bded05c9af9bbfa2224d411.zip
fix: Memory leak from CreateProxyWindowHandler (#32773)
* fix: Memory leak from CreateProxyWindowHandler Signed-off-by: ede1998 <online@erik-hennig.me> * fix: memory leak in WindowProxy Signed-off-by: ede1998 <online@erik-hennig.me> * fix: Memory leak in WindowProxyHandler through static Signed-off-by: ede1998 <online@erik-hennig.me> --------- Signed-off-by: ede1998 <online@erik-hennig.me>
Diffstat (limited to 'components/script/dom/bindings/utils.rs')
-rw-r--r--components/script/dom/bindings/utils.rs19
1 files changed, 5 insertions, 14 deletions
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs
index 64886971f5f..522b6f46686 100644
--- a/components/script/dom/bindings/utils.rs
+++ b/components/script/dom/bindings/utils.rs
@@ -31,7 +31,7 @@ use js::rust::{
MutableHandleValue, ToString,
};
use js::JS_CALLEE;
-use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
+use malloc_size_of::MallocSizeOfOps;
use crate::dom::bindings::codegen::PrototypeList::{MAX_PROTO_CHAIN_LENGTH, PROTO_OR_IFACE_LENGTH};
use crate::dom::bindings::codegen::{InterfaceObjectMap, PrototypeList};
@@ -42,31 +42,22 @@ use crate::dom::bindings::error::throw_invalid_this;
use crate::dom::bindings::inheritance::TopTypeId;
use crate::dom::bindings::str::DOMString;
use crate::dom::bindings::trace::trace_object;
-use crate::dom::windowproxy;
+use crate::dom::windowproxy::WindowProxyHandler;
use crate::script_runtime::JSContext as SafeJSContext;
-/// Proxy handler for a WindowProxy.
-pub struct WindowProxyHandler(pub *const libc::c_void);
-
-impl MallocSizeOf for WindowProxyHandler {
- fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
- // FIXME(#6907) this is a pointer to memory allocated by `new` in NewProxyHandler in rust-mozjs.
- 0
- }
-}
-
#[derive(JSTraceable, MallocSizeOf)]
/// Static data associated with a global object.
pub struct GlobalStaticData {
+ #[ignore_malloc_size_of = "WindowProxyHandler does not properly implement it anyway"]
/// The WindowProxy proxy handler for this global.
- pub windowproxy_handler: WindowProxyHandler,
+ pub windowproxy_handler: &'static WindowProxyHandler,
}
impl GlobalStaticData {
/// Creates a new GlobalStaticData.
pub fn new() -> GlobalStaticData {
GlobalStaticData {
- windowproxy_handler: windowproxy::new_window_proxy_handler(),
+ windowproxy_handler: WindowProxyHandler::proxy_handler(),
}
}
}