Service Worker doesn’t work because dart2js doesn’t understand Promise

This issue was originally filed by segaud.k…@gmail.com


What steps will reproduce the problem?

  1. download the attached zip file
  2. launch in dartium or chrome
  3. try to change the service worker file sw.js or sw.dart

What is the expected output? What do you see instead?

If you launch in dartium with the js Service Worker it should work.
If you launch in dartium with the dart Service Worker you get an error : AbortError: The Service Worker installation failed.

If you launch in chrome with the js Service Worker you get the error : undefined is not a function on line 13
Here the register method inside ServiceWorker return normally a Future<dynamic> but instead it return a Null Object.

If you launch in chrome with the dart Service Worker your get two error :

  • undefined is not a function on line 13 the same as the javascript version
  • Operation failed by security issue

I use sdk version 1.8.5 on a windows_x64


Attachment:
testSW.zip (370.29 KB)

Author: Fantashit

1 thought on “Service Worker doesn’t work because dart2js doesn’t understand Promise

  1. Do we have an update regarding Dart Service Worker support? It would also be useful to be able to plug in any existing Service Worker code written in JavaScript via Dart/JS interop.

Comments are closed.