Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Window.open and related infrastructure #20678

Merged
merged 7 commits into from Aug 11, 2018

iframe: use value of name attr to set nested bc name

  • Loading branch information
gterzian committed Aug 10, 2018
commit a0082c57c8bb9a1c62f03bffa3f636e0791ee7b3
@@ -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 {

This comment has been minimized.

Copy link
@nox

nox Jul 13, 2018

Member

Spec link? Why was that change needed? Please write more details in the commit message.

This comment has been minimized.

Copy link
@gterzian

gterzian Jul 13, 2018

Author Member

This has been addressed through a (I hope)more descriptive commit message, and a comment with a link to the spec.

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()
}
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.