State & Command Partitioning
Describe the problem
We provide many security features regarding commands, but as someone on discord recently pointed out failed to implement a fairly obvious one: State & Command Partitioning.
Every window shares the exact same set of State entries and Commands, even though logically some windows might need less privileges than others (think simple prompt windows vs the main app window)
Describe the solution you'd like
I‘d like to propose a solution similar to wasmtime::Store.
Instead of being global, a Store struct would own State and Commands. Each window would be backed by a Store, with a fallback to the global backing store of the App.
When creating windows programmatically the developer would need to pass an instance of a Store, allowing users to share the same state and commands between different windows or create a completely fresh partitioned Store.
Alternatives considered
No response
Additional context
The only weird feeling thing about this proposal is the global app backing store, does it look up state and commands recursively? Do we have app.state() and window.state() refer to different windows?