Symfony version(s) affected
7.4.0 | 8.0
Description
Tested on Firefox For Developers 147.0b1 it that matters
WebDebugToolbar's JS code throws this Error when URL object is used to initialize EventSource
Uncaught TypeError: url.match is not a function
JS console points at column 16247 of WebDebugToolbar's JS code:
if (!url.match(new RegExp("^\/((index|app(_[\\w]+)?)\\.php\/)?_wdt"))) {
....
}
How to reproduce
src/Controller/ExampleController.php
extends AbstractController
#[Route(methods: 'GET', path: '/example')]
public function example(): Response {
return $this->render('example.html.twig');
}
templates/example.html.twig
{% extends 'base.html.twig' %}
{% block importmap %}
{{ importmap('example') }}
{% endblock %}
importmap.php
return [
'example' => [
'path' => 'assets/example.js',
'entrypoint' => true
]
];
assets/example.js
let ES = new EventSource(new URL('https://example.com'));
Possible Solution
Handle 'url' variable being of URL type here