LibWeb: Make the "document" global a native property

This defers construction of the document wrapper until actually needed.
This commit is contained in:
Andreas Kling 2020-03-21 14:53:23 +01:00
parent a7d458f76a
commit f1715bbd5e
Notes: sideshowbarker 2024-07-19 08:12:09 +09:00

View file

@ -348,7 +348,12 @@ JS::Interpreter& Document::interpreter()
return JS::js_undefined();
});
m_interpreter->global_object().put("document", wrap(m_interpreter->heap(), *this));
m_interpreter->global_object().put_native_property(
"document",
[this](JS::Object*) {
return wrap(m_interpreter->heap(), *this);
},
nullptr);
}
return *m_interpreter;
}