HttpRequest
from dart:html
don't not work in web workers on Safari
#51918
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
web-dart2js
XMLHttpRequests which, according to MDN should work in regular web workers, don't work in Safari web workers when used through
dart:html
.To reproduce this issue, setup a new Dart web project from the template (
dart create -t xhr_worker
). Create a new fileweb/worker.dart
with the following content:Also, change
web/main.dart
as follows:I run this example with
dart run build_runner serve "--define=build_web_compilers:entrypoint=compiler=dart2js" web:8080
.This works in Firefox and in Chrome, but fails in Safari (throws in
_failedAsCheck
, whereobject
is anXMLHttpRequestProgressEvent
andtestRti
is the RTI forEvent
).Also, it's interesting that
J.getInterceptor$(new Event('a'))
returns a DartEvent
, butJ.getInterceptor$(object)
returns anUnknownJavaScriptObject
, even though the object is an event as well. I suspect this is because, despite these events being delivered in workers, the global scope for workers does not includeXMLHttpRequestProgressEvent
in Safari. Is there a way for the Dart SDK to work around this issue?The text was updated successfully, but these errors were encountered: