Reputation: 145
I'm a bit confused, and I think I'm just confusing myself more.
Firefox apparently does not support ECMAScript modules inside Workers, however I'm getting inconsistent performance with it. I have a project that uses Comlink and ES6 modules. When I ran it in Firefox, it seemed to work fine.
... Until yesterday, we had a client on Firefox 100 who's getting DataCloneError: The object could not be cloned.
. I've installed numerous versions of Firefox on numerous devices, and I can't seem to recreate the issue. I had the client reset their browser, but no luck fixing it.
My Comlink worker is something like this:
import { FetchFromId } from "./deobf";
export const Fetch = async (id: string): Promise<CustomObject | Error> => {
return FetchFromId(id);
};
And it's called like this:
import { FetchFromId } from "./deobf";
if (window.Worker) {
WORKER = new ComlinkWorker<typeof import('./worker')>(new URL('./worker', import.meta.url), { type: "module" });
}
const res = await (WORKER ? WORKER.Fetch(id) : FetchFromId(id)); // DataCloneError: The object could not be cloned
(ComlinkWorker
is from here)
When I run this in Firefox 100, should it not throw an error because it's not supported?
Upvotes: 0
Views: 713