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

What should window.open() return if it ends up focusing an existing client? #48

Open
alancutter opened this issue Jan 18, 2022 · 7 comments
Labels
future-api Issue discusses possible extensions to the current API.

Comments

@alancutter
Copy link
Collaborator

alancutter commented Jan 18, 2022

Ideally it continues to return a WindowProxy object for the existing window but it's not clear that that doesn't conflict or break something.

@reillyeon
Copy link

I think this would be the first time that a page could get a WindowProxy for an existing window. The only malicious thing I can think of for what a site could do with that is call close(). The existing rule that a window is script-closable only if it was itself created by script should apply. It might need some additional checks that it was created by that script in particular and not another script. For example, if a.com launches b.com then c.com shouldn't be able to close the b.com window by calling window.open("b.com") to get a WindowProxy for the existing window.

@alancutter alancutter added future-api Issue discusses possible extensions to the current API. compatibility-risk Resolving this issue may require API breaking changes. labels Oct 21, 2022
@domenic
Copy link

domenic commented Oct 21, 2022

I think this would be the first time that a page could get a WindowProxy for an existing window.

Nah, window.open(url, "existingwindowname") lets you generate handles to existing windows which have set window.name = "existingwindowname".

I haven't looked at this feature in detail but maybe it's a bit more dangerous since it doesn't require victim opt in?

@yoavweiss
Copy link

^^ @mikewest @camillelamy for thoughts on the above

@alancutter alancutter removed the future-api Issue discusses possible extensions to the current API. label Oct 21, 2022
@mikewest
Copy link
Member

  1. As long as we apply COOP, I don't see much of a problem.
  2. I think @domenic's claim isn't entirely right. window.open should only allow you to grab a handle to a window you're familiar with, which requires some non-trivial existing relationship between the windows.

@domenic
Copy link

domenic commented Oct 21, 2022

Mike is quite correct on "familiar with", and I am highly embarrassed.

@mikewest
Copy link
Member

(@domenic corrects me on stuff all the time; HTML is complicated, nothing to be embarrassed about!)

@alancutter
Copy link
Collaborator Author

Thanks, familiar with wasn't something I was familiar with. That constraint sounds reasonable here.
I think supporting existing windows being returned as active WindowProxy handles from window.open() can be considered a future API extension at this point without much compat risk.

@alancutter alancutter added future-api Issue discusses possible extensions to the current API. and removed compatibility-risk Resolving this issue may require API breaking changes. labels Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future-api Issue discusses possible extensions to the current API.
Projects
None yet
Development

No branches or pull requests

6 participants
@mikewest @reillyeon @domenic @yoavweiss @alancutter and others