mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-01 15:18:06 +00:00
LibWeb: Isolate WebAssembly cache by global object
This change moves WebAssembly related data that was previously globally accessible into the `WebAssemblyCache` object and creates one of these per global object. This ensures that WebAssembly data cannot be accessed across realms.
This commit is contained in:
parent
5e75afd549
commit
6d4b8bde55
Notes:
sideshowbarker
2024-07-17 02:57:43 +09:00
Author: https://github.com/tcl3
Commit: 6d4b8bde55
Pull-request: https://github.com/SerenityOS/serenity/pull/24051
Reviewed-by: https://github.com/alimpfard ✅
9 changed files with 121 additions and 116 deletions
|
@ -11,8 +11,10 @@
|
|||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Heap/GCPtr.h>
|
||||
#include <LibJS/Heap/Handle.h>
|
||||
#include <LibWasm/AbstractMachine/AbstractMachine.h>
|
||||
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/WebAssembly/WebAssembly.h>
|
||||
|
||||
namespace Web::WebAssembly {
|
||||
|
||||
|
@ -26,13 +28,16 @@ public:
|
|||
Object const* exports() const { return m_exports.ptr(); }
|
||||
|
||||
private:
|
||||
Instance(JS::Realm&, size_t index);
|
||||
Instance(JS::Realm&, NonnullOwnPtr<Wasm::ModuleInstance>);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
JS::NonnullGCPtr<Object> m_exports;
|
||||
size_t m_index { 0 };
|
||||
NonnullOwnPtr<Wasm::ModuleInstance> m_module_instance;
|
||||
HashMap<Wasm::FunctionAddress, JS::GCPtr<JS::FunctionObject>> m_function_instances;
|
||||
HashMap<Wasm::MemoryAddress, JS::GCPtr<WebAssembly::Memory>> m_memory_instances;
|
||||
HashMap<Wasm::TableAddress, JS::GCPtr<WebAssembly::Table>> m_table_instances;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue