summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-21 14:53:23 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-21 14:54:33 +0100
commitf1715bbd5e3524869284caeca980c8a67b39e59f (patch)
treebe144e11a07418bd1e86d5396d635ef4d81cb79d
parenta7d458f76a654d145a2b466ff53c02bcac0505e6 (diff)
downloadserenity-f1715bbd5e3524869284caeca980c8a67b39e59f.zip
LibWeb: Make the "document" global a native property
This defers construction of the document wrapper until actually needed.
-rw-r--r--Libraries/LibWeb/DOM/Document.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp
index 4aa9746b2f..518f2a653e 100644
--- a/Libraries/LibWeb/DOM/Document.cpp
+++ b/Libraries/LibWeb/DOM/Document.cpp
@@ -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;
}