Skip to content

Truly independent web browser

LibWeb: Count a Notification's data towards garbage collection

Shannon Boothf578a9b3ae3a
diff --git a/Libraries/LibWeb/Bindings/Rust/src/notifications_api/notification.rs b/Libraries/LibWeb/Bindings/Rust/src/notifications_api/notification.rs
index fb713e83190..3e6a6b5ddd8 100644
--- a/Libraries/LibWeb/Bindings/Rust/src/notifications_api/notification.rs
+++ b/Libraries/LibWeb/Bindings/Rust/src/notifications_api/notification.rs
@@ -215,6 +215,13 @@ pub(crate) struct Notification {
}
impl Wrappable for Notification {
+ const OWNS_EXTERNAL_MEMORY: bool = true;
+ const COUNTS_EXTERNAL_MEMORY_WHEN_ALLOCATED: bool = true;
+
+ fn external_memory_size(&self) -> usize {
+ self.notification.data.capacity()
+ }
+
fn relevant_realm(&self) -> Option<Gc<Realm>> {
Some(self.realm)
}