[Webkit-unassigned] [Bug 226637] New: Worker.constructor throws an exception when the url param is an empty string

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jun 4 02:58:42 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=226637

            Bug ID: 226637
           Summary: Worker.constructor throws an exception when the url
                    param is an empty string
           Product: WebKit
           Version: WebKit Local Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKitGTK
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: zyscoder at gmail.com
                CC: bugs-noreply at webkitgtk.org

Steps to reproduce:

(1) Open a tab and navigate to any URL;
(2) Run the following code in the Console of Devtools:
```
new Worker("")
```
(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:

For EventSource.constructor, 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.

I think the URL script param of Worker.constructor should be parsed as a relative URL to the API's URL too.
In my test, both Chrome and Firefox would not throw the SyntaxError exception and would parse it as the relative URL when evaluating this code.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210604/c7b8e198/attachment.htm>


More information about the webkit-unassigned mailing list