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

Navigate a navigable should probably use "matches about:srcdoc" #10900

Open
AtkinsSJ opened this issue Jan 7, 2025 · 1 comment
Open

Navigate a navigable should probably use "matches about:srcdoc" #10900

AtkinsSJ opened this issue Jan 7, 2025 · 1 comment

Comments

@AtkinsSJ
Copy link
Contributor

AtkinsSJ commented Jan 7, 2025

What is the issue with the HTML Standard?

The "navigate a navigable" algorithm, step 22.5, states:

If url matches about:blank or is about:srcdoc, then:

I believe this should probably be "matches about:srcdoc" instead of "is about:srcdoc", as there's a specific algorithm for that.

@domenic
Copy link
Member

domenic commented Jan 15, 2025

Interesting. Two cases:

  • You are already on an iframe srcdoc document, and do location.href = 'about:srcdoc#foo'. Then the navigate algorithm will bail out early, instead navigating to the fragment. Step 22 is not reached.

  • You attempt to navigate to about:srcdoc?bar or about:srcdoc (from any location), or attempt to navigate to about:srcdoc#foo from a non-iframe srcdoc document. Then we will eventually try to fetch that URL, and get a network error.

    That means null navigation params, which means the document state's origin will be updated to an opaque origin (so the value set in 22.5.1 does not matter).

    The about base URL set in 22.5.2 will be copied to the new error document. This is a bit strange, but it does not matter, since the error document is not an iframe srcdoc document and its URL does not match about:blank, so the about base URL is never consulted.

The difference between "is about:srcdoc" and "matches about:srcdoc" is what happens for about:srcdoc#baz. (The former does not match; the latter does.) Both treat about:srcdoc and about:srcdoc?bar identically (match / do not match, respectively).

So, I think it does not matter whether we use "is about:srcdoc" or "matches about:srcdoc". The only case it impacts, about:srcdoc#baz, is not impacted by steps 22.5.1 and step 22.5.2.

--

The fact that we had to reason this out is maybe a bit annoying. So clarifying PRs are welcome to add notes explaining this to the spec.

/cc @domfarolino in case he wants to double-check any of the above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants