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:
parent
deba345ca7
commit
ed33ea13ab
Notes:
sideshowbarker
2024-07-17 18:44:48 +09:00
Author: https://github.com/sppmacd Commit: https://github.com/SerenityOS/serenity/commit/ed33ea13ab Pull-request: https://github.com/SerenityOS/serenity/pull/12554 Reviewed-by: https://github.com/trflynn89 ✅
3 changed files with 19 additions and 0 deletions
Userland/Libraries/LibWeb/DOM
|
@ -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())
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue