summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/DOM/Document.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-14 12:41:51 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-14 13:25:38 +0100
commit9c9d3f090429746df8a39232eb75467007463a9e (patch)
treec1681103843ba738899df25fc11f22ad2f5039ed /Libraries/LibWeb/DOM/Document.h
parentf94099f796a26920034159cf1adbdaef400c6756 (diff)
downloadserenity-9c9d3f090429746df8a39232eb75467007463a9e.zip
LibWeb: Parse <script> elements and run any JavaScript found inside
This patch begins integrating LibJS into LibWeb. Document holds the JS::Interpreter for now, and it is created on demand when you first call Document::interpreter(). We also add a simple "alert()" function to the global object.
Diffstat (limited to 'Libraries/LibWeb/DOM/Document.h')
-rw-r--r--Libraries/LibWeb/DOM/Document.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/Libraries/LibWeb/DOM/Document.h b/Libraries/LibWeb/DOM/Document.h
index aa7d3e2014..bdfe6e6cb9 100644
--- a/Libraries/LibWeb/DOM/Document.h
+++ b/Libraries/LibWeb/DOM/Document.h
@@ -33,6 +33,7 @@
#include <AK/URL.h>
#include <AK/WeakPtr.h>
#include <LibCore/Forward.h>
+#include <LibJS/Forward.h>
#include <LibWeb/CSS/StyleResolver.h>
#include <LibWeb/CSS/StyleSheet.h>
#include <LibWeb/DOM/ParentNode.h>
@@ -120,6 +121,8 @@ public:
const String& source() const { return m_source; }
void set_source(const String& source) { m_source = source; }
+ JS::Interpreter& interpreter();
+
private:
virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) const override;
@@ -139,6 +142,8 @@ private:
RefPtr<Core::Timer> m_style_update_timer;
String m_source;
+
+ OwnPtr<JS::Interpreter> m_interpreter;
};
template<>