diff --git a/Libraries/LibWeb/HTML/AttributeNames.h b/Libraries/LibWeb/HTML/AttributeNames.h index 6dc4c95cbca..c73d4e8bd1d 100644 --- a/Libraries/LibWeb/HTML/AttributeNames.h +++ b/Libraries/LibWeb/HTML/AttributeNames.h @@ -233,6 +233,7 @@ namespace AttributeNames { __ENUMERATE_HTML_ATTRIBUTE(rows) \ __ENUMERATE_HTML_ATTRIBUTE(rowspan) \ __ENUMERATE_HTML_ATTRIBUTE(rules) \ + __ENUMERATE_HTML_ATTRIBUTE(sandbox) \ __ENUMERATE_HTML_ATTRIBUTE(scheme) \ __ENUMERATE_HTML_ATTRIBUTE(scope) \ __ENUMERATE_HTML_ATTRIBUTE(scrollamount) \ diff --git a/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp index 8249a8576c8..d352d2d92db 100644 --- a/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -211,10 +212,20 @@ i32 HTMLIFrameElement::default_tab_index_value() const return 0; } +// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#dom-iframe-sandbox +GC::Ref HTMLIFrameElement::sandbox() +{ + // The sandbox IDL attribute must reflect the sandbox content attribute. + if (!m_sandbox) + m_sandbox = DOM::DOMTokenList::create(*this, HTML::AttributeNames::sandbox); + return *m_sandbox; +} + void HTMLIFrameElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); visit_lazy_loading_element(visitor); + visitor.visit(m_sandbox); } void HTMLIFrameElement::set_current_navigation_was_lazy_loaded(bool value) diff --git a/Libraries/LibWeb/HTML/HTMLIFrameElement.h b/Libraries/LibWeb/HTML/HTMLIFrameElement.h index 2fd2c8158e4..085df19052c 100644 --- a/Libraries/LibWeb/HTML/HTMLIFrameElement.h +++ b/Libraries/LibWeb/HTML/HTMLIFrameElement.h @@ -31,6 +31,8 @@ public: Optional const& pending_resource_start_time() const { return m_pending_resource_start_time; } void set_pending_resource_start_time(Optional time) { m_pending_resource_start_time = time; } + GC::Ref sandbox(); + virtual void visit_edges(Cell::Visitor&) override; private: @@ -55,6 +57,8 @@ private: // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#iframe-pending-resource-timing-start-time Optional m_pending_resource_start_time = {}; + + GC::Ptr m_sandbox; }; void run_iframe_load_event_steps(HTML::HTMLIFrameElement&); diff --git a/Libraries/LibWeb/HTML/HTMLIFrameElement.idl b/Libraries/LibWeb/HTML/HTMLIFrameElement.idl index 205c4e7099e..9f00d92df8c 100644 --- a/Libraries/LibWeb/HTML/HTMLIFrameElement.idl +++ b/Libraries/LibWeb/HTML/HTMLIFrameElement.idl @@ -11,7 +11,7 @@ interface HTMLIFrameElement : HTMLElement { [CEReactions, Reflect, URL] attribute USVString src; [CEReactions, Reflect] attribute DOMString srcdoc; [CEReactions, Reflect] attribute DOMString name; - [FIXME, SameObject, PutForwards=value] readonly attribute DOMTokenList sandbox; + [SameObject, PutForwards=value] readonly attribute DOMTokenList sandbox; [CEReactions, Reflect] attribute DOMString allow; [CEReactions, Reflect=allowfullscreen] attribute boolean allowFullscreen; [CEReactions, Reflect] attribute DOMString width; diff --git a/Tests/LibWeb/Text/expected/wpt-import/dom/lists/DOMTokenList-coverage-for-attributes.txt b/Tests/LibWeb/Text/expected/wpt-import/dom/lists/DOMTokenList-coverage-for-attributes.txt index 9502f336e27..91f20a5ec51 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/dom/lists/DOMTokenList-coverage-for-attributes.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/dom/lists/DOMTokenList-coverage-for-attributes.txt @@ -6,8 +6,7 @@ Rerun Found 175 tests -174 Pass -1 Fail +175 Pass Details Result Test Name MessagePass a.classList in http://www.w3.org/1999/xhtml namespace should be DOMTokenList. Pass area.classList in http://www.w3.org/1999/xhtml namespace should be DOMTokenList. @@ -117,7 +116,7 @@ Pass th.htmlFor in null namespace should be undefined. Pass a.sandbox in http://www.w3.org/1999/xhtml namespace should be undefined. Pass area.sandbox in http://www.w3.org/1999/xhtml namespace should be undefined. Pass link.sandbox in http://www.w3.org/1999/xhtml namespace should be undefined. -Fail iframe.sandbox in http://www.w3.org/1999/xhtml namespace should be DOMTokenList. +Pass iframe.sandbox in http://www.w3.org/1999/xhtml namespace should be DOMTokenList. Pass output.sandbox in http://www.w3.org/1999/xhtml namespace should be undefined. Pass td.sandbox in http://www.w3.org/1999/xhtml namespace should be undefined. Pass th.sandbox in http://www.w3.org/1999/xhtml namespace should be undefined.