mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-01 08:48:49 +00:00
LibJS: Set prototype of GlobalObject to ObjectPrototype
As the global object is constructed and initialized in a different way than most other objects we were not setting its prototype! This made things like "globalThis.toString()" fail unexpectedly.
This commit is contained in:
parent
965050796f
commit
06a3625545
Notes:
sideshowbarker
2024-07-19 01:32:16 +09:00
Author: https://github.com/linusg
Commit: 06a3625545
Pull-request: https://github.com/SerenityOS/serenity/pull/3966
Issue: https://github.com/SerenityOS/serenity/issues/3960
2 changed files with 4 additions and 0 deletions
|
@ -94,6 +94,8 @@ void GlobalObject::initialize()
|
|||
static_cast<FunctionPrototype*>(m_function_prototype)->initialize(*this);
|
||||
static_cast<ObjectPrototype*>(m_object_prototype)->initialize(*this);
|
||||
|
||||
set_prototype(m_object_prototype);
|
||||
|
||||
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName) \
|
||||
if (!m_##snake_name##_prototype) \
|
||||
m_##snake_name##_prototype = heap().allocate<PrototypeName>(*this, *this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue