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

"fallback base URL" algorithm seems wrong for popups? #9310

Closed
domenic opened this issue May 19, 2023 · 5 comments
Closed

"fallback base URL" algorithm seems wrong for popups? #9310

domenic opened this issue May 19, 2023 · 5 comments
Labels
interop Implementations are not interoperable with each other topic: frames/navigables/browsing contexts

Comments

@domenic
Copy link
Member

domenic commented May 19, 2023

https://html.spec.whatwg.org/#fallback-base-url

If document's URL is about:blank, and document's browsing context's creator base URL is non-null, then return that creator base URL.

From what I can tell, popups from window.open() will have a creator base URL.

But, if I do window.open() (no args) or window.open("about:blank"), and then check the opened window in the dev console, I get:

document.documentURI === "about:blank";
document.baseURI === "about:blank"; // *not* the creator base URL

Am I missing something, or is this fairly basic part of the spec wrong?

@annevk
Copy link
Member

annevk commented May 19, 2023

WebKit does inherit here.

cc @cdumez

@domfarolino
Copy link
Member

Yeah Chrome doesn't seem to match the spec here I guess. Maybe we should file a Chome bug?

@annevk
Copy link
Member

annevk commented May 24, 2023

I think WebKit is the odd-one-out and inheriting isn't necessarily better. I guess it depends on what else gets inherited and what would make sense from a policy container point-of-view.

@zcorpan
Copy link
Member

zcorpan commented May 25, 2023

Demos: window.open(), window.open('about:blank')

Test Firefox Safari Chrome
open(): documentURI about:blank about:blank about:blank
open(): baseURI about:blank opener's url opener's url
open('about:blank'): documentURI about:blank about:blank about:blank
open('about:blank'): baseURI opener's url opener's url opener's url

My result is different from what @domenic said in OP for Chrome.

Tested with

  • Firefox 115.0a1 (2023-05-22) (64-bit)
  • Safari TP Release 168 (Safari 16.4, WebKit 18616.1.10.2)
  • Chrome 115.0.5776.0 (Official Build) canary (arm64)

@domenic
Copy link
Member Author

domenic commented Jun 1, 2023

I've found a bit more background on this. @wjmaclean has been looking into about:blank URL inheritance, mostly for iframes, but he also plans to work on it for popups. See this Chromium doc. This is mostly captured in #421; in particular see my summary in #421 (comment).

This might also explain why Simon and I saw different results, if Simon was testing with experimental web platform features on in his Chrome Canary, or if these changes are rolling out to 50% or similar (which is pretty common on Canary channel).

It seems like there is a separate issue here where open() and open("about:blank") are not treated the same in Firefox.

I will file a Chromium issue to help @wjmaclean remember to write web platform tests for the popup cases in addition to the iframe cases which he's already written tests for.

With this in mind, let me close this issue and re-title #421 to also mention popups.

@domenic domenic closed this as completed Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interop Implementations are not interoperable with each other topic: frames/navigables/browsing contexts
Development

No branches or pull requests

4 participants