-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add SharedMemory service #1208
Add SharedMemory service #1208
Conversation
852e689
to
a723d87
Compare
a723d87
to
b4a68c5
Compare
type Base64 = string | ||
|
||
export const scanDocument = async (): Promise<Base64 | undefined> => { | ||
try { | ||
removeSharedMemory('mespapiers', 'scanDocument') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want to clear this before doing the OS scan (that may produce memory flush too)? Would it be better to do this the later we can?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by memory flush ?
It has no meaning to do this cleaning later. But this cleaning is not necessary. It is just that if we are in this function this value has no meaning anymore because we overwrite it a few lines later.
Maybe I can remove it.
e6a4432
to
8392671
Compare
This SharedMemory service is an in memory store used to store data that can be retrieved later by Cozy webviews.
Sometimes, the operating system kill the mespapiers webview during a 'scanDocument' due to memory constraints. But the 'scanDocument' still run successfully. So we store the result in SharedMemory service so that the mespapiers webview will be able to retrieve it when it will be reloaded by the SupervisedWebview.
To improve security, we want to be sure that a webview only read the shared memory from this webview. So we check the slug added by cozy-intent. We also need to register this slug.
8392671
to
66c2949
Compare
Related to this PR : cozy/cozy-libs#2540
Checklist
Before merging this PR, the following things must have been done if relevant:
Todo
Merge cozy/cozy-libs#2548 and update cozy-intent