mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 20:05:07 +00:00
LibWeb+Meta: Add wrapper for the BufferSource/ArrayBufferView IDL types
These wrappers will make it much easier to do various operations on the different ArrayBuffer-related classes in LibWeb compared to the current solution, which is to just accept a Handle<Object> everywhere (and use "any" in the *.idl files). Co-Authored-By: Matthew Olsson <mattco@serenityos.org>
This commit is contained in:
parent
54d0aafff0
commit
04c094343f
27 changed files with 286 additions and 71 deletions
|
@ -11,16 +11,17 @@
|
|||
#include <LibWeb/Bindings/ModulePrototype.h>
|
||||
#include <LibWeb/WebAssembly/Module.h>
|
||||
#include <LibWeb/WebAssembly/WebAssembly.h>
|
||||
#include <LibWeb/WebIDL/Buffers.h>
|
||||
|
||||
namespace Web::WebAssembly {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Module);
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<Module>> Module::construct_impl(JS::Realm& realm, JS::Handle<JS::Object>& bytes)
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<Module>> Module::construct_impl(JS::Realm& realm, JS::Handle<WebIDL::BufferSource>& bytes)
|
||||
{
|
||||
auto& vm = realm.vm();
|
||||
|
||||
auto index = TRY(Detail::parse_module(vm, bytes.cell()));
|
||||
auto index = TRY(Detail::parse_module(vm, bytes->raw_object()));
|
||||
return vm.heap().allocate<Module>(realm, realm, index);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue