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

Restrict openWindow() to http(s) schemes? #699

Open
jakearchibald opened this issue May 18, 2015 · 5 comments
Open

Restrict openWindow() to http(s) schemes? #699

jakearchibald opened this issue May 18, 2015 · 5 comments
Labels
Milestone

Comments

@jakearchibald
Copy link
Contributor

We currently reject on about:blank (due to #696), but is there any benefit in allowing schemes other than http and https?

What would it mean to openWindow('mailto:hello@example.com')? etc

I propose we reject on schemes other than http/https. Any objections?

@annevk
Copy link
Member

annevk commented Jun 9, 2015

What happens if you hit a redirect to a custom scheme? Or execute some JavaScript to navigate to one?

@mfalken
Copy link
Member

mfalken commented Jun 25, 2015

Hey, I just noticed the about:blank spec change.

Chrome currently treats all about:* URLs as "about:blank" in openWindow(). Apparently this mimics the behavior of window.open(). cc @mounirlamouri who implemented this in https://codereview.chromium.org/980383004

By the logic of issue #696, it would seem we should instead reject all about:* instead of opening about:blank. Should the spec codify that?

@jakearchibald
Copy link
Contributor Author

Apologies for flip-flopping, but I'm no longer convinced the changes in #696 were a good idea.

Sure, clients.openWindow('about:blank') creates a window that cannot be used by the SW, and is arguably useless, but as @annevk points out, a developer would open a page on their origin that navigates to about:blank with JS, or a redirect. Or, they could do clients.openWindow('/whatever').then(c => c.navigate('about:blank')) once #681 lands.

Making openWindow accept a different set of URLs to window.open seems needlessly complicated.

@annevk
Copy link
Member

annevk commented Jun 25, 2015

It seems better if they follow the same code path as much as possible, agreed. This requires some special casing though for about:blank as bz pointed out in that bug. You want it to inherit the origin of the service worker (and likely the CSP policy, and maybe some other stuff, we should have something for that).

@jakearchibald jakearchibald added this to the Version 1 milestone Oct 28, 2015
@jakearchibald jakearchibald modified the milestones: Version 2, Version 1 Apr 11, 2016
@jakearchibald
Copy link
Contributor Author

F2F: Allowing about:blank means figuring out what origin it is, and if it's service-worker controlled. It's more complicated than it seems, and it's a real edge case. Moving to v2, since we can add it later.

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

No branches or pull requests

3 participants