summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Script.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-09-12 12:02:20 +0100
committerAndreas Kling <kling@serenityos.org>2021-09-12 15:18:25 +0200
commit106f29591688bc7f430f58360a2f6171e37b01ba (patch)
tree0b91ee9b6b1e2a53800adf19360877e698e951fa /Userland/Libraries/LibJS/Script.cpp
parent673fc02ac5ab92f8fe93b4cd831ec65c00a76654 (diff)
downloadserenity-106f29591688bc7f430f58360a2f6171e37b01ba.zip
LibJS+LibWeb: Make JS::Script and Web::HTML::ClassicScript use Realms
The spec wants Script Records to have a Realm, not a GlobalObject.
Diffstat (limited to 'Userland/Libraries/LibJS/Script.cpp')
-rw-r--r--Userland/Libraries/LibJS/Script.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibJS/Script.cpp b/Userland/Libraries/LibJS/Script.cpp
index 02bb7d46fb..14286749df 100644
--- a/Userland/Libraries/LibJS/Script.cpp
+++ b/Userland/Libraries/LibJS/Script.cpp
@@ -12,7 +12,7 @@
namespace JS {
// 16.1.5 ParseScript ( sourceText, realm, hostDefined ), https://tc39.es/ecma262/#sec-parse-script
-NonnullRefPtr<Script> Script::parse(StringView source_text, GlobalObject& global_object, StringView filename)
+NonnullRefPtr<Script> Script::parse(StringView source_text, Realm& realm, StringView filename)
{
// 1. Let body be ParseText(sourceText, Script).
auto body = Parser(Lexer(source_text, filename)).parse_program();
@@ -20,11 +20,11 @@ NonnullRefPtr<Script> Script::parse(StringView source_text, GlobalObject& global
// FIXME: 2. If body is a List of errors, return body.
// 3. Return Script Record { [[Realm]]: realm, [[ECMAScriptCode]]: body, [[HostDefined]]: hostDefined }.
- return adopt_ref(*new Script(global_object, move(body)));
+ return adopt_ref(*new Script(realm, move(body)));
}
-Script::Script(GlobalObject& global_object, NonnullRefPtr<Program> parse_node)
- : m_global_object(make_handle(&global_object))
+Script::Script(Realm& realm, NonnullRefPtr<Program> parse_node)
+ : m_realm(make_handle(&realm))
, m_parse_node(move(parse_node))
{
}