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.
This commit is contained in:
Maciej 2022-02-15 17:36:27 +01:00 committed by Tim Flynn
parent deba345ca7
commit ed33ea13ab
Notes: sideshowbarker 2024-07-17 18:44:48 +09:00
3 changed files with 19 additions and 0 deletions

View File

@ -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())

View File

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

View File

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