mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
LibWeb: Remove data from WebAssembly cache when namespace is finalized
Previously, the cache held on to data for objects that had already been garbage collected.
This commit is contained in:
parent
ddd1ac1e36
commit
fcf1a2a287
Notes:
sideshowbarker
2024-07-17 20:22:04 +09:00
Author: https://github.com/tcl3
Commit: fcf1a2a287
Pull-request: https://github.com/SerenityOS/serenity/pull/24051
Reviewed-by: https://github.com/alimpfard ✅
3 changed files with 8 additions and 1 deletions
|
@ -48,6 +48,12 @@ void visit_edges(JS::Object& object, JS::Cell::Visitor& visitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void finalize(JS::Object& object)
|
||||||
|
{
|
||||||
|
auto& global_object = HTML::relevant_global_object(object);
|
||||||
|
Detail::s_caches.remove(global_object);
|
||||||
|
}
|
||||||
|
|
||||||
// https://webassembly.github.io/spec/js-api/#dom-webassembly-validate
|
// https://webassembly.github.io/spec/js-api/#dom-webassembly-validate
|
||||||
bool validate(JS::VM& vm, JS::Handle<WebIDL::BufferSource>& bytes)
|
bool validate(JS::VM& vm, JS::Handle<WebIDL::BufferSource>& bytes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
namespace Web::WebAssembly {
|
namespace Web::WebAssembly {
|
||||||
|
|
||||||
void visit_edges(JS::Object&, JS::Cell::Visitor&);
|
void visit_edges(JS::Object&, JS::Cell::Visitor&);
|
||||||
|
void finalize(JS::Object&);
|
||||||
|
|
||||||
bool validate(JS::VM&, JS::Handle<WebIDL::BufferSource>& bytes);
|
bool validate(JS::VM&, JS::Handle<WebIDL::BufferSource>& bytes);
|
||||||
WebIDL::ExceptionOr<JS::Value> compile(JS::VM&, JS::Handle<WebIDL::BufferSource>& bytes);
|
WebIDL::ExceptionOr<JS::Value> compile(JS::VM&, JS::Handle<WebIDL::BufferSource>& bytes);
|
||||||
|
|
|
@ -7,7 +7,7 @@ dictionary WebAssemblyInstantiatedSource {
|
||||||
};
|
};
|
||||||
|
|
||||||
// https://webassembly.github.io/spec/js-api/#webassembly-namespace
|
// https://webassembly.github.io/spec/js-api/#webassembly-namespace
|
||||||
[Exposed=*, WithGCVisitor]
|
[Exposed=*, WithGCVisitor, WithFinalizer]
|
||||||
namespace WebAssembly {
|
namespace WebAssembly {
|
||||||
boolean validate(BufferSource bytes);
|
boolean validate(BufferSource bytes);
|
||||||
Promise<Module> compile(BufferSource bytes);
|
Promise<Module> compile(BufferSource bytes);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue