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

Clicking an HTMLAnchorElement with an href inside an src-less <iframe> isn't following hyperlink #25374

Open
pshaughn opened this issue Dec 23, 2019 · 1 comment
Labels
A-content/dom Interacting with the DOM from web content

Comments

@pshaughn
Copy link
Member

pshaughn commented Dec 23, 2019

<html>
  <body>
    <iframe id="frame1"></iframe>
    <div id="msg"></div>
    <script>
      window.addEventListener("load", function() {
      var frame1=document.getElementById("frame1");
      var doc=frame1.contentDocument;
      var a=doc.createElement("a");
      a.href="2.html"
      a.id="foo"
      a.innerText="SYNTHETICALLY CLICK HERE!"
      doc.body.appendChild(a);
      a.click();
      document.getElementById("msg").innerText="Synthetic click happened, 2.html should load in the iframe";
      })
    </script>
  </body>
</html>

Served over http or opened as a local file (in a directory that also has a 2.html), this loads 2.html in Firefox with no manual intervention. In Servo, it does not, and manually clicking also isn't working!

@pshaughn pshaughn changed the title Clicking a created HTMLAnchorElement with an href inside an <iframe> isn't following hyperlink Clicking an HTMLAnchorElement with an href inside an src-less <iframe> isn't following hyperlink Dec 23, 2019
@pshaughn
Copy link
Member Author

pshaughn commented Dec 23, 2019

It is not dependent on whether the <a> was created via createElement, it is dependent on whether the iframe has an src. Adding a new <a> to an iframe with a same-domain src does work (over http; same-origin semantics for local filesystem are different). Possibly load_url is thinking the about:blank iframe is in the wrong origin to navigate to the href!

@jdm jdm added the A-content/dom Interacting with the DOM from web content label Dec 24, 2019
@jdm jdm added this to To do in web-platform-test failures via automation Dec 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-content/dom Interacting with the DOM from web content
Projects
Development

No branches or pull requests

2 participants