Electrolysis compatibility shims doesn't work with evalInSandbox

Hi,

We have a rather old XUL extension which we want to make sure works with Electrolysis. We will eventually migrate it to the WebExtensions API, but for now we want to use the compatibility shims.

We can access content stuff (using window.content for example) in the some of our scripts (e.g, the overlay scripts). However, our extension also load some scripts using evalInSandbox. It look something like this:

var sandbox = Components.utils.Sandbox(Components.classes["@mozilla.org/systemprincipal;1"].createInstance(Components.interfaces.nsIPrincipal), {
			        sandboxPrototype: window,
			        wantXrays: false
		    	});
// ...
Components.utils.evalInSandbox(script, sandbox, url, 0); 

We don’t seem to be able to access window.content on the scripts loaded in the sandbox. It seem like the shims don’t work in this case. Is this a bug, or is it by design?

Thanks

try window.gBrowser.tabContainer.childNodes[tab_number_here].contentWindow

Unfortunately, this doesn’t work (contentWindow is null). Any more ideas?

If you just want to run some code in a website, its super easy to do the new way. Fork this and modify the contentscript.js file: https://github.com/Noitidart/modtools