Node has done a lot of work in defining a runtime outside of the browser. I'm guessing much of this work would need to be done with spidermonkey in order to match common functionality. It'd also help out an electron equivalent for gecko, too.
My ideal model would be having one piece of trusted javascript which works similar to web extensions which can control the window, trigger navigations, approve or deny permission requests by origins and can interact with the current web control. Any advanced integration with the host operating system would happen though the local webserver (which could be implemented in node.js if that's your thing, or in C#, Rust...). This would not require many changes to a browser runtime.