Skip to content

Improve Spec compliance of the iframe "name" attribute #20713

Closed

Description

@gterzian

Current behavior:

Currently, Iframe.SetName only "sets the name" if the iframe has a browsing context/window proxy:

if let Some(window) = self.GetContentWindow() {

So when the "name" attribute is mutated before the iframe is inserted in the document, this has no effect:

&local_name!("name") => {

Tests:

Some tests assume the attribute can be mutated "with effect" before the iframe has been inserted in the document:

ifr.name = "sufficientlyrandomwindownameamiright2";

There might be other tests testing this more specifically, or such a test could be written otherwise.

Desired behavior:

Per the spec "When the browsing context is created, if the attribute is present, the browsing context name must be set to the value of this attribute;", and after that "Whenever the name attribute is set, the nested browsing context's name must be changed to the new value. If the attribute is removed, the browsing context name must be set to the empty string." https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-name

"When an iframe element is inserted into a document that has a browsing context, the user agent must create a new browsing context, set the element's nested browsing context to the newly-created browsing context, and then process the iframe attributes for the "first time". https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element

Currently, "process_the_iframe_attributes" doesn't involve any previously set name, so it should be updated to set the name of the newly created browsing context to be the "name" attribute of the iframe:

fn process_the_iframe_attributes(&self, mode: ProcessingMode) {

Activity

  1. changed the title [-]Allow setting name of Iframe with no WindowProxy[/-] [+]Improve Spec compliance of Iframe "name" attribute[/+] on Apr 29, 2018
  2. changed the title [-]Improve Spec compliance of Iframe "name" attribute[/-] [+]Improve Spec compliance of the iframe "name" attribute[/+] on Apr 29, 2018
  3. added 4 commits that reference this issue on Jun 6, 2018
    412148e
    ccaedd6
    31779c0
    c3c9490
  4. added a commit that references this issue on Jul 19, 2018
    6730bf6
  5. added 3 commits that reference this issue on Aug 10, 2018
    2c09e0d
    7d04e61
    9c24c16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions