mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibJS: Make Script and Module GC-allocated
This ensures that code currently in any active or saved execution stack always stays alive.
This commit is contained in:
parent
cb15132146
commit
00c8f07192
Notes:
sideshowbarker
2024-07-17 07:23:36 +09:00
Author: https://github.com/awesomekling
Commit: 00c8f07192
Pull-request: https://github.com/SerenityOS/serenity/pull/14816
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/linusg ✅
18 changed files with 145 additions and 89 deletions
|
@ -231,7 +231,7 @@ inline ByteBuffer load_entire_file(StringView path)
|
|||
return buffer_or_error.release_value();
|
||||
}
|
||||
|
||||
inline AK::Result<NonnullRefPtr<JS::Script>, ParserError> parse_script(StringView path, JS::Realm& realm)
|
||||
inline AK::Result<JS::NonnullGCPtr<JS::Script>, ParserError> parse_script(StringView path, JS::Realm& realm)
|
||||
{
|
||||
auto contents = load_entire_file(path);
|
||||
auto script_or_errors = JS::Script::parse(contents, realm, path);
|
||||
|
@ -244,7 +244,7 @@ inline AK::Result<NonnullRefPtr<JS::Script>, ParserError> parse_script(StringVie
|
|||
return script_or_errors.release_value();
|
||||
}
|
||||
|
||||
inline AK::Result<NonnullRefPtr<JS::SourceTextModule>, ParserError> parse_module(StringView path, JS::Realm& realm)
|
||||
inline AK::Result<JS::NonnullGCPtr<JS::SourceTextModule>, ParserError> parse_module(StringView path, JS::Realm& realm)
|
||||
{
|
||||
auto contents = load_entire_file(path);
|
||||
auto script_or_errors = JS::SourceTextModule::parse(contents, realm, path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue