mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:07:44 +00:00
LibWeb: Implement document.open(string, string, string)
This commit is contained in:
parent
a63c7549e1
commit
43c5b94ea6
3 changed files with 14 additions and 2 deletions
|
@ -499,6 +499,17 @@ WebIDL::ExceptionOr<Document*> Document::open(String const&, String const&)
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-document-open-window
|
||||||
|
WebIDL::ExceptionOr<JS::GCPtr<HTML::WindowProxy>> Document::open(String const& url, String const& name, String const& features)
|
||||||
|
{
|
||||||
|
// 1. If this is not fully active, then throw an "InvalidAccessError" DOMException exception.
|
||||||
|
if (!is_fully_active())
|
||||||
|
return WebIDL::InvalidAccessError::create(realm(), "Cannot perform open on a document that isn't fully active."sv);
|
||||||
|
|
||||||
|
// 2. Return the result of running the window open steps with url, name, and features.
|
||||||
|
return window().open_impl(url, name, features);
|
||||||
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#closing-the-input-stream
|
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#closing-the-input-stream
|
||||||
WebIDL::ExceptionOr<void> Document::close()
|
WebIDL::ExceptionOr<void> Document::close()
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||||
#include <LibWeb/HTML/VisibilityState.h>
|
#include <LibWeb/HTML/VisibilityState.h>
|
||||||
#include <LibWeb/HTML/Window.h>
|
#include <LibWeb/HTML/Window.h>
|
||||||
|
#include <LibWeb/HTML/WindowProxy.h>
|
||||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||||
|
|
||||||
namespace Web::DOM {
|
namespace Web::DOM {
|
||||||
|
@ -295,6 +296,7 @@ public:
|
||||||
WebIDL::ExceptionOr<void> writeln(Vector<String> const& strings);
|
WebIDL::ExceptionOr<void> writeln(Vector<String> const& strings);
|
||||||
|
|
||||||
WebIDL::ExceptionOr<Document*> open(String const& = "", String const& = "");
|
WebIDL::ExceptionOr<Document*> open(String const& = "", String const& = "");
|
||||||
|
WebIDL::ExceptionOr<JS::GCPtr<HTML::WindowProxy>> open(String const& url, String const& name, String const& features);
|
||||||
WebIDL::ExceptionOr<void> close();
|
WebIDL::ExceptionOr<void> close();
|
||||||
|
|
||||||
HTML::Window* default_view() { return m_window.ptr(); }
|
HTML::Window* default_view() { return m_window.ptr(); }
|
||||||
|
|
|
@ -43,8 +43,7 @@ interface Document : Node {
|
||||||
readonly attribute Window? defaultView;
|
readonly attribute Window? defaultView;
|
||||||
|
|
||||||
[CEReactions] Document open(optional DOMString unused1, optional DOMString unused2);
|
[CEReactions] Document open(optional DOMString unused1, optional DOMString unused2);
|
||||||
// FIXME: implement ExceptionOr<HTML::Window> Document::open(...)
|
WindowProxy? open(USVString url, DOMString name, DOMString features);
|
||||||
// WindowProxy? open(USVString url, DOMString name, DOMString features);
|
|
||||||
[CEReactions] undefined close();
|
[CEReactions] undefined close();
|
||||||
[CEReactions] undefined write(DOMString... text);
|
[CEReactions] undefined write(DOMString... text);
|
||||||
[CEReactions] undefined writeln(DOMString... text);
|
[CEReactions] undefined writeln(DOMString... text);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue