Closed Bug 1589935 Opened 5 years ago Closed 5 years ago

Erroneous "import declarations may only appear at top level of a module" for module service worker

Categories

(Core :: DOM: Service Workers, defect)

69 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1360870

People

(Reporter: alancutter, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.63 Safari/537.36

Steps to reproduce:

Register service worker as a module. Use an import statement at the top of the service worker.
Repro site: https://time-hickory.glitch.me/

Actual results:

Console errors:
SyntaxError: import declarations may only appear at top level of a module serviceworker.js:1
TypeError: ServiceWorker script at https://time-hickory.glitch.me/serviceworker.js for scope https://time-hickory.glitch.me/ encountered an error during installation.

Expected results:

Console should log success.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → DOM: Service Workers
Product: Firefox → Core

(In reply to alancutter from comment #0)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.63 Safari/537.36

Steps to reproduce:

Register service worker as a module. Use an import statement at the top of the service worker.
Repro site: https://time-hickory.glitch.me/

Actual results:

Console errors:
SyntaxError: import declarations may only appear at top level of a module serviceworker.js:1
TypeError: ServiceWorker script at https://time-hickory.glitch.me/serviceworker.js for scope https://time-hickory.glitch.me/ encountered an error during installation.

Expected results:

Console should log success.

Hi allancutter, thank you for the bug report! I believe that module Service Workers are not yet implemented in Firefox; this is tracked by bug 1360870.

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.