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

Origin of non-initial about:blank doesn't seem to be defined #255

Closed
bzbarsky opened this issue Oct 15, 2015 · 7 comments
Closed

Origin of non-initial about:blank doesn't seem to be defined #255

bzbarsky opened this issue Oct 15, 2015 · 7 comments

Comments

@bzbarsky
Copy link
Contributor

https://html.spec.whatwg.org/multipage/browsers.html#origin-2 talks about the initial about:blank, and urls with a server-based naming authority, but says nothing about non-initial about:blank. It probably needs to, because the DOM standard's default behavior would be wrong here.

@bzbarsky bzbarsky changed the title Origin of non-initial about:blank doesn Origin of non-initial about:blank doesn't seem to be defined Oct 15, 2015
@annevk
Copy link
Member

annevk commented Oct 16, 2015

I'm not sure what you mean by non-initial about:blank. It seems to define the origin of Document objects for quite a number of cases.

@bzbarsky
Copy link
Contributor Author

I'm not sure what you mean by non-initial about:blank

<!DOCTYPE html>
<iframe src="http://example.com"></iframe>
<script>
  onload = function() {
    setTimeout(function() {
      var i = document.querySelector("iframe");
      i.onload = function() { alert(i.contentDocument.URL); }
      i.src = "about:blank";
    }, 1000);
  }
</script>

Live testcase at http://jsfiddle.net/5d00v3ta/1/

It seems to define the origin of Document objects for quite a number of cases.

It sure does. And unless I'm totally misreading it, the way it defines the origin in the above testcase means that .contentDocument should return null and then we should get an exception getting null.URL. Instead, all UAs interoperably alert the string "about:blank". The problem is that this case needs to be defined specially, and differently from the way it's defined right now.

@jwatt
Copy link

jwatt commented Nov 3, 2015

Would this just be fixed by dropping the word "initial"? Or more specifically replacing the text 'If a Document is the initial "about:blank" document' with the text 'If a Document was generated from the URL "about:blank"'?

@bzbarsky
Copy link
Contributor Author

bzbarsky commented Nov 4, 2015

No, because "those it was assigned when its browsing context was created" only makes sense for initial about:blank. What's needed for the non-initial ones is something like the language used for data: URIs, I think.

@foolip
Copy link
Member

foolip commented Feb 10, 2016

This came up in https://code.google.com/p/chromium/issues/detail?id=585649

Daniel Cheng says that in Firefox "An about:blank frame inherits the origin of the document that navigated it." Is that correct and is it the same as for data: URLs in Firefox?

It looks like either that or the same rule as for "If a Document is an iframe srcdoc document", which is the iframe's node document's origin, are the main options.

@bzbarsky
Copy link
Contributor Author

Is that correct and is it the same as for data: URLs in Firefox?

Yes, it's exactly the same codepath.

It looks like either that or the same rule as for "If a Document is an iframe srcdoc document

This doesn't work for navigations to about:blank in toplevel browsing contexts, right?

@foolip
Copy link
Member

foolip commented Feb 15, 2016

This doesn't work for navigations to about:blank in toplevel browsing contexts, right?

Right, so I guess it should be "the document that navigated it" then, i.e. include this case with "If a Document was generated from a data: URL found in another Document or in a script" in https://html.spec.whatwg.org/multipage/browsers.html#origin-2

nathaneliason pushed a commit to nathaneliason/html that referenced this issue Jun 16, 2022
Closes whatwg#255.

Additionally, this uses a custom temporary directory for pdfsizeopt, as
I was getting permission errors (likely due to Docker/Windows/WSL
interactions) when testing this locally with the default temporary
directory being the output directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants