-
Notifications
You must be signed in to change notification settings - Fork 17k
Closed
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
Issue Details
- Electron Version:
- 7.0.0-beta.4
- Operating System:
- macOS 10.14.6
- Last Known Working Electron version:
- NA
Expected Behavior
Serve up a simple html page inside an iframe using a custom protocol (test-scheme in this example). The html page should be able to register a service worker to handle requests
Here's the example main process code:
protocol.registerSchemesAsPrivileged([
{ scheme: 'test-scheme', privileges: { allowServiceWorkers: true, standard: true, secure: true } }
]); protocol.registerStringProtocol('test-scheme, (request, cb) => {
cb({
mimeType: 'text/html',
charset: 'utf-8',
data: `<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Heey World!</title>
</head>
<body>
Hello iframe!
<script>
window.navigator.serviceWorker.register('service-worker.js', {scope: './'}).then(function(registration) {
console.log('All good')
})
</script>
</body>
</html>`
})
});Actual Behavior
The service worker cannot be registered. In the dev tools console, I see the error:
DOMException: Failed to register a ServiceWorker: The document is in an invalid state.
To Reproduce
Use the electron fiddle: https://gist.github.com/98ead2337cf17febffa64f731a8cc3e8
Look at the devtools output to see the errors
Screenshots
Additional Information
/cc @deepak1556 - This is blocks migrating VS Code to use normal iframes for its webviews
Reactions are currently unavailable