summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Meta/Lagom/Fuzzers/FuzzilliJs.cpp7
-rw-r--r--Userland/Applications/Spreadsheet/JSIntegration.cpp5
-rw-r--r--Userland/Applications/Spreadsheet/JSIntegration.h3
-rw-r--r--Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp2
-rw-r--r--Userland/Libraries/LibJS/Contrib/Test262/GlobalObject.cpp4
-rw-r--r--Userland/Libraries/LibJS/Contrib/Test262/GlobalObject.h2
-rw-r--r--Userland/Libraries/LibJS/Runtime/GlobalObject.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/GlobalObject.h3
-rw-r--r--Userland/Libraries/LibJS/Runtime/Realm.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp2
-rw-r--r--Userland/Libraries/LibTest/JavaScriptTestRunner.h9
-rw-r--r--Userland/Libraries/LibWeb/Bindings/WindowObject.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Bindings/WindowObject.h2
-rw-r--r--Userland/Services/WebContent/ConsoleGlobalObject.cpp4
-rw-r--r--Userland/Services/WebContent/ConsoleGlobalObject.h3
-rw-r--r--Userland/Services/WebContent/WebContentConsoleClient.cpp2
-rw-r--r--Userland/Utilities/js.cpp14
17 files changed, 36 insertions, 36 deletions
diff --git a/Meta/Lagom/Fuzzers/FuzzilliJs.cpp b/Meta/Lagom/Fuzzers/FuzzilliJs.cpp
index e4d2a9a711..f55840bcac 100644
--- a/Meta/Lagom/Fuzzers/FuzzilliJs.cpp
+++ b/Meta/Lagom/Fuzzers/FuzzilliJs.cpp
@@ -120,10 +120,9 @@ class TestRunnerGlobalObject final : public JS::GlobalObject {
public:
TestRunnerGlobalObject(JS::Realm&);
+ virtual void initialize(JS::Realm&) override;
virtual ~TestRunnerGlobalObject() override;
- virtual void initialize_global_object(JS::Realm&) override;
-
private:
JS_DECLARE_NATIVE_FUNCTION(fuzzilli);
};
@@ -168,9 +167,9 @@ JS_DEFINE_NATIVE_FUNCTION(TestRunnerGlobalObject::fuzzilli)
return JS::js_undefined();
}
-void TestRunnerGlobalObject::initialize_global_object(JS::Realm& realm)
+void TestRunnerGlobalObject::initialize(JS::Realm& realm)
{
- Base::initialize_global_object(realm);
+ Base::initialize(realm);
define_direct_property("global", this, JS::Attribute::Enumerable);
define_native_function(realm, "fuzzilli", fuzzilli, 2, JS::default_attributes);
}
diff --git a/Userland/Applications/Spreadsheet/JSIntegration.cpp b/Userland/Applications/Spreadsheet/JSIntegration.cpp
index f5e2022fa0..b7e5a07f83 100644
--- a/Userland/Applications/Spreadsheet/JSIntegration.cpp
+++ b/Userland/Applications/Spreadsheet/JSIntegration.cpp
@@ -144,9 +144,10 @@ JS::ThrowCompletionOr<bool> SheetGlobalObject::internal_set(const JS::PropertyKe
return Base::internal_set(property_name, value, receiver);
}
-void SheetGlobalObject::initialize_global_object(JS::Realm& realm)
+void SheetGlobalObject::initialize(JS::Realm& realm)
{
- Base::initialize_global_object(realm);
+ Base::initialize(realm);
+
u8 attr = JS::Attribute::Configurable | JS::Attribute::Writable | JS::Attribute::Enumerable;
define_native_function(realm, "get_real_cell_contents", get_real_cell_contents, 1, attr);
define_native_function(realm, "set_real_cell_contents", set_real_cell_contents, 2, attr);
diff --git a/Userland/Applications/Spreadsheet/JSIntegration.h b/Userland/Applications/Spreadsheet/JSIntegration.h
index bf6f007e5e..1d76430ab7 100644
--- a/Userland/Applications/Spreadsheet/JSIntegration.h
+++ b/Userland/Applications/Spreadsheet/JSIntegration.h
@@ -24,13 +24,12 @@ class SheetGlobalObject final : public JS::GlobalObject {
public:
SheetGlobalObject(JS::Realm&, Sheet&);
-
+ virtual void initialize(JS::Realm&) override;
virtual ~SheetGlobalObject() override = default;
virtual JS::ThrowCompletionOr<bool> internal_has_property(JS::PropertyKey const& name) const override;
virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value receiver) const override;
virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver) override;
- virtual void initialize_global_object(JS::Realm&) override;
JS_DECLARE_NATIVE_FUNCTION(get_real_cell_contents);
JS_DECLARE_NATIVE_FUNCTION(set_real_cell_contents);
diff --git a/Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp b/Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp
index b70b70abf9..bca046a5cc 100644
--- a/Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp
+++ b/Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp
@@ -62,7 +62,7 @@ JS_DEFINE_NATIVE_FUNCTION($262Object::create_realm)
auto* realm_global_object = vm.heap().allocate_without_realm<GlobalObject>(*realm);
VERIFY(realm_global_object);
realm->set_global_object(realm_global_object, nullptr);
- realm_global_object->initialize_global_object(*realm);
+ realm_global_object->initialize(*realm);
return Value(realm_global_object->$262());
}
diff --git a/Userland/Libraries/LibJS/Contrib/Test262/GlobalObject.cpp b/Userland/Libraries/LibJS/Contrib/Test262/GlobalObject.cpp
index 2129fcfa04..95d7c3867b 100644
--- a/Userland/Libraries/LibJS/Contrib/Test262/GlobalObject.cpp
+++ b/Userland/Libraries/LibJS/Contrib/Test262/GlobalObject.cpp
@@ -14,9 +14,9 @@
namespace JS::Test262 {
-void GlobalObject::initialize_global_object(Realm& realm)
+void GlobalObject::initialize(Realm& realm)
{
- Base::initialize_global_object(realm);
+ Base::initialize(realm);
m_$262 = vm().heap().allocate<$262Object>(realm, realm);
diff --git a/Userland/Libraries/LibJS/Contrib/Test262/GlobalObject.h b/Userland/Libraries/LibJS/Contrib/Test262/GlobalObject.h
index 168467d0b6..f095233c1a 100644
--- a/Userland/Libraries/LibJS/Contrib/Test262/GlobalObject.h
+++ b/Userland/Libraries/LibJS/Contrib/Test262/GlobalObject.h
@@ -19,7 +19,7 @@ public:
: JS::GlobalObject(realm)
{
}
- virtual void initialize_global_object(Realm&) override;
+ virtual void initialize(Realm&) override;
virtual ~GlobalObject() override = default;
$262Object* $262() const { return m_$262; }
diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp
index 3464b6b34a..5d147d37eb 100644
--- a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp
@@ -88,8 +88,10 @@ GlobalObject::GlobalObject(Realm& realm)
}
// 9.3.4 SetDefaultGlobalBindings ( realmRec ), https://tc39.es/ecma262/#sec-setdefaultglobalbindings
-void GlobalObject::initialize_global_object(Realm& realm)
+void GlobalObject::initialize(Realm& realm)
{
+ Base::initialize(realm);
+
auto& vm = this->vm();
ensure_shape_is_unique();
diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.h b/Userland/Libraries/LibJS/Runtime/GlobalObject.h
index e1704b9c70..0557038477 100644
--- a/Userland/Libraries/LibJS/Runtime/GlobalObject.h
+++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.h
@@ -18,8 +18,7 @@ class GlobalObject : public Object {
public:
explicit GlobalObject(Realm&);
- virtual void initialize_global_object(Realm&);
-
+ virtual void initialize(Realm&) override;
virtual ~GlobalObject() override;
private:
diff --git a/Userland/Libraries/LibJS/Runtime/Realm.cpp b/Userland/Libraries/LibJS/Runtime/Realm.cpp
index a855589793..10d48b4d8d 100644
--- a/Userland/Libraries/LibJS/Runtime/Realm.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Realm.cpp
@@ -75,7 +75,7 @@ ThrowCompletionOr<NonnullOwnPtr<ExecutionContext>> Realm::initialize_host_define
// 10. Let globalObj be ? SetDefaultGlobalBindings(realm).
// 11. Create any host-defined global object properties on globalObj.
- realm->global_object().initialize_global_object(*realm);
+ realm->global_object().initialize(*realm);
// 12. Return unused.
return new_context;
diff --git a/Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp
index d0a384ddf0..2ea3f75bd7 100644
--- a/Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp
@@ -64,7 +64,7 @@ ThrowCompletionOr<Object*> ShadowRealmConstructor::construct(FunctionObject& new
// 10. Perform ? SetRealmGlobalObject(realmRec, undefined, undefined).
auto* new_global_object = vm.heap().allocate_without_realm<GlobalObject>(*realm);
realm->set_global_object(new_global_object, nullptr);
- new_global_object->initialize_global_object(*realm);
+ new_global_object->initialize(*realm);
// TODO: I don't think we should have these exactly like this, that doesn't work well with how
// we create global objects. Still, it should be possible to make a ShadowRealm with a
diff --git a/Userland/Libraries/LibTest/JavaScriptTestRunner.h b/Userland/Libraries/LibTest/JavaScriptTestRunner.h
index eef825661d..d4658eabfa 100644
--- a/Userland/Libraries/LibTest/JavaScriptTestRunner.h
+++ b/Userland/Libraries/LibTest/JavaScriptTestRunner.h
@@ -194,15 +194,14 @@ public:
: JS::GlobalObject(realm)
{
}
-
+ virtual void initialize(JS::Realm&) override;
virtual ~TestRunnerGlobalObject() override = default;
-
- virtual void initialize_global_object(JS::Realm&) override;
};
-inline void TestRunnerGlobalObject::initialize_global_object(JS::Realm& realm)
+inline void TestRunnerGlobalObject::initialize(JS::Realm& realm)
{
- Base::initialize_global_object(realm);
+ Base::initialize(realm);
+
define_direct_property("global", this, JS::Attribute::Enumerable);
for (auto& entry : s_exposed_global_functions) {
define_native_function(
diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp
index 4c58147063..3ac4ff6ba7 100644
--- a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp
@@ -57,9 +57,9 @@ WindowObject::WindowObject(JS::Realm& realm, HTML::Window& impl)
impl.set_wrapper({}, *this);
}
-void WindowObject::initialize_global_object(JS::Realm& realm)
+void WindowObject::initialize(JS::Realm& realm)
{
- Base::initialize_global_object(realm);
+ Base::initialize(realm);
Object::set_prototype(&ensure_web_prototype<WindowPrototype>("Window"));
diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.h b/Userland/Libraries/LibWeb/Bindings/WindowObject.h
index df346b8f44..7e7a8bac78 100644
--- a/Userland/Libraries/LibWeb/Bindings/WindowObject.h
+++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.h
@@ -33,7 +33,7 @@ class WindowObject
public:
explicit WindowObject(JS::Realm&, HTML::Window&);
- virtual void initialize_global_object(JS::Realm&) override;
+ virtual void initialize(JS::Realm&) override;
virtual ~WindowObject() override = default;
HTML::Window& impl() { return *m_impl; }
diff --git a/Userland/Services/WebContent/ConsoleGlobalObject.cpp b/Userland/Services/WebContent/ConsoleGlobalObject.cpp
index 6ab8d6949d..785c1e1855 100644
--- a/Userland/Services/WebContent/ConsoleGlobalObject.cpp
+++ b/Userland/Services/WebContent/ConsoleGlobalObject.cpp
@@ -20,9 +20,9 @@ ConsoleGlobalObject::ConsoleGlobalObject(JS::Realm& realm, Web::Bindings::Window
{
}
-void ConsoleGlobalObject::initialize_global_object(JS::Realm& realm)
+void ConsoleGlobalObject::initialize(JS::Realm& realm)
{
- Base::initialize_global_object(realm);
+ Base::initialize(realm);
// $0 magic variable
define_native_accessor(realm, "$0", inspected_node_getter, nullptr, 0);
diff --git a/Userland/Services/WebContent/ConsoleGlobalObject.h b/Userland/Services/WebContent/ConsoleGlobalObject.h
index 884ca4b4c7..49118ac68d 100644
--- a/Userland/Services/WebContent/ConsoleGlobalObject.h
+++ b/Userland/Services/WebContent/ConsoleGlobalObject.h
@@ -21,6 +21,7 @@ class ConsoleGlobalObject final : public JS::GlobalObject {
public:
ConsoleGlobalObject(JS::Realm&, Web::Bindings::WindowObject&);
+ virtual void initialize(JS::Realm&) override;
virtual ~ConsoleGlobalObject() override = default;
virtual JS::ThrowCompletionOr<Object*> internal_get_prototype_of() const override;
@@ -35,8 +36,6 @@ public:
virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const& name) override;
virtual JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> internal_own_property_keys() const override;
- virtual void initialize_global_object(JS::Realm&) override;
-
private:
virtual void visit_edges(Visitor&) override;
diff --git a/Userland/Services/WebContent/WebContentConsoleClient.cpp b/Userland/Services/WebContent/WebContentConsoleClient.cpp
index c048e9bc68..1e2218537b 100644
--- a/Userland/Services/WebContent/WebContentConsoleClient.cpp
+++ b/Userland/Services/WebContent/WebContentConsoleClient.cpp
@@ -33,7 +33,7 @@ WebContentConsoleClient::WebContentConsoleClient(JS::Console& console, WeakPtr<J
// It gets removed immediately after creating the interpreter in Document::interpreter().
auto& eso = verify_cast<Web::HTML::EnvironmentSettingsObject>(*realm.host_defined());
vm.push_execution_context(eso.realm_execution_context());
- console_global_object->initialize_global_object(realm);
+ console_global_object->initialize(realm);
vm.pop_execution_context();
m_console_global_object = JS::make_handle(console_global_object);
diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp
index 39ee42c0ea..fad8a6be00 100644
--- a/Userland/Utilities/js.cpp
+++ b/Userland/Utilities/js.cpp
@@ -97,7 +97,7 @@ public:
: GlobalObject(realm)
{
}
- virtual void initialize_global_object(JS::Realm&) override;
+ virtual void initialize(JS::Realm&) override;
virtual ~ReplObject() override = default;
private:
@@ -118,7 +118,7 @@ public:
: JS::GlobalObject(realm)
{
}
- virtual void initialize_global_object(JS::Realm&) override;
+ virtual void initialize(JS::Realm&) override;
virtual ~ScriptObject() override = default;
private:
@@ -1301,9 +1301,10 @@ static JS::ThrowCompletionOr<JS::Value> load_json_impl(JS::VM& vm)
return JS::JSONObject::parse_json_value(vm, json.value());
}
-void ReplObject::initialize_global_object(JS::Realm& realm)
+void ReplObject::initialize(JS::Realm& realm)
{
- Base::initialize_global_object(realm);
+ Base::initialize(realm);
+
define_direct_property("global", this, JS::Attribute::Enumerable);
u8 attr = JS::Attribute::Configurable | JS::Attribute::Writable | JS::Attribute::Enumerable;
define_native_function(realm, "exit", exit_interpreter, 0, attr);
@@ -1380,9 +1381,10 @@ JS_DEFINE_NATIVE_FUNCTION(ReplObject::print)
return JS::js_undefined();
}
-void ScriptObject::initialize_global_object(JS::Realm& realm)
+void ScriptObject::initialize(JS::Realm& realm)
{
- Base::initialize_global_object(realm);
+ Base::initialize(realm);
+
define_direct_property("global", this, JS::Attribute::Enumerable);
u8 attr = JS::Attribute::Configurable | JS::Attribute::Writable | JS::Attribute::Enumerable;
define_native_function(realm, "loadINI", load_ini, 1, attr);