I am using a **custom require** function which mimics [nodejs require](https://github.com/joyent/node/blob/master/lib/module.js#L275) and it works fine.

However, in **electron**, I get 

```
SecurityError: An attempt was made to break through the security policy of the user agent.

```

when calling `window.addEventListener` inside the custom-required code.

If I could read the source code for electron's 'require' function, I could probably understand why my version fails.