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

Should throw for window.open when URL fails to parse #2490

Closed
zcorpan opened this issue Mar 31, 2017 · 19 comments
Closed

Should throw for window.open when URL fails to parse #2490

zcorpan opened this issue Mar 31, 2017 · 19 comments
Labels
interop Implementations are not interoperable with each other needs compat analysis

Comments

@zcorpan
Copy link
Member

zcorpan commented Mar 31, 2017

See http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4996

Edge and Gecko throw some exception. WebKit and Chromium return null. We typically throw for APIs when URLs fail to parse, it seems reasonable to do that here as well.

cc @lyzadanger

@zcorpan zcorpan added the interop Implementations are not interoperable with each other label Mar 31, 2017
@zcorpan
Copy link
Member Author

zcorpan commented Mar 31, 2017

Should be "SyntaxError" DOMException for consistency with other APIs.

@annevk
Copy link
Member

annevk commented Mar 31, 2017

@cdumez @jeisinger, thoughts?

@cdumez
Copy link

cdumez commented Mar 31, 2017

I'm willing to give it a try in WebKit if Blink is on board too.

@lyzadanger
Copy link

@annevk I'm fine with this—certainly easier to test for!

@jeisinger
Copy link
Member

I think we'd like to have some kind of indication of how many sites will be affected by this change before committing to ship it

@zcorpan
Copy link
Member Author

zcorpan commented Apr 3, 2017

@jeisinger can you (find someone to) add a use counter?

@jeisinger
Copy link
Member

yeah, will do

@zcorpan
Copy link
Member Author

zcorpan commented Apr 3, 2017

Great, thanks. Let me know when it reaches stable. Then we can also check httparchive instances that trigger the use counter (if there are any).

@foolip
Copy link
Member

foolip commented Apr 4, 2017

window.open() is probably called from a click event handler, not during the initial load, so I don't think HTTP Archive will help here.

@zcorpan
Copy link
Member Author

zcorpan commented Apr 4, 2017

Ah right. Hmmm. I suppose use counter + the fact that it already throws in 2 browsers should be enough.

@annevk
Copy link
Member

annevk commented Apr 4, 2017

It already seems to throw somewhat unreliably due to the exceptions from navigate, but if we think it's safer to return null instead I'd be happy to align on that too. Currently neither behavior is defined (and instead something else is required).

@jeisinger
Copy link
Member

btw, looking at the blink sources, if you specify a target frame, then we'll return that frame instead of null for an invalid url. Is that expected?

@zcorpan
Copy link
Member Author

zcorpan commented Apr 4, 2017

I tested that in the link given in the OP. I get null in Chromium and WebKit for the iframe case. Is there another case where it does not return null?

@jeisinger
Copy link
Member

sorry, I confused invalid with empty URL.

For completeness, _parent and _top are treated differently by blink, so WPT should cover those cases as well

@jeisinger
Copy link
Member

jeisinger commented Apr 4, 2017

@jeisinger
Copy link
Member

use counter is pretty much 0%: https://www.chromestatus.com/metrics/feature/timeline/popularity/1909

we can still wait until it hits stable channel, but I think it's ok to just move forward here

@annevk
Copy link
Member

annevk commented May 4, 2017

I filed https://bugs.webkit.org/show_bug.cgi?id=171656 against WebKit.

@domenic
Copy link
Member

domenic commented May 4, 2017

Both Edge and Gecko fire the wrong exception type, so bugs on them would be good too.

inikulin pushed a commit to HTMLParseErrorWG/html that referenced this issue May 9, 2017
inikulin pushed a commit to HTMLParseErrorWG/html that referenced this issue May 9, 2017
alice pushed a commit to alice/html that referenced this issue Jan 8, 2019
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 needs compat analysis
Development

No branches or pull requests

7 participants