lundi 2 novembre 2015

Firefox addon sdk: Using small and testable / tested modules in content script

I'm in the process of making my addon code testable and to separate various functionalities.

I started to create small modules like on the sdk tutorials and to learn about addon unit testing.

But my problem is that I want to use some modules in the content script.

It looks like I cannot require them directly in the content script file so I'm wondering how to do it.

The only thing I know I could do sofar would be to have the content script send the data to be processed to the addon script where it will be processed by the module code and then receive back the output.

But it sounds really like a lot of hassle...

But the way, the functionality I'm thinking about mostly involves modifying strings on the page etc.

Maybe it's more a question of writing testable javascript code and testing it rather than addon code, but I am a newbie at both, so I'd like to know if someone could help me find where I should learn further to solve this problem.

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire