Using @webext-core/proxy-service, the blob data transfer is empty
Closed this issue · 1 comments
AydenGen commented
Replication with examples/vanilla-indexed-db
utils/todos-repo.ts
export interface Todo {
id: string;
title: string;
done?: boolean;
+ blob?: Blob
}
entrypoints/popup/main.ts
(async () => {
todosRepo.createOrUpdate({
id: '2',
title: 'Another TODO',
+ blob: new Blob(['Blob TODO'], { type: 'text/plain' }),
});
const all = await todosRepo.getAll();
console.log('All todos:', all);
})();
utils/todos-repo.ts
async createOrUpdate(todo) {
+ console.log('createOrUpdate', todo);
await (await db).put('todos', todo);
},
- output
{
"id": "2",
"title": "Another TODO",
"blob": {} // The blob here is an empty object.
}
aklinker1 commented
This proxy uses the browser messaging APIs, which doesn't support class instances, like blobs. You can only pass primitives, arrays, or objects.
Transferring blobs is only supported by the window.postMessage
API, which is completely unrelated to this library.