electron-sandbox-boilerplate
electron-sandbox-boilerplate copied to clipboard
Experimental feature: require = null in preload
I've added an experimental feature to the preload script that will set require() = null after it's done importing. Feedback? https://github.com/kewde/electron-sandbox-boilerplate/blob/401b293066aeb185741852f059cdf0a46e70f1bf/sandbox-preload-extended/electron/renderer/preload-extended.js#L13-L23
What I hope it will achieve: disallow the loading of other modules after this line..
This dereferences the code behind the require function, making it potentially eligible for garbage collection? The gc isn't automatically triggered tho, so something like this would be required. https://simonmcmanus.wordpress.com/2013/01/03/forcing-garbage-collection-with-node-js-and-v8/