mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Check that an iframe is in a document with a browsing context before processing src.
This commit is contained in:
parent
25e3ae6915
commit
23d030e7a7
2 changed files with 34 additions and 4 deletions
|
@ -771,6 +771,20 @@ impl Node {
|
|||
self.owner_doc().is_html_document()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#in-a-document-tree
|
||||
pub fn is_in_a_document_tree(&self) -> bool {
|
||||
self.inclusive_ancestors().last()
|
||||
.and_then(Root::downcast::<Document>)
|
||||
.is_some()
|
||||
}
|
||||
|
||||
pub fn is_in_a_document_tree_with_a_browsing_context(&self) -> bool {
|
||||
self.inclusive_ancestors().last()
|
||||
.and_then(Root::downcast::<Document>)
|
||||
.map(|doc| doc.browsing_context().is_some())
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn children(&self) -> NodeSiblingIterator {
|
||||
NodeSiblingIterator {
|
||||
current: self.GetFirstChild(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue