mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 21:12:08 +02:00
LibJS: Replace Object's create_empty() with create() taking a prototype
This now matches the spec's OrdinaryObjectCreate() across the board: instead of implicitly setting the created object's prototype to %Object.prototype% and then in many cases setting it to a nullptr right away, it now has an 'Object* prototype' parameter with _no default value_. This makes the code easier to compare with the spec, very clear in terms of what prototype is being used as well as avoiding unnecessary shape transitions. Also fixes a couple of cases were we weren't setting the correct prototype. There's no reason to assume that the object would not be empty (as in having own properties), so let's follow our existing pattern of Type::create(...) and simply call it 'create'.
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 12:09:30 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/317b88a8c39 Pull-request: https://github.com/SerenityOS/serenity/pull/8099 Reviewed-by: https://github.com/awesomekling ✅
@@ -362,8 +362,7 @@ void WebAssemblyInstanceObject::initialize(JS::GlobalObject& global_object)
|
||||
Object::initialize(global_object);
|
||||
|
||||
VERIFY(!m_exports_object);
|
||||
m_exports_object = JS::Object::create_empty(global_object);
|
||||
m_exports_object->set_prototype(nullptr);
|
||||
m_exports_object = JS::Object::create(global_object, nullptr);
|
||||
auto& instance = this->instance();
|
||||
for (auto& export_ : instance.exports()) {
|
||||
export_.value().visit(
|
||||
|
||||
Reference in New Issue
Block a user