1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

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

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;
}