Skip to content

Truly independent web browser

LibJS: Remove facade types and accessors that nothing uses

Shannon Boothd09c47c3491c
diff --git a/Libraries/LibJS/Runtime/Accessor.h b/Libraries/LibJS/Runtime/Accessor.h
deleted file mode 100644
index 3a35cc671a0..00000000000
--- a/Libraries/LibJS/Runtime/Accessor.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2020, Matthew Olsson <[email protected]>
- * Copyright (c) 2020, Linus Groh <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <AK/StringView.h>
-#include <LibJS/Heap/EngineCell.h>
-#include <LibJS/Runtime/FunctionObject.h>
-#include <LibJS/Runtime/Symbol.h>
-#include <LibJS/Runtime/VM.h>
-
-namespace JS {
-
-// The getter and setter of an accessor property, which the runtime keeps in a cell of its own. LibJS's users only name
-// the type.
-class Accessor final : public EngineCell {
-};
-
-}
diff --git a/Libraries/LibJS/Runtime/ArrayPrototype.h b/Libraries/LibJS/Runtime/ArrayPrototype.h
deleted file mode 100644
index 02dd58d6caf..00000000000
--- a/Libraries/LibJS/Runtime/ArrayPrototype.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (c) 2020, Andreas Kling <[email protected]>
- * Copyright (c) 2020-2022, Linus Groh <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <LibJS/Runtime/Array.h>
-
-namespace JS {
-
-// %Array.prototype%, which LibJS's users reach through Intrinsics::array_prototype().
-class ArrayPrototype final : public Array {
-};
-
-}
diff --git a/Libraries/LibJS/Runtime/AsyncIteratorPrototype.h b/Libraries/LibJS/Runtime/AsyncIteratorPrototype.h
deleted file mode 100644
index 55ba9c0206a..00000000000
--- a/Libraries/LibJS/Runtime/AsyncIteratorPrototype.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2021, David Tuin <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <AK/StringView.h>
-#include <AK/TypeCasts.h>
-#include <LibJS/Runtime/Completion.h>
-#include <LibJS/Runtime/GlobalObject.h>
-#include <LibJS/Runtime/Object.h>
-#include <LibJS/Runtime/ValueInlines.h>
-
-namespace JS {
-
-// %AsyncIteratorPrototype%, which LibJS's users reach through Intrinsics::async_iterator_prototype().
-class AsyncIteratorPrototype final : public Object {
-};
-
-}
diff --git a/Libraries/LibJS/Runtime/DataViewConstructor.h b/Libraries/LibJS/Runtime/DataViewConstructor.h
deleted file mode 100644
index b39bf6ccb80..00000000000
--- a/Libraries/LibJS/Runtime/DataViewConstructor.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright (c) 2021, Idan Horowitz <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <LibJS/Runtime/NativeFunction.h>
-
-namespace JS {
-
-class DataViewConstructor final : public NativeFunction {
-};
-
-}
diff --git a/Libraries/LibJS/Runtime/Intrinsics.cpp b/Libraries/LibJS/Runtime/Intrinsics.cpp
index 921d7a8934e..afe04c66d82 100644
--- a/Libraries/LibJS/Runtime/Intrinsics.cpp
+++ b/Libraries/LibJS/Runtime/Intrinsics.cpp
@@ -6,7 +6,6 @@
#include <LibJS/EmbeddingABIConversions.h>
#include <LibJS/Runtime/ConsoleObject.h>
-#include <LibJS/Runtime/DataViewConstructor.h>
#include <LibJS/Runtime/ErrorConstructor.h>
#include <LibJS/Runtime/FunctionObject.h>
#include <LibJS/Runtime/Intrinsics.h>
@@ -48,7 +47,6 @@ Realm& Intrinsics::realm() const
}
GC::Ref<Object> Intrinsics::object_prototype() { return intrinsic_of_realm<Object>(realm(), JS_INTRINSIC_OBJECT_PROTOTYPE); }
-GC::Ref<Object> Intrinsics::function_prototype() { return intrinsic_of_realm<Object>(realm(), JS_INTRINSIC_FUNCTION_PROTOTYPE); }
GC::Ref<Object> Intrinsics::array_prototype() { return intrinsic_of_realm<Object>(realm(), JS_INTRINSIC_ARRAY_PROTOTYPE); }
GC::Ref<Object> Intrinsics::string_prototype() { return intrinsic_of_realm<Object>(realm(), JS_INTRINSIC_STRING_PROTOTYPE); }
GC::Ref<Object> Intrinsics::error_prototype() { return intrinsic_of_realm<Object>(realm(), JS_INTRINSIC_ERROR_PROTOTYPE); }
@@ -58,7 +56,6 @@ GC::Ref<Object> Intrinsics::async_iterator_prototype() { return intrinsic_of_rea
GC::Ref<ErrorConstructor> Intrinsics::error_constructor() { return intrinsic_of_realm<ErrorConstructor>(realm(), JS_INTRINSIC_ERROR_CONSTRUCTOR); }
GC::Ref<PromiseConstructor> Intrinsics::promise_constructor() { return intrinsic_of_realm<PromiseConstructor>(realm(), JS_INTRINSIC_PROMISE_CONSTRUCTOR); }
GC::Ref<SharedArrayBufferConstructor> Intrinsics::shared_array_buffer_constructor() { return intrinsic_of_realm<SharedArrayBufferConstructor>(realm(), JS_INTRINSIC_SHARED_ARRAY_BUFFER_CONSTRUCTOR); }
-GC::Ref<DataViewConstructor> Intrinsics::data_view_constructor() { return intrinsic_of_realm<DataViewConstructor>(realm(), JS_INTRINSIC_DATA_VIEW_CONSTRUCTOR); }
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
GC::Ref<ConstructorName> Intrinsics::snake_name##_constructor() \
diff --git a/Libraries/LibJS/Runtime/Intrinsics.h b/Libraries/LibJS/Runtime/Intrinsics.h
index 2de7c7e0681..cdbe1064553 100644
--- a/Libraries/LibJS/Runtime/Intrinsics.h
+++ b/Libraries/LibJS/Runtime/Intrinsics.h
@@ -21,7 +21,6 @@ namespace JS {
class JS_API Intrinsics final : public EngineCell {
public:
GC::Ref<Object> object_prototype();
- GC::Ref<Object> function_prototype();
GC::Ref<Object> array_prototype();
GC::Ref<Object> string_prototype();
GC::Ref<Object> error_prototype();
@@ -31,7 +30,6 @@ public:
GC::Ref<ErrorConstructor> error_constructor();
GC::Ref<PromiseConstructor> promise_constructor();
GC::Ref<SharedArrayBufferConstructor> shared_array_buffer_constructor();
- GC::Ref<DataViewConstructor> data_view_constructor();
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
GC::Ref<ConstructorName> snake_name##_constructor();
diff --git a/Libraries/LibJS/Runtime/IteratorPrototype.h b/Libraries/LibJS/Runtime/IteratorPrototype.h
deleted file mode 100644
index 92afa7bdeaf..00000000000
--- a/Libraries/LibJS/Runtime/IteratorPrototype.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2020, Matthew Olsson <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <AK/StringView.h>
-#include <AK/TypeCasts.h>
-#include <LibJS/Runtime/Completion.h>
-#include <LibJS/Runtime/GlobalObject.h>
-#include <LibJS/Runtime/Iterator.h>
-#include <LibJS/Runtime/Object.h>
-#include <LibJS/Runtime/ValueInlines.h>
-
-namespace JS {
-
-// %Iterator.prototype%, which LibJS's users reach through Intrinsics::iterator_prototype().
-class IteratorPrototype : public Object {
-};
-
-}
diff --git a/Libraries/LibJS/Rust/src/embedding/realm.rs b/Libraries/LibJS/Rust/src/embedding/realm.rs
index 5ce2e664f88..85773a88eca 100644
--- a/Libraries/LibJS/Rust/src/embedding/realm.rs
+++ b/Libraries/LibJS/Rust/src/embedding/realm.rs
@@ -44,32 +44,30 @@ pub type JSCreateRealmObjectCallback =
pub type JSIntrinsic = u32;
pub const JS_INTRINSIC_OBJECT_PROTOTYPE: JSIntrinsic = 0;
-pub const JS_INTRINSIC_FUNCTION_PROTOTYPE: JSIntrinsic = 1;
-pub const JS_INTRINSIC_ARRAY_PROTOTYPE: JSIntrinsic = 2;
-pub const JS_INTRINSIC_STRING_PROTOTYPE: JSIntrinsic = 3;
-pub const JS_INTRINSIC_ERROR_PROTOTYPE: JSIntrinsic = 4;
-pub const JS_INTRINSIC_ITERATOR_PROTOTYPE: JSIntrinsic = 5;
-pub const JS_INTRINSIC_ASYNC_ITERATOR_PROTOTYPE: JSIntrinsic = 6;
-pub const JS_INTRINSIC_ERROR_CONSTRUCTOR: JSIntrinsic = 7;
-pub const JS_INTRINSIC_PROMISE_CONSTRUCTOR: JSIntrinsic = 8;
-pub const JS_INTRINSIC_SHARED_ARRAY_BUFFER_CONSTRUCTOR: JSIntrinsic = 9;
-pub const JS_INTRINSIC_DATA_VIEW_CONSTRUCTOR: JSIntrinsic = 10;
-pub const JS_INTRINSIC_UINT8_ARRAY_CONSTRUCTOR: JSIntrinsic = 11;
-pub const JS_INTRINSIC_UINT8_CLAMPED_ARRAY_CONSTRUCTOR: JSIntrinsic = 12;
-pub const JS_INTRINSIC_UINT16_ARRAY_CONSTRUCTOR: JSIntrinsic = 13;
-pub const JS_INTRINSIC_UINT32_ARRAY_CONSTRUCTOR: JSIntrinsic = 14;
-pub const JS_INTRINSIC_BIG_UINT64_ARRAY_CONSTRUCTOR: JSIntrinsic = 15;
-pub const JS_INTRINSIC_INT8_ARRAY_CONSTRUCTOR: JSIntrinsic = 16;
-pub const JS_INTRINSIC_INT16_ARRAY_CONSTRUCTOR: JSIntrinsic = 17;
-pub const JS_INTRINSIC_INT32_ARRAY_CONSTRUCTOR: JSIntrinsic = 18;
-pub const JS_INTRINSIC_BIG_INT64_ARRAY_CONSTRUCTOR: JSIntrinsic = 19;
-pub const JS_INTRINSIC_FLOAT16_ARRAY_CONSTRUCTOR: JSIntrinsic = 20;
-pub const JS_INTRINSIC_FLOAT32_ARRAY_CONSTRUCTOR: JSIntrinsic = 21;
-pub const JS_INTRINSIC_FLOAT64_ARRAY_CONSTRUCTOR: JSIntrinsic = 22;
-pub const JS_INTRINSIC_JSON_STRINGIFY_FUNCTION: JSIntrinsic = 23;
-pub const JS_INTRINSIC_CONSOLE_OBJECT: JSIntrinsic = 24;
+pub const JS_INTRINSIC_ARRAY_PROTOTYPE: JSIntrinsic = 1;
+pub const JS_INTRINSIC_STRING_PROTOTYPE: JSIntrinsic = 2;
+pub const JS_INTRINSIC_ERROR_PROTOTYPE: JSIntrinsic = 3;
+pub const JS_INTRINSIC_ITERATOR_PROTOTYPE: JSIntrinsic = 4;
+pub const JS_INTRINSIC_ASYNC_ITERATOR_PROTOTYPE: JSIntrinsic = 5;
+pub const JS_INTRINSIC_ERROR_CONSTRUCTOR: JSIntrinsic = 6;
+pub const JS_INTRINSIC_PROMISE_CONSTRUCTOR: JSIntrinsic = 7;
+pub const JS_INTRINSIC_SHARED_ARRAY_BUFFER_CONSTRUCTOR: JSIntrinsic = 8;
+pub const JS_INTRINSIC_UINT8_ARRAY_CONSTRUCTOR: JSIntrinsic = 9;
+pub const JS_INTRINSIC_UINT8_CLAMPED_ARRAY_CONSTRUCTOR: JSIntrinsic = 10;
+pub const JS_INTRINSIC_UINT16_ARRAY_CONSTRUCTOR: JSIntrinsic = 11;
+pub const JS_INTRINSIC_UINT32_ARRAY_CONSTRUCTOR: JSIntrinsic = 12;
+pub const JS_INTRINSIC_BIG_UINT64_ARRAY_CONSTRUCTOR: JSIntrinsic = 13;
+pub const JS_INTRINSIC_INT8_ARRAY_CONSTRUCTOR: JSIntrinsic = 14;
+pub const JS_INTRINSIC_INT16_ARRAY_CONSTRUCTOR: JSIntrinsic = 15;
+pub const JS_INTRINSIC_INT32_ARRAY_CONSTRUCTOR: JSIntrinsic = 16;
+pub const JS_INTRINSIC_BIG_INT64_ARRAY_CONSTRUCTOR: JSIntrinsic = 17;
+pub const JS_INTRINSIC_FLOAT16_ARRAY_CONSTRUCTOR: JSIntrinsic = 18;
+pub const JS_INTRINSIC_FLOAT32_ARRAY_CONSTRUCTOR: JSIntrinsic = 19;
+pub const JS_INTRINSIC_FLOAT64_ARRAY_CONSTRUCTOR: JSIntrinsic = 20;
+pub const JS_INTRINSIC_JSON_STRINGIFY_FUNCTION: JSIntrinsic = 21;
+pub const JS_INTRINSIC_CONSOLE_OBJECT: JSIntrinsic = 22;
/// One more than the largest JSIntrinsic.
-pub const JS_INTRINSIC_COUNT: JSIntrinsic = 25;
+pub const JS_INTRINSIC_COUNT: JSIntrinsic = 23;
/// A slot holding `cell`, or an empty one for null.
///
@@ -182,7 +180,6 @@ pub unsafe extern "C" fn js_realm_intrinsic(
let intrinsics = realm.intrinsics();
let object: Gc<Object> = match intrinsic {
JS_INTRINSIC_OBJECT_PROTOTYPE => intrinsics.object_prototype(vm),
- JS_INTRINSIC_FUNCTION_PROTOTYPE => intrinsics.function_prototype(vm),
JS_INTRINSIC_ARRAY_PROTOTYPE => intrinsics.array_prototype(vm),
JS_INTRINSIC_STRING_PROTOTYPE => intrinsics.string_prototype(vm),
JS_INTRINSIC_ERROR_PROTOTYPE => intrinsics.error_prototype(vm),
@@ -191,7 +188,6 @@ pub unsafe extern "C" fn js_realm_intrinsic(
JS_INTRINSIC_ERROR_CONSTRUCTOR => intrinsics.error_constructor(vm).upcast(),
JS_INTRINSIC_PROMISE_CONSTRUCTOR => intrinsics.promise_constructor(vm).upcast(),
JS_INTRINSIC_SHARED_ARRAY_BUFFER_CONSTRUCTOR => intrinsics.shared_array_buffer_constructor(vm).upcast(),
- JS_INTRINSIC_DATA_VIEW_CONSTRUCTOR => intrinsics.data_view_constructor(vm).upcast(),
JS_INTRINSIC_UINT8_ARRAY_CONSTRUCTOR => intrinsics.uint8_array_constructor(vm).upcast(),
JS_INTRINSIC_UINT8_CLAMPED_ARRAY_CONSTRUCTOR => intrinsics.uint8_clamped_array_constructor(vm).upcast(),
JS_INTRINSIC_UINT16_ARRAY_CONSTRUCTOR => intrinsics.uint16_array_constructor(vm).upcast(),
diff --git a/Libraries/LibWeb/HTML/Window.cpp b/Libraries/LibWeb/HTML/Window.cpp
index 85dcaa8bf3d..aeb3ab295ba 100644
--- a/Libraries/LibWeb/HTML/Window.cpp
+++ b/Libraries/LibWeb/HTML/Window.cpp
@@ -12,7 +12,6 @@
#include <LibGC/WeakHashSet.h>
#include <LibIPC/File.h>
#include <LibJS/Runtime/AbstractOperations.h>
-#include <LibJS/Runtime/Accessor.h>
#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/Error.h>
#include <LibJS/Runtime/FunctionObject.h>
diff --git a/Meta/Generators/libweb_bindings/iterables.py b/Meta/Generators/libweb_bindings/iterables.py
index efbe658cb90..5be0c0b96df 100644
--- a/Meta/Generators/libweb_bindings/iterables.py
+++ b/Meta/Generators/libweb_bindings/iterables.py
@@ -72,7 +72,6 @@ def define_the_pair_iterable_declaration(
if interface.iterable is None or interface.iterable.key_type is None:
return
- includes.add("LibJS/Runtime/ArrayPrototype.h")
out.write(
""" object.define_native_function(realm, vm.names.entries, entries, 0, default_attributes);
object.define_native_function(realm, vm.names.forEach, for_each, 1, default_attributes);
@@ -270,7 +269,6 @@ def write_iterator_prototype_implementation(
includes.add("LibJS/Runtime/Error.h")
includes.add("LibJS/Runtime/HostObject.h")
- includes.add("LibJS/Runtime/IteratorPrototype.h")
includes.add("LibJS/Runtime/PrimitiveString.h")
includes.add("LibJS/Runtime/ValueInlines.h")
includes.add("LibWeb/WebIDL/ExceptionOrUtils.h")
@@ -362,7 +360,6 @@ def write_async_iterator_prototype_implementation(
return
includes.add("AK/StringView.h")
- includes.add("LibJS/Runtime/AsyncIteratorPrototype.h")
includes.add("LibJS/Runtime/PrimitiveString.h")
includes.add("LibWeb/WebIDL/ExceptionOrUtils.h")
includes.add("LibWeb/WebIDL/AsyncIterator.h")
diff --git a/Meta/Generators/libweb_bindings/named_and_indexed_properties.py b/Meta/Generators/libweb_bindings/named_and_indexed_properties.py
index 6f4ed10367e..eca24223f2b 100644
--- a/Meta/Generators/libweb_bindings/named_and_indexed_properties.py
+++ b/Meta/Generators/libweb_bindings/named_and_indexed_properties.py
@@ -701,7 +701,6 @@ def define_the_indexed_property_getter(
operation = interface.indexed_property_getter
- includes.add("LibJS/Runtime/ArrayPrototype.h")
if operation.name:
out.write(
f""" object.define_native_function(realm, "{operation.name}"_utf16_fly_string, {idl_identifier_cpp_name(operation)}, {len(operation.parameters)}, default_attributes);
diff --git a/Meta/Linters/check_libjs_includes.py b/Meta/Linters/check_libjs_includes.py
index 83ffde0ceae..1b7541a2cea 100755
--- a/Meta/Linters/check_libjs_includes.py
+++ b/Meta/Linters/check_libjs_includes.py
@@ -29,12 +29,9 @@ ALLOWED_HEADERS = {
"LibJS/Position.h",
"LibJS/Print.h",
"LibJS/Runtime/AbstractOperations.h",
- "LibJS/Runtime/Accessor.h",
"LibJS/Runtime/Agent.h",
"LibJS/Runtime/Array.h",
"LibJS/Runtime/ArrayBuffer.h",
- "LibJS/Runtime/ArrayPrototype.h",
- "LibJS/Runtime/AsyncIteratorPrototype.h",
"LibJS/Runtime/BigInt.h",
"LibJS/Runtime/BigIntObject.h",
"LibJS/Runtime/BooleanObject.h",
@@ -60,7 +57,6 @@ ALLOWED_HEADERS = {
"LibJS/Runtime/HostObject.h",
"LibJS/Runtime/Intrinsics.h",
"LibJS/Runtime/Iterator.h",
- "LibJS/Runtime/IteratorPrototype.h",
"LibJS/Runtime/JobCallback.h",
"LibJS/Runtime/JSONObject.h",
"LibJS/Runtime/Map.h",