Firefox already has all that. A good part of the browser is written in JS which runs with high privileges (full filesystem access, full network access, etc) while the code on websites doesn't. It already has systems for unprivileged JS to request access to certain privileged APIs (location, localStorage, etc). "Apps" - websites - are already segregated and run in their own sandbox.