RESOLVED FIXED 226635
EventSource.constructor throws an exception when the url param is an empty string
https://bugs.webkit.org/show_bug.cgi?id=226635
Summary EventSource.constructor throws an exception when the url param is an empty st...
zyscoder@gmail.com
Reported 2021-06-04 02:46:36 PDT
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.
Attachments
Patch (1.25 KB, patch)
2021-06-04 12:08 PDT, Alex Christensen
no flags
Patch (3.67 KB, patch)
2021-06-04 15:56 PDT, Alex Christensen
darin: review+
Alex Christensen
Comment 1 2021-06-04 12:08:52 PDT
Alex Christensen
Comment 2 2021-06-04 12:09:11 PDT
Seems like an easy enough fix. Let's see if we already have tests that cover this.
Yusuke Suzuki
Comment 3 2021-06-04 12:16:11 PDT
Comment on attachment 430597 [details] Patch r=me
Alex Christensen
Comment 4 2021-06-04 15:56:50 PDT
Darin Adler
Comment 5 2021-06-06 23:55:47 PDT
Looks like Yusuke already reviews, so don’t really need my review too, but I saw a review?
Radar WebKit Bug Importer
Comment 6 2021-06-11 02:47:16 PDT
Alex Christensen
Comment 7 2021-06-11 09:15:24 PDT
Note You need to log in before you can comment on or make changes to this bug.