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

SW: Add secure headers and clean up #24217

Merged
merged 8 commits into from
Sep 29, 2022
Merged

SW: Add secure headers and clean up #24217

merged 8 commits into from
Sep 29, 2022

Conversation

LeviPesin
Copy link
Contributor

Fixes #24212

Description

Add the required secure headers to the editor's service worker and clean up it.

@mattrossman Please confirm this works.

@mattrossman
Copy link
Contributor

I'm testing it here: https://rawcdn.githack.com/LeviPesin/three.js-1/a0f8cbd345e98f3e9ecf3fc1bf922add84d98905/editor/index.html

It isn't working for me.

The FetchEvent for "https://rawcdn.githack.com/LeviPesin/three.js-1/a0f8cbd345e98f3e9ecf3fc1bf922add84d98905/editor/index.html" resulted in a network error response: a Response whose "body" is locked cannot be used to respond to a request.

The trace points to this line:

https://github.com/LeviPesin/three.js-1/blob/a0f8cbd345e98f3e9ecf3fc1bf922add84d98905/editor/sw.js#L257

Perhaps there is some additional code from coi-serviceworker that should be copied over.

@LeviPesin
Copy link
Contributor Author

Should be fixed now.

@mattrossman
Copy link
Contributor

@LeviPesin
Copy link
Contributor Author

It seems that unpkg does not provide CORP header, so we cannot use COEP: require-corp and should use the new COEP: credentialless.

@LeviPesin
Copy link
Contributor Author

But it still does not work... I am unsure why.

@mattrossman
Copy link
Contributor

In my case mattrossman@bc818a7 I had to copy the two libs (ffmpeg.wasm and es-module-shims) from unpkg locally. Working demo.

@LeviPesin
Copy link
Contributor Author

I think @mrdoob should decide should we keep these libs locally, investigate ways to enable the SW to work with cross-origin requests, or just use a non-SharedArrayBuffer version.

@mrdoob
Copy link
Owner

mrdoob commented Jun 10, 2022

Is the non-SharedArrayBuffer version 10x slower or something? 🤔

@LeviPesin
Copy link
Contributor Author

I think it is exactly number-of-coresX slower, because SharedArrayBuffer allows multithreading. I think we can actually keep the libs like we do with the other libs?

@mrdoob
Copy link
Owner

mrdoob commented Jun 13, 2022

Alright, lets host the libraries then 👍

@LeviPesin
Copy link
Contributor Author

Done.

@LeviPesin
Copy link
Contributor Author

Is there something preventing merging this PR?

@LeviPesin
Copy link
Contributor Author

@mrdoob Can this PR be merged, please?

@LeviPesin
Copy link
Contributor Author

@mrdoob @Mugen87 Something preventing the merge?

@mrdoob
Copy link
Owner

mrdoob commented Sep 29, 2022

Sorry for the delay!

@mrdoob mrdoob added this to the r145 milestone Sep 29, 2022
@mrdoob mrdoob merged commit 3f632d3 into mrdoob:dev Sep 29, 2022
@mrdoob
Copy link
Owner

mrdoob commented Sep 29, 2022

Thanks!

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

Successfully merging this pull request may close these issues.

Editor: Video renderer no longer available in Chrome
3 participants