| Summary: | EventSource.constructor throws an exception when the url param is an empty string | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | zyscoder <zyscoder> | ||||||
| Component: | WebCore Misc. | Assignee: | Alex Christensen <achristensen> | ||||||
| Status: | RESOLVED FIXED | ||||||||
| Severity: | Normal | CC: | achristensen, bugs-noreply, darin, mcatanzaro, sam, webkit-bug-importer, youennf, ysuzuki | ||||||
| Priority: | P2 | Keywords: | InRadar | ||||||
| Version: | WebKit Local Build | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Attachments: |
|
||||||||
Created attachment 430597 [details]
Patch
Seems like an easy enough fix. Let's see if we already have tests that cover this. Comment on attachment 430597 [details]
Patch
r=me
Created attachment 430626 [details]
Patch
Looks like Yusuke already reviews, so don’t really need my review too, but I saw a review? |
Steps to reproduce: (1) Open a tab and navigate to any URL; (2) Run the following code in the Console of Devtools: ``` new EventSource("") ``` (3) Then this code would throw a SyntaxError exception. Actual results: This code would throw a SyntaxError exception: `SyntaxError: The string did not match the expected pattern.` Expected results: As https://html.spec.whatwg.org/multipage/server-sent-events.html#dom-eventsource says, when the URL param is an empty string, it should be parsed as a relative URL to the API's URL. In fact, Firefox works as the spec says, and Chrome has fixed this problem following the spec nowadays too.