mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:37:35 +00:00
LibJS: Add host layering point related to modules to VM
Also make HostResolveImportedModule fail on the browser to prevent module loading for now.
This commit is contained in:
parent
0b89dbc529
commit
be9d478d92
3 changed files with 14 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Module.h>
|
||||
#include <LibJS/Runtime/VM.h>
|
||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||
|
||||
|
@ -15,6 +16,10 @@ JS::VM& main_thread_vm()
|
|||
if (!vm) {
|
||||
vm = JS::VM::create(make<WebEngineCustomData>());
|
||||
static_cast<WebEngineCustomData*>(vm->custom_data())->event_loop.set_vm(*vm);
|
||||
|
||||
vm->host_resolve_imported_module = [&](JS::ScriptOrModule, JS::ModuleRequest const&) -> JS::ThrowCompletionOr<NonnullRefPtr<JS::Module>> {
|
||||
return vm->throw_completion<JS::InternalError>(vm->current_realm()->global_object(), JS::ErrorType::NotImplemented, "Modules in the browser");
|
||||
};
|
||||
}
|
||||
return *vm;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue