mozilla / positron

a experimental, Electron-compatible runtime on top of Gecko
Other
562 stars 64 forks source link

loading renderer modules in single sandbox throws "TypeError: 'get location' called on an object that does not implement interface Window." #93

Closed mykmelez closed 8 years ago

mykmelez commented 8 years ago

In the renderer process, we can't yet load all modules in a single sandbox, because attempts to reference Window properties on the target object then throw errors like: TypeError: 'get location' called on an object that does not implement interface Window.

This is described as "TypeError: invalid Array.prototype.sort argument" in the MDN docs on the error. But that's clearly not the issue here. Some code is deciding that the target object doesn't implement Window, even though its prototype is a Window instance.

Whereas that code does think that a sandbox with a Window prototype implements Window. So we work around the problem by loading modules in their own sandboxes in renderer processes. But we should resolve the underlying issue so we can load them in the same sandbox to avoid issues like #45, which we worked around in #26.

(That issue happens to be specific to the main process. But similar issues could crop up in the renderer process.)