Worker.constructor miss checking for the type of options.type param
Categories
(Core :: DOM: Workers, enhancement)
Tracking
()
People
(Reporter: zyscoder, Unassigned)
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36
Steps to reproduce:
(1) Open a tab and navigate to any URL;
(2) Run the following code in the Console of Devtools:
new Worker(origin,{type:'any_str'});
(3) Then this code would be evaluated successfully without throwing any exceptions.
Actual results:
This code would be evaluated successfully without throwing any exceptions.
Expected results:
As https://html.spec.whatwg.org/multipage/workers.html#workertype says, options.type param is of WorkerType: enum WorkerType { "classic", "module" };
. Since this code set the type as "any_str", not any member in the WorkerType enum, a TypeError exception should be thrown.
BTW, in my test, both Chrome and Webkit throw TypeRrror exceptions:
For Chrome: VM183:1 Uncaught TypeError: Failed to construct 'Worker': The provided value 'any_str' is not a valid enum value of type WorkerType.
For Webkit: TypeError: Type error
Comment 1•3 years ago
|
||
Thanks for the report. Firefox doesn't yet support type
, because only "classic" workers are supported at the moment.
Description
•