mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-20 19:00:25 +00:00
LibWeb: Support WASM modules
This adds support for importing WASM modules in JavaScript and vice versa.
This commit is contained in:
parent
7392d2a2f4
commit
e5dab9e1c7
Notes:
github-actions[bot]
2026-04-03 19:22:16 +00:00
Author: https://github.com/skyz1
Commit: e5dab9e1c7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6029
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/konradekk
Reviewed-by: https://github.com/shannonbooth ✅
30 changed files with 759 additions and 77 deletions
|
|
@ -10,6 +10,7 @@
|
|||
#include <LibJS/SyntheticModule.h>
|
||||
#include <LibWeb/Export.h>
|
||||
#include <LibWeb/HTML/Scripting/Script.h>
|
||||
#include <LibWeb/WebAssembly/WebAssemblyModule.h>
|
||||
|
||||
namespace JS::FFI {
|
||||
|
||||
|
|
@ -19,8 +20,7 @@ struct ParsedProgram;
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
// FIXME: Support WebAssembly Module Record
|
||||
using ModuleScriptRecord = Variant<Empty, GC::Ref<JS::SourceTextModule>, GC::Ref<JS::SyntheticModule>>;
|
||||
using ModuleScriptRecord = Variant<Empty, GC::Ref<JS::SourceTextModule>, GC::Ref<JS::SyntheticModule>, GC::Ref<WebAssembly::WebAssemblyModule>>;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#module-script
|
||||
class WEB_API ModuleScript : public Script {
|
||||
|
|
@ -35,13 +35,14 @@ public:
|
|||
static WebIDL::ExceptionOr<GC::Ptr<ModuleScript>> create_a_javascript_module_script(ByteString const& filename, StringView source, JS::Realm&, URL::URL base_url);
|
||||
static WebIDL::ExceptionOr<GC::Ptr<ModuleScript>> create_a_css_module_script(ByteString const& filename, StringView source, JS::Realm&);
|
||||
static WebIDL::ExceptionOr<GC::Ptr<ModuleScript>> create_a_json_module_script(ByteString const& filename, StringView source, JS::Realm&);
|
||||
static WebIDL::ExceptionOr<GC::Ptr<ModuleScript>> create_a_webassembly_module_script(ByteString const& filename, ByteBuffer body_bytes, JS::Realm&, URL::URL base_url);
|
||||
|
||||
enum class PreventErrorReporting {
|
||||
Yes,
|
||||
No
|
||||
};
|
||||
|
||||
JS::Promise* run(PreventErrorReporting = PreventErrorReporting::No);
|
||||
WebIDL::Promise* run(PreventErrorReporting = PreventErrorReporting::No);
|
||||
|
||||
ModuleScriptRecord record() const { return m_record; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue