mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:57:45 +00:00
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.
This commit is contained in:
parent
f94099f796
commit
9c9d3f0904
11 changed files with 142 additions and 3 deletions
|
@ -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<>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue