Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service Workers are not supported #920

Open
happybeing opened this issue Aug 4, 2019 · 8 comments
Open

Service Workers are not supported #920

happybeing opened this issue Aug 4, 2019 · 8 comments

Comments

@happybeing
Copy link

An app which works in mock fails when the origin is a safe:// URI. Here's the error message:

serviceWorker.ts:97 Error during service worker registration: DOMException: Failed to register a ServiceWorker: The URL protocol of the current origin ('safe://solid-filemanager') is not supported

This may be an electron issue, see: electron/electron#2831

You can reproduce the error by choosing a WebID, visiting safe://solid-filemanager, waiting for the app to load and a popup to appear, and then clicking Login. The code is at https://github.com/theWebalyst/solid-filemanager/blob/master/src/serviceWorker.ts

I'm using SB v0.14.1 on Ubuntu 18.10.

Any short term fudge I could try here?

@joshuef
Copy link
Collaborator

joshuef commented Aug 12, 2019

Reads like we'll just need to update the options we provide to https://electronjs.org/docs/api/protocol#protocolregisterschemesasprivilegedcustomschemes

That should work. And if it does, I don't have any objection to getting this merged in!

@happybeing
Copy link
Author

Hi Josh,

I tried

protocol.registerSchemesAsPrivileged( [ {scheme: PROTOCOLS.SAFE, privileges: { allowServiceWorkers: true } } ] );

But this API doesn't exist pre v5 and SB is using v4. So I went looking for docs on registerServiceWorkerSchemes(). I didn't find the API docs, but the following suggests it doesn't work yet anyway so this may not be fixable:

See electron/electron#9663 (comment)

@joshuef
Copy link
Collaborator

joshuef commented Aug 14, 2019

Aha. Righto. Okay, well the upgrade path to e5/6 + will involve some FFI changes to safe_app nodejs. That's not a prio right now with the new APIs we're working on. But they'll be built for N-API which is good to go w/ newer electron versions.

So there's not much to be done right now I think, sorry @theWebalyst

@happybeing
Copy link
Author

No problem. Thanks for looking.

@johannesjo
Copy link

johannesjo commented Feb 16, 2020

@joshuef any update on this?

There are many open issues regarding this in all sorts of different shades. Currently it seems that there is no sensible way to service workers work when serving from the local file system.

electron/electron#9705
electron/electron#2831
electron/electron#10146
electron/electron#14885
electron/electron#20248

@marciot
Copy link

marciot commented Jun 22, 2020

I'm curious what is the latest status on this. Is it correct to assume that at this point, service workers cannot be used in Electron apps that run from local files?

@happybeing
Copy link
Author

Looks like a fix for this has been merged!

electron/electron#20248 (reference)

@joshuef
Copy link
Collaborator

joshuef commented May 17, 2021

sorry @johannesjo for the radio silence. browser has been fairly backburner lately (and then i've been on paternity).

Looks like this'll get solved when we're able to upgrade to latest electron if that fix sorts things. Browser is still reasonably backburner though atm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants