mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Add Sandbox field to HTMLIFrameElement
This commit is contained in:
parent
41230fe03d
commit
47984a52c6
3 changed files with 8 additions and 12 deletions
|
@ -19,11 +19,12 @@ use dom::bindings::conversions::ToJSValConvertible;
|
||||||
use dom::bindings::error::{Error, ErrorResult};
|
use dom::bindings::error::{Error, ErrorResult};
|
||||||
use dom::bindings::global::GlobalRef;
|
use dom::bindings::global::GlobalRef;
|
||||||
use dom::bindings::inheritance::Castable;
|
use dom::bindings::inheritance::Castable;
|
||||||
use dom::bindings::js::{Root, LayoutJS};
|
use dom::bindings::js::{JS, MutNullableHeap, Root, LayoutJS};
|
||||||
use dom::bindings::reflector::Reflectable;
|
use dom::bindings::reflector::Reflectable;
|
||||||
use dom::bindings::str::DOMString;
|
use dom::bindings::str::DOMString;
|
||||||
use dom::customevent::CustomEvent;
|
use dom::customevent::CustomEvent;
|
||||||
use dom::document::Document;
|
use dom::document::Document;
|
||||||
|
use dom::domtokenlist::DOMTokenList;
|
||||||
use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers};
|
use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers};
|
||||||
use dom::event::Event;
|
use dom::event::Event;
|
||||||
use dom::eventtarget::EventTarget;
|
use dom::eventtarget::EventTarget;
|
||||||
|
@ -63,6 +64,7 @@ pub struct HTMLIFrameElement {
|
||||||
htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
pipeline_id: Cell<Option<PipelineId>>,
|
pipeline_id: Cell<Option<PipelineId>>,
|
||||||
subpage_id: Cell<Option<SubpageId>>,
|
subpage_id: Cell<Option<SubpageId>>,
|
||||||
|
sandbox: MutNullableHeap<JS<DOMTokenList>>,
|
||||||
sandbox_allowance: Cell<Option<u8>>,
|
sandbox_allowance: Cell<Option<u8>>,
|
||||||
load_blocker: DOMRefCell<Option<LoadBlocker>>,
|
load_blocker: DOMRefCell<Option<LoadBlocker>>,
|
||||||
}
|
}
|
||||||
|
@ -193,6 +195,7 @@ impl HTMLIFrameElement {
|
||||||
htmlelement: HTMLElement::new_inherited(localName, prefix, document),
|
htmlelement: HTMLElement::new_inherited(localName, prefix, document),
|
||||||
pipeline_id: Cell::new(None),
|
pipeline_id: Cell::new(None),
|
||||||
subpage_id: Cell::new(None),
|
subpage_id: Cell::new(None),
|
||||||
|
sandbox: Default::default(),
|
||||||
sandbox_allowance: Cell::new(None),
|
sandbox_allowance: Cell::new(None),
|
||||||
load_blocker: DOMRefCell::new(None),
|
load_blocker: DOMRefCell::new(None),
|
||||||
}
|
}
|
||||||
|
@ -412,13 +415,8 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-iframe-sandbox
|
// https://html.spec.whatwg.org/multipage/#dom-iframe-sandbox
|
||||||
fn Sandbox(&self) -> DOMString {
|
fn Sandbox(&self) -> Root<DOMTokenList> {
|
||||||
self.upcast::<Element>().get_string_attribute(&atom!("sandbox"))
|
self.sandbox.or_init(|| DOMTokenList::new(self.upcast::<Element>(), &atom!("sandbox")))
|
||||||
}
|
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-iframe-sandbox
|
|
||||||
fn SetSandbox(&self, sandbox: DOMString) {
|
|
||||||
self.upcast::<Element>().set_tokenlist_attribute(&atom!("sandbox"), sandbox);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-iframe-contentwindow
|
// https://html.spec.whatwg.org/multipage/#dom-iframe-contentwindow
|
||||||
|
|
|
@ -7,7 +7,8 @@ interface HTMLIFrameElement : HTMLElement {
|
||||||
attribute DOMString src;
|
attribute DOMString src;
|
||||||
// attribute DOMString srcdoc;
|
// attribute DOMString srcdoc;
|
||||||
// attribute DOMString name;
|
// attribute DOMString name;
|
||||||
attribute DOMString sandbox;
|
[SameObject, PutForwards=value]
|
||||||
|
readonly attribute DOMTokenList sandbox;
|
||||||
// attribute boolean seamless;
|
// attribute boolean seamless;
|
||||||
// attribute boolean allowFullscreen;
|
// attribute boolean allowFullscreen;
|
||||||
attribute DOMString width;
|
attribute DOMString width;
|
||||||
|
|
|
@ -36,9 +36,6 @@
|
||||||
[area.ping in http://www.w3.org/1999/xhtml namespace should be DOMTokenList.]
|
[area.ping in http://www.w3.org/1999/xhtml namespace should be DOMTokenList.]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[iframe.sandbox in http://www.w3.org/1999/xhtml namespace should be DOMTokenList.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[link.sizes in http://www.w3.org/1999/xhtml namespace should be DOMTokenList.]
|
[link.sizes in http://www.w3.org/1999/xhtml namespace should be DOMTokenList.]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue