Unable to disable Compatibility shims

Hello. I’m wondering if someone can help me.

I’m trying to test multi-process support in my addon with compatibility shims disabled, but I can’t actually get them to disable in the Windows 64-bit nightly build.

I set the multiprocessCompatible flag to true in the install manifest of my addon and installed it and it worked fine, which I know is wrong because the addon interacts with browser windows.

I opened Scratchpad and evaluated “gBrowser.contentWindow;” in the browser environment and it returns a window object. I expected it to return null.

Is there something else I need to do here?

Setting the multiprocessCompatible flag in install.rdf will not affect scratchpad. Shims from your addon will be disabled though, so if you try to do var gbrow = Services.wm.getMostRecentWindow('navigator:browser).gBrowser; then try to get into content like gbrow.contentWindow you will get null.

Scratchpad is running within the content process it looks like. For sure though, your manifest/install.rdf flags will have no effect on it.

Thanks for responding.

I think I figured out why things I thought shouldn’t be working actually are. The only things that are actually affected are trying to directly access data from web pages. I was expecting not to be able to do any type of content overlay on the browser window, which is not the case.

That actually greatly simplifies things and I’ve found the vast majority of my add-on works without modification.

Yep you are correct. The only issue is injecting code/styles into the web pages. You can access gBrowser and go throuh all the tabs to figure out what page is loaded with gBrowser.tabContainer.childNodes[0].linkedBrowser.currentURI. Cool stuff.

You can see where you need to modify code by leaving the shims enabled, then looking in the console log for messages about CPOWs. Each of those (in your addon) is a use of a shim. It is unlikely that you will be using a CPOW “safely” so once you get rid of all the warnings, you should be able to turn off the shims.

There are a great many things, other than injecting into content, that will use CPOWs, like just looking at content. There are also a great many things that don’t use CPOWs but will break anyway in multiprocess mode, like certain events and observer notifications you won’t get any more.

Just have to test, I guess :slight_smile:

1 Like