diff options
author | Maciej <sppmacd@pm.me> | 2022-02-15 17:36:27 +0100 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2022-02-15 16:23:06 -0500 |
commit | ed33ea13abdf3fd9b025694cc48decc60d9b070d (patch) | |
tree | cd591f8aeaeb02355eba5271d8726c6e7d6b731c /Userland | |
parent | deba345ca797c6eb312929574828b0953fa18be2 (diff) | |
download | serenity-ed33ea13abdf3fd9b025694cc48decc60d9b070d.zip |
LibWeb: Add stubs for document.write and document.writeln
ACID3 test page throws exception about document.write. Let's at least
get rid of it by defining these stubs.
I added document.writeln too because it is similar.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Document.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Document.h | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Document.idl | 3 |
3 files changed, 19 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index cdafa8eee3..3a992f8d34 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -147,6 +147,18 @@ void Document::removed_last_ref() delete this; } +// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-document-write +void Document::write(Vector<String> const& strings) +{ + dbgln("TODO: document.write({})", strings); +} + +// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-document-writeln +void Document::writeln(Vector<String> const& strings) +{ + dbgln("TODO: document.writeln({})", strings); +} + Origin Document::origin() const { if (!m_url.is_valid()) diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index 529a236e8f..e9d2962314 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -13,6 +13,7 @@ #include <AK/OwnPtr.h> #include <AK/String.h> #include <AK/URL.h> +#include <AK/Vector.h> #include <AK/WeakPtr.h> #include <LibCore/Forward.h> #include <LibJS/Forward.h> @@ -243,6 +244,9 @@ public: Window& window() { return *m_window; } + void write(Vector<String> const& strings); + void writeln(Vector<String> const& strings); + Window* default_view() { return m_window; } const String& content_type() const { return m_content_type; } diff --git a/Userland/Libraries/LibWeb/DOM/Document.idl b/Userland/Libraries/LibWeb/DOM/Document.idl index 63ca8d0ff7..cad5c23d26 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.idl +++ b/Userland/Libraries/LibWeb/DOM/Document.idl @@ -16,6 +16,9 @@ interface Document : Node { readonly attribute Window? defaultView; + undefined write(DOMString... text); + undefined writeln(DOMString... text); + attribute DOMString cookie; readonly attribute USVString referrer; |