diff options
author | Gregory Terzian <gterzian@users.noreply.github.com> | 2018-06-03 22:59:36 +0800 |
---|---|---|
committer | Gregory Terzian <gterzian@users.noreply.github.com> | 2018-08-11 01:13:11 +0200 |
commit | a0082c57c8bb9a1c62f03bffa3f636e0791ee7b3 (patch) | |
tree | b5cb43aff8cbe95140f7b8d74b00f7a2ce0416ca /components/script/dom/htmliframeelement.rs | |
parent | e27ba16c3fda8a851b358b00852c2e0784649702 (diff) | |
download | servo-a0082c57c8bb9a1c62f03bffa3f636e0791ee7b3.tar.gz servo-a0082c57c8bb9a1c62f03bffa3f636e0791ee7b3.zip |
iframe: use value of name attr to set nested bc name
Diffstat (limited to 'components/script/dom/htmliframeelement.rs')
-rw-r--r-- | components/script/dom/htmliframeelement.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index b7540344c6a..658961a1725 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -76,6 +76,7 @@ pub struct HTMLIFrameElement { sandbox_allowance: Cell<Option<SandboxAllowance>>, load_blocker: DomRefCell<Option<LoadBlocker>>, visibility: Cell<bool>, + name: DomRefCell<DOMString>, } impl HTMLIFrameElement { @@ -223,6 +224,16 @@ impl HTMLIFrameElement { return; } + // https://html.spec.whatwg.org/multipage/#attr-iframe-name + // Note: the spec says to set the name 'when the nested browsing context is created'. + // The current implementation sets the name on the window, + // when the iframe attributes are first processed. + if mode == ProcessingMode::FirstTime { + if let Some(window) = self.GetContentWindow() { + window.set_name(self.name.borrow().clone()) + } + } + let url = self.get_url(); // TODO: check ancestor browsing contexts for same URL @@ -299,6 +310,7 @@ impl HTMLIFrameElement { sandbox_allowance: Cell::new(None), load_blocker: DomRefCell::new(None), visibility: Cell::new(true), + name: DomRefCell::new(DOMString::new()) } } @@ -471,6 +483,7 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement { // https://html.spec.whatwg.org/multipage/#dom-iframe-name fn SetName(&self, name: DOMString) { + *self.name.borrow_mut() = name.clone(); if let Some(window) = self.GetContentWindow() { window.set_name(name) } @@ -481,7 +494,7 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement { if let Some(window) = self.GetContentWindow() { window.get_name() } else { - DOMString::new() + self.name.borrow().clone() } } } |