Details
-
Bug
-
Resolution: Incomplete
-
P2: Important
-
None
-
5.7.0
-
None
Description
While trying to register service worker from file:// protocol, I am getting the following error:
Failed to register a ServiceWorker: The URL protocol of the current origin ('file://') is not supported.
Code used to register service worker, as follows: (serviceworker.js is an empty file)
navigator.serviceWorker.register('./serviceworker.js') .then(function(registration) { // succeeded }) .catch(function(e) { // failed });
I've tried to enable support for file:// protocol by calling blink::WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers() with file protocol:
void ContentRendererClientQt::RenderFrameCreated(content::RenderFrame* render_frame) { new QtWebEngineCore::RenderFrameObserverQt(render_frame); // code below has been added static const char kFileSchemeQt[] = "file"; blink::WebString fileScheme(base::ASCIIToUTF16(kFileSchemeQt)); blink::WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers(fileScheme); }
however, it gives me the following error.
Failed to register a ServiceWorker: A bad HTTP response code (-1) was received when fetching the script.
Did anyone try to enable service worker with success?
Attachments
Issue Links
- relates to
-
QTBUG-62536 WebSockets not supported when loaded from non-default scheme
- Closed