not transfer data to worker for safety
This commit is contained in:
parent
ac9c2a9248
commit
74e5231861
@ -202,7 +202,7 @@ export class CipherRclone {
|
|||||||
},
|
},
|
||||||
[
|
[
|
||||||
channel.port1,
|
channel.port1,
|
||||||
// input // the array buffer might be re-used later, so we CANNOT transform here
|
// input // the array buffer might be re-used later, so we CANNOT transfer here
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -247,8 +247,10 @@ export class CipherRclone {
|
|||||||
action: "decryptContent",
|
action: "decryptContent",
|
||||||
inputContent: input,
|
inputContent: input,
|
||||||
},
|
},
|
||||||
// the decrypted result is not used later in worker, so it's save to transfer
|
[
|
||||||
[channel.port1, input]
|
channel.port1,
|
||||||
|
input, // not transfer for safety
|
||||||
|
]
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -141,7 +141,7 @@ ctx.addEventListener("message", async (event: any) => {
|
|||||||
status: "ok",
|
status: "ok",
|
||||||
outputContent: outputContent,
|
outputContent: outputContent,
|
||||||
},
|
},
|
||||||
[outputContent]
|
[outputContent] // on worker side, we don't reuse anything so it's safe to transfer
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -166,7 +166,7 @@ ctx.addEventListener("message", async (event: any) => {
|
|||||||
status: "ok",
|
status: "ok",
|
||||||
outputContent: outputContent,
|
outputContent: outputContent,
|
||||||
},
|
},
|
||||||
[outputContent]
|
[outputContent] // on worker side, we don't reuse anything so it's safe to transfer
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user